Beispiel #1
0
<body>
<!-- Tabs if present -->
<?php 
if (GET('fullscreen') != 1) {
    $tabs = Window_Panel_Ajax::getPanelTabs();
    //$tabs_urls = Window_Panel_Ajax::getPanelUrls();
    $first = 1;
    include "tabs.php";
    ?>
<!-- EDIT panel controls -->

<?php 
    // if not fullscreen
} else {
    // if in fullscreen mode show a big tab name and icon
    $tabs = Window_Panel_Ajax::getPanelTabs();
    if (strlen($tabs[$panel_id]["tab_icon_url"]) > 0) {
        $image_string = "<img src=\"" . $tabs[$panel_id]["tab_icon_url"] . "\">";
    } else {
        $image_string = "";
    }
    print "<center><h2> [" . $tabs[$panel_id]["tab_name"] . $image_string . "] </h2></center>";
}
if ($tabs[$panel_id]['disable'] == 1) {
    die(_("The panel you want to show is disabled.") . " <a href='panel.php?edit_tabs=1&panel_id=" . $panel_id . "'>" . _("Click here to Edit Tabs") . "</a>");
}
// tab url
$menu_opc = GET('hmenu');
$menu_sopc = GET('smenu');
if (GET('edit') && $tabsavt[$panel_id] != "") {
    $last_tab_id = -1;
        foreach ($panel_urls as $key => $value) {
            $key_ini = $key;
            if (!empty($value['tab_url'])) {
                if ($value['tab_url'] == $url) {
                    $flag = false;
                    break;
                }
            }
        }
        //
        if ($flag) {
            $panel_urls[++$key_ini] = array('tab_name' => $name, 'tab_icon_url' => '', 'disable' => 0, 'tab_url' => $url);
        }
        //
        //Window_Panel_Ajax::setPanelUrls($panel_urls);
        Window_Panel_Ajax::setPanelTabs($panel_urls, $user);
        // clean var
        unset($panel_urls);
        unset($flag);
        unset($key_ini);
    }
    ?>
<script type="text/javascript">
	parent.location.href='../panel/panel.php';
</script>
<?php 
    return;
} else {
    $url = GET('url');
    if (empty($url)) {
        die(_('Error no url for add'));
Beispiel #3
0
}
//
$url = str_replace('hmenu', 'older-hmenu', $url);
$url = str_replace('smenu', 'older-smenu', $url);
$url .= '&hmenu=dashboards&smenu=dashboards';
//
foreach ($panel_urls as $key => $value) {
    $key_ini = $key;
    if (!empty($value['tab_url'])) {
        if ($value['tab_url'] == $url) {
            $flag = false;
            break;
        }
    }
}
//
if ($flag) {
    $panel_urls[++$key_ini] = array('tab_name' => $name, 'tab_icon_url' => '', 'disable' => 0, 'tab_url' => $url);
}
//
//Window_Panel_Ajax::setPanelUrls($panel_urls);
Window_Panel_Ajax::setPanelTabs($panel_urls);
// clean var
unset($panel_urls);
unset($flag);
unset($key_ini);
?>
<script type="text/javascript">
	window.top.frames["main"].document.location.href='../panel/panel.php';
</script>
Beispiel #4
0
 function showWindowContents()
 {
     require_once 'panel/Ajax_Panel.php';
     $conf =& $GLOBALS['conf'];
     $configs_dir = $conf->get_conf('panel_configs_dir');
     $tabs = Window_Panel_Ajax::getPanelTabs();
     // If there aren't any tabs, simulate an empty one
     if (empty($tabs)) {
         $tabs[1] = array('tab_name' => '', 'tab_icon_url' => '');
     }
     $user = Session::get_session_user();
     $ajax =& new Window_Panel_Ajax();
     $tab_num = 0;
     $panel_num = 0;
     $panel_id = GET('panel_id') ? GET('panel_id') : 0;
     $results_array = array();
     $results_array[0] = array();
     $results_array[1] = array();
     $results_array[2] = array();
     $results_array[3] = array();
     $results_array[4] = array();
     $html = "<ul>\n";
     foreach ($tabs as $tab_id => $tab_name) {
         if ($this->get('metric_restrict_to_tab') && $tab_id != $panel_id) {
             continue;
         }
         $tab_num++;
         if ($this->get('metric_max_categories') > 0 && $tab_num > $this->get('metric_max_categories')) {
             continue;
         }
         if ($this->get('metric_show_tab_names')) {
             if (strlen($tabs[$tab_id]["tab_icon_url"]) > 0) {
                 $image_string = "<img src=\"" . $tabs[$tab_id]["tab_icon_url"] . "\">";
             } else {
                 $image_string = "";
             }
             $html .= "<br/>" . $tabs[$tab_id]["tab_name"] . $image_string . "<br/><hr noshade>\n";
         }
         $options = $ajax->loadConfig(null, $configs_dir . "/" . $user . "_" . $tab_id);
         // TODO: Check out why some config files get written with "_1" behind them
         if (empty($options)) {
             $options = $ajax->loadConfig(null, $configs_dir . "/" . $user . "_" . $tab_id . "_1");
         }
         $panel_num = 0;
         if (!empty($options)) {
             foreach ($options as $panel) {
                 if ($this->get('metric_max_entries') > 0 && $panel_num >= $this->get('metric_max_entries')) {
                     continue;
                 }
                 $indicator = " <img src=\"../pixmaps/traffic_light0.gif\"/> ";
                 if (isset($panel['metric_opts']['enable_metrics']) && $panel['metric_opts']['enable_metrics'] == 1 && isset($panel['metric_opts']['metric_sql']) && strlen($panel['metric_opts']['metric_sql']) > 0) {
                     $panel_num++;
                     $sql = $panel['metric_opts']['metric_sql'];
                     if (!preg_match('/^\\s*\\(?\\s*SELECT\\s/i', $sql) || preg_match('/\\sFOR\\s+UPDATE/i', $sql) || preg_match('/\\sINTO\\s+OUTFILE/i', $sql) || preg_match('/\\sLOCK\\s+IN\\s+SHARE\\s+MODE/i', $sql)) {
                         die(_("SQL Query invalid due security reasons"));
                     }
                     $db = new ossim_db();
                     $conn = $db->connect();
                     if (!($rs = $conn->Execute($sql))) {
                         echo "Error was: " . $conn->ErrorMsg() . "\n\nQuery was: " . $sql;
                         exit;
                     }
                     $metric_value = $rs->fields[0];
                     $db->close($conn);
                     $low_threshold = $panel['metric_opts']['low_threshold'];
                     $high_threshold = $panel['metric_opts']['high_threshold'];
                     $first_comp = $low_threshold - $low_threshold / 4;
                     $second_comp = $low_threshold + $low_threshold / 4;
                     $third_comp = $high_threshold + $high_threshold / 4;
                     $fourth_comp = $high_threshold + $high_threshold / 4;
                     $title = "";
                     if (isset($panel["window_opts"]["title"])) {
                         $title = $panel["window_opts"]["title"];
                     }
                     if ($metric_value <= $first_comp) {
                         $indicator = " <img src=\"../pixmaps/traffic_light1.gif\"/> ";
                         array_push($results_array[4], "<li>{$indicator}<small>" . $title . "</small>\n");
                     } elseif ($metric_value > $first_comp && $metric_value <= $second_comp) {
                         $indicator = " <img src=\"../pixmaps/traffic_light2.gif\"/> ";
                         array_push($results_array[3], "<li>{$indicator}<small>" . $title . "</small>\n");
                     } elseif ($metric_value > $second_comp && $metric_value <= $third_comp) {
                         $indicator = " <img src=\"../pixmaps/traffic_light3.gif\"/> ";
                         array_push($results_array[2], "<li>{$indicator}<small>" . $title . "</small>\n");
                     } elseif ($metric_value > $third_comp && $metric_value <= $fourth_comp) {
                         $indicator = " <img src=\"../pixmaps/traffic_light4.gif\"/> ";
                         array_push($results_array[1], "<li>{$indicator}<small>" . $title . "</small>\n");
                     } elseif ($metric_value > $fourth_comp) {
                         $indicator = " <img src=\"../pixmaps/traffic_light5.gif\"/> ";
                         array_push($results_array[0], "<li>{$indicator}<small>" . $title . "</small>\n");
                     } else {
                         $indicator = " <img src=\"../pixmaps/traffic_light0.gif\"/> ";
                     }
                     $html .= "<li>{$indicator}<small>" . $title . "</small>\n";
                 }
                 // if(isset(sql))
             }
         }
         // if(!empty($options))
     }
     $html .= "</ul>\n";
     if (!$this->get('metric_show_tab_names')) {
         // Since we don't separate by name, let's give thema  nice order.
         $html = '';
         $html .= "<ul>\n";
         foreach ($results_array as $temp_array) {
             foreach ($temp_array as $metric) {
                 $html .= "{$metric}\n";
             }
         }
         $html .= "</ul>\n";
     }
     return $html;
 }