From c3f085976c7892a62fd02f49b8c22559263350d5 Mon Sep 17 00:00:00 2001 From: Maxime Wack Date: Thu, 13 Apr 2017 18:08:05 +0200 Subject: [PATCH] =?UTF-8?q?Remplacement=20du=20t=C3=A9l=C3=A9chargement=20?= =?UTF-8?q?par=20publication=20et=20archivage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.rmd | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/index.rmd b/index.rmd index 272bbc7..5b288e0 100644 --- a/index.rmd +++ b/index.rmd @@ -70,7 +70,7 @@ inputPanel( ) inputPanel( fileInput("exhau_pims", "Fichier d'exhaustivité", accept = "text/csv"), - downloadButton("report", "Télécharger le rapport") + actionButton("publish", "Publier et archiver le rapport") ) # Récupération des fichiers ePMSI ---- @@ -304,20 +304,27 @@ periode <- reactive({ ``` ```{r report} -output$report <- downloadHandler(filename = "bilan.html", - content = function(file) - { - rmarkdown::render("cloture.Rmd", - output_file = file, - params = list(annee = input$annee, - mois = input$mois, - rum = rum(), - rss = rss(), - exhau = exhau(), - exhau_pims = exhau_pims(), - Ovalide = tibble::data_frame(nom = names(Ovalide()), tab = Ovalide()), - OvalideP = tibble::data_frame(nom = names(OvalideP()), tab = OvalideP()))) - }) +observeEvent(input$publish, + { + req(input$annee, input$mois, exhau(), rum(), rss(), exhau_pims(), Ovalide(), OvalideP()) + + + rmarkdown::render("cloture.Rmd", + output_file = "cloture.html", + params = list(annee = input$annee, + mois = input$mois, + rum = rum(), + rss = rss(), + exhau = exhau(), + exhau_pims = exhau_pims(), + Ovalide = tibble::data_frame(nom = names(Ovalide()), tab = Ovalide()), + OvalideP = tibble::data_frame(nom = names(OvalideP()), tab = OvalideP()))) + file.copy("cloture.html", str_c("/var/www/html/cloture/archive/cloture", input$annee, "_", str_pad(input$mois, 2, "left", "0"), ".html"), overwrite = T) + file.copy("cloture.html", str_c("archive/cloture", input$annee, "_", str_pad(input$mois, 2, "left", "0"), ".html"), overwrite = T) + file.copy("cloture.html", "/var/www/html/cloture/", overwrite = T) + + showModal(modalDialog(title = "Publication", p("Fichier archivé et publié, disponible", a("ici", href = "https://livenne.chu-nancy.fr/sitedim/index.php/clot/bilan")), easyClose = T)) + }) ``` ## Rapport