SECURITY WARNING:
Please note that installation and/or use of this feature on a public wiki is a security risk. This feature should only be used on a private or intranet wiki where the environment is entirely trusted.

This Contributed Plugin allows you to execute Tcl code on the server. Useful for creating pages with dynamic content. This plugin is experimental at this stage; clearly better wiki integration and server safety issues need to be addressed.

For more information please contact Andrew Gilmartin at andrew@andrewgilmartin.com.

For more information about Tcl -- tool command language -- see http://wiki.tcl.tk/.

Building#

To built you will first need to copy the JSPWiki.jar to the project's lib directory. The jars for jacl 1.3.1 are included. Note that I have only built the plugin against the JSPWiki 2.0.52 source.

Then run ant

Note that the code does not yet conform to the JSPWIki Coding Standard.

Installing#

Copy the file build/jspwiki-tcl-plugin.jar to JSPWiki's WEB-INF/lib directory. Note that this jar contains the plugin classes and the jacl classes.

Using#

The plugin is called using

[{com.ingenta.jspwiki.plugin.TclPlugin scriptPage='wikiPage' result='text|xml|wiki' }]

[{com.ingenta.jspwiki.plugin.TclPlugin script='tcl' result='text|xml|wiki' }]

[{com.ingenta.jspwiki.plugin.TclPlugin result='text|xml|wiki'

.. body content ..
}]

The script or scriptPage parameter or body content selects the Tcl code to execute. The result parameter determines how the result is further processed; xml result output is sent as is to the browser; text result output is send to the browser after escaping &, <, >, and " characters; wiki result output is send to the browser after first converting to HTML. All parameters are accessible within Tcl via the args array, for example set format $args(result).

Note that the current interpreter is not a "Safe TCL" one. Thus all event, file, socket, and use of Java classes is enabled.

See TclPluginScripts for examples of scripts.

The wiki specific Tcl commands are wiki::page and wiki::info.

See also the ScriptedPlugin for possible future use.

Name#

wiki::page - obtain and manipulate a wiki page

Synopsis#

wiki::page option ?arg arg ...?

Description#

wiki::page get pageName

returns the content of the page as plain text.

wiki::page put pageName content

sets the content of the page.

wiki::page create pageName ?content?

creates a new page with the given optional content.

wiki::page versions pageName

returns a list of versions for the page. Each version is a list of the page name, author, version number, and version time.

wiki::page attachments pageName

returns a list of attachments for the page. Each attachment is a list of page name, author, version number, version time, file name, file size.

wiki::page referencesin pageName

returns a list of referrering pages to the given page. Each referrering page is a list of the page name, author, version number, and version time.

wiki::page referencesout pageName

returns a list of pages referrered to by the given page. Each referrered to page is a list of the page name, author, version number, and version time. Not yet working.

Name#

wiki::info - Return information about the state of the wiki

Synopsis#

wiki::info option ?arg arg ...?

Description#

wiki::info pages

Returns a list of pages. Each page is a list of the page name, author, version number, and version time.

Note#

The following procs are useful in working with page info and attachment info.

proc wiki::pageinfo { option page } {
    if { $option == "pagename" } { return [lindex $page 0] }
    if { $option == "author"   } { return [lindex $page 1] }
    if { $option == "version"  } { return [lindex $page 2] }
    if { $option == "modified" } { return [lindex $page 3] }
    error "unknown option $option"
}

proc wiki::attachementinfo { option attachment } {
    if { $option == "pagename" } { return [lindex $attachment 0] }
    if { $option == "author"   } { return [lindex $attachment 1] }
    if { $option == "version"  } { return [lindex $attachment 2] }
    if { $option == "modified" } { return [lindex $attachment 3] }
    if { $option == "filename" } { return [lindex $attachment 4] }
    if { $option == "filesize" } { return [lindex $attachment 5] }
    error "unknown option $option"
}

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
jar
jspwiki-tcl-plugin.jar 497.0 kB 2 20-Aug-2004 05:51 AndrewGilmartin
zip
jspwiki-tcl-plugin.zip 389.1 kB 2 20-Aug-2004 05:54 AndrewGilmartin
« This page (revision-34) was last changed on 30-Sep-2010 05:08 by 68.226.92.3