[rkward-cvs] SF.net SVN: rkward:[2724] trunk/rkward/rkward/plugins/plots

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Dec 7 10:59:31 UTC 2009


Revision: 2724
          http://rkward.svn.sourceforge.net/rkward/?rev=2724&view=rev
Author:   tfry
Date:     2009-12-07 10:59:30 +0000 (Mon, 07 Dec 2009)

Log Message:
-----------
Complete conversion of plot_options-plugin to .js

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/plot_options.js
    trunk/rkward/rkward/plugins/plots/plot_options.xml

Removed Paths:
-------------
    trunk/rkward/rkward/plugins/plots/plot_options.php

Modified: trunk/rkward/rkward/plugins/plots/plot_options.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.js	2009-12-07 10:46:07 UTC (rev 2723)
+++ trunk/rkward/rkward/plugins/plots/plot_options.js	2009-12-07 10:59:30 UTC (rev 2724)
@@ -1,36 +1,11 @@
-/* ------- 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
-Found string 'count'. Please check whether conversion is needed (use varname.length).
-Found string 'count'. Please check whether conversion is needed (use varname.length).
-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.
-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;
-
 function prepareLabel (labelname) {
-	var quoted = "";
-	var label = "";
-	quoted = (getValue (labelname + "isquote") == "1");
-	label = getValue (labelname);
+	var quoted = (getValue (labelname + "isquote") == "1");
+	var label = getValue (labelname);
 	if (label == "") {
 		label = getValue ("default_" + labelname);
 		quoted = true;
 	}
-	if ((label != "") && (quoted)) label = "\"" + strtr (label, new Array('"' ,  '\\"')) + "\"";
+	if ((label != "") && (quoted)) label = "\"" + label.replace ('"', '\\"') + "\"";
 	if (label != "") label = ", " + labelname + "=" + label;
 
 	return label;
@@ -65,24 +40,15 @@
 	var col = "";
 	var asp = "";
 	var options = "";
-	log;
-	xaxt;
-	yaxt;
-	xlim;
-	ylim;
-	xlab;
-	ylab;
-	main;
-	sub;
 
-	xvars = split ("\n", getValue ("xvar"));
-	if (count (xvars) > 1) {
+	xvars = getValue ("xvar").split ("\n");
+	if (xvars.length > 1) {
 		xvar = "c (" + join (", ", xvars) + ")";
 	} else {
 		xvar = xvars[0];
 	}
-	yvars = getValue ("yvar");
-	if (count (yvars) > 1) {
+	yvars = getValue ("yvar").split ("\n");
+	if (yvars.length > 1) {
 		yvar = "c (" + join (", ", yvars) + ")";
 	} else {
 		yvar = yvars[0];
@@ -140,8 +106,8 @@
 	if (log != "") log = ", log=\"" + log + "\"";
 
 	type = getValue ("pointtype");
-	if (empty (type)) type = getValue ("default_pointtype");
-	if (!empty (type)) type = ", type=\"" + type + "\"";
+	if (type == "") type = getValue ("default_pointtype");
+	if (type != "") type = ", type=\"" + type + "\"";
 
 	//color of points / lines
 	col = getValue ("pointcolor.code.printout");

Deleted: trunk/rkward/rkward/plugins/plots/plot_options.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.php	2009-12-07 10:46:07 UTC (rev 2723)
+++ trunk/rkward/rkward/plugins/plots/plot_options.php	2009-12-07 10:59:30 UTC (rev 2724)
@@ -1,113 +0,0 @@
-<?
-function prepareLabel ($labelname) {
-	$quoted = (getRK_val ($labelname . "isquote") == "1");
-	$label = getRK_val ($labelname);
-	if ($label == "") {
-		$label = getRK_val ("default_" . $labelname);
-		$quoted = true;
-	}
-	if (($label != "") && ($quoted)) $label = "\"" . strtr ($label, array ('"' => '\\"')) . "\"";
-	if ($label != "") $label = ", " . $labelname . "=" . $label;
-
-	return $label;
-}
-
-function preprocess () {
-}
-
-function calculate () {
-	if (getRK_val ("grid_enable") == "true") {
-		getRK ("grid_options.code.printout");
-	}
-}
-
-function printout () {
-	$log; $xaxt; $yaxt; $xlim; $ylim; $xlab; $ylab; $main; $sub;
-
-	$xvars = split ("\n", getRK_val ("xvar"));
-	if (count ($xvars) > 1) {
-		$xvar = "c (" . join (", ", $xvars) . ")";
-	} else {
-		$xvar = $xvars[0];
-	}
-	$yvars = getRK_val ("yvar");
-	if (count ($yvars) > 1) {
-		$yvar = "c (" . join (", ", $yvars) . ")";
-	} else {
-		$yvar = $yvars[0];
-	}
-
-	if ($yvar == "") {
-		$yvar = "1:length (" . $xvar .")";
-	} else if ($xvar == "") {	// don't replace both at the same time, even if both are empty
-		$xvar = "1:length (" . $yvar .")";
-	}
-
-	// X axis
-	$xaxt = getRK_val ("xaxt");
-	if ($xaxt != "") {
-		$xaxt = ", xaxt=\"" . $xaxt . "\"";
-	}
-	$log .= getRK_val ("xlog");
-
-	$xlab = prepareLabel ("xlab");
-	$xminvalue = getRK_val ("xminvalue");
-	$xmaxvalue = getRK_val ("xmaxvalue");
-	if (($xminvalue != "") || ($xmaxvalue != "")) {
-		$xlim = ", xlim=c (";
-		if (($xminvalue == "") && ($xvar != "")) $xlim .= "min (" . $xvar . ")";
-		else $xlim .= $xminvalue;
-		$xlim .= ", ";
-		if (($xmaxvalue == "") && ($xvar != "")) $xlim .= "max (" . $xvar . ")";
-		else $xlim .= $xmaxvalue;
-		$xlim .= ")";
-	}
-
-
-	// same for Y axis
-	$yaxt = getRK_val ("yaxt");
-	if ($yaxt != ""){
-		$yaxt = ", yaxt=\"" . $yaxt . "\"";
-	}
-	$log .= getRK_val ("ylog");
-
-	$ylab = prepareLabel ("ylab");
-	$yminvalue = getRK_val ("yminvalue");
-	$ymaxvalue = getRK_val ("ymaxvalue");
-	if (($yminvalue != "") || ($ymaxvalue != "")) {
-		$ylim = ", ylim=c (";
-		if (($yminvalue == "") && ($yvar != "")) $ylim .= "min (" . $yvar . ")";
-		else $ylim .= $yminvalue;
-		$ylim .= ", ";
-		if (($ymaxvalue == "") && ($yvar != "")) $ylim .= "max (" . $yvar . ")";
-		else $ylim .= $ymaxvalue;
-		$ylim .= ")";
-	}
-
-
-	// final touches
-	if ($log != "") $log = ", log=\"" . $log . "\"";
-
-	$type = getRK_val ("pointtype");
-	if (empty ($type)) $type = getRK_val ("default_pointtype");
-	if (!empty ($type)) $type = ", type=\"" . $type . "\"";
-
-	//color of points / lines
-	$col = getRK_val ("pointcolor.code.printout");
-
-	// main and subtitle to the plot
-	$main = prepareLabel ("main");
-	$sub = prepareLabel ("sub");
-
-	//define the aspect y/x of the plot
-	$asp = getRK_val ("asp");
-	if ($asp != 0) $asp = ", asp=" . $asp;
-	else $asp = "";
-
-	// make option string
-	$options = $type . $col . $xaxt . $yaxt . $log . $xlim . $ylim . $xlab . $ylab . $main . $sub . $asp;
-
-	echo ($options);
-}
-
-?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/plots/plot_options.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.xml	2009-12-07 10:46:07 UTC (rev 2723)
+++ trunk/rkward/rkward/plugins/plots/plot_options.xml	2009-12-07 10:59:30 UTC (rev 2724)
@@ -1,6 +1,6 @@
 <!DOCTYPE rkplugin>
 <document>
-	<code file="plot_options.php" />
+	<code file="plot_options.js" />
 	<help file="plot_options.rkh" />
 	<logic>
 		<external id="xvar" default="" />


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