2009-02-19 Esteban Sanchez <estebans@artica.es>
* include/functions_ui.php: Added require_css_file(),
require_javascript_file() and require_jquery_file() to add CSS,
javascript and jQuery files to the header easily without changing
config object. A path parameter is addded to allow the use on
enterprise code.
* include/functions_db.php: Added
get_db_value_filter(), get_db_all_rows_filter() and
process_sql_delete(). Fixed delete_agent() style and use these
functions. Added process_page_head() from functions_ui.php and changed
a bit the config javascript object part.
* include/functions_custom_graphs.php: Get results indexed by id on
get_user_custom_graphs().
* include/functions.php: Moved process_page_head to functions_ui.php.
* godmode/agentes/manage_delete.php: New interface to perform massive
agents deletion.
* godmode/menu.php: Added new option to massive agents deletion.
* general/main_menu.php, godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/configure_alert_template.php,
godmode/reporting/map_builder.php, operation/agentes/networkmap.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php: Use new functions in include
CSS and javascript files.
* index.php: Bit of style when printing the header so the HTML can be
readed easily in a editor.
* include/javascript/pandora.js: Added a variable to determine the
enterprise directory.
* include/styles/pandora.css: Added style for manage_delete.php
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
|
|
|
var ENTERPRISE_DIR = 'enterprise';
|
|
|
|
|
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
|
|
|
/* Function to hide/unhide a specific Div id */
|
|
|
|
function toggleDiv (divid){
|
2008-06-26 Esteban Sanchez <estebans@artica.es>
* ajax.php: Sed id_user in config array.
* godmode/menu.php, general/header.php, operation/menu.php: Replaced
lang_label with lang_string().
* general/logon_ok.php: Reduced one indentation level.
* godmode/agentes/agent_manager.php: Replaced lang_label with
lang_string(). Use pandora functions.
* include/functions_html.php, godmode/agentes/configurar_agente.php:
Tab and blankspaces style correction.
* godmode/reporting/map_builder.php: Complete rewritten to provide an
intuitive way of build the maps. It's cool, useful and very simple.
* godmode/reporting/reporting_builder.php: Deleted an output debug.
* godmode/setup/setup.php: Rewritten to use pandora functions. Added a
colorpicker for color settings.
* include/config.php: Reset pandora password. We must solve things
with this file...
* include/functions.php: Check if input is an array on safe_input().
Use filename as id in array returned by list_files().
* include/functions_db.php: Renamed return_coordinate_* functions.
Style correction.
* include/javascript/jquery.js: Updated to 1.2.6.
* include/javascript/jquery.ui.datepicker.js: Code minimized.
* include/javascript/pandora.js: Style correction.
* include/javascript/wz_jsgraphics.js: Added a class to the elements
of a line, so it can be modified using javascript.
* /include/styles/pandora.css: Added style to some tables dropdowns.
Added new styles relative to visual map editor.
* operation/reporting/reporting_viewer.php: Style correction. Added
jQuery UI.
* operation/visual_console/index.php: Use Pandora functions.
* operation/visual_console/render_view.php: Drawing the map is now on
functions_visual_map.php. Added a countdown if a refresh time is set.
Use pandora functions. Style correction.
* reporting/fgraph.php: Style correction. Use graphic_error() if
there's no data on grafico_modulo_sparse().
* images/trash.png: Added to repository. Image used on trash area on
visual map editor.
* images/console/background/africa.jpg,
images/console/background/asia.jpg,
images/console/background/europe.jpg,
images/console/background/north_america.jpg,
images/console/background/oceania.jpg,
images/console/background/shouth_america.jpg,
images/console/background/world.jpg: Added to repository. Useful and
cool map backgrounds.
* include/functions_visual_map.php: Added to repository. Implements
visual map functions like drawing the map.
* include/javascript/jquery.colorpicker.js: Added to repository.
Implements a color picker widget.
* /include/javascript/jquery.countdown.js: Added to repository.
Implements a countdown widget.
* include/javascript/jquery.ui.core.js: Added to repository. jQuery UI
core.
* include/javascript/jquery.ui.draggable.js: Added to repository.
jQuery draggable plugin.
* include/javascript/jquery.ui.droppable.js: Added to repository.
jQuery droppable plugin.
* include/javascript/pandora_visual_console.js: Added to repository.
Function useful to visual map interface.
* include/languages/countdown_*.js: Added to repository. Countdown
localization.
* include/languages/date_es_la.js, include/languages/date_gl.js,
include/languages/time_es_la.js, include/languages/time_gl.js: Added
to repository. Missing localizations.
* include/styles/color-picker.css: Added to repository. Colorpicker
style sheet.
* include/styles/countdown.css: Added to repository. Countdown style
sheet.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
|
|
|
if (document.getElementById(divid).style.display == 'none') {
|
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
|
|
|
document.getElementById(divid).style.display = 'block';
|
2012-09-13 19:47:21 +02:00
|
|
|
}
|
|
|
|
else {
|
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
|
|
|
document.getElementById(divid).style.display = 'none';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-26 Esteban Sanchez <estebans@artica.es>
* ajax.php: Sed id_user in config array.
* godmode/menu.php, general/header.php, operation/menu.php: Replaced
lang_label with lang_string().
* general/logon_ok.php: Reduced one indentation level.
* godmode/agentes/agent_manager.php: Replaced lang_label with
lang_string(). Use pandora functions.
* include/functions_html.php, godmode/agentes/configurar_agente.php:
Tab and blankspaces style correction.
* godmode/reporting/map_builder.php: Complete rewritten to provide an
intuitive way of build the maps. It's cool, useful and very simple.
* godmode/reporting/reporting_builder.php: Deleted an output debug.
* godmode/setup/setup.php: Rewritten to use pandora functions. Added a
colorpicker for color settings.
* include/config.php: Reset pandora password. We must solve things
with this file...
* include/functions.php: Check if input is an array on safe_input().
Use filename as id in array returned by list_files().
* include/functions_db.php: Renamed return_coordinate_* functions.
Style correction.
* include/javascript/jquery.js: Updated to 1.2.6.
* include/javascript/jquery.ui.datepicker.js: Code minimized.
* include/javascript/pandora.js: Style correction.
* include/javascript/wz_jsgraphics.js: Added a class to the elements
of a line, so it can be modified using javascript.
* /include/styles/pandora.css: Added style to some tables dropdowns.
Added new styles relative to visual map editor.
* operation/reporting/reporting_viewer.php: Style correction. Added
jQuery UI.
* operation/visual_console/index.php: Use Pandora functions.
* operation/visual_console/render_view.php: Drawing the map is now on
functions_visual_map.php. Added a countdown if a refresh time is set.
Use pandora functions. Style correction.
* reporting/fgraph.php: Style correction. Use graphic_error() if
there's no data on grafico_modulo_sparse().
* images/trash.png: Added to repository. Image used on trash area on
visual map editor.
* images/console/background/africa.jpg,
images/console/background/asia.jpg,
images/console/background/europe.jpg,
images/console/background/north_america.jpg,
images/console/background/oceania.jpg,
images/console/background/shouth_america.jpg,
images/console/background/world.jpg: Added to repository. Useful and
cool map backgrounds.
* include/functions_visual_map.php: Added to repository. Implements
visual map functions like drawing the map.
* include/javascript/jquery.colorpicker.js: Added to repository.
Implements a color picker widget.
* /include/javascript/jquery.countdown.js: Added to repository.
Implements a countdown widget.
* include/javascript/jquery.ui.core.js: Added to repository. jQuery UI
core.
* include/javascript/jquery.ui.draggable.js: Added to repository.
jQuery draggable plugin.
* include/javascript/jquery.ui.droppable.js: Added to repository.
jQuery droppable plugin.
* include/javascript/pandora_visual_console.js: Added to repository.
Function useful to visual map interface.
* include/languages/countdown_*.js: Added to repository. Countdown
localization.
* include/languages/date_es_la.js, include/languages/date_gl.js,
include/languages/time_es_la.js, include/languages/time_gl.js: Added
to repository. Missing localizations.
* include/styles/color-picker.css: Added to repository. Colorpicker
style sheet.
* include/styles/countdown.css: Added to repository. Countdown style
sheet.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
|
|
|
function winopeng (url, wid) {
|
2012-03-01 17:41:02 +01:00
|
|
|
open (url, wid,"width=650,height=410,status=no,toolbar=no,menubar=no,scrollbar=no");
|
2012-04-18 18:08:48 +02:00
|
|
|
// WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE
|
2012-12-09 23:31:29 +01:00
|
|
|
status = wid;
|
|
|
|
}
|
|
|
|
|
|
|
|
function winopeng_var (url, wid, width, height) {
|
|
|
|
open (url, wid,"width="+width+",height="+height+",status=no,toolbar=no,menubar=no,scrollbar=yes");
|
|
|
|
// WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE
|
|
|
|
status = wid;
|
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 18:39:48 +01:00
|
|
|
function open_help (help_id, home_url) {
|
|
|
|
open (home_url+"general/pandora_help.php?id="+help_id, "pandorahelp", "width=650,height=500,status=0,toolbar=0,menubar=0,scrollbars=1,location=0");
|
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decode HTML entities into characters. Useful when receiving something from AJAX
|
|
|
|
*
|
|
|
|
* @param str String to convert
|
|
|
|
*
|
|
|
|
* @retval str with entities decoded
|
|
|
|
*/
|
2010-03-08 13:49:49 +01:00
|
|
|
function js_html_entity_decode (str) {
|
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
|
|
|
if (! str)
|
|
|
|
return "";
|
2010-03-08 13:49:49 +01:00
|
|
|
|
|
|
|
str2 = str.replace (/</g, "<").
|
2012-09-13 19:47:21 +02:00
|
|
|
replace (/>/g,">").replace(/</g,'<')
|
|
|
|
.replace(/>/g,'>').replace(/\/g,'\\')
|
|
|
|
.replace(/"/g,'\"').replace(/'/g,'\'')
|
|
|
|
.replace(/&/g,'&').replace(/ /g,' ')
|
|
|
|
.replace(/ /g, '\r').replace(/ /g, '\n');
|
2010-03-08 13:49:49 +01:00
|
|
|
|
|
|
|
return str2;
|
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
|
|
|
}
|
2008-06-26 Esteban Sanchez <estebans@artica.es>
* ajax.php: Sed id_user in config array.
* godmode/menu.php, general/header.php, operation/menu.php: Replaced
lang_label with lang_string().
* general/logon_ok.php: Reduced one indentation level.
* godmode/agentes/agent_manager.php: Replaced lang_label with
lang_string(). Use pandora functions.
* include/functions_html.php, godmode/agentes/configurar_agente.php:
Tab and blankspaces style correction.
* godmode/reporting/map_builder.php: Complete rewritten to provide an
intuitive way of build the maps. It's cool, useful and very simple.
* godmode/reporting/reporting_builder.php: Deleted an output debug.
* godmode/setup/setup.php: Rewritten to use pandora functions. Added a
colorpicker for color settings.
* include/config.php: Reset pandora password. We must solve things
with this file...
* include/functions.php: Check if input is an array on safe_input().
Use filename as id in array returned by list_files().
* include/functions_db.php: Renamed return_coordinate_* functions.
Style correction.
* include/javascript/jquery.js: Updated to 1.2.6.
* include/javascript/jquery.ui.datepicker.js: Code minimized.
* include/javascript/pandora.js: Style correction.
* include/javascript/wz_jsgraphics.js: Added a class to the elements
of a line, so it can be modified using javascript.
* /include/styles/pandora.css: Added style to some tables dropdowns.
Added new styles relative to visual map editor.
* operation/reporting/reporting_viewer.php: Style correction. Added
jQuery UI.
* operation/visual_console/index.php: Use Pandora functions.
* operation/visual_console/render_view.php: Drawing the map is now on
functions_visual_map.php. Added a countdown if a refresh time is set.
Use pandora functions. Style correction.
* reporting/fgraph.php: Style correction. Use graphic_error() if
there's no data on grafico_modulo_sparse().
* images/trash.png: Added to repository. Image used on trash area on
visual map editor.
* images/console/background/africa.jpg,
images/console/background/asia.jpg,
images/console/background/europe.jpg,
images/console/background/north_america.jpg,
images/console/background/oceania.jpg,
images/console/background/shouth_america.jpg,
images/console/background/world.jpg: Added to repository. Useful and
cool map backgrounds.
* include/functions_visual_map.php: Added to repository. Implements
visual map functions like drawing the map.
* include/javascript/jquery.colorpicker.js: Added to repository.
Implements a color picker widget.
* /include/javascript/jquery.countdown.js: Added to repository.
Implements a countdown widget.
* include/javascript/jquery.ui.core.js: Added to repository. jQuery UI
core.
* include/javascript/jquery.ui.draggable.js: Added to repository.
jQuery draggable plugin.
* include/javascript/jquery.ui.droppable.js: Added to repository.
jQuery droppable plugin.
* include/javascript/pandora_visual_console.js: Added to repository.
Function useful to visual map interface.
* include/languages/countdown_*.js: Added to repository. Countdown
localization.
* include/languages/date_es_la.js, include/languages/date_gl.js,
include/languages/time_es_la.js, include/languages/time_gl.js: Added
to repository. Missing localizations.
* include/styles/color-picker.css: Added to repository. Colorpicker
style sheet.
* include/styles/countdown.css: Added to repository. Countdown style
sheet.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-26 15:26:48 +02:00
|
|
|
|
2009-02-02 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/module_manager_editor_wmi.php: Agent module editions
rewritten. The interface should be clearer now and SNMP walking much
more faster, since it's done with AJAX. Some cleanup might be needed
yet.
* godmode/agentes/module_manager_editor_common.php: Added to
repository. Common part for agent module editors.
* images/edit.png, images/spinner.gif: Added to repository.
* include/javascript/jquery.form.js: Added to repository. jQuery form
plugin.
* include/javascript/jquery.pandora.js: Added to repository. Special
Pandora addons for jQuery library.
* include/javascript/pandora.js: Added an extension to Array
javascript objects to check if an array has an element.
* include/styles/pandora.css: Added styling for new module editors.
* include/functions_db.php: Added get_moduletype_description().
* index.php: Added Pandora jQuery extensions.
* pandoradb.sql, pandoradb_migrate_20_to_21.sql: Removed alert_text
useless field from talert_templates.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1417 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-02 16:40:31 +01:00
|
|
|
/**
|
|
|
|
* Function to search an element in an array.
|
|
|
|
*
|
|
|
|
* Extends the array object to use it like a method in an array object. Example:
|
|
|
|
* <code>
|
|
|
|
a = Array (4, 7, 9);
|
|
|
|
alert (a.in_array (4)); // true
|
|
|
|
alert (a.in_array (5)); // false
|
|
|
|
*/
|
|
|
|
Array.prototype.in_array = function () {
|
|
|
|
for (var j in this) {
|
|
|
|
if(this[j] == arguments[0])
|
|
|
|
return true;
|
|
|
|
}
|
2012-09-13 19:47:21 +02:00
|
|
|
|
2009-02-02 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/module_manager_editor_wmi.php: Agent module editions
rewritten. The interface should be clearer now and SNMP walking much
more faster, since it's done with AJAX. Some cleanup might be needed
yet.
* godmode/agentes/module_manager_editor_common.php: Added to
repository. Common part for agent module editors.
* images/edit.png, images/spinner.gif: Added to repository.
* include/javascript/jquery.form.js: Added to repository. jQuery form
plugin.
* include/javascript/jquery.pandora.js: Added to repository. Special
Pandora addons for jQuery library.
* include/javascript/pandora.js: Added an extension to Array
javascript objects to check if an array has an element.
* include/styles/pandora.css: Added styling for new module editors.
* include/functions_db.php: Added get_moduletype_description().
* index.php: Added Pandora jQuery extensions.
* pandoradb.sql, pandoradb_migrate_20_to_21.sql: Removed alert_text
useless field from talert_templates.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1417 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-02 16:40:31 +01:00
|
|
|
return false;
|
2010-06-09 13:07:01 +02:00
|
|
|
};
|
2009-03-09 21:47:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill up select box with id "module" with modules after agent has been selected
|
|
|
|
*
|
|
|
|
* @param event that has been triggered
|
|
|
|
* @param id_agent Agent ID that has been selected
|
|
|
|
* @param selected Which module(s) have to be selected
|
|
|
|
*/
|
|
|
|
function agent_changed (event, id_agent, selected) {
|
|
|
|
if (id_agent == undefined)
|
|
|
|
id_agent = this.value;
|
|
|
|
$('#module').attr ('disabled', 1);
|
|
|
|
$('#module').empty ();
|
2009-05-28 16:06:32 +02:00
|
|
|
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
2009-03-09 21:47:42 +01:00
|
|
|
jQuery.post ('ajax.php',
|
2012-09-10 17:51:47 +02:00
|
|
|
{"page": "operation/agentes/ver_agente",
|
|
|
|
"get_agent_modules_json": 1,
|
|
|
|
"id_agent": id_agent
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
|
|
|
|
$('#module').empty ();
|
|
|
|
|
|
|
|
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (typeof(data['any_text']) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
|
|
|
|
|
|
|
if (anyText == null) {
|
|
|
|
anyText = 'Any';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
s = js_html_entity_decode (val['nombre']);
|
|
|
|
$('#module').append ($('<option></option>').html (s).attr ("value", val['id_agente_modulo']));
|
|
|
|
$('#module').fadeIn ('normal');
|
|
|
|
});
|
|
|
|
if (selected != undefined)
|
|
|
|
$('#module').attr ('value', selected);
|
|
|
|
$('#module').removeAttr('disabled');
|
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
2009-03-09 21:47:42 +01:00
|
|
|
}
|
2010-04-19 09:47:55 +02:00
|
|
|
|
2011-02-15 20:07:23 +01:00
|
|
|
/**
|
|
|
|
* Util for check is empty object
|
|
|
|
*
|
|
|
|
* @param obj the object to check
|
|
|
|
* @returns {Boolean} True it is empty
|
|
|
|
*/
|
|
|
|
function isEmptyObject(obj) {
|
|
|
|
for(var prop in obj) {
|
|
|
|
if(obj.hasOwnProperty(prop))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-22 20:50:00 +02:00
|
|
|
/**
|
|
|
|
* Fill up select box with id "module" with modules after agent has been selected, but this not empty the select box.s
|
|
|
|
*
|
|
|
|
* @param event that has been triggered
|
|
|
|
* @param id_agent Agent ID that has been selected
|
|
|
|
* @param selected Which module(s) have to be selected
|
|
|
|
*/
|
|
|
|
function agent_changed_by_multiple_agents (event, id_agent, selected) {
|
2011-07-15 14:45:23 +02:00
|
|
|
// Hack to add custom condition
|
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-11 16:01:45 +01:00
|
|
|
if ($("#hidden-custom_condition").val() != undefined) {
|
2011-07-15 14:45:23 +02:00
|
|
|
custom_condition = $("#hidden-custom_condition").val();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
custom_condition = '';
|
|
|
|
}
|
|
|
|
|
2010-04-22 20:50:00 +02:00
|
|
|
var idAgents = Array();
|
|
|
|
|
|
|
|
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
|
|
|
//val() because the var is same <option val="NNN"></option>
|
|
|
|
idAgents.push($(val).val());
|
|
|
|
});
|
|
|
|
|
2011-01-24 13:11:17 +01:00
|
|
|
//Hack to find only enabled modules
|
|
|
|
//Pass a flag as global var
|
|
|
|
find_modules = 'all';
|
|
|
|
if (typeof(show_only_enabled_modules) != "undefined") {
|
|
|
|
if (show_only_enabled_modules == true) {
|
|
|
|
find_modules = 'enabled';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-03 18:33:38 +02:00
|
|
|
var selection_mode = $('#modules_selection_mode').val();
|
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-11 16:01:45 +01:00
|
|
|
if (selection_mode == undefined) {
|
2012-04-03 18:33:38 +02:00
|
|
|
selection_mode = 'common';
|
|
|
|
}
|
|
|
|
|
2012-10-10 20:04:57 +02:00
|
|
|
var serialized = $('#hidden-serialized').val();
|
|
|
|
if (serialized == undefined) {
|
|
|
|
serialized = '';
|
|
|
|
}
|
|
|
|
|
2010-04-22 20:50:00 +02:00
|
|
|
$('#module').attr ('disabled', 1);
|
|
|
|
$('#module').empty ();
|
|
|
|
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
2012-09-07 14:01:23 +02:00
|
|
|
|
|
|
|
// Check if homedir was received like a JSON
|
|
|
|
homedir = '';
|
2012-12-13 19:40:30 +01:00
|
|
|
id_server = 0;
|
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-11 16:01:45 +01:00
|
|
|
if (typeof(event) == 'undefined') {
|
2012-09-07 14:01:23 +02:00
|
|
|
homedir += '.';
|
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-11 16:01:45 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (event.data == null)
|
|
|
|
homedir += '.';
|
2012-12-31 09:01:28 +01:00
|
|
|
else {
|
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-11 16:01:45 +01:00
|
|
|
homedir = event.data.homedir;
|
|
|
|
|
2012-12-31 09:01:28 +01:00
|
|
|
if (event.data.metaconsole != null) {
|
|
|
|
id_server = $("#" + event.data.id_server).val();
|
|
|
|
}
|
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-11 16:01:45 +01:00
|
|
|
}
|
|
|
|
}
|
2012-09-07 14:01:23 +02:00
|
|
|
|
|
|
|
jQuery.post (homedir + '/ajax.php',
|
2012-09-13 19:47:21 +02:00
|
|
|
{"page": "operation/agentes/ver_agente",
|
|
|
|
"get_agent_modules_json_for_multiple_agents": 1,
|
|
|
|
"id_agent[]": idAgents,
|
|
|
|
"all": find_modules,
|
|
|
|
"custom_condition": custom_condition,
|
2012-10-10 20:04:57 +02:00
|
|
|
"selection_mode": selection_mode,
|
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-11 16:01:45 +01:00
|
|
|
"serialized": serialized,
|
|
|
|
"id_server": id_server
|
2012-09-13 19:47:21 +02:00
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
$('#module').empty ();
|
|
|
|
|
|
|
|
if (isEmptyObject(data)) {
|
|
|
|
var noneText = $("#none_text").html(); //Trick for catch the translate text.
|
|
|
|
|
|
|
|
if (noneText == null) {
|
|
|
|
noneText = 'None';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#module').append ($('<option></option>').html (noneText).attr ("None", "").attr('selected', true));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (typeof(data['any_text']) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
|
|
|
|
|
|
|
if (anyText == null) {
|
|
|
|
anyText = 'Any';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
s = js_html_entity_decode(val);
|
|
|
|
$('#module').append ($('<option></option>').html (s).attr ("value", i));
|
|
|
|
$('#module').fadeIn ('normal');
|
|
|
|
});
|
2012-08-29 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
include/db/mysql.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/planned_downtime.list.php,
godmode/agentes/planned_downtime.editor.php, godmode/menu.php,
include/ajax/planned_downtime.ajax.php: refactoriced the code for
planned downtime, now this have new feature such as set a downtime
with a periodicity each week, each month and set the agents and
the modules with Quiet state instead the old form (but the old still
is). And the page is more easy and quickly to set or config a
planned downtime.
* godmode/alerts/configure_alert_template.php,
include/javascript/pandora.js: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6919 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-29 11:46:05 +02:00
|
|
|
if (selected != undefined)
|
|
|
|
$('#module').attr ('value', selected);
|
|
|
|
$('#module').css ("width", "auto");
|
|
|
|
$('#module').css ("max-width", "");
|
|
|
|
|
|
|
|
|
|
|
|
$('#module').removeAttr('disabled');
|
2012-09-10 17:51:47 +02:00
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
2010-10-08 13:16:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill up select box with id "module" with modules with alerts of one template
|
|
|
|
* after agent has been selected, but this not empty the select box.s
|
|
|
|
*
|
|
|
|
* @param event that has been triggered
|
|
|
|
* @param id_agent Agent ID that has been selected
|
|
|
|
* @param selected Which module(s) have to be selected
|
|
|
|
*/
|
|
|
|
function agent_changed_by_multiple_agents_with_alerts (event, id_agent, selected) {
|
|
|
|
var idAgents = Array();
|
|
|
|
|
|
|
|
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
|
|
|
//val() because the var is same <option val="NNN"></option>
|
|
|
|
idAgents.push($(val).val());
|
|
|
|
});
|
2012-04-10 13:28:36 +02:00
|
|
|
|
|
|
|
var selection_mode = $('#modules_selection_mode').val();
|
|
|
|
if(selection_mode == undefined) {
|
|
|
|
selection_mode = 'common';
|
|
|
|
}
|
|
|
|
|
2010-10-08 13:16:57 +02:00
|
|
|
template = $('#id_alert_template option:selected').attr("value");
|
|
|
|
$('#module').attr ('disabled', 1);
|
|
|
|
$('#module').empty ();
|
|
|
|
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
|
|
|
jQuery.post ('ajax.php',
|
2012-09-10 17:51:47 +02:00
|
|
|
{"page": "operation/agentes/ver_agente",
|
|
|
|
"get_agent_modules_alerts_json_for_multiple_agents": 1,
|
|
|
|
"template": template,
|
|
|
|
"id_agent[]": idAgents,
|
|
|
|
"selection_mode": selection_mode
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
$('#module').empty ();
|
|
|
|
|
|
|
|
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (typeof(data['any_text']) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
|
|
|
|
|
|
|
if (anyText == null) {
|
|
|
|
anyText = 'Any';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
s = js_html_entity_decode(val);
|
|
|
|
$('#module').append ($('<option></option>').html (s).attr ("value", val));
|
|
|
|
$('#module').fadeIn ('normal');
|
|
|
|
});
|
|
|
|
if (selected != undefined)
|
|
|
|
$('#module').attr ('value', selected);
|
|
|
|
$('#module').removeAttr('disabled');
|
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
2010-04-22 20:50:00 +02:00
|
|
|
}
|
|
|
|
|
2010-10-04 17:58:05 +02:00
|
|
|
/**
|
|
|
|
* Fill up select box with id "agent" with agents after module has been selected, but this not empty the select box.s
|
|
|
|
*
|
|
|
|
* @param event that has been triggered
|
|
|
|
* @param id_module Module ID that has been selected
|
|
|
|
* @param selected Which agent(s) have to be selected
|
|
|
|
*/
|
|
|
|
function module_changed_by_multiple_modules (event, id_module, selected) {
|
|
|
|
var idModules = Array();
|
|
|
|
|
|
|
|
jQuery.each ($("#module_name option:selected"), function (i, val) {
|
|
|
|
//val() because the var is same <option val="NNN"></option>
|
|
|
|
idModules.push($(val).val());
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#agents').attr ('disabled', 1);
|
|
|
|
$('#agents').empty ();
|
|
|
|
$('#agents').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
2012-04-03 18:33:38 +02:00
|
|
|
|
|
|
|
var selection_mode = $('#agents_selection_mode').val();
|
|
|
|
if(selection_mode == undefined) {
|
|
|
|
selection_mode = 'common';
|
|
|
|
}
|
|
|
|
|
2012-06-18 14:36:18 +02:00
|
|
|
jQuery.post('ajax.php',
|
|
|
|
{"page": "operation/agentes/ver_agente",
|
|
|
|
"get_agents_json_for_multiple_modules": 1,
|
|
|
|
"module_name[]": idModules,
|
|
|
|
"selection_mode": selection_mode
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
$('#agents').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
|
|
|
|
|
|
|
$('#agents').empty ();
|
|
|
|
|
|
|
|
if (isEmptyObject(data)) {
|
|
|
|
var noneText = $("#none_text").html(); //Trick for catch the translate text.
|
|
|
|
|
|
|
|
if (noneText == null) {
|
|
|
|
noneText = 'None';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#agents').append ($('<option></option>').html (noneText).attr ("None", "").attr('selected', true));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
|
|
|
$('#agents').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (typeof(data['any_text']) != 'undefined') {
|
|
|
|
$('#agents').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
|
2012-09-13 19:47:21 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
|
|
|
|
|
|
|
if (anyText == null) {
|
|
|
|
anyText = 'Any';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#agents').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
s = js_html_entity_decode(val);
|
|
|
|
$('#agents').append ($('<option></option>').html (s).attr ("value", val));
|
|
|
|
$('#agents').fadeIn ('normal');
|
|
|
|
});
|
|
|
|
if (selected != undefined)
|
|
|
|
$('#agents').attr ('value', selected);
|
|
|
|
$('#agents').removeAttr('disabled');
|
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
2010-10-04 17:58:05 +02:00
|
|
|
}
|
2010-04-19 09:47:55 +02:00
|
|
|
|
2010-05-18 12:03:06 +02:00
|
|
|
/**
|
|
|
|
* Fill up select box with id "module" with modules after agent has been selected, but this not empty the select box.s
|
|
|
|
*
|
|
|
|
* @param event that has been triggered
|
|
|
|
* @param id_agent Agent ID that has been selected
|
|
|
|
* @param selected Which module(s) have to be selected
|
|
|
|
*/
|
|
|
|
function agent_changed_by_multiple_agents_id (event, id_agent, selected) {
|
|
|
|
var idAgents = Array();
|
|
|
|
|
|
|
|
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
|
|
|
//val() because the var is same <option val="NNN"></option>
|
|
|
|
idAgents.push($(val).val());
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#module').attr ('disabled', 1);
|
|
|
|
$('#module').empty ();
|
|
|
|
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
|
|
|
jQuery.post ('ajax.php',
|
2012-07-18 11:34:10 +02:00
|
|
|
{"page": "operation/agentes/ver_agente",
|
|
|
|
"get_agent_modules_json_for_multiple_agents_id": 1,
|
|
|
|
"id_agent[]": idAgents
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
$('#module').empty ();
|
|
|
|
|
|
|
|
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (typeof(data['any_text']) != 'undefined') {
|
|
|
|
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
|
|
|
|
|
|
|
if (anyText == null) {
|
|
|
|
anyText = 'Any';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
|
|
|
|
}
|
|
|
|
}
|
2012-09-10 17:51:47 +02:00
|
|
|
|
2012-07-18 11:34:10 +02:00
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
s = js_html_entity_decode(val['nombre']);
|
|
|
|
//$('#module').append ($('<option></option>').html (s).attr ("value", val));
|
|
|
|
$('#module').append ($('<option></option>').html (s).attr ("value", val['id_agente_modulo']));
|
|
|
|
$('#module').fadeIn ('normal');
|
|
|
|
});
|
|
|
|
if (selected != undefined)
|
|
|
|
$('#module').attr ('value', selected);
|
|
|
|
$('#module').removeAttr('disabled');
|
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
2010-05-18 12:03:06 +02:00
|
|
|
}
|
|
|
|
|
2012-03-15 17:03:51 +01:00
|
|
|
/**
|
2012-03-22 12:22:07 +01:00
|
|
|
* Init values for html_extended_select_for_time
|
2012-03-15 17:03:51 +01:00
|
|
|
*
|
2012-03-22 12:22:07 +01:00
|
|
|
* This function initialize the values of the control
|
2012-03-15 17:03:51 +01:00
|
|
|
*
|
|
|
|
* @param name string with the name of the select for time
|
|
|
|
*/
|
2012-03-22 12:22:07 +01:00
|
|
|
function period_select_init(name) {
|
2012-03-16 10:23:09 +01:00
|
|
|
// Manual mode is hidden by default
|
|
|
|
$('#'+name+'_manual').hide();
|
2012-04-10 13:28:36 +02:00
|
|
|
$('#'+name+'_default').show();
|
2012-03-16 10:23:09 +01:00
|
|
|
|
2012-03-15 19:35:23 +01:00
|
|
|
// If the text input is empty, we put on it 5 minutes by default
|
2012-03-15 18:30:13 +01:00
|
|
|
if($('#text-'+name+'_text').val() == '') {
|
|
|
|
$('#text-'+name+'_text').val(300);
|
2012-08-09 13:45:33 +02:00
|
|
|
// Set the value in the hidden field too
|
|
|
|
$('.'+name).val(300);
|
2012-04-10 13:28:36 +02:00
|
|
|
if($('#'+name+'_select option:eq(0)').val() == 0) {
|
|
|
|
$('#'+name+'_select option:eq(2)').attr('selected', 'selected');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#'+name+'_select option:eq(1)').attr('selected', 'selected');
|
|
|
|
}
|
2012-03-15 18:30:13 +01:00
|
|
|
}
|
2012-03-21 11:58:52 +01:00
|
|
|
else if($('#text-'+name+'_text').val() == 0) {
|
|
|
|
$('#'+name+'_units option:last').removeAttr('selected');
|
2012-08-09 13:45:33 +02:00
|
|
|
$('#'+name+'_manual').show();
|
|
|
|
$('#'+name+'_default').hide();
|
2012-03-21 11:58:52 +01:00
|
|
|
}
|
2012-03-22 12:22:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Manage events into html_extended_select_for_time
|
|
|
|
*
|
|
|
|
* This function has all the events to manage the extended select
|
|
|
|
* for time
|
|
|
|
*
|
|
|
|
* @param name string with the name of the select for time
|
|
|
|
*/
|
|
|
|
function period_select_events(name) {
|
2012-03-16 10:23:09 +01:00
|
|
|
$('.'+name+'_toggler').click(function() {
|
2012-04-10 13:28:36 +02:00
|
|
|
toggleBoth(name);
|
2012-03-16 10:23:09 +01:00
|
|
|
$('#text-'+name+'_text').focus();
|
|
|
|
});
|
|
|
|
|
2012-03-20 11:03:22 +01:00
|
|
|
adjustTextUnits(name);
|
2012-03-15 17:03:51 +01:00
|
|
|
|
|
|
|
// When select a default period, is setted in seconds
|
|
|
|
$('#'+name+'_select').change(function() {
|
|
|
|
var value = $('#'+name+'_select').val();
|
|
|
|
|
2012-03-21 11:58:52 +01:00
|
|
|
if(value == -1) {
|
2012-03-15 17:03:51 +01:00
|
|
|
value = 300;
|
2012-04-10 13:28:36 +02:00
|
|
|
toggleBoth(name);
|
|
|
|
$('#text-'+name+'_text').focus();
|
2012-03-15 17:03:51 +01:00
|
|
|
}
|
|
|
|
|
2012-03-16 13:08:10 +01:00
|
|
|
$('.'+name).val(value);
|
2012-03-15 17:03:51 +01:00
|
|
|
$('#text-'+name+'_text').val(value);
|
2012-03-20 11:03:22 +01:00
|
|
|
adjustTextUnits(name);
|
2012-03-15 17:03:51 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
// When select a custom units, the default period changes to 'custom' and
|
|
|
|
// the time in seconds is calculated into hidden input
|
|
|
|
$('#'+name+'_units').change(function() {
|
2012-04-10 13:28:36 +02:00
|
|
|
selectFirst(name);
|
2012-03-22 12:22:07 +01:00
|
|
|
calculateSeconds(name);
|
2012-03-15 17:03:51 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
// When write any character into custom input, it check to convert it to
|
|
|
|
// integer and calculate in seconds into hidden input
|
|
|
|
$('#text-'+name+'_text').keyup (function () {
|
|
|
|
var cleanValue = parseInt($('#text-'+name+'_text').val());
|
|
|
|
if(isNaN(cleanValue)) {
|
|
|
|
cleanValue = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#text-'+name+'_text').val(cleanValue);
|
|
|
|
|
2012-04-10 13:28:36 +02:00
|
|
|
selectFirst(name+'_select');
|
2012-03-22 12:22:07 +01:00
|
|
|
calculateSeconds(name);
|
2012-03-15 17:03:51 +01:00
|
|
|
});
|
2012-03-22 12:22:07 +01:00
|
|
|
}
|
|
|
|
|
2012-04-10 13:28:36 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Select first option of a select if is not value=0
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
function selectFirst(name) {
|
|
|
|
if($('#'+name+' option:eq(0)').val() == 0) {
|
|
|
|
$('#'+name+' option:eq(1)').attr('selected', 'selected');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#'+name+' option:eq(0)').attr('selected', 'selected');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Toggle default and manual controls of period control
|
|
|
|
* It is done with css function because hide and show do not
|
|
|
|
* work properly when the divs are into a hiden div
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
function toggleBoth(name) {
|
|
|
|
if($('#'+name+'_default').css('display') == 'none') {
|
|
|
|
$('#'+name+'_default').css('display','inline');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#'+name+'_default').css('display','none');
|
|
|
|
}
|
|
|
|
|
|
|
|
if($('#'+name+'_manual').css('display') == 'none') {
|
|
|
|
$('#'+name+'_manual').css('display','inline');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#'+name+'_manual').css('display','none');
|
2012-09-10 17:51:47 +02:00
|
|
|
}
|
2012-04-10 13:28:36 +02:00
|
|
|
}
|
|
|
|
|
2012-03-22 12:22:07 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Calculate the custom time in seconds into hidden input
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function calculateSeconds(name) {
|
|
|
|
var calculated = $('#text-'+name+'_text').val()*$('#'+name+'_units').val();
|
2012-09-12 17:53:58 +02:00
|
|
|
|
2012-03-22 12:22:07 +01:00
|
|
|
$('.'+name).val(calculated);
|
2012-03-20 11:03:22 +01:00
|
|
|
}
|
|
|
|
|
2012-07-05 11:16:57 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Update via Javascript an advance selec for time
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function period_select_update(name, seconds) {
|
|
|
|
$('#text-'+name+'_text').val(seconds);
|
|
|
|
adjustTextUnits(name);
|
2012-09-10 17:51:47 +02:00
|
|
|
calculateSeconds(name);
|
|
|
|
$('#'+name+'_manual').show();
|
2012-07-05 11:16:57 +02:00
|
|
|
$('#'+name+'_default').hide();
|
|
|
|
}
|
|
|
|
|
2012-03-20 11:03:22 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Adjust units in the advanced select for time
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function adjustTextUnits(name) {
|
|
|
|
var restPrev;
|
|
|
|
var unitsSelected = false;
|
|
|
|
$('#'+name+'_units option').each(function() {
|
2012-04-10 13:28:36 +02:00
|
|
|
if($(this).val() < 0) {
|
|
|
|
return;
|
|
|
|
}
|
2012-03-20 11:03:22 +01:00
|
|
|
var rest = $('#text-'+name+'_text').val()/$(this).val();
|
|
|
|
var restInt = parseInt(rest).toString();
|
2012-04-10 13:28:36 +02:00
|
|
|
|
2012-03-20 11:03:22 +01:00
|
|
|
if(rest != restInt && unitsSelected == false) {
|
|
|
|
$('#'+name+'_units option:eq('+($(this).index()-1)+')').attr('selected', true);
|
|
|
|
$('#text-'+name+'_text').val(restPrev);
|
|
|
|
unitsSelected = true;
|
|
|
|
}
|
2012-09-10 17:51:47 +02:00
|
|
|
|
2012-03-20 11:03:22 +01:00
|
|
|
restPrev = rest;
|
|
|
|
});
|
2012-03-15 17:03:51 +01:00
|
|
|
|
2012-03-20 11:03:22 +01:00
|
|
|
if(unitsSelected == false) {
|
|
|
|
$('#'+name+'_units option:last').attr('selected', true);
|
|
|
|
$('#text-'+name+'_text').val(restPrev);
|
|
|
|
}
|
2012-03-21 11:58:52 +01:00
|
|
|
|
|
|
|
if($('#text-'+name+'_text').val() == 0) {
|
2012-04-10 13:28:36 +02:00
|
|
|
selectFirst(name+'_units');
|
2012-03-21 11:58:52 +01:00
|
|
|
}
|
2012-09-10 17:51:47 +02:00
|
|
|
}
|