Skip to content

Commit

Permalink
Item12180: Alternate presentation
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@16192 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
TimotheLitt authored and TimotheLitt committed Dec 11, 2012
1 parent 619cd7c commit 9f2eeb2
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion core/lib/Foswiki.spec
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ $Foswiki::cfg{ScriptUrlPaths}{view} =
# directory.
# $Foswiki::cfg{ScriptDir} = '/home/httpd/foswiki/bin';

# **URLPATH CHECK='expand' M**
# **URLPATH CHECK='expand' M T**
# Attachments URL path e.g. /foswiki/pub
# <p /><b>Security Note:</b> files in this directory are *not*
# protected by Foswiki access controls. If you require access controls, you
Expand Down
22 changes: 12 additions & 10 deletions core/lib/Foswiki/Configure/Checkers/PubUrlPath.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use warnings;
require Foswiki::Configure::Checkers::URLPATH;
our @ISA = ('Foswiki::Configure::Checkers::URLPATH');

use Foswiki::Configure qw/:cgi/;

sub check {
my $this = shift;
my ($valobj) = @_;
Expand All @@ -26,19 +24,23 @@ sub check {
return $mess if ( $mess =~ /Error:/ );

my $t = "/System/ProjectLogos/foswiki-logo.png";
my $ok = $this->NOTE("Successfully accessed content under $value");
my $fail = $this->ERROR("Failed to acccess content under $value");
my $ok = $this->NOTE("Content under $value is accessible.");
my $fail = $this->ERROR(
"Content under $value is inaccessible. Check the setting and webserver configuration."
);
$valobj->{errors}--;

$mess .= $this->NOTE(
qq{<span name="{PubUrlPath}Wait">Please wait while the setting is tested. Disregard any message that appears only briefly.</span>}
. qq{<span onload='\$("[name=\\"\\{PubUrlPath\\}Error\\"]").hide();\$("[name=\\"\\{PubUrlPath\\}Ok\\"]").hide();'>
<img name="{PubUrlPath}TestImage" src="$value$t" testImg="$t" style="height:1px;float:right;opacity:0"
onload='\$("[name=\\"\\{PubUrlPath\\}Error\\"]").hide();\$("[name=\\"\\{PubUrlPath\\}Wait\\"]").hide();\$("[name=\\"\\{PubUrlPath\\}Ok\\"]").show();'
onerror='\$("[name=\\"\\{PubUrlPath\\}Ok\\"]").hide();\$("[name=\\"\\{PubUrlPath\\}Wait\\"]").hide();\$("[name=\\"\\{PubUrlPath\\}Error\\"]").show();'>
qq{<span class="foswikiJSRequired">
<span name="{PubUrlPath}Wait">Please wait while the setting is tested. Disregard any message that appears only briefly.</span>
<span name="{PubUrlPath}Ok">$ok</span>
<span name="{PubUrlPath}Error">$fail</span></span>}
<span name="{PubUrlPath}Error">$fail</span></span>
<span class="foswikiNonJS">Content under $value is accessible if the Foswiki logo appears to the right of this text.
<img name="{PubUrlPath}TestImage" src="$value$t" testImg="$t" style="margin-left:10px;height:15px;"
onload='\$("[name=\\"\\{PubUrlPath\\}Error\\"],[name=\\"\\{PubUrlPath\\}Wait\\"]").hide();\$("[name=\\"\\{PubUrlPath\\}Ok\\"]").show();'
onerror='\$("[name=\\"\\{PubUrlPath\\}Ok\\"],[name=\\"\\{PubUrlPath\\}Wait\\"]").hide();\$("[name=\\"\\{PubUrlPath\\}Error\\"]").show();'><br >If it does not appear, check the setting and webserver configuration.</span>}
);
$this->{JSContent} = 1;

return $mess;
}
Expand Down
3 changes: 3 additions & 0 deletions core/lib/Foswiki/Configure/Checkers/URL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ sub provideFeedback {
elsif ( $this->{UpdatedValue} ) {
$e .= $this->FB_VALUE( $keys, delete $this->{UpdatedValue} );
}
if ( delete $this->{JSContent} ) {
$e .= $this->FB_ACTION( $keys, 'j' );
}

return wantarray ? ( $e, 0 ) : $e;
}
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.110");
my $minScriptVersion = version->parse("v3.111");

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

Expand Down
2 changes: 2 additions & 0 deletions core/lib/Foswiki/Configure/UIs/Value.pm
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ HERE
# Generate a prompter for the value.
my $promptclass = $value->{typename} || '';
$promptclass .= ' configureMandatory' if ( $value->{mandatory} );
$promptclass .= ' configureHasTestImage'
if ( $value->{opts} =~ /\bT\b/ );
eval {
$control .=
$type->prompt( $keys, $value->{opts}, $currentValue,
Expand Down
9 changes: 7 additions & 2 deletions core/lib/Foswiki/Configure/resources/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var configure = (function ($) {

"use strict";

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

Expand Down Expand Up @@ -755,7 +755,7 @@ function valueChanged(el) {
"use strict";
switch (el.type.toLowerCase()) {
case "text":
if( /UrlPath/.test(el.name) ) {
if( $(el).hasClass('configureHasTestImage') ) {
$('[name="' + configure.utils.quoteName(el.name+'TestImage') + '"]').
attr('src','').
each(function () {
Expand Down Expand Up @@ -1252,6 +1252,10 @@ var feedback = ( function ($) {
case 'a':
$(this).append(kpair[2]);
break;
case 'j':
$('.foswikiNonJS').hide();
$('.foswikiJSRequired').removeClass('foswikiJSRequired');
break;
case 'm':
mark = this.scrollHeight;
if( this.clientHeight !== undefined ) {
Expand Down Expand Up @@ -1398,6 +1402,7 @@ $(document).ready(function () {
}
}} );

$('.foswikiNonJS').hide();
$('.foswikiJSRequired').removeClass('foswikiJSRequired');

/* Provide version before anything else happens */
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 @@ -1065,4 +1065,8 @@ div.configureSaveForm div.configureLogEntryHelp {
}
.foswikiJSRequired {
display:none;
}
}
.foswikiNonJS {
}
.configureHasTestImage {
}

0 comments on commit 9f2eeb2

Please sign in to comment.