r5 - 13 Feb 2005 - 16:08:43 - SamHaslerYou are here: TWiki >  Codev Web > SaveNotHonoringOnlynewtopicFlag
Tags:
, create new tag

Bug: Direct save is not honoring the onlynewtopic Flag

FlagForEditScriptToAvoidFormDataOverwrite should also be honored by the save script so that direct saving can avoid overwriting topics.

Test case

action %SCRIPTURLPATH%/save%SCRIPTSUFFIX%/Sandbox/
topic
templatetopic
onlynewtopic

Environment

TWiki version: TWikiRelease01Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  

-- SamHasler - 10 Sep 2004

Follow up

Fix record

Fix for onlynewtopic flag and also for onlywikiname flag is now in SVN.

Index: Save.pm
===================================================================
--- Save.pm     (revision 1740)
+++ Save.pm     (working copy)
@@ -76,12 +76,32 @@
   my $dontNotify = $query->param( "dontnotify" ) || "";
   my $changeform = $query->param( 'submitChangeForm' ) || "";
   my $theParent = $query->param( 'topicparent' ) || "";
+  my $onlyWikiName = $query->param( 'onlywikiname' ) || "";
+  my $onlyNewTopic = $query->param( 'onlynewtopic' ) || "";
   my $formTemplate = $query->param( "formtemplate" );

+  my $topicExists  = TWiki::Store::topicExists( $webName, $topic );
+
   return 0 unless TWiki::UI::webExists( $webName, $topic );

   return 0 if TWiki::UI::isMirror( $webName, $topic );

+  # Prevent saving existing topic?
+  if( $onlyNewTopic && $topicExists ) {
+    # Topic exists and user requested oops if it exists
+    TWiki::UI::oops( $webName, $topic, "createnewtopic" );
+    return 0;
+  }
+
+  # prevent non-Wiki names?
+  if( ( $onlyWikiName )
+      && ( ! $topicExists )
+      && ( ! ( &TWiki::isWikiName( $topic ) || &TWiki::isAbbrev( $topic ) ) ) ) {
+    # do not allow non-wikinames, redirect to view topic
+    TWiki::UI::redirect( TWiki::getViewUrl( $webName, $topic ) );
+    return 0;
+  }
+
   my $wikiUserName = TWiki::userToWikiName( $userName );
   return 0 unless TWiki::UI::isAccessPermitted( $webName, $topic,
                                             "change", $wikiUserName );

-- PeterThoeny - 16 Sep 2004

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r5 < r4 < r3 < r2 < r1 | More topic actions
Codev.SaveNotHonoringOnlynewtopicFlag moved from Codev.OnlynewtopicFlagNotHonored on 10 Sep 2004 - 16:15 by SamHasler - put it back
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo