[rkward-cvs] SF.net SVN: rkward:[2752] trunk/rkward/rkward/plugins/00saveload

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Feb 21 19:40:18 UTC 2010


Revision: 2752
          http://rkward.svn.sourceforge.net/rkward/?rev=2752&view=rev
Author:   tfry
Date:     2010-02-21 19:40:15 +0000 (Sun, 21 Feb 2010)

Log Message:
-----------
Convert most import/export plugins to JS

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/00saveload/import/import_csv.js
    trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml
    trunk/rkward/rkward/plugins/00saveload/import/import_spss.js
    trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml
    trunk/rkward/rkward/plugins/00saveload/import/load_data.js
    trunk/rkward/rkward/plugins/00saveload/import/load_data.xml
    trunk/rkward/rkward/plugins/00saveload/import/source.js
    trunk/rkward/rkward/plugins/00saveload/import/source.xml
    trunk/rkward/rkward/plugins/00saveload/save/save/code.js
    trunk/rkward/rkward/plugins/00saveload/save/save/description.xml
    trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js
    trunk/rkward/rkward/plugins/00saveload/save/skeleton/description.xml
    trunk/rkward/rkward/plugins/00saveload/save/write.js
    trunk/rkward/rkward/plugins/00saveload/save/write.xml
    trunk/rkward/rkward/plugins/00saveload/save/write_table.js
    trunk/rkward/rkward/plugins/00saveload/save/write_table.xml
    trunk/rkward/rkward/plugins/00saveload/setworkdir.js
    trunk/rkward/rkward/plugins/00saveload/setworkdir.xml

Removed Paths:
-------------
    trunk/rkward/rkward/plugins/00saveload/import/import_csv.php
    trunk/rkward/rkward/plugins/00saveload/import/import_spss.php
    trunk/rkward/rkward/plugins/00saveload/import/load_data.php
    trunk/rkward/rkward/plugins/00saveload/import/source.php
    trunk/rkward/rkward/plugins/00saveload/save/save/code.php
    trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php
    trunk/rkward/rkward/plugins/00saveload/save/write.php
    trunk/rkward/rkward/plugins/00saveload/save/write_table.php
    trunk/rkward/rkward/plugins/00saveload/setworkdir.php

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_csv.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,55 +1,17 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-Found string 'strtr'. Please check whether conversion is needed (use varname.replace(...)).
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
-Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
-Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
-Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
-Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
-Warning: '$' inside '"'-delimited string. This might be a variable name. Please check by hand!
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Note: Control statement without braces. This is bad style.
-Note: Control statement without braces. This is bad style.
-Note: Control statement without braces. This is bad style.
-Note: Control statement without braces. This is bad style.
-Note: Control statement without braces. This is bad style.
-Note: Control statement without braces. This is bad style.
-
----------------------------- */
-
-// globals
-var undefined;
-
-// internal helper function
-function quoteString (string) {
-	return ('"' + strtr (string, new Array('"', '\\"')) + '"');
-}
-
-
 function calculate () {
-	var quick = "";
-	var dec = "";
-	var sep = "";
-	var quote = "";
-	var header = "";
-	var fill = "";
-	var comchar = "";
 	var tableOptions = "";
-	quick = getValue ("quick");
+	var quick = getValue ("quick");
 	if (quick == "table") {
-		dec = getValue ("dec");
-		if (dec == "other") dec = quoteString (getValue ("custom_dec"));
-		sep = getValue ("sep");
-		if (sep == "other") sep = quoteString (getValue ("custom_sep"));
-		quote = getValue ("quote");
-		if (quote == "other") quote = quoteString (getValue ("custom_quote"));
-		header = getValue ("header");
-		fill = getValue ("fill");
-		comchar = quoteString (getValue ("commentchar"));
-		tableOptions = ", header={$header}, sep={$sep}, quote={$quote}, dec={$dec}, fill={$fill}, comment.char={$comchar}";
+		var dec = getValue ("dec");
+		if (dec == "other") dec = quote (getValue ("custom_dec"));
+		var sep = getValue ("sep");
+		if (sep == "other") sep = quote (getValue ("custom_sep"));
+		var quote_char = getValue ("quote");
+		if (quote_char == "other") quote_char = quote (getValue ("custom_quote"));
+		var header = getValue ("header");
+		var fill = getValue ("fill");
+		var comchar = quote (getValue ("commentchar"));
+		tableOptions = ", header=" + header + ", sep=" + sep + ", quote=" + quote_char + ", dec=" + dec + ", fill=" + fill + ", comment.char=" + comchar;
 	} else {
 		tableOptions = "";
 	}
@@ -57,7 +19,7 @@
 	echo ('imported <<- read.' + quick + ' (file="' + getValue("file") + '"' + tableOptions + ', '); // doing row names (what a pity...)
 	if (getValue("rowname")!="NULL") {
 		echo ("row.names = ");
-		if (getValue("rowname")=="rowcol") echo (echo (getValue("nomrow")) + ",");
+		if (getValue("rowname")=="rowcol") echo (getValue("nomrow") + ",");
 		else echo (getValue("rownames") + ",");
 	}
 	// doing col names (what a pity...)
@@ -65,7 +27,7 @@
 	// doing col class (what a pity...)
 	if (getValue("colclass") == "custoClass") echo( "colClasses = " + getValue ("custoClasses") + ",");
 	//doing what is left
-	echo (' na.strings = "' + getValue("na"))  echo ('", nrows = ' + getValue("nrows") + ', skip = ' + getValue("skip") + ', check.names = ' + getValue("checkname") + ', strip.white = ' + getValue("stripwhite") + ', blank.lines.skip = ' + getValue("blanklinesskip") + getValue("allow_escapes") + getValue("flush") + getValue("strings_as_factors") + ')\n');
+	echo (' na.strings = "' + getValue("na") + '", nrows = ' + getValue("nrows") + ', skip = ' + getValue("skip") + ', check.names = ' + getValue("checkname") + ', strip.white = ' + getValue("stripwhite") + ', blank.lines.skip = ' + getValue("blanklinesskip") + getValue("allow_escapes") + getValue("flush") + getValue("strings_as_factors") + ')\n');
 	echo ('\n');
 	echo ('# copy from the local environment to globalenv()\n');
 	echo ('assign("' + getValue("name") + '", imported, envir=globalenv())\n');

Deleted: trunk/rkward/rkward/plugins/00saveload/import/import_csv.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,51 +0,0 @@
-<?
-// internal helper function
-function quoteString ($string) {
-	return ('"' . strtr ($string, array ('"'=>'\\"')) . '"');
-}
-
-function preprocess () {
-}
-
-function calculate () {
-	$quick = getRK_val ("quick");
-	if ($quick == "table") {
-		$dec = getRK_val ("dec");
-		if ($dec == "other") $dec = quoteString (getRK_val ("custom_dec"));
-		$sep = getRK_val ("sep");
-		if ($sep == "other") $sep = quoteString (getRK_val ("custom_sep"));
-		$quote = getRK_val ("quote");
-		if ($quote == "other") $quote = quoteString (getRK_val ("custom_quote"));
-		$header = getRK_val ("header");
-		$fill = getRK_val ("fill");
-		$comchar = quoteString (getRK_val ("commentchar"));
-		$tableOptions = ", header={$header}, sep={$sep}, quote={$quote}, dec={$dec}, fill={$fill}, comment.char={$comchar}";
-	} else {
-		$tableOptions = "";
-	}
-// Other method is to use read.table and show all the options - more transparent
-?>imported <<- read.<? echo ($quick); ?> (file="<? getRK("file"); ?>"<? echo ($tableOptions); ?>, <? # doing row names (what a pity...) 
-	if (getRK_val("rowname")!="NULL") {
-		echo( "row.names = ");
-		if (getRK_val("rowname")=="rowcol") echo (getRK("nomrow") . ",");
-		else echo (getRK_val("rownames") . ",");
-	}
-	# doing col names (what a pity...)
-	if (getRK_val("colname") == "custoCol") echo ( "col.names = " . getRK_val ("colnames") . ",");
-	# doing col class (what a pity...)
-	if (getRK_val("colclass") == "custoClass") echo( "colClasses = " . getRK_val ("custoClasses") . ",");
-	#doing what is left
-?> na.strings = "<? getRK("na")  ?>", nrows = <? getRK("nrows") ; ?>, skip = <? getRK("skip") ; ?>, check.names = <? getRK("checkname") ; ?>, strip.white = <? getRK("stripwhite") ; ?>, blank.lines.skip = <? getRK("blanklinesskip") ; ?><? getRK("allow_escapes"); ?><? getRK("flush"); ?><? getRK("strings_as_factors"); ?>)
-
-# copy from the local environment to globalenv()
-assign("<? getRK("name"); ?>", imported, envir=globalenv())
-<?	if (getRK_val ("doedit")) { ?>
-
-rk.edit (<? getRK ("name"); ?>)
-<?	}
-}
-
-function printout () { 
-	makeHeaderCode ("Import text / csv data", array ("File" => getRK_val ("file"), "Import as" => getRK_val ("name")));
-}
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document> 
-	<code file="import_csv.php"/>
+	<code file="import_csv.js"/>
 	<help file="import_csv.rkh"/>
 	<logic>
 		<external id="filename" />

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_spss.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_spss.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_spss.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,15 +1,3 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Note: Control statement without braces. This is bad style.
-
----------------------------- */
-
-// globals
-var undefined;
-
 function preprocess () {
 	echo ('require (foreign)\n');
 	if (getValue ("do_locale_conversion")) {
@@ -32,14 +20,12 @@
 function calculate () {
 	var data_frame = "";
 	var data_frame_opt = "";
-	var labels_opt = "";
-	var object = "";
-	var from_locale = "";
 	if (getValue ("data_frame")) {
 		data_frame = true;
 		data_frame_opt = ", to.data.frame=TRUE";
 	}
 
+	var labels_opt = "";
 	if (getValue ("use_labels")) {
 		labels_opt += ", max.value.labels=" + getValue ("labels_limit");
 		if (getValue ("trim_labels")) labels_opt += ", trim.factor.names=TRUE";
@@ -47,11 +33,11 @@
 		labels_opt = ", use.value.labels=FALSE";
 	}
 
-	object = getValue ("saveto");
+	var object = getValue ("saveto");
 
 	echo ('data <- read.spss ("' + getValue ("file") + '"' + data_frame_opt + labels_opt + ')\n');
 	if (getValue ("do_locale_conversion")) {
-		from_locale = getValue ("encoding");
+		var from_locale = getValue ("encoding");
 		if (from_locale == "other") {
 			from_locale = getValue ("user_encoding");
 		}
@@ -80,6 +66,6 @@
 }
 
 function printout () {
-	makeHeaderCode ("Import SPSS data", new Array("File" ,  getValue ("file"), "Import as" ,  getValue ("saveto")));
+	makeHeaderCode ("Import SPSS data", new Array("File",  getValue ("file"), "Import as",  getValue ("saveto")));
 }
 

Deleted: trunk/rkward/rkward/plugins/00saveload/import/import_spss.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_spss.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_spss.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,70 +0,0 @@
-<?php
-function preprocess () { ?>
-require (foreign)
-<?	if (getRK_val ("do_locale_conversion")) { ?>
-
-# helper function to convert all strings to the current encoding
-iconv.recursive <- function (x, from) {
-	attribs <- attributes (x);
-	if (is.character (x)) {
-		x <- iconv (x, from=from, to="", sub="")
-	} else if (is.list (x)) {
-		x <- lapply (x, function (sub) iconv.recursive (sub, from))
-	}
-	# convert factor levels and all other attributes
-	attributes (x) <- lapply (attribs, function (sub) iconv.recursive (sub, from))
-	x
-}
-<?	}
-}
-
-function calculate () {
-	if (getRK_val ("data_frame")) {
-		$data_frame = true;
-		$data_frame_opt = ", to.data.frame=TRUE";
-	}
-
-	if (getRK_val ("use_labels")) {
-		$labels_opt .= ", max.value.labels=" . getRK_val ("labels_limit");
-		if (getRK_val ("trim_labels")) $labels_opt .= ", trim.factor.names=TRUE";
-	} else {
-		$labels_opt = ", use.value.labels=FALSE";
-        }
-
-	$object = getRK_val ("saveto");
-?>
-data <- read.spss ("<? getRK ("file"); ?>"<? echo ($data_frame_opt); echo ($labels_opt); ?>)
-<?	if (getRK_val ("do_locale_conversion")) {
-		$from_locale = getRK_val ("encoding");
-		if ($from_locale == "other") {
-			$from_locale = getRK_val ("user_encoding");
-		} ?>
-
-# convert all strings to the current encoding
-data <- iconv.recursive (data, from="<? echo ($from_locale); ?>")
-<?	}
-	if (getRK_val ("convert_var_labels")) { ?>
-
-# set variable labels for use in RKWard
-labels <- attr (data, "variable.labels");
-if (!is.null (labels)) {
-	for (i in 1:length (labels)) {
-		col <- make.names (names (labels[i]))
-		if (!is.null (col)) {
-			rk.set.label (data[[col]], labels[i])
-		}
-	}
-}
-<?	} ?>
-
-<? echo ($object); ?> <<- data		# assign to globalenv()
-<?
-	if (getRK_val ("doedit") && $data_frame) { ?>
-rk.edit (<? echo ($object); ?>)
-<?	}
-}
-
-function printout () {
-	makeHeaderCode ("Import SPSS data", array ("File" => getRK_val ("file"), "Import as" => getRK_val ("saveto")));
-}
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-	<code file="import_spss.php" />
+	<code file="import_spss.js" />
 	<help file="import_spss.rkh" />
 	<logic>
 		<external id="filename"/>

Modified: trunk/rkward/rkward/plugins/00saveload/import/load_data.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,18 +1,8 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Warning: please check correctness of conversion of '=>' in arrays by hand
-
----------------------------- */
-
 // globals
 var envir;
-var undefined;
 
-
 function calculate () {
-	var other_env = "";
+	var other_env = false;
 	if (getValue ("other_env")) {
 		other_env = true;
 		envir = getValue ("envir");
@@ -27,7 +17,7 @@
 }
 
 function printout () {
-	makeHeaderCode ("Load data", new Array("File" ,  getValue ("file"), "Import to environment" ,  envir));
+	makeHeaderCode ("Load data", new Array("File",  getValue ("file"), "Import to environment",  envir));
 }
 
 

Deleted: trunk/rkward/rkward/plugins/00saveload/import/load_data.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,27 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-	global $envir;
-
-	if (getRK_val ("other_env")) {
-		$other_env = true;
-		$envir = getRK_val ("envir");
-	} else {
-		$envir = "globalenv()";
-	}
-
-	if ($other_env) { ?>
-assign ("<? echo ($envir); ?>, new.env (parent=globalenv()), envir=globalenv())
-<?	} ?>
-load (file="<? getRK("file"); ?>", envir=<? echo ($envir); ?>)
-<?
-}
-
-function printout () {
-	global $envir; 
-	makeHeaderCode ("Load data", array ("File" => getRK_val ("file"), "Import to environment" => $envir));
-}
-
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/import/load_data.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document> 
-	<code file="load_data.php"/>
+	<code file="load_data.js"/>
 	<help file="load_data.rkh"/>
 	<logic>
 		<convert id="use_globalenv" mode="equals" sources="other_env.state" standard="0"/>

Modified: trunk/rkward/rkward/plugins/00saveload/import/source.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,23 +1,11 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-Warning: please check correctness of conversion of '=>' in arrays by hand
-
----------------------------- */
-
-// globals
-var undefined;
-
-
 function calculate () {
-	var options = "";
 	var prompt = "";
 	// most options should only be shown, if they differ from the default.
-	options = "";
+	var options = "";
 	if (getValue ("echo")) {
 		options += ", echo=TRUE";
-		prompt = getValue ("promptecho");
-		if (!empty (prompt)) {
+		var prompt = getValue ("promptecho");
+		if (prompt.length > 0) {
 			options += ", prompt.echo=\"" + prompt + "\"";
 		}
 		options += ", max.deparse.length=" + getValue ("maxdeparselength");
@@ -31,7 +19,7 @@
 }
 
 function printout () {
-	makeHeadercode ("Source R file", new Array("File" ,  getValue ("file")));
+	makeHeaderCode ("Source R file", new Array("File", getValue ("file")));
 }
 
 

Deleted: trunk/rkward/rkward/plugins/00saveload/import/source.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,29 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-	// most options should only be shown, if they differ from the default.
-	$options = "";
-	if (getRK_val ("echo")) {
-		$options .= ", echo=TRUE";
-		$prompt = getRK_val ("promptecho");
-		if (!empty ($prompt)) {
-			$options .= ", prompt.echo=\"" . $prompt . "\"";
-		}
-		$options .= ", max.deparse.length=" . getRK_val ("maxdeparselength");
-		$options .= ", verbose=" . getRK_val ("verbose");
-	} else {
-		$options .= ", verbose=FALSE";
-	}
-	$options .= ", print.eval=" . getRK_val ("printeval");
-?>
-source (file="<? getRK("file"); ?>", local=<? getRK("local"); echo ($options); ?>, chdir=<? getRK("chdir"); ?>)
-<?
-}
-
-function printout () {
-	makeHeadercode ("Source R file", array ("File" => getRK_val ("file")));
-}
-
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/import/source.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-	<code file="source.php"/>
+	<code file="source.js"/>
 	<help file="source.rkh"/>
 
 	<logic>

Modified: trunk/rkward/rkward/plugins/00saveload/save/save/code.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/save/code.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/save/code.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -12,12 +12,12 @@
 
 
 function calculate () {
-	vars = str_replace ("\n", ",", trim (getValue ("data")));
+	vars = trim (getValue ("data")).replace (/\n/g, ",");
 
 	echo ('save (' + vars + ', file="' + getValue("file") + '", ascii=' + getValue("ascii") + ', compress=' + getValue("compress") + ')\n');
 }
 
 function printout () {
-	makeHeaderCode ("Save R objects", new Array("File" ,  getValue ("file"), "Variables" ,  vars));
+	makeHeaderCode ("Save R objects", new Array("File", getValue ("file"), "Variables", vars));
 }
 

Deleted: trunk/rkward/rkward/plugins/00saveload/save/save/code.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/save/code.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/save/code.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,17 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-	global $vars;
-	$vars = str_replace ("\n", ",", trim (getRK_val ("data")));
-?>
-save (<? echo ($vars); ?>, file="<? getRK("file"); ?>", ascii=<? getRK("ascii"); ?>, compress=<? getRK("compress"); ?>)
-<?
-}
-
-function printout () {
-	global $vars;
-	makeHeaderCode ("Save R objects", array ("File" => getRK_val ("file"), "Variables" => $vars));
-}
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/save/save/description.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/save/description.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/save/description.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-	<code file="code.php"/>
+	<code file="code.js"/>
 
 	<dialog label="Save R objects" >
 		<tabbook>

Modified: trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,23 +1,10 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Warning: please check correctness of conversion of '=>' in arrays by hand
-
----------------------------- */
-
-// globals
-var undefined;
-
-
 function calculate () {
-	var vars = "";
-	vars = str_replace ("\n", "','", trim (getValue ("data"))) ;
+	var vars = trim (getValue ("data")).replace (/\n/g, "','");
 
 	echo ('package.skeleton(name="' + getValue("name") + '", list=c(\'' + vars + '\'), path="' + getValue("path") + '", force= ' + getValue("force") + ')\n');
 }
 
 function printout () {
-	makeHeaderCode ("Create package skeleton", new Array("Name" ,  getValue ("name"), "Directory" ,  getValue ("path")));
+	makeHeaderCode ("Create package skeleton", new Array("Name", getValue ("name"), "Directory", getValue ("path")));
 }
 

Deleted: trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,15 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-$vars = str_replace ("\n", "','", trim (getRK_val ("data"))) ;
-?>
-package.skeleton(name="<? getRK("name"); ?>", list=c('<? echo ($vars); ?>'), path="<? getRK("path"); ?>", force= <? getRK("force"); ?>)
-<?
-}
-
-function printout () {
-	makeHeaderCode ("Create package skeleton", array ("Name" => getRK_val ("name"), "Directory" => getRK_val ("path")));
-}
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/save/skeleton/description.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/skeleton/description.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/skeleton/description.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-	<code file="code.php"/>
+	<code file="code.js"/>
 
 	<dialog label="Create package skeleton">
 		<tabbook>

Modified: trunk/rkward/rkward/plugins/00saveload/save/write.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/write.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,20 +1,5 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Note: Control statement without braces. This is bad style.
-Note: Control statement without braces. This is bad style.
-
----------------------------- */
-
-// globals
-var undefined;
-
-
 function calculate () {
-	var sep = "";
-	sep = getValue ("sep");
+	var sep = getValue ("sep");
 	if (sep == "other") sep = getValue ("custom_sep");
 	if (sep == " ") sep = "";
 	else sep = ", sep=" + quote (sep);
@@ -23,6 +8,6 @@
 }
 
 function printout () {
-	makeHeaderCode ("Write Variables", new Array("File" ,  getValue ("file"), "Data" ,  getValue ("data")));
+	makeHeaderCode ("Write Variables", new Array("File", getValue ("file"), "Data",  getValue ("data")));
 }
 

Deleted: trunk/rkward/rkward/plugins/00saveload/save/write.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/write.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,18 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-	$sep = getRK_val ("sep");
-	if ($sep == "other") $sep = getRK_val ("custom_sep");
-	if ($sep == " ") $sep = "";
-	else $sep = ", sep=" . quote ($sep);
-?>
-write (x=<? getRK("data"); ?>, file="<? getRK("file"); ?>", ncolumns=<? getRK("ncolumns"); ?>, append=<? getRK("append"); echo ($sep); ?>)
-<?
-}
-
-function printout () {
-	makeHeaderCode ("Write Variables", array ("File" => getRK_val ("file"), "Data" => getRK_val ("data")));
-}
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/save/write.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/write.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-	<code file="write.php"/>
+	<code file="write.js"/>
 	<logic>
 		<convert id="several_columns" mode="range" min="2" sources="ncolumns.int"/>
 		<connect client="sep.enabled" governor="several_columns" />

Modified: trunk/rkward/rkward/plugins/00saveload/save/write_table.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write_table.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/write_table.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,19 +1,5 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Warning: please check correctness of conversion of '=>' in arrays by hand
-Note: Control statement without braces. This is bad style.
-Note: Control statement without braces. This is bad style.
-
----------------------------- */
-
-// globals
-var undefined;
-
-
 function calculate () {
-	echo ('write.table ( x =  ' + getValue("data") + ' , file =  "' + getValue("file") + '" , append =  ' + getValue("append") + '  ,quote = ' + getValue("quote")) echo (' ,  sep = ' + getValue("sep")) echo (' , eol = "' + getValue("eol"))  echo ('" , na = "' + getValue("na"))  echo ('" ,  dec = ' + getValue("dec")) echo (' , row.names =  ');
+	echo ('write.table ( x =  ' + getValue("data") + ' , file =  "' + getValue("file") + '" , append =  ' + getValue("append") + '  ,quote = ' + getValue("quote") + ' ,  sep = ' + getValue("sep") + ' , eol = "' + getValue("eol") + '" , na = "' + getValue("na") + '" ,  dec = ' + getValue("dec") + ' , row.names =  ');
 	if (getValue("rows") == "custoRow") echo (getValue("rownames")) ;
 	else  echo (getValue("rows") + ' ,  col.names =  ');
 	if (getValue("columns") == "custoCol") echo (getValue("colnames")) ;
@@ -21,6 +7,6 @@
 }
 
 function printout () {
-	makeHeaderCode ("Write as table", new Array("File" ,  getValue ("file"), "Data" ,  getValue ("data")));
+	makeHeaderCode ("Write as table", new Array("File", getValue ("file"), "Data",  getValue ("data")));
 }
 

Deleted: trunk/rkward/rkward/plugins/00saveload/save/write_table.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write_table.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/write_table.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,14 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-?>
-write.table ( x =  <? getRK("data") ; ?> , file =  "<? getRK("file") ; ?>" , append =  <? getRK("append") ; ?>  ,quote = <? getRK("quote") ?> ,  sep = <? getRK("sep") ?> , eol = "<? getRK("eol")  ?>" , na = "<? getRK("na")  ?>" ,  dec = <? getRK("dec") ?> , row.names =  <? if (getRK_val("rows") == "custoRow") getRK("rownames") ; else  getRK("rows")  ; ?> ,  col.names =  <? if (getRK_val("columns") == "custoCol") getRK("colnames") ; else  getRK("columns")  ; ?> , qmethod=  <? getRK("qmethod") ; ?> ) 
-<?
-}
-
-function printout () {
-	makeHeaderCode ("Write as table", array ("File" => getRK_val ("file"), "Data" => getRK_val ("data")));
-}
-?>

Modified: trunk/rkward/rkward/plugins/00saveload/save/write_table.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write_table.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/save/write_table.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-	<code file="write_table.php"/>
+	<code file="write_table.js"/>
 
 	<logic>
 		<convert id="customizerow" mode="equals" sources="rows.string" standard="custoRow" />

Modified: trunk/rkward/rkward/plugins/00saveload/setworkdir.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/setworkdir.js	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/setworkdir.js	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,17 +1,4 @@
-/* ------- This file generated by php2js from PHP code. --------
-Please check this file by hand, and remove this notice, afterwards.
-Messages:
-
----------------------------- */
-
-// globals
-var undefined;
-
-
 function calculate () {
-	var dir = "";
-	dir = getValue ("dir");
-
-	echo ('setwd("' + dir + '")\n');
+	echo ('setwd("' + getValue ("dir") + '")\n');
 }
 

Deleted: trunk/rkward/rkward/plugins/00saveload/setworkdir.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/setworkdir.php	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/setworkdir.php	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,14 +0,0 @@
-<?php
-function preprocess () {
-}
-
-function calculate () {
-	$dir = getRK_val ("dir");
-?>
-setwd("<? echo ($dir); ?>")
-<?
-}
-
-function printout () {
-}
-?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/00saveload/setworkdir.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/setworkdir.xml	2010-02-21 19:21:54 UTC (rev 2751)
+++ trunk/rkward/rkward/plugins/00saveload/setworkdir.xml	2010-02-21 19:40:15 UTC (rev 2752)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-  <code file="setworkdir.php" />
+  <code file="setworkdir.js" />
   <help file="setworkdir.rkh" />
   <dialog label="Set the working directory">
     <browser size="small" id="dir" type="dir" label="Choose the Working Directory"/>


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