Tags:
archive_me1Add my vote for this tag create new tag
view all tags
The TWikiImplementations example twiki application dynamically creates a form that will create a new topic by using GMTIME. That works great until you submit from the same link more than once, in which case you stomp on a previously submitted topic. (We're using for project tracking.)

I made a small change to the edit script to allow this to be done in a mostly race-condition-free manner.

    #
    # Allow for dynamic topic creation if it contains a string of 10 x's XXXXXX
    #
    if ( $theTopic =~ /X{10}/o ) {
        $theTopic =~ s|X{10}X*|substr(int($$) . int(rand(100000)) . int(time), 0, 10)|e;
    }

I'd like to see something like this in the standard twiki. It basically just does a mktemp() style replacement.

The way I did it above is just a quick hack. It might make sense to add an extra parameter to the edit script dynamicname=1 or similar, and only do the substitution if that is set.

-- NathanNeulinger - 25 Feb 2003

File::Temp allows safely create unique file names - and IIRC it's part of standard perl distro?

-- PeterMasiar - 26 Feb 2003

for our bug tracking system I use sequential numbers. so far my extremely dumb method has not shown signs of slowing down (i start at one and increment until i can't find a topic, and use that).

-- SvenDowideit - 26 Feb 2003

I have attached a diff to the current cvs that uses my sequential topic numbers. The other thing is that it test to see if the topic, or a lock for that topic exists to stop overwriting other new topic entries. (it also has my HIDETEXTAREA tag) - I like the X{10} syntax - its simpler than the extra parameter

PeterT, can we add this to the main code?

-- SvenDowideit - 19 Mar 2003

I think this is a good idea. People are likely to want different ways of doing the numbering. I would suggest:

  • Introduce the above xxx form
  • Add a plugin hook to allow for other forms of numbering, might want to allow for different xxx format.

-- JohnTalintyre - 13 Jan 2004

To implement a Bug tracking system using DEVELOP, this patch will need to change a so that it is done in the save script. This is because there is no locking of a topic on edit in Dakar anymore. (and It makes the topic name creation more dynamic)

I also need a way to HideTWikiEditTextArea

-- SvenDowideit - 1 May 2003

I just commited r4262 - a version of this feature that will eventually slow down your system smile - as I'm using it for the upcoming DevelopBranchBugTrackingSystem

-- SvenDowideit - 04 May 2005

I'm not sure if this is the official 'doc' for the implemented feature in Dakar, but I came here via the 4.0.2. feature list. I've changed the CurrentState to MergedToCore, since it's been released.

My question: I've built a small news apllication with the sequential numbering. To build a nice UI, I'd like to create links to the previous and the next news item. Is there a way to create these links in a template, i.e. without knowing the exact sequential number?

T.I.A.

-- JosMaccabiani - 13 May 2006

I was able to partly answer my own question using SpreadSheetPlugin. If your dynamic topic name is TestTopicXXXXXXXXXX, then use:

Previous topic: TestTopic%CALC{"$SUM($VALUE(%TOPIC%),-1)"}%

Next topic: TestTopic%CALC{"$SUM($VALUE(%TOPIC%),+1)"}%

Of course, this doesn't work for the first topic, and for the last topic. For these topics, nothing should be displayed

-- JosMaccabiani - 13 May 2006

See proposed improvement at AutoIncTopicNameOnSave.

-- PeterThoeny - 19 Jul 2006

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff edit.diff r3 r2 r1 manage 2.4 K 2003-03-19 - 04:35 UnknownUser autoincrementing topic names
Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r19 - 2006-07-19 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.