From a21eaafc613a914cf1455b4954b831a7cd20b880 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Mon, 23 Apr 2018 18:41:44 +0200 Subject: [PATCH 1/5] Added in progress button to events list --- .../operation/events/events.build_table.php | 23 +++++++++++-------- pandora_console/operation/events/events.php | 17 ++++++++++++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php index 8a506c979e..a7a7048679 100644 --- a/pandora_console/operation/events/events.build_table.php +++ b/pandora_console/operation/events/events.build_table.php @@ -666,8 +666,12 @@ else { if ($i != 0 && $allow_action) { //Actions - $data[$i] = ''; - + $data[$i] = ''; + $data[$i] .= html_print_input_hidden('event_title_'.$event["id_evento"], "#".$event["id_evento"]." - " . strip_tags(io_safe_output($event["evento"])), true); + $data[$i] .= html_print_image ("images/eye.png", true, + array ("title" => __('Show more'))); + $data[$i] .= ''; + if(!$readonly) { // Validate event if (($event["estado"] != 1) && (tags_checks_event_acl ($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'], $childrens_ids))) { @@ -676,6 +680,13 @@ else { $data[$i] .= html_print_image ("images/ok.png", true, array ("title" => __('Validate event'))); $data[$i] .= ''; + // Display the go to in progress status button + if ($event["estado"] != 2) { + $data[$i] .= ''; + $data[$i] .= html_print_image ("images/hourglass.png", true, + array ("title" => __('Change to in progress status'))); + $data[$i] .= ''; + } } // Delete event @@ -693,13 +704,7 @@ else { } } } - - $data[$i] .= ''; - $data[$i] .= html_print_input_hidden('event_title_'.$event["id_evento"], "#".$event["id_evento"]." - " . strip_tags(io_safe_output($event["evento"])), true); - $data[$i] .= html_print_image ("images/eye.png", true, - array ("title" => __('Show more'))); - $data[$i] .= ''; - + $table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;'; $i++; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 9564e87b5e..6532285ef9 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -966,6 +966,7 @@ function validate_event_advanced(id, new_status) { // Change state image $("#validate-"+id).css("display", "none"); + $("#in-progress-"+id).css("display", "none"); $("#status_img_"+id).attr ("src", "images/tick.png"); $("#status_img_"+id).attr ("title", ); $("#status_img_"+id).attr ("alt", ); @@ -986,9 +987,21 @@ function validate_event_advanced(id, new_status) { // Change state image $("#status_img_"+id).attr ("src", "images/hourglass.png"); - $("#status_img_"+id).attr ("title", ); + $("#status_img_"+id).attr ("data-title", ); $("#status_img_"+id).attr ("alt", ); - + $("#status_img_"+id).attr ("data-use_title_for_force_title", 1); + $("#status_img_"+id).attr ("class", "forced_title"); + + // Change the actions buttons + $("#delete-"+id).remove(); + $("#in-progress-"+id).remove(); + // Format the new disabled delete icon. + $("#validate-"+id).parent().append(""); + $("#delete-"+id).attr ("data-title", ); + $("#delete-"+id).attr ("alt", ); + $("#delete-"+id).attr ("data-use_title_for_force_title", 1); + $("#delete-"+id).attr ("class", "forced_title"); + // Remove row due to new state if (($("#status").val() == 0) || ($("#status").val() == 1)) { From e09e1c4cd4f569f751a0bc8283b2e9e902b69e3a Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 24 Apr 2018 11:54:45 +0200 Subject: [PATCH 2/5] Fixed in progress event button in metaconsole and other problems --- pandora_console/operation/events/events.php | 39 ++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 6532285ef9..cb9b4333a9 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -874,7 +874,7 @@ $(document).ready( function() { ); }); - $("a.delete_event").click (function () { + $("td").on('click', 'a.delete_event', function () { confirmation = confirm(""); if (!confirmation) { return; @@ -940,6 +940,11 @@ function validate_event_advanced(id, new_status) { $tr = $('#validate-'+id).parents ("tr"); var grouped = $('#group_rep').val(); + + // Get images url + var hourglass_image = ""; + var cross_disabled_image = ""; + var cross_image = ""; var similar_ids; similar_ids = $('#hidden-similar_ids_'+id).val(); @@ -964,29 +969,31 @@ function validate_event_advanced(id, new_status) { // Change status description $("#status_row_"+id).html(); - // Change state image + // Change delete icon + $("#delete-"+id).remove(); + $("#validate-"+id).parent().append(''); + $("#delete-"+id).append(""); + $("#delete-"+id + " img").attr ("id", "delete_cross_" + id); + $("#delete-"+id + " img").attr ("data-title", ); + $("#delete-"+id + " img").attr ("alt", ); + $("#delete-"+id + " img").attr ("data-use_title_for_force_title", 1); + $("#delete-"+id + " img").attr ("class", "forced_title"); + + // Change other buttons actions $("#validate-"+id).css("display", "none"); $("#in-progress-"+id).css("display", "none"); $("#status_img_"+id).attr ("src", "images/tick.png"); - $("#status_img_"+id).attr ("title", ); - $("#status_img_"+id).attr ("alt", ); + $("#status_img_"+id).attr ("data-title", ); + $("#status_img_"+id).attr ("alt", ); + $("#status_img_"+id).attr ("data-use_title_for_force_title", 1); + $("#status_img_"+id).attr ("class", "forced_title"); } // In process else if (new_status == 2) { // Change status description $("#status_row_"+id).html(); - // Remove delete link (if event is not grouped and there is more than one event) - if (grouped == 1) { - if (parseInt($("#count_event_group_"+id).text()) <= 1) { - $("#delete-"+id).replaceWith('' + <?php echo + '" title="' + + '" src="images/cross.disabled.png">'); - } - } - else { // Remove delete link (if event is not grouped) - $("#delete-"+id).replaceWith('' + <?php echo + '" title="' + + '" src="images/cross.disabled.png">'); - } - // Change state image - $("#status_img_"+id).attr ("src", "images/hourglass.png"); + $("#status_img_"+id).attr ("src", hourglass_image); $("#status_img_"+id).attr ("data-title", ); $("#status_img_"+id).attr ("alt", ); $("#status_img_"+id).attr ("data-use_title_for_force_title", 1); @@ -996,7 +1003,7 @@ function validate_event_advanced(id, new_status) { $("#delete-"+id).remove(); $("#in-progress-"+id).remove(); // Format the new disabled delete icon. - $("#validate-"+id).parent().append(""); + $("#validate-"+id).parent().append(""); $("#delete-"+id).attr ("data-title", ); $("#delete-"+id).attr ("alt", ); $("#delete-"+id).attr ("data-use_title_for_force_title", 1); From 112bbac52744e585284b49c5a61efffaa77405a1 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 24 Apr 2018 12:11:04 +0200 Subject: [PATCH 3/5] Added id to in progress status bin icon (disabled) --- .../operation/events/events.build_table.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php index a7a7048679..01373c8358 100644 --- a/pandora_console/operation/events/events.build_table.php +++ b/pandora_console/operation/events/events.build_table.php @@ -699,8 +699,15 @@ else { $data[$i] .= ''; } else { - $data[$i] .= html_print_image ("images/cross.disabled.png", true, - array ("title" => __('Is not allowed delete events in process'))).' '; + $data[$i] .= html_print_image ( + "images/cross.disabled.png", + true, + array ( + "title" => __('Is not allowed delete events in process'), + "id" => "delete-" . $event['id_evento'] + ) + ); + $data[$i] .= ' '; } } } From 675e8deb4707afbad69449086466478e0a0f6b9e Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 25 Apr 2018 12:32:58 +0200 Subject: [PATCH 4/5] Added function display_confirm_dialog with custom dialog --- pandora_console/include/javascript/pandora.js | 64 +++++++++++++++++++ pandora_console/include/styles/pandora.css | 16 +++++ 2 files changed, 80 insertions(+) diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 8a1965268f..6b0274229e 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1562,4 +1562,68 @@ function round_with_decimals (value, multiplier = 1) { return Math.round(value * multiplier) / multiplier; } return round_with_decimals (value, multiplier * 10); +} + +/* + + $("body").append('

' + '' + '

'); + $("#event_delete_confirm_dialog").dialog({ + resizable: false, + draggable: false, + modal: true, + height: 280, + width: 330, + overlay: { + opacity: 0.5, + background: "black" + }, + closeOnEscape: false, + open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); } + }); +*/ + +/** + * Display a confirm dialog box + * + * @param string Text to display + * @param string Ok button text + * @param string Cancel button text + * @param function Callback to action when ok button is pressed +*/ +function display_confirm_dialog ( + message = '', + ok_text = '', + cancel_text = '', + ok_function = function () {} +) { + // Clean function to close the dialog + var clean_function = function () { + $("#pandora_confirm_dialog_text").hide(); + $("#pandora_confirm_dialog_text").remove(); + } + + // Modify the ok function to close the dialog too + var ok_function_clean = function () { + ok_function(); + clean_function(); + } + + // Display the dialog + $("body").append('

' + message + '

'); + $("#pandora_confirm_dialog_text").dialog({ + resizable: false, + draggable: true, + modal: true, + dialogClass: "pandora_confirm_dialog", + overlay: { + opacity: 0.5, + background: "black" + }, + closeOnEscape: true, + modal: true, + buttons: { + Cancel: clean_function, + "Confirm": ok_function_clean + } + }); } \ No newline at end of file diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 9b39270e66..7badf707b7 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4633,3 +4633,19 @@ form ul.form_flex li ul li{ line-height: 1.05em!important; } +.pandora_confirm_dialog .ui-dialog-buttonset { + display: flex; + width: 100%; + margin-left: 10px; + float: none !important; +} + +.pandora_confirm_dialog .ui-dialog-buttonset button{ + flex: 50%; +} + +#pandora_confirm_dialog_text h3{ + margin-left: 20px; + margin-right: 20px; + text-align: center; +} \ No newline at end of file From 9c9f75152d82240e9ec552214b8a13ba8f0e1acd Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 25 Apr 2018 12:34:33 +0200 Subject: [PATCH 5/5] Added custom confirm dialog to events --- pandora_console/operation/events/events.php | 68 +++++++++++---------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index cb9b4333a9..03101d09b4 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -873,41 +873,45 @@ $(document).ready( function() { "html" ); }); - + $("td").on('click', 'a.delete_event', function () { - confirmation = confirm(""); - if (!confirmation) { - return; - } - meta = $('#hidden-meta').val(); - history_var = $('#hidden-history').val(); - - $tr = $(this).parents ("tr"); - id = this.id.split ("-").pop (); - - $("#delete_cross_"+id).attr ("src", "images/spinner.gif"); - - jQuery.post ("", - {"page" : "operation/events/events", - "delete_event" : 1, - "id" : id, - "similars" : , - "meta" : meta, - "history" : history_var - }, - function (data, status) { - if (data == "ok") { - $tr.remove (); - $('#show_message_error').html('

'); - } - else - $('#show_message_error').html('

'); - }, - "html" + var click_element = this; + display_confirm_dialog( + "", + "", + "", + function () { + meta = $('#hidden-meta').val(); + history_var = $('#hidden-history').val(); + + $tr = $(click_element).parents ("tr"); + id = click_element.id.split ("-").pop (); + + $("#delete_cross_"+id).attr ("src", "images/spinner.gif"); + + jQuery.post ("", + {"page" : "operation/events/events", + "delete_event" : 1, + "id" : id, + "similars" : , + "meta" : meta, + "history" : history_var + }, + function (data, status) { + if (data == "ok") { + $tr.remove (); + $('#show_message_error').html('

'); + } + else + $('#show_message_error').html('

'); + }, + "html" + ); + return false; + } ); - return false; }); - + function toggleDiv (divid) { if (document.getElementById(divid).style.display == 'none') { document.getElementById(divid).style.display = 'block';