Jelajahi Sumber

web: restored wiki link in user auth record
web: restored device interfaces name in switch ports

root 2 bulan lalu
induk
melakukan
e9a28f1103

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

@@ -223,7 +223,7 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
 
             //print gateway settings
             if ($device['device_type'] == 2) {
-                print "<tr><td>"; print_url(WEB_device_access_control,"/admin/devices/edit_gw_instances.php?id=$id"); print "</td><td>" . WEB_device_dhcp_server . "</td><td>" . WEB_device_queues_enabled . "</td><td>" . WEB_device_connected_only . "</td></tr>";
+                print "<tr><td>"; print_url(WEB_device_access_control,"/admin/devices/edit_gw_instances.php?id=$id", 'linkButton'); print "</td><td>" . WEB_device_dhcp_server . "</td><td>" . WEB_device_queues_enabled . "</td><td>" . WEB_device_connected_only . "</td></tr>";
                 print "<tr>";
                 print "<td class='data'>";
                 print_qa_select('f_user_acl', $device['user_acl']);
@@ -239,10 +239,10 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
                 print "</td>\n";
                 print "</tr>\n";
                 print "<tr><td colspan=2>";
-                print_url(WEB_list_l3_interfaces, "/admin/devices/edit_l3int.php?id=$id");
+                print_url(WEB_list_l3_interfaces, "/admin/devices/edit_l3int.php?id=$id",'linkButton');
                 print "</td>";
                 print "<td colspan=2>";
-                print_url(WEB_list_gateway_subnets, "/admin/devices/edit_gw_subnets.php?id=$id");
+                print_url(WEB_list_gateway_subnets, "/admin/devices/edit_gw_subnets.php?id=$id", 'linkButton');
                 print "</td></tr>";
                 print "<tr><td colspan=2 class='data'>";
                 print get_l3_interfaces($db_link, $device['id']);

+ 1 - 1
html/admin/devices/switchport.php

@@ -115,7 +115,7 @@ foreach ($ports as $row) {
             $display_tagged = preg_replace($pattern, $replacement, $row['tagged_vlan']);
             $display_vlan.=";T:".$display_tagged; 
             }
-        $ifname= compact_port_name($row['ifName']);
+        $ifname= compact_port_name($row['ifname']);
         $f_cacti_url = get_cacti_graph($device['ip'], $row['snmp_index']);
         if (empty(get_const('torrus_url')) and (empty($f_cacti_url))) {  $snmp_url=$ifname; }
                 else {

+ 7 - 1
html/admin/users/edit_alias.php

@@ -127,7 +127,13 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
 
 <br>
 <form name="def" action="edit_alias.php?id=<?php echo $id; ?>" method="post">
-<b><?php print WEB_user_alias_for."&nbsp"; print_url($auth_info['ip'],"/admin/users/editauth.php?id=$id"); ?></b> <br>
+<b>
+<?php
+print WEB_user_alias_for."&nbsp";
+print_url($auth_info['ip'],"/admin/users/editauth.php?id=$id", 'linkButton');
+?>
+</b>
+<br>
 <table class="data">
 <tr align="center">
     <td><input type="checkbox" onClick="checkAll(this.checked);"></td>

+ 29 - 2
html/admin/users/editauth.php

@@ -400,7 +400,13 @@ $disabled_attr = $is_system_ou ? 'disabled' : '';
             <!-- 3. DHCP -->
             <tr style="height: 10px; background: #f5f5f5;"><td colspan="5"></td></tr>
             <tr>
-                <td><?php echo WEB_cell_dns_name; ?> &nbsp;|&nbsp; <?php print_url(WEB_cell_aliases, $alias_link); ?></td>
+                <td><?php echo WEB_cell_dns_name; ?> &nbsp;|&nbsp; 
+                <?php 
+                if (!empty($alias_link)) {
+                    print_url(WEB_cell_aliases, $alias_link, 'linkButton');
+                    }
+                ?>
+                </td>
                 <td><?php echo WEB_cell_dhcp; ?></td>
                 <td><?php echo WEB_cell_acl; ?></td>
                 <td><?php echo WEB_cell_option_set; ?></td>
@@ -424,7 +430,28 @@ $disabled_attr = $is_system_ou ? 'disabled' : '';
             <!-- 4. МОНИТОРИНГ -->
             <tr style="height: 10px; background: #f5f5f5;"><td colspan="5"></td></tr>
             <tr>
-                <td width="200"><?php echo WEB_cell_wikiname; ?></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, 'linkButton');
+                        }
+                    } 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, 'linkButton');
+                    }
+                    ?>
+                </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>

+ 9 - 0
html/css/white.css

@@ -101,3 +101,12 @@ input:disabled, select:disabled {
     color: #888 !important;
     cursor: not-allowed !important;
 }
+
+.linkButton{
+  padding: 1px 5px;
+  background: #ffebcd;
+  border-radius: 15px;
+  box-shadow: 0 0 5px rgba(206, 57, 57, 0.5);
+  color: #fff;
+  text-decoration: none;
+}

+ 3 - 2
html/inc/common.php

@@ -1264,9 +1264,10 @@ function print_submenu_nw($display_name, $page, $current_page, $last)
     }
 }
 
-function print_url($display_name, $page)
+function print_url($display_name, $page, $class = '')
 {
-    print "<a href='" . reencodeurl($page) . "'> $display_name </a>";
+    if (!empty($class)) { $class = "class='{$class}'"; }
+    print "<a $class href='" . reencodeurl($page) . "'> $display_name </a>";
 }
 
 function print_log_submenu($current_page)

+ 1 - 1
html/inc/sql.php

@@ -906,7 +906,7 @@ function allow_update($db, $table, $action = 'update', $field = '')
                 'link_check' => true,
                 'nagios' => true,
                 'nagios_handler' => true,
-                'Wikiname' => true
+                'wikiname' => true
             ],
             'user_list' => [
                 'description' => true,