Roman Dmitriev 2 місяців тому
батько
коміт
4832531ddf

+ 105 - 66
html/admin/customers/devmodels.php

@@ -43,8 +43,9 @@ if (getPOST("remove")) {
     if (!empty($f_ids) && is_array($f_ids)) {
         $f_ids = array_map('intval', array_filter($f_ids, fn($id) => $id >= 10000));
         foreach ($f_ids as $id) {
+            // set default - Unknown computer
+            update_records($db_link, "devices", "device_model_id = ?", ['device_model_id' => 87], [$id]);
             delete_record($db_link, "device_models", "id = ?", [$id]);
-            update_records($db_link, "devices", "device_model_id = ?", ['device_model_id' => null], [$id]);
         }
     }
     header("Location: " . $_SERVER["REQUEST_URI"]);
@@ -55,13 +56,14 @@ if (getPOST("create")) {
     $model_name = trim(getPOST("new_model", null, ''));
     if ($model_name !== '') {
         $max_record = get_record_sql($db_link, "SELECT MAX(id) AS max_id FROM device_models");
+        $f_vendor_id = (int)getPOST("new_vendor_id", null, 1);
         $next_id = (isset($max_record['max_id']) && $max_record['max_id'] >= 10000)
             ? (int)$max_record['max_id'] + 1
             : 10000;
 
         $new = [
             'id'         => $next_id,
-            'vendor_id'  => (int)($f_vendor_select ?? 1),
+            'vendor_id'  => (int)($f_vendor_id ?? 1),
             'model_name' => $model_name
         ];
         insert_record($db_link, "device_models", $new);
@@ -75,74 +77,111 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 print_control_submenu($page_url);
 
 ?>
+
 <div id="cont">
-<br>
-<form name="def" action="devmodels.php" method="post">
-
-<table class="data">
-<tr>
-<td><b><?php echo WEB_list_models; ?></b></td>
-<td><?php print_vendor_select($db_link,'vendor_select',$f_vendor_select); ?></td>
-<td><?php print WEB_rows_at_page."&nbsp:";print_row_at_pages('rows',$displayed); ?></td>
-<td><input id='apply' name='apply' type="submit" name="OK" value="<?php print WEB_btn_show; ?>"></td>
-</tr>
-</table>
+    <br>
+    <form name="def" action="devmodels.php" method="post">
 
-<?php
-$params = [];
-$filter = '';
+        <table class="data">
+            <tr>
+                <td><b><?php echo WEB_list_models; ?></b></td>
+                <td><?php print_vendor_select($db_link, 'vendor_select', $f_vendor_select); ?></td>
+                <td><?php echo WEB_rows_at_page . "&nbsp:"; print_row_at_pages('rows', $displayed); ?></td>
+                <td><input type="submit" name="OK" value="<?php echo WEB_btn_show; ?>"></td>
+            </tr>
+        </table>
 
-if (!empty($f_vendor_select)) {
-    $filter = 'WHERE vendor_id = ?';
-    $params[] = $f_vendor_select;
-}
+        <?php
+        $params = [];
+        $filter = '';
 
-$countSQL = "SELECT COUNT(*) FROM device_models $filter";
-$count_records = get_single_field($db_link, $countSQL, $params);
-
-$total=ceil($count_records/$displayed);
-if ($page>$total) { $page=$total; }
-if ($page<1) { $page=1; }
-$start = ($page * $displayed) - $displayed;
-print_navigation($page_url,$page,$displayed,$count_records,$total);
-$sql = "SELECT * FROM device_models $filter ORDER BY vendor_id, model_name LIMIT ? OFFSET ?";
-$params[] = $displayed;
-$params[] = $start;
-$t_ou = get_records_sql($db_link, $sql, $params);
-?>
-<br>
-<table class="data">
-<tr align="center">
-<td><input type="checkbox" onClick="checkAll(this.checked);"></td>
-<td><b>Id</b></td>
-<td><b><?php echo WEB_model_vendor; ?></b></td>
-<td><b><?php echo WEB_cell_name; ?></b></td>
-<td><b><?php echo WEB_cell_poe_in; ?></b></td>
-<td><b><?php echo WEB_cell_poe_out; ?></b></td>
-<td><b><?php echo WEB_nagios_template; ?></b></td>
-<td><input id='save' type="submit" name='save' value="<?php echo WEB_btn_save; ?>"></td>
-<td><input id='remove' type="submit" name='remove' value="<?php echo WEB_btn_delete; ?>"></td>
-</tr>
-<?php
-foreach ($t_ou as $row) {
-    print "<tr align=center>\n";
-    print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$row['id']}'></td>\n";
-    print "<td class=\"data\"><input type=\"hidden\" name='r_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
-    print "<td class=\"data\" width=150>"; print_vendor_set($db_link,'f_vendor[]',$row['vendor_id']); print "</td>\n";
-    print "<td class=\"data\"><input type=\"text\" name='f_name[]' value='{$row['model_name']}'></td>\n";
-    print "<td class=\"data\">";print_qa_select("f_poe_in[]", $row['poe_in']); print "</td>\n";
-    print "<td class=\"data\">";print_qa_select("f_poe_out[]", $row['poe_out']); print "</td>\n";
-    print "<td class=\"data\"><input type=\"text\" name='f_nagios[]' value='{$row['nagios_template']}'></td>\n";
-    print "<td class=\"data\"></td>\n";
-    print "<td class=\"data\"></td>\n";
-    print "</tr>\n";
-}
-?>
-</table>
-<div><input type=text name=new_model value="Unknown">
-<input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
-</div>
-</form>
+        if (!empty($f_vendor_select)) {
+            $filter = 'WHERE vendor_id = ?';
+            $params[] = $f_vendor_select;
+        }
+
+        $countSQL = "SELECT COUNT(*) FROM device_models $filter";
+        $count_records = get_single_field($db_link, $countSQL, $params);
+
+        $total = ceil($count_records / $displayed);
+        if ($page > $total) { $page = $total; }
+        if ($page < 1) { $page = 1; }
+        $start = ($page * $displayed) - $displayed;
+        print_navigation($page_url, $page, $displayed, $count_records, $total);
+
+        $sql = "SELECT * FROM device_models $filter ORDER BY vendor_id, model_name LIMIT ? OFFSET ?";
+        $params[] = $displayed;
+        $params[] = $start;
+        $t_models = get_records_sql($db_link, $sql, $params);
+        ?>
+
+        <br>
+        <table class="data">
+            <tr align="center">
+                <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
+                <td><b>Id</b></td>
+                <td><b><?php echo WEB_model_vendor; ?></b></td>
+                <td><b><?php echo WEB_cell_name; ?></b></td>
+                <td><b><?php echo WEB_cell_poe_in; ?></b></td>
+                <td><b><?php echo WEB_cell_poe_out; ?></b></td>
+                <td><b><?php echo WEB_nagios_template; ?></b></td>
+                <td></td>
+            </tr>
+            <?php
+            foreach ($t_models as $row) {
+                $is_system = ($row['id'] < 10000);
+                $disabled_attr = $is_system ? 'disabled' : '';
+                $checkbox_attr = $is_system ? 'disabled title="System model — cannot be edited or deleted"' : '';
+                echo "<tr align=center>\n";
+                echo "<td class=\"data\" style='padding:0'>";
+                echo "<input type=\"checkbox\" name=\"f_id[]\" value=\"{$row['id']}\">";
+                echo "</td>\n";
+                echo "<td class=\"data\"><input type=\"hidden\" name=\"r_id[]\" value=\"{$row['id']}\">{$row['id']}</td>\n";
+                echo "<td class=\"data\" width=150>";
+                print_vendor_set($db_link, 'f_vendor[]', $row['vendor_id'], $is_system);
+                echo "</td>\n";
+                echo "<td class=\"data\">";
+                echo "<input type=\"text\" name=\"f_name[]\" value=\"" . htmlspecialchars($row['model_name']) . "\" $disabled_attr>";
+                echo "</td>\n";
+                echo "<td class=\"data\">";
+                print_qa_select("f_poe_in[]", $row['poe_in']);
+                echo "</td>\n";
+                echo "<td class=\"data\">";
+                print_qa_select("f_poe_out[]", $row['poe_out']);
+                echo "</td>\n";
+                echo "<td class=\"data\">";
+                echo "<input type=\"text\" name=\"f_nagios[]\" value=\"" . htmlspecialchars($row['nagios_template']) . "\">";
+                echo "</td>\n";
+                echo "<td class=\"data\"></td>\n";
+                echo "</tr>\n";
+            }
+            ?>
+        </table>
+
+        <!-- Кнопки под таблицей -->
+        <div style="margin-top: 15px; display: flex; justify-content: space-between; align-items: center;">
+            <!-- Массовые действия -->
+            <div>
+                <input type="submit"
+                       name="save"
+                       value="<?php echo WEB_btn_save; ?>"
+                       <?php if (empty($t_models)) echo 'disabled'; ?>>
+                <input type="submit"
+                       name="remove"
+                       value="<?php echo WEB_btn_delete; ?>"
+                       onclick="return confirm('<?php echo WEB_msg_delete; ?>?')"
+                       <?php if (empty($t_models) || !array_filter($t_models, fn($r) => $r['id'] >= 10000)) echo 'disabled'; ?>>
+            </div>
+
+            <!-- Создание новой записи -->
+            <div style="display: flex; gap: 8px; align-items: center;">
+                <?php print WEB_model_vendor."&nbsp"; print_vendor_select($db_link, 'new_vendor_id', $f_vendor_select ?: 1); ?>
+                <input type="text" name="new_model" value="Unknown" placeholder="Model name" style="width: 120px;">
+                <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
+            </div>
+        </div>
+
+    </form>
 
 <?php
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");

+ 87 - 49
html/admin/customers/devvendors.php

@@ -41,13 +41,31 @@ if (getPOST("create") !== null) {
         $next_id = (isset($max_record['max_id']) && $max_record['max_id'] >= 10000)
             ? (int)$max_record['max_id'] + 1
             : 10000;
-            
         insert_record($db_link, "vendors", [
             'id'   => $next_id,
             'name' => $vendor_name
         ]);
     }
-    
+    header("Location: " . $_SERVER["REQUEST_URI"]);
+    exit;
+}
+
+// Удаление отмеченных
+if (getPOST("remove") !== null) {
+    $selected_ids = getPOST("f_id", null, []);
+    if (!empty($selected_ids) && is_array($selected_ids)) {
+        // Преобразуем в целые числа и оставляем только >= 10000
+        $selected_ids = array_filter(array_map('intval', $selected_ids), fn($id) => $id >= 10000);
+        if (!empty($selected_ids)) {
+            $r_ids   = array_map('intval', getPOST("r_id",   null, []));
+            foreach ($selected_ids as $vendor_id) {
+                $idx = array_search($vendor_id, $r_ids, true);
+                if ($idx === false) continue;
+                update_records($db_link, "device_models", "vendor_id =?", [ 'id'=> 1 ], [ $vendor_id ]);
+                delete_record($db_link, "vendors", "id = ?", [$vendor_id]);
+            }
+        }
+    }
     header("Location: " . $_SERVER["REQUEST_URI"]);
     exit;
 }
@@ -57,59 +75,79 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 print_control_submenu($page_url);
 
 ?>
+
 <div id="cont">
-<br>
+    <br>
+    <form name="def" action="devvendors.php" method="post">
 
-<form name="def" action="devvendors.php" method="post">
+        <table class="data">
+            <tr>
+                <td><b><?php echo WEB_list_vendors; ?></b></td>
+                <td><?php echo WEB_rows_at_page . "&nbsp:"; print_row_at_pages('rows', $displayed); ?></td>
+                <td><input type="submit" name="OK" value="<?php echo WEB_btn_show; ?>"></td>
+            </tr>
+        </table>
 
-<table class="data">
-<tr>
-<td><b><?php print WEB_list_vendors; ?></b></td>
-<td><?php print WEB_rows_at_page."&nbsp:";print_row_at_pages('rows',$displayed); ?></td>
-<td><input type="submit" name="OK" value="<?php print WEB_btn_show; ?>"></td>
-</tr>
-</table>
+        <?php
+        $countSQL = "SELECT COUNT(*) FROM vendors";
+        $count_records = get_single_field($db_link, $countSQL);
+        $total = ceil($count_records / $displayed);
+        if ($page > $total) { $page = $total; }
+        if ($page < 1) { $page = 1; }
+        $start = ($page * $displayed) - $displayed;
+        print_navigation($page_url, $page, $displayed, $count_records, $total);
+        ?>
 
-<?php
+        <table class="data">
+            <tr align="center">
+                <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
+                <td><b>Id</b></td>
+                <td><b><?php echo WEB_model_vendor; ?></b></td>
+                <td style="width: 120px;">
+                    <input type="submit" name="save" value="<?php echo WEB_btn_save; ?>">
+                </td>
+            </tr>
+            <?php
+            $params = [$displayed, $start];
+            $t_vendors = get_records_sql($db_link, "SELECT * FROM vendors ORDER BY name LIMIT ? OFFSET ?", $params);
+            foreach ($t_vendors as $row) {
+                $is_system = ($row['id'] < 10000);
+                $disabled_attr = $is_system ? 'disabled' : '';
+                $checkbox_attr = $is_system ? 'disabled title="System vendor — cannot be edited or deleted"' : '';
+
+                echo "<tr align=center>\n";
+                echo "<td class=\"data\" style='padding:0'>";
+                echo "<input type=\"checkbox\" name=\"f_id[]\" value=\"{$row['id']}\" $checkbox_attr>";
+                echo "</td>\n";
+                echo "<td class=\"data\"><input type=\"hidden\" name=\"r_id[]\" value=\"{$row['id']}\">{$row['id']}</td>\n";
+                echo "<td colspan=2 class=\"data\">";
+                echo "<input type=\"text\" name=\"f_name[]\" value=\"" . htmlspecialchars($row['name']) . "\" class=\"full-width\" $disabled_attr>";
+                echo "</td>\n";
+                echo "</tr>\n";
+            }
+            ?>
+        </table>
 
-$countSQL="SELECT Count(*) FROM vendors";
-$count_records = get_single_field($db_link,$countSQL);
-$total=ceil($count_records/$displayed);
-if ($page>$total) { $page=$total; }
-if ($page<1) { $page=1; }
-$start = ($page * $displayed) - $displayed;
-print_navigation($page_url,$page,$displayed,$count_records,$total);
+        <!-- Кнопки под таблицей -->
+        <div style="margin-top: 15px; display: flex; justify-content: space-between; align-items: center;">
+            <!-- Массовые действия -->
+            <div>
+                <input type="submit"
+                       name="remove"
+                       value="<?php echo WEB_btn_delete; ?>"
+                       onclick="return confirm('<?php echo WEB_msg_delete; ?>?')"
+                       <?php if (empty($t_vendors) || !array_filter($t_vendors, fn($r) => $r['id'] >= 10000)) echo 'disabled'; ?>>
+            </div>
+
+            <!-- Создание новой записи -->
+            <div style="display: flex; gap: 8px; align-items: center;">
+                <input type="text" name="new_vendor" value="Unknown" style="width: 120px;">
+                <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
+            </div>
+        </div>
+
+    </form>
 
-?>
-<table class="data">
-<tr align="center">
-<td><input type="checkbox" onClick="checkAll(this.checked);"></td>
-<td><b>Id</b></td>
-<td><b><?php echo WEB_model_vendor; ?></b></td>
-<td><input type="submit" name='save' value="<?php echo WEB_btn_save; ?>"></td>
-</tr>
-<?php
-$params[]=$displayed;
-$params[]=$start;
-$t_ou = get_records_sql($db_link,"SELECT * FROM vendors ORDER BY name LIMIT ? OFFSET ?", $params);
-foreach ($t_ou as $row) {
-    print "<tr align=center>\n";
-    print "<td class=\"data\" style='padding:0'><input type=checkbox name=f_id[] value='{$row['id']}'></td>\n";
-    print "<td class=\"data\"><input type=\"hidden\" name='r_id[]' value='{$row['id']}'>{$row['id']}</td>\n";
-    print "<td class=\"data\"><input type=\"text\" name='f_name[]' value='{$row['name']}'></td>\n";
-    print "<td class=\"data\"></td>\n";
-    print "</tr>\n";
-}
-?>
-</table>
-<table>
-<tr>
-<td><input type=text name=new_vendor value="Unknown"></td>
-<td><input type="submit" name="create" value="<?php echo WEB_btn_add; ?>"></td>
-<td align="right"></td>
-</tr>
-</table>
-</form>
 <?php
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
 ?>

+ 2 - 2
html/admin/customers/editsubnet.php

@@ -132,7 +132,7 @@ print_control_submenu($page_url);
                 <td></td>
                 <td><b><?php echo WEB_network_subnet; ?></b></td>
                 <td class="data">
-                    <input type="text" name="s_subnet" value="<?php echo $subnet_info['subnet']; ?>" size="18">
+                    <input type="text" name="s_subnet" value="<?php echo $subnet_info['subnet']; ?>" size="18" class='full-width'>
                 </td>
                 <td>
                     <button name="s_save" value="save"><?php echo WEB_btn_save; ?></button>
@@ -143,7 +143,7 @@ print_control_submenu($page_url);
                 <td></td>
                 <td><b><?php echo WEB_cell_description; ?></b></td>
                 <td colspan="2" class="data">
-                    <input type="text" name="s_description" value="<?php echo $subnet_info['description']; ?>">
+                    <input type="text" name="s_description" value="<?php echo $subnet_info['description']; ?>" class='full-width'>
                 </td>
             </tr>
             

+ 3 - 3
html/admin/devices/editdevice.php

@@ -210,15 +210,15 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
             print "<td class='data' colspan=2>";
             print_device_model_select($db_link, 'f_device_model_id', $device['device_model_id']);
             print "</td>\n";
-            print "<td class='data' ><input type='text' name='f_firmware' value='" . $device['firmware'] . "'></td>\n";
-            print "<td class='data' ><input type='text' name='f_sn' value='" . $device['sn'] . "'></td>\n";
+            print "<td class='data' ><input type='text' name='f_firmware' value='" . $device['firmware'] . "' class='full-width'></td>\n";
+            print "<td class='data' ><input type='text' name='f_sn' value='" . $device['sn'] . "' class='full-width'></td>\n";
             print "</tr>\n";
             print "<tr><td colspan=2>" . WEB_location_name . "</td><td colspan=2>" . WEB_cell_description . "</td>";
             print "</tr><tr>";
             print "<td class='data'>";
             print_building_select($db_link, 'f_building_id', $device['building_id']);
             print "</td>\n";
-            print "<td class='data' colspan=3><input type='text' size=50 name='f_description' value='" . $device['description'] . "'></td>\n";
+            print "<td class='data' colspan=3><input type='text' size=50 name='f_description' value='" . $device['description'] . "' class='full-width'></td>\n";
             print "</tr>";
 
             //print gateway settings

+ 1 - 1
html/admin/filters/editfilter.php

@@ -42,7 +42,7 @@ if (isset($filter['filter_type']) and $filter['filter_type'] == 0) {
     print "</tr>";
     print "<tr>";
     print "<td align=left><input type=text name=f_name value='".$filter['name']."'></td>";
-    print "<td colspan=2><input type=text name=f_description value='".$filter['description']."'></td>";
+    print "<td colspan=2><input type=text name=f_description value='".$filter['description']."' class='full-width'></td>";
     print "<td><input type=submit name=editfilter value='".WEB_btn_save."'></td>";
     print "</tr>";
     print "<tr>";

+ 39 - 38
html/admin/queues/index.php

@@ -62,47 +62,48 @@ unset($_POST);
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 ?>
 <div id="cont">
-<b><?php echo WEB_list_queues; ?></b> <br>
-<form name="def" action="index.php" method="post">
-
-<!-- ЕДИНАЯ КНОПКА СОХРАНЕНИЯ -->
-<div style="margin-top: 10px; text-align: right;">
-    <input type="submit" name="save" value="<?php echo WEB_btn_save; ?>">
-    <input type="submit" 
-           onclick="return confirm('<?php echo WEB_msg_delete; ?>?')" 
-           name="remove" 
-           value="<?php echo WEB_btn_delete; ?>">
-</div>
-
-<table class="data">
-<tr align="center">
-    <td><input type="checkbox" onClick="checkAll(this.checked);"></td>
-    <td><b>Id</b></td>
-    <td><b><?php echo WEB_cell_name; ?></b></td>
-    <td><b>Download</b></td>
-    <td><b>Upload</b></td>
-</tr>
-<?php
-$t_queue = get_records_sql($db_link, "SELECT * FROM queue_list ORDER BY id");
-foreach ($t_queue as $row) {
-    print "<tr align=center>\n";
-    print "<td class=\"data\" style='padding:0'><input type=\"checkbox\" name=\"f_id[]\" value=\"{$row['id']}\"></td>\n";
-    print "<td class=\"data\"><input type=\"hidden\" name=\"r_id[]\" value=\"{$row['id']}\">{$row['id']}</td>\n";
-    print "<td class=\"data\"><input type=\"text\" name=\"f_queue_name[]\" value=\"" . htmlspecialchars($row['queue_name']) . "\"></td>\n";
-    print "<td class=\"data\"><input type=\"text\" name=\"f_down[]\" value=\"{$row['download']}\"></td>\n";
-    print "<td class=\"data\"><input type=\"text\" name=\"f_up[]\" value=\"{$row['upload']}\"></td>\n";
-    print "</tr>\n";
-}
-?>
-</table>
+    <b><?php echo WEB_list_queues; ?></b> <br>
 
+    <form name="def" action="index.php" method="post">
+        <table class="data">
+            <tr align="center">
+                <td>
+                    <input type="checkbox" onClick="checkAll(this.checked);">
+                </td>
+                <td><b>Id</b></td>
+                <td><b><?php echo WEB_cell_name; ?></b></td>
+                <td><b>Download</b></td>
+                <td><b>Upload</b></td>
+            </tr>
+            <?php
+            $t_queue = get_records_sql($db_link, "SELECT * FROM queue_list ORDER BY id");
+            foreach ($t_queue as $row) {
+                print "<tr align=center>\n";
+                print "<td class=\"data\" style='padding:0'><input type=\"checkbox\" name=\"f_id[]\" value=\"{$row['id']}\"></td>\n";
+                print "<td class=\"data\"><input type=\"hidden\" name=\"r_id[]\" value=\"{$row['id']}\">{$row['id']}</td>\n";
+                print "<td class=\"data\"><input type=\"text\" class=\"full-width\" name=\"f_queue_name[]\" value=\"" . htmlspecialchars($row['queue_name']) . "\"></td>\n";
+                print "<td class=\"data\"><input type=\"text\" name=\"f_down[]\" value=\"{$row['download']}\"></td>\n";
+                print "<td class=\"data\"><input type=\"text\" name=\"f_up[]\" value=\"{$row['upload']}\"></td>\n";
+                print "</tr>\n";
+            }
+            ?>
+        </table>
 
-<div style="margin-top: 15px;">
-    <input type="text" name="new_queue" value="New_queue">
-    <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
-</div>
+        <div style="margin-top: 15px; display: flex; justify-content: space-between; align-items: center;">
+            <div>
+                <input type="submit" name="save" value="<?php echo WEB_btn_save; ?>">
+                <input type="submit"
+                       onclick="return confirm('<?php echo WEB_msg_delete; ?>?')"
+                       name="remove"
+                       value="<?php echo WEB_btn_delete; ?>">
+            </div>
+            <div style="display: flex; gap: 8px; align-items: center;">
+                <input type="text" name="new_queue" value="New_queue" style="width: 120px;">
+                <input type="submit" name="create" value="<?php echo WEB_btn_add; ?>">
+            </div>
+        </div>
+    </form>
 
-</form>
 <?php
 require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
 ?>

+ 153 - 149
html/admin/users/editauth.php

@@ -137,11 +137,11 @@ if (getPOST("editauth") !== null && !$old_auth_info['deleted']) {
         $new['dhcp_option_set']   = trim(getPOST("f_dhcp_option_set", null, ''));
         $new['dynamic']           = (int)(getPOST("f_dynamic", null, 0));
         if ($new['dynamic']) {
-            $new['end_life'] = trim(getPOST("f_end_life", null, ''));
+            $new['end_life'] = trim(getPOST("f_end_life"));
         }
 
         // Настройки по OU
-        if (get_const('default_user_ou_id') == $parent_ou_id || get_const('default_hotspot_ou_id') == $parent_ou_id) {
+        if (is_system_ou($db_link, $parent_ou_id)) {
             $new += [
                 'nagios_handler'    => '',
                 'enabled'           => 0,
@@ -168,6 +168,10 @@ if (getPOST("editauth") !== null && !$old_auth_info['deleted']) {
             ];
         }
 
+        if ($new['day_quota']>0) {
+            if ($new['month_quota'] <= $new['day_quota']) { $new['month_quota'] = $new['day_quota'] * 31; }
+            }
+
         if ($new['nagios'] == 0) {
             $new['nagios_status'] = 'UP';
         }
@@ -327,200 +331,200 @@ if (empty($auth_info['end_life']) || is_empty_datetime($auth_info['end_life']))
     $auth_info['end_life'] = $now->format('Y-m-d H:i:s');
     }
 
-?>
+$is_system_ou = is_system_ou($db_link, $parent_ou_id);
+$disabled_attr = $is_system_ou ? 'disabled' : '';
 
+?>
 
 <div id="cont">
-    <?php
-    if (!empty($_SESSION[$page_url]['msg'])) {
-        print '<div id="msg">' . $_SESSION[$page_url]['msg'] . '</div>';
-        unset($_SESSION[$page_url]['msg']);
-    }
-    print "<b>" . WEB_user_title . "&nbsp<a href=/admin/users/edituser.php?id=" . $auth_info['user_id'] . ">" . $parent_name . "</a> </b>";
+    <?php if (!empty($_SESSION[$page_url]['msg'])): ?>
+        <div id="msg"><?php echo $_SESSION[$page_url]['msg']; unset($_SESSION[$page_url]['msg']); ?></div>
+    <?php endif; ?>
+
+    <b><?php echo WEB_user_title; ?>&nbsp;
+        <a href="/admin/users/edituser.php?id=<?php echo $auth_info['user_id']; ?>">
+            <?php echo $parent_name; ?>
+        </a>
+    </b>
 
+    <?php
     $alias_link = '';
-    if (!empty($auth_info['dns_name']) and !$auth_info['dns_ptr_only']) { $alias_link="/admin/users/edit_alias.php?id=".$id; }
-    if (empty($auth_info['created_by'])) { $auth_info['created_by'] = '-'; }
-    $f_dns_ptr = '';
-    if ($auth_info['dns_ptr_only']) { $f_dns_ptr = 'checked'; }
+    if (!empty($auth_info['dns_name']) && !$auth_info['dns_ptr_only']) {
+        $alias_link = "/admin/users/edit_alias.php?id=" . $id;
+    }
+    if (empty($auth_info['created_by'])) {
+        $auth_info['created_by'] = '-';
+    }
+    $f_dns_ptr = $auth_info['dns_ptr_only'] ? 'checked' : '';
     ?>
 
     <form name="def" action="editauth.php?id=<?php echo $id; ?>" method="post">
-        <input type="hidden" name="id" value=<?php echo $id; ?>>
+        <input type="hidden" name="id" value="<?php echo $id; ?>">
+
         <table class="data">
+            <!-- 1. СЕТЕВЫЕ ДАННЫЕ -->
             <tr>
-                <td width=230><?php print WEB_cell_dns_name . " &nbsp | &nbsp "; print_url(WEB_cell_aliases, $alias_link); ?></td>
-                <td width=200><?php print WEB_cell_description; ?></td>
-                <td width=70><?php print WEB_cell_enabled; ?></td>
-                <td><?php print WEB_cell_traf; ?></td>
+                <td><?php echo WEB_cell_ip; ?></td>
+                <td><?php echo WEB_cell_mac; ?></td>
+                <td><?php echo WEB_cell_description; ?></td>
                 <td></td>
+                <td><?php echo WEB_cell_traf; ?></td>
             </tr>
             <tr>
-                <td style="white-space: nowrap;"><input type="text" name="f_dns_name" size="14"  value="<?php echo $auth_info['dns_name']; ?>" pattern="^([a-zA-Z0-9-]{1,63})(\.[a-zA-Z0-9-]{1,63})*\.?$">
-                    <input type="checkbox" id="f_dns_ptr" name="f_dns_ptr" value="1" <?php echo $f_dns_ptr; ?>> &nbsp <?php print WEB_cell_ptr_only; ?>
-                </td>
-                <td><input type="text" name="f_description" value="<?php echo $auth_info['description']; ?>"></td>
-                <td><?php print_qa_select('f_enabled', $auth_info['enabled']); ?></td>
-                <td><?php print_qa_select('f_save_traf', $auth_info['save_traf']); ?></td>
-                <td></td>
+                <td><input type="text" name="f_ip" value="<?php echo htmlspecialchars($auth_info['ip']); ?>" pattern="^(\d{1,3}\.){3}\d{1,3}$" class='full-width'></td>
+                <td><input type="text" name="f_mac" value="<?php echo htmlspecialchars($auth_info['mac']); ?>" pattern="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$" class='full-width'></td>
+                <td colspan=2><input type="text" name="f_description" value="<?php echo htmlspecialchars($auth_info['description']); ?>" class='full-width'></td>
+                <td><?php print_qa_select('f_save_traf', $auth_info['save_traf'],$is_system_ou); ?></td>
             </tr>
+
+            <!-- 2. ДОСТУП И ОГРАНИЧЕНИЯ -->
+            <tr style="height: 10px; background: #f5f5f5;"><td colspan="5"></td></tr>
             <tr>
-                <td><?php print WEB_cell_ip; ?></td>
-                <td><?php print WEB_cell_mac; ?></td>
-                <td><?php print WEB_cell_dhcp; ?></td>
-                <td><?php print WEB_cell_acl; ?></td>
-                <td><?php print WEB_cell_option_set; ?></td>
-                <td></td>
-            <tr>
-                <td><input type="text" name="f_ip" value="<?php echo $auth_info['ip']; ?>" pattern="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[\.ю]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"></td>
-                <td><input type="text" name="f_mac" value="<?php echo $auth_info['mac']; ?>" pattern="^(([0-9A-Fa-f]{2}[\.\:\-]){5}[0-9A-Fa-f]{2}|([0-9a-fA-F]{4}[\.\-][0-9a-fA-F]{4}[\.\-][0-9a-fA-F]{4})|[0-9A-Fa-f]{12})$"></td>
-                <td><?php print_qa_select('f_dhcp', $auth_info['dhcp']); ?></td>
-                <td><?php print_dhcp_acl_list($db_link,"f_acl",$auth_info['dhcp_acl']); ?></td>
-                <td><?php print_dhcp_option_set_list($db_link,"f_dhcp_option_set",$auth_info['dhcp_option_set']); ?></td>
+                <td><?php echo WEB_cell_enabled; ?></td>
+                <td><?php echo WEB_cell_blocked; ?></td>
+                <td><?php echo WEB_cell_filter; ?></td>
+                <td><?php echo WEB_cell_shaper; ?></td>
+                <td><?php echo WEB_cell_perday; ?> / <?php echo WEB_cell_permonth; ?></td>
             </tr>
             <tr>
-                <td><?php print WEB_cell_filter; ?></td>
-                <td><?php print WEB_cell_shaper; ?></td>
-                <td><?php print WEB_cell_blocked; ?></td>
-                <td><?php print WEB_cell_perday; ?></td>
-                <td><?php print WEB_cell_permonth; ?></td>
+                <td><?php print_qa_select('f_enabled', $auth_info['enabled'], $is_system_ou); ?></td>
+                <td><?php print_qa_select('f_blocked', $auth_info['blocked'], $is_system_ou); ?></td>
+                <td><?php print_filter_group_select($db_link, 'f_group_id', $auth_info['filter_group_id'], $is_system_ou); ?></td>
+                <td><?php print_queue_select($db_link, 'f_queue_id', $auth_info['queue_id'],$is_system_ou); ?></td>
+                <td>
+                    <input type="text" name="f_day_q" value="<?php echo $auth_info['day_quota']; ?>" size="5" <?php print $disabled_attr; ?> > /
+                    <input type="text" name="f_month_q" value="<?php echo $auth_info['month_quota']; ?>" size="5" <?php print $disabled_attr; ?> >
+                </td>
             </tr>
+
+            <!-- 3. DHCP -->
+            <tr style="height: 10px; background: #f5f5f5;"><td colspan="5"></td></tr>
             <tr>
-                <td><?php print_filter_group_select($db_link, 'f_group_id', $auth_info['filter_group_id']); ?> </td>
-                <td><?php print_queue_select($db_link, 'f_queue_id', $auth_info['queue_id']); ?> </td>
-                <td><?php print_qa_select('f_blocked', $auth_info['blocked']); ?></td>
-                <td><input type="text" name="f_day_q" value="<?php echo $auth_info['day_quota']; ?>" size=5></td>
-                <td><input type="text" name="f_month_q" value="<?php echo $auth_info['month_quota']; ?>" size=5></td>
+                <td><?php echo WEB_cell_dns_name; ?> &nbsp;|&nbsp; <?php print_url(WEB_cell_aliases, $alias_link); ?></td>
+                <td><?php echo WEB_cell_dhcp; ?></td>
+                <td><?php echo WEB_cell_acl; ?></td>
+                <td><?php echo WEB_cell_option_set; ?></td>
+                <td></td>
             </tr>
             <tr>
-                <td><?php print WEB_cell_nagios_handler; ?></td>
-                <td width=200>
-                    <?php
-                    if (!empty($auth_info['wikiname'])) {
-                        $wiki_url = rtrim(get_option($db_link, 60), '/');
-                        if (preg_match('/127.0.0.1/', $wiki_url)) {
-                            print WEB_cell_wikiname;
-                        } else {
-                            $wiki_web = rtrim(get_option($db_link, 63), '/');
-                            $wiki_web = ltrim($wiki_web, '/');
-                            $wiki_link = $wiki_url . '/' . $wiki_web . '/' . $auth_info['wikiname'];
-                            print_url(WEB_cell_wikiname, $wiki_link);
-                        }
-                    } else {
-                        print WEB_cell_wikiname;
-                    }
-                    $dev_id = get_device_by_auth($db_link, $auth_info['user_id']);
-                    if (isset($dev_id)) {
-                        print "&nbsp|&nbsp";
-                        print_url('Device', '/admin/devices/editdevice.php?id=' . $dev_id);
-                    }
-                    ?>
-                </td>
-                <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
-                        print WEB_cell_nagios;
-                    } ?></td>
-                <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
-                        print WEB_cell_link;
-                    } ?></td>
-            <tr>
-                <td><input type="text" name="f_handler" value="<?php echo $auth_info['nagios_handler']; ?>"></td>
-                <td><input type="text" name="f_wiki" value="<?php echo $auth_info['wikiname']; ?>"></td>
-                <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
-                        print_qa_select('f_nagios', $auth_info['nagios']);
-                    } ?>
-                </td>
-                <td><?php if (empty($device) or (!empty($device) and $device['device_type'] > 2)) {
-                        print_qa_select('f_link', $auth_info['link_check']);
-                    } ?>
+                <td style="white-space: nowrap;">
+                    <input type="text" name="f_dns_name" size="14" value="<?php echo htmlspecialchars($auth_info['dns_name']); ?>" pattern="^([a-zA-Z0-9-]{1,63})(\.[a-zA-Z0-9-]{1,63})*\.?$"  <?php echo $disabled_attr; ?> class='full-width'>
+                    <br>
+                    <label>
+                        <input type="checkbox" id="f_dns_ptr" name="f_dns_ptr" value="1" <?php echo $f_dns_ptr; echo " {$disabled_attr}"; ?>>
+                        <?php echo WEB_cell_ptr_only; ?>
+                    </label>
                 </td>
+                <td><?php print_qa_select('f_dhcp', $auth_info['dhcp'], $is_system_ou); ?></td>
+                <td><?php print_dhcp_acl_list($db_link, "f_acl", $auth_info['dhcp_acl'], $is_system_ou); ?></td>
+                <td><?php print_dhcp_option_set_list($db_link, "f_dhcp_option_set", $auth_info['dhcp_option_set'],$is_system_ou); ?></td>
                 <td></td>
             </tr>
+
+            <!-- 4. МОНИТОРИНГ -->
+            <tr style="height: 10px; background: #f5f5f5;"><td colspan="5"></td></tr>
             <tr>
-                <td><?php print WEB_cell_temporary; ?></td>
-                <?php if ($auth_info['dynamic']) { print "<td>"; } else { print "<td>"; } ?>
-                <div style="color: #7B1FA2;">
-                <?php print WEB_cell_end_life; ?>
-                </div>
-                </td>
-                <td></td>
-                <td></td>
+                <td width="200"><?php echo WEB_cell_wikiname; ?></td>
+                <td><?php if (empty($device) || (!empty($device) && $device['device_type'] > 2)) echo WEB_cell_nagios; ?></td>
+                <td><?php if (empty($device) || (!empty($device) && $device['device_type'] > 2)) echo WEB_cell_link; ?></td>
+                <td><?php echo WEB_cell_nagios_handler; ?></td>
                 <td></td>
             </tr>
             <tr>
-                <td><?php print_qa_select('f_dynamic',$auth_info['dynamic']); ?></td>
-                <td><input type="datetime-local" id="f_end_life" name="f_end_life" min="<?php print $created->format('Y-m-d H:i:s'); ?>" value="<?php print $auth_info['end_life']; ?>" 
-                <?php if (!$auth_info['dynamic']) { print "disabled"; } ?>
-                step=1 ></td>
-                <td></td>
-                <td></td>
-                <td></td>
+                <td><input type="text" name="f_wiki" value="<?php echo htmlspecialchars($auth_info['wikiname']); ?>" <?php print $disabled_attr; ?> class='full-width'></td>
+                <td><?php if (empty($device) || (!empty($device) && $device['device_type'] > 2)) print_qa_select('f_nagios', $auth_info['nagios'],$is_system_ou); ?></td>
+                <td><?php if (empty($device) || (!empty($device) && $device['device_type'] > 2)) print_qa_select('f_link', $auth_info['link_check'],$is_system_ou); ?></td>
+                <td colspan=2><input type="text" name="f_handler" value="<?php echo htmlspecialchars($auth_info['nagios_handler']); ?>" <?php print $disabled_attr; ?> class='full-width'></td>
             </tr>
+
+            <!-- 5. ТИП ЗАПИСИ -->
+            <tr style="height: 10px; background: #f5f5f5;"><td colspan="5"></td></tr>
             <tr>
-                <td colspan=3><input type="submit" name="moveauth" value=<?php print WEB_btn_move; ?>>
-                <?php print_login_select($db_link, 'f_new_parent', $auth_info['user_id']); ?></td>
-                <?php
-                if ($auth_info['deleted']) {
-                    print "<td ><font color=red>" . WEB_deleted . ": " . $auth_info['changed_time'] . "</font></td>";
-                    print "<td align=right><input type=\"submit\" name=\"recovery\" value='" . WEB_btn_recover . "'></td>";
-                } else {
-                    print "<td ></td>";
-                    print "<td align=right><input type=\"submit\" name=\"editauth\" value='" . WEB_btn_save . "'></td>";
-                }
-                ?>
+                <td><?php echo WEB_cell_temporary; ?></td>
+                <td colspan="4">
+                    <?php print_qa_select('f_dynamic', $auth_info['dynamic']); ?>
+                    <span id="end-life-container" style="<?php echo !$auth_info['dynamic'] ? 'display:none;' : ''; ?>">
+                        &nbsp;—&nbsp;
+                        <input type="datetime-local"
+                               id="f_end_life"
+                               name="f_end_life"
+                               min="<?php echo $created->format('Y-m-d\TH:i:s'); ?>"
+                               value="<?php echo htmlspecialchars($auth_info['end_life'] ?? ''); ?>"
+                               step="1">
+                    </span>
+                </td>
             </tr>
-        </table>
-        <table class="data">
+
+            <!-- КНОПКИ -->
+            <tr style="height: 10px; background: #f5f5f5;"><td colspan="5"></td></tr>
             <tr>
-                <td class="data" colspan=2><?php echo WEB_status . ":"; ?></td>
-                <td align=right ><a href=/admin/logs/authlog.php?auth_id=<?php print $id; ?>><?php print WEB_log; ?></a></td>
-                <td align=right ><?php print_url(WEB_report_by_day, "/admin/reports/authday.php?id=$id"); ?></td>
+                <td colspan="3">
+                    <input type="submit" name="moveauth" value="<?php echo WEB_btn_move; ?>">
+                    <?php print_login_select($db_link, 'f_new_parent', $auth_info['user_id']); ?>
+                </td>
+                <?php if ($auth_info['deleted']): ?>
+                    <td><font color="red"><?php echo WEB_deleted . ": " . $auth_info['changed_time']; ?></font></td>
+                    <td align="right"><input type="submit" name="recovery" value="<?php echo WEB_btn_recover; ?>"></td>
+                <?php else: ?>
+                    <td></td>
+                    <td align="right"><input type="submit" name="editauth" value="<?php echo WEB_btn_save; ?>"></td>
+                <?php endif; ?>
             </tr>
+        </table>
+
+        <!-- ИНФОРМАЦИЯ О ЗАПИСИ -->
+        <table class="data" style="margin-top: 20px;">
+            <caption style="caption-side: top; font-weight: bold; margin-bottom: 5px;"><?php echo WEB_status; ?></caption>
             <tr>
-                <td ><?php echo WEB_cell_created_by . ":"; ?></td>
-                <td class="data" ></td>
-                <td class="data" colspan=2 align=right><?php echo $auth_info['created_by']; ?></td>
+                <td width="150"><?php echo WEB_cell_created_by; ?>:</td>
+                <td width="200"><?php echo $auth_info['created_by']; ?></td>
+                <td align="right"><a href="/admin/logs/authlog.php?auth_id=<?php echo $id; ?>"><?php echo WEB_log; ?></a></td>
+                <td align="right"><?php print_url(WEB_report_by_day, "/admin/reports/authday.php?id=$id"); ?></td>
             </tr>
             <tr>
-                <td><?php print WEB_cell_created; ?></td>
-                <td class="data" align=right><?php print $auth_info['ts']; ?></td>
-                <td><?php print WEB_cell_connection . ": "; ?></td>
-                <td class="data" align=right><?php print get_connection($db_link, $id) ; ?></td>
+                <td><?php echo WEB_cell_created; ?>:</td>
+                <td><?php echo $auth_info['ts']; ?></td>
+                <td><?php echo WEB_cell_connection; ?>:</td>
+                <td><?php echo get_connection($db_link, $id); ?></td>
             </tr>
             <tr>
-                <td ><?php print WEB_cell_dhcp_hostname.":"; ?></td>
-                <td class="data"><?php print $auth_info['dhcp_hostname']; ?></td>
-                <td ><?php print "Dhcp event: "; ?></td>
-                <td class="data" align=right><?php print $dhcp_str; ?></td>
+                <td><?php echo WEB_cell_dhcp_hostname; ?>:</td>
+                <td><?php echo $auth_info['dhcp_hostname']; ?></td>
+                <td>Dhcp event:</td>
+                <td><?php echo $dhcp_str; ?></td>
             </tr>
             <tr>
-                <td ><?php print WEB_cell_arp_found . ": "; ?></td>
-                <td class="data" align=right><?php print $auth_info['arp_found'] ; ?></td>
-                <td ><?php print WEB_cell_mac_found . ": "; ?></td>
-                <td class="data" align=right><?php print $auth_info['mac_found'] ; ?></td>
+                <td><?php echo WEB_cell_arp_found; ?>:</td>
+                <td><?php echo $auth_info['arp_found']; ?></td>
+                <td><?php echo WEB_cell_mac_found; ?>:</td>
+                <td><?php echo $auth_info['mac_found']; ?></td>
             </tr>
             <tr>
+                <td><?php echo WEB_changed_time; ?>:</td>
+                <td><?php echo $auth_info['changed_time']; ?></td>
+                <td></td>
+                <td></td>
             </tr>
         </table>
-        <?php
-        if ($msg_error) {
-            print "<div id='msg'><b>$msg_error</b></div><br>\n";
-        }
-        ?>
-
-
-</form>
-<br>
 
+        <?php if ($msg_error): ?>
+            <div id="msg"><b><?php echo $msg_error; ?></b></div>
+        <?php endif; ?>
+    </form>
 
 <script>
-document.getElementById('f_dynamic').addEventListener('change', function(event) {
-  const selectValue = this.value;
-  const inputField = document.getElementById('f_end_life');
-  if (selectValue === '1') {
-    inputField.disabled = false;
-  } else {
-    inputField.disabled = true;
-  }
+document.addEventListener('DOMContentLoaded', function() {
+    const dynamicField = document.querySelector('[name="f_dynamic"]');
+    const endLifeContainer = document.getElementById('end-life-container');
+    if (dynamicField && endLifeContainer) {
+        function toggleEndLife() {
+            const isActive = dynamicField.type === 'checkbox' 
+                ? dynamicField.checked 
+                : dynamicField.value == '1';
+            endLifeContainer.style.display = isActive ? '' : 'none';
+        }
+        dynamicField.addEventListener('change', toggleEndLife);
+    }
 });
 </script>
 

+ 8 - 0
html/css/white.css

@@ -32,6 +32,8 @@ td.speed1G                      { background-color: #58FA82; }
 td.speed10G                     { background-color: #ffcc00; }
 td.crc                          { background-color: #ff6666; }
 
+.full-width                     { width: 100%;  box-sizing: border-box; }
+
 input                           { font-family: tahoma; padding: 1px; }
 textarea                        { font-family: tahoma; padding: 1px; }
 select                          { font-family: tahoma; width: auto; padding: 0; }
@@ -93,3 +95,9 @@ input[type="datetime-local"]:focus {
 .performance-info strong {
     color: black;
 }
+
+input:disabled, select:disabled {
+    background-color: #f0f0f0 !important;
+    color: #888 !important;
+    cursor: not-allowed !important;
+}

+ 28 - 21
html/inc/common.php

@@ -1419,9 +1419,10 @@ function print_device_model_select($db, $device_model_name, $device_model_value)
     echo "</select>\n";
 }
 
-function print_filter_group_select($db, $group_name, $group_value)
+function print_filter_group_select($db, $group_name, $group_value, $disabled = 0)
 {
-    echo "<select id=\"" . htmlspecialchars($group_name) . "\" name=\"" . htmlspecialchars($group_name) . "\">\n";
+    $disabled_attr = $disabled ? 'disabled' : '';
+    echo "<select id=\"" . htmlspecialchars($group_name) . "\" name=\"" . htmlspecialchars($group_name) . "\" {$disabled_attr}>\n";
     $t_group = get_records_sql($db, "SELECT id, group_name FROM group_list ORDER BY group_name");
     
     foreach ($t_group as $row) {
@@ -1654,9 +1655,10 @@ function get_gw_subnets($db, $device_id)
     return trim($result);
 }
 
-function print_queue_select($db, $queue_name, $queue_value)
-{   
-    echo "<select id=\"" . htmlspecialchars($queue_name) . "\" name=\"" . htmlspecialchars($queue_name) . "\">\n";
+function print_queue_select($db, $queue_name, $queue_value, $disabled = 0)
+{
+    $disabled_attr = $disabled ? 'disabled' : '';
+    echo "<select id=\"" . htmlspecialchars($queue_name) . "\" name=\"" . htmlspecialchars($queue_name) . "\" {$disabled_attr}>\n";
     $t_queue = get_records_sql($db, "SELECT id, queue_name FROM queue_list ORDER BY queue_name");
     
     foreach ($t_queue as $row) {
@@ -1724,9 +1726,10 @@ function get_int($qa_value = 0)
     return $qa_value;
 }
 
-function print_qa_select($qa_name, $qa_value = 0)
+function print_qa_select($qa_name, $qa_value = 0, $disabled = 0)
 {
-    print "<select name=\"$qa_name\" id=\"$qa_name\">\n";
+    $disabled_attr = $disabled ? 'disabled' : '';
+    print "<select name=\"$qa_name\" id=\"$qa_name\" {$disabled_attr}>\n";
     if (empty($qa_value)) {
         $qa_value = 0;
     } else {
@@ -1860,15 +1863,16 @@ function print_dhcp_acl($db, $qa_name)
     }
 }
     
-function print_dhcp_option_set($db, $qa_name)
-{   
+function print_dhcp_option_set($db, $qa_name, $disabled = 0)
+{
+    $disabled_attr = $disabled ? 'disabled' : '';
     $dhcp_option_sets = get_records_sql($db,
         "SELECT DISTINCT dhcp_option_set FROM user_auth 
          WHERE dhcp_option_set IS NOT NULL AND dhcp_option_set != '' AND deleted = 0"
     );
     
     if (!empty($dhcp_option_sets)) {
-        echo "<select name=\"" . htmlspecialchars($qa_name) . "\">\n";
+        echo "<select name=\"" . htmlspecialchars($qa_name) . "\" {$disabled_attr}>\n";
         print_select_simple(WEB_select_item_no, '');
         
         foreach ($dhcp_option_sets as $dhcp_option_set) {
@@ -1881,8 +1885,10 @@ function print_dhcp_option_set($db, $qa_name)
     }
 }
 
-function print_dhcp_acl_list($db, $qa_name, $value = '')
+function print_dhcp_acl_list($db, $qa_name, $value = '', $disabled = 0)
 {
+    $disabled_attr = $disabled ? 'disabled' : '';
+
     $dhcp_acl = get_records_sql($db,
         "SELECT DISTINCT dhcp_acl FROM user_auth
          WHERE dhcp_acl IS NOT NULL AND dhcp_acl != '' AND deleted = 0"
@@ -1900,7 +1906,7 @@ function print_dhcp_acl_list($db, $qa_name, $value = '')
         }
     }
 
-    echo "<input list=\"dhcp_acl\" id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" value=\"" . htmlspecialchars($value) . "\" />";
+    echo "<input list=\"dhcp_acl\" id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" value=\"" . htmlspecialchars($value) . "\" {$disabled_attr}/>";
     echo "<datalist id=\"dhcp_acl\">";
     echo "<option value=\"\">";
 
@@ -1911,8 +1917,9 @@ function print_dhcp_acl_list($db, $qa_name, $value = '')
     echo "</datalist>";
 }
 
-function print_dhcp_option_set_list($db, $qa_name, $value = '')
+function print_dhcp_option_set_list($db, $qa_name, $value = '', $disabled = 0)
 {
+    $disabled_attr = $disabled ? 'disabled' : '';
     $dhcp_option_sets = get_records_sql($db,
         "SELECT DISTINCT dhcp_option_set FROM user_auth
          WHERE dhcp_option_set IS NOT NULL AND dhcp_option_set != '' AND deleted = 0"
@@ -1930,7 +1937,7 @@ function print_dhcp_option_set_list($db, $qa_name, $value = '')
         }
     }
 
-    echo "<input list=\"dhcp_option_set\" id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" value=\"" . htmlspecialchars($value) . "\" />";
+    echo "<input list=\"dhcp_option_set\" id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" value=\"" . htmlspecialchars($value) . "\" {$disabled_attr}/>";
     echo "<datalist id=\"dhcp_option_set\">";
     echo "<option value=\"\">"; 
 
@@ -2011,23 +2018,23 @@ function print_ip_type_select($qa_name, $qa_value)
     print "</select>\n";
 }
 
-function print_vendor_select($db, $qa_name, $qa_value)
-{   
-    echo "<select id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" style=\"width: 100%\">\n";
+function print_vendor_select($db, $qa_name, $qa_value, $disabled = 0)
+{
+    $disabled_attr = $disabled ? 'disabled' : '';
+    echo "<select id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" style=\"width: 100%\" {$disabled_attr}>\n";
     $vendors = get_records_sql($db, "SELECT id, name FROM vendors ORDER BY name");
     print_select_item(WEB_select_item_all, 0, $qa_value);
-    
     foreach ($vendors as $row) {
         print_select_item(htmlspecialchars($row['name']), $row['id'], $qa_value);
     }
     echo "</select>\n";
 }
 
-function print_vendor_set($db, $qa_name, $qa_value)
+function print_vendor_set($db, $qa_name, $qa_value, $disabled = 0)
 {
-    echo "<select id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" style=\"width: 100%\">\n";
+    $disabled_attr = $disabled ? 'disabled' : '';
+    echo "<select id=\"" . htmlspecialchars($qa_name) . "\" name=\"" . htmlspecialchars($qa_name) . "\" style=\"width: 100%\" {$disabled_attr}>\n";
     $vendors = get_records_sql($db, "SELECT id, name FROM vendors ORDER BY name");
-    
     foreach ($vendors as $row) {
         print_select_item(htmlspecialchars($row['name']), $row['id'], $qa_value);
     }

+ 2 - 1
html/inc/languages/english.php

@@ -9,7 +9,8 @@ define("WEB_pkts","Pkt");
 define("WEB_log","Log");
 define("WEB_deleted","Deleted");
 define("WEB_status","Status");
-define ("WEB_unknown","No data available");
+define("WEB_unknown","No data available");
+define("WEB_changed_time","Last changed");
 
 define("WEB_page_speed","Page generated for ");
 define("WEB_rows_at_page","Lines");

+ 2 - 1
html/inc/languages/russian.php

@@ -9,7 +9,8 @@ define("WEB_pkts","Pkt");
 define("WEB_log","Лог");
 define("WEB_deleted","Удалён");
 define("WEB_status","Состояние");
-define ("WEB_unknown","В списках не значится");
+define("WEB_unknown","В списках не значится");
+define("WEB_changed_time","Последняя правка");
 
 define("WEB_page_speed","Страница сгенерирована за ");
 define("WEB_rows_at_page","Строк");