summaryrefslogtreecommitdiff
path: root/liberty_plugins
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2008-07-08 07:04:18 +0000
committerMax Kremmel <xing@synapse.plus.com>2008-07-08 07:04:18 +0000
commit58b1876efd528ae0f11d26a8679d26a769486a1d (patch)
tree337f0fdc885d0b302eceed0baf2e96a06286d70a /liberty_plugins
parent1d5f689d5df683f2d44f5d62005d7278c8f8d694 (diff)
downloadwiki-58b1876efd528ae0f11d26a8679d26a769486a1d.tar.gz
wiki-58b1876efd528ae0f11d26a8679d26a769486a1d.tar.bz2
wiki-58b1876efd528ae0f11d26a8679d26a769486a1d.zip
move some plugins to their new homes
Diffstat (limited to 'liberty_plugins')
-rw-r--r--liberty_plugins/data.wikigraph.php178
-rw-r--r--liberty_plugins/data.wikilist.php194
2 files changed, 372 insertions, 0 deletions
diff --git a/liberty_plugins/data.wikigraph.php b/liberty_plugins/data.wikigraph.php
new file mode 100644
index 0000000..6994d33
--- /dev/null
+++ b/liberty_plugins/data.wikigraph.php
@@ -0,0 +1,178 @@
+<?php
+/**
+ * @version $Revision: 1.1 $
+ * @package liberty
+ * @subpackage plugins_data
+ */
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2004, bitweaver.org
+// +----------------------------------------------------------------------+
+// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
+// |
+// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
+// | -> see http://phpdocu.sourceforge.net/
+// +----------------------------------------------------------------------+
+// | Author (TikiWiki): Unknown
+// | Reworked & Undoubtedly Screwed-Up for (Bitweaver)
+// | by: wolff_borg <wolff_borg@yahoo.com.au>
+// | Reworked from: wikiplugin_wikigraph.php - see deprecated code below
+// +----------------------------------------------------------------------+
+// $Id: data.wikigraph.php,v 1.1 2008/07/08 07:04:18 squareing Exp $
+/**
+ * definitions
+ */
+global $gBitSystem, $gLibertySystem;
+
+// only include this plugin if wiki is active and we have GraphViz
+if( $gBitSystem->isPackageActive( 'wiki' ) && @include_once( UTIL_PKG_PATH.'GraphViz.php' )) {
+
+define( 'PLUGIN_GUID_DATAWIKIGRAPH', 'datawikigraph' );
+$pluginParams = array (
+ 'tag' => 'WIKIGRAPH',
+ 'auto_activate' => FALSE,
+ 'requires_pair' => TRUE,
+ 'load_function' => 'data_wikigraph',
+ 'title' => 'WikiGraph',
+ 'help_page' => 'DataPluginWikiGraph',
+ 'description' => tra("Inserts a graph for visual navigation. The graph shows the page and every page that can be reached from that page."),
+ 'help_function' => 'data_wikigraph_help',
+ 'syntax' => "{WIKIGRAPH level= title= nodesep= rankdir= bgcolor= size= fontsize= fontname= shap= nodestyle= nodecolor= nodefillcolor= nodewidth= nodeheight= edgecolor= edgestyle= }".tra("Wiki page name")."{WIKIGRAPH}",
+ 'path' => LIBERTY_PKG_PATH.'plugins/data.wikigraph.php',
+ 'security' => 'registered',
+ 'plugin_type' => DATA_PLUGIN
+);
+$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAWIKIGRAPH, $pluginParams );
+$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAWIKIGRAPH );
+
+function data_wikigraph_help() {
+ $help =
+ '<table class="data help">'
+ .'<tr>'
+ .'<th>'.tra( "Key" ).'</th>'
+ .'<th>'.tra( "Type" ).'</th>'
+ .'<th>'.tra( "Comments" ).'</th>'
+ .'</tr>'
+ .'<tr class="odd">'
+ .'<td>level</td>'
+ .'<td>'.tra( "numeric").'<br />'.tra( "(optional)" ).'</td>'
+ .'<td>'.tra( "The number of levels that will be followed from the starting page." ).' '.tra( "Default").': 0</td>'
+ .'</tr>'
+ .'<tr class="even">'
+ .'<td>title</td>'
+ .'<td>'.tra( "string").'<br />'.tra( "(optional)" ).'</td>'
+ .'<td>'.tra( "Title of the graph.").' '.tra( "Default ").': Wiki-Graph</td>'
+ .'</tr>'
+ .'<tr class="even">'
+ .'<td>nodesep</td>'
+ .'<td>'.tra( "numeric").'<br />'.tra( "(optional)" ).'</td>'
+ .'<td>'.tra( "Distance between nodes in inches.").' '.tra( "Default").': 1.2</td>'
+ .'</tr>'
+ .'<tr class="even">'
+ .'<td>rankdir</td>'
+ .'<td>'.tra( "string").'<br />'.tra( "(optional)" ).'</td>'
+ .'<td>'.tra( "Direction of graph layout - can be Left to Right (LR), Right to Left (RL), Top to Bottom (TB), Bottom to Top (BT).").' '.tra( "Default").': TB</td>'
+ .'</tr>'
+ .'<tr class="even">'
+ .'<td>bgcolor</td>'
+ .'<td>'.tra( "html colour").'<br />'.tra( "(optional)" ).'</td>'
+ .'<td>'.tra( "Background colour of the graph.").' '.tra( "Default").': transparent</td>'
+ .'</tr>'
+ .'</table>'
+ .tra( "Example: " )."{wikigraph level=1}Welcome{/wikigraph}";
+ return $help;
+
+ /*
+ // old help - needs to be fulle converted into new format
+ $back = tra("^__Parameter Syntax:__ ") . "~np~{WIKIGRAPH" . tra("(key=>value)}~/np~\n");
+ $back.= tra("Inserts a graph for visual navigation. The graph shows the page and every page that can be reached from that page. Each node in the graph can be clicked to navigate to the selected page. Unless a PageName is included between the ") . "__~np~{WIKIGRAPH}~/np~__" . tra(" blocks, the graph will be created for the Current Page. __Note:__ This plugin requires the installation of ))GraphViz(( on the server.");
+ $back.= tra("||__::key::__ | __::value::__ | __::Comments::__\n");
+ $back.= "::level::" . tra(" | ::number:: | the number of levels that will be followed from the starting page. __Optional__ - can be omitted - the __Default = 0__ so only the links from the page will be displayed.\n");
+ $back.= "::title::" . tra(" | ::string:: | the title of the graph. __Optional__ - can be omitted - the __Default = ~034~Wiki-Graph~034~__.\n");
+ $back.= "::nodesep::" . tra(" | ::inches:: | the minimum distance between two nodes at the same level.Use the format __1.2__ in inches. __Optional__ - can be omitted - the __Default = .1__.\n");
+ $back.= "::rankdir::" . tra(" | ::string:: | direction of graph layout. Can be Left to Right ") . "__LR__ or __RL__" . tra(" Right to Left. Vertical graphs can also be made using Top to Bottom ") . "__TB__ or __BT__" . tra(" Bottom to Top. __Optional__ - can be omitted - the __Default = ") . "TB__.\n";
+ $back.= "::bgcolor::" . tra(" | ::colorname or hex color:: | specifies the background color for the graph. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = ~034~transparent~034~__.\n");
+ $back.= "::size::" . tra(" | ::inches:: | the width and height of the graph. Use the format __5,3__ in inches. If the graph is larger that the size it will be scaled down to fit. __Optional__ - can be omitted - the __Default = Unlimited__.\n");
+ $back.= "::fontsize::" . tra(" | ::points:: | the font size in points - used in all text. __Optional__ - can be omitted - the __Default = 9__.\n");
+ $back.= "::fontname::" . tra(" | ::font name:: | the name of the font used for the labels. It is better to use a font that is generally available, such as Times-Roman, Helvetica or Courier. __Optional__ - can be omitted - the __Default = Helvetica__.\n");
+ $back.= "::shap::" . tra(" | ::value:: | the shape of the nodes. Values can be") . "__a1 / box / circle / diamond / doublecircle / doubleoctagon / egg / ellipse / hexagon / house / invhouse / invtrapezium / invtriangle / Mcircle / Mdiamond / Msquare / octagon / parallelogram / pentagon / point / polygon / rect / rectangle / septagon / trapezium / triangle / tripleoctagon__." . tra(" __Optional__ - can be omitted - the __Default = ") . "box__.\n";
+ $back.= "::nodestyle::" . tra(" | ::value:: | the style used for creating the nodes. Values are: ") . "__dashed / dotted / solid / invis / bold / filled / diagonals / rounded__." . tra(" __Optional__ - can be omitted - the __Default = ") . "filled__.\n";
+ $back.= "::nodecolor::" . tra(" | ::colorname or hex-color:: | basic color for all graphics. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = #aeaeae__ (a light gray).\n");
+ $back.= "::nodefillcolor::" . tra(" | ::colorname or hex-color:: | specifies the background color for the nodes. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = #FFFFFF__ (White).\n");
+ $back.= "::nodewidth::" . tra(" | ::inches:: | width of the nodes. This is the initial, minimum width of a node. Use the format __1.2__ in inches. __Optional__ - can be omitted - the __Default = .1__.\n");
+ $back.= "::nodeheight::" . tra(" | ::inches:: | height of the nodes. This is the initial, minimum height of a node. Use the format __1.2__ in inches. __Optional__ - can be omitted - the __Default = .1__.\n");
+ $back.= "::edgecolor::" . tra(" | ::colorname or hex-color:: | specifies the color of the links. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = #999999__ (a darker gray).\n");
+ $back.= "::edgestyle::" . tra(" | ::value:: | the shape of the arrow that points at the link. Values are: ") . "__normal / inv / dot / invdot / odot / invodot / none / tree / empty / invempty / diamond / ediamond / odiamond / crow / box / obox / open / halfopen__." . tra(" __Optional__ - can be omitted - the __Default = ") . "normal__.||^"; // This one may not be correct - this had a default of "solid" but the ArrowTypes given at http://www.research.att.com/~erg/graphviz/info/attrs.html#k:arrowType specify the default as "normal"
+ $back.= tra("^__Example:__ ") . "~np~{WIKIGRAPH(level=>0)}HomePage{WIKIGRAPH}~/np~^";
+ $back.= tra("^__Note 1:__ Plugin's are __case sensitive__. The Name of the plugin __MUST__ be UPPERCASE. The Key(s) are __always__ lowercase. Some Values are mixed-case but most require lowercase. When in doubt - look at the Example.\n");
+ $back.= tra("__Note 2:__ A listing of ColorNames can be found at ") . "<a class='wiki' target=" . '"_blank"' . " href='http://www.tikipro.org/wiki/index.php?page=Browser+ColorNames/'>" . tra("TikiPro</a>^");
+ $back.= tra("__Note 3:__ One useful place for obtaining HTML colors is ") . "<a class='wiki' target=" . '"_blank"' . " href='http://www.pagetutor.com/pagetutor/makapage/picker/'>" . tra("The Color Picker II</a>^");
+ */
+}
+
+include_once( WIKI_PKG_PATH.'BitPage.php');
+
+function data_wikigraph( $pData, $pParams ) {
+ global $gContent;
+
+ $add = "";
+ $ret = " ";
+
+ $ommit = array( 'title', 'data' );
+ foreach( $pParams as $param => $value ) {
+ if( !in_array( $param, $ommit ) && !is_numeric( $param ) ) {
+ $add .= "&amp;{$param}={$value}";
+ }
+ }
+
+ if( empty( $title ) ) {
+ $title = "Wiki-Graph";
+ }
+
+ if( empty( $pData ) ) {
+ $pData = ( ( !is_object( $gContent ) || empty( $gContent->mInfo['title'] ) ) ? NULL : $gContent->mInfo['title'] );
+ }
+
+ $level = isset( $level ) ? $level : "0";
+
+ if( !empty( $pData ) ) {
+ $garg = array(
+ 'att' => array(
+ 'level' => !empty( $level ) ? $level : ".1",
+ 'nodesep' => isset( $nodesep ) ? $nodesep : ".1",
+ 'rankdir' => isset( $rankdir ) ? $rankdir : "LR",
+ 'bgcolor' => isset( $bgcolor ) ? $bgcolor : "transparent",
+ 'size' => isset( $size ) ? $size : ""
+ ),
+ 'node' => array(
+ 'fontsize' => isset( $fontsize ) ? $fontsize : "10",
+ 'fontname' => isset( $fontname ) ? $fontname : "sans",
+ 'shape' => isset( $shape ) ? $shape : "box",
+ 'style' => isset( $nodestyle ) ? $nodestyle : "filled",
+ 'color' => isset( $nodecolor ) ? $nodecolor : "#aaaaaa",
+ 'fillcolor' => isset( $nodefillcolor ) ? $nodefillcolor : "#f5f5f5",
+ 'width' => isset( $nodewidth ) ? $nodewidth : ".1",
+ 'height' => isset( $nodeheight ) ? $nodeheight : ".1"
+ ),
+ 'edge' => array(
+ 'color' => isset( $edgecolor ) ? $edgecolor : "#aa8866",
+ 'style' => isset( $edgestyle ) ? $edgestyle : "solid"
+ )
+ );
+
+ $mapname=md5(uniqid("."));
+ $ret = "<div align='center'><img border='0' src=\"".WIKI_PKG_URL."wiki_graph.php?page=".urlencode($pData)."{$add}\" alt='{$title}' usemap='#$mapname' />";
+
+ if( !empty( $pData ) && !empty( $garg ) ) {
+ $wikilib = new WikiLib();
+ $mapdata = $wikilib->get_graph_map( $pData, $level, $garg );
+ $mapdata = preg_replace( "/\n|\r/", '', $mapdata );
+ $ret .= "<map name='$mapname'>$mapdata</map>";
+ $ret .= "</div>";
+ }
+ }
+ return $ret;
+}
+
+} // wiki package and graphviz check
+?>
diff --git a/liberty_plugins/data.wikilist.php b/liberty_plugins/data.wikilist.php
new file mode 100644
index 0000000..0715b48
--- /dev/null
+++ b/liberty_plugins/data.wikilist.php
@@ -0,0 +1,194 @@
+<?php
+/**
+ * @version $Revision: 1.1 $
+ * @package liberty
+ * @subpackage plugins_data
+ */
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2004, bitweaver.org
+// +----------------------------------------------------------------------+
+// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
+// |
+// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
+// | -> see http://phpdocu.sourceforge.net/
+// +----------------------------------------------------------------------+
+// | Author (TikiWiki): Unknown
+// | Reworked & Undoubtedly Screwed-Up for (Bitweaver)
+// | by: StarRider <starrrider@sourceforge.net>
+// | Reworked from: wikiplugin_wikilist.php - see deprecated code below
+// +----------------------------------------------------------------------+
+// $Id: data.wikilist.php,v 1.1 2008/07/08 07:04:18 squareing Exp $
+
+/**
+ * definitions
+ */
+define( 'PLUGIN_GUID_DATAWIKILIST', 'datawikilist' );
+global $gLibertySystem;
+$pluginParams = array (
+ 'tag' => 'WIKILIST',
+ 'auto_activate' => FALSE,
+ 'requires_pair' => TRUE,
+ 'load_function' => 'data_wikilist',
+ 'title' => 'WikiList - This plugin is not yet functional.', // Remove this line when the plugin becomes operational
+// 'title' => 'WikiList', // and Remove the comment from the start of this line
+ 'help_page' => 'DataPluginWikiList',
+ 'description' => tra("Displays an alphabetically sorted list of WikiPages"),
+ 'help_function' => 'data_wikilist_help',
+ 'syntax' => "{WIKILIST num= alpha= total= list= }Group Name{WIKILIST} ",
+ 'path' => LIBERTY_PKG_PATH.'plugins/data.wikilist.php',
+ 'security' => 'registered',
+ 'plugin_type' => DATA_PLUGIN
+);
+$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAWIKILIST, $pluginParams );
+$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAWIKILIST );
+
+// Help Function
+function data_wikilist_help() {
+ $help = '
+ <table class="plugin help">
+ <tr>
+ <th>'.tra( 'key' ).'</th>
+ <th>'.tra( 'type' ).'</th>
+ <th>'.tra( 'comments' ).'</th>
+ </tr>
+ <tr class="odd">
+ <td>num</td>
+ <td>'.tra( '0 or 1' ).'</td>
+ <td>'.tra( 'Adds numbering to the list. Default = 0 (no numbering).' ).'</td>
+ </tr>
+ <tr class="even">
+ <td>alpha</td>
+ <td>'.tra( '0 or 1' ).'</td>
+ <td>'.tra( 'Sorts names alphabetically and groups them by the beginning letter. Default = 1 (sorting and grouping are active).' ).'</td>
+ </tr>
+ <tr class="odd">
+ <td>list</td>
+ <td>'.tra( 'all / userpages / wiki' ).'</td>
+ <td>'.tra( 'Defines the type of pages to be shown. Wiki and user pages will only show those type of pages. Default = all.' ).'</td>
+ </tr>
+ <tr class="odd">
+ <td>total</td>
+ <td>'.tra( '0 or 1' ).'</td>
+ <td>'.tra( 'Shows total number of users in list at the end. Default = On (1)' ).'</td>
+ </tr>
+ <tr class="odd">
+ <td>GroupName</td>
+ <td>'.tra( 'not a parameter' ).'</td>
+ <td>'.tra( 'Given between {WIKILIST} blocks. If no GroupName is given, All Users is assumed.' ).'</td>
+ </tr>
+ </table>
+ Example: {WIKILIST}';
+ return $help;
+}
+
+// Load Function
+function data_wikilist($data, $params) {
+ $ret = "This plugin has not been completed as yet. ";
+ return $ret;
+}
+/******************************************************************************
+The code below is from the deprecated WIKILIST plugin. All comments and the help routines have been removed. - StarRider
+
+// Displays an alphabetically sorted list of WikiPages
+// Use:
+// {WIKILIST(num=>1,alpha=>1,total=>1,list=>all)}{WIKILIST}
+// num=>1 --> writes a number in front of every name default = 0
+// alpha=>1 --> shows names in groups of beginning letters default = 1
+// list=> default = all
+// all --> shows the wiki list and appends the userPage list
+// userpages --> shows all userPages without showing the wiki list
+// wiki --> shows the wiki list without showing the userpages
+// total=>1 --> shows total number of users in list at the end default = 1
+//
+// If no groupname is given, plugin returns all users
+
+
+// function used to sort an array - NOT case-sensitive
+function wikiplugin_compare_wikipages($a, $b) {
+ return strcmp(strtolower($a), strtolower($b));
+}
+
+function wikiplugin_wikilist($data, $params) {
+ global $gBitSystem;
+ global $hotwords;
+ // turn off $hotwords to avoid conflicts
+ $hotwords = 'n';
+
+ extract ($params, EXTR_SKIP);
+ if(!isset($alpha)) { $alpha = 1; }
+ if(!isset($userpages)) { $userpages = "all"; }
+ if(!isset($num)) { $num = 0; }
+ if(!isset($total)) { $total = 1; }
+
+ $ret = "";
+ $pagedata = $gBitSystem->list_pages(0);
+
+ foreach ($pagedata['data'] as $pagedata_temp) {
+ $wiki_pages_all[] = $pagedata_temp['pageName'];
+ }
+
+ // sort the pages
+ usort($wiki_pages_all, "wikiplugin_compare_wikipages");
+
+ // sort the userpages from the rest of the wikipages
+ foreach ($wiki_pages_all as $pagename) {
+ if(strstr($pagename,"userPage") == false){
+ $wiki_pages[] = $pagename;
+ }
+ else {
+ $user_pages[] = $pagename;
+ }
+ }
+
+ if ($list != "userpages") {
+ $wp_list_count = 0;
+ foreach ($wiki_pages as $pagename) {
+ if ($wp_list_count >= 1) {
+ $prev_pagename = $wiki_pages[$wp_list_count-1];
+ }
+ else {
+ $prev_pagename = 0;
+ }
+ $wp_list_count++;
+
+ if ($alpha != 0) {
+ if (strtolower($prev_pagename[0]) != strtolower($pagename[0])) {
+ $ret .= ("-=".strtoupper($pagename[0])."=-\n");
+ }
+ }
+
+ if ($num != 0) {
+ $ret .= ($wp_list_count." ");
+ }
+
+ $ret .= ("((".$pagename."))\n");
+ }
+
+ if ($total != 0) {
+ $ret .= ("<br />".tra("Total").": ".$wp_list_count."\n");
+ }
+ }
+
+ if ($list != "wiki") {
+ $ret .= ("-=userPages=-\n");
+
+ $wp_list_count = 0;
+ foreach ($user_pages as $user_title) {
+ $wp_list_count++;
+ if ($num != 0) {
+ $ret .= ($wp_list_count." ");
+ }
+
+ $ret .= ("((".$user_title."))\n");
+ }
+
+ if ($total != 0) {
+ $ret .= ("<br />".tra("Total").": ".$wp_list_count."\n");
+ }
+ }
+
+ return $ret;
+}
+*/
+?>