From c889776f449a32364c04be62cd8944095cbe96f1 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Thu, 8 Feb 2018 16:51:58 +0100 Subject: [PATCH] Add visual animation to popup modal windows - #1781 --- pandora_console/include/ajax/config.ajax.php | 10 + .../include/javascript/jquery.pandora.js | 190 +++++++++++++++--- pandora_console/include/styles/pandora.css | 1 - 3 files changed, 170 insertions(+), 31 deletions(-) create mode 100644 pandora_console/include/ajax/config.ajax.php diff --git a/pandora_console/include/ajax/config.ajax.php b/pandora_console/include/ajax/config.ajax.php new file mode 100644 index 0000000000..7640d6ca38 --- /dev/null +++ b/pandora_console/include/ajax/config.ajax.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index fd0972e750..f1109b9723 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -59,46 +59,152 @@ $(document).ready (function () { }); $("a.show_systemalert_dialog").click (function () { - $('body').append( "
" ); jQuery.post ("ajax.php", - {"page": "operation/system_alert"}, - function (data, status) { - $("#alert_messages").hide () - .empty () - .append (data) - .show (); - }, - "html" - ); - return false; + {"page": "include/ajax/config.ajax", + "token_name": 'visual_animation' + }, + function (data, status) { + if(data){ + $('body').append( "
" ); + jQuery.post ("ajax.php", + {"page": "operation/system_alert"}, + function (data, status) { + + $("#alert_messages").css('width','auto'); + $("#alert_messages").css('height','auto'); + + $("#alert_messages").css('visibility','hidden'); + $("#alert_messages").empty ().append (data); + $("#alert_messages").css('display','block'); + + setTimeout( function() { + animation_modal('alert_messages'); + }, 50); + }, + "html" + ); + return false; + } + else{ + $('body').append( "
" ); + jQuery.post ("ajax.php", + {"page": "operation/system_alert"}, + function (data, status) { + $("#alert_messages").hide () + .empty () + .append (data) + .show (); + }, + "html" + ); + return false; + } + }, + "html" + ); }); $("a.modalpopup").click (function () { - $('body').append( "
" ); - jQuery.post ("ajax.php", - { - "page": "general/alert_enterprise", - "message": $(this).attr("id") - }, - function (data, status) { - $("#alert_messages").hide () - .empty () - .append (data) - .show (); - }, - "html" - ); - return false; - }); + var elem = $(this).attr("id"); + + jQuery.post ("ajax.php", + {"page": "include/ajax/config.ajax", + "token_name": 'visual_animation' + }, + function (data, status) { + if(data){ + $('body').append( "
" ); + jQuery.post ("ajax.php", + { + "page": "general/alert_enterprise", + "message": elem + }, + function (data, status) { + + $("#alert_messages").css('width','auto'); + $("#alert_messages").css('height','auto'); + + $("#alert_messages").css('visibility','hidden'); + $("#alert_messages").empty ().append (data); + $("#alert_messages").css('display','block'); + + setTimeout( function() { + animation_modal('alert_messages'); + }, 50); + }, + "html" + ); + return false; + } + else{ + $('body').append( "
" ); + jQuery.post ("ajax.php", + { + "page": "general/alert_enterprise", + "message": elem + }, + function (data, status) { + $("#alert_messages").hide () + .empty () + .append (data) + .show (); + }, + "html" + ); + return false; + } + }, + "html" + ); +}); // Creacion de ventana modal y botones $(".publienterprise").click (function () { + + var elem = $(this).attr("id"); + + jQuery.post ("ajax.php", + {"page": "include/ajax/config.ajax", + "token_name": 'visual_animation' + }, + function (data, status) { + + if(data){ + + $('body').append( "
" ); + jQuery.post ("ajax.php", + { + "page": "general/alert_enterprise", + "message": elem + }, + function (data, status) { + + $("#alert_messages").css('width','auto'); + $("#alert_messages").css('height','auto'); + + $("#alert_messages").css('visibility','hidden'); + $("#alert_messages").empty ().append (data); + $("#alert_messages").css('display','block'); + + setTimeout( function() { + animation_modal('alert_messages'); + }, 50); + }, + "html" + ); + + return false; + + } + else{ + $('body').append( "
" ); + jQuery.post ("ajax.php", { "page": "general/alert_enterprise", - "message": $(this).attr("id") + "message": elem }, function (data, status) { $("#alert_messages").hide () @@ -109,9 +215,13 @@ $(document).ready (function () { "html" ); - return false; - }); + } + }, + "html" + ); +}); + $(".publienterprisehide").click (function () { $('body').append( "
" ); @@ -319,3 +429,23 @@ function forced_title_callback() { $('#forced_title_layer').hide().empty(); }); } + +function animation_modal(id){ + + var animation_width = $("#"+id).css('width'); + var animation_height = $("#"+id).css('height'); + var posanimation_left = parseInt($('#'+id).css('left')); + var preanimation_left = parseInt($('#'+id).css('left'))+parseInt($('#'+id).css('left'))/2; + $('#'+id).css({'width':'100px','height':'60px'}); + $("#alert_messages").css('visibility','visible'); + $('#'+id).css('left',+preanimation_left+'px'); + $('#'+id).css('opacity',0); + + $('#opacidad').animate({'opacity':0.8},2000); + + $("#"+id) + .animate({'width': animation_width,'left':posanimation_left+'px','opacity':1},1000) + .animate({'height': animation_height},1000); + +} + diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 40f86f5e1a..5740aaef52 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -3593,7 +3593,6 @@ div.simple_value > a > span.text p position:fixed; width:750px; max-width:750px; - min-width:750px; top: 20%; background:white; }