r11 - 15 Feb 2005 - 12:20:27 - CrawfordCurrieYou are here: TWiki >  Codev Web > TWikiRelease > CairoRelease > AddonAPI
Tags:
, create new tag
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

Topic attachments
I Attachment Action Size Date Who Comment
zipzip TWiki-Node-0.0.1.zip manage 2.2 K 25 Sep 2002 - 09:39 EstebanManchado Initial TWiki::Node class implementation
zipzip TWiki-Node-0.0.2.zip manage 2.7 K 26 Sep 2002 - 11:44 EstebanManchado TWiki::Node class implementation
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r11 < r10 < r9 < r8 < r7 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo