Changeset 1342
- Timestamp:
- 02/05/07 16:17:07 (6 years ago)
- Location:
- ccsweb/trunk/ccs_mods/graphs
- Files:
-
- 4 edited
-
config-graphs.php (modified) (7 diffs)
-
config-graphs.tpl (modified) (1 diff)
-
config-part-div.js (modified) (3 diffs)
-
config-part-div.tpl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ccsweb/trunk/ccs_mods/graphs/config-graphs.php
r1273 r1342 245 245 if (xmlrpc_has_error($rv)) { 246 246 ccs_notice("Could not update Group: ".xmlrpc_error_string($rv)); 247 $group= array("group_name"=>$_REQUEST["group_name"]); 247 248 } else { 248 249 ccs_notice("Group details successfully updated."); … … 268 269 get_if_posted(&$part, "class_id"); 269 270 get_if_posted(&$part, "group_id"); 271 get_if_posted(&$part, "virtical_label"); 270 272 $rv = do_xmlrpc("addGraphType", array($part), 271 273 $xmlrpc_conn, TRUE, FALSE); 272 274 if (xmlrpc_has_error($rv)) { 273 275 ccs_notice("Could not update Graph: ".xmlrpc_error_string($rv)); 276 277 $graph= array("title"=>$_REQUEST["title"], "class_id"=>$_REQUEST["class_id"], "virtical_label"=>$_REQUEST["virtical_label"]); 274 278 } else { 275 279 ccs_notice("Graph details successfully updated."); … … 300 304 ********************************************************************/ 301 305 }else if ($_REQUEST["do"] == "newpart") { 306 $smarty->assign("part", array("type"=>"DEF")); 302 307 if ($_REQUEST["process"]=="yes") { 303 308 $part = array(); … … 314 319 if (xmlrpc_has_error($rv)) { 315 320 ccs_notice("Could not update Graph part: ".xmlrpc_error_string($rv)); 321 $part= array("type"=>$_REQUEST["type"], "graph_order"=>$_REQUEST["graph_order"], "varname"=>$_REQUEST["varname"], "filename"=>$_REQUEST["filename"] , "cf"=>$_REQUEST["cf"] , "colour"=>$_REQUEST["colour"], "text"=>$_REQUEST["text"]); 322 //, ""=>$_REQUEST[""]) 323 $smarty->assign("part", $part); 316 324 } else { 317 325 ccs_notice("Graph part details successfully updated."); … … 327 335 getVars($_REQUEST["graph_id"]); 328 336 $smarty->assign("action", "newpart"); 329 $smarty->assign("part", array("type"=>"DEF"));330 337 $smarty->assign("items", $items); 331 338 $smarty->assign("group_id", $_REQUEST["group_id"]); … … 350 357 xmlrpc_error_string($error)); 351 358 } 352 display_ groups();359 display_type(); 353 360 }else{ 354 361 $part = do_xmlrpc("getGraphPart", array($_REQUEST["part_id"]), $xmlrpc_conn, TRUE, FALSE); … … 378 385 xmlrpc_error_string($error)); 379 386 } 380 display_group s();387 display_group(); 381 388 }else{ 382 389 $part = do_xmlrpc("getGraphType", array($_REQUEST["graph_id"]), $xmlrpc_conn, TRUE, FALSE); -
ccsweb/trunk/ccs_mods/graphs/config-graphs.tpl
r1256 r1342 23 23 {include file="header.tpl" title="Graphs"} 24 24 <div id="instructions"> 25 This is a list of groups that graphs are grouped in.25 Graphs are grouped into groups of similar graphs for ease of viewing. 26 26 <br /> 27 27 <br /> -
ccsweb/trunk/ccs_mods/graphs/config-part-div.js
r1273 r1342 21 21 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 22 */ 23 23 errCount=0; 24 24 url = "https://" + site + "/mods/graphs/config-graphs.php"; 25 25 … … 28 28 '#type' : function(element){ 29 29 element.onchange = type_selected; 30 }, 31 '#varname' : function(element){ 32 element.onchange = validataVarname; 33 }, 34 '#colour' : function(element){ 35 element.onchange = validateColour; 36 }, 37 '#text' : function(element){ 38 element.onchange = validateText; 39 }, 40 '#cf' : function(element){ 41 element.onchange = validateCf; 42 }, 43 '#graph_order' : function(element){ 44 element.onchange = validateOrder; 30 45 } 46 31 47 }; 32 48 33 49 Behaviour.register(myrules); 50 Behaviour.addLoadEvent(validateForm); 51 52 function validataVarname(){ 53 type_o = $("type"); 54 if (type_o) 55 type = $F("type"); 56 box = document.getElementById("varname"); 57 if (type == "VRULE"){ 58 if (box.value == ""){ 59 setError("varname", "Must set a time!"); 60 return; 61 } 62 var anum=/(^\d+$)|(^\d+\.\d+$)/ 63 if (!anum.test(box.value)){ 64 setError("varname", "Must be a number!"); 65 return; 66 } 67 } 68 if (box.value == ""){ 69 setError("varname", "Must be supplied!"); 70 return; 71 } 72 clearError("varname"); 73 } 74 function validateColour(){ 75 box = document.getElementById("colour"); 76 if (box){ 77 if (box.value == ""){ 78 setError("colour", "Colour must be given!"); 79 return; 80 } 81 //Hex is required 82 var anum=/(^[0123456789ABCDEFabcdef]+$)|(^[0123456789ABCDEFabcdef]+\.[0123456789ABCDEFabcdef]+$)/ 83 if (!anum.test(box.value)){ 84 setError("colour", "Invalid Characters!"); 85 return; 86 } 87 if (box.value.length != 6){ 88 setError("colour", "Need 6 charactors!"); 89 return; 90 } 91 } 92 93 clearError("colour"); 94 } 95 function validateText(){ 96 type_o = $("type"); 97 if (type_o) 98 type = $F("type"); 99 box = document.getElementById("text"); 100 if (box){ 101 if (box.value == ""){ 102 setError("text", "Chain must be given!"); 103 return; 104 }} 105 106 clearError("text"); 107 } 108 function validateCf(){ 109 clearError("cf"); 110 } 111 function validateOrder(){ 112 box = document.getElementById("graph_order"); 113 if (box){ 114 if (box.value == ""){ 115 setError("order", "Must be given!"); 116 return; 117 } 118 var anum=/(^\d+$)|(^\d+\.\d+$)/ 119 if (!anum.test(box.value)){ 120 setError("order", "Must be a number!"); 121 return; 122 }} 123 clearError("order"); 124 } 125 34 126 35 127 // When a type is selected update the variables (and page) … … 66 158 object.innerHTML = string; 67 159 Behaviour.apply(); 160 validateForm(); 68 161 } 162 163 function validateForm() 164 { 165 errCount=0; 166 validataVarname(); 167 validateColour(); 168 validateText(); 169 validateCf(); 170 validateOrder(); 171 } -
ccsweb/trunk/ccs_mods/graphs/config-part-div.tpl
r1341 r1342 23 23 24 24 <tr> 25 <th width="200" >Type</th><td>25 <th width="200">Type</th><td> 26 26 <select id="type" name="type" /> 27 27 <option value="DEF" {if $part.type == "DEF"}selected="selected"{/if}>DEF</option> … … 35 35 <option value="LINE2" {if $part.type == "LINE2"}selected="selected"{/if}>LINE2</option> 36 36 <option value="LINE3" {if $part.type == "LINE3"}selected="selected"{/if}>LINE3</option> 37 <option value="SHIFT" {if $part.type == "SHIFT"}selected="selected"{/if}>SHIFT</option>38 37 <option value="STACK" {if $part.type == "STACK"}selected="selected"{/if}>STACK</option> 39 38 <option value="AREA" {if $part.type == "AREA"}selected="selected"{/if}>AREA</option> … … 41 40 </tr> 42 41 <tr> 43 <th width="200" >Order</th>42 <th width="200" id="order-header">Order</th> 44 43 <td><input type="text" name="graph_order" id="graph_order" value="{$part.graph_order}"/>This field controls the order in which they are used during rendering. If two numbers are the same it is undefined what order they will be used.</td> 45 44 </tr> 46 {if $part.type == "LINE1" || $part.type == "LINE2" || $part.type == "LINE 2" || $part.type == "AREA" || $part.type == "STACK"}45 {if $part.type == "LINE1" || $part.type == "LINE2" || $part.type == "LINE3" || $part.type == "AREA" || $part.type == "STACK"} 47 46 <tr> 48 <th width="200" >Variable</th><td>47 <th width="200" id="varname-header">Variable</th><td> 49 48 <select name="varname" id="varname"> 50 49 {foreach from=$vars item=var} … … 54 53 </td></tr> 55 54 <tr> 56 <th width="200" >Colour</th>57 <td><input type="text" name="colour" id="colour" value="{$part.colour}"/>The draw colour </td>55 <th width="200" id="colour-header">Colour</th> 56 <td><input type="text" name="colour" id="colour" value="{$part.colour}"/>The draw colour in hex (RRGGBB eg FF0000 is red)</td> 58 57 </tr> 59 58 <tr> … … 65 64 {if $part.type == "HRULE"} 66 65 <tr> 67 <th width="200" >Value</th>66 <th width="200" id="varname-header">Value</th> 68 67 <td><input type="text" name="varname" id="varname" value="{$part.varname}"/></td> 69 68 </tr> 70 69 <tr> 71 <th width="200" >Colour</th>72 <td><input type="text" name="colour" id="colour" value="{$part.colour}"/>The draw colour </td>70 <th width="200" id="colour-header">Colour</th> 71 <td><input type="text" name="colour" id="colour" value="{$part.colour}"/>The draw colour in hex (RRGGBB eg FF0000 is red)</td> 73 72 </tr> 74 73 <tr> … … 79 78 {if $part.type == "VRULE"} 80 79 <tr> 81 <th width="200" >Time</th>80 <th width="200" id="varname-header">Time</th> 82 81 <td><input type="text" name="varname" id="varname" value="{$part.varname}"/>In seconds since 1 Jan 1970</td> 83 82 </tr> 84 83 <tr> 85 <th width="200" >Colour</th>86 <td><input type="text" name="colour" id="colour" value="{$part.colour}"/>The draw colour </td>84 <th width="200" id="colour-header">Colour</th> 85 <td><input type="text" name="colour" id="colour" value="{$part.colour}"/>The draw colour in hex (RRGGBB eg FF0000 is red)</td> 87 86 </tr> 88 87 <tr> … … 94 93 {if $part.type == "PRINT" || $part.type == "GPRINT"} 95 94 <tr> 96 <th width="200" >Variable</th><td>95 <th width="200" id="varname-header">Variable</th><td> 97 96 <select name="varname" id="varname"> 98 97 {foreach from=$vars item=var} … … 111 110 </tr> 112 111 <tr> 113 <th width="200" >Statement</th>112 <th width="200" id="text-header">Statement</th> 114 113 <td><input type="text" name="text" id="text" value="{$part.text}"/></td> 115 114 </tr> … … 117 116 {if $part.type == "COMMENT"} 118 117 <tr> 119 <th width="200" >Comment</th>118 <th width="200" id="text-header">Comment</th> 120 119 <td><input type="text" name="text" id="text" value="{$part.text}"/></td> 121 120 </tr> … … 123 122 {if $part.type == "DEF"} 124 123 <tr> 125 <th width="200" >Variable</th>124 <th width="200" id="varname-header">Variable</th> 126 125 <td><input type="text" name="varname" id="varname" value="{$part.varname}"/>The variable name</td> 127 126 </tr> … … 147 146 {if $part.type == "CDEF"} 148 147 <tr> 149 <th width="200" >Variable</th>148 <th width="200" id="varname-header">Variable</th> 150 149 <td><input type="text" name="varname" id="varname" value="{$part.varname}"/>The variable name</td> 151 150 </tr> 152 151 <tr> 153 <th width="200" >Chain</th>152 <th width="200" id="text-header">Chain</th> 154 153 <td><input type="text" name="text" id="text" value="{$part.text}"/></td> 155 154 </td></tr>
Note: See TracChangeset
for help on using the changeset viewer.
