File: 0.02.53a/server/web/localtest.edit.php (View as HTML)

  1: <?php
  2: /* -------------------------------------------------------------
  3: This file is part of FreeNATS
  4: 
  5: FreeNATS is (C) Copyright 2008 PurplePixie Systems
  6: 
  7: FreeNATS is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeNATS is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with Foobar.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freenats
 21: -------------------------------------------------------------- */
 22: 
 23: ob_start();
 24: require("include.php");
 25: $NATS->Start();
 26: if (!$NATS_Session->Check($NATS->DB))
 27: 	{
 28: 	header("Location: ./?login_msg=Invalid+Or+Expired+Session");
 29: 	exit();
 30: 	}
 31: if ($NATS_Session->userlevel<5) UL_Error("Edit Local Test");
 32: ob_end_flush();
 33: Screen_Header("Local Test Editor",1);
 34: ?>
 35: <br>
 36: <?php
 37: $q="SELECT * FROM fnlocaltest WHERE localtestid=".ss($_REQUEST['localtestid'])." LIMIT 0,1";
 38: $r=$NATS->DB->Query($q);
 39: if (!$row=$NATS->DB->Fetch_Array($r))
 40: 	{
 41: 	echo "No such test!<br><br>";
 42: 	Screen_Footer();
 43: 	exit();
 44: 	}
 45: 
 46: echo "<b class=\"minortitle\">Editing Test on NodeID: <a href=node.edit.php?nodeid=".$row['nodeid'].">".$row['nodeid']."</a></b><br><br>";
 47: 
 48: if (isset($_REQUEST['message'])) 
 49: 	{
 50: 	echo "<b>".$_REQUEST['message']."</b><br><br>";
 51: 	$poplist[]=$_REQUEST['message'];
 52: 	}
 53: 
 54: echo "<table border=0>";
 55: echo "<form action=localtest.action.php method=post>";
 56: echo "<input type=hidden name=localtestid value=".$_REQUEST['localtestid'].">";
 57: echo "<input type=hidden name=action value=save_form>";
 58: echo "<tr><td>Test Type :</td>";
 59: echo "<td>".lText($row['testtype']);
 60: echo "</td></tr>";
 61: echo "<tr><td>Parameters :</td><td>";
 62: echo "<input type=text name=testparam size=30 maxlength=128 value=\"".$row['testparam']."\">";
 63: echo "</td></tr>";
 64: echo "<tr><td>Recorded :</td><td>";
 65: if ($row['testrecord']==1) $s=" checked";
 66: else $s="";
 67: echo "<input type=checkbox name=testrecord value=1".$s.">";
 68: echo "</td></tr>";
 69: echo "<tr><td>Simple Evaluation :</td><td>";
 70: if ($row['simpleeval']==1) $s=" checked";
 71: else $s="";
 72: echo "<input type=checkbox name=simpleeval value=1".$s.">";
 73: echo "</td></tr>";
 74: echo "<tr><td colspan=2><input type=submit value=\"Save Test Settings\"> <a href=node.edit.php?nodeid=".$row['nodeid'].">Abandon Changes</a>";
 75: echo "</td></tr></form>";
 76: 
 77: echo "<tr><td colspan=2>&nbsp;<br>";
 78: echo "<b class=\"sectitle\"><u>Test Evaluators</u></b><br><br>";
 79: if ($row['simpleeval']==1)
 80: 	{
 81: 	echo "<i>Custom evaluators will not be processed as<br>Simple Evaluation is checked (above)</i><br>";
 82: 	}
 83: echo "</td></tr>";
 84: 
 85: $q="SELECT * FROM fneval WHERE testid=\"L".ss($_REQUEST['localtestid'])."\" ORDER BY weight ASC";
 86: $r=$NATS->DB->Query($q);
 87: while ($row=$NATS->DB->Fetch_Array($r))
 88: 	{
 89: 	echo "<tr><td>".$row['eoperator']." ".$row['evalue']." =&gt; ".oText($row['eoutcome'])."</td>";
 90: 	echo "<td><a href=eval.action.php?action=delete&back=".urlencode("localtest.edit.php?localtestid=".$_REQUEST['localtestid']."&message=Evaluator+Deleted")."&evalid=".$row['evalid'].">Delete</a>";
 91: 	//echo " | <a href=eval.action.php?action=move&dir=up&evalid=".$row['evalid'].">Up</a>/<a href=eval.action.php?action=move&dir=dn&evalid=".$row['evalid'].">Down</a>";
 92: 	echo "</td></tr>";
 93: 	}
 94: 
 95: echo "<form action=eval.action.php>";
 96: echo "<input type=hidden name=action value=create>";
 97: echo "<input type=hidden name=testid value=L".$_REQUEST['localtestid'].">";
 98: echo "<tr><td colspan=2>&nbsp;<br></td></tr>";
 99: echo "<tr><td><b>Add New :</b></td>";
100: echo "<td><select name=eoperator>";
101: echo "<option value=ET>Equal To</option><option value=LT>Less Than</option><option value=GT>Greater Than</option>";
102: echo "</select> <input type=text name=evalue size=4 value=0> =&gt; ";
103: echo "<select name=eoutcome>";
104: echo "<option value=1>Warning</option>";
105: echo "<option value=2>Failure</option>";
106: echo "</select> <input type=submit value=Add></td></tr>";
107: echo "</form>";
108: 
109: 
110: echo "</table>";
111: 
112: ?>
113: 
114: <?php
115: Screen_Footer();
116: ?>
117: