Skip to content

Commit

Permalink
fix AMADO table generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-plutniak committed Apr 23, 2024
1 parent 297077e commit 3bd2657
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -1613,23 +1613,28 @@ app_server <- function(input, output, session) {
# 2) amado url
amado.url <- reactive({
req(export.table())

data <- export.table()

data <- data[order(rownames(data)), ]

# retrieve the name of the instance:
title <- shiny::getShinyOption("title")
if(is.null(title)){ title <- "archeoViz" }
data <- eval(parse(text = paste0(
"cbind('", shiny::getShinyOption("title"), "'= rownames(data), data)"
"cbind('", title, "'= rownames(data), data)"
)))

data <- cbind("archeoViz" = rownames(data), data)
data <- rbind(colnames(data), data)

# recast the table as a single string:
data <- apply(data, 2, paste0, collapse="%09") # separate cells by tabs
data <- gsub(" ", "%20", data) # add spaces
data <- paste0(data, collapse = "%0A") # encode lines

# generate an URL:
amado.lang <- "en"
if(getShinyOption("lang") %in% c('es', 'fr', 'it', 'ru', 'tr', 'uk', 'vi', 'zh')){
amado.lang <- getShinyOption("lang")
if(shiny::getShinyOption("lang") %in% c('es', 'fr', 'it', 'ru', 'tr', 'uk', 'vi', 'zh')){
amado.lang <- shiny::getShinyOption("lang")
}

paste0("https://app.ptm.huma-num.fr/amado/main.html?lang=",
Expand All @@ -1639,7 +1644,7 @@ app_server <- function(input, output, session) {

output$run.amado <- renderUI({
req(amado.url())

tagList(
"> ", .term_switcher("export.to"),
actionLink("run.amado",
Expand Down

0 comments on commit 3bd2657

Please sign in to comment.