From 32b28bea0c7c708ed60c2d6bf9034ccb1a0a0173 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 22 Jan 2020 11:10:02 +0100 Subject: [PATCH] Added warning in update manager offline --- .../update_manager/update_manager.offline.php | 11 +++- .../include/javascript/update_manager.js | 50 +++++++++++++++++-- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/update_manager/update_manager.offline.php b/pandora_console/godmode/update_manager/update_manager.offline.php index 8eff08d996..8fb4447772 100644 --- a/pandora_console/godmode/update_manager/update_manager.offline.php +++ b/pandora_console/godmode/update_manager/update_manager.offline.php @@ -46,6 +46,13 @@ if (! check_acl($config['id_user'], 0, 'PM') $baseurl = ui_get_full_url(false, false, false, false); +$current_package = db_get_value( + 'value', + 'tconfig', + 'token', + 'current_package_enterprise' +); + ?> var text1_package_file = "\n"; var text2_package_file = "\n"; + var text1_warning = "\n"; + var text2_warning = "\n"; var applying_mr = "\n"; var cancel_button = "\n"; var ok_button = "\n"; @@ -109,5 +118,5 @@ is not working on the metaconsole and there is no time to fix it --> diff --git a/pandora_console/include/javascript/update_manager.js b/pandora_console/include/javascript/update_manager.js index 0cc385fb95..6f0aeda5c6 100644 --- a/pandora_console/include/javascript/update_manager.js +++ b/pandora_console/include/javascript/update_manager.js @@ -4,7 +4,7 @@ var correct_install_progress = true; -function form_upload(homeurl) { +function form_upload(homeurl, current_package) { var home_url = typeof homeurl !== "undefined" ? homeurl + "/" : ""; //Thanks to: http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/ @@ -164,7 +164,7 @@ function form_upload(homeurl) { .change(); // Begin the installation - install_package(res.package, homeurl); + install_package(res.package, homeurl, current_package); }); } else { // Something has gone wrong! @@ -214,7 +214,7 @@ function formatFileSize(bytes) { return (bytes / 1000).toFixed(2) + " KB"; } -function install_package(package, homeurl) { +function install_package(package, homeurl, current_package) { var home_url = typeof homeurl !== "undefined" ? homeurl + "/" : ""; $( @@ -1235,6 +1235,50 @@ function install_package(package, homeurl) { $("#pkg_apply_dialog").html(dialog_text); $("#pkg_apply_dialog").dialog("open"); + + const number_update = package.match(/package_(\d+).oum/); + + if (number_update === null || number_update[1] != current_package - 0 + 1) { + $( + "
" + ).dialog({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 600, + height: 250, + buttons: [ + { + text: ok_button, + click: function() { + $(this).dialog("close"); + } + } + ] + }); + + var dialog_warning = "
"; + dialog_warning = + dialog_warning + + "

" + + text1_warning + + "

"; + dialog_warning = dialog_warning + "

" + text2_warning + "

"; + dialog_warning = + dialog_warning + + "
"; + dialog_warning = dialog_warning + "
"; + + $("#warning_pkg").html(dialog_warning); + } } function check_install_package(package, homeurl) {