From ec8ea7dff96369fbb38c10d720e4bdaf8ef18850 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 20 Mar 2012 10:03:22 +0000 Subject: [PATCH] 2012-03-20 Sergio Martin * include/javascript/pandora.js godmode/reporting/visual_console_builder.editor.js godmode/reporting/visual_console_builder.editor.php: add new period control to the visual console graph item editor git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5790 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++ .../visual_console_builder.editor.js | 23 +++++++- .../visual_console_builder.editor.php | 19 ++----- pandora_console/include/javascript/pandora.js | 54 ++++++++++--------- 4 files changed, 61 insertions(+), 42 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ee896ae9f7..3ad21964b5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-03-20 Sergio Martin + + * include/javascript/pandora.js + godmode/reporting/visual_console_builder.editor.js + godmode/reporting/visual_console_builder.editor.php: add + new period control to the visual console graph item editor + 2012-03-16 Sergio Martin * operation/reporting/graph_viewer.php: Added ACL control diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index b2813f6b72..3af8396450 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -312,7 +312,7 @@ function readFields() { values['module'] = $("select[name=module]").val(); values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); - values['period'] = $("select[name=period]").val(); + values['period'] = $("#hidden-period").val(); values['width'] = $("input[name=width]").val(); values['height'] = $("input[name=height]").val(); values['parent'] = $("select[name=parent]").val(); @@ -517,7 +517,26 @@ function loadFieldsFromDB(item) { $("select[name=module]").val(val); } if (key == 'process_value') $("select[name=process_value]").val(val); - if (key == 'period') $("select[name=period]").val(val); + if (key == 'period') { + var anySelected = false; + var periodId = $('#hidden-period').attr('class'); + $('#'+periodId+'_select option').each(function() { + if($(this).val() == val) { + $(this).attr('selected',true); + $(this).trigger('change'); + anySelected = true; + } + }); + if(anySelected == false) { + $('#'+periodId+'_select option').eq(0).attr('selected',true); + $('#'+periodId+'_units option').eq(0).attr('selected',true); + $('#hidden-period').val(val); + $('#text-'+periodId+'_text').val(val); + adjustTextUnits(periodId); + $('#'+periodId+'_default').hide(); + $('#'+periodId+'_manual').show(); + } + } if (key == 'width') $("input[name=width]").val(val); if (key == 'height') $("input[name=height]").val(val); if (key == 'parent_item') $("select[name=parent]").val(val); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index c156b81bdf..5ae4a1e368 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -73,20 +73,6 @@ $layoutDatas = db_get_all_rows_field_filter ('tlayout_data', 'id_layout', $idVis if ($layoutDatas === false) $layoutDatas = array(); -/* Layout_data editor form */ -$intervals = array (); -$intervals[3600] = "1 ".__('hour'); -$intervals[7200] = "2 ".__('hours'); -$intervals[10800] = "3 ".__('hours'); -$intervals[21600] = "6 ".__('hours'); -$intervals[43200] = "12 ".__('hours'); -$intervals[86400] = __('Last day'); -$intervals[172800] = "2 ". __('days'); -$intervals[604800] = __('Last week'); -$intervals[1209600] = "14 ".__('days'); -$intervals[2592000] = __('Last month'); -$intervals[5184000] = "2 ".__('months'); -$intervals[15552000] = "6 ".__('months'); //Trick for it have a traduct text for javascript. echo ''; @@ -199,7 +185,10 @@ echo '