소스 검색

do not update the switch status page when opening links from it

root 2 년 전
부모
커밋
07255f6c3d
2개의 변경된 파일31개의 추가작업 그리고 7개의 파일을 삭제
  1. 10 6
      html/admin/devices/switchstatus.php
  2. 21 1
      html/inc/common.php

+ 10 - 6
html/admin/devices/switchstatus.php

@@ -139,7 +139,7 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
             print "<tr align=center>\n";
             $cl = "down";
             $new_info = NULL;
-            
+
             $display_vlan= $row['vlan'];
             if (!empty($row['untagged_vlan'])) { 
                 if ($row['untagged_vlan'] != $row['vlan']) { 
@@ -167,12 +167,13 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
                 list($poper, $padmin, $pspeed, $perrors) = explode(';', $port_state_detail);
                 if ($poper == 1) { $cl = "up"; }
                 if ($poper >= 2) {
-                    if ($padmin >= 2) { $cl = "shutdown"; } else { $cl = "down"; }      
+                    if ($padmin >= 2) { $cl = "shutdown"; } else { $cl = "down"; }
                     }
                 }
 
             print "<td class='" . $cl . "' style='padding:0'><input type=checkbox name=d_port_index[] value=" . $row['snmp_index'] . " ></td>\n";
-            print "<td class='" . $cl . "'><a href=\"editport.php?id=" . $row['id'] . "\">" . $row['port'] . "</a></td>\n";
+
+            print "<td class='" . $cl . "'><a href=\"#\" onclick=\"".open_window_url("editport.php?id=".$row['id'])." return false;\">" . $row['port'] . "</a></td>\n";
             print "<td class='" . $cl . "' >" . $row['port_name'] . "</td>\n";
             print "<td class='" . $cl . "' >" . $row['snmp_index'] . "</td>\n";
             print "<td class='" . $cl . "'>";
@@ -275,7 +276,7 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
                 $snmp_url = $ifname;
             } else {
                 if (isset($f_cacti_url)) {
-                    $snmp_url = "<a href=\"$f_cacti_url\">" . $ifname . "</a>";
+                    $snmp_url = "<a href=\"#\" onclick=\"".open_window_url($f_cacti_url)."return false;\">" . $ifname . "</a>";
                 }
                 if (!empty(get_const('torrus_url'))) {
                     $normed_ifname = str_replace("/", "_", $ifname);
@@ -283,7 +284,7 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
                     $normed_ifname = trim(str_replace(" ", "_", $normed_ifname));
                     $t_url = str_replace("HOST_IP", $device['ip'], get_const('torrus_url'));
                     $t_url = str_replace("IF_NAME", $normed_ifname, $t_url);
-                    $snmp_url = "<a href=\"$t_url\">" . $ifname . "</a>";
+                    $snmp_url = "<a href=\"#\" onclick=\"".open_window_url($t_url)."return false;\">" . $ifname . "</a>";
                 }
             }
 
@@ -327,7 +328,10 @@ print_editdevice_submenu($page_url, $id, $device['device_type'], $user_info['log
             }
 
             print "<td class=\"$cl_error\">" . $perrors . "</td>\n";
-            print "<td class='" . $cl . "' ><button name=\"write\" class=\"j-submit-report\" onclick=\"window.open('portmactable.php?id=" . $row['id'] . "')\">" . $row['last_mac_count'] . "</button></td>\n";
+                    $snmp_url = "<a href=\"#\" onclick=\"".open_window_url($f_cacti_url)." return false;\">" . $ifname . "</a>";
+
+            print "<td class='" . $cl . "' ><button onclick=\"". open_window_url('portmactable.php?id='.$row['id'])." return false;\">" . $row['last_mac_count'] . "</button></td>\n";
+
             print "<td class='" . $cl . "'>" . $sfp_status . " " . $poe_info . "</td>\n";
             if (isset($poe_status) and !$row['skip']) {
                 print "<td class=\"data\">";

+ 21 - 1
html/inc/common.php

@@ -549,6 +549,21 @@ function print_submenu_url($display_name, $page, $current_page, $last)
     }
 }
 
+function print_submenu_nw($display_name, $page, $current_page, $last)
+{
+    $url_arr = explode('?', $page);
+    $fpage = $url_arr[0];
+    $new_url = reencodeurl($page);
+    if ($fpage === $current_page) {
+        print "<b>$display_name</b>";
+    } else {
+        print '<a href="" onclick="window.open(\''.$new_url."', '_tab').focus(); return false;\">". $display_name ."</a>";
+    }
+    if (!isset($last) or $last == 0) {
+        print " | ";
+    }
+}
+
 function print_url($display_name, $page)
 {
     print "<a href='" . reencodeurl($page) . "'> $display_name </a>";
@@ -616,6 +631,11 @@ function print_device_submenu($current_page)
     print "</div>\n";
 }
 
+function open_window_url ($url) 
+{
+return "window.open('".$url."', '_tab');";
+}
+
 function print_editdevice_submenu($current_page, $id, $dev_type, $dev_name = NULL)
 {
     print "<div id='subsubmenu'>\n";
@@ -1302,7 +1322,7 @@ function print_auth_port($db, $port_id)
         if (isset($f_dns) and $f_dns != '') {
             $name = $f_dns;
         }
-        print "<a href=\"/admin/users/editauth.php?id=$f_auth_id\">" . $name . " [" . $f_ip . "]</a><br>";
+        print "<a href=\"#\" onclick=\"".open_window_url("/admin/users/editauth.php?id=".$f_auth_id)." return false;\">" . $name . " [" . $f_ip . "]</a><br>";
     }
 }