File: 0.02.19a/server/base/help.inc.php (View as HTML)

  1: <?php // help.inc.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: $NATS_Help=array();
 24: 
 25: function ha($id,$text)
 26: {
 27: global $NATS_Help;
 28: $NATS_Help[strtoupper($id)]=$text;
 29: }
 30: 
 31: ha("FreeNATS","FreeNATS is a network monitoring package");
 32: 
 33: ha("Node","A node is a system or device which you are monitoring. Note that nodes can have tests pointing to different physical devices and vice-versa");
 34: ha("Node:Create","Create a new {node} with this {node:id|NodeID}");
 35: ha("Node:ID","The NodeID is a unique text name for a {node}. Maximum length 60 chars and only normal characters allowed.");
 36: 
 37: ha("Group","A group is a collection of one or more {node|nodes}. Note that nodes can be members of more than one group.");
 38: ha("Group:Create","Create a new {group} with this name");
 39: 
 40: ha("History:Should","A rough calculation based on 5 minute polling from the start to finish (or now if sooner)");
 41: 
 42: ha("Variable","System variables are used to control the system environment. To delete a variable just save it with a blank name.");
 43: ha("Var:log.level","The system log level - 10 is everything, 0 is fatal only. 5-6-ish is probably a good balance.");
 44: 
 45: ha("Var:site.enable.interactive","Must be set (1) to allow interactive web sessions (like this one)");
 46: 
 47: ha("Var:test.icmp.timeout","Timeout in seconds to wait for an ICMP response before declaring a failure in seconds (default 10)");
 48: ha("Var:test.icmp.trytwice","If 1 the main tester will try a second ICMP test if the first failed before failing (default 1)");
 49: 
 50: ha("Var:retain.alert","Days to retain alert records for (default 356). Retain forever with value 0.");
 51: ha("Var:retain.record","Days to retain test result records for use in history and graphs (default 356). Retain forever with value 0.");
 52: ha("Var:retain.testrun","Days to retain test run records for (default 30). Retain forever with value 0.");
 53: function hdisp($id,$html=true)
 54: {
 55: global $NATS_Help;
 56: if (!isset($NATS_Help[strtoupper($id)])) return "";
 57: $t=$NATS_Help[strtoupper($id)];
 58: $o="";
 59: $mode="text";
 60: $linktext=false;
 61: for ($a=0; $a<strlen($t); $a++)
 62: 	{
 63: 	$c=$t[$a];
 64: 	
 65: 	if ($c=="{") // start of a link
 66: 		{
 67: 		$mode="link";
 68: 		$linktext=false;
 69: 		$linkid="";
 70: 		$linktxt="";
 71: 		}
 72: 		
 73: 	else if ( ($mode=="link") && ($c=="|") ) // in a link and move into text mode...
 74: 		{
 75: 		$linktext=true;
 76: 		}
 77: 		
 78: 	else if ( ($mode=="link") && ($c=="}") ) // in a link and the end of the link
 79: 		{
 80: 		if (!$linktext) $linktxt=$linkid;
 81: 		if ($html) $o.="<a href=\"help.php?id=".$linkid."\">";
 82: 		$o.=$linktxt;
 83: 		if ($html) $o.="</a>";
 84: 		$mode="text";
 85: 		}
 86: 		
 87: 	else if ( $mode=="link" ) // in a link
 88: 		{
 89: 		if ($linktext) $linktxt.=$c;
 90: 		else $linkid.=$c;
 91: 		}
 92: 		
 93: 	else // in text
 94: 		$o.=$c;
 95: 	}
 96: return $o;
 97: }
 98: 
 99: function hlink($id,$size=16)
100: {
101: global $NATS_Help;
102: if (isset($NATS_Help[strtoupper($id)]))
103: 	return "<a href=\"javascript:freenats_help('".$id."')\"><img src=\"images/info".$size.".gif\" title=\"".hdisp($id,false)."\" border=0></a>";
104: 	
105: return "<img src=\"images/info".$size."g.gif\" border=0 title=\"Sorry, no help available.\">";
106: }
107: 
108: function ph($id,$size=16)
109: {
110: echo hlink($id,$size);
111: }
112: ?>