Extension:My list

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
My list

Release status: beta

Description Used as a memory list.
Author(s) Frickytalk
Last version 0.1
License No license specified
Download No link
Check usage and version matrix

Contents

What can this extension do? [edit]

This extention can be used to draw a memory list. You can add some priority tags.

!!! This extension DO NOT use any DB.

Usage [edit]

Tags are : <my_list (parameters...)>(contents...)</my_list>.

Parameters :

  • "title=name_of_title" is used to set a title to the list. Default : "My Checklist";

Contents :

  • Every elements of the list have to be inserted between '[' and ']'.
  • You can add a priority tag (1#) just after the '['. The priority tag will insert the element on the top

of the list with red background.


Download instructions [edit]

Please cut and paste the code found below and place it in $IP/extensions/my_list/my_list.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation [edit]

To install this extension, add the following to LocalSettings.php:

#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/my_list/my_list.php");

Configuration parameters [edit]

User rights [edit]

Code [edit]

<?php
/******************
http://aiantis.net
Author : Fricky
Version : 0.1 Beta
 
!!!!! This extension do not use MySQL db. !!!!!!!
 
DESCRIPTION
-------------
List is a very basic extension used as a memory list.
 
USAGE
------
Tags are : <my_list (parameters...)>(contents...)</my_list>.
 
Parameters : 
** "title=name_of_title" is used to set a title to the list. Default : "My Checklist";
 
Contents :
** Every elements of the list have to be inserted between '[' and ']'.
** You can add a priority tag (1#) just after the '['. The priority tag will insert the element on the top
of the list with red background.
 
 
EXAMPLE
--------
<my_list title=pikachu>
[1#one]
[two]
[1#three]
[four]
</my_list>
 
*********************************************************/
$wgExtensionFunctions[] = "my_List";
 
function my_List() {
        global $wgParser;
        $wgParser->setHook( "my_list", "build_list" );
        $wgParser->disableCache();
}
 
function build_list ( $input, $argv=array() )
{
        $count = 1;
        if ($argv['title'] != NULL)
                $title = $argv['title'];
        else
                $title = 'My check list :';
        $temp = explode('[', $input);
        while ($temp[$count] != NULL)
        {
                $content = explode(']', $temp[$count++]);
                $check = explode('#', $content[0]);
                if ($check[0] == '1')
                        $str .= "<div style='background:#ffd1d1'><input type='checkbox'>" . $check[1] . "</div>";
        }
$count = 1;
        while ($temp[$count] != NULL)
        {
                $content = explode(']', $temp[$count++]);
                $check = explode('#', $content[0]);
                if ($check[0] != '1')
                        $str .= "<div><input type='checkbox'>" . $content[0] . "</div>";
        }
        $str = "<table style='border:1px solid #e3e3e3'><tr><td><h3>" . $title . "</h3></td></tr><tr><td>" . $str . "</td></tr></table>";
        return $str;;
}
 
 
 
 
?>

See also [edit]