diff --git a/emhttp/plugins/dynamix/include/DefaultPageLayout.php b/emhttp/plugins/dynamix/include/DefaultPageLayout.php index 095ed437b..133ebdab6 100644 --- a/emhttp/plugins/dynamix/include/DefaultPageLayout.php +++ b/emhttp/plugins/dynamix/include/DefaultPageLayout.php @@ -546,34 +546,32 @@ function digits(number) { if (number < 100) return 'two'; return 'three'; } -function openNotifier(filter) { +function openNotifier() { $.post('/webGui/include/Notify.php',{cmd:'get',csrf_token:csrf_token},function(msg) { - $.each($.parseJSON(msg), function(i, notify) { - if (notify.importance==filter) { - $.jGrowl(notify.subject+'
'+notify.description, { - group: notify.importance, - header: notify.event+': '+notify.timestamp, - theme: notify.file, - sticky: true, - beforeOpen: function(e,m,o){if ($('div.jGrowl-notification').hasClass(notify.file)) return(false);}, - afterOpen: function(e,m,o){if (notify.link) $(e).css('cursor','pointer');}, - click: function(e,m,o){if (notify.link) location.replace(notify.link);}, - close: function(e,m,o){$.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token});} - }); - } + $.each($.parseJSON(msg), function(i, notify){ + $.jGrowl(notify.subject+'
'+notify.description,{ + group: notify.importance, + header: notify.event+': '+notify.timestamp, + theme: notify.file, + sticky: true, + beforeOpen: function(e,m,o){if ($('div.jGrowl-notification').hasClass(notify.file)) return(false);}, + afterOpen: function(e,m,o){if (notify.link) $(e).css('cursor','pointer');}, + click: function(e,m,o){if (notify.link) location.replace(notify.link);}, + close: function(e,m,o){$.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token});} + }); }); }); } -function closeNotifier(filter) { +function closeNotifier() { $.post('/webGui/include/Notify.php',{cmd:'get',csrf_token:csrf_token},function(msg) { - $.each($.parseJSON(msg), function(i, notify) { - if (notify.importance==filter) $.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token}); + $.each($.parseJSON(msg), function(i, notify){ + $.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token}); }); - $('div.jGrowl').find('.'+filter).find('div.jGrowl-close').trigger('click'); + $('div.jGrowl').find('div.jGrowl-close').trigger('click'); }); } -function viewHistory(filter) { - location.replace('/Tools/NotificationsArchive?filter='+filter); +function viewHistory() { + location.replace('/Tools/NotificationsArchive'); } function flashReport() { $.post('/webGui/include/Report.php',{cmd:'config'},function(check){ @@ -873,7 +871,7 @@ defaultPage.on('message', function(msg,meta) { case 2: // notifications var bell1 = 0, bell2 = 0, bell3 = 0; - $.each($.parseJSON(msg), function(i, notify) { + $.each($.parseJSON(msg), function(i, notify){ switch (notify.importance) { case 'alert' : bell1++; break; case 'warning': bell2++; break; @@ -881,7 +879,7 @@ defaultPage.on('message', function(msg,meta) { } if (notify.show) { - $.jGrowl(notify.subject+'
'+notify.description, { + $.jGrowl(notify.subject+'
'+notify.description,{ group: notify.importance, header: notify.event+': '+notify.timestamp, theme: notify.file, @@ -893,14 +891,10 @@ defaultPage.on('message', function(msg,meta) { } }); - $('#bell').removeClass('red-orb yellow-orb green-orb').prop('title'," ["+bell1+']\n'+" ["+bell2+']\n'+" ["+bell3+']');; + $('#bell').removeClass('red-orb yellow-orb green-orb').prop('title'," ["+bell1+']\n'+" ["+bell2+']\n'+" ["+bell3+']'); if (bell1) $('#bell').addClass('red-orb'); else if (bell2) $('#bell').addClass('yellow-orb'); else if (bell3) $('#bell').addClass('green-orb'); - - if (bell1) $('#dropdown-board li.dropdown-submenu:eq(0)').removeClass('disabled'); else $('#dropdown-board li.dropdown-submenu:eq(0)').addClass('disabled').find('.dropdown-menu').hide(); - if (bell2) $('#dropdown-board li.dropdown-submenu:eq(1)').removeClass('disabled'); else $('#dropdown-board li.dropdown-submenu:eq(1)').addClass('disabled').find('.dropdown-menu').hide(); - if (bell3) $('#dropdown-board li.dropdown-submenu:eq(2)').removeClass('disabled'); else $('#dropdown-board li.dropdown-submenu:eq(2)').addClass('disabled').find('.dropdown-menu').hide(); break; } }); @@ -1081,9 +1075,9 @@ $(function() { var opts = []; context.settings({above:false}); opts.push({header:""}); - opts.push({text:"",icon:'fa-bell-o',subMenu:[{text:"",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('alert');}},{text:"",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('alert');}},{text:"",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('alert');}}]}); - opts.push({text:"",icon:'fa-star-o',subMenu:[{text:"",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('warning');}},{text:"",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('warning');}},{text:"",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('warning');}}]}); - opts.push({text:"",icon:'fa-sun-o',subMenu:[{text:"",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('normal');}},{text:"",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('normal');}},{text:"",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('normal');}}]}); + opts.push({text:"",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier();}}); + opts.push({text:"",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory();}}); + opts.push({text:"",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier();}}); context.attach('#board',opts); if (location.pathname.search(/\/(AddVM|UpdateVM|AddContainer|UpdateContainer)/)==-1) { $('blockquote.inline_help').each(function(i) {