Changeset 6247
- Timestamp:
- 02/08/10 10:36:26 (2 years ago)
- Location:
- trunk/TopicCreatePlugin
- Files:
-
- 4 edited
-
data/System/TopicCreatePlugin.txt (modified) (1 diff)
-
lib/Foswiki/Plugins/TopicCreatePlugin.pm (modified) (1 diff)
-
lib/Foswiki/Plugins/TopicCreatePlugin/Func.pm (modified) (2 diffs)
-
test/unit/TopicCreatePlugin/TopicCreateTests.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/TopicCreatePlugin/data/System/TopicCreatePlugin.txt
r6183 r6247 68 68 | Plugin Version: | %$VERSION% | 69 69 | Change History: | <!-- versions below in reverse order --> | 70 | 08 Feb 2010: | v1.3: Foswikitask:Item8480 - Fix for setting the parent; Fix for using Macros as the parent in =%<nop>TOPICCREATE%= -- Foswiki:Main.AndrewJones | 70 71 | 28 Jan 2010: | v1.2: Foswikitask:Item8438 - =%<nop>TOPICCREATE%= now allows you to define a parent for the new topic -- Foswiki:Main.AndrewJones | 71 72 | 29 Sep 2009: | v1.1: Foswikitask:Item4757 - Fixed warning when using =%<nop>TOPICATTACH%= -- Foswiki:Main.AndrewJones | -
trunk/TopicCreatePlugin/lib/Foswiki/Plugins/TopicCreatePlugin.pm
r6183 r6247 26 26 27 27 our $VERSION = '$Rev$'; 28 our $RELEASE = '1. 2';28 our $RELEASE = '1.3'; 29 29 our $SHORTDESCRIPTION = 30 30 'Automatically create a set of topics and attachments at topic save time'; -
trunk/TopicCreatePlugin/lib/Foswiki/Plugins/TopicCreatePlugin/Func.pm
r6183 r6247 78 78 $topicName = 79 79 Foswiki::Func::expandCommonVariables( $topicName, $theTopic, $theWeb ); 80 $parent = 81 Foswiki::Func::expandCommonVariables( $parent, $theTopic, $theWeb ); 80 82 $template = 81 83 Foswiki::Func::expandCommonVariables( $template, $theTopic, $theWeb ); … … 109 111 110 112 # Set topic parent 111 $meta->put Keyed( 'TOPICPARENT', { name => $parent } );113 $meta->putAll( 'TOPICPARENT', { name => $parent } ); 112 114 113 115 # SMELL: replace with expandVariablesOnTopicCreation( $text ); -
trunk/TopicCreatePlugin/test/unit/TopicCreatePlugin/TopicCreateTests.pm
r6183 r6247 71 71 } 72 72 73 # test the use of %TOPICCREATE{ parent=" WebHome" }%73 # test the use of %TOPICCREATE{ parent="FooBar" }% 74 74 sub test_parent { 75 75 my $this = shift; … … 81 81 %META:TOPICPARENT{name="WebHome"}% 82 82 83 %TOPICCREATE{template="$simpleTemplate" topic="$testTopic" parent="WebHome"}% 83 %TOPICCREATE{template="$simpleTemplate" topic="$testTopic" parent="FooBar"}% 84 85 HERE 86 87 Foswiki::Plugins::TopicCreatePlugin::beforeSaveHandler( $sampleText, 88 $this->{test_topic}, $this->{test_web} ); 89 90 # child topic should now exist 91 $this->assert( Foswiki::Func::topicExists( $this->{test_web}, $testTopic ), 92 "$testTopic was not created" ); 93 94 # parent of newly created topic should be WebHome 95 my ( $meta, undef ) = 96 Foswiki::Func::readTopic( $this->{test_web}, $testTopic ); 97 $this->assert_equals( "FooBar", $meta->getParent(), 98 "Parent of new child topic is incorrect" ); 99 } 100 101 # test the use of %TOPICCREATE{ parent="%HOMETOPIC%" }% 102 sub test_parent_as_macro { 103 my $this = shift; 104 105 my $testTopic = "ParentTest2"; 106 107 my $sampleText = <<"HERE"; 108 %META:TOPICINFO{author="guest" date="1053267450" format="1.0" version="1.35"}% 109 %META:TOPICPARENT{name="WebHome"}% 110 111 %TOPICCREATE{template="$simpleTemplate" topic="$testTopic" parent="%HOMETOPIC%"}% 84 112 85 113 HERE … … 96 124 Foswiki::Func::readTopic( $this->{test_web}, $testTopic ); 97 125 $this->assert_equals( "WebHome", $meta->getParent(), 98 "Parent of new child topic is incorrect" ); 126 "Parent of new child topic is incorrect. Should be the same as the current topic." 127 ); 99 128 } 100 129
Note: See TracChangeset
for help on using the changeset viewer.
