diff --git a/pandora_console/include/javascript/connection_check.js b/pandora_console/include/javascript/connection_check.js index 65b893ef51..04be169245 100644 --- a/pandora_console/include/javascript/connection_check.js +++ b/pandora_console/include/javascript/connection_check.js @@ -1,3 +1,4 @@ +/* globals $, get_php_value, infoMessage */ /** * ------------------------------------- * Connection Check @@ -97,62 +98,3 @@ function showConnectionMessage(conn = true, msg = "") { infoMessage(data, "message_dialog_connection"); } } - -function infoMessage(data, idMsg) { - var title = data.title; - var err_messge = data.text; - - if (idMsg == null) { - idMsg = uniqId(); - } - - if ($("#" + idMsg).length === 0) { - $("body").append('
'); - $("#" + idMsg).empty(); - } - - $("#err_msg").empty(); - $("#err_msg").html("\n\n" + err_messge); - - $("#" + idMsg) - .dialog({ - height: 250, - width: 528, - opacity: 1, - modal: true, - position: { - my: "center", - at: "center", - of: window, - collision: "fit" - }, - title: data.title, - buttons: [ - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", - text: "Retry", - click: function(e) { - handleConnection(); - } - }, - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel", - text: "Close", - click: function() { - $(this).dialog("close"); - } - } - ], - - open: function(event, ui) { - $(".ui-widget-overlay").addClass("error-modal-opened"); - }, - close: function(event, ui) { - $(".ui-widget-overlay").removeClass("error-modal-opened"); - closed = true; - } - }) - .show(); -} diff --git a/pandora_console/include/javascript/pandora_ui.js b/pandora_console/include/javascript/pandora_ui.js index f66f5c2730..525ee90cb2 100644 --- a/pandora_console/include/javascript/pandora_ui.js +++ b/pandora_console/include/javascript/pandora_ui.js @@ -577,6 +577,9 @@ function generalShowMsg(data, idMsg) { function infoMessage(data, idMsg) { var title = data.title; var err_messge = data.text; + // False or null: Show all buttons and classic behaviour, + // if true, show an OK button and message from data.text. + var simple = data.simple; if (idMsg == null) { idMsg = uniqId(); @@ -590,6 +593,41 @@ function infoMessage(data, idMsg) { $("#err_msg").empty(); $("#err_msg").html("\n\n" + err_messge); + var buttons = []; + + if (simple == null || simple == false) { + buttons = [ + { + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", + text: "Retry", + click: function(e) { + handleConnection(); + } + }, + { + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel", + text: "Close", + click: function() { + $(this).dialog("close"); + } + } + ]; + } else { + $("#" + idMsg).append($("#err_msg")); + buttons = [ + { + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", + text: "Ok", + click: function(e) { + $("#" + idMsg).dialog("close"); + } + } + ]; + } + $("#" + idMsg) .dialog({ height: 250, @@ -603,24 +641,7 @@ function infoMessage(data, idMsg) { collision: "fit" }, title: data.title, - buttons: [ - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", - text: "Retry", - click: function(e) { - handleConnection(); - } - }, - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel", - text: "Close", - click: function() { - $(this).dialog("close"); - } - } - ], + buttons: buttons, open: function(event, ui) { $(".ui-widget-overlay").addClass("error-modal-opened");