My idea is developing an
AddOn API to make it easy to create, change and delete TWiki pages from programs. That would make it possible to write TWiki extensions like automatic mailing list archivers, intelligent TWiki-aware bots (think Jabber or IRC), etc.
The current implementation is object-oriented, although is based in the
DolphinToTWikiAddOn. The file
TWiki/Node.pm contains the class
Node, which represents a topic in a given TWiki web. The class text can be read and written, and one can get locks for it.
It seems that using OO follows the current
TWikiOO trend, and will make life easier for both developers and
AddonAPI maintainers. The bad side is that some functionality in modules
Twiki and
TWiki::Store had to be cloned, because their use of global variables, which are not very clean for object orientation (think more than one node object instantiated at a time).
--
EstebanManchado - 23 Sep 2002
API
The general idea is having a Perl class to manage single TWiki nodes. One would normally create an object of the class TWiki::Node, retrieve its text and/or modify it. To modify the text a lock on the node is needed.
The class interface is very simple. It has the following methods:
- new
- The class constructor. It accepts as parameters the Web, the Node name (topic) and, optionally, the user to connect as and the TWiki root directory.
- text
- Returns the node text.
- isLocked
- Returns the lock user if locked, and
"" if not.
- setText
- Stores the given text in the Node object.
- getLock
- Gets a lock.
- releaseLock
- Releases the lock.
- save
- Saves the current topic status to disk.
Discussion
Updated progress fields with values from old manual "Nice to Have" table. Don't know how accurate they are.
--
SamHasler - 08 Sep 2004
The first pass over such an API will be there in
DakarRelease, when the core functions are more generally documented and published. Add-on authors can use these functions on a caveat emptor basis.
--
CrawfordCurrie - 15 Feb 2005