Fixed validations and changed alert by dialog

Former-commit-id: 4c38c7f665cd328708bca48f997794b9a8586840
This commit is contained in:
manuel.montes 2018-12-18 12:52:01 +01:00
parent c9ac5d9313
commit e6049870f7
2 changed files with 469 additions and 124 deletions

View File

@ -213,6 +213,20 @@ function is_metaconsole() {
return false; return false;
} }
function dialog_message(message_id){
$(message_id).css('display', 'inline').dialog({
modal: true,
show: "blind",
hide: "blind",
buttons:{
"Close": function(){
$(this).dialog("close");
}
}
});
}
function update_button_palette_callback() { function update_button_palette_callback() {
var values = {}; var values = {};
@ -223,16 +237,11 @@ function update_button_palette_callback() {
switch (selectedItem) { switch (selectedItem) {
case 'background': case 'background':
if(values['width'] < 1024 || values['height'] < 768){ if(values['width'] < 1024 || values['height'] < 768){
alert('Min allowed size is 1024x768'); dialog_message("#message_min_allowed_size");
return false; return false;
} }
$("#hidden-background_width").val(values['width']);
if(values['width'] == 0 && values['height'] == 0) { $("#hidden-background_height").val(values['height']);
values['width'] =
$("#hidden-background_original_width").val();
values['height'] =
$("#hidden-background_original_height").val();
}
$("#background").css('width', values['width']); $("#background").css('width', values['width']);
$("#background").css('height', values['height']); $("#background").css('height', values['height']);
@ -244,11 +253,19 @@ function update_button_palette_callback() {
break; break;
case 'box_item': case 'box_item':
if($('input[name=width_box]').val() == ''){ if($('input[name=width_box]').val() == ''){
alert('Undefined width'); dialog_message("#message_alert_no_width");
return false;
}
if (parseInt($("input[name='width_box']").val()) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false; return false;
} }
if($('input[name=height_box]').val() == ''){ if($('input[name=height_box]').val() == ''){
alert('Undefined height'); dialog_message("#message_alert_no_height");
return false;
}
if (parseInt($("input[name='height_box']").val()) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_height");
return false; return false;
} }
@ -267,7 +284,7 @@ function update_button_palette_callback() {
break; break;
case 'group_item': case 'group_item':
if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){ if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){
alert('Undefined image'); dialog_message("#message_alert_no_image");
return false; return false;
} }
@ -385,15 +402,31 @@ function update_button_palette_callback() {
break; break;
case 'static_graph': case 'static_graph':
if($('input[name=width]').val() == ''){ if($('input[name=width]').val() == ''){
alert('Undefined width'); dialog_message("#message_alert_no_width");
return false;
}
if (parseInt($("input[name='width']").val()) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false; return false;
} }
if($('input[name=height]').val() == ''){ if($('input[name=height]').val() == ''){
alert('Undefined height'); dialog_message("#message_alert_no_height");
return false;
}
if (parseInt($("input[name='height']").val()) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_height");
return false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
return false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
return false; return false;
} }
if(((values['image'] == '' || values['image'] == 'none') && (values['label'] == ''))){ if(((values['image'] == '' || values['image'] == 'none') && (values['label'] == ''))){
alert('Undefined image'); dialog_message("#message_alert_no_image");
return false; return false;
} }
@ -485,13 +518,24 @@ function update_button_palette_callback() {
break; break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
if($('input[name=width_percentile]').val() == ''){ if($('input[name=height_percentile]').val() == ''){
alert('Undefined width'); dialog_message("#message_alert_no_height");
return false; return false;
} }
if($('input[name=width_percentile]').val() == ''){
if($('input[name=height_percentile]').val() == ''){ dialog_message("#message_alert_no_width");
alert('Undefined height'); return false;
}
if($('input[name=width_percentile]').val() > parseInt($("#hidden-background_width").val())){
dialog_message("#message_alert_max_width");
return false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
return false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
return false; return false;
} }
@ -516,31 +560,42 @@ function update_button_palette_callback() {
if($('#dir_items').html() == 'horizontal'){ if($('#dir_items').html() == 'horizontal'){
if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width')) if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))
|| parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){ || parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){
alert($('#count_items').html()+' joined graph items are wider than background'); alert($('#count_items').html()+' joined graph items are wider than background');
return false; return false;
} }
} }
if($('#dir_items').html() == 'vertical'){ if($('#dir_items').html() == 'vertical'){
if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){ if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){
alert($('#count_items').html()+' joined graph items are higher than background'); alert($('#count_items').html()+' joined graph items are higher than background');
return false; return false;
} }
} }
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
return false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
return false;
}
if($('input[name=width_module_graph]').val() == ''){ if($('input[name=width_module_graph]').val() == ''){
alert('Undefined width'); dialog_message("#message_alert_no_width");
return false; return false;
} }
if($('input[name=height_module_graph]').val() == ''){ if($('input[name=height_module_graph]').val() == ''){
alert('Undefined height'); dialog_message("#message_alert_no_height");
return false;
}
if (parseInt(values['width_module_graph']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false;
}
if (parseInt($('input[name=height_module_graph]').val()) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
return false; return false;
} }
if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){ if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){
alert('Undefined graph'); dialog_message("#message_alert_no_custom_graph");
return false; return false;
} }
@ -550,12 +605,19 @@ function update_button_palette_callback() {
break; break;
case 'bars_graph': case 'bars_graph':
if($('input[name=width_percentile]').val() == ''){ if($('input[name=width_percentile]').val() == ''){
alert('Undefined width'); dialog_message("#message_alert_no_width");
return false; return false;
} }
if($('input[name=bars_graph_height]').val() == ''){ if($('input[name=bars_graph_height]').val() == ''){
alert('Undefined height'); dialog_message("#message_alert_no_height");
return false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
return false;
}
if ((values['agent_string'] == '')) {
dialog_message("#message_alert_no_agent");
return false; return false;
} }
@ -566,6 +628,10 @@ function update_button_palette_callback() {
break; break;
case 'clock': case 'clock':
if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false;
}
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif"); $("#image_" + idItem).attr("src", "images/spinner.gif");
@ -573,12 +639,28 @@ function update_button_palette_callback() {
break; break;
case 'auto_sla_graph': case 'auto_sla_graph':
if($('input[name=width]').val() == ''){ if (values['height'] == '') {
alert('Undefined width'); dialog_message("#message_alert_no_height");
return false; return false;
} }
if($('input[name=height]').val() == ''){ if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) {
alert('Undefined height'); dialog_message("#message_alert_max_height");
return false;
}
if (values['width'] == '') {
dialog_message("#message_alert_no_width");
return false;
}
if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
return false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
return false; return false;
} }
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
@ -587,8 +669,19 @@ function update_button_palette_callback() {
setEventsBar(idItem, values); setEventsBar(idItem, values);
break; break;
case 'donut_graph': case 'donut_graph':
if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module_string_type");
return false;
}
if ((values['agent_string'] == '')) {
dialog_message("#message_alert_no_agent");
return false;
}
$("#image_" + idItem).attr("src", "images/spinner.gif"); $("#image_" + idItem).attr("src", "images/spinner.gif");
setDonutsGraph(idItem, values); setDonutsGraph(idItem, values);
break; break;
case 'simple_value': case 'simple_value':
@ -606,21 +699,41 @@ function update_button_palette_callback() {
'<table><tbody><tr><td></td></tr><tr><td><span style="width:'+values['width_data_image']+'px;" id="text_' + idItem + '" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>' '<table><tbody><tr><td></td></tr><tr><td><span style="width:'+values['width_data_image']+'px;" id="text_' + idItem + '" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>'
) )
} }
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
return false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
return false;
}
break; break;
case 'label': case 'label':
if ((values['label'] == '')) {
dialog_message("#message_alert_no_label");
return false;
}
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
break; break;
case 'icon': case 'icon':
if($('input[name=width]').val() == ''){ if($('input[name=width]').val() == ''){
alert('Undefined width'); dialog_message("#message_alert_no_width");
return false; return false;
} }
if (parseInt($('input[name=width]').val()) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false;
}
if($('input[name=height]').val() == ''){ if($('input[name=height]').val() == ''){
alert('Undefined height'); dialog_message("#message_alert_no_height");
return false; return false;
} }
if (parseInt($('input[name=height]').val()) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
return false;
}
if(values['image'] == '' || values['image'] == 'none'){ if(values['image'] == '' || values['image'] == 'none'){
alert('Undefined image'); dialog_message("#message_alert_no_image");
return false; return false;
} }
$("#image_" + idItem).attr('src', "images/spinner.gif"); $("#image_" + idItem).attr('src', "images/spinner.gif");
@ -653,14 +766,56 @@ function update_button_palette_callback() {
var image = values['image'] + ".png"; var image = values['image'] + ".png";
set_image("image", idItem, image); set_image("image", idItem, image);
break; break;
case 'line_item':
if (parseInt(values['line_width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false;
}
break;
case 'color_cloud':
if (parseInt(values['diameter']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
return false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
return false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
return false;
}
break;
case 'service':
if (values['height'] == '' || values['height_module_graph'] == 0) {
dialog_message("#message_alert_no_height");
return false;
}
if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
return false;
}
if (values['width'] == '' || values['width_module_graph'] == 0) {
dialog_message("#message_alert_no_width");
return false;
}
if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
return false;
}
if($("select[name=service]").val() == '' || $("select[name=service]").val() == 'none'){
dialog_message("#message_alert_no_service");
return false;
}
break;
default: default:
if($('input[name=width]').val() == ''){ if($('input[name=width]').val() == ''){
alert('Undefined width'); dialog_message("#message_alert_no_width");
return false; return false;
} }
if($('input[name=height]').val() == ''){ if($('input[name=height]').val() == ''){
alert('Undefined height'); dialog_message("#message_alert_no_height");
return false; return false;
} }
//Maybe save in any Enterprise item. //Maybe save in any Enterprise item.
if (typeof(enterprise_update_button_palette_callback) == 'function') { if (typeof(enterprise_update_button_palette_callback) == 'function') {
@ -860,144 +1015,288 @@ function create_button_palette_callback() {
var validate = true; var validate = true;
switch (creationItem) { switch (creationItem) {
case 'box_item': case 'box_item':
if (($("input[name='width_box']").val() == '')) { if ($("input[name='width_box']").val() == '') {
alert('Undefined width'); dialog_message("#message_alert_no_width");
validate = false; validate = false;
} }
if (($("input[name='height_box']").val() == '')) { if (parseInt($("input[name='width_box']").val()) > parseInt($("#hidden-background_width").val())) {
alert('Undefined height'); dialog_message("#message_alert_max_width");
validate = false;
}
if ($("input[name='height_box']").val() == '') {
dialog_message("#message_alert_no_height");
validate = false;
}
if(parseInt($("input[name='height_box']").val()) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
validate = false; validate = false;
} }
break; break;
case 'group_item': case 'group_item':
if (values['height'] == '') {
dialog_message("#message_alert_no_height");
validate = false;
}
if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
validate = false;
}
if (values['width'] == '') {
dialog_message("#message_alert_no_width");
validate = false;
}
if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){ if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){
alert('Undefined images'); dialog_message("#message_alert_no_image");
validate = false; validate = false;
} }
break; break;
case 'static_graph': case 'static_graph':
if ((values['width'] == '')) {
alert('Undefined width'); if (values['height'] == '') {
dialog_message("#message_alert_no_height");
validate = false; validate = false;
} }
if ((values['height'] == '')) { if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) {
alert('Undefined height'); dialog_message("#message_alert_max_height");
validate = false;
}
if (values['width'] == '') {
dialog_message("#message_alert_no_width");
validate = false;
}
if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
validate = false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
validate = false; validate = false;
} }
if((values['image'] == '' || values['image'] == 'none') && (values['label']) == false){ if((values['image'] == '' || values['image'] == 'none') && (values['label']) == false){
alert('Undefined image'); dialog_message("#message_alert_no_image");
validate = false; validate = false;
} }
break; break;
case 'auto_sla_graph': case 'auto_sla_graph':
if (values['height'] == '') {
dialog_message("#message_alert_no_height");
validate = false;
}
if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
validate = false;
}
if (values['width'] == '') {
dialog_message("#message_alert_no_width");
validate = false;
}
if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
validate = false;
}
if ((values['agent'] == '')) { if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html()); dialog_message("#message_alert_no_agent");
validate = false; validate = false;
} }
break; break;
case 'donut_graph': case 'donut_graph':
if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module_string_type");
validate = false;
}
if ((values['agent_string'] == '')) { if ((values['agent_string'] == '')) {
alert($("#message_alert_no_agent").html()); dialog_message("#message_alert_no_agent");
validate = false; validate = false;
} }
break; break;
case 'label': case 'label':
if ((values['label'] == '')) { if ((values['label'] == '')) {
alert($("#message_alert_no_label").html()); dialog_message("#message_alert_no_label");
validate = false; validate = false;
} }
break; break;
case 'icon': case 'icon':
if ((values['width'] == '')) { if ((values['width'] == '')) {
alert('Undefined width'); dialog_message("#message_alert_no_width");
validate = false;
}
if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false; validate = false;
} }
if ((values['height'] == '')) { if ((values['height'] == '')) {
alert('Undefined height'); dialog_message("#message_alert_no_height");
validate = false;
}
if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
validate = false; validate = false;
} }
if ((values['image'] == '' || values['image'] == 'none')) { if ((values['image'] == '' || values['image'] == 'none')) {
alert($("#message_alert_no_image").html()); dialog_message("#message_alert_no_image");
validate = false; validate = false;
} }
break; break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
if ((values['width'] == '')) { if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) {
alert('Undefined width'); dialog_message("#message_alert_max_width");
validate = false;
}
if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false;
}
if ((values['module'] == 0)) {
alert($("#message_alert_no_module").html());
validate = false;
}
if ((values['max_percentile'] == '')) {
alert($("#message_alert_no_max_percentile").html());
validate = false; validate = false;
} }
if ((values['width_percentile'] == '')) { if ((values['width_percentile'] == '')) {
alert($("#message_alert_no_width_percentile").html()); dialog_message("#message_alert_no_width");
validate = false; validate = false;
} }
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
validate = false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
validate = false;
}
if ((values['max_percentile'] == '')) {
dialog_message("#message_alert_no_max_percentile");
validate = false;
}
break; break;
case 'module_graph': case 'module_graph':
if (values['width_module_graph'] == '') { if ((values['module'] == 0)) {
alert('Undefined width'); dialog_message("#message_alert_no_module");
validate = false;
}
if (values['height_module_graph'] == '') {
alert('Undefined height');
validate = false; validate = false;
} }
if (values['id_custom_graph'] == 0) { if (values['id_custom_graph'] == 0) {
if ((values['agent'] == '')) { if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html()); dialog_message("#message_alert_no_agent");
validate = false;
}
if ((values['module'] == 0)) {
alert($("#message_alert_no_module").html());
validate = false; validate = false;
} }
if ((values['period'] == 0)) { if ((values['period'] == 0)) {
alert($("#message_alert_no_period").html()); dialog_message("#message_alert_no_period");
validate = false; validate = false;
} }
} }
break; if (values['height_module_graph'] == '' || values['height_module_graph'] == 0) {
case 'bars_graph': dialog_message("#message_alert_no_height");
if ((values['agent_string'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false; validate = false;
} }
if ((values['module'] == 0)) { if (parseInt(values['height_module_graph']) > parseInt($("#hidden-background_height").val())) {
alert($("#message_alert_no_module").html()); dialog_message("#message_alert_max_height");
validate = false;
}
if (values['width_module_graph'] == '' || values['width_module_graph'] == 0) {
dialog_message("#message_alert_no_width");
validate = false;
}
if (parseInt(values['width_module_graph']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
break;
case 'bars_graph':
if ((values['bars_graph_height'] == '')) {
dialog_message("#message_alert_no_height");
validate = false;
}
if (parseInt(values['bars_graph_height']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
validate = false; validate = false;
} }
if ((values['width_percentile'] == '')) { if ((values['width_percentile'] == '')) {
alert($("#message_alert_no_width_percentile").html()); dialog_message("#message_alert_no_width");
validate = false; validate = false;
} }
if ((values['bars_graph_height'] == '')) { if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) {
alert($("#message_alert_no_bars_graph_height").html()); dialog_message("#message_alert_max_width");
validate = false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
validate = false;
}
if ((values['agent_string'] == '')) {
dialog_message("#message_alert_no_agent");
validate = false; validate = false;
} }
break; break;
case 'simple_value': case 'simple_value':
if ((values['agent'] == '')) { if ((values['module'] == 0)) {
alert($("#message_alert_no_agent").html()); dialog_message("#message_alert_no_module");
validate = false; validate = false;
} }
if ((values['module'] == 0)) { if ((values['agent'] == '')) {
alert($("#message_alert_no_module").html()); dialog_message("#message_alert_no_agent");
validate = false; validate = false;
} }
break; break;
case 'clock':
if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
break;
case 'line_item':
if (parseInt(values['line_width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
break;
case 'color_cloud':
if (parseInt(values['diameter']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
validate = false;
}
if ((values['module'] == 0)) {
dialog_message("#message_alert_no_module");
validate = false;
}
if ((values['agent'] == '')) {
dialog_message("#message_alert_no_agent");
validate = false;
}
break;
case 'service':
if (values['height'] == '' || values['height_module_graph'] == 0) {
dialog_message("#message_alert_no_height");
validate = false;
}
if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) {
dialog_message("#message_alert_max_height");
validate = false;
}
if (values['width'] == '' || values['width_module_graph'] == 0) {
dialog_message("#message_alert_no_width");
validate = false;
}
if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) {
dialog_message("#message_alert_max_width");
validate = false;
}
if($("select[name=service]").val() == '' || $("select[name=service]").val() == 'none'){
dialog_message("#message_alert_no_service");
validate = false;
}
break;
default: default:
//Maybe save in any Enterprise item. //Maybe save in any Enterprise item.
if (typeof(enterprise_create_button_palette_callback) == 'function') { if (typeof(enterprise_create_button_palette_callback) == 'function') {
@ -3603,7 +3902,6 @@ function createItem(type, values, id_data) {
case 'clock': case 'clock':
sizeStyle = ''; sizeStyle = '';
imageSize = ''; imageSize = '';
if(values['label_position'] == 'up'){ if(values['label_position'] == 'up'){
item = $('<div id="' + id_data + '" class="item clock" style="text-align: left; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' + item = $('<div id="' + id_data + '" class="item clock" style="text-align: left; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' + '<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +

View File

@ -1136,31 +1136,78 @@ function visual_map_editor_print_hack_translate_strings() {
echo '<span id="ip_text" style="display: none;">' . __('IP') . '</span>'; echo '<span id="ip_text" style="display: none;">' . __('IP') . '</span>';
//Hack to translate messages in javascript //Hack to translate messages in javascript
echo '<span style="display: none" id="message_alert_no_label_no_image">' . echo"<div id='message_min_allowed_size' title='".__('Visual Console Builder Information')."' style='display:none;'>";
__('No image or name defined.') .'</span>'; echo"<p style='text-align: center;font-weight: bold;'>" . __('Min allowed size is 1024x768.') . "</p>";
echo '<span style="display: none" id="message_alert_no_label">' . echo"</div>";
__('No label defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_image">' . echo"<div id='message_alert_no_custom_graph' title='".__('Visual Console Builder Information')."' style='display:none;'>";
__('No image defined.') .'</span>'; echo"<p style='text-align: center;font-weight: bold;'>" . __('No custom graph defined.') . "</p>";
echo '<span style="display: none" id="message_alert_no_process">' . echo"</div>";
__('No process defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_max_percentile">' . echo"<div id='message_alert_no_label_no_image' title='".__('Visual Console Builder Information')."' style='display:none;'>";
__('No Max value defined.') .'</span>'; echo"<p style='text-align: center;font-weight: bold;'>" . __('No image or name defined.') . "</p>";
echo '<span style="display: none" id="message_alert_no_width_percentile">' . echo"</div>";
__('No width defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_bars_graph_height">' . echo"<div id='message_alert_no_label' title='".__('Visual Console Builder Information')."' style='display:none;'>";
__('No height defined.') .'</span>'; echo"<p style='text-align: center;font-weight: bold;'>" . __('No label defined.') . "</p>";
echo '<span style="display: none" id="message_alert_no_period">' . echo"</div>";
__('No period defined.') .'</span>';
echo '<span style="display: none" id="message_alert_no_agent">' . echo"<div id='message_alert_no_service' title='".__('Visual Console Builder Information')."' style='display:none;'>";
__('No agent defined.') .'</span>'; echo"<p style='text-align: center;font-weight: bold;'>" . __('No service defined.') . "</p>";
echo '<span style="display: none" id="message_alert_no_module">' . echo"</div>";
__('No module defined.') .'</span>';
echo"<div id='message_alert_no_image' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No image defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_process' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No process defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_max_percentile' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No Max value defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_width' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No width defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_height' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No height defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_max_width' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('The width must not exceed the size of the visual console container.') . "</p>";
echo"</div>";
echo"<div id='message_alert_max_height' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('The height must not exceed the size of the visual console container.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_period' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No period defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_agent' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No agent defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_module' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No module defined.') . "</p>";
echo"</div>";
echo"<div id='message_alert_no_module_string_type' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('No module defined. This module must be string type.') . "</p>";
echo"</div>";
echo"<div id='hack_translation_correct_save' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('Successfully save the changes.') . "</p>";
echo"</div>";
echo"<div id='hack_translation_incorrect_save' title='".__('Visual Console Builder Information')."' style='display:none;'>";
echo"<p style='text-align: center;font-weight: bold;'>" . __('Could not be save.') . "</p>";
echo"</div>";
echo '<span style="display: none" id="hack_translation_correct_save">' .
__('Successfully save the changes.') .'</span>';
echo '<span style="display: none" id="hack_translation_incorrect_save">' .
__('Could not be save') .'</span>';
} }
?> ?>