2012-03-20 Sergio Martin <sergio.martin@artica.es>
* 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
This commit is contained in:
parent
5262c214fd
commit
ec8ea7dff9
|
@ -1,3 +1,10 @@
|
||||||
|
2012-03-20 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
|
* 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 <sergio.martin@artica.es>
|
2012-03-16 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* operation/reporting/graph_viewer.php: Added ACL control
|
* operation/reporting/graph_viewer.php: Added ACL control
|
||||||
|
|
|
@ -312,7 +312,7 @@ function readFields() {
|
||||||
values['module'] = $("select[name=module]").val();
|
values['module'] = $("select[name=module]").val();
|
||||||
values['process_simple_value'] = $("select[name=process_value]").val();
|
values['process_simple_value'] = $("select[name=process_value]").val();
|
||||||
values['background'] = $("#background_image").val();
|
values['background'] = $("#background_image").val();
|
||||||
values['period'] = $("select[name=period]").val();
|
values['period'] = $("#hidden-period").val();
|
||||||
values['width'] = $("input[name=width]").val();
|
values['width'] = $("input[name=width]").val();
|
||||||
values['height'] = $("input[name=height]").val();
|
values['height'] = $("input[name=height]").val();
|
||||||
values['parent'] = $("select[name=parent]").val();
|
values['parent'] = $("select[name=parent]").val();
|
||||||
|
@ -517,7 +517,26 @@ function loadFieldsFromDB(item) {
|
||||||
$("select[name=module]").val(val);
|
$("select[name=module]").val(val);
|
||||||
}
|
}
|
||||||
if (key == 'process_value') $("select[name=process_value]").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 == 'width') $("input[name=width]").val(val);
|
||||||
if (key == 'height') $("input[name=height]").val(val);
|
if (key == 'height') $("input[name=height]").val(val);
|
||||||
if (key == 'parent_item') $("select[name=parent]").val(val);
|
if (key == 'parent_item') $("select[name=parent]").val(val);
|
||||||
|
|
|
@ -73,20 +73,6 @@ $layoutDatas = db_get_all_rows_field_filter ('tlayout_data', 'id_layout', $idVis
|
||||||
if ($layoutDatas === false)
|
if ($layoutDatas === false)
|
||||||
$layoutDatas = array();
|
$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.
|
//Trick for it have a traduct text for javascript.
|
||||||
echo '<span id="any_text" style="display: none;">' . __('Any') . '</span>';
|
echo '<span id="any_text" style="display: none;">' . __('Any') . '</span>';
|
||||||
|
@ -199,7 +185,10 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="period_row" class="module_graph datos">
|
<tr id="period_row" class="module_graph datos">
|
||||||
<td><?php echo __('Period');?></td>
|
<td><?php echo __('Period');?></td>
|
||||||
<td><?php html_print_select ($intervals, 'period', '', '', '--', 0, false, false, false);?></td>
|
<td><?php
|
||||||
|
html_print_extended_select_for_time ('period', '', '', '', '')
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="module_graph_size_row" class="module_graph datos">
|
<tr id="module_graph_size_row" class="module_graph datos">
|
||||||
<td><?php echo __('Size');?></td>
|
<td><?php echo __('Size');?></td>
|
||||||
|
|
|
@ -625,28 +625,7 @@ function period_select_events(name) {
|
||||||
$('#text-'+name+'_text').focus();
|
$('#text-'+name+'_text').focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
function adjustTextUnits() {
|
adjustTextUnits(name);
|
||||||
var restPrev;
|
|
||||||
var unitsSelected = false;
|
|
||||||
$('#'+name+'_units option').each(function() {
|
|
||||||
var rest = $('#text-'+name+'_text').val()/$(this).val();
|
|
||||||
var restInt = parseInt(rest).toString();
|
|
||||||
if(rest != restInt && unitsSelected == false) {
|
|
||||||
$('#'+name+'_units option:eq('+($(this).index()-1)+')').attr('selected', true);
|
|
||||||
$('#text-'+name+'_text').val(restPrev);
|
|
||||||
unitsSelected = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
restPrev = rest;
|
|
||||||
});
|
|
||||||
|
|
||||||
if(unitsSelected == false) {
|
|
||||||
$('#'+name+'_units option:last').attr('selected', true);
|
|
||||||
$('#text-'+name+'_text').val(restPrev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
adjustTextUnits();
|
|
||||||
|
|
||||||
// When select a default period, is setted in seconds
|
// When select a default period, is setted in seconds
|
||||||
$('#'+name+'_select').change(function() {
|
$('#'+name+'_select').change(function() {
|
||||||
|
@ -658,7 +637,7 @@ function period_select_events(name) {
|
||||||
|
|
||||||
$('.'+name).val(value);
|
$('.'+name).val(value);
|
||||||
$('#text-'+name+'_text').val(value);
|
$('#text-'+name+'_text').val(value);
|
||||||
adjustTextUnits();
|
adjustTextUnits(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
// When select a custom units, the default period changes to 'custom' and
|
// When select a custom units, the default period changes to 'custom' and
|
||||||
|
@ -682,10 +661,35 @@ function period_select_events(name) {
|
||||||
calculateSeconds();
|
calculateSeconds();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Function to calculate the custom time in seconds into hidden input
|
// Calculate the custom time in seconds into hidden input
|
||||||
function calculateSeconds() {
|
function calculateSeconds() {
|
||||||
var calculated = $('#text-'+name+'_text').val()*$('#'+name+'_units').val();
|
var calculated = $('#text-'+name+'_text').val()*$('#'+name+'_units').val();
|
||||||
$('.'+name).val(calculated);
|
$('.'+name).val(calculated);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Adjust units in the advanced select for time
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function adjustTextUnits(name) {
|
||||||
|
var restPrev;
|
||||||
|
var unitsSelected = false;
|
||||||
|
$('#'+name+'_units option').each(function() {
|
||||||
|
var rest = $('#text-'+name+'_text').val()/$(this).val();
|
||||||
|
var restInt = parseInt(rest).toString();
|
||||||
|
if(rest != restInt && unitsSelected == false) {
|
||||||
|
$('#'+name+'_units option:eq('+($(this).index()-1)+')').attr('selected', true);
|
||||||
|
$('#text-'+name+'_text').val(restPrev);
|
||||||
|
unitsSelected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
restPrev = rest;
|
||||||
|
});
|
||||||
|
|
||||||
|
if(unitsSelected == false) {
|
||||||
|
$('#'+name+'_units option:last').attr('selected', true);
|
||||||
|
$('#text-'+name+'_text').val(restPrev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue