[prev in list] [next in list] [prev in thread] [next in thread] 

List:       os-sim-commits
Subject:    [Os-sim-commits] os-sim/www/host gethost.php, 1.5, 1.6 host.php,
From:       Juan Manuel Albarracin <jmalbarracin () users ! sourceforge ! net>
Date:       2009-09-30 9:02:08
Message-ID: E1Msv4a-00031T-2c () 23jxhf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/os-sim/os-sim/www/host
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11491/www/host

Modified Files:
	gethost.php host.php newhostgroup.php newhostgroupform.php 
Log Message:
Added "host group" Back button to auto-fill form 


Index: newhostgroupform.php
===================================================================
RCS file: /cvsroot/os-sim/os-sim/www/host/newhostgroupform.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- newhostgroupform.php	9 Sep 2009 08:43:27 -0000	1.15
+++ newhostgroupform.php	30 Sep 2009 09:02:06 -0000	1.16
@@ -144,7 +144,7 @@
   <tr>
     <th> <?php
 echo gettext("Name"); ?> </th>
-    <td class="left"><input type="text" name="name" size="30" value="<?php echo \
$hg_name ?>"></td> +    <td class="left"><input type="text" name="name" size="30" \
value="<?=((REQUEST('name')!="") ? REQUEST('name') : $hg_name )?>"></td>  </tr>
 
   <tr>
@@ -159,9 +159,16 @@
 	<td class="left nobborder">
 		<select id="hosts" name="ips[]" size="20" multiple="multiple" style="width:250px">
 		<?php
-foreach($host_list as $host) {
-    $ip = $host->get_host_ip($conn);
-    echo "<option value='$ip'>$ip\n";
+		
+if(count($host_list)==0 && count($_POST['ips'])!=0){
+	$list = $_POST['ips'];
+	foreach($list as $v) echo "<option value='$v'>$v\n";
+}
+else{
+	foreach($host_list as $host) {
+	    $ip = $host->get_host_ip($conn);
+	    echo "<option value='$ip'>$ip\n";
+	}
 } ?>
 		</select>
 		<input type="button" value=" [X] " onclick="deletefrom('hosts')" class="btn">
@@ -170,13 +177,13 @@
   <tr>
     <th> <?php echo gettext("Threshold C"); ?> </th>
     <td class="left">
-      <input type="text" name="threshold_c" size="4" value="<?php echo $hg_thrc ?>">
+      <input type="text" name="threshold_c" size="4" \
value="<?=((REQUEST('threshold_c')!="") ? REQUEST('threshold_c') : $hg_thrc )?>">  \
</td>  </tr>
   <tr>
     <th> <?php echo gettext("Threshold A"); ?> </th>
     <td class="left">
-      <input type="text" name="threshold_a" size="4" value="<?php echo $hg_thra ?>">
+      <input type="text" name="threshold_a" size="4" \
value="<?=((REQUEST('threshold_a')!="") ? REQUEST('threshold_a') : $hg_thra )?>">  \
</td>  </tr>
 
@@ -209,7 +216,7 @@
         <input type="checkbox" name="<?php
         echo $sname; ?>"
             value="<?php
-        echo $sensor_name; ?>" <?php echo (in_array($sensor_name, $hg_sensors)) ? \
"checked" : "" ?>> +        echo $sensor_name; ?>" <?php echo (in_array($sensor_name, \
$hg_sensors) || REQUEST($sname)!="") ? "checked" : "" ?>>  <?php
         echo $sensor_ip . " (" . $sensor_name . ")<br>"; ?>
         </input>
@@ -231,17 +238,14 @@
         </font>
     </th>
     <td class="left">
-      <select name="rrd_profile">
+      <select name="rrd_profile"><option value=""><?=gettext("None"); ?> </option>
 <?php
 foreach(RRD_Config::get_profile_list($conn) as $profile) {
     if (strcmp($profile, "global")) {
-        echo "<option value=\"$profile\"" . (($rrd_profile == $profile) ? " \
selected" : "") . ">$profile</option>\n"; +        echo "<option value=\"$profile\"" \
. (($rrd_profile == $profile || REQUEST('rrd_profile')==$profile) ? " selected" : "") \
. ">$profile</option>\n";  }
 }
 ?>
-        <option value="" selected>
-	<?php
-echo gettext("None"); ?> </option>
       </select>
     </td>
 
@@ -250,10 +254,10 @@
     <th> <?php
 echo gettext("Scan options"); ?> </th>
     <td class="left">
-        <input type="checkbox" name="nessus" value="1" <?php echo $nessus ?>>
+        <input type="checkbox" name="nessus" value="1"  <?=((REQUEST('nessus') == 1) \
? 'checked' : $nessus)?>>  <?php
 echo gettext("Enable nessus scan"); ?> </input><br/>
-        <input type="checkbox" name="nagios" value="1" <?php echo $nagios ?>>
+        <input type="checkbox" name="nagios" value="1" <?=((REQUEST('nagios') == 1) \
? 'checked' : $nagios)?>>  <?php
 echo gettext("Enable nagios scan"); ?> </input>
     </td>
@@ -263,7 +267,7 @@
     <th> <?php
 echo gettext("Description"); ?> </th>
     <td class="left">
-      <textarea name="descr" rows="2" cols="30"><?php echo $hg_desc ?></textarea>
+      <textarea name="descr" rows="2" cols="30"><?=((REQUEST('descr') != "") ? \
REQUEST('descr') : $hg_desc)?></textarea>  </td>
   </tr>
   <tr>

Index: gethost.php
===================================================================
RCS file: /cvsroot/os-sim/os-sim/www/host/gethost.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gethost.php	8 Sep 2009 08:11:25 -0000	1.5
+++ gethost.php	30 Sep 2009 09:02:06 -0000	1.6
@@ -101,7 +101,7 @@
 foreach($host_list as $host) {
     $ip = $host->get_ip();
     $xml.= "<row id='$ip'>";
-    $name = "<a href=\"../report/index.php?host=$ip\">" . $host->get_hostname() . \
"</a>" . Host_os::get_os_pixmap($conn, $ip); +	$name = "<a \
href=\"../report/index.php?host=$ip\">" . $host->get_hostname() . "</a>" . \
Host_os::get_os_pixmap($conn, $ip);  $xml.= "<cell><![CDATA[" . $name . "]]></cell>";
     $xml.= "<cell><![CDATA[" . $ip . "]]></cell>";
     $xml.= "<cell><![CDATA[" . $host->get_asset() . "]]></cell>";

Index: host.php
===================================================================
RCS file: /cvsroot/os-sim/os-sim/www/host/host.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- host.php	1 Jul 2009 10:53:53 -0000	1.40
+++ host.php	30 Sep 2009 09:02:06 -0000	1.41
@@ -56,6 +56,10 @@
   <script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
   <script type="text/javascript" src="../js/jquery.flexigrid.js"></script>
   <script type="text/javascript" src="../js/urlencode.js"></script>
+
+	<link rel="stylesheet" type="text/css" href="../style/greybox.css"/>
+	<script type="text/javascript" src="../js/greybox.js"></script>
+	
 </head>
 <body>
 
@@ -72,6 +76,12 @@
 		<IFRAME src="" frameborder="0" name="addcontent" id="addcontent" \
width="500"></IFRAME>  </td></tr>
 	</table>
+
+	<!-- Right Click Menu -->
+	<ul id="myMenu" class="contextMenu">
+		<li class="hostreport"><a href="#hostreport" class="greybox">Host Report</a></li>
+	</ul>
+
 	<style>
 		table, th, tr, td {
 			background:transparent;
@@ -136,6 +146,17 @@
 				}
 		});
 	}
+	function menu_action(com,id,fg,fp) {
+		if (com=='hostreport') {
+			var ip = id;
+			var hostname = id;
+			var url = "../report/host_report.php?host="+ip+"&hostname="+hostname+"&greybox=1";
 +			if (hostname == ip) var title = "Host Report: "+ip;
+			else var title = "Host Report: "+hostname+"("+ip+")";
+			GB_show(title,url,450,'90%');
+		}
+	}
+
 	$("#flextable").flexigrid({
 		url: 'gethost.php',
 		dataType: 'xml',
@@ -143,7 +164,7 @@
 		<?php
 $default = array(
     "hostname" => array(
-        'Hotname',
+        'Hostname',
         100,
         'true',
         'left',
@@ -253,6 +274,8 @@
 		nomsg: 'No hosts',
 		useRp: true,
 		rp: 25,
+		contextMenu: 'myMenu',
+		onContextMenuClick: menu_action,
 		showTableToggleBtn: true,
 		singleSelect: true,
 		width: get_width('headerh1'),

Index: newhostgroup.php
===================================================================
RCS file: /cvsroot/os-sim/os-sim/www/host/newhostgroup.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- newhostgroup.php	9 Sep 2009 17:25:46 -0000	1.11
+++ newhostgroup.php	30 Sep 2009 09:02:06 -0000	1.12
@@ -35,6 +35,8 @@
 * Classes list:
 */
 require_once ('classes/Session.inc');
+require_once 'classes/Util.inc';
+
 Session::logcheck("MenuPolicy", "PolicyHosts");
 ?>
 
@@ -68,7 +70,10 @@
 ossim_valid($descr, OSS_ALPHA, OSS_NULLABLE, OSS_SPACE, OSS_PUNC, OSS_AT, 'illegal:' \
. _("Description"));  ossim_valid($nsens, OSS_NULLABLE, OSS_DIGIT, 'illegal:' . \
_("nsens"));  if (ossim_error()) {
-    die(ossim_error());
+	echo ossim_error();
+	Util::make_form($_POST,"newhostgroupform.php");
+	die();
+    //die(ossim_error());
 }
 if (POST('insert')) {
     $num_sens = 0;
@@ -78,19 +83,17 @@
             $num_sens++;
             ossim_valid(POST("$name") , OSS_ALPHA, OSS_SCORE, OSS_PUNC, OSS_AT);
             if (ossim_error()) {
-                die(ossim_error());
+				echo ossim_error();
+				Util::make_form($_POST,"newhostgroupform.php");
+				die();
+				//die(ossim_error());
             }
             $sensors[] = POST("$name");
         }
     }
     if (!isset($sensors)) {
-?>
-        <p> <?php
-        echo gettext("You Need to select at least one sensor"); ?> </p>
-        <p><a href="newhostgroupform.php">
-        <?php
-        echo gettext("Back"); ?> </a></p>
-        <?php
+        Util::print_error("You Need to select at least one sensor");
+        Util::make_form($_POST,"newhostgroupform.php");
         die();
     }
     $hosts = array();
@@ -98,7 +101,10 @@
     foreach($ips as $name) {
         ossim_valid($name, OSS_ALPHA, OSS_NULLABLE, OSS_PUNC, OSS_SPACE, 'illegal:' \
. _("$name"));  if (ossim_error()) {
-            die(ossim_error());
+				echo ossim_error();
+				Util::make_form($_POST,"newhostgroupform.php");
+				die();
+				//die(ossim_error());
         }
         if (!empty($name) && !in_array($name, $hosts)) $hosts[] = $name;
     }


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Os-sim-commits mailing list
Os-sim-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/os-sim-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic