Skip to content

Commit

Permalink
Merge branch 'master' into Item14288
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Mar 15, 2017
2 parents 6f3164a + 847e815 commit 523e393
Show file tree
Hide file tree
Showing 42 changed files with 648 additions and 230 deletions.
4 changes: 2 additions & 2 deletions TopicUserMappingContrib/data/System/RemoveUser.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1482953205" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1489457633" format="1.1" version="1"}%
%META:TOPICPARENT{name="AdminToolsCategory"}%
---+ %MAKETEXT{"Remove User"}%

Expand All @@ -24,7 +24,7 @@ The existence of the <nop>UserName topic should also prevent that username from
<verbatim class="foswikiHidden">
%STARTSECTION{"removeUser"}%
<!-- %JQREQUIRE{"ui, ui::autocomplete"}% -->
<form name="admin" action="%SCRIPTURLPATH{manage}%/%BASEWEB%/%BASETOPIC%" method="post">
<form name="admin" action="%SCRIPTURLPATH{"manage" topic="%BASEWEB%.%BASETOPIC%"}%" method="post">
<div class="foswikiFormSteps">
<div class="foswikiFormStep">
---++++!! Enter user to be removed
Expand Down
Expand Up @@ -289,7 +289,17 @@ sub std_tests {

#TODO: redo this with custom tmpl and check each username
my $output;
if ( $this->check_dependency('Foswiki,>=,1.2') ) {
if ( $this->check_dependency('Foswiki,>=,2.1.999') ) {
$output = <<'THIS';
%TMPL:P{"settmltablesummary"
SUMMARY="%MAKETEXT{"Attachments"}%"
}%<div class="foswikiAttachments">
| *I* | *%MAKETEXT{"Attachment"}%* | *%MAKETEXT{"Action"}%* | *%MAKETEXT{"Size"}%* | *%MAKETEXT{"Date"}%* | *%MAKETEXT{"Who"}%* | *%MAKETEXT{"Comment"}%* |
| %ICON{"home.org.au.png" default="else"}%<span class="foswikiHidden">png</span> | <a href="%ATTACHURLPATH%/%ENCODE{home.org.au.png}%"><noautolink>home.org.au.png</noautolink></a> | <a href='%SCRIPTURLPATH{"attach" topic="%WEB%.%TOPIC%" filename="home.org.au.png" revInfo="1"}%' title="%MAKETEXT{"change, update, previous revisions, move, delete..."}%" rel="nofollow">%MAKETEXT{"manage"}%</a> | 4 K|<span class="foswikiNoBreak">31 May 2007 - 21:58</span> |TemporaryTopicUserMappingContribTestsUsersWeb.JoeDoe | |
</div>
THIS
}
elsif ( $this->check_dependency('Foswiki,>=,1.2') ) {
$output = <<'THIS';
%TMPL:P{"settmltablesummary"
SUMMARY="%MAKETEXT{"Attachments"}%"
Expand Down
46 changes: 46 additions & 0 deletions UnitTestContrib/test/unit/AttrsTests.pm
Expand Up @@ -60,6 +60,36 @@ sub test_default {
$this->assert( $attrs->isEmpty() );
}

sub test_anchor_friendly {
my $this = shift;

my $attrs =
Foswiki::Attrs->new(
"var1=val1 var2= val2, var3 = 3 var4 =val4 #=blah a#a=1#1", 1 );
$this->assert_str_equals( "val1", $attrs->remove("var1") );
$this->assert_str_equals( "val2", $attrs->remove("var2") );
$this->assert_str_equals( "3", $attrs->remove("var3") );
$this->assert_str_equals( "val4", $attrs->remove("var4") );
$this->assert_str_equals( "blah", $attrs->remove("#") );
$this->assert_str_equals( "1#1", $attrs->remove("a#a") );
$this->assert( $attrs->isEmpty() );
}

sub test_anchor_unfriendly {
my $this = shift;

my $attrs =
Foswiki::Attrs->new(
'var1="val1" var2=" val2" var3="3" var4="val4" #="blah" a#a="1#1"', 0 );
$this->assert_str_equals( "val1", $attrs->remove("var1") );
$this->assert_str_equals( " val2", $attrs->remove("var2") );
$this->assert_str_equals( "3", $attrs->remove("var3") );
$this->assert_str_equals( "val4", $attrs->remove("var4") );
$this->assert_str_equals( "blah", $attrs->remove("#") );
$this->assert_str_equals( "1#1", $attrs->remove("a#a") );
$this->assert( $attrs->isEmpty() );
}

sub test_unquoted {
my $this = shift;

Expand Down Expand Up @@ -123,6 +153,22 @@ sub test_mixedQuotes {
$this->assert( $attrs->isEmpty() );
}

sub test_mixedAlpha {
my $this = shift;

my $attrs =
Foswiki::Attrs->new( "aa = AA AA = aa Aa ='\"', bB=\"'\" \"'\"", 1 );
$this->assert_str_equals( "\"", $attrs->remove("Aa") );
$this->assert_str_equals( "'", $attrs->remove("bB") );
$this->assert_str_equals( "aa", $attrs->remove("AA") );
$this->assert_str_equals( "AA", $attrs->remove("aa") );
$this->assert_str_equals( "'", $attrs->remove("_DEFAULT") );
$this->assert( $attrs->isEmpty() );
$attrs = Foswiki::Attrs->new( "'\"'", 1 );
$this->assert_str_equals( "\"", $attrs->remove("_DEFAULT") );
$this->assert( $attrs->isEmpty() );
}

sub test_toString {
my $this = shift;

Expand Down
105 changes: 95 additions & 10 deletions UnitTestContrib/test/unit/Fn_SCRIPTURL.pm
Expand Up @@ -15,7 +15,7 @@ sub new {
return $self;
}

sub test_SCRIPTURL {
sub test_SCRIPTURL_view {
my $this = shift;

$Foswiki::cfg{ScriptUrlPaths}{snarf} = "sausages";
Expand Down Expand Up @@ -45,32 +45,117 @@ sub test_SCRIPTURL {
"$Foswiki::cfg{ScriptUrlPath}/view.dot/Main/WebHome?web=System",
$result );

# SMELL: rest and jsonrpc cannot built the path automatically. Ignore all params.
$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"jsonrpc\" topic=\"Main.WebHome\" web=\"System\"}%");
$this->assert_str_equals(
"<div class='foswikiAlert'>jsonrpc requires the 'namespace' parameter if other parameters are supplied.</div>",
$result
);

# Web is used if topic contains no web, remove from query string.
$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"view\" topic=\"WebHome\" web=\"System\"}%");
$this->assert_str_equals(
"$Foswiki::cfg{ScriptUrlPath}/view.dot/System/WebHome", $result );

$result = $this->{test_topicObject}->expandMacros("%SCRIPTURLPATH{snarf}%");
$this->assert_str_equals( "sausages", $result );

# anchor parameter # is added as a fragment.
$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"view\" topic=\"Main.WebHome\" #=\"frag\"}%");
$this->assert_str_equals(
$Foswiki::cfg{ScriptUrlPath} . '/view.dot/Main/WebHome#frag', $result );

# Use of # anywhere but the anchor tag is encoded.
$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"view\" topic=\"Main.WebHome\" #=\"frag\" A#A=\"another\"}%"
);
$this->assert_str_equals(
$Foswiki::cfg{ScriptUrlPath}
. '/view.dot/Main/WebHome?A%23A=another#frag',
$result
);
}

sub test_SCRIPTURL_rest {
my $this = shift;

$Foswiki::cfg{ScriptUrlPaths}{snarf} = "sausages";
undef $Foswiki::cfg{ScriptUrlPaths}{view};
$Foswiki::cfg{ScriptSuffix} = ".dot";

my $result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"rest\" topic=\"Main.WebHome\" web=\"System\"}%");
$this->assert_str_equals(
"<div class='foswikiAlert'>Parameters are not supported when generating rest or jsonrpc URLs.</div>",
"<div class='foswikiAlert'>rest requires both 'subject' and 'verb' parameters if other parameters are supplied.</div>",
$result
);

$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"rest\" subject=\"Weeble\" topic=\"Main.WebHome\" web=\"System\"}%"
);
$this->assert_str_equals(
"<div class='foswikiAlert'>rest requires both 'subject' and 'verb' parameters if other parameters are supplied.</div>",
$result
);

$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"rest\" subject=\"Weeble\" verb=\"wobble\" topic=\"Main.WebHome\" web=\"System\"}%"
);
$this->assert_str_equals(
"$Foswiki::cfg{ScriptUrlPath}/rest.dot/Weeble/wobble?topic=Main.WebHome;web=System",
$result
);
}

sub test_SCRIPTURL_jsonrpc {
my $this = shift;

$Foswiki::cfg{ScriptUrlPaths}{snarf} = "sausages";
undef $Foswiki::cfg{ScriptUrlPaths}{view};
$Foswiki::cfg{ScriptSuffix} = ".dot";

my $result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"jsonrpc\" topic=\"Main.WebHome\" web=\"System\"}%");
$this->assert_str_equals(
"<div class='foswikiAlert'>Parameters are not supported when generating rest or jsonrpc URLs.</div>",
"<div class='foswikiAlert'>jsonrpc requires the 'namespace' parameter if other parameters are supplied.</div>",
$result
);

# Web is used if topic contains no web, remove from query string.
$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"view\" topic=\"WebHome\" web=\"System\"}%");
"%SCRIPTURLPATH{\"jsonrpc\" namespace=\"Weeble\" topic=\"Main.WebHome\" web=\"System\"}%"
);
$this->assert_str_equals(
"$Foswiki::cfg{ScriptUrlPath}/view.dot/System/WebHome", $result );
"$Foswiki::cfg{ScriptUrlPath}/jsonrpc.dot/Weeble?topic=Main.WebHome;web=System",
$result
);

$result = $this->{test_topicObject}->expandMacros("%SCRIPTURLPATH{snarf}%");
$this->assert_str_equals( "sausages", $result );
}
$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"jsonrpc\" namespace=\"Weeble\" method=\"wobble\" topic=\"Main.WebHome\" web=\"System\"}%"
);
$this->assert_str_equals(
"$Foswiki::cfg{ScriptUrlPath}/jsonrpc.dot/Weeble/wobble?topic=Main.WebHome;web=System",
$result
);

$result =
$this->{test_topicObject}->expandMacros(
"%SCRIPTURLPATH{\"jsonrpc\" namespace=\"Weeble\" method=\"wobble\" topic=\"Main.WebHome\" web=\"System\"}%"
);
$this->assert_str_equals(
"$Foswiki::cfg{ScriptUrlPath}/jsonrpc.dot/Weeble/wobble?topic=Main.WebHome;web=System",
$result
);
}
1;
8 changes: 5 additions & 3 deletions UnitTestContrib/test/unit/UploadScriptTests.pm
Expand Up @@ -547,7 +547,8 @@ sub test_propschanges {
hidefile => 1,
filecomment => 'Educate the hedgehog',
createlink => 1,
linkformat => '\n * [[%ATTACHURL%/$fileurl][$filename]]: $comment',
linkformat =>
'\n * [[$percentATTACHURL$percent/$fileurl][$filename]]: $comment',
changeproperties => 1
);
$this->assert_matches( qr/^Status: 302/ms, $result );
Expand Down Expand Up @@ -590,7 +591,8 @@ sub test_linkformat {
hidefile => 1,
filecomment => 'Educate the hedgehog',
createlink => 1,
linkformat => '\n * [[%ATTACHURL%/$fileurl][$filename]]: $comment',
linkformat =>
'\n * [[$percntATTACHURL$percnt/$fileurl][$filename]]: $comment',
changeproperties => 1
);
$this->assert_matches( qr/^Status: 302/ms, $result );
Expand All @@ -612,7 +614,7 @@ qr/^ \* \[\[%ATTACHURL%\/Flappadoodle\.txt\]\[Flappadoodle\.txt\]\]: Educate t
filecomment => 'Wikiworld',
createlink => 1,
linkformat =>
'$n |$year-$mo $wday|Effort $lt-- |[[%ATTACHURL%/$name][%ICON{$fileext}% $name]]| received from $comment |',
'$n |$year-$mo $wday|Effort $lt-- |[[$percntATTACHURL$percnt/$name][$percntICON{$fileext}$percnt $name]]| received from $comment |',
changeproperties => 1
);
$this->assert_matches( qr/^Status: 302/ms, $result );
Expand Down
6 changes: 3 additions & 3 deletions core/data/Main/AdminUserLeftBar.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1421599902" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1489206078" format="1.1" version="1"}%
%META:TOPICPARENT{name="AdminUser"}%
%ADDTOZONE{
"head"
Expand All @@ -16,7 +16,7 @@ Customise this topic; samples and ideas available at
%SYSTEMWEB%.WebLeftBarCookbook.
--> *My links:*
* [[%USERSWEB%.AdminUser][My home page]]
* [[%SCRIPTURL{search}%/%BASEWEB%/%HOMETOPIC%?search=AdminUser;type=word;scope=text;reverse=on;casesensitive=on;order=modified;limit=50;zeroresults=on][AdminUser %BASEWEB% activities]]
* [[%SCRIPTURLPATH{"search" topic="%BASEWEB%.WebSearch" search="AdminUser" type="word" scope="text" reverse="on" casesensitive="on" order="modified" limit="50" zeroresults="on"}%][AdminUser %BASEWEB% activities]]
* [[%LOGOUTURL%][Logout]]
<a class="foswikiSmallish" href="%SCRIPTURLPATH{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%">edit</a>
<a class='foswikiSmallish' href='%SCRIPTURLPATH{"edit" topic="%WEB%.%TOPIC%" t="%GMTIME{"$epoch"}%"}%'>edit</a>

4 changes: 2 additions & 2 deletions core/data/Main/WikiGroups.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1300572565" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1489206078" format="1.1" version="1"}%
%META:TOPICPARENT{name="WebHome"}%
---+ Wiki groups dashboard
Showing all known groups that can be used to define [[%SYSTEMWEB%.AccessControl][access controls]] in <nop>%WIKITOOLNAME%.
Expand All @@ -20,7 +20,7 @@ With this enabled, adding and removing members and also topic upgrades for each
}%

<sticky>
<form action="%SCRIPTURLPATH{"manage"}%/%WEB%/%TOPIC%" method="post">
<form action='%SCRIPTURLPATH{"manage" topic="%WEB%.%TOPIC%"}%' method='post'>
<input type="hidden" name="action" value="addUserToGroup"/>
<input type="hidden" name="create" value="1"/>
<div class="foswikiFormSteps">
Expand Down
6 changes: 3 additions & 3 deletions core/data/System/AccessControl.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1457197356" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1489206078" format="1.1" version="1"}%
%META:TOPICPARENT{name="UserDocumentationCategory"}%
%STARTINCLUDE%
---+ Access Control
Expand Down Expand Up @@ -304,7 +304,7 @@ If needed, you can further restrict access to selected webs with ALLOWWEBVIEW an
---++++ When using Template Login

[[UserAuthentication#TemplateLogin][User authentication with TemplateLogin]] is enabled on your site. To require login for *all* scripts:
* Add all scripts in the =foswiki/bin= directory (except for =login=, =logon=) to the list of ={AuthScripts}= in [[%SCRIPTURL{"configure"}%][configure]], =Security And Authentication= tab, =Login= sub-tab, For a default Foswiki installation:
* Add all scripts in the =foswiki/bin= directory (except for =jsonrpc=, =login= and =logon=) to the list of ={AuthScripts}= in [[%SCRIPTURLPATH{"configure"}%][configure]], =Security And Authentication= tab, =Login= sub-tab, For a default Foswiki installation:

* Default (open) site:
<verbatim>
Expand Down Expand Up @@ -350,7 +350,7 @@ Use the following setup is used to "lock down" the Wiki to logged in users, whil
---+++ Control access to topic History and Raw text.

Foswiki 2.0 now restricts the guest user from access to topic history and raw topic text. This is configurable. See:
[[%SCRIPTURLPATH{configure}][configure]] =Security and Authentication > Access Control > {FeatureAccess}{AllowRaw}= and ={FeatureAccess}{AllowHistory}= (They are expert level settings, so the "Show expert options" button in the lower left corner must be pressed.)
[[%SCRIPTURLPATH{"configure"}][configure]] =Security and Authentication > Access Control > {FeatureAccess}{AllowRaw}= and ={FeatureAccess}{AllowHistory}= (They are expert level settings, so the "Show expert options" button in the lower left corner must be pressed.)

Each of these setting has 3 choices:
* =authenticated= - This is the default. Anyone who is logged in has access
Expand Down
4 changes: 2 additions & 2 deletions core/data/System/AppendixCascadingStyleSheets.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1437331638" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1489206078" format="1.1" version="1"}%
%META:TOPICPARENT{name="DeveloperDocumentationCategory"}%
%STARTINCLUDE%
---+ Appendix C: CSS
Expand Down Expand Up @@ -214,7 +214,7 @@ Markers to invoke behaviour with unobtrusive !JavaScript.
#TestFoswikiFocus
---++++ Troubleshooting foswikiFocus
* Test for loading error of focus plugin (no message means ok): %JQREQUIRE{"focus"}%
* [[%SCRIPTURL{view}%/%WEB%/%TOPIC%?testfocus=1#TestFoswikiFocus][Test foswikiFocus]]
* [[%SCRIPTURLPATH{"view" topic="%WEB%.%TOPIC%" testfocus="1"}%#TestFoswikiFocus][Test foswikiFocus]]

%IF{"$'URLPARAM{testfocus}'='1'" then="
$percntJQREQUIRE{$quotfocus$quot}$percnt
Expand Down

0 comments on commit 523e393

Please sign in to comment.