Commit 25e326fd authored by Yong Liu's avatar Yong Liu

Refs #5703

parent d822036f
......@@ -4502,7 +4502,7 @@ compareDataExport <- function(comparedScript, len, ...){
}
# Script - Save Script
saveScript <- function(...) {
saveAsScript <- function(...) {
saveScriptToFile <- function(fileName, ...) {
cmdtmp <- Script()$cmd
if(length(grep("sdcMicroScript",fileName))==0)
......@@ -4524,6 +4524,26 @@ compareDataExport <- function(comparedScript, len, ...){
parent=window)
}
}
# Script - Save Script
saveScript <- function(...) {
saveScriptToFile <- function(fileName, ...) {
cmdtmp <- Script()$cmd
if(length(grep("sdcMicroScript",fileName))==0)
fileName <- paste(fileName,".sdcMicroScript", sep="")
fo <- file(fileName)
writeLines(cmdtmp,fo)
close(fo)
}
if( existd("activescript.file") ) {
xname <- getd("activescript.file")
if( nchar(xname) > 0 && xname != "Untitled Script") {
saveScriptToFile(xname)
}
} else {
gmessage("No active Script found.", title="Information", icon="warning", parent=window)
}
}
# Script - Load Script
loadScript <- function(...) {
......@@ -5310,8 +5330,9 @@ compareDataExport <- function(comparedScript, len, ...){
mbar$Data$"View"$"Observations with risk above the benchmark"$handler = function(h, ...) viewhigh()
mbar$Data$"View"$"Compare dataset"$handler = compareDataset
mbar$Data$"Variable Manager"$handler = function(h, ...) CreateVariableManager()
mbar$Script$"Import"$handler = loadScript
mbar$Script$"Export"$handler = saveScript
mbar$Script$"Load"$handler = loadScript
mbar$Script$"Save As"$handler = saveAsScript
mbar$Script$"Save"$handler = saveScript
mbar$Script$"View"$handler = viewScript
mbar$"Anonymisation"$"On Categorical key Variables"$Recode$handler = selectKeyVariableInVC
mbar$"Anonymisation"$"On Categorical key Variables"$Pram$handler = pram1
......@@ -5349,7 +5370,7 @@ compareDataExport <- function(comparedScript, len, ...){
add(sdcLayout, gmenu(mbar))
# Start - add toolbar
toolbargroup <- ggroup(container=sdcLayout, horizontal=TRUE)
gtoolbar(list(Open=gaction("Open", icon="open", tooltip="Open script", handler=function(h,...) {
gtoolbar(list(Open=gaction("Load", icon="open", tooltip="Open script", handler=function(h,...) {
loadScript()
}),
save=gaction("Save", icon="save", tooltip="Save script", handler=function(h,...) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment