Skip to content

Commit

Permalink
Item12180: More optimization, more paranoia
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@15957 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
TimotheLitt authored and TimotheLitt committed Nov 8, 2012
1 parent dd02a10 commit 48152e5
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions core/lib/Foswiki/Configure/resources/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ var configure = (function ($) {
if( errors.length !== 2 ) {
return true;
}
/* N.B. All items processed have 1 or more issues */

errors[0] = parseInt(errors[0],10);
totalErrors += errors[0];
errors[1] = parseInt(errors[1],10);
Expand Down Expand Up @@ -523,11 +525,12 @@ var configure = (function ($) {
}
}

/* Section alert */
/* Update section's Alert <div> error/warning counts */

alertDiv = $(root).find('div[id$="Alerts"].foswikiAlert').first();
if( alertDiv.size() == 1 ) {
id = alertDiv.attr('id');
if( id in alerts ) {
if( alerts.hasOwnProperty(id) ) {
alerts[id].errors += errors[0];
alerts[id].warnings += errors[1];
} else {
Expand All @@ -536,16 +539,16 @@ var configure = (function ($) {
}
}
return true;
}); /* errorItem */
}); /* enabled errorItem */

/* Section summaries */
/* Section summaries - only sections with errors or warnings are in alertIds.
* Stale statusLines were hidden by foswikiAlertInactive before the scans.
*/

for (id = 0; id < alertIds.length; id++) {
alertDiv = alertIds[id];
statusLine = '';
itemClass = 0;
if( alerts[alertDiv].errors !== 0 ) {
itemClass = 1;
statusLine += "<span class='configureStatusErrors'>" + alerts[alertDiv].errors;
if( alerts[alertDiv].errors == 1 ) {
statusLine += " error";
Expand All @@ -555,7 +558,6 @@ var configure = (function ($) {
statusLine += "</span>";
}
if( alerts[alertDiv].warnings !== 0 ) {
itemClass += 2;
statusLine += "<span class='configureStatusWarnings'>" + alerts[alertDiv].warnings;
if( alerts[alertDiv].warnings == 1 ) {
statusLine += " warning";
Expand All @@ -564,12 +566,7 @@ var configure = (function ($) {
}
statusLine += "</span>";
}
$('#' + configure.utils.quoteName(alertDiv)).html(statusLine).each( function (idx,ele) {
if( itemClass ) {
$(this).removeClass('foswikiAlertInactive');
}
return true;
});
$('#' + configure.utils.quoteName(alertDiv)).html(statusLine).removeClass('foswikiAlertInactive');
}

/* Finally, the summary status bar */
Expand Down

0 comments on commit 48152e5

Please sign in to comment.