Index: /documentation/trunk/packages/dokuwiki-2011-05-25a/data/pages/wiki/development.txt
===================================================================
--- /documentation/trunk/packages/dokuwiki-2011-05-25a/data/pages/wiki/development.txt	(revision 30099)
+++ /documentation/trunk/packages/dokuwiki-2011-05-25a/data/pages/wiki/development.txt	(revision 30100)
@@ -1,3 +1,28 @@
 ====== Development ======
+
+===== Frequently Asked Questions =====
+
+==== Q. How do you enable login to wiki using Greenstone registration? ====
+
+The code changes to allow for Greenstone registration integration should already be present in the dokuwiki retrieved from Greenstone's SVN. To configure the dokuwiki for login follow these instructions:
+  - Copy ''<dokuwiki>/conf/mysql.conf.php.example'' to ''<dokuwiki>/conf/mysql.conf.php''
+  - Edit the ''mysql.conf.php'' file to have the correct details:<code>$conf['auth']['mysql']['server']   = 'localhost';
+$conf['auth']['mysql']['user']     = 'greenstonewiki';
+$conf['auth']['mysql']['password'] = '********';
+$conf['auth']['mysql']['database'] = 'gs_services';</code>
+  - While still in the conf directory, create a file ''local.protected.php'' with the content:<code><?php
+require_once('mysql.conf.php');
+?></code>
+  - Edit the file ''local.php'' and ammend/add the line:<code>...
+$conf['authtype'] = 'mysql';
+...</code>
+  - Ensure the permissions for all three files you've edited are correct as to be readble by the //nzdl// group
+  - Disable Dokuwiki's built-in register and email new password abilities by editing ''<dokuwiki>/conf/local.php'' and adding (or updating):<code>$conf['disableactions'] = 'register,resendpwd';</code>Alternatively, you can set these in the "Configuration Settings" page within the "Admin" page. **Note** a later customization step will add back in links to the global Greenstone registration system.
+
+==== Q. How do I create a page? ====
+
+The easiest way is to use the search box in the left navigation to search for a page that isn't already created. Include in the search any path/namespace as required. For instance, we (originally) created this page by searching for:<code>faq</code>but we could have included a path like so:<code>Manuals:User:Section1</code>which would create a ''Manuals'' folder, with a ''User'' folder within it, and finally the ''Section1'' page within that.
+
+When you search for a page that isn't there, the result page will helpfully suggest //"If you didn't find what you were looking for, you can create or edit the page named after your query with the appropriate button."// However, instead of a button, in this page template you'll need to click the tab at the top of the search results page labelled ''create this page''.  If it all works you should find yourself in a textarea editor entering content for the page. Click ''Preview'' to review your content for formatting etc, and ''Save'' to commit changes to the page.
 
 ===== Installation =====
@@ -32,9 +57,12 @@
   * [[http://www.dokuwiki.org/plugin:publish|Publish]] - integrate a publishing process into DokuWiki (differentiating between draft and approved copies of pages)
   * [[http://www.dokuwiki.org/plugin:tablewidth|TableWidth]] - allows the width of tables and table cells to be defined
-
+  * [[:wiki:development#custom_plugins|SimpleTabs]] - as explained below.
 
 ===== Customizations =====
 
+**Note:** The diffs regarding the main Dokuwiki code are against the stable release 2011-05-25a "Rincewind". 
 ==== Dokuwiki ====
+
+=== inc/common.php ===
 
 ^ File  ^ Changes  ^
@@ -53,4 +81,109 @@
      }
 </code> ||
+
+=== inc/html.php ===
+
+^ File  ^ Changes  ^
+^ inc/html.php  | Add id attributes to the table of contents list items so we can hide the ones on currently hidden tabs. Allow for a 'reset' header to be specified by the user in order to 'break out of' the current TOC nesting (for instance, at the end of a tabbed area to prevent following headings being grouped under Tab area headings).  |
+| <code diff u>
+--- html.original.php	2014-03-13 11:16:37.000000000 +1300
++++ html.php	2014-03-13 11:13:34.000000000 +1300
+@@ -758,9 +758,28 @@ function html_li_index($item){
+  *
+  * @author Andreas Gohr <andi@splitbrain.org>
+  */
++// In order to alter the TOC when a user changes a tab, we
++// need some way to uniquely identify what titles lurk in
++// what tabs. Dokuwiki automagically labels headers with
++// <a name=""> tags - so if I use the same information here
++// they should match (and be unique etc)
++// - jmt12
++// At some stage the traditional 'link' attribute was (some-
++// times) replaced with information in 'hid'
++// - jmt12 2014MAR13
+ function html_li_default($item)
+ {
+-    return '<li class="level' . $item['level'] . '">';
++  $link = $item['link'];
++  if (isset($item['hid']) && !empty($item['hid']))
++    {
++      $link = $item['hid'];
++    }
++  $hash_pos = strpos($link, '#');
++  if ($hash_pos !== false)
++    {
++      $link = substr($link, $hash_pos + 1);
++    }
++  return '<li id="toc_' . $link . '" class="level' . $item['level'] . '">';
+ }
+
+ /**
+@@ -784,7 +803,24 @@ function html_buildlist($data,$class,$fu
+     $ret   = '';
+ 
+     foreach ($data as $item){
+-	if( $item['level'] > $level ){
++      // A reset closes all TOC items, all the way back to the top
++      if ($item['title'] == '#')
++	{
++	  //close last item
++	  $ret .= "</li>\n";
++	  while( $level > 0 && $open > 0 ){
++	    //close higher lists
++	    $ret .= "</ul>\n</li>\n";
++	    $level--;
++	    $open--;
++	  }
++	  // open a dummy item list, although we don't output a list item
++	  $ret .= "<li class=\"clear\">\n<ul class=\"$class\">\n<li class=\"clear\">";
++	  $level++;
++	  $open++;
++	  // skip to next item
++	  continue;
++	}elseif( $item['level'] > $level ){
+             //open new list
+             for($i=0; $i<($item['level'] - $level); $i++){
+                 if ($i) $ret .= "<li class=\"clear\">\n";
+</code>||
+
+
+=== inc/lang/en/login.txt ===
+
+^ File  ^ Changes  ^
+^ inc/lang/en/login.txt  | Add a link to the global Greenstone registration / password reset page (because we have disabled Dokuwiki's built-in user stuff at the top of this page).  |
+| <code diff u>
+--- dokuwiki-2011-05-25a/inc/lang/en/login.txt	2012-02-09 10:17:32.000000000 +1300
++++ greenstone-wiki/inc/lang/en/login.txt	2013-10-24 12:12:14.000000000 +1300
+@@ -2,3 +2,4 @@
+ 
+ You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
+ 
++Don't have an account? [[http://www.greenstone.org/users?&returnto=GreenstoneWiki|Create an account or email new password]].
+</code>||
+=== inc/parserutils.php ===
+
+^ File  ^ Changes  ^
+^ inc/parserutils.php  | Add a check to an introspective call to ensure that the function called exists in the class //before// calling it - otherwise the logs fill up with warnings from classes that don't (i.e. ''Doku_Renderer_metadata'') |
+| <code diff u>
+--- /greenstone/greenstone-documentation/packages/dokuwiki-2011-05-25a/inc/parserutils.php	2012-02-01 16:03:06.000000000 +1300
++++ parserutils.php	2013-09-19 10:46:58.000000000 +1200
+@@ -522,7 +522,12 @@ function p_render_metadata($id, $orig){
+         // loop through the instructions
+         foreach ($instructions as $instruction){
+             // execute the callback against the renderer
+-            call_user_func_array(array(&$renderer, $instruction[0]), (array) $instruction[1]);
++	    // - check we can, first, otherwise logs fill up with warnings
++	    $handler = array(&$renderer, $instruction[0]);
++	    if (is_callable($handler))
++            {
++              call_user_func_array($handler, (array) $instruction[1]);
++	    }
+         }
+ 
+         $evt->result = array('current'=>&$renderer->meta,'persistent'=>&$renderer->persistent);
+</code>||
+=== inc/parser/handler.php ===
+
+^ File  ^ Changes  ^
 ^ inc/parser/handler.php  | Hide HTML comments (namely text ids) in headings  |
 | <code diff u>
@@ -68,8 +201,26 @@
          $this->_addCall('header',array($title,$level,$pos), $pos);
 </code> ||
-^ inc/parser/xhtml.php  | Heavily altered //_highlight()// in order to allow the id specifying HTML comments to remain hidden. Added macro to external urls to allow for links to pages on the same host.  |
+
+=== inc/parser/xhtml.php ===
+
+^ File  ^ Changes  ^
+^ inc/parser/xhtml.php  | Hide the reset header (whose content is simply "#"). Heavily altered //_highlight()// in order to allow the id specifying HTML comments to remain hidden. Added macro to external urls to allow for links to pages on the same host.  |
 | <code diff u>
 --- dokuwiki-2011-05-25a/inc/parser/xhtml.php	2011-06-15 07:58:54.000000000 +1200
 +++ dokuwiki/inc/parser/xhtml.php	2012-01-23 13:16:49.317187175 +1300
+@@ -170,6 +170,12 @@
+         }
+         $this->lastlevel = $level;
+ 
++	// Hide the 'reset' header
++        if ($text == '#')
++	{
++	  return;
++	}
++
+         if ($level <= $conf['maxseclevel'] &&
+             count($this->sectionedits) > 0 &&
+             $this->sectionedits[count($this->sectionedits) - 1][2] === 'section') {
+             
 @@ -449,19 +449,24 @@
              $text = substr($text, 0, -1);
@@ -118,8 +269,23 @@
          $link['style']  = '';
 </code> ||
-
 ===== Plugins =====
 
+==== Custom Plugins ====
+
+=== SimpleTabs ===
+
+Support for simple tabbed areas (as compared to the existing complicated tabbed area plugins ala [[https://www.dokuwiki.org/plugin:tabinclude|TabInclude]]) is provided through a custom-built plugin. To reinstall:
+  * download {{:wiki:simpletabs-2014dec05.tgz|SimpleTabs}} (5.5K)
+  * extract to ''<dokuwiki>/lib/plugins/''
+The syntax looks like this:<code><TABAREA tabs="comma,separated,list">
+<TAB>content for 'comma' //including// wiki <del>magic</del> formatting</TAB>
+<TAB>content for 'separated' and a [[:playground|link]]</TAB>
+<TAB>content for 'list'</TAB>
+</TABAREA></code>
+
+Older versions: {{:wiki:simpletabs-2013sep18.tgz|2013SEP18}} (5.0K) {{:wiki:simpletabs-2013aug02.tgz|2013AUG02}} (4.3K)
 ==== Code ====
+
+Diff against [[http://wiki.splitbrain.org/plugin:code2|code2]] plugin dated 2008-07-22.
 
 ^ File  ^ Changes  ^
@@ -137,6 +303,7 @@
  	} // _entities()
 </code>  ||
-
 ==== HTMLComment ====
+
+Diff against [[http://wiki.splitbrain.org/plugin:htmlcomment|htmlcomment]] plugin dated 2005-10-08.
 
 ^ File  ^ Changes  ^
@@ -216,6 +383,7 @@
          }
 </code> ||
-
 ==== ImageReference ====
+
+Diff against [[http://wiki.splitbrain.org/plugin:imagereference|imagereference]] plugin dated 2008-05-30.
 
 ^ File  ^ Changes  ^
@@ -476,4 +644,6 @@
 ==== Publish ====
 
+Diff against [[http://www.dokuwiki.org/plugin:publish|publish]] plugin dated 2011-10-02.
+
 ^ File  ^ Changes  ^
 ^ action.php  | Never display "previous version" span - you can always look under old revisions anyway. In fact, try to hide the 'publish state' message unless the user is looking at a draft or if they are an editor (whereupon they may be interested in when a page was last approved etc)  |
@@ -561,9 +731,11 @@
 ==== Monobook ====
 
+Diff against [[https://www.dokuwiki.org/template:monobook|monobook]] template dated 2011-12-10.
+
 ^ File  ^ Changes  ^
 ^ main.php  | Removed positioning test so that the hierarchy navigation appears at both the top and bottom of pages (rather than one or the other)  |
 |  <code diff u>
 --- dokuwiki-2011-05-25a/lib/tpl/monobook/main.php	2012-01-23 13:37:25.353131918 +1300
-+++ dokuwiki/lib/tpl/monobook/main.php	2012-01-16 12:30:35.131067643 +1300
++++ dokuwiki/lib/tpl/monobook/main.php	2013-10-24 12:22:48.000000000 +1300
 @@ -613,8 +613,8 @@
                $ACT !== "media" && //var comes from DokuWiki
@@ -587,10 +759,59 @@
                echo "\n          <div class=\"catlinks noprint\"><p>\n            ";
                tpl_youarehere();
-               echo "\n          </p></div>\n";
+               echo "\n          </p></div>\n";               
+@@ -698,7 +698,7 @@
+           //default
+           echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
+       }
+-      echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
++      echo " accesskey=\"h\" title=\"Back to start [ALT+H]\"></a>\n";
+       ?>
+     </div>
+     <?php
+@@ -733,7 +733,7 @@
+                 echo "          <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("monobook_discuss_ns").ltrim(tpl_getConf("monobook_userpage_ns"), ":").$loginname, hsc($lang["monobook_tab_mytalk"]))."</li>";
+             }
+             //profile
+-            echo  "          <li id=\"pt-preferences\"><a href=\"".wl(cleanID(getId()), array("do" => "profile"))."\" rel=\"nofollow\">".hsc($lang["btn_profile"])."</a></li>\n"; //language comes from DokuWiki core
++            echo  "          <li id=\"pt-preferences\"><a href=\"http://www.greenstone.org/users/change.php\" rel=\"nofollow\">".hsc($lang["btn_profile"])."</a></li>\n"; //language comes from DokuWiki core
+             //logout
+             echo  "          <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout"))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core
+         }  
 </code>  ||
-^ static/css/screen.css  | Restrict the width of code blocks - otherwise they'll push out past the 1000px limit anyway - and set them to use scrollbars for any overflow.  |
-| <code diff u>
---- dokuwiki-2011-05-25a/lib/tpl/monobook/static/css/screen.css	2012-01-23 13:44:38.685377461 +1300
-+++ dokuwiki/lib/tpl/monobook/static/css/screen.css	2012-01-23 11:43:23.188315618 +1300
+^ static/css/screen.css  | Restrict the width of code blocks - otherwise they'll push out past the 1000px limit anyway - and set them to use scrollbars for any overflow.  Making h5 different (I can't remember why). Two little fixes for the new simple tabbed area where there are extra pixels sneaking in between the tabs and the tab content areas. |
+| <code diff u>
+--- screen.css.original	2012-12-13 12:54:13.000000000 +1300
++++ screen.css	2013-08-02 12:00:08.000000000 +1200
+@@ -535,10 +535,12 @@ div#content .dokuwiki h1 a,
+ div#content .dokuwiki h2 a,
+ div#content .dokuwiki h3 a,
+ div#content .dokuwiki h4 a,
+-div#content .dokuwiki h5 a,
+ div#content .dokuwiki h6 a {
+   color: __text__;
+ }
++div#content .dokuwiki h5 a {
++  color: __background__;
++}
+ div#content .dokuwiki h1 a:hover,
+ div#content .dokuwiki h2 a:hover,
+ div#content .dokuwiki h3 a:hover,
+@@ -571,6 +573,7 @@ div#content .dokuwiki h4 {
+ }
+ div#content .dokuwiki h5 {
+   font-size: 100%;
++  color: __background__;
+ }
+ div#content .dokuwiki h6 {
+   font-size: 80%;
+@@ -629,7 +632,7 @@ div.dokuwiki li.closed {
+ 
+ div#content div.dokuwiki li {
+   margin-left: 0;
+-  margin-bottom: 1px;
++  margin-bottom: 0;
+ }
+ 
+ /* quotes */
 @@ -678,6 +678,8 @@
    line-height: 1.2em;
@@ -602,6 +823,28 @@
  div#content .dokuwiki dl.file,
  div#content .dokuwiki dl.file dd {
-</code> ||
-^ static/3rd/monobook/main.css  | Reduce the text area to around 1000px by centring main div and other absolute divs (logo and top navigation).  |
+@@ -1338,3 +1343,7 @@ textarea,
+   #font-weight: bold;
+   #border-left: 1px dashed __background__; /* invisible border triggers IE to render the stuff */
+ }
++
++div.tab {
++ margin-top:-1px;
++}
+</code> ||
+^ static/3rd/dokuwiki/_tabs.css  | Remove the override of foreground and background colours. |
+| <code diff u>
+--- _tabs.css.original	2013-08-02 12:07:12.000000000 +1200
++++ _tabs.css	2013-08-02 12:07:36.000000000 +1200
+@@ -19,8 +19,6 @@
+     float: left;
+     padding: .3em .8em;
+     margin: 0 .3em 0 0;
+-    background-color: __background_neu__;
+-    color: __text__;
+     border-radius: .5em .5em 0 0;
+ }
+ .dokuwiki ul.tabs li strong {
+</code> ||
+^ static/3rd/monobook/main.css  | Reduce the text area to around 1000px by centring main div and other absolute divs (logo and top navigation).  Rename the style "preferences" to "preftitle" to prevent CSS being randomly injected where-ever you end up with an anchor tag that just happens to have the word preferences in it (happens surprisingly often in instruction manuals). I can't actually find where this style is used anyway. |
 | <code diff u>
 --- dokuwiki-2011-05-25a/lib/tpl/monobook/static/3rd/monobook/main.css	2012-01-23 13:41:54.253064506 +1300
@@ -646,12 +889,12 @@
  	overflow: visible;
  	background: none;
-@@ -869,7 +872,7 @@
-         margin: 0 auto;
- 	list-style: none;
- 	font-size: 95%;
--        font-weight: normal;
-+font-weight: normal;
- }
- #p-cactions .hiddenStructure {
- 	display: none;
-</code> ||
+@@ -1034,7 +1037,7 @@
+ 	padding-top: 2em;
+ 	clear: both;
+ }
+-#preferences {
++#preftitle {
+ 	margin: 0;
+ 	border: 1px solid #aaa;
+ 	clear: both;
+</code> ||
