diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 18f82b76aa..6a4606e74b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,36 @@ +2009-02-09 Evi Vanoost + + * general/header.php, general/footer.php: Made it comply with standards + + * general/main_menu.php: Fixed some typo's. + + * include/javascript/jquery.pandora.js: This was loading an extension + that has a separate file already + + * include/functions.php: Added process_page_head and process_page_body + these are callback functions for ob_start and add functionality like + conditional loading and external scripts in the correct places. Also adds + override functionality to certain items (like refresh) from anywhere + + * include/javascript/time_en.js: Added as a placeholder + + * extensions/update_manager.php: Fixed some typos + + * operation/agentes/exportdata.php, operation/agentes/networkmap.php, + operation/events/events.php, operation/extensions.php, + operation/incidents/incident_detail.php, + operation/reporting/reporting_viewer.php, + operation/visual_console/render_view.php, + godmode/agentes/alert_manager.php, + godmode/agentes/module_manager_editor.php, + godmode/agentes/planned_downtime.php, + godmode/alerts/configure_alert_template.php, + godmode/alerts/configure_alert_action.php, + godmode/groups/configure_group.php, godmode/reporting/graph_builder.php, + godmode/reporting/map_builder.php, godmode/reporting/reporting_builder.php + godmode/snmpconsole/snmp_alert.php: Changed javascript, css and jquery + loading to the new buffer callback handlers. + 2009-02-09 Raul Mateos * include/config_process.php, general/error_noconfig.php, index.php: diff --git a/pandora_console/extensions/update_manager.php b/pandora_console/extensions/update_manager.php index 76c3adad14..b57f80aa90 100644 --- a/pandora_console/extensions/update_manager.php +++ b/pandora_console/extensions/update_manager.php @@ -105,7 +105,7 @@ function pandora_update_manager_login () { echo '
'; echo ' '; echo __('There\'s a new update for Pandora'); - echo '. '; + echo '. '; echo __('More info'); echo ''; echo '
'; diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php index b0e9087a01..2ca6ebbacd 100644 --- a/pandora_console/general/footer.php +++ b/pandora_console/general/footer.php @@ -23,12 +23,12 @@ if (isset($_SERVER['REQUEST_TIME'])) { $time = get_system_time (); } -echo 'Pandora FMS '.$pandora_version.' - Build '.$build_version.'
'; +echo '
Pandora FMS '.$pandora_version.' - Build '.$build_version.'
'; echo ''. __('Page generated at') . ' '. print_timestamp ($time, true, array ("prominent" => "timestamp")); //Always use timestamp here if ((isset($develop_bypass)) AND ($develop_bypass == 1)) { echo ' - Saved '.format_numeric ($sql_cache["saved"]).' Queries'; } echo '
'; -echo ''; +echo ''.__('Get Firefox').''; ?> diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 96624da24d..d29ccd6e39 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -45,7 +45,7 @@ echo ''; +echo ''; $servers["all"] = (int) get_db_value ('COUNT(id_server)','tserver'); $servers["up"] = (int) check_server_status (); $servers["down"] = $servers["all"] - $servers["up"]; @@ -68,11 +68,11 @@ echo ""; echo ''; $refr = (int) get_parameter ("refr"); if ($refr) { - echo 'lightning '. __('Autorefresh'); + echo 'lightning '. __('Autorefresh'); echo ' ('.date ("i:s", $refr).')'; echo ''; } else { - echo ' '.__('Autorefresh').''; + echo ' '.__('Autorefresh').''; $values = array ('5' => '5 '.__('seconds'), '10' => '10 '.__('seconds'), '15' => '15 '.__('seconds'), @@ -90,13 +90,14 @@ if ($refr) { //Events echo '

'; -echo 'lightning_go '.__('Events').''; +echo 'lightning_go '.__('Events').''; // Styled text echo '
Pandora FMS
'; + +$config['jquery'][] = 'countdown'; ?> - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + '; + + if (!empty ($config['css'])) { + $loaded = array ('', $config["style"], 'ie'); //We can't load empty and we loaded current style and ie + foreach ($config['css'] as $style) { + if (in_array ($style, $loaded)) { + continue; + } + array_push ($loaded, $style); + $output .= ''; + } + } + + if (!empty ($config['js'])) { + //Load other javascript + $loaded = array ('', 'wz_jsgraphics', 'pandora', 'date_'.$config['language'], 'time_'.$config['language'], 'countdown_'.$config['language']); //We can't load empty and we loaded wz_jsgraphics and pandora + foreach ($config['js'] as $javascript) { + if (in_array ($javascript, $loaded)) { + continue; + } + array_push ($loaded, $javascript); + $output .= ''; + } + } + + if (!empty ($config['jquery'])) { + //Load jQuery + $loaded = array ('', 'pandora'); //We automagically load pandora and jquery + + //Then add each script as necessary + foreach ($config['jquery'] as $script) { + if (in_array ($script, $loaded)) { + continue; + } + array_push ($loaded, $script); + $output .= ''; + } + } + + $output .= $string; + + return $output; +} + +/** + * Callback function to add stuff to the body + * + * @param string Callback will fill this with the current buffer. + * @param bitfield Callback will fill this with a bitfield (see ob_start) + * + * @return string String to return to the browser + */ +function process_page_body ($string, $bitfield) { + global $config; + + // Show custom background + if ($config["pure"] == 0) { + $output = ''; + } else { + $output = ''; //Don't enforce a white background color. Let user style sheet do that + } + + $output .= $string; + + $output .= ''; + + return $output; +} ?> diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index a4ac35f7cf..247907d42b 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -22,12 +22,15 @@ $(document).ready (function () { return this.each (function () { this.checked = false; })}; + $.fn.enable = function () { return $(this).removeAttr ("disabled"); }; + $.fn.disable = function () { return $(this).attr ("disabled", "disabled"); }; + $.fn.pulsate = function () { return $(this).fadeIn ("normal", function () { $(this).fadeOut ("normal", function () { @@ -39,70 +42,5 @@ $(document).ready (function () { }); }); }; - - /** - * Cookie plugin - * - * Copyright (c) 2006 Klaus Hartl (stilbuero.de) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ - /** - * Get the value of a cookie with the given name. - * - * @example $.cookie('the_cookie'); - * @desc Get the value of a cookie. - * - * @param String name The name of the cookie. - * @return The value of the cookie. - * @type String - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ - $.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // NOTE Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason... - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; - } - }; + }); diff --git a/pandora_console/include/languages/time_en.js b/pandora_console/include/languages/time_en.js new file mode 100644 index 0000000000..469bcd6dc9 --- /dev/null +++ b/pandora_console/include/languages/time_en.js @@ -0,0 +1 @@ +/* Placeholder. Original strings in English already */ \ No newline at end of file diff --git a/pandora_console/index.php b/pandora_console/index.php index 99394604e8..b9124b2c42 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -97,70 +97,21 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) { exit; //Always exit after sending location headers } -echo ''; +echo ''; +ob_start ('process_page_head'); //This starts the page head. In the call back function, things from $page['head'] array will be processed into the head // Pure mode (without menu, header and footer). $config["pure"] = (bool) get_parameter ("pure", 0); -// Auto Refresh page +// Auto Refresh page (can now be disabled anywhere in the script) $config["refr"] = (int) get_parameter ("refr", 0); -if ($config["refr"] > 0) { - // Agent selection filters and refresh - $query = 'http' . (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME']; - if ($_SERVER['SERVER_PORT'] != 80 && (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE && $_SERVER['SERVER_PORT'] != 443)) { - $query .= ":" . $_SERVER['SERVER_PORT']; - } - - $query .= $_SERVER['SCRIPT_NAME']; - if (sizeof ($_REQUEST)) - //Some (old) browsers don't like the ?&key=var - $query .= '?1=1'; - - //We don't clean these variables up as they're only being passed along - foreach ($_GET as $key => $value) { - /* Avoid the 1=1 */ - if ($key == 1) - continue; - $query .= '&'.$key.'='.$value; - } - foreach ($_POST as $key => $value) { - $query .= '&'.$key.'='.$value; - } - - echo ''; -} enterprise_include ('index.php'); - -echo 'Pandora FMS - '.__('the Flexible Monitoring System').' - - - - - - - - - - - - - - -'; - enterprise_hook ('load_html_header'); -echo ''; +echo ''; //This tag is included in the buffer passed to process_page_head so technically it can be stripped -// Show custom background -if ($config["pure"] == 0) { - echo ''; -} else { - echo ''; //Don't enforce a white background color. Let user style sheet do that -} +ob_start ('process_page_body'); $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; $config["remote_addr"] = $_SERVER['REMOTE_ADDR']; @@ -289,6 +240,7 @@ if ($config["pure"] == 0) { require ("general/footer.php"); echo ''; } - -echo ''; +echo ''; //container div +while (@ob_end_flush()); +echo ''; ?> \ No newline at end of file diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index 026c6c4fa6..209082141d 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -229,8 +229,9 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){ $date_to = $_POST["to_date"]; else $date_to = $ahora; - - echo ""; + + $config['js'][] = 'calendar'; + echo "

".__('Pandora Agents')." > "; echo __('Export data')."

"; diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index 898be2f949..d3b35304df 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -383,12 +383,10 @@ if ($result !== false) { return; } + +$config['css'][] = 'cluetip'; +$config['jquery'][] = 'cluetip'; ?> - - - - - '; echo " - - - - - - - - -