diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1be16383ae..894740e08a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2009-07-22 Miguel de Dios + + * general/header.php, images/lupa_15x15.png, include/functions_html.php + include/styles/pandora.css, operation/search_results.php: add global + search bar in the header for searching Agents, Maps, Reports, Graphs, + Alerts and Users...if you user have access level... + 2009-07-20 Miguel de Dios * operation/agentes/tactical.php, operation/agentes/status_monitor.php: add diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 64ce4d61fd..eebfde0315 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -14,99 +14,150 @@ require_once ("include/functions_messages.php"); -//First column (logo) -echo ' + + + + + + + +
'; - -echo '
'; - -// First column (identifier) -echo '
user '.''.__('You are').' ['.$config["id_user"].'] '; -$msg_cnt = get_message_count ($config["id_user"]); -if ($msg_cnt > 0) { - echo ''; +?> + + + +
+ .png" class="bot" alt="user" /> + [] + 0) { + echo ''; - require_css_file ('dialog'); - require_jquery_file ('ui.core'); - require_jquery_file ('ui.dialog'); - echo ''; - print_image ("images/email.png", false, - array ("title" => __('You have %d unread message(s)', $msg_cnt), - "id" => "yougotmail", - "class" => "bot")); - echo ''; -} - -//First column, second row (logout button) -echo '

'; -echo 'logout '. __('Logout').''; - -// Second column (link to main page) -echo '
'; -echo 'info '.__('General information').''; - -//Second column, second row (System up/down) -echo '

'; -echo ''; -$servers["all"] = (int) get_db_value ('COUNT(id_server)','tserver'); -$servers["up"] = (int) check_server_status (); -$servers["down"] = $servers["all"] - $servers["up"]; -if ($servers["up"] == 0) { - //All Servers down or no servers at all - echo 'cross '.__('All systems').': '.__('Down'); -} elseif ($servers["down"] != 0) { - //Some servers down - echo 'error '.$servers["down"].' '.__('servers down'); -} else { - //All servers up - echo 'ok '.__('All systems').': '.__('Ready'); -} -unset ($servers); // Since this is the header, we don't like to trickle down variables. -echo ""; - - -// Third column -// Autorefresh -echo '
'; -$ignored_params = array ('agent_config' => false, 'code' => false); -if ($config["refr"]) { - $ignored_params['refr'] = 0; - echo 'lightning '. __('Autorefresh'); - echo ' ('.date ("i:s", $config["refr"]).')'; - echo ''; -} else { - $ignored_params['refr'] = ''; - echo 'lightning '.__('Autorefresh').''; - $values = array ('5' => '5 '.__('seconds'), - '10' => '10 '.__('seconds'), - '15' => '15 '.__('seconds'), - '30' => '30 '.__('seconds'), - '60' => '1 '.__('minute'), - '120' => '2 '.__('minutes'), - '300' => '5 '.__('minutes'), - '900' => '15 '.__('minutes'), - '1800' => '30 '.__('minutes'), - '3600' => '1 '.__('hour')); - echo ''; -} - -//Events -echo '

'; -echo 'lightning_go '.__('Events').''; - -// Styled text -echo '
Pandora FMS
'; - -/* Enterprise support */ -if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) - echo '
Enterprise
'; -else - echo '
OpenSource
'; - -echo '
'; - + require_css_file ('dialog'); + require_jquery_file ('ui.core'); + require_jquery_file ('ui.dialog'); + echo ''; + print_image ("images/email.png", false, + array ("title" => __('You have %d unread message(s)', $msg_cnt), "id" => "yougotmail", "class" => "bot")); + echo ''; + } + ?> +
+
+ <?=__('Logout');?> +
+ info +
+
+ +  '.__('All systems').': '.__('Down'); + } + elseif ($servers["down"] != 0) { + //Some servers down + echo 'error '.$servers["down"].' '.__('servers down'); + } + else { + //All servers up + echo 'ok '.__('All systems').': '.__('Ready'); + } + unset ($servers); // Since this is the header, we don't like to trickle down variables. + ?> + +
+ false, 'code' => false); + if ($config["refr"]) { + $ignored_params['refr'] = 0; + echo 'lightning '. __('Autorefresh'); + echo ' ('.date ("i:s", $config["refr"]).')'; + echo ''; + } + else { + $ignored_params['refr'] = ''; + echo 'lightning '.__('Autorefresh').''; + $values = array ( + '5' => '5 '.__('seconds'), + '10' => '10 '.__('seconds'), + '15' => '15 '.__('seconds'), + '30' => '30 '.__('seconds'), + '60' => '1 '.__('minute'), + '120' => '2 '.__('minutes'), + '300' => '5 '.__('minutes'), + '900' => '15 '.__('minutes'), + '1800' => '30 '.__('minutes'), + '3600' => '1 '.__('hour')); + echo ''; + } + ?> +
+
+ + lightning_go + +
+
Pandora FMS
+ Enterprise'; + else + echo '
OpenSource
'; + ?> +
+
+ + + onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');" + size="119" style="background: white url('images/lupa_15x15.png') no-repeat left; padding: 0; padding-left:15px; margin: 0; width: 70%; margin-left: 2px;" /> + ((strlen(__("Search")) > 12) ? (substr(__("0123456789AB"), 0, 12) . "…") : __("0123456789AB")), + 'all' => ((strlen(__("All")) > 12) ? (substr(__("All"), 0, 12) . "…") : __("All")), + 'users' => ((strlen(__("Users")) > 12) ? (substr(__("Users"), 0, 12) . "…") : __("Users")), + 'alerts' => ((strlen(__("Alerts")) > 12) ? (substr(__("Alerts"), 0, 12) . "…") : __("Alerts")), + 'reports' => ((strlen(__("Reports")) > 12) ? (substr(__("Reports"), 0, 12) . "…") : __("Reports")) + ); + + //INI SECURITY ACL + if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "AR")) { + $values['agents'] = ((strlen(__("Agents")) > 12) ? (substr(__("Agents"), 0, 12) . "…") : __("Agents")); + $values['graphs'] = ((strlen(__("Graphs")) > 12) ? (substr(__("Graphs"), 0, 12) . "…") : __("Graphs")); + } + if (give_acl ($config["id_user"], 0, "AR")) + $values['maps'] = ((strlen(__("Maps")) > 12) ? (substr(__("Maps"), 0, 12) . "…") : __("Maps"));; + //END SECURITY ACL + + print_select_style ($values, 'search_category', $selected, "min-width: 12em;"); + ?> + 12) ? (substr(__("0123456789ABCD"), 0, 12) . "…") : __("Search")); ?>" + class="sub" type="submit" style="min-width: 12em; height: 23px;" /> +
+
+ diff --git a/pandora_console/images/lupa_15x15.png b/pandora_console/images/lupa_15x15.png new file mode 100644 index 0000000000..2f048b00d1 Binary files /dev/null and b/pandora_console/images/lupa_15x15.png differ diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index ab39d72f81..8f19faf641 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -15,6 +15,96 @@ // GNU General Public License for more details. +/** + * Prints an array of fields in a popup menu of a form. + * + * Based on choose_from_menu() from Moodle + * + * @param array Array with dropdown values. Example: $fields["value"] = "label" + * @param string Select form name + * @param variant Current selected value. Can be a single value or an + * array of selected values (in combination with multiple) + * @param string Javascript onChange code. + * @param string Label when nothing is selected. + * @param variant Value when nothing is selected + * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param bool Set the input to allow multiple selections (optional, single selection by default). + * @param bool Whether to sort the options or not (optional, unsorted by default). + * + * @return string HTML code if return parameter is true. + */ +function print_select_style ($fields, $name, $selected = '', $style='', $script = '', $nothing = '', $nothing_value = 0, $return = false, $multiple = false, $sort = true, $class = '', $disabled = false) { + $output = "\n"; + + static $idcounter = array (); + + //If duplicate names exist, it will start numbering. Otherwise it won't + if (isset ($idcounter[$name])) { + $idcounter[$name]++; + } else { + $idcounter[$name] = 0; + } + + $id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); + + $attributes = ""; + if (!empty ($script)) { + $attributes .= ' onchange="'.$script.'"'; + } + if (!empty ($multiple)) { + $attributes .= ' multiple="multiple" size="10"'; + } + if (!empty ($class)) { + $attributes .= ' class="'.$class.'"'; + } + if (!empty ($disabled)) { + $attributes .= ' disabled="disabled"'; + } + + $output .= '"; + + if ($return) + return $output; + + echo $output; +} + /** * Prints an array of fields in a popup menu of a form. diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 28d859e67b..3b43770ec8 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -209,7 +209,7 @@ div#menu { div#head { font-size: 8pt; width: 960px; - height: 60px; + height: 87px;/*84px;*/ /*height: 60px;*/ background: url(../../images/header.jpg); border-bottom: solid 2px #555; } diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php new file mode 100644 index 0000000000..45582b8100 --- /dev/null +++ b/pandora_console/operation/search_results.php @@ -0,0 +1,230 @@ + + + +"; +echo "
"; + +if (($agents === false) && ($users === false) && ($alerts === false) && ($graphs === false) + && ($reports === false) && ($maps === false)) { + echo "

" . __("None results") . "

\n"; +} +else { + if ($agents !== false) { + echo "\n"; + } + + if ($users !== false) { + echo "\n"; + } + + if ($alerts !== false) { + echo "\n"; + } + + if ($graphs !== false) { + echo "\n"; + } + + if ($reports !== false) { + echo "\n"; + } + + if ($maps !== false) { + //echo "

" . __("Maps") . "

\n"; + echo "\n"; + } +} +?>