[rkward-cvs] SF.net SVN: rkward-code:[4555] trunk/rkward/packages/rkwarddev
m-eik at users.sf.net
m-eik at users.sf.net
Fri Feb 22 20:37:57 UTC 2013
Revision: 4555
http://sourceforge.net/p/rkward/code/4555
Author: m-eik
Date: 2013-02-22 20:37:56 +0000 (Fri, 22 Feb 2013)
Log Message:
-----------
rkwarddev: i hope this is a good solution to the optionset problem.
Modified Paths:
--------------
trunk/rkward/packages/rkwarddev/ChangeLog
trunk/rkward/packages/rkwarddev/DESCRIPTION
trunk/rkward/packages/rkwarddev/NAMESPACE
trunk/rkward/packages/rkwarddev/R/id.R
trunk/rkward/packages/rkwarddev/R/rk-internal.R
trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R
trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd
Removed Paths:
-------------
trunk/rkward/packages/rkwarddev/R/id.os.R
trunk/rkward/packages/rkwarddev/man/id.os.Rd
Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/ChangeLog 2013-02-22 20:37:56 UTC (rev 4555)
@@ -1,22 +1,25 @@
ChangeLog for package rkwarddev
-changes in version 0.06-2 (2013-02-20)
+changes in version 0.06-2 (2013-02-22)
changed:
- - the structure of <about> nodes will change in RKWard 0.6.1, <dependencies> will become
- a direct child of <document> or <component>, which explains several changes in this release.
- this is not really critical, because this information wasn't evaluated by RKWard until now
- anyway
+ - the structure of <about> nodes will change in RKWard 0.6.1,
+ <dependencies> will become a direct child of <document> or <component>, which explains
+ several changes in this release. this is not really critical, because this
+ information wasn't evaluated by RKWard until now anyway
- for consistency, from now on <component> is never an empty node
- - rk.XML.pluginmap(), rk.XML.plugin() and rk.plugin.skeleton() will now move <dependencies>
- from <about> to a top level child node of plugin maps, with a warning
- - the object class rk.JS.var gained a new slot "getter" to set a default JS function
- to query variable values. it defaults to "getValue" to ensure compatibility with earlier
- releases. consequently, rk.JS.vars() and rk.paste.JS() have a new "getter" argument to set
- or overwrite this value. another new argument, "guess.getter", can be used to turn on
- automatic guessing which getter function might be most appropriate. this was also added to
+ - rk.XML.pluginmap(), rk.XML.plugin() and rk.plugin.skeleton() will now
+ move <dependencies> from <about> to a top level child node of plugin maps,
+ with a warning
+ - the object class rk.JS.var gained a new slot "getter" to set a default JS
+ function to query variable values. it defaults to "getValue" to ensure
+ compatibility with earlier releases. consequently, rk.JS.vars() and
+ rk.paste.JS() have a new "getter" argument to set or overwrite this value.
+ another new argument, "guess.getter", can be used to turn on automatic guessing
+ which getter function might be most appropriate. this was also added to
rk.plugin.component() and rk.plugin.skeleton().
- - rk.JS.scan() learned how to treat <optionset> and <matrix>
- updated the skeleton_dialog.R demo file and recreated the plugin code
+ - JavaScript functions like rk.JS.scan() and id() learned how to treat
+ <optionset>, <optioncolumn> and <matrix>
added:
- new function rk.XML.switch()
- new function rk.XML.optiondisplay()
@@ -24,7 +27,8 @@
- new function rk.XML.matrix()
- new function rk.XML.dependencies()
- new function rk.XML.dependency_check()
- - added options "dependencies", "namespace" and "priority" to rk.XML.pluginmap()
+ - added options "dependencies", "namespace" and "priority" to
+ rk.XML.pluginmap()
- added option "dependencies" to rk.XML.component()
- added "map" to rk.XML.require()
fixed:
@@ -300,7 +304,7 @@
- added options "require", "x11.context", "import.context" and "hints" to
rk.XML.pluginmap()
- removed now superfluous option "plugin.dir" from rk.XML.pluginmap()
- - tuned rk.plugin.skeleton() to only skip file writing if they exist
+ - tuned rk.plugin.skeleton() to only skip file writing if they exist
changes in version 0.02-2 (2011-09-29)
- added "load" and "show" options to rk.plugin.skeleton() to call
@@ -358,7 +362,7 @@
changes in version 0.01-1 (2011-09-05)
- added rk.JS.scan(), rk.JS.doc(), rk.JS.array(), rk.rkh.scan() and
rk.rkh.doc()
- - added rk.XML.browser(), rk.XML.input(), rk.XML.saveobj(),
+ - added rk.XML.browser(), rk.XML.input(), rk.XML.saveobj(),
rk.XML.stretch() and rk.XML.text()
- added rk.testsuite.doc()
- shortened package name from "rkwardplugdev" to "rkwarddev"
Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION 2013-02-22 20:37:56 UTC (rev 4555)
@@ -18,7 +18,6 @@
Date: 2013-02-22
Collate:
'echo.R'
- 'id.os.R'
'id.R'
'rk.JS.ite-class.R'
'ite.R'
Modified: trunk/rkward/packages/rkwarddev/NAMESPACE
===================================================================
--- trunk/rkward/packages/rkwarddev/NAMESPACE 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/NAMESPACE 2013-02-22 20:37:56 UTC (rev 4555)
@@ -1,41 +1,13 @@
-exportClasses(rk.JS.arr)
-exportClasses(rk.JS.ite)
-exportClasses(rk.JS.opt)
-exportClasses(rk.JS.var)
-exportClasses(rk.plot.opts)
-exportClasses(rk.plug.comp)
export(echo)
export(id)
-export(id.os)
export(ite)
-exportMethods(show)
export(qp)
-export(rk.build.plugin)
-export(rk.comment)
export(rk.JS.array)
export(rk.JS.doc)
export(rk.JS.options)
export(rk.JS.saveobj)
export(rk.JS.scan)
export(rk.JS.vars)
-export(rk.paste.JS)
-export(rk.paste.JS.graph)
-export(rk.plotOptions)
-export(rk.plugin.component)
-export(rk.plugin.skeleton)
-export(rk.rkh.caption)
-export(rk.rkh.doc)
-export(rk.rkh.link)
-export(rk.rkh.related)
-export(rk.rkh.scan)
-export(rk.rkh.section)
-export(rk.rkh.setting)
-export(rk.rkh.settings)
-export(rk.rkh.summary)
-export(rk.rkh.technical)
-export(rk.rkh.title)
-export(rk.rkh.usage)
-export(rk.testsuite.doc)
export(rk.XML.about)
export(rk.XML.attribute)
export(rk.XML.browser)
@@ -89,5 +61,32 @@
export(rk.XML.varselector)
export(rk.XML.varslot)
export(rk.XML.wizard)
+export(rk.build.plugin)
+export(rk.comment)
+export(rk.paste.JS)
+export(rk.paste.JS.graph)
+export(rk.plotOptions)
+export(rk.plugin.component)
+export(rk.plugin.skeleton)
+export(rk.rkh.caption)
+export(rk.rkh.doc)
+export(rk.rkh.link)
+export(rk.rkh.related)
+export(rk.rkh.scan)
+export(rk.rkh.section)
+export(rk.rkh.setting)
+export(rk.rkh.settings)
+export(rk.rkh.summary)
+export(rk.rkh.technical)
+export(rk.rkh.title)
+export(rk.rkh.usage)
+export(rk.testsuite.doc)
export(tf)
+exportClasses(rk.JS.arr)
+exportClasses(rk.JS.ite)
+exportClasses(rk.JS.opt)
+exportClasses(rk.JS.var)
+exportClasses(rk.plot.opts)
+exportClasses(rk.plug.comp)
+exportMethods(show)
import(methods)
Modified: trunk/rkward/packages/rkwarddev/R/id.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/id.R 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/R/id.R 2013-02-22 20:37:56 UTC (rev 4555)
@@ -34,10 +34,19 @@
this.part <- stripCont(this.part, get="printout")
if(is.XiMpLe.node(this.part)){
- node.id <- XMLAttrs(this.part)$id
+ if(identical(XMLName(this.part), "optioncolumn")){
+ # optionsets are more difficult to identify automatically
if(isTRUE(js)){
+ node.id <- camelCode(get.IDs(check.optionset.tags(this.part), relevant.tags="optioncolumn")[,"abbrev"])
+ } else {
+ node.id <- get.IDs(check.optionset.tags(this.part), relevant.tags="optioncolumn")[,"id"]
+ }
+ } else {
+ node.id <- XMLAttrs(this.part)[["id"]]
+ if(isTRUE(js)){
node.id <- camelCode(node.id)
} else {}
+ }
return(node.id)
} else if(inherits(this.part, "rk.JS.arr")){
node.id <- this.part at opt.name
Deleted: trunk/rkward/packages/rkwarddev/R/id.os.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/id.os.R 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/R/id.os.R 2013-02-22 20:37:56 UTC (rev 4555)
@@ -1,56 +0,0 @@
-#' Create JavaScript variables from optionsets
-#'
-#' Scans an \code{<optionset>} node and returns the relevant variable or ID names of each
-#' \code{<optioncolumn>} included.
-#'
-#' This function can be of assistance when dealing with \code{<optionset>} nodes, because what you
-#' need in the JavaScript part of your plugin is the correct variable name of its columns.
-#'
-#' @param optionset An object of class \code{XiMpLe.node} containing a full \code{<optionset>}.
-#' @param js Logical, if \code{TRUE} valid JavaScript varaible names will be returned, otherwise
-#' the XML ID names, respectively.
-#' @param add.abbrev Logical, if \code{TRUE} the JavaScript variables will all have a prefix with an
-#' three letter abbreviation of the XML tag type to improve the readability of the code. But it's
-#' probably better to add this in the XML code in the first place.
-#' @return A character vector. For each \code{<optioncolumn>} in the set, this vector will contain
-#' either its variable name or XML ID, depending on the \code{js} switch.
-#' @seealso
-#' \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}},
-#' \code{\link[rkwarddev:rk.XML.optiondisplay]{rk.XML.optiondisplay}},
-#' and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
-#' @export
-
-# this is a quick hack which might become obsolete again, if i find a good way of limiting
-# the JS variables to the column ID.
-
-id.os <- function(optionset, js=TRUE, add.abbrev=FALSE){
-
- if(!is.XiMpLe.node(optionset) || !identical(XMLName(optionset), "optionset")){
- stop(simpleError("id.os() can only process <optionset> nodes in XiMpLe object form!"))
- } else {}
-
- # getting the relevant IDs out of optionsets is a little tricky
- # this function will probe for sets and return single tags
- single.tags <- check.optionset.tags(XML.obj=optionset, drop=c("comments","cdata", "declarations", "doctype"))
-
- JS.id <- get.IDs(single.tags=single.tags, relevant.tags="optioncolumn", add.abbrev=add.abbrev, tag.names=TRUE)
-
- if("id" %in% colnames(JS.id)){
- if(isTRUE(js)){
- JS.lines <- unlist(sapply(1:nrow(JS.id), function(this.id){
- return(rk.paste.JS(get.JS.vars(
- JS.var=JS.id[this.id,"abbrev"],
- XML.var=JS.id[this.id,"id"],
- tag.name=JS.id[this.id,"tag"],
- names.only=TRUE), level=1, indent.by=""))
- }, USE.NAMES=FALSE))
- } else {
- JS.lines <- JS.id[,"id"]
- names(JS.lines) <- NULL
- }
- } else {
- JS.lines <- NULL
- }
-
- return(JS.lines)
-}
Modified: trunk/rkward/packages/rkwarddev/R/rk-internal.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk-internal.R 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/R/rk-internal.R 2013-02-22 20:37:56 UTC (rev 4555)
@@ -114,7 +114,7 @@
## function get.IDs()
# scans XML tags for defined IDs, returns a matrix with columns "id" and "abbrev",
-# and optional "tag"
+# and optional "tag". "abbrev" is mostly used for the JavaScript variable name.
# 'single.tags' can also contain XiMpLe.node objects
get.IDs <- function(single.tags, relevant.tags, add.abbrev=FALSE, tag.names=FALSE, only.checkable=FALSE){
@@ -156,17 +156,37 @@
ids <- t(sapply(cleaned.tags, function(this.tag){
if(is.XiMpLe.node(this.tag)){
this.tag.name <- XMLName(this.tag)
- this.tag.id <- XMLAttrs(this.tag)["id"]
+ this.tag.id.abbrev <- this.tag.id <- XMLAttrs(this.tag)["id"]
+ # take care of one special case: optionsets
+ # the need the set ID to access the value from the dialog,
+ # but to be able to use only the optioncolumn in rkwaddev scripts
+ # as reference, the JavaScript variable must be generated from the
+ # column ID alone.
+ if(identical(this.tag.name, "optioncolumn")){
+ this.tag.setid <- XMLAttrs(this.tag)[["setid"]]
+ if(!is.null(this.tag.setid)){
+ this.tag.id <- paste(this.tag.setid, this.tag.id, sep=".")
+ } else {}
+ # for safety, prefix the column ID with a constant
+ this.tag.id.abbrev <- paste("ocol_", this.tag.id.abbrev, sep="")
+ } else {}
} else {
this.tag.name <- XiMpLe:::XML.tagName(this.tag)
- this.tag.id <- XiMpLe:::parseXMLAttr(this.tag)[["id"]]
+ this.tag.id.abbrev <- this.tag.id <- XiMpLe:::parseXMLAttr(this.tag)[["id"]]
+ # see comment above for the next part
+ if(identical(this.tag.name, "optioncolumn")){
+ this.tag.setid <- XiMpLe:::parseXMLAttr(this.tag)[["setid"]]
+ if(!is.null(this.tag.setid)){
+ this.tag.id <- paste(this.tag.setid, this.tag.id, sep=".")
+ } else {}
+ # for safety, prefix the column ID with a constant
+ this.tag.id.abbrev <- paste("ocol_", this.tag.id.abbrev, sep="")
+ } else {}
}
if(isTRUE(add.abbrev)){
- this.tag.id.abbrev <- paste(ID.prefix(this.tag.name), this.tag.id, sep="")
- } else {
- this.tag.id.abbrev <- this.tag.id
- }
+ this.tag.id.abbrev <- paste(ID.prefix(this.tag.name), this.tag.id.abbrev, sep="")
+ } else {}
if(isTRUE(tag.names)){
return(c(id=this.tag.id, abbrev=this.tag.id.abbrev, tag=this.tag.name))
} else {
@@ -191,8 +211,10 @@
# XML.obj may be a character string (file name) or XiMpLe object.
# this function will check if <optionset> nodes are present
# and return a possibly corrected result of get.single.tags(),
-# where "corrected" means: optioncolumns will get their IDs prefixed
-# with the set ID, and the rest of the set is discarded.
+# where "corrected" means: optioncolumns internally will gain an
+# attribute "setid" with the respective set ID, and the rest of the
+# set is discarded.
+# this extra attribute is evaluated by get.IDs().
check.optionset.tags <- function(XML.obj, drop=NULL){
# if this is not a XiMpLe object, transform the file into one
if(!is.XiMpLe.node(XML.obj) && !is.XiMpLe.doc(XML.obj)){
@@ -209,8 +231,7 @@
thisCols <- child.list(XMLScan(thisNode, "optioncolumn"))
thisSetID <- XMLAttrs(thisNode)[["id"]]
thisNewCols <- unlist(sapply(thisCols, function(thisCol){
- thisColsID <- XMLAttrs(thisCol)[["id"]]
- XMLAttrs(thisCol)[["id"]] <- paste(thisSetID, thisColsID, sep=".")
+ XMLAttrs(thisCol)[["setid"]] <- thisSetID
pastedTag <- get.single.tags(XML.obj=thisCol, drop=drop)
return(pastedTag)
}, USE.NAMES=FALSE))
@@ -271,52 +292,60 @@
getter="getValue", guess.getter=FALSE, check.modifiers=TRUE){
# check for XiMpLe nodes
JS.var <- check.ID(JS.var)
+ have.XiMpLe.var <- FALSE
if(!is.null(XML.var)){
+ if(is.XiMpLe.node(XML.var)){
+ have.XiMpLe.var <- TRUE
+ tag.name <- XMLName(XML.var)
+ } else if(is.null(tag.name)){
+ # hm, not a XiMpLe object and no known tag name :-/
+ # if this is simply a character string, the tag name will become ""
+ tag.name <- XMLName(XMLChildren(parseXMLTree(XML.var, object=TRUE))[[1]])
+ } else {}
+
# check validity of modifiers value
if(!is.null(modifiers)){
if(identical(modifiers, "all")){
- if(is.XiMpLe.node(XML.var)){
- tag.name <- XMLName(XML.var)
- } else {
- tag.name <- XML.var
- }
if(tag.name %in% names(all.valid.modifiers)){
modifiers <- all.valid.modifiers[[tag.name]]
} else {
modifiers <- NULL
}
} else {
- if(is.XiMpLe.node(XML.var)){
- modif.tag.name <- XMLName(XML.var)
+ if(identical(tag.name, "")){
+ modif.tag.name <- "all"
} else {
- modif.tag.name <- "all"
+ modif.tag.name <- tag.name
}
if(isTRUE(check.modifiers)){
- modifiers <- modifiers[modif.validity(modif.tag.name, modifier=child.list(modifiers), warn.only=TRUE, bool=TRUE)]
+ modifiers <- modifiers[modif.validity(modif.tag.name,
+ modifier=child.list(modifiers), warn.only=TRUE, bool=TRUE)]
} else {}
}
} else {}
+
+
# check for getter guessing
if(isTRUE(guess.getter)){
- if(is.XiMpLe.node(XML.var)){
- tag.name <- XMLName(XML.var)
- } else if(is.null(tag.name)){
- # hm, not a XiMpLe object and no known tag name :-/
- XML.var <- XMLChildren(parseXMLTree(XML.var, object=TRUE))[[1]]
- tag.name <- XMLName(XML.var)
- } else {}
if(tag.name %in% names(JS.getters.default)){
# special case: is a <checkbox> has a value other than
# "true" or "false", it's probably supposed to be fetched
# as string, not boolean
- if(is.XiMpLe.node(XML.var) && identical(tag.name, "checkbox") &&
+ if(isTRUE(have.XiMpLe.var) && identical(tag.name, "checkbox") &&
any(!c(XMLAttrs(XML.var)[["value"]], XMLAttrs(XML.var)[["value_unchecked"]]) %in% c("true","false"))){
getter <- "getString"
} else {
getter <- JS.getters.default[[tag.name]]
}
} else {}
- } else {}
+ } else {
+ # if guess.getters is off but we're dealing with <matrix> or <optionset>,
+ # throw in a warning:
+ if(tag.name %in% c("matrix", "optioncolumn") && identical(getter, "getValue")){
+ warning(paste("Your plugin contains the <", tag.name, "> element, but 'guess.getter' is off. ",
+ "Using the default getValue() on this node might cause problems!", sep=""), call.=FALSE)
+ } else {}
+ }
XML.var <- check.ID(XML.var)
} else {
XML.var <- check.ID(JS.var)
Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.optionset.R 2013-02-22 20:37:56 UTC (rev 4555)
@@ -1,5 +1,11 @@
#' Create XML node "optionset" for RKWard plugins
#'
+#' Note that if you want to refer to the optioncolumns in your JavaScript code, the \code{id}
+#' you need is a combination of \code{<optionset id>.<optioncolumn id>.<modifier>}. that is,
+#' you must always prefix it with the sets' \code{id}. For JavaScript code generating with
+#' \code{rkwarddev}, you can use the ID that functions like \code{\link[rkwarddev:id]{id}} return,
+#' because the JavaScript variable name will only contain a constant prefix ("ocol") an the column ID.
+#'
#' @note The \code{<optionset>} node was introduced with RKWard 0.6.1, please set the dependencies
#' of your component/plugin accordingly.
#'
@@ -30,7 +36,7 @@
#' genderselect <- rk.XML.radio("Gender", options=list(
#' Male = c(val="m"),
#' Female = c(val="f")))
-#' rk.XML.optionset(
+#' (myOptionset <- rk.XML.optionset(
#' content = list(
#' rk.XML.row(
#' firstname,
@@ -41,7 +47,7 @@
#' rk.XML.optioncolumn(lastname, modifier="text"),
#' rk.XML.optioncolumn(genderselect)
#' )
-#' )
+#' ))
rk.XML.optionset <- function(content, optioncolumn, min_rows=0, min_rows_if_any=0, max_rows=0,
keycolumn=NULL, logic=NULL, optiondisplay=TRUE, id.name="auto"){
Modified: trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/NEWS.Rd 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/inst/NEWS.Rd 2013-02-22 20:37:56 UTC (rev 4555)
@@ -1,24 +1,27 @@
\name{NEWS}
\title{News for Package 'rkwarddev'}
\encoding{UTF-8}
-\section{Changes in rkwarddev version 0.06-2 (2013-02-20)}{
+\section{Changes in rkwarddev version 0.06-2 (2013-02-22)}{
\subsection{changed}{
\itemize{
- \item the structure of <about> nodes will change in RKWard 0.6.1, <dependencies> will become
- a direct child of <document> or <component>, which explains several changes in this release.
- this is not really critical, because this information wasn't evaluated by RKWard until now
- anyway
+ \item the structure of <about> nodes will change in RKWard 0.6.1,
+ <dependencies> will become a direct child of <document> or <component>, which explains
+ several changes in this release. this is not really critical, because this
+ information wasn't evaluated by RKWard until now anyway
\item for consistency, from now on <component> is never an empty node
- \item \code{rk.XML.pluginmap()}, \code{rk.XML.plugin()} and \code{rk.plugin.skeleton()} will now move <dependencies>
- from <about> to a top level child node of plugin maps, with a warning
- \item the object class rk.JS.var gained a new slot \code{"getter"} to set a default JS function
- to query variable values. it defaults to \code{"getValue"} to ensure compatibility with earlier
- releases. consequently, \code{rk.JS.vars()} and \code{rk.paste.JS()} have a new \code{"getter"} argument to set
- or overwrite this value. another new argument, \code{"guess.getter"}, can be used to turn on
- automatic guessing which getter function might be most appropriate. this was also added to
+ \item \code{rk.XML.pluginmap()}, \code{rk.XML.plugin()} and \code{rk.plugin.skeleton()} will now
+ move <dependencies> from <about> to a top level child node of plugin maps,
+ with a warning
+ \item the object class rk.JS.var gained a new slot \code{"getter"} to set a default JS
+ function to query variable values. it defaults to \code{"getValue"} to ensure
+ compatibility with earlier releases. consequently, \code{rk.JS.vars()} and
+ \code{rk.paste.JS()} have a new \code{"getter"} argument to set or overwrite this value.
+ another new argument, \code{"guess.getter"}, can be used to turn on automatic guessing
+ which getter function might be most appropriate. this was also added to
\code{rk.plugin.component()} and \code{rk.plugin.skeleton()}.
- \item \code{rk.JS.scan()} learned how to treat <optionset> and <matrix>
\item updated the skeleton_dialog.R demo file and recreated the plugin code
+ \item JavaScript functions like \code{rk.JS.scan()} and \code{id()} learned how to treat
+ <optionset>, <optioncolumn> and <matrix>
}
}
\subsection{added}{
@@ -29,7 +32,8 @@
\item new function \code{rk.XML.matrix()}
\item new function \code{rk.XML.dependencies()}
\item new function \code{rk.XML.dependency_check()}
- \item added options \code{"dependencies"}, \code{"namespace"} and \code{"priority"} to \code{rk.XML.pluginmap()}
+ \item added options \code{"dependencies"}, \code{"namespace"} and \code{"priority"} to
+ \code{rk.XML.pluginmap()}
\item added option \code{"dependencies"} to \code{rk.XML.component()}
\item added \code{"map"} to \code{rk.XML.require()}
}
@@ -397,7 +401,7 @@
\item added options \code{"require"}, \code{"x11.context"}, \code{"import.context"} and \code{"hints"} to
\code{rk.XML.pluginmap()}
\item removed now superfluous option \code{"plugin.dir"} from \code{rk.XML.pluginmap()}
- \item tuned \code{rk.plugin.skeleton()} to only skip file writing if they exist
+ \item tuned \code{rk.plugin.skeleton()} to only skip file writing if they exist
}
}
\section{Changes in rkwarddev version 0.02-2 (2011-09-29)}{
@@ -471,7 +475,7 @@
\itemize{
\item added \code{rk.JS.scan()}, \code{rk.JS.doc()}, \code{rk.JS.array()}, \code{rk.rkh.scan()} and
\code{rk.rkh.doc()}
- \item added \code{rk.XML.browser()}, \code{rk.XML.input()}, \code{rk.XML.saveobj()},
+ \item added \code{rk.XML.browser()}, \code{rk.XML.input()}, \code{rk.XML.saveobj()},
\code{rk.XML.stretch()} and \code{rk.XML.text()}
\item added \code{rk.testsuite.doc()}
\item shortened package name from \code{"rkwardplugdev"} to \code{"rkwarddev"}
Modified: trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
===================================================================
(Binary files differ)
Deleted: trunk/rkward/packages/rkwarddev/man/id.os.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/id.os.Rd 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/man/id.os.Rd 2013-02-22 20:37:56 UTC (rev 4555)
@@ -1,43 +0,0 @@
-\name{id.os}
-\alias{id.os}
-\title{Create JavaScript variables from optionsets}
-\usage{
- id.os(optionset, js = TRUE, add.abbrev = FALSE)
-}
-\arguments{
- \item{optionset}{An object of class \code{XiMpLe.node}
- containing a full \code{<optionset>}.}
-
- \item{js}{Logical, if \code{TRUE} valid JavaScript
- varaible names will be returned, otherwise the XML ID
- names, respectively.}
-
- \item{add.abbrev}{Logical, if \code{TRUE} the JavaScript
- variables will all have a prefix with an three letter
- abbreviation of the XML tag type to improve the
- readability of the code. But it's probably better to add
- this in the XML code in the first place.}
-}
-\value{
- A character vector. For each \code{<optioncolumn>} in the
- set, this vector will contain either its variable name or
- XML ID, depending on the \code{js} switch.
-}
-\description{
- Scans an \code{<optionset>} node and returns the relevant
- variable or ID names of each \code{<optioncolumn>}
- included.
-}
-\details{
- This function can be of assistance when dealing with
- \code{<optionset>} nodes, because what you need in the
- JavaScript part of your plugin is the correct variable
- name of its columns.
-}
-\seealso{
- \code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}},
- \code{\link[rkwarddev:rk.XML.optiondisplay]{rk.XML.optiondisplay}},
- and the \href{help:rkwardplugins}{Introduction to Writing
- Plugins for RKWard}
-}
-
Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd 2013-02-22 16:28:53 UTC (rev 4554)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.optionset.Rd 2013-02-22 20:37:56 UTC (rev 4555)
@@ -44,7 +44,15 @@
An object of class \code{XiMpLe.node}.
}
\description{
- Create XML node "optionset" for RKWard plugins
+ Note that if you want to refer to the optioncolumns in
+ your JavaScript code, the \code{id} you need is a
+ combination of \code{<optionset id>.<optioncolumn
+ id>.<modifier>}. that is, you must always prefix it with
+ the sets' \code{id}. For JavaScript code generating with
+ \code{rkwarddev}, you can use the ID that functions like
+ \code{\link[rkwarddev:id]{id}} return, because the
+ JavaScript variable name will only contain a constant
+ prefix ("ocol") an the column ID.
}
\note{
The \code{<optionset>} node was introduced with RKWard
@@ -57,7 +65,7 @@
genderselect <- rk.XML.radio("Gender", options=list(
Male = c(val="m"),
Female = c(val="f")))
-rk.XML.optionset(
+(myOptionset <- rk.XML.optionset(
content = list(
rk.XML.row(
firstname,
@@ -68,7 +76,7 @@
rk.XML.optioncolumn(lastname, modifier="text"),
rk.XML.optioncolumn(genderselect)
)
-)
+))
}
\seealso{
\code{\link[rkwarddev:rk.XML.optioncolumn]{rk.XML.optioncolumn}},
More information about the rkward-tracker
mailing list