Title: | File Sharing Shiny Module |
---|---|
Description: | Shiny module for easily sharing files between users. Admin can add, remove, edit and download file. User can only download file. It's also possible to manage files using R functions directly. |
Authors: | Benoit Thieurmel [aut, cre], Thibaut Dubois [aut] |
Maintainer: | Benoit Thieurmel <[email protected]> |
License: | GPL-3 |
Version: | 0.1.3 |
Built: | 2024-11-20 05:05:42 UTC |
Source: | https://github.com/cran/shinydrive |
Add / suppress / edit a file
add_file_in_dir( file, dir, yml, name, description = "", date_time_format = "%Y%m%d_%H%M%s" ) edit_file_in_dir( id, dir, yml, name = NULL, description = NULL, file = NULL, date_time_format = "%Y%m%d_%H%M%s" ) suppress_file_in_dir(id, dir, yml) get_yaml_info( yml, recorded_name = TRUE, date_time_format = "%Y%m%d_%H%M%s", add_img = FALSE, img_size = 30 )
add_file_in_dir( file, dir, yml, name, description = "", date_time_format = "%Y%m%d_%H%M%s" ) edit_file_in_dir( id, dir, yml, name = NULL, description = NULL, file = NULL, date_time_format = "%Y%m%d_%H%M%s" ) suppress_file_in_dir(id, dir, yml) get_yaml_info( yml, recorded_name = TRUE, date_time_format = "%Y%m%d_%H%M%s", add_img = FALSE, img_size = 30 )
file |
|
dir |
|
yml |
|
name |
|
description |
|
date_time_format |
|
id |
|
recorded_name |
|
add_img |
|
img_size |
|
These functions return a logical
indicating if operation succeeded or not
## Not run: yml <- file.path(getwd(), "test_sfm/config.yml") # will be created dir <- file.path(getwd(), "test_sfm") dir.create(dir) file <- system.file("translate/translate.csv", package = "shinydrive") # add one first file add_file_in_dir( file = file, dir = dir, yml = yml, name = "translate1", description = "" ) yaml::yaml.load_file(yml) list.files(dir) get_yaml_info(yml) # add second file add_file_in_dir( file = file, dir = dir, yml = yml, name = "translate_2", description = "This is cool" ) yaml::yaml.load_file(yml) list.files(dir) get_yaml_info(yml, recorded_name = F) # modify first file edit_file_in_dir( id = "2", dir = dir, yml = yml, name = "translate_2_mod", description = "So cool" ) yaml::yaml.load_file(yml) list.files(dir) # suppress first file suppress_file_in_dir(id = "1", dir = dir, yml = yml) yaml::yaml.load_file(yml) list.files(dir) ## End(Not run)
## Not run: yml <- file.path(getwd(), "test_sfm/config.yml") # will be created dir <- file.path(getwd(), "test_sfm") dir.create(dir) file <- system.file("translate/translate.csv", package = "shinydrive") # add one first file add_file_in_dir( file = file, dir = dir, yml = yml, name = "translate1", description = "" ) yaml::yaml.load_file(yml) list.files(dir) get_yaml_info(yml) # add second file add_file_in_dir( file = file, dir = dir, yml = yml, name = "translate_2", description = "This is cool" ) yaml::yaml.load_file(yml) list.files(dir) get_yaml_info(yml, recorded_name = F) # modify first file edit_file_in_dir( id = "2", dir = dir, yml = yml, name = "translate_2_mod", description = "So cool" ) yaml::yaml.load_file(yml) list.files(dir) # suppress first file suppress_file_in_dir(id = "1", dir = dir, yml = yml) yaml::yaml.load_file(yml) list.files(dir) ## End(Not run)
File management shiny module.
shiny_drive_ui(id) shiny_drive_server( input, output, session, id, save_dir, dir_access = NULL, admin_user = TRUE, force_desc = FALSE, lan = "EN", file_translate = read.csv(system.file("translate/translate.csv", package = "shinydrive"), sep = ";", encoding = "UTF-8", check.names = FALSE), datatable_options = list(), yml = "files_desc.yaml", date_time_format = "%Y%m%d_%H%M%s" )
shiny_drive_ui(id) shiny_drive_server( input, output, session, id, save_dir, dir_access = NULL, admin_user = TRUE, force_desc = FALSE, lan = "EN", file_translate = read.csv(system.file("translate/translate.csv", package = "shinydrive"), sep = ";", encoding = "UTF-8", check.names = FALSE), datatable_options = list(), yml = "files_desc.yaml", date_time_format = "%Y%m%d_%H%M%s" )
id |
|
input |
shiny input |
output |
shiny input |
session |
shiny input |
save_dir |
|
dir_access |
|
admin_user |
|
force_desc |
|
lan |
|
file_translate |
|
datatable_options |
|
yml |
|
date_time_format |
|
Shiny module without return value.
## Not run: if(require(shiny)){ ui <- fluidPage( shiny_drive_ui(id = "idm") ) server <- function(input, output, session) { callModule(module = shiny_drive_server, id = "idm", session = session, admin_user = TRUE, save_dir = getwd(), lan = "FR") } shinyApp(ui, server) } ## End(Not run)
## Not run: if(require(shiny)){ ui <- fluidPage( shiny_drive_ui(id = "idm") ) server <- function(input, output, session) { callModule(module = shiny_drive_server, id = "idm", session = session, admin_user = TRUE, save_dir = getwd(), lan = "FR") } shinyApp(ui, server) } ## End(Not run)