Tags:
accessibility1Add my vote for this tag database1Add my vote for this tag information_design1Add my vote for this tag create new tag
, view all tags

MrdIdPlugin

Generates unique incrementing ID's with custom tags

Introduction

Our marketing department keeps track of product requirements in TWiki. They wanted a way to label each requirement with a unique ID with a user defined format. This is a simple plugin to meet that need. It allows users to generate incrementing ID values that are unique across an entire TWiki site. The user can prepend the numeric ID with custom tags. See the examples in the next section for usage.

Syntax Rules/Examples

You Enter Displayed Value Comment
%MRDID% x where x is a number that will start at 1 and increment each time %MRDID% is entered
%MRDID{ id="NWID" }% NWIDx where x is a number that will start at 1 and increment each time %MRDID{ id="NWID" }% is entered
%MRDID{ id="SSREQ" }% SSREQx where x is a number that will start at 1 and increment each time %MRDID{ id="SSREQ" }% is entered
%MRDID{ id="SSREQ33" }% SSREQ33 This will force the id to SSREQ33 regardless of what the next value should be. Note that this will also prevent the id from being unique as 33 will still be used by the id generator.

Usage Caveats

Note that the tags are case sensitive (i.e. NWID is different from NwId) and that the numeric values of each tag are independent of each other. In other words (using examples from the table above), the NWID values will start at 1 and increment. The SSREQ values will also start at 1 and increment. Not supplying an id field is the same as supplying id="". Also note that the next time you edit a page, the %MRDID% tag will be updated with the latest value (e.g. after an edit %MRDID{ id="NWID" }% will become %MRDID{ id="NWIDx" }%. Editing the id field after the first save should be avoided to guarantee unique id's.

The plugin keeps track of ID's by storing the last used ID value of each tag in a text file (data/mrdIdReg). If this file is deleted (or moved), the plugin will restart generating ID values with 1 for all new ID's. Note that previously saved pages with ID's will not be updated, and ID's will almost certainly no longer be unique. Once an ID is saved on a page, it is never updated again by the plugin.

The plugin is designed to allow %MRDID% to work in both the normal page area and in TWiki forms (i.e. meta data).

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Generates unique incrementing ID's with custom tags

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

  • If you want ID's to start at a value other than 1, change the value below:
    • Set STARTINGIDVALUE = 1

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip MrdIdPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/MrdIdPlugin.txt Plugin topic
    lib/TWiki/Plugins/MrdIdPlugin.pm Plugin Perl module
  • Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Test if the installation was successful:
    • If it was installed correctly, you should see "MRDIDTESTx" below (where x is a number, probably 1). If it failed, you will see:
      %MRDID{ id="MRDIDTEST" }%.
    • %MRDID{ id="MRDIDTEST1" }%

Plugin Info

Plugin Author: TWiki:Main.BrianSpinar
Copyright: © 2005 TWiki:Main.BrianSpinar
© 2006-2010 TWiki:TWiki.TWikiContributor
Plugin Version: 2010-12-12 (V1.1)
Change History:  
2010-12-12: TWikibug:Item6530: Doc improvements, changing TWIKIWEB to SYSTEMWEB -- TWiki:Main.PeterThoeny
29 Jan 2005: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, MrdIdPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/MrdIdPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/MrdIdPluginDev

Related Topics: TWikiPreferences, TWikiPlugins

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 MrdIdPlugin.md5 r3 r2 r1 manage 0.2 K 2010-12-13 - 06:30 PeterThoeny  
Compressed Zip archivetgz MrdIdPlugin.tgz r3 r2 r1 manage 5.7 K 2010-12-13 - 06:30 PeterThoeny  
Compressed Zip archivezip MrdIdPlugin.zip r5 r4 r3 r2 r1 manage 7.2 K 2010-12-13 - 06:30 PeterThoeny  
Unknown file formatEXT MrdIdPlugin_installer r2 r1 manage 3.4 K 2010-12-13 - 06:30 PeterThoeny  
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2013-10-16 - 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-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.