[rkward-cvs] SF.net SVN: rkward:[4268] trunk/rkward/rkward/rbackend/rpackages/rkward/R

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Sun Jun 3 13:47:44 UTC 2012


Revision: 4268
          http://rkward.svn.sourceforge.net/rkward/?rev=4268&view=rev
Author:   m-eik
Date:     2012-06-03 13:47:43 +0000 (Sun, 03 Jun 2012)
Log Message:
-----------
changed TOC IDs in output file, to enable proper plugin testing

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R	2012-05-28 16:10:51 UTC (rev 4267)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R	2012-06-03 13:47:43 UTC (rev 4268)
@@ -128,7 +128,7 @@
 		# see $SRC/rkward/pages/rkward_output.css
 		.rk.cat.output (paste ("</head>\n<body>\n", sep=""))
 		# This initial output mostly to indicate the output is really there, just empty for now
-		.rk.cat.output (paste ("<a name=\"top\"></a>\n<pre>RKWard output initialized on", date (), "</pre>\n"))
+		.rk.cat.output (paste ("<a name=\"top\"></a>\n<pre>RKWard output initialized on", .rk.date (), "</pre>\n"))
 		# an empty <div> where the TOC menu gets added to dynamically, and a second one to toggle show/hide
 		.rk.cat.output (paste (
 			"<div id=\"RKWardResultsTOCShown\" class=\"RKTOC\">\n",

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R	2012-05-28 16:10:51 UTC (rev 4267)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R	2012-06-03 13:47:43 UTC (rev 4268)
@@ -108,8 +108,15 @@
 
 	# give header a name to be able to set anchors
 	# it's just a time string down to the fraction of a second: yyyy-mm-dd HH:MM:SS.ssssss
-	header.id <- format(Sys.time(), "%Y-%m-%d_%H:%M:%OS6")
-	header.title <- format(Sys.time(), "%Y-%m-%d %H:%M:%S")
+	# but to enable proper plugin tests, first check if we're running in a test environment
+	if(tryCatch(
+		is.environment(rkwardtests::.rktest.tmp.storage) && exists(".rk.date", envir=rkwardtests::.rktest.tmp.storage, inherits=FALSE),
+		error=function(e) return(FALSE))){
+		header.id <- header.title <- "test"
+	} else {
+		header.id <- format(Sys.time(), "%Y-%m-%d_%H:%M:%OS6")
+		header.title <- format(Sys.time(), "%Y-%m-%d %H:%M:%S")
+	}
 	# add 'id', 'name' and 'title' attributes to the header
 	cat ("<h", level, "><a id=\"", header.id,"\" name=\"", header.id,"n\" title=\"", header.title,"\">", title, "</a></h", level, ">\n", sep="")
 	# if 'toc' is true, also add a javascript function call to add this header to the TOC menu

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