From: <de...@de...> - 2008-06-29 00:35:49
|
Author: GilmarSantosJr Date: 2008-06-28 19:35:55 -0500 (Sat, 28 Jun 2008) New Revision: 16949 Trac url: http://develop.twiki.org/trac/changeset/16949 Added: twiki/scratch/TWikiStandAlone/PatternSkin/templates/form.pattern.tmpl Modified: twiki/scratch/TWikiStandAlone/ twiki/scratch/TWikiStandAlone/ClassicSkin/templates/edit.classic.tmpl twiki/scratch/TWikiStandAlone/ClassicSkin/templates/twiki.classic.tmpl twiki/scratch/TWikiStandAlone/EditTablePlugin/test/unit/EditTablePlugin/EditTablePluginTests.pm twiki/scratch/TWikiStandAlone/PatternSkin/lib/TWiki/Contrib/PatternSkin/MANIFEST twiki/scratch/TWikiStandAlone/PatternSkin/templates/twiki.pattern.tmpl twiki/scratch/TWikiStandAlone/TWikiUserMappingContrib/test/unit/TWikiUserMappingContrib/TWikiUserMappingTests.pm twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/FuncUsersTests.pm twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/RenderFormTests.pm twiki/scratch/TWikiStandAlone/core/data/TWiki/TWikiScripts.txt twiki/scratch/TWikiStandAlone/core/lib/TWiki/Response.pm twiki/scratch/TWikiStandAlone/core/lib/TWiki/Store/RcsFile.pm twiki/scratch/TWikiStandAlone/core/templates/changeform.tmpl twiki/scratch/TWikiStandAlone/core/templates/twiki.tmpl Log: Item4662: merge from trunk, rev 16948; Minor Fixes; Wysiwyg still broken :( Property changes on: twiki/scratch/TWikiStandAlone ___________________________________________________________________ Name: svk:merge - 60094016-2702-0410-bb0b-b63eed92a26c:/tp/local:3519 a00a5322-12db-0310-a70b-8735589c885e:/twiki/branches/DEVELOP/twikiplugins:8663 a00a5322-12db-0310-a70b-8735589c885e:/twiki/branches/MAIN/twikiplugins:16408 a00a5322-12db-0310-a70b-8735589c885e:/twiki/branches/TWikiRelease04x00/twikiplugins:11683 a00a5322-12db-0310-a70b-8735589c885e:/twiki/trunk:16912 + 60094016-2702-0410-bb0b-b63eed92a26c:/tp/local:3519 a00a5322-12db-0310-a70b-8735589c885e:/twiki/branches/DEVELOP/twikiplugins:8663 a00a5322-12db-0310-a70b-8735589c885e:/twiki/branches/MAIN/twikiplugins:16408 a00a5322-12db-0310-a70b-8735589c885e:/twiki/branches/TWikiRelease04x00/twikiplugins:11683 a00a5322-12db-0310-a70b-8735589c885e:/twiki/trunk:16948 Modified: twiki/scratch/TWikiStandAlone/ClassicSkin/templates/edit.classic.tmpl =================================================================== --- twiki/scratch/TWikiStandAlone/ClassicSkin/templates/edit.classic.tmpl 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/ClassicSkin/templates/edit.classic.tmpl 2008-06-29 00:35:55 UTC (rev 16949) @@ -48,7 +48,7 @@ %TMPL:P{"topicinfo"}%</form>%TMPL:END% -%TMPL:DEF{"topicaction"}% <input type="submit" class="twikiSubmit" name="action_cancel" value="Cancel" id="cancel" onclick="suppressTWikiSaveValidation()" />%TMPL:P{"sep"}% <input type="submit" class="twikiSubmit" name="action_checkpoint" value="Save and Continue" id="checkpoint" /> +%TMPL:DEF{"topicactionbuttons"}% <input type="submit" class="twikiSubmit" name="action_cancel" value="Cancel" id="cancel" onclick="suppressTWikiSaveValidation()" /> %TMPL:P{"sep"}% <input type="submit" class="twikiSubmit" name="action_checkpoint" value="Save and Continue" id="checkpoint" /> <input type="submit" class="twikiSubmit" name="action_quietsave" value="QuietSave" id="quietsave" /> <input type="submit" class="twikiSubmit" name="action_save" value="Save" id="save" />%TMPL:P{"sep"}% <input type="submit" class="twikiSubmit" name="action_preview" value="Preview" id="preview" />%TMPL:END% Modified: twiki/scratch/TWikiStandAlone/ClassicSkin/templates/twiki.classic.tmpl =================================================================== --- twiki/scratch/TWikiStandAlone/ClassicSkin/templates/twiki.classic.tmpl 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/ClassicSkin/templates/twiki.classic.tmpl 2008-06-29 00:35:55 UTC (rev 16949) @@ -38,6 +38,7 @@ <meta name="SCRIPTURLPATH" content="%SCRIPTURLPATH%" /> <meta name="SCRIPTSUFFIX" content="%SCRIPTSUFFIX%" /> <link rel="icon" href="%FAVICON%" type="image/x-icon" /> <link rel="shortcut icon" href="%FAVICON%" type="image/x-icon" /> + <link rel="alternate" href="%SCRIPTURL{edit}%/%BASEWEB%/%BASETOPIC%?_T=%DATE%" type="application/x-wiki" title="edit %BASETOPIC%" /> <base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%"></base> %TMPL:P{"script"}% %TMPL:P{"twikistyle"}% Modified: twiki/scratch/TWikiStandAlone/EditTablePlugin/test/unit/EditTablePlugin/EditTablePluginTests.pm =================================================================== --- twiki/scratch/TWikiStandAlone/EditTablePlugin/test/unit/EditTablePlugin/EditTablePluginTests.pm 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/EditTablePlugin/test/unit/EditTablePlugin/EditTablePluginTests.pm 2008-06-29 00:35:55 UTC (rev 16949) @@ -357,8 +357,8 @@ my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body(TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); $this->assert( $saveResult =~ /Status: 302/ ); @@ -660,8 +660,8 @@ my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body( TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); @@ -726,8 +726,8 @@ my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body( TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); @@ -790,8 +790,8 @@ $TWiki::Plugins::SESSION = $twiki; my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body(TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); my ( $meta, $newtext ) = TWiki::Func::readTopic( $webName, $topicName ); @@ -848,8 +848,8 @@ $TWiki::Plugins::SESSION = $twiki; my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body(TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); my ( $meta, $newtext ) = TWiki::Func::readTopic( $webName, $topicName ); @@ -908,8 +908,8 @@ $TWiki::Plugins::SESSION = $twiki; my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body(TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); my ( $meta, $newtext ) = TWiki::Func::readTopic( $webName, $topicName ); @@ -1001,8 +1001,8 @@ $TWiki::Plugins::SESSION = $twiki; my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body(TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); my ( $meta, $newtext ) = TWiki::Func::readTopic( $webName, $topicName ); @@ -1054,8 +1054,8 @@ $TWiki::Plugins::SESSION = $twiki; my ( $saveResult, $ecode ) = $this->capture( sub { - print TWiki::Func::expandCommonVariables( $input, - $this->{test_topic}, $this->{test_web}, undef ); + $twiki->{response}->body(TWiki::Func::expandCommonVariables( $input, + $this->{test_topic}, $this->{test_web}, undef ) ); } ); my ( $meta, $newtext ) = TWiki::Func::readTopic( $webName, $topicName ); Modified: twiki/scratch/TWikiStandAlone/PatternSkin/lib/TWiki/Contrib/PatternSkin/MANIFEST =================================================================== --- twiki/scratch/TWikiStandAlone/PatternSkin/lib/TWiki/Contrib/PatternSkin/MANIFEST 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/PatternSkin/lib/TWiki/Contrib/PatternSkin/MANIFEST 2008-06-29 00:35:55 UTC (rev 16949) @@ -86,6 +86,7 @@ templates/changes.pattern.tmpl 0444 templates/css.pattern.tmpl 0444 templates/edit.pattern.tmpl 0444 +templates/form.pattern.tmpl 0444 templates/formtables.pattern.tmpl 0444 templates/login.pattern.tmpl 0444 templates/oops.pattern.tmpl 0444 Added: twiki/scratch/TWikiStandAlone/PatternSkin/templates/form.pattern.tmpl =================================================================== --- twiki/scratch/TWikiStandAlone/PatternSkin/templates/form.pattern.tmpl (rev 0) +++ twiki/scratch/TWikiStandAlone/PatternSkin/templates/form.pattern.tmpl 2008-06-29 00:35:55 UTC (rev 16949) @@ -0,0 +1,2 @@ +%TMPL:INCLUDE{"form"}% +%TMPL:DEF{"changeform"}%<input type="submit" name="action_replaceform" value='%MAKETEXT{"Replace form..."}%' class="twikiChangeFormButton twikiButton" onclick="suppressTWikiSaveValidation()" />%TMPL:END% Modified: twiki/scratch/TWikiStandAlone/PatternSkin/templates/twiki.pattern.tmpl =================================================================== --- twiki/scratch/TWikiStandAlone/PatternSkin/templates/twiki.pattern.tmpl 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/PatternSkin/templates/twiki.pattern.tmpl 2008-06-29 00:35:55 UTC (rev 16949) @@ -29,6 +29,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=%CHARSET%" /> <link rel="icon" href="%FAVICON%" type="image/x-icon" /> <link rel="shortcut icon" href="%FAVICON%" type="image/x-icon" /> +<link rel="alternate" href="%SCRIPTURL{edit}%/%BASEWEB%/%BASETOPIC%?_T=%DATE%" type="application/x-wiki" title="edit %BASETOPIC%" /> <meta name="SCRIPTURLPATH" content="%SCRIPTURLPATH%" /> <meta name="SCRIPTSUFFIX" content="%SCRIPTSUFFIX%" /> <meta name="TEXT_JUMP" content="%MAKETEXT{"Jump"}%" /> @@ -69,4 +70,4 @@ %TMPL:DEF{"bodyend"}%</body></html>%TMPL:END% -%TMPL:DEF{"textareabuttons"}%<span class="twikiRight twikiMakeVisible" style="text-align:left;"><span class="twikiLeft patternTextareaButton patternButtonFontSelector" title="%MAKETEXT{"Switch to monotype or propotional font"}%"> </span><span class="twikiLeft patternTextareaButton patternButtonEnlarge" title="%MAKETEXT{"Enlarge edit box"}%"> </span><span class="twikiLeft patternTextareaButton patternButtonShrink" title="%MAKETEXT{"Shrink edit box"}%"> </span></span>%TMPL:END% \ No newline at end of file +%TMPL:DEF{"textareabuttons"}%<span class="twikiRight twikiMakeVisible" style="text-align:left;"><span class="twikiLeft patternTextareaButton patternButtonFontSelector" title="%MAKETEXT{"Switch to monotype or propotional font"}%"> </span><span class="twikiLeft patternTextareaButton patternButtonEnlarge" title="%MAKETEXT{"Enlarge edit box"}%"> </span><span class="twikiLeft patternTextareaButton patternButtonShrink" title="%MAKETEXT{"Shrink edit box"}%"> </span></span>%TMPL:END% Modified: twiki/scratch/TWikiStandAlone/TWikiUserMappingContrib/test/unit/TWikiUserMappingContrib/TWikiUserMappingTests.pm =================================================================== --- twiki/scratch/TWikiStandAlone/TWikiUserMappingContrib/test/unit/TWikiUserMappingContrib/TWikiUserMappingTests.pm 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/TWikiUserMappingContrib/test/unit/TWikiUserMappingContrib/TWikiUserMappingTests.pm 2008-06-29 00:35:55 UTC (rev 16949) @@ -219,9 +219,10 @@ $twiki->{users}->{mapping}->addUser( "auser","AaronUser", $me); $twiki->{users}->{mapping}->addUser( "guser","GeorgeUser", $me); $twiki->{users}->{mapping}->addUser( "zuser","ZebediahUser", $me); + $twiki->{users}->{mapping}->addUser( "scum","ScumUser", $me); $twiki->{store}->saveTopic( $twiki->{user}, $testUsersWeb, 'AmishGroup', - " * Set GROUP = AaronUser,%USERSWEB%.GeorgeUser\n"); + " * Set GROUP = AaronUser,%MAINWEB%.GeorgeUser, scum\n"); $twiki->{store}->saveTopic( $twiki->{user}, $testUsersWeb, 'BaptistGroup', " * Set GROUP = GeorgeUser,$testUsersWeb.ZebediahUser\n"); @@ -246,7 +247,7 @@ my @l = (); while ($i->hasNext()) { push(@l, $i->next()) }; my $k = join(',', map{$twiki->{users}->getLoginName($_)} sort @l); - $this->assert_str_equals("auser,guser", $k); + $this->assert_str_equals("auser,guser,scum", $k); $g = "BaptistGroup"; $this->assert($twiki->{users}->isGroup($g)); Modified: twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/FuncUsersTests.pm =================================================================== --- twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/FuncUsersTests.pm 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/FuncUsersTests.pm 2008-06-29 00:35:55 UTC (rev 16949) @@ -1,6 +1,8 @@ +package FuncUsersTests; + use strict; +use warnings; -package FuncUsersTests; # Some basic tests for adding/removing users in the TWiki users topic, # and finding them again. @@ -30,6 +32,7 @@ $loginname{UserC} = 'userc'; $loginname{NonExistantuser} = 'nonexistantuser'; $loginname{ScumBag} = 'scum'; + $loginname{UserZ} = 'userz'; } sub DontAllowLoginName { my $this = shift; @@ -41,6 +44,7 @@ $loginname{UserC} = 'UserC'; $loginname{NonExistantuser} = 'NonExistantuser'; $loginname{ScumBag} = 'scum'; #the scum user was registered _before_ these options in the base class + $loginname{UserZ} = 'UserZ'; } sub TemplateLoginManager { @@ -115,6 +119,10 @@ #$this->registerUser('86usera', '86User', 'A', 'us...@ex...'); $this->registerUser($loginname{UserB}, 'User', 'B', 'us...@ex...'); $this->registerUser($loginname{UserC}, 'User', 'C', 'us...@ex...;us...@ex...'); + + $this->registerUser($loginname{UserZ}, 'User', 'Z', 'us...@ex...'); + + $this->{twiki}->{store}->saveTopic( $this->{twiki}->{user}, $this->{users_web}, 'AandBGroup', @@ -130,7 +138,7 @@ $this->{twiki}->{store}->saveTopic( $this->{twiki}->{user}, $this->{users_web}, 'ScumGroup', - " * Set GROUP = UserA, $TWiki::cfg{DefaultUserWikiName}"); + " * Set GROUP = UserA, $TWiki::cfg{DefaultUserWikiName}, $loginname{UserZ}"); $this->{twiki}->{store}->saveTopic( $this->{twiki}->{user}, $this->{users_web}, $TWiki::cfg{SuperAdminGroup}, @@ -189,7 +197,7 @@ if ($TWiki::cfg{UserMappingManager} eq 'TWiki::Users::BaseUserMapping') { @correctList = qw/TWikiContributor TWikiGuest TWikiRegistrationAgent UnknownUser/; } else { - @correctList = qw/TWikiContributor TWikiGuest TWikiRegistrationAgent UnknownUser User86A UserA UserA86 UserB UserC/; + @correctList = qw/TWikiContributor TWikiGuest TWikiRegistrationAgent UnknownUser User86A UserA UserA86 UserB UserC UserZ/; if ($TWiki::cfg{Register}{AllowLoginName} == 1) { push @correctList, 'ScumBag'; # this user is created in the base class with the assumption of AllowLoginName } else { @@ -284,6 +292,10 @@ $this->assert(TWiki::Func::isGroupMember('BandCGroup', 'UserB')); $this->assert(TWiki::Func::isGroupMember('BandCGroup', 'UserC')); $this->assert(TWiki::Func::isGroupMember('ScumGroup', 'TWikiGuest')); + + $this->assert(TWiki::Func::isGroupMember('ScumGroup', 'UserZ')); + $this->assert(TWiki::Func::isGroupMember('ScumGroup', $loginname{UserZ})); + } sub verify_eachMembership { @@ -319,6 +331,23 @@ push(@list, $g); } $this->assert_str_equals('TWikiBaseGroup,ScumGroup', sort join(',', @list)); + + $it = TWiki::Func::eachMembership($loginname{UserZ}); + @list = (); + while ($it->hasNext()) { + my $g = $it->next(); + push(@list, $g); + } + $this->assert_str_equals('ScumGroup', sort join(',', @list)); + + $it = TWiki::Func::eachMembership('UserZ'); + @list = (); + while ($it->hasNext()) { + my $g = $it->next(); + push(@list, $g); + } + $this->assert_str_equals('ScumGroup', sort join(',', @list)); + } sub verify_eachMembershipDefault { @@ -349,7 +378,7 @@ my $g = $it->next(); push(@list, $g); } - $this->assert_str_equals("UserA,$TWiki::cfg{DefaultUserWikiName}", sort join(',', @list)); + $this->assert_str_equals("UserA,$TWiki::cfg{DefaultUserWikiName},UserZ", sort join(',', @list)); } @@ -471,7 +500,7 @@ #$TWiki::cfg{RenderLoggedInButUnknownUsers} is false, or undefined $this->assert_str_equals('TWikiUserMapping_NonExistantUser', TWiki::Func::getWikiName('TWikiUserMapping_NonExistantUser')); my $nonexistantuser_cUID = $this->{twiki}->{users}->getCanonicalUserID($loginname{NonExistantuser}); - $this->annotate($nonexistantuser_cUID); #returns guest + $this->annotate($nonexistantuser_cUID); #returns guest $this->assert_str_equals($TWiki::cfg{DefaultUserWikiName}, TWiki::Func::getWikiName($nonexistantuser_cUID)); $this->assert_str_equals($loginname{NonExistantuser}, TWiki::Func::getWikiName($loginname{NonExistantuser})); $this->assert_str_equals('NonExistantUser', TWiki::Func::getWikiName('NonExistantUser')); @@ -529,7 +558,7 @@ #TODO: consider how to render unkown user's $this->assert_str_equals($TWiki::cfg{UsersWebName}.'.'.'NonExistantUserAsdf', TWiki::Func::getWikiUserName('NonExistantUserAsdf')); my $nonexistantuser_cUID = $this->{twiki}->{users}->getCanonicalUserID('nonexistantuserasdf'); - $this->annotate($nonexistantuser_cUID); #returns guest + $this->annotate($nonexistantuser_cUID); #returns guest $this->assert_str_equals($TWiki::cfg{UsersWebName}.'.'.$TWiki::cfg{DefaultUserWikiName}, TWiki::Func::getWikiUserName($nonexistantuser_cUID)); $this->assert_str_equals($TWiki::cfg{UsersWebName}.'.'.'nonexistantuserasdf', TWiki::Func::getWikiUserName('nonexistantuserasdf')); $this->assert_str_equals($TWiki::cfg{UsersWebName}.'.'.'nonexistantuserasdfqwer', TWiki::Func::getWikiUserName('nonexistantuserasdfqwer')); Modified: twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/RenderFormTests.pm =================================================================== --- twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/RenderFormTests.pm 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/UnitTestContrib/test/unit/RenderFormTests.pm 2008-06-29 00:35:55 UTC (rev 16949) @@ -237,7 +237,7 @@ my $expected = <<HERE; <div class="twikiForm twikiEditForm"><table class="twikiFormTable"> <tr> -<th class="twikiFormTableHRow" colspan="2"><a rel="nofollow" target="InitializationForm" href="%VIEWURL%/TemporaryRenderFormTestsTestWebRenderFormTests/InitializationForm" title="Details in separate window" onclick="return launchWindow("TemporaryRenderFormTestsTestWebRenderFormTests","InitializationForm")">TemporaryRenderFormTestsTestWebRenderFormTests.InitializationForm</a> <input type="submit" name="action_replaceform" value='Replace form...' class="twikiChangeFormButton twikiButton" /></th> +<th class="twikiFormTableHRow" colspan="2"><a rel="nofollow" target="InitializationForm" href="%VIEWURL%/TemporaryRenderFormTestsTestWebRenderFormTests/InitializationForm" title="Details in separate window" onclick="return launchWindow("TemporaryRenderFormTestsTestWebRenderFormTests","InitializationForm")">TemporaryRenderFormTestsTestWebRenderFormTests.InitializationForm</a> <input type="submit" name="action_replaceform" value='Replace form...' class="twikiChangeFormButton twikiButton" onclick="suppressTWikiSaveValidation()" /></th> </tr> <tr><th align="right">Issue Name</th><td align="left"><input type="text" name="IssueName" value="_An issue_" size="40" class="twikiInputField twikiEditFormTextField" /></td></tr> <tr><th align="right">State</th><td align="left"><table><tr><td><label><input type="radio" name="State" value="none" label="none" class="twikiRadioButton twikiEditFormRadioField"/>none</label></td></tr></table></td></tr> Modified: twiki/scratch/TWikiStandAlone/core/data/TWiki/TWikiScripts.txt =================================================================== --- twiki/scratch/TWikiStandAlone/core/data/TWiki/TWikiScripts.txt 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/core/data/TWiki/TWikiScripts.txt 2008-06-29 00:35:55 UTC (rev 16949) @@ -61,7 +61,7 @@ | =action= | Optional. Use the editaction template instead of the standard edit. If action=text, then hide the form. If action=form hide the normal text area and only edit the form. | | | =onlynewtopic= | If set, error if topic already exists | | | =onlywikiname= | If set, error if topic name is not a WikiWord | | -| =templatetopic= | The name of the template topic, copied to get the initial content | | +| =templatetopic= | The name of the template topic, copied to get the initial content (new topic _only_) | | | =text= | Initial text for the topic | | | =topicparent= | The parent topic | | | =formtemplate= | Name of the form to instantiate in the topic. Overrides the form set in the =templatetopic= if defined. (will remove the form is set to 'none') | | @@ -232,7 +232,7 @@ | =onlynewtopic= | If set, error if topic already exists | | | =onlywikiname= | If set, error if topic name is not a WikiWord | | | =dontnotify= | if defined, suppress change notification | | -| =templatetopic= | Name of a topic to use as a template for the text and form | | +| =templatetopic= | Name of a topic to use as a template for the text and form (new topic _only_) | | | =text= | New text of the topic | | | =forcenewrevision= | if set, forces a revision even if TWiki thinks one isn't needed | | | =topicparent= | If 'none' remove any current topic parent. If the name of a topic, set the topic parent to this. | | @@ -250,14 +250,14 @@ 1 The first sequence of ten or more =X= characters in the topic name will be converted to a number such that the resulting topic name is unique in the target web. 1 When the action is =save=, =checkpoint=, =quietsave=, or =preview=: 1 The new text is taken from the =text= parameter, if it is defined, - * otherwise it is taken from the =templatetopic=, if it is defined, + * otherwise it is taken from the =templatetopic=, if it is defined, (new topic _only_) * otherwise it is taken from the previous version of the topic, if any, 1 The name of the new form is taken from the =formtemplate=, if defined - * otherwise it is taken from the =templatetopic=, if defined, + * otherwise it is taken from the =templatetopic=, if defined, (new topic _only_) * otherwise it is taken from the previous version of the topic, if any, * otherwise no form is attached. 1 The value for each field in the form is taken from the query, if it is defined - * otherwise it is taken from the =templatetopic=, if defined, + * otherwise it is taken from the =templatetopic=, if defined, (new topic _only_) * otherwise it is taken from the previous version of the topic, if any, * otherwise it defaults to the empty string. Modified: twiki/scratch/TWikiStandAlone/core/lib/TWiki/Response.pm =================================================================== --- twiki/scratch/TWikiStandAlone/core/lib/TWiki/Response.pm 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/core/lib/TWiki/Response.pm 2008-06-29 00:35:55 UTC (rev 16949) @@ -94,7 +94,7 @@ =cut sub charset { - return (@_ == 1) ? $_[0]->{charset} : $_[0]->{charset} = $_[1]; + return @_ == 1 ? $_[0]->{charset} : ( $_[0]->{charset} = $_[1] ); } =begin twiki @@ -125,7 +125,6 @@ @p ); -# SMELL: Review this if ( defined $charset ) { $this->charset($charset); } Modified: twiki/scratch/TWikiStandAlone/core/lib/TWiki/Store/RcsFile.pm =================================================================== --- twiki/scratch/TWikiStandAlone/core/lib/TWiki/Store/RcsFile.pm 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/core/lib/TWiki/Store/RcsFile.pm 2008-06-29 00:35:55 UTC (rev 16949) @@ -36,6 +36,7 @@ package TWiki::Store::RcsFile; use strict; +use warnings; use Assert; require File::Copy; @@ -105,6 +106,8 @@ undef $this->{attachment}; undef $this->{searchFn}; undef $this->{session}; + + return; } # Used in subclasses for late initialisation during object creation @@ -121,6 +124,8 @@ $this->initText(); } } + + return; } # Make any missing paths on the way to this file @@ -137,6 +142,8 @@ if ($@) { throw Error::Simple("RCS: failed to create ${path}: $!"); } + + return; } # SMELL: this should use TWiki::Time @@ -248,15 +255,15 @@ sub getTopicNames { my $this = shift; - opendir DIR, $TWiki::cfg{DataDir}.'/'.$this->{web}; + opendir my $DIR, $TWiki::cfg{DataDir}.'/'.$this->{web}; # the name filter is used to ensure we don't return filenames # that contain illegal characters as topic names. my @topicList = sort map { TWiki::Sandbox::untaintUnchecked( $_ ) } grep { !/$TWiki::cfg{NameFilter}/ && s/\.txt$// } - readdir( DIR ); - closedir( DIR ); + readdir( $DIR ); + closedir( $DIR ); return @topicList; } @@ -271,7 +278,7 @@ sub getWebNames { my $this = shift; my $dir = $TWiki::cfg{DataDir}.'/'.$this->{web}; - if( opendir( DIR, $dir ) ) { + if( opendir( my $DIR, $dir ) ) { my @tmpList = sort map { TWiki::Sandbox::untaintUnchecked( $_ ) } @@ -279,8 +286,8 @@ !/$TWiki::cfg{NameFilter}/ && -d $dir.'/'.$_ } - readdir( DIR ); - closedir( DIR ); + readdir( $DIR ); + closedir( $DIR ); return @tmpList; } return (); @@ -375,6 +382,8 @@ _moveFile( $TWiki::cfg{PubDir}.'/'.$this->{web}, $TWiki::cfg{PubDir}.'/'.$newWeb ); } + + return; } =pod @@ -447,6 +456,8 @@ } else { saveFile( $this, $this->{file}, $text ); } + + return; } =pod @@ -469,6 +480,8 @@ _rmtree( $TWiki::cfg{DataDir}.'/'.$this->{web} ); _rmtree( $TWiki::cfg{PubDir}.'/'.$this->{web} ); + + return; } =pod @@ -502,6 +515,8 @@ my $to = $TWiki::cfg{PubDir}.'/'.$newWeb.'/'.$newTopic; _moveFile( $from, $to ); } + + return; } =pod @@ -526,17 +541,19 @@ _copyFile( $this->{rcsFile}, $new->{rcsFile} ); } - if( opendir(DIR, $TWiki::cfg{PubDir}.'/'.$this->{web}.'/'. + if( opendir(my $DIR, $TWiki::cfg{PubDir}.'/'.$this->{web}.'/'. $this->{topic} )) { - for my $att ( grep { !/^\./ } readdir DIR ) { + for my $att ( grep { !/^\./ } readdir $DIR ) { $att = TWiki::Sandbox::untaintUnchecked( $att ); my $oldAtt = new TWiki::Store::RcsFile( $this->{session}, $this->{web}, $this->{topic}, $att ); $oldAtt->copyAttachment( $newWeb, $newTopic ); } - closedir DIR; + closedir $DIR; } + + return; } =pod @@ -559,6 +576,8 @@ if( -e $this->{rcsFile} ) { _moveFile( $this->{rcsFile}, $new->{rcsFile} ); } + + return; } =pod @@ -584,6 +603,8 @@ if( -e $this->{rcsFile} ) { _copyFile( $this->{rcsFile}, $new->{rcsFile} ); } + + return; } =pod @@ -625,6 +646,8 @@ unlink $filename || throw Error::Simple( 'RCS: failed to delete '.$filename.': '.$! ); } + + return; } =pod @@ -666,6 +689,7 @@ unlink $filename || throw Error::Simple( 'RCS: failed to delete '.$filename.': '.$! ); } + return; } =pod @@ -685,7 +709,7 @@ my $lease = { split( /\r?\n/, $t ) }; return $lease; } - return undef; + return; } =pod @@ -700,16 +724,18 @@ sub removeSpuriousLeases { my( $this ) = @_; my $web = $TWiki::cfg{DataDir}.'/'.$this->{web}.'/'; - if (opendir(W, $web)) { - foreach my $f (readdir(W)) { + my $W; + if (opendir($W, $web)) { + foreach my $f (readdir($W)) { if ($f =~ /^(.*)\.lease$/) { if (! -e "$1.txt,v") { unlink($f); } } } - closedir(W); + closedir($W); } + return; } sub saveStream { @@ -718,16 +744,17 @@ ASSERT($fh) if DEBUG; mkPathTo( $this->{file} ); - open( F, '>'.$this->{file} ) || + my $F; + open( $F, '>', $this->{file} ) || throw Error::Simple( 'RCS: open '.$this->{file}.' failed: '.$! ); - binmode( F ) || + binmode( $F ) || throw Error::Simple( 'RCS: failed to binmode '.$this->{file}.': '.$! ); my $text; - binmode(F); + binmode($F); while( read( $fh, $text, 1024 )) { - print F $text; + print $F $text; } - close(F) || + close($F) || throw Error::Simple( 'RCS: close '.$this->{file}.' failed: '.$! );; chmod( $TWiki::cfg{RCS}{filePermission}, $this->{file} ); @@ -742,6 +769,8 @@ unless( File::Copy::copy( $from, $to ) ) { throw Error::Simple( 'RCS: copy '.$from.' to '.$to.' failed: '.$! ); } + + return; } sub _moveFile { @@ -751,6 +780,8 @@ unless( File::Copy::move( $from, $to ) ) { throw Error::Simple( 'RCS: move '.$from.' to '.$to.' failed: '.$! ); } + + return; } sub saveFile { @@ -758,24 +789,26 @@ mkPathTo( $name ); - open( FILE, '>'.$name ) || + my $FILE; + open($FILE, '>', $name ) || throw Error::Simple( 'RCS: failed to create file '.$name.': '.$! ); - binmode( FILE ) || + binmode($FILE ) || throw Error::Simple( 'RCS: failed to binmode '.$name.': '.$! ); - print FILE $text; - close( FILE) || + print $FILE $text; + close($FILE) || throw Error::Simple( 'RCS: failed to create file '.$name.': '.$! ); - return undef; + return; } sub readFile { my( $this, $name ) = @_; my $data; - if( open( IN_FILE, '<', $name )) { - binmode( IN_FILE ); + my $IN_FILE; + if( open( $IN_FILE, '<', $name )) { + binmode( $IN_FILE ); local $/ = undef; - $data = <IN_FILE>; - close( IN_FILE ); + $data = <$IN_FILE>; + close( $IN_FILE ); } $data ||= ''; return $data; @@ -836,8 +869,8 @@ sub _rmtree { my $root = shift; - if( opendir( D, $root ) ) { - foreach my $entry ( grep { !/^\.+$/ } readdir( D ) ) { + if( opendir(my $D, $root ) ) { + foreach my $entry ( grep { !/^\.+$/ } readdir( $D ) ) { $entry =~ /^(.*)$/; $entry = $root.'/'.$1; if( -d $entry ) { @@ -855,7 +888,7 @@ } } } - closedir(D); + closedir($D); if (!rmdir( $root )) { if ($TWiki::cfg{OS} ne 'WINDOWS') { @@ -865,6 +898,7 @@ } } } + return; } =pod @@ -878,7 +912,7 @@ sub getStream { my( $this ) = shift; my $strm; - unless( open( $strm, '<'.$this->{file} )) { + unless( open( $strm, '<', $this->{file} )) { throw Error::Simple( 'RCS: stream open '.$this->{file}. ' failed: '.$! ); } @@ -1046,7 +1080,7 @@ if ($#$stat > 0) { return \%pairs; } else { - return undef; + return; } } @@ -1061,18 +1095,19 @@ =cut sub getAttachmentList { - my( $this, $web, $topic ) = @_; - my $dir = dirForTopicAttachments($web, $topic); + my( $this, $web, $topic ) = @_; + my $dir = dirForTopicAttachments($web, $topic); - opendir DIR, $dir || return ''; my %attachmentList = (); - my @files = sort grep { m/^[^\.*_]/ } readdir( DIR ); - @files = grep { !/.*,v/ } @files; - foreach my $attachment ( @files ) { - my @stat = stat ($dir."/".$attachment); - $attachmentList{$attachment} = _constructAttributesForAutoAttached($attachment, \@stat); + if (opendir(my $DIR, $dir)) { + my @files = sort grep { m/^[^\.*_]/ } readdir( $DIR ); + @files = grep { !/.*,v/ } @files; + foreach my $attachment ( @files ) { + my @stat = stat ($dir."/".$attachment); + $attachmentList{$attachment} = _constructAttributesForAutoAttached($attachment, \@stat); + } + closedir( $DIR ); } - closedir( DIR ); return %attachmentList; } @@ -1142,6 +1177,7 @@ my $text = join( "\n", map { join( "\t", @$_); } @changes ); saveFile( $this, $file, $text ); + return; } =pod Modified: twiki/scratch/TWikiStandAlone/core/templates/changeform.tmpl =================================================================== --- twiki/scratch/TWikiStandAlone/core/templates/changeform.tmpl 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/core/templates/changeform.tmpl 2008-06-29 00:35:55 UTC (rev 16949) @@ -21,7 +21,8 @@ <input type="hidden" name="topicparent" value="%URLPARAM{"topicparent"}%" /> <input type="hidden" name="redirectto" value="%URLPARAM{"redirectto"}%" /> <input type="hidden" name="skin" value="%URLPARAM{"skin"}%" /> -<input type="hidden" name="cover" value="%URLPARAM{"cover"}%" />%TMPL:END% +<input type="hidden" name="cover" value="%URLPARAM{"cover"}%" /> +<input type="hidden" name="nowysiwyg" value="%URLPARAM{"nowysiwyg"}%" />%TMPL:END% %TMPL:DEF{"notes"}%<p>%MAKETEXT{"Any changes you made to the topic before coming to this page are preserved."}%<br /> Modified: twiki/scratch/TWikiStandAlone/core/templates/twiki.tmpl =================================================================== --- twiki/scratch/TWikiStandAlone/core/templates/twiki.tmpl 2008-06-26 05:49:38 UTC (rev 16948) +++ twiki/scratch/TWikiStandAlone/core/templates/twiki.tmpl 2008-06-29 00:35:55 UTC (rev 16949) @@ -30,6 +30,7 @@ <meta name="scripturl" content="%SCRIPTURL%" /> <meta name="scriptsuffix" content="%SCRIPTSUFFIX%" /> <link rel="icon" href="%FAVICON%" type="image/x-icon" /> <link rel="shortcut icon" href="%FAVICON%" type="image/x-icon" /> + <link rel="alternate" href="%SCRIPTURL{edit}%/%BASEWEB%/%BASETOPIC%?_T=%DATE%" type="application/x-wiki" title="edit %BASETOPIC%" /> <meta name="description" content="%TOPIC%" /> <base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%"></base> %TMPL:P{"script"}% |