Commit af8b7a9c authored by Pascal Dreissen's avatar Pascal Dreissen
Browse files

Modification for datalog notification header (uniform naming / stability when losing connection)

parent 38699b9d
......@@ -8,6 +8,7 @@ var ISPConfig = {
indicatorCompleted: false,
registeredHooks: new Array(),
new_tpl_add_id: 0,
dataLogTimer: 0,
options: {
useLoadIndicator: false,
......@@ -175,6 +176,8 @@ var ISPConfig = {
ISPConfig.onAfterContentLoad(target, $('#'+formname).serialize());
ISPConfig.pageFormChanged = false;
}
clearTimeout(dataLogTimer);
ISPConfig.dataLogNotification();
ISPConfig.hideLoadIndicator();
},
error: function(jqXHR, textStatus, errorThrown) {
......@@ -282,6 +285,8 @@ var ISPConfig = {
ISPConfig.onAfterContentLoad(pagename, (params ? params : null));
ISPConfig.pageFormChanged = false;
}
clearTimeout(dataLogTimer); // clear running dataLogTimer
ISPConfig.dataLogNotification();
ISPConfig.hideLoadIndicator();
},
error: function() {
......@@ -346,7 +351,7 @@ var ISPConfig = {
ISPConfig.loadMenus();
ISPConfig.keepalive();
ISPConfig.datalognotification();
ISPConfig.dataLogNotification();
setTimeout(function() {
try {
$('form#pageForm').find('input[name="username"]').focus();
......@@ -487,6 +492,7 @@ var ISPConfig = {
url: "keepalive.php",
dataType: "html",
success: function(data, textStatus, jqXHR) {
//alert(textStatus);
setTimeout( function() { ISPConfig.keepalive(); }, 1000000 );
},
error: function() {
......@@ -494,7 +500,8 @@ var ISPConfig = {
}
});
},
datalognotification: function() {
dataLogNotification: function() {
console.log(ISPConfig.options);
var notificationContent = $.ajax({
type: "GET",
url: "datalogstatus.php",
......@@ -502,17 +509,18 @@ var ISPConfig = {
success: function(data, textStatus, jqXHR) {
var dataLogItems = [];
$.each( data['entries'], function( key, val ) {
dataLogItems.push('<li><strong>' + val['text'] + ':</strong> ' + val['count'] + '</li>');
dataLogItems.push('<li><strong>' + val['text'] + ':</strong> ' + val['count'] + '</li>');
});
if(data['count'] > 0) {
$('.modal-body').html(dataLogItems.join(""));
$('.notification_text').text(data['count']);
$('.notification').css('display','');
setTimeout( function() { ISPConfig.datalognotification(); }, 2000 );
dataLogTimer = setTimeout( function() { ISPConfig.dataLogNotification(); }, 2000 );
} else {
$('.notification').css('display','none');
$('.modal-body').html('');
setTimeout( function() { ISPConfig.datalognotification(); }, 5000 );
$('#datalogModal').modal('hide');
dataLogTimer = setTimeout( function() { ISPConfig.dataLogNotification(); }, 5000 );
}
},
error: function() {
......@@ -530,7 +538,7 @@ var ISPConfig = {
if(addTplId > 0) {
var newVal = tpl_add.split('/');
ISPConfig.new_tpl_add_id += 1;
var delbtn = $('<a href="#"><span class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a>').attr('class', 'btn btn-danger btn-xs').click(function(e) {
var delbtn = $('&nbsp;<a href="#"><span class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a>').attr('class', 'btn btn-danger btn-xs').click(function(e) {
e.preventDefault();
ISPConfig.delAdditionalTemplate($(this).parent().attr('rel'));
});
......
......@@ -61,31 +61,31 @@
</tmpl_if>
</div>
</div>
<div class="notification" data-toggle="modal" data-target="#myModal" style="display: none;">
<span class="notification_text">{tmpl_var name="datalog_changes_count"}</span>
</div>
<!-- Datalogstatus Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">{tmpl_var name="datalog_changes_txt"}</h4>
</div>
<div class="modal-body">
<ul>
<tmpl_loop name="datalog_changes">
<li><strong>{tmpl_var name="text"}:</strong> {tmpl_var name="count"}</li>
</tmpl_loop>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- END Datalogstatus Modal -->
<div class="notification" data-toggle="modal" data-target="#datalogModal" style="display: none;">
<span class="notification_text">{tmpl_var name="datalog_changes_count"}</span>
</div>
<!-- Datalogstatus Modal -->
<div id="datalogModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">{tmpl_var name="datalog_changes_txt"}</h4>
</div>
<div class="modal-body">
<ul>
<tmpl_loop name="datalog_changes">
<li><strong>{tmpl_var name="text"}:</strong> {tmpl_var name="count"}</li>
</tmpl_loop>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- END Datalogstatus Modal -->
<tmpl_if name='logged_in' value='y'><div id='topnav-container'>
</div></tmpl_if>
<div class='clear'>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment