[rkward-cvs] SF.net SVN: rkward:[3878] trunk/rkward/packages/rkwarddev

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Mon Oct 3 20:41:59 UTC 2011


Revision: 3878
          http://rkward.svn.sourceforge.net/rkward/?rev=3878&view=rev
Author:   m-eik
Date:     2011-10-03 20:41:59 +0000 (Mon, 03 Oct 2011)
Log Message:
-----------
rkwarddev: rk.paste.JS() now takes more than one object

Modified Paths:
--------------
    trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.R
    trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
    trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
    trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd
    trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.R	2011-10-03 19:31:00 UTC (rev 3877)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.cbox.R	2011-10-03 20:41:59 UTC (rev 3878)
@@ -24,7 +24,7 @@
 
 	attr.list <- list(id=id, label=label, value=value)
 	if(!is.null(un.value)){
-		attr.list[["unchecked_value"]] <- un.value
+		attr.list[["value_unchecked"]] <- un.value
 	} else {}
 	if(isTRUE(chk)){
 		attr.list[["checked"]] <- "true"

Modified: trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R	2011-10-03 19:31:00 UTC (rev 3877)
+++ trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R	2011-10-03 20:41:59 UTC (rev 3878)
@@ -1,6 +1,6 @@
-#' Paste objects of class rk.JS.ite
+#' Paste JavaScript objects and character strings
 #'
-#' @param object An object of class \code{rk.JS.ite} or \code{rk.JS.arr}
+#' @param ... Objects of class \code{rk.JS.ite}, \code{rk.JS.arr} or character.
 #' @param level Integer, which indentation level to use, minimum is 1.
 #' @param indent.by A character string defining the indentation string to use.
 #' @param funct For \code{rk.JS.arr} objects only: Character string, name of the R function
@@ -13,18 +13,22 @@
 #'		\code{\link[rkwarddev:ite]{ite}}
 #' @export
 
-rk.paste.JS <- function(object, level=1, indent.by="\t", funct=NULL){
+rk.paste.JS <- function(..., level=1, indent.by="\t", funct=NULL){
 	stopifnot(level > 0)
+	all.objects <- list(...)
+	
+	paste.results <- paste(sapply(all.objects, function(this.object){
+		if(inherits(this.object, "rk.JS.ite")){
+			# done by an internal function, to ease handling of recursions
+			result <- paste.JS.ite(this.object, level=level, indent.by=indent.by)
+		} else if(inherits(this.object, "rk.JS.arr")){
+			# done by an internal function, to ease handling of recursions
+			result <- paste.JS.array(this.object, level=level, indent.by=indent.by, funct=funct)
+		} else {
+			result <- paste(indent(level, by=indent.by), this.object, sep="")
+		}
+		return(result)
+	}), collapse="\n")
 
-	if(inherits(object, "rk.JS.ite")){
-		# done by an internal function, to ease handling of recursions
-		result <- paste.JS.ite(object, level=level, indent.by=indent.by)
-	} else if(inherits(object, "rk.JS.arr")){
-		# done by an internal function, to ease handling of recursions
-		result <- paste.JS.array(object, level=level, indent.by=indent.by, funct=funct)
-	} else {
-		result <- paste(object)
-	}
-
-	return(result)
+	return(paste.results)
 }

Modified: trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R	2011-10-03 19:31:00 UTC (rev 3877)
+++ trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R	2011-10-03 20:41:59 UTC (rev 3878)
@@ -27,6 +27,7 @@
 #'		\code{"file"}, \code{"edit"}, \code{"view"}, \code{"workspace"}, \code{"run"}, \code{"data"},
 #'		\code{"analysis"}, \code{"plots"}, \code{"distributions"}, \code{"windows"}, \code{"settings"} and \code{"help"}.
 #'		Anything else will place it in a "test" menu.
+#' @param results.header A character string to headline the printed results.
 #' @param JS.prep A character string with JavaScript code to be included in the \code{preprocess()} function. This string will be
 #'		pasted as-is, see \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}}.
 #' @param JS.calc A character string with JavaScript code to be included in the \code{calculate()} function. This string will be
@@ -110,7 +111,7 @@
 #' }
 
 rk.plugin.skeleton <- function(name, about=NULL, path=tempdir(), dialog=NULL, wizard=NULL, logic=NULL, snippets=NULL,
-	provides=c("logic", "dialog"), dial.require=c(), overwrite=FALSE, tests=TRUE, lazyLoad=TRUE, menu="test",
+	provides=c("logic", "dialog"), dial.require=c(), overwrite=FALSE, tests=TRUE, lazyLoad=TRUE, menu="test", results.header=NULL,
 	JS.prep=NULL, JS.calc=NULL, JS.prnt=NULL, create=c("pmap", "xml", "js", "rkh", "desc"), edit=FALSE, load=FALSE, show=FALSE){
 	# to besure, remove all non-character symbols from name
 	name.orig <- name
@@ -199,10 +200,13 @@
 	## create plugin.js
 	if("js" %in% create){
 		if(isTRUE(checkCreateFiles(plugin.js))){
+			if(is.null(results.header)){
+				results.header <- paste(name.orig, " results", sep="")
+			} else {}
 			JS.code <- rk.JS.doc(
 				require=dial.require,
 				variables=rk.JS.scan(XML.plugin),
-				results.header=paste(name.orig, " results", sep=""),
+				results.header=results.header,
 				preprocess=JS.prep,
 				calculate=JS.calc,
 				printout=JS.prnt)

Modified: trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd	2011-10-03 19:31:00 UTC (rev 3877)
+++ trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd	2011-10-03 20:41:59 UTC (rev 3878)
@@ -1,13 +1,13 @@
 \name{rk.paste.JS}
 \alias{rk.paste.JS}
-\title{Paste objects of class rk.JS.ite}
+\title{Paste JavaScript objects and character strings}
 \usage{
-  rk.paste.JS(object, level = 1, indent.by = "\t", funct =
+  rk.paste.JS(..., level = 1, indent.by = "\t", funct =
   NULL)
 }
 \arguments{
-  \item{object}{An object of class \code{rk.JS.ite} or
-  \code{rk.JS.arr}}
+  \item{...}{Objects of class \code{rk.JS.ite},
+  \code{rk.JS.arr} or character.}
 
   \item{level}{Integer, which indentation level to use,
   minimum is 1.}
@@ -24,7 +24,7 @@
   A character string.
 }
 \description{
-  Paste objects of class rk.JS.ite
+  Paste JavaScript objects and character strings
 }
 \seealso{
   \code{\link[rkwarddev:rk.JS.array]{rk.JS.array}},

Modified: trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-10-03 19:31:00 UTC (rev 3877)
+++ trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-10-03 20:41:59 UTC (rev 3878)
@@ -6,9 +6,10 @@
   dialog = NULL, wizard = NULL, logic = NULL, snippets =
   NULL, provides = c("logic", "dialog"), dial.require =
   c(), overwrite = FALSE, tests = TRUE, lazyLoad = TRUE,
-  menu = "test", JS.prep = NULL, JS.calc = NULL, JS.prnt =
-  NULL, create = c("pmap", "xml", "js", "rkh", "desc"),
-  edit = FALSE, load = FALSE, show = FALSE)
+  menu = "test", results.header = NULL, JS.prep = NULL,
+  JS.calc = NULL, JS.prnt = NULL, create = c("pmap", "xml",
+  "js", "rkh", "desc"), edit = FALSE, load = FALSE, show =
+  FALSE)
 }
 \arguments{
   \item{name}{Character sting, name of the plugin package.}
@@ -72,6 +73,9 @@
   \code{"settings"} and \code{"help"}. Anything else will
   place it in a "test" menu.}
 
+  \item{results.header}{A character string to headline the
+  printed results.}
+
   \item{JS.prep}{A character string with JavaScript code to
   be included in the \code{preprocess()} function. This
   string will be pasted as-is, see

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list