Mods Details

Morphology

Each Mod is defined by a type and a package name. the types are arbitrary strings to group mods in mods families. The initial set is composed of avatars, icons, menus, themes, languages, sqlupgrade, wikiplugins, features, services ... more types can be added with time, but please do not add wild types. New types should be only added after proper discussion with knowledgeable people (whatever that means for you).

A mod is managed by a control file with following characteristics :


The maintenance of the mods repository is managed by other text files that have to be present in the mods/Packages/ dir as well. Those files are indexes in CSV format, so they can be used by other tools. The indexes are following the conventions :

for developers : mods.sh

In 1.9cvs you can find that script in doc/devtools/mods.sh. This script is recent and has only a few features, but the goal is to make possible to manage the mods only with it. Before use edit this script to adapt the configuration to your environment, and when done you can launch it from your tiki root directory.

Copy to clipboard
Usage: ./doc/devtools/mods.sh <package_name> [copy|diff|install] copy : copy tiki files to mods diff : diff tiki files with mods install : copy mods files to tiki without 2nd arg, returns the list of files from package in tiki tree !!! note that this script only works with installed packages !!! !!! (this is work in progress, use is quite limited for now) !!!

How to add your own mods

Let's work a simple mods, a wikiplugin

Get _mods

First get a CVS version of _mods from HEAD. From now on, all paths will be relative to the directory _mods.

Create a wikiplugin

Create your plugin:

Copy to clipboard
<?php /* * $Header: /cvsroot/tikiwiki/_mods/wiki-plugins/dopplr/wiki-plugins/wikiplugin_dopplr.php,v 1.1 2007/12/20 23:37:10 franck Exp $ * * Dopplr plugin. Add a Dopplr badge * * Syntax: * * {DOPPLR(badgeid=>id)} * some content * {DOPPLR} * */ function wikiplugin_dopplr_help() { return tra("Insert a dopplr.com badge on wiki page").":<br />{DOPPLR(badgeid=>ID)}".tra("text")."{DOPPLR}"; } function wikiplugin_dopplr($data, $params) { extract ($params,EXTR_SKIP); $badgeid = (isset($badgeid) && ctype_xdigit($badgeid)) ? "$badgeid" : ""; $begin = '<div id="dopplr-blog-badge"><sscript src="http://www.dopplr.com/blogbadge/script/'.$badgeid.'"></sscript></div>'; $data = ""; $end = ""; return $begin . $data . $end; } ?>

Place it in wiki-plugins/dopplr/wiki-plugins/wikiplugin_dopplr.php

Security: ensure to test $params and $data so people cannot abuse these variables to compromise the site that runs this wikiplugin

Then create the following file Packages/wikiplugins-dopplr.info.txt

Copy to clipboard
contributor: $Author: franck $ revision: $Revision: 1.1 $ lastmodif: $Date: 2007/12/20 23:37:10 $ files: wiki-plugins/dopplr/wiki-plugins/wikiplugin_dopplr.php lib/wiki-plugins/wikiplugin_dopplr.php author: Franck licence: GNU/LGPL Description: Add a dopplr.com badge to a wiki page

add into the file Packages/00_list.txt the line:

Copy to clipboard
'wikiplugins','dopplr','1.0','add a dopplr.com badge','GNU/LGPL'

Commit the wikiplugin

Copy to clipboard
cvs -z5 add wiki-plugins/dopplr cvs -z5 add wiki-plugins/dopplr/wiki-plugins cvs -z5 add wiki-plugins/dopplr/wiki-plugins/wikiplugin_dopplr.php cvs -z5 add Packages/wikiplugins-dopplr.info.txt cvs -z5 commit -m "Wikiplugin dopplr.com badge" Packages/wikiplugins-dopplr.info.txt Packages/00_list.txt wiki-plugins/dopplr/wiki-plugins/wikiplugin_dopplr.php

Make it available

Go on irc://irc.freenode.net/#tikiwiki or send an e-mail to the developer list to have http://mods.tiki.org/ updated.

Mods evolution

The first version of mods feature is very basic, and will need to handle some more things :

Most of those evolutions should be ready before 1.9 final release.


mods system was initially designed by mose, use at your own risk and read the source code.

Related pages