Maintenance - Mise à jour mensuelle Lundi 6 Avril 2020 entre 7h00 et 9h00

owncss.R 2.32 KB
Newer Older
fsoubes's avatar
fsoubes committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#Source https://stackoverflow.com/questions/33839543/shiny-server-session-time-out-doesnt-work
# but seems to not work

inactivity <- "function idleTimer() {
  var t = setTimeout(logout, 5000);
  window.onmousemove = resetTimer; // catches mouse movements
  window.onmousedown = resetTimer; // catches mouse movements
  window.onclick = resetTimer;     // catches mouse clicks
  window.onscroll = resetTimer;    // catches scrolling
  window.onkeypress = resetTimer;  //catches keyboard actions

  function logout() {
    window.close();  //close the window
  }

  function resetTimer() {
    clearTimeout(t);
    t = setTimeout(logout, 5000);  // time is in milliseconds (1000 is 1 second)
  }
}
idleTimer();"

#The following html are sourced from https://github.com/aghozlane/shaman/blob/master/css/owncss.R
fsoubes's avatar
fsoubes committed
24

fsoubes's avatar
fsoubes committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
spincss <- "
  #plot-container {
z-index: 0;
position: relative;
}
#loading-spinner {
position: absolute;
left: 50%;
top: 50%;
z-index: -1;
margin-top: 33px;  /* half of the spinner's height */
margin-left: -33px; /* half of the spinner's width */
}
.recalculating {
z-index: -2;
background-color: #fff;
}
"

fsoubes's avatar
fsoubes committed
44 45
Errorcss <-
".shiny-output-error { visibility: visible;  color: orange; font-size: larger;}
fsoubes's avatar
fsoubes committed
46

fsoubes's avatar
fsoubes committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
.shiny-output-error:before {
color: #3c8dbc;
visibility: visible;
#content: 'An error occurred. Please contact us at franck.soubes@inra.fr'; }
content: 'ok'; }
}
"


appCSS <- "
#loading-content {
position: absolute;
background: #182b42;
opacity: 0.9;
z-index: 100;
left: 0;
right: 0;
top: 30px;
height: 100%;
text-align: center;
color: #FFFFFF;
}
#loading-content-bar {
position: absolute;
background: #182b42;
opacity: 0.9;
z-index: 100;
left: 0;
right: 0;
height: 100%;
text-align: center;
color: #FFFFFF;
}
"

gaugeCSS <- "
.html-widget.gauge svg {
    height: 100%;
margin-top: -10px;
margin-bottom: -40px;
}
"


#' addNews is a function that render a pretty table for news
#'
fsoubes's avatar
fsoubes committed
93 94 95 96
#' @param date
#' @param title
#' @param text
#' @author Amine Ghozlane
fsoubes's avatar
fsoubes committed
97 98 99 100 101 102
#' Source https://github.com/aghozlane/shaman/blob/master/Rfunctions/Data_Management.R
#'
#' @return
#' @export
#'
#' @examples
fsoubes's avatar
fsoubes committed
103
#'
fsoubes's avatar
fsoubes committed
104 105
addNews <- function(date ="",title="",text="")
{
fsoubes's avatar
fsoubes committed
106 107


fsoubes's avatar
fsoubes committed
108 109 110
  res=list()
  res$r1 = paste("<b><font size='+1'>",date,"</font></b>", " - ", "<b><font size='+1'>",title,"</font></b><br/>")
  res$r2 = paste("<p><font color='grey'>",text,"</font></p><hr/>")
fsoubes's avatar
fsoubes committed
111

fsoubes's avatar
fsoubes committed
112 113
  return(HTML(unlist(res)))
}