Skip to content

Commit

Permalink
Item12180: Upgrades for display of expert items with errors. ExpireAf…
Browse files Browse the repository at this point in the history
…ter was not a NUMBER.

git-svn-id: http://svn.foswiki.org/trunk@16214 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
TimotheLitt authored and TimotheLitt committed Dec 14, 2012
1 parent f221449 commit 1d6ac2e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 57 deletions.
7 changes: 5 additions & 2 deletions core/lib/Foswiki/Configure/Checkers/Sessions/ExpireAfter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ package Foswiki::Configure::Checkers::Sessions::ExpireAfter;
use strict;
use warnings;

use Foswiki::Configure::Checker ();
our @ISA = ('Foswiki::Configure::Checker');
require Foswiki::Configure::Checkers::NUMBER;
our @ISA = ('Foswiki::Configure::Checkers::NUMBER');

sub check {
my $this = shift;

return '' unless $Foswiki::cfg{UseClientSessions};

my $e = '';
$e .= $this->SUPER::check(@_);
return $e if ( $e =~ /Error:/ );

if ( $Foswiki::cfg{Sessions}{ExpireAfter} < 0 ) {
$e .= $this->WARN(<<'MESSAGE');
Foswiki will *not* clean up sessions automatically. Make sure you
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/Dispatch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use version 0.77;

# minimum version of client JavaScript that configure requires.
#
my $minScriptVersion = version->parse("v3.113");
my $minScriptVersion = version->parse("v3.115");

use Foswiki::Configure (qw/:DEFAULT :auth :cgi :config :session :trace/);

Expand Down
101 changes: 49 additions & 52 deletions core/lib/Foswiki/Configure/resources/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ var configure = (function ($) {

"use strict";

var VERSION = "v3.113";
var VERSION = "v3.115";
/* Do not merge, move or change format of VERSION, parsed by perl.
*/

var expertsMode = '',
var expertsMode = false,
tabLinks = {},
menuState = {
main: undefined,
Expand Down Expand Up @@ -140,33 +140,40 @@ var configure = (function ($) {
});
},

toggleExpertsMode: function (modeName) {
var mode = getUrlParam(modeName),
antimode;
if (mode !== undefined && mode !== '') {
/* convert value to a css value */
expertsMode = (mode === '1' ? '' : 'none');
} else {
/* toggle */
expertsMode = (expertsMode === 'none' ? '' : 'none');
}

antimode = (expertsMode === 'none' ? '' : 'none');
/* toggle table rows */
$('tr.configureExpert').each(function () {
$(this).css("display", expertsMode);
});
$('tr.configureNotExpert').each(function () {
$(this).css("display", antimode);
});
/* toggle links */
$('a.configureExpert').each(function () {
$(this).css("display", expertsMode);
});
$('a.configureNotExpert').each(function () {
$(this).css("display", antimode);
});
},
toggleExpertsMode: function (modeName) {
var mode,
isClass;

if( modeName !== undefined ) {
if( modeName !== '' ) {
mode = getUrlParam(modeName);
if (mode !== undefined ) {
/* convert value to boolean */
expertsMode = (mode === '1' ? true : false);
}
}
} else {
/* toggle */
expertsMode = !expertsMode;
}

isClass = expertsMode? 'configureExpert' : 'configureNotExpert';

$('tr.configureExpert,tr.configureNotExpert,a.configureExpert,a.configureNotExpert').
each(function () {
var ele = $(this);

if( ele.hasClass(isClass) ||
ele.filter('tr.configureExpert').
find('div.configureWarning,div.configureError').size() ) {
ele.removeClass('foswikiMakeHidden');
} else {
ele.addClass('foswikiMakeHidden');
}

return true;
});
},

getDefaultSub: function (inMainId) {
return menuState.defaultSub[inMainId];
Expand Down Expand Up @@ -421,6 +428,8 @@ var configure = (function ($) {
* error and warning counts. These are initally set with checker results with the
* main page is built, and updated when changed by feedback. updateIndicators
* pushes the values up to the tabs and status line, mostly by adjusting classes.
* It also updates any expert settings forced visible in non-expert mode due to
* warnings or errors.
*/

updateIndicators: function () {
Expand Down Expand Up @@ -600,6 +609,10 @@ var configure = (function ($) {
$('#configureFixSoon').remove();
}
$('#configureErrorSummary').html(statusLine);

if( !expertsMode ) {
configure.toggleExpertsMode( '' );
}
return true;
},
getVERSION: function () {
Expand Down Expand Up @@ -1347,19 +1360,11 @@ $(document).ready(function () {
$(".tabli a").click(function () {
return configure.showSection(this.sectionId);
});
$("a.configureExpert").click(function () {
configure.toggleExpertsMode();
return false;
});
$("a.configureNotExpert").click(function () {
$("a.configureExpert,a.configureNotExpert").click(function () {
configure.toggleExpertsMode();
return false;
});
$("a.configureInfoText").click(function () {
configure.toggleInfoMode();
return false;
});
$("a.configureNotInfoText").click(function () {
$("a.configureInfoText,a.configureNotInfoText").click(function () {
configure.toggleInfoMode();
return false;
});
Expand All @@ -1375,18 +1380,6 @@ $(document).ready(function () {
$(":input.foswikiFocus").each(function () {
this.focus();
});
$(".configureRootSection table.configureSectionValues div.configureError").each(function () {
var row = $(this).closest('tr').get(0);
if (row) {
$(row).removeClass('configureExpert');
}
});
$(".configureRootSection table.configureSectionValues div.configureWarning").each(function () {
var row = $(this).closest('tr').get(0);
if (row) {
$(row).removeClass('configureExpert');
}
});
$("#closeMessages").click(function () {
$("#messages").hide();
return false;
Expand All @@ -1413,7 +1406,11 @@ $(document).ready(function () {

$("[data-displayif]").each(function () {
add_dependency($(this), "displayif", function ($el, tf) {
$el.toggle(tf);
if( tf ) {
$($el).removeClass('configureDisplayHidden' );
} else {
$($el).addClass('configureDisplayHidden' );
}
});
});
$("[data-enableif]").each(function () {
Expand Down
6 changes: 5 additions & 1 deletion core/lib/Foswiki/Configure/resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1082,4 +1082,8 @@ td.configureItemEnable {
padding: 10px 0 0 0;
margin: 0px;
vertical-align:top;
}
}
/* Hidden by DisplayIF */
.configureDisplayHidden {
display: none;
}
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/templates/section.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<#if description??>${description}</#if>

<#-- any contents (table) -->
<#if contents??>${contents?replace("CONFIGURE_EXPERT_LINK", "<span><a class='configureExpert' style='display:none' href='#'>Hide expert options</a><a class='configureNotExpert foswikiMakeVisible' style='display:none' href='#'>Show expert options</a></span>")?replace("CONFIGURE_INFO_LINK", "<span><a class='configureInfoText foswikiMakeVisible' href='#'>Hide all info</a><a class='configureNotInfoText foswikiMakeVisible' href='#'>Show all info</a></span>")}</#if>
<#if contents??>${contents?replace("CONFIGURE_EXPERT_LINK", "<span><a class='configureExpert configureMakeHidden' href='#'>Hide expert options</a><a class='configureNotExpert foswikiMakeHidden' href='#'>Show expert options</a></span>")?replace("CONFIGURE_INFO_LINK", "<span><a class='configureInfoText foswikiMakeVisible' href='#'>Hide all info</a><a class='configureNotInfoText foswikiMakeVisible' href='#'>Show all info</a></span>")}</#if>

</div><!--/${id}Body-->

0 comments on commit 1d6ac2e

Please sign in to comment.