Ent 6680 ventana de perdida de conexion incorrecta
This commit is contained in:
parent
01b315de3f
commit
2f2556ef79
|
@ -114,6 +114,13 @@ foreach ($custom_fields as $field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connection lost alert.
|
||||||
|
ui_require_css_file('register', 'include/styles/', true);
|
||||||
|
ui_require_javascript_file('connection_check');
|
||||||
|
$conn_title = __('Connection with server has been lost');
|
||||||
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
|
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
||||||
|
|
||||||
// Get the custom icons.
|
// Get the custom icons.
|
||||||
$docs_logo = ui_get_docs_logo();
|
$docs_logo = ui_get_docs_logo();
|
||||||
$support_logo = ui_get_support_logo();
|
$support_logo = ui_get_support_logo();
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
/**
|
||||||
|
* -------------------------------------
|
||||||
|
* Connection Check
|
||||||
|
* --------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
checkConnection(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs connection tests every minutes and add connection listeners
|
||||||
|
* @param {integer} time in minutes
|
||||||
|
*/
|
||||||
|
|
||||||
|
function checkConnection(minutes) {
|
||||||
|
var cicle = minutes * 60 * 1000;
|
||||||
|
var checkConnection = setInterval(handleConnection, cicle);
|
||||||
|
|
||||||
|
// Connection listeters.
|
||||||
|
window.addEventListener("online", handleConnection);
|
||||||
|
window.addEventListener("offline", handleConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle connection status test.
|
||||||
|
*
|
||||||
|
* Test conectivity with server and shows modal message.
|
||||||
|
*/
|
||||||
|
function handleConnection() {
|
||||||
|
var connected;
|
||||||
|
var msg = "online";
|
||||||
|
|
||||||
|
if (navigator.onLine) {
|
||||||
|
isReachable(getServerUrl())
|
||||||
|
.then(function(online) {
|
||||||
|
if (online) {
|
||||||
|
// handle online status
|
||||||
|
connected = true;
|
||||||
|
showConnectionMessage(connected, msg);
|
||||||
|
} else {
|
||||||
|
connected = false;
|
||||||
|
msg = "No connectivity with server";
|
||||||
|
showConnectionMessage(connected, msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function(err) {
|
||||||
|
connected = false;
|
||||||
|
msg = err;
|
||||||
|
showConnectionMessage(connected, msg);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// handle offline status
|
||||||
|
connected = false;
|
||||||
|
msg = "Connection offline";
|
||||||
|
showConnectionMessage(connected, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test server reachibilty and get response.
|
||||||
|
*
|
||||||
|
* @param {String} url
|
||||||
|
*
|
||||||
|
* Return {promise}
|
||||||
|
*/
|
||||||
|
function isReachable(url) {
|
||||||
|
/**
|
||||||
|
* Note: fetch() still "succeeds" for 404s on subdirectories,
|
||||||
|
* which is ok when only testing for domain reachability.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* https://google.com/noexist does not throw
|
||||||
|
* https://noexist.com/noexist does throw
|
||||||
|
*/
|
||||||
|
return fetch(url, { method: "HEAD", mode: "no-cors" })
|
||||||
|
.then(function(resp) {
|
||||||
|
return resp && (resp.ok || resp.type === "opaque");
|
||||||
|
})
|
||||||
|
.catch(function(error) {
|
||||||
|
console.warn("[conn test failure]:", error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets server origin url
|
||||||
|
*/
|
||||||
|
function getServerUrl() {
|
||||||
|
var server_url;
|
||||||
|
|
||||||
|
server_url = window.location.origin;
|
||||||
|
|
||||||
|
return server_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows or hide connection infoMessage.
|
||||||
|
*
|
||||||
|
* @param {bool} conn
|
||||||
|
* @param {string} msg
|
||||||
|
*/
|
||||||
|
function showConnectionMessage(conn = true, msg = "") {
|
||||||
|
var data = {};
|
||||||
|
if (conn) {
|
||||||
|
$("div#message_dialog_connection")
|
||||||
|
.closest(".ui-dialog-content")
|
||||||
|
.dialog("close");
|
||||||
|
} else {
|
||||||
|
data.title = "Connection with server has been lost";
|
||||||
|
data.text = "Connection status: " + 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('<div title="' + title + '" id="' + idMsg + '"></div>');
|
||||||
|
$("#" + 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");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
|
@ -1930,120 +1930,3 @@ function ajaxRequest(id, settings) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* -------------------------------------
|
|
||||||
* Connection Check
|
|
||||||
* --------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
checkConnection(1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs connection tests every minutes and add connection listeners
|
|
||||||
* @param {integer} time in minutes
|
|
||||||
*/
|
|
||||||
|
|
||||||
function checkConnection(minutes) {
|
|
||||||
var cicle = minutes * 60 * 1000;
|
|
||||||
var checkConnection = setInterval(handleConnection, cicle);
|
|
||||||
|
|
||||||
// Connection listeters.
|
|
||||||
window.addEventListener("online", handleConnection);
|
|
||||||
window.addEventListener("offline", handleConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle connection status test.
|
|
||||||
*
|
|
||||||
* Test conectivity with server and shows modal message.
|
|
||||||
*/
|
|
||||||
function handleConnection() {
|
|
||||||
var connected;
|
|
||||||
var msg = "online";
|
|
||||||
|
|
||||||
if (navigator.onLine) {
|
|
||||||
isReachable(getServerUrl())
|
|
||||||
.then(function(online) {
|
|
||||||
if (online) {
|
|
||||||
// handle online status
|
|
||||||
connected = true;
|
|
||||||
showConnectionMessage(connected, msg);
|
|
||||||
} else {
|
|
||||||
connected = false;
|
|
||||||
msg = "No connectivity with server";
|
|
||||||
showConnectionMessage(connected, msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
connected = false;
|
|
||||||
msg = err;
|
|
||||||
showConnectionMessage(connected, msg);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// handle offline status
|
|
||||||
connected = false;
|
|
||||||
msg = "Connection offline";
|
|
||||||
showConnectionMessage(connected, msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test server reachibilty and get response.
|
|
||||||
*
|
|
||||||
* @param {String} url
|
|
||||||
*
|
|
||||||
* Return {promise}
|
|
||||||
*/
|
|
||||||
function isReachable(url) {
|
|
||||||
/**
|
|
||||||
* Note: fetch() still "succeeds" for 404s on subdirectories,
|
|
||||||
* which is ok when only testing for domain reachability.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* https://google.com/noexist does not throw
|
|
||||||
* https://noexist.com/noexist does throw
|
|
||||||
*/
|
|
||||||
return fetch(url, { method: "HEAD", mode: "no-cors" })
|
|
||||||
.then(function(resp) {
|
|
||||||
return resp && (resp.ok || resp.type === "opaque");
|
|
||||||
})
|
|
||||||
.catch(function(error) {
|
|
||||||
console.warn("[conn test failure]:", error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets server origin url
|
|
||||||
*/
|
|
||||||
function getServerUrl() {
|
|
||||||
var server_url;
|
|
||||||
|
|
||||||
try {
|
|
||||||
server_url = get_php_value("homeurl");
|
|
||||||
} catch (SyntaxError) {
|
|
||||||
console.warn("Pandora homeurl cannot be found.");
|
|
||||||
server_url = $("#hidden-homeurl").val();
|
|
||||||
}
|
|
||||||
return server_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows or hide connection infoMessage.
|
|
||||||
*
|
|
||||||
* @param {bool} conn
|
|
||||||
* @param {string} msg
|
|
||||||
*/
|
|
||||||
function showConnectionMessage(conn = true, msg = "") {
|
|
||||||
var data = {};
|
|
||||||
if (conn) {
|
|
||||||
$("div#message_dialog_connection")
|
|
||||||
.closest(".ui-dialog-content")
|
|
||||||
.dialog("close");
|
|
||||||
} else {
|
|
||||||
data.title = "Connection with server has been lost";
|
|
||||||
data.text = "Connection status: " + msg;
|
|
||||||
|
|
||||||
infoMessage(data, "message_dialog_connection");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -494,61 +494,3 @@ function generalShowMsg(data, idMsg) {
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function infoMessage(data, idMsg) {
|
|
||||||
var title = data.title;
|
|
||||||
var err_messge = data.text;
|
|
||||||
|
|
||||||
if (idMsg == null) {
|
|
||||||
idMsg = uniqId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($("#" + idMsg).length === 0) {
|
|
||||||
$("body").append('<div title="' + title + '" id="' + idMsg + '"></div>');
|
|
||||||
$("#" + 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");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
|
@ -1255,8 +1255,8 @@ echo '</div>';
|
||||||
echo '<div id="um_msg_receiver">';
|
echo '<div id="um_msg_receiver">';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
|
ui_require_javascript_file('connection_check');
|
||||||
$conn_title = __('Connection with server has been lost');
|
$conn_title = __('Connection with server has been lost');
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
||||||
|
|
|
@ -86,6 +86,7 @@ ui_require_css_file('register', 'include/styles/', true);
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
$conn_title = __('Connection with server has been lost');
|
$conn_title = __('Connection with server has been lost');
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
|
ui_require_javascript_file('connection_check');
|
||||||
ui_print_message_dialog(
|
ui_print_message_dialog(
|
||||||
$conn_title,
|
$conn_title,
|
||||||
$conn_text,
|
$conn_text,
|
||||||
|
|
|
@ -61,6 +61,13 @@ echo '</head>';
|
||||||
echo "<body style='background-color: #494949; max-width: 550px; max-height: 400px; margin-top:40px;'>";
|
echo "<body style='background-color: #494949; max-width: 550px; max-height: 400px; margin-top:40px;'>";
|
||||||
echo "<h1 class='modalheaderh1'>".__('Sound console').'</h1>';
|
echo "<h1 class='modalheaderh1'>".__('Sound console').'</h1>';
|
||||||
|
|
||||||
|
// Connection lost alert.
|
||||||
|
ui_require_css_file('register', 'include/styles/', true);
|
||||||
|
$conn_title = __('Connection with server has been lost');
|
||||||
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
|
ui_require_javascript_file('connection_check');
|
||||||
|
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
||||||
|
|
||||||
$table = new StdClass;
|
$table = new StdClass;
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->styleTable = 'padding-left:16px; padding-right:16px; padding-top:16px;';
|
$table->styleTable = 'padding-left:16px; padding-right:16px; padding-top:16px;';
|
||||||
|
|
|
@ -273,8 +273,10 @@ if ($layers != false) {
|
||||||
gis_activate_ajax_refresh($layers, $timestampLastOperation, 1, $idMap);
|
gis_activate_ajax_refresh($layers, $timestampLastOperation, 1, $idMap);
|
||||||
|
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
|
ui_require_css_file('register', 'include/styles/', true);
|
||||||
$conn_title = __('Connection with server has been lost');
|
$conn_title = __('Connection with server has been lost');
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
|
ui_require_javascript_file('connection_check');
|
||||||
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ html_print_input_hidden('homeurl', $config['homeurl']);
|
||||||
$url_css_modal = ui_get_full_url('include/styles/register.css', false, false, false);
|
$url_css_modal = ui_get_full_url('include/styles/register.css', false, false, false);
|
||||||
echo '<link rel="stylesheet" href="'.$url_css_modal.'" type="text/css" />';
|
echo '<link rel="stylesheet" href="'.$url_css_modal.'" type="text/css" />';
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
|
ui_require_javascript_file('connection_check', 'include/javascript/', true);
|
||||||
$conn_title = __('Connection with server has been lost');
|
$conn_title = __('Connection with server has been lost');
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
||||||
|
@ -157,10 +158,6 @@ echo '<div style="display: none;" id="qrcode_container" title="'.__('QR code of
|
||||||
echo '<div id="qrcode_container_image"></div>';
|
echo '<div id="qrcode_container_image"></div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Connection lost alert.
|
|
||||||
$conn_title = __('Connection with server has been lost');
|
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
|
||||||
ui_print_message_alert($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
|
||||||
|
|
||||||
ui_require_jquery_file('countdown', 'include/javascript/', true);
|
ui_require_jquery_file('countdown', 'include/javascript/', true);
|
||||||
ui_require_javascript_file('wz_jsgraphics', 'include/javascript/', true);
|
ui_require_javascript_file('wz_jsgraphics', 'include/javascript/', true);
|
||||||
|
|
|
@ -29,11 +29,10 @@ if (file_exists(ENTERPRISE_DIR.'/include/functions_login.php')) {
|
||||||
require_once $config['homedir'].'/vendor/autoload.php';
|
require_once $config['homedir'].'/vendor/autoload.php';
|
||||||
|
|
||||||
ui_require_css_file('visual_maps');
|
ui_require_css_file('visual_maps');
|
||||||
ui_require_css_file('register');
|
ui_require_css_file('register', 'include/styles/', true);
|
||||||
|
|
||||||
html_print_input_hidden('homeurl', $config['homeurl']);
|
|
||||||
|
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
|
ui_require_javascript_file('connection_check', 'include/javascript/', true);
|
||||||
$conn_title = __('Connection with server has been lost');
|
$conn_title = __('Connection with server has been lost');
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
||||||
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
||||||
|
@ -140,10 +139,6 @@ echo '<div style="display: none;" id="qrcode_container" title="'.__('QR code of
|
||||||
echo '<div id="qrcode_container_image"></div>';
|
echo '<div id="qrcode_container_image"></div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Connection lost alert.
|
|
||||||
$conn_title = __('Connection with server has been lost');
|
|
||||||
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
|
|
||||||
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
|
|
||||||
|
|
||||||
// Check groups can access user.
|
// Check groups can access user.
|
||||||
$aclUserGroups = [];
|
$aclUserGroups = [];
|
||||||
|
|
Loading…
Reference in New Issue