This is a small enhancement to the AUTOINC* feature that auto-increments numbers for automatic topic creation.
Currently any prefix can be used, such as
PrjAUTOINC001
to create
Prj001
,
Prj002
,
Prj003
, etc.
If the new topic or existing topics have a suffix, auto-increments no longer works as expected. For example, I'd like to have
Prj001Foo
,
Prj002Bar
,
Prj003Moo
, etc, where the suffix is specified at topic creation time, such as
PrjAUTOINC001Foo
.
This enhancement allows arbitrary suffix after the number.
Example:
- Create topic using name
PrjAUTOINC001FirstProject
-- results in topic Prj001FirstProject
- Create topic using name
PrjAUTOINC001
-- results in topic Prj002
- Create topic using name
PrjAUTOINC001SomeSuffix
-- results in topic Prj003SomeSuffix
Patch:
--- Save.pm.save1 2012-01-15 00:53:39.000000000 -0500
+++ Save.pm 2012-05-16 22:39:48.012810595 -0400
@@ -393,11 +393,11 @@
my $baseTopic = $topic;
$store->clearLease( $web, $baseTopic );
my $nameFilter = $topic;
- $nameFilter =~ s/AUTOINC([0-9]+)/([0-9]+)/;
+ $nameFilter =~ s/AUTOINC([0-9]+).*/([0-9]+)/;
my @list =
sort{ $a <=> $b }
- map{ s/^$nameFilter$/$1/; s/^0*([0-9])/$1/; $_ }
- grep{ /^$nameFilter$/ }
+ map{ s/^$nameFilter.*/$1/; s/^0*([0-9])/$1/; $_ }
+ grep{ /^$nameFilter/ }
$store->getTopicNames( $web );
if( scalar @list ) {
# find last one, and increment by one
--
TWiki:Main/PeterThoeny
- 2012-05-17
Now in SVN trunk and 5.1 branch. Docs at
TWikiTemplates updated too.
--
TWiki:Main/PeterThoeny
- 2012-05-17