Roman Dmitriev 2 лет назад
Родитель
Сommit
088907e73e
3 измененных файлов с 25 добавлено и 24 удалено
  1. 22 21
      html/admin/devices/index-passive.php
  2. 2 2
      html/inc/common.php
  3. 1 1
      html/utils/devices_apply.php

+ 22 - 21
html/admin/devices/index-passive.php

@@ -23,7 +23,7 @@ if ($sort_field == 'login') { $sort_table = 'L'; }
 if ($sort_field == 'fio') { $sort_table = 'L'; }
 if ($sort_field == 'model_name') { $sort_table = 'M'; }
 
-$sort_url = "<a href=index-passive.php?ou=" . $rou; 
+$sort_url = "<a href=index-passive.php?ou=" . $rou;
 
 if ($rou == 0) { $ou_filter = ''; } else { $ou_filter = " and L.ou_id=$rou "; }
 
@@ -64,6 +64,7 @@ print_device_submenu($page_url);
 </td>
 </tr>
 </table>
+</form>
 
 <br>
 <a class="mainButton" href="#modal"><?php print WEB_btn_apply_selected; ?></a>
@@ -74,12 +75,12 @@ print_device_submenu($page_url);
         <h2 id="modal1Title"><?php print WEB_selection_title; ?></h2>
         <input type="hidden" name="ApplyForAll" value="MassChange">
         <table class="data" align=center>
-        <tr><td><input type=checkbox class="putField" name="e_set_type" value='1'></td><td><?php print WEB_cell_type."&nbsp";print_devtype_select($db_link,'a_dev_type',5);?></td></tr>
-        <tr><td><input type=checkbox class="putField" name="e_set_model" value='1'></td><td><?php echo WEB_cell_host_model."&nbsp"; print_device_model_select($db_link,'a_device_model_id',0);?></td></tr>
-        <tr><td><input type=checkbox class="putField" name="e_set_building" value='1'></td><td><?php echo WEB_location_name."&nbsp"; print_building_select($db_link, 'a_building_id', 0);?></td></tr>
-        <tr><td><input type=checkbox class="putField" name="e_set_snmp_version" value='1'></td><td><?php echo WEB_snmp_version."&nbsp";print_snmp_select('a_snmp_version', get_const('snmp_default_version'));?></td></tr>
-        <tr><td><input type=checkbox class="putField" name="e_set_ro_community" value='1'></td><td><?php echo WEB_snmp_community_ro."&nbsp"; ?><input type='text' name='a_ro_community' value="<?php print get_const('snmp_default_community'); ?>"></td></tr>
-        <tr><td><input type=checkbox class="putField" name="e_set_rw_community" value='1'></td><td><?php echo WEB_snmp_community_rw."&nbsp"; ?><input type='text' name='a_rw_community' value="private"></td></tr>
+        <tr><td><input type=checkbox class="putField" name="e_set_type" value='1'></td><td><?php print WEB_cell_type."</td><td>";print_devtype_select($db_link,'a_dev_type',5);?></td></tr>
+        <tr><td><input type=checkbox class="putField" name="e_set_model" value='1'></td><td><?php echo WEB_cell_host_model."</td><td>"; print_devmodels_select($db_link,'a_device_model_id',0,'device_type>2');?></td></tr>
+        <tr><td><input type=checkbox class="putField" name="e_set_building" value='1'></td><td><?php echo WEB_location_name."</td><td>"; print_building_select($db_link, 'a_building_id', 0);?></td></tr>
+        <tr><td><input type=checkbox class="putField" name="e_set_snmp_version" value='1'></td><td><?php echo WEB_snmp_version."</td><td>";print_snmp_select('a_snmp_version', get_const('snmp_default_version'));?></td></tr>
+        <tr><td><input type=checkbox class="putField" name="e_set_ro_community" value='1'></td><td><?php echo WEB_snmp_community_ro."</td><td>"; ?><input type='text' name='a_ro_community' value="<?php print get_const('snmp_default_community'); ?>"></td></tr>
+        <tr><td><input type=checkbox class="putField" name="e_set_rw_community" value='1'></td><td><?php echo WEB_snmp_community_rw."</td><td>"; ?><input type='text' name='a_rw_community' value="private"></td></tr>
         </table>
         <input type="submit" name="submit" class="btn" value="<?php echo WEB_btn_apply; ?>">
     </form>
@@ -108,7 +109,7 @@ if ($unknown and $f_vendor_select==0) { $u_filter=' AND V.id<>1 '; } else {
         }
     }
 
-$countSQL="SELECT Count(*) FROM User_auth A, User_list L, devices D, device_models M, vendors V 
+$countSQL="SELECT Count(*) FROM User_auth A, User_list L, devices D, device_models M, vendors V
 WHERE D.user_id=L.id AND A.ip = D.ip AND D.device_model_id=M.id AND M.vendor_id=V.id AND A.deleted =0
 $u_filter $ip_list_filter $d_filter";
 
@@ -117,26 +118,26 @@ $count_records = mysqli_fetch_array($res);
 $total=ceil($count_records[0]/$displayed);
 if ($page>$total) { $page=$total; }
 if ($page<1) { $page=1; }
-$start = ($page * $displayed) - $displayed; 
+$start = ($page * $displayed) - $displayed;
 print_navigation($page_url,$page,$displayed,$count_records[0],$total);
 ?>
 <br>
 
 <table class="data">
-	<tr>
-		<td align=Center><input type="checkbox" onClick="checkAll(this.checked);"></td>
-		<td align=Center><?php print $sort_url . "&sort=login&order=$new_order>" . WEB_cell_login . "</a>"; ?></td>
-		<td align=Center><?php print $sort_url . "&sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
-		<td align=Center><?php print $sort_url . "&sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
-		<td align=Center><?php print $sort_url . "&sort=model_name&order=$new_order>".WEB_cell_host_model; ?></td>
-		<td align=Center><?php print WEB_cell_comment; ?></td>
-		<td align=Center><?php print WEB_cell_connection; ?></td>
-		<td align=Center><?php print $sort_url . "&sort=last_found&order=$new_order>".WEB_cell_last_found."</a>"; ?></td>
-	</tr>
+        <tr>
+                <td align=Center><input type="checkbox" onClick="checkAll(this.checked);"></td>
+                <td align=Center><?php print $sort_url . "&sort=login&order=$new_order>" . WEB_cell_login . "</a>"; ?></td>
+                <td align=Center><?php print $sort_url . "&sort=ip_int&order=$new_order>" . WEB_cell_ip . "</a>"; ?></td>
+                <td align=Center><?php print $sort_url . "&sort=mac&order=$new_order>" . WEB_cell_mac . "</a>"; ?></td>
+                <td align=Center><?php print $sort_url . "&sort=model_name&order=$new_order>".WEB_cell_host_model; ?></td>
+                <td align=Center><?php print WEB_cell_comment; ?></td>
+                <td align=Center><?php print WEB_cell_connection; ?></td>
+                <td align=Center><?php print $sort_url . "&sort=last_found&order=$new_order>".WEB_cell_last_found."</a>"; ?></td>
+        </tr>
 <?php
 
-$sSQL = "SELECT A.id, D.id as dev_id, D.device_type, A.ip, A.mac, A.user_id, L.login, D.comment, A.last_found, V.name, M.model_name 
-FROM User_auth A, User_list L, devices D, device_models M, vendors V 
+$sSQL = "SELECT A.id, D.id as dev_id, D.device_type, A.ip, A.mac, A.user_id, L.login, D.comment, A.last_found, V.name, M.model_name
+FROM User_auth A, User_list L, devices D, device_models M, vendors V
 WHERE D.user_id=L.id AND A.ip = D.ip AND D.device_model_id=M.id AND M.vendor_id=V.id AND A.deleted =0
 $u_filter $ip_list_filter $d_filter
 ORDER BY $sort_table.$sort_field $order LIMIT $start,$displayed";

+ 2 - 2
html/inc/common.php

@@ -759,11 +759,11 @@ function print_building_select($db, $building_name, $building_value)
     print "</select>\n";
 }
 
-function print_devmodels_select($db, $devmodel_name, $devmodel_value)
+function print_devmodels_select($db, $devmodel_name, $devmodel_value, $dev_filter = 'device_type<=2')
 {
     print "<select name=\"$devmodel_name\">\n";
     print_select_item(WEB_select_item_all, -1, $devmodel_value);
-    $t_devmodel = mysqli_query($db, "SELECT M.id,V.name,M.model_name FROM device_models M,vendors V WHERE M.vendor_id = V.id and M.id in (SELECT device_model_id FROM devices WHERE device_type<=2) ORDER BY V.name,M.model_name");
+    $t_devmodel = mysqli_query($db, "SELECT M.id,V.name,M.model_name FROM device_models M,vendors V WHERE M.vendor_id = V.id and M.id in (SELECT device_model_id FROM devices WHERE $dev_filter) ORDER BY V.name,M.model_name");
     while (list($f_devmodel_id, $f_devmodel_vendor, $f_devmodel_name) = mysqli_fetch_array($t_devmodel)) {
         print_select_item($f_devmodel_vendor." ".$f_devmodel_name, $f_devmodel_id, $devmodel_value);
     }

+ 1 - 1
html/utils/devices_apply.php

@@ -27,7 +27,7 @@ if (isset($_POST["ApplyForAll"])) {
 
     $all_ok = 1;
     foreach ($dev_id as $key => $val) {
-        if ($val) {
+        if (!empty($val)) {
             unset($device);
             if (isset($_POST["e_set_type"])) { $device['device_type'] = $a_dev_type; }
             if (isset($_POST["e_set_model"])) {