From d9958d7c67507baa74b272a093210530efbc2a11 Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Tue, 24 Mar 2020 12:04:43 +0100 Subject: [PATCH] v0.2.9.2 NEW: add an output in the server file to show in the GUI the summary sheet corresponding to the selected dataset #10 --- DESCRIPTION | 2 +- NEWS.md | 2 +- inst/ShinyGR/server.R | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d407fdd..f74b057 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGRteaching Type: Package Title: Teaching Hydrological Modelling with the GR Rainfall-Runoff Models ('Shiny' Interface Included) -Version: 0.2.9.1 +Version: 0.2.9.2 Date: 2020-03-24 Authors@R: c( person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"), diff --git a/NEWS.md b/NEWS.md index 4b2b5f6..1696f45 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ -### 0.2.9.1 Release Notes (2020-03-24) +### 0.2.9.2 Release Notes (2020-03-24) ____________________________________________________________________________________ diff --git a/inst/ShinyGR/server.R b/inst/ShinyGR/server.R index 2107c38..c1147c1 100644 --- a/inst/ShinyGR/server.R +++ b/inst/ShinyGR/server.R @@ -764,6 +764,8 @@ shinyServer(function(input, output, session) { + + ## --------------- Criteria table output$Criteria <- renderTable({ @@ -962,5 +964,41 @@ shinyServer(function(input, output, session) { ) + + ## --------------- Summary sheet + + output$Sheet <- renderUI({ + codeRegex <- "\\D{1}\\d{7}" + codeBH <- gsub(sprintf("(.*)(%s)(.*)", codeRegex), "\\2", input$DatasetSheet) + urlRegex <- "https://webgr.inrae.fr/wp-content/uploads/fiches/%s_fiche.png" + urlSheet <- sprintf(urlRegex, codeBH) + if (.CheckUrl(urlSheet)) { + tags$p(tags$h6("Click on the image to open it in a new window and to enlarge it."), + tags$a(href = urlSheet, target = "_blank", rel = "noopener noreferrer", + tags$img(src = urlSheet, height = "770px", + alt = sprintf("Go to webGR.inrae.fr to see %s in the activities/database section", codeBH), + title = "Click to open in a new window"))) + } else { + urlSheet <- sprintf(urlRegex, "W1110010") + urlWebGR <- "https://webgr.inrae.fr" + txtWebGR <- "webgr.inrae.fr" + urlFraDb <- file.path(urlWebGR, "activites/base-de-donnees/") + txtFraDb <- "All the summary sheets are available on" + tags$p(tags$h1("Sorry, the summary sheet is not available for this dataset."), + tags$br(), + tags$h5("Only sheets of stations of the Banque Hydro French database are available."), + tags$h5("To show a summary sheet, the name of the choosen dataset has to contain the Banque Hydro station code (8 characters : 1 letter and 7 numbers)."), + txtFraDb, tags$a(href = urlFraDb, target = "_blank", rel = "noopener noreferrer", txtWebGR), ".", + tags$br(), + tags$br(), + tags$a(href = urlFraDb, target = "_blank", rel = "noopener noreferrer", + tags$img(src = urlSheet, width = "30%", height = "30%", + alt = txtWebGR, + title = paste("Visit", txtWebGR)))) + } + }) + + + }) -- GitLab