Changeset 875 for trunk/core/lib/Foswiki/UI/Manage.pm
- Timestamp:
- 11/23/08 11:02:43 (4 years ago)
- File:
-
- 1 edited
-
trunk/core/lib/Foswiki/UI/Manage.pm (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki/UI/Manage.pm
r859 r875 62 62 _restoreRevision($session); 63 63 } 64 elsif ( $action eq 'c opy' ) {65 _c opyTopic($session);64 elsif ( $action eq 'create' ) { 65 _createTopic($session); 66 66 } 67 67 elsif ($action) { … … 300 300 my $breakLock = $query->param('breaklock'); 301 301 302 my $confirm = $query->param('confirm'); 303 my $store = $session->{store}; 304 305 $newTopic =~ s/\s//go; 306 $newTopic =~ s/$Foswiki::cfg{NameFilter}//go; 307 $newTopic = ucfirst $newTopic; # Item3270 302 my $confirm = $query->param('confirm'); 303 my $store = $session->{store}; 308 304 309 305 $attachment ||= ''; … … 327 323 328 324 if ($newTopic) { 325 $newTopic = _safeTopicName($newTopic); 329 326 if ( !_isValidTopicName( $newTopic, $query->param('nonwikiword') ) ) { 330 327 throw Foswiki::OopsException( … … 336 333 ); 337 334 } 338 $newTopic = _safeTopicName($newTopic);339 335 } 340 336 … … 405 401 Foswiki::UI::checkAccess( $session, $oldWeb, $oldTopic, 'VIEW', 406 402 $session->{user} ); 407 _newTopicScreen( $session, $oldWeb, $oldTopic, $newWeb, $newTopic, 408 $attachment, $confirm ); 403 _newTopicScreen( 404 $session, $oldWeb, $oldTopic, $newWeb, 405 $newTopic, $attachment, $confirm 406 ); 409 407 return; 410 408 } … … 513 511 =pod 514 512 515 ---++ StaticMethod _copyTopic() 516 517 Copies a topic to new topic with name passed in query param 'newtopic'. 518 Redirects to edit screen. 513 ---++ StaticMethod _createTopic() 514 515 Creates a topic to new topic with name passed in query param 'topic'. 516 Creates an exception when the topic name is not valid; the topic name does not have to be a WikiWord if parameter 'nonwikiword' is set to 'on'. 517 Redirects to the edit screen. 518 519 Copy an existing topic using: 520 <form action="%SCRIPTURL{manage}%/%WEB%/"> 521 <input type="text" name="topic" class="twikiInputField" value="%TOPIC%Copy" size="30"> 522 <input type="hidden" name="action" value="create" /> 523 <input type="hidden" name="templatetopic" value="%TOPIC%" /> 524 ... 525 </form> 519 526 520 527 =cut 521 528 522 523 sub _copyTopic { 529 sub _createTopic { 524 530 my ($session) = @_; 525 531 526 532 my $query = $session->{request}; 527 my $newTopic = $query->param(' newtopic') || '';533 my $newTopic = $query->param('topic') || ''; 528 534 529 535 # topic must not be empty … … 538 544 } 539 545 540 my $oldWeb = $session->{webName}; 541 my $oldTopic = $session->{topicName}; 542 543 if ($newTopic) { 544 # topic must be valid 545 if ( !_isValidTopicName( $newTopic, $query->param('nonwikiword') ) ) { 546 throw Foswiki::OopsException( 547 'attention', 548 web => $oldWeb, 549 topic => $oldTopic, 550 def => 'not_wikiword', 551 params => [$newTopic] 552 ); 553 } 554 $newTopic = _safeTopicName($newTopic); 555 } 556 546 my $oldWeb = $session->{webName}; 547 my $oldTopic = $session->{topicName}; 548 549 Foswiki::UI::checkAccess( $session, $oldWeb, $newTopic, 'CHANGE', 550 $session->{user} ); 551 552 # topic must be valid 553 if ( !_isValidTopicName( $newTopic, $query->param('nonwikiword') ) ) { 554 throw Foswiki::OopsException( 555 'attention', 556 web => $oldWeb, 557 topic => $oldTopic, 558 def => 'not_wikiword', 559 params => [$newTopic] 560 ); 561 } 562 $newTopic = _safeTopicName($newTopic); 563 557 564 # untaint new topic name 558 565 use Foswiki::Sandbox; … … 624 631 625 632 my $newTopic; 626 my $lockFailure = '';627 my $breakLock = $query->param('breaklock');628 my $confirm = $query->param('confirm') || '';629 my $store = $session->{store};633 my $lockFailure = ''; 634 my $breakLock = $query->param('breaklock'); 635 my $confirm = $query->param('confirm') || ''; 636 my $store = $session->{store}; 630 637 631 638 Foswiki::UI::checkWebExists( $session, $oldWeb, … … 1008 1015 # Display screen so user can decide on new web and topic. 1009 1016 sub _newTopicScreen { 1010 my ( $session, $oldWeb, $oldTopic, $newWeb, $newTopic, $attachment, 1011 $confirm ) 1012 = @_; 1017 my ( 1018 $session, $oldWeb, $oldTopic, $newWeb, 1019 $newTopic, $attachment, $confirm 1020 ) = @_; 1013 1021 1014 1022 my $query = $session->{request};
Note: See TracChangeset
for help on using the changeset viewer.
