Skip to content

Commit af8b7a9

Browse files
author
Pascal Dreissen
committed
Modification for datalog notification header (uniform naming / stability when losing connection)
1 parent 38699b9 commit af8b7a9

File tree

3 files changed

+40
-32
lines changed

3 files changed

+40
-32
lines changed

interface/web/themes/default/assets/javascripts/ispconfig.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var ISPConfig = {
88
indicatorCompleted: false,
99
registeredHooks: new Array(),
1010
new_tpl_add_id: 0,
11+
dataLogTimer: 0,
1112

1213
options: {
1314
useLoadIndicator: false,
@@ -175,6 +176,8 @@ var ISPConfig = {
175176
ISPConfig.onAfterContentLoad(target, $('#'+formname).serialize());
176177
ISPConfig.pageFormChanged = false;
177178
}
179+
clearTimeout(dataLogTimer);
180+
ISPConfig.dataLogNotification();
178181
ISPConfig.hideLoadIndicator();
179182
},
180183
error: function(jqXHR, textStatus, errorThrown) {
@@ -282,6 +285,8 @@ var ISPConfig = {
282285
ISPConfig.onAfterContentLoad(pagename, (params ? params : null));
283286
ISPConfig.pageFormChanged = false;
284287
}
288+
clearTimeout(dataLogTimer); // clear running dataLogTimer
289+
ISPConfig.dataLogNotification();
285290
ISPConfig.hideLoadIndicator();
286291
},
287292
error: function() {
@@ -346,7 +351,7 @@ var ISPConfig = {
346351

347352
ISPConfig.loadMenus();
348353
ISPConfig.keepalive();
349-
ISPConfig.datalognotification();
354+
ISPConfig.dataLogNotification();
350355
setTimeout(function() {
351356
try {
352357
$('form#pageForm').find('input[name="username"]').focus();
@@ -487,32 +492,35 @@ var ISPConfig = {
487492
url: "keepalive.php",
488493
dataType: "html",
489494
success: function(data, textStatus, jqXHR) {
495+
//alert(textStatus);
490496
setTimeout( function() { ISPConfig.keepalive(); }, 1000000 );
491497
},
492498
error: function() {
493499
ISPConfig.reportError('Session expired. Please login again.');
494500
}
495501
});
496502
},
497-
datalognotification: function() {
503+
dataLogNotification: function() {
504+
console.log(ISPConfig.options);
498505
var notificationContent = $.ajax({
499506
type: "GET",
500507
url: "datalogstatus.php",
501508
dataType: "json",
502509
success: function(data, textStatus, jqXHR) {
503510
var dataLogItems = [];
504511
$.each( data['entries'], function( key, val ) {
505-
dataLogItems.push('<li><strong>' + val['text'] + ':</strong> ' + val['count'] + '</li>');
512+
dataLogItems.push('<li><strong>' + val['text'] + ':</strong> ' + val['count'] + '</li>');
506513
});
507514
if(data['count'] > 0) {
508515
$('.modal-body').html(dataLogItems.join(""));
509516
$('.notification_text').text(data['count']);
510517
$('.notification').css('display','');
511-
setTimeout( function() { ISPConfig.datalognotification(); }, 2000 );
518+
dataLogTimer = setTimeout( function() { ISPConfig.dataLogNotification(); }, 2000 );
512519
} else {
513520
$('.notification').css('display','none');
514521
$('.modal-body').html('');
515-
setTimeout( function() { ISPConfig.datalognotification(); }, 5000 );
522+
$('#datalogModal').modal('hide');
523+
dataLogTimer = setTimeout( function() { ISPConfig.dataLogNotification(); }, 5000 );
516524
}
517525
},
518526
error: function() {
@@ -530,7 +538,7 @@ var ISPConfig = {
530538
if(addTplId > 0) {
531539
var newVal = tpl_add.split('/');
532540
ISPConfig.new_tpl_add_id += 1;
533-
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) {
541+
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) {
534542
e.preventDefault();
535543
ISPConfig.delAdditionalTemplate($(this).parent().attr('rel'));
536544
});

0 commit comments

Comments
 (0)