[Reconnoiter-devel] [reconnoiter commit] r747 - in trunk/ui/web/htdocs: . css

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Wed Jun 10 13:35:31 EDT 2009


Author: umar
Date: 2009-06-10 13:35:30 -0400 (Wed, 10 Jun 2009)
New Revision: 747

Modified:
   trunk/ui/web/htdocs/css/style.css
   trunk/ui/web/htdocs/template_browse_json.php
Log:
styling changes for template browsing, and validation to ensure each SID placeholder and TEXT placeholder have values set before making graphs.

Modified: trunk/ui/web/htdocs/css/style.css
===================================================================
--- trunk/ui/web/htdocs/css/style.css	2009-06-10 15:50:26 UTC (rev 746)
+++ trunk/ui/web/htdocs/css/style.css	2009-06-10 17:35:30 UTC (rev 747)
@@ -529,6 +529,18 @@
 background:transparent url(../images/icon-min-max.png) no-repeat scroll 15px 3px;
 padding-left:30px;
 }
+#browselist ul li ul li span.sidvar {
+background:none;
+padding-left:0;
+}
+#browselist ul li ul li span.sidvar span.sidvarspan{
+background:none;
+padding-left:15px;
+}
+#browselist ul li ul li#textvar span{
+background:none;
+padding-left:15px;
+}
 #browselist ul li ul li span.numeric {
 background:transparent url(../images/icon-data.png) no-repeat scroll 15px 1px;
 padding-left:30px;
@@ -552,6 +564,10 @@
 #browselist ul li ul li ul li span.templatesid {
 padding-left:30px;
 }
+#browselist ul li ul li#graphcreatebutton span{
+background:none;
+padding-left:8px;
+}
 #browselist ul li ul li ul li span.CreateGraph {
 border:1px solid #DDDDDD;
 padding-left: 0px;

Modified: trunk/ui/web/htdocs/template_browse_json.php
===================================================================
--- trunk/ui/web/htdocs/template_browse_json.php	2009-06-10 15:50:26 UTC (rev 746)
+++ trunk/ui/web/htdocs/template_browse_json.php	2009-06-10 17:35:30 UTC (rev 747)
@@ -107,9 +107,9 @@
 
 	 foreach($textvars as $tv) {
 	   $params = array();
-	   $ctext = "<br>".$tv.":";
-	   $ctext.="<input type='text' size='15' name='".$tv."' id='textvar'><br>";
-	   $jitem = array ('id' => '',
+	   $ctext = $tv.":";
+	   $ctext.="<input type='text' size='15' name='".$tv."' id='textvar'>";
+	   $jitem = array ('id' => 'textvar',
 	    	     	   'text' => $ctext,
 			   'hasChildren' => false,
 			   'classes' => $tv,
@@ -137,11 +137,21 @@
 textvars = [];
 sidvars =[];
 
+//if we have selected atleast one sid for each SID placeholder
+//and set values for TEXT placeholder, make the graphs
+var have_req_txtvals = false;
+var have_req_sidvals = false;
+
+
 var template_e = $("#"+templateid);
 
-template_e.find("#textvar").each ( function (i) {
-        textvals+=  "&"+$(this).attr('name')+"="+$(this).val();
-	textvars[i] = $(this).attr('name');
+template_e.find("input[@id='textvar']").each ( function (i) {
+        textvars[i] = $(this).attr('name');
+	if($(this).val() != '') {
+	  have_req_txtvals = true;
+          textvals+=  "&"+$(this).attr('name')+"="+$(this).val();
+        }
+	else have_req_txtvals = false;
 });
 
 template_e.find(".sidvar").each(function(i) {
@@ -163,12 +173,17 @@
 textvars.sort();
 
 for (i=0; i<sidvars.length; i++){
-        sidvar_sid_map[sidvars[i]].sort();
-	sidvals+="&"+sidvars[i]+"="+sidvar_sid_map[sidvars[i]].join(",");
+  if(sidvar_sid_map[sidvars[i]]) {
+    sidvar_sid_map[sidvars[i]].sort();
+    have_req_sidvals=true;
+    sidvals+="&"+sidvars[i]+"="+sidvar_sid_map[sidvars[i]].join(",");
+  }
+  else {
+    have_req_sidvals=false;
+  }
 }
 
-//if we have selected atleast one sid
-if(sids.length > 0){	 
+if(have_req_txtvals && have_req_sidvals){
 	var dataString = 'templateid='+templateid+'&textvars='+textvars.join(',')+'&sidvars='+sidvars.join(',')+textvals+sidvals;
 	$.ajax({
 		type: "POST",
@@ -176,20 +191,20 @@
 	data: dataString,
 	success: function() { }
 	});
-	$(".CreateGraph").html('Graph Saved').fadeIn('slow');
-	$(".CreateGraph").html('Graph Saved').fadeOut('slow');
+	template_e.find(".CreateGraph").html('Graph Saved').fadeIn('slow');
+	template_e.find(".CreateGraph").html('Graph Saved').fadeOut('slow');
 }
 else {
-     modal_warning("Graph creation error", "You need to select atleast one sid!");
+     modal_warning("Graph creation error", "You need to select atleast one value for each SID placeholder ("+sidvars.join(",")+"), and each TEXT place holder ("+textvars.join(",")+")!");
 }
 }
 
 </script>
 JS;
-$jitem = array ('id' => '',
+$jitem = array ('id' => 'graphcreatebutton',
 	    	     	   'text' => $ctext,
 			   'hasChildren' => false,
-			   'classes' => $tv,
+			   'classes' => '',
 			   'params' => array(),
 			   );
 $bag[] = $jitem;



More information about the Reconnoiter-devel mailing list