====== Development ====== ===== Installation ===== - Checkout the ''gsdl-docs'' package out of SVN - Go to ''/lib/dokuwiki/'' and untar the [[http://www.dokuwiki.org/dokuwiki|dokuwiki]] tarball (currently the stable version [[http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2011-05-25a.tgz|Ricewind]]) - Go back up to ''/'' and create a symlink to the folder you just unpacked called just ''dokuwiki'':ln -s ./lib/dokuwiki/dokuwiki- ./dokuwiki - Copy all of the archive files in ''/lib/dokuwiki/plugins/'' into ''/dokuwiki/lib/plugins/'', then unpack * **note** you may need to rename the plugin folders---you'll find Dokuwiki will complain about incorrectly named folders at startup - Similarly, copy the ''monobook'' template archive from ''/lib/dokuwiki/templates'' to ''/dokuwiki/lib/tpl/'' and unpack - Setup your webserver (as needed) so you can access this dokuwiki directory and run the PHP scripts therein - Visit the dokuwiki installer page in a web browser. For example, if you're webserver is running on ''localhost'', at port ''8080'', and the path to ''/'' //is// ''/gsdl-docs'', then visit:http://localhost:8080/gsdl-docs/dokuwiki/install.php - Follow the setup instructions, and then follow the recommended [[http://www.dokuwiki.org/security|security settings]] for Dokuwiki, including renaming the ''install.php'' file - Overwrite the default configuration by copying the file ''/lib/dokuwiki/conf/local.php'' to ''/dokuwiki/conf/'' overwriting the existing file - Recursively copy the starting pages file into place, overwriting existing files if promptedcp -r /lib/dokuwiki/pages/ /dokuwiki/data/pages/ * **note** there is a copy of these instructions in the starting files, located at [[wiki:development]] - Enter ''/lib/php/'' - Run each of these commands in order to transform the manual's XML files into Dokuwiki pages:php gs-manuals-import.php -m user php gs-manuals-import.php -m install php gs-manuals-import.php -m develop php gs-manuals-import.php -m paper * **note** these require a command line version of PHP to be available on the path - Enter the wiki again, log in using the administrator account you created when installing, and then visit each manual wiki page, 'edit' it and click approve ===== Required Plugins ===== * [[http://www.dokuwiki.org/plugin:captcha|Captcha]] - Use a CAPTCHA challenge to protect DokuWiki against automated spam * [[http://wiki.splitbrain.org/plugin:code2|Code2]] - Enhanced code syntax highlighting with line numbering * [[http://wiki.splitbrain.org/plugin:htmlcomment|HTMLComment]] - allows HTML comments to be retained in the output * [[http://wiki.splitbrain.org/plugin:ifauth|IFAuth]] - so content only for specific groups and/or users * [[http://wiki.splitbrain.org/plugin:imagereference|ImageReference]] - create image references like latex is doing with figures * [[http://dokuwiki.org/plugin:orphanswanted|OrphansWanted]] - provide macros to list orphan pages and wanted pages * [[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 ===== Customizations ===== ==== Dokuwiki ==== ^ File ^ Changes ^ ^ inc/common.php | Allow for 'no change' submissions as long as the Approve flag is ticked (see documentation for [[http://www.dokuwiki.org/plugin:publish|plugin:publish]]) | | --- dokuwiki-2011-05-25a/inc/common.php 2011-06-15 07:58:53.000000000 +1200 +++ dokuwiki/inc/common.php 2012-01-17 13:53:12.860063701 +1300 @@ -973,7 +973,8 @@ global $lang; global $REV; // ignore if no changes were made - if($text == rawWiki($id,'')){ + // - [jmt12] unless the approved checkbox is set + if(!$_POST['approved'] && $text == rawWiki($id,'')){ return; } || ^ inc/parser/handler.php | Hide HTML comments (namely text ids) in headings | | --- dokuwiki-2011-05-25a/inc/parser/handler.php 2011-06-15 07:58:54.000000000 +1200 +++ dokuwiki/inc/parser/handler.php 2011-12-16 11:37:45.036066485 +1300 @@ -97,6 +97,9 @@ $title = trim($title,'='); $title = trim($title); + // Hide HTML comments [jmt12] + $title = preg_replace('/<\!--[^>]*-->/','',$title); + if ($this->status['section']) $this->_addCall('section_close',array(),$pos); $this->_addCall('header',array($title,$level,$pos), $pos); || ^ 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. | | --- 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 @@ -449,19 +449,24 @@ $text = substr($text, 0, -1); } + // - code HTML is now temporarily stored in a local string so we can + // restore specific HTML comments [jmt12] + $code_text = ''; if ( is_null($language) ) { - $this->doc .= '
'.$this->_xmlEntities($text).'
'.DOKU_LF; + $code_text = '
'.$this->_xmlEntities($text).'
'.DOKU_LF; // [jmt12] } else { $class = 'code'; //we always need the code class to make the syntax highlighting apply if($type != 'code') $class .= ' '.$type; - $this->doc .= "
".p_xhtml_cached_geshi($text, $language, '').'
'.DOKU_LF; + $code_text = "
".p_xhtml_cached_geshi($text, $language, '').'
'.DOKU_LF; // [jmt12] } + // - restore id comments! [jmt12] + $code_text = preg_replace('/\<\;\!\-\-\s+id\:([^\s]+)\s+\-\-\>\;/','', $code_text); + $this->doc .= $code_text; // [jmt12] if($filename){ $this->doc .= ''.DOKU_LF; } $this->_codeblock++; } @@ -665,6 +670,16 @@ $class='media'; } + // [jmt12] Replace the macro ~~localhost~~ with the hostname (and port + // number if necessary) of the current host + if (preg_match('/^http:\/\/~~baseurl~~(\/.*)$/', $url, $matches)) + { + $host = $_SERVER['HTTP_HOST']; + $path = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')); + $url = 'http://' . $host . $path . $matches[1]; + } + // [jmt12] + //prepare for formating $link['target'] = $conf['target']['extern']; $link['style'] = '';
|| ===== Plugins ===== ==== Code ==== ^ File ^ Changes ^ ^ syntax.php | Restore the HTML comments containing text fragment ids to be proper hidden comments. | | --- dokuwiki-2011-05-25a/lib/plugins/code/syntax.php 2012-01-23 11:16:05.033314469 +1300 +++ dokuwiki/lib/plugins/code/syntax.php 2012-01-23 11:16:19.122156271 +1300 @@ -226,6 +226,8 @@ function &_entities(&$aString) { $aString = str_replace(array('&', '<', '>'), array('&', '<', '>'), $aString); + // [jmt12] Restore the hidden ids to normal HTML comments + $aString = preg_replace('/<!-- id:(.*?) -->/','', $aString); return $aString; } // _entities() || ==== HTMLComment ==== ^ File ^ Changes ^ ^ syntax.php | Added code to allow the use of an alternate HTML comment block (prefix %!--, suffix --%) that is automagically rendered using entities to appear verbatim in text (so appears as rather than being hidden). | | --- dokuwiki-2011-05-25a/lib/plugins/htmlcomment/syntax.php 2005-10-09 11:31:47.000000000 +1300 +++ dokuwiki/lib/plugins/htmlcomment/syntax.php 2012-01-20 14:03:27.078084422 +1300 @@ -41,15 +41,24 @@ } function connectTo($mode) { - $this->Lexer->addSpecialPattern("<\!--.*?-->", $mode, - 'plugin_htmlcomment'); + $this->Lexer->addSpecialPattern("<\!--.*?-->", $mode, 'plugin_htmlcomment'); + $this->Lexer->addSpecialPattern("%\!--.*?--%", $mode, 'plugin_htmlcomment'); + $this->Lexer->addSpecialPattern("
", $mode, 'plugin_htmlcomment'); } function handle($match, $state, $pos, &$handler) { if ($state == DOKU_LEXER_SPECIAL) { - // strip from end - $match = substr($match,4,-3); - return array($state, $match); + if ($match == '
') + { + return array('newline',$match); + } + if (strpos($match, '%!--') !== false) + { + $state = 'displaycomment'; + } + // strip from end + $match = substr($match,4,-3); + return array($state, $match); } return array(); } @@ -57,14 +66,31 @@ function render($mode, &$renderer, $data) { if ($mode == 'xhtml') { list($state, $match) = $data; - if ($state == DOKU_LEXER_SPECIAL) { - $renderer->doc .= ''; + if ($state == 'newline') + { + $renderer->doc .= $match; + return true; + } + if ($state == 'displaycomment') + { + $renderer->doc .= '<!--'; + } + else + { + $renderer->doc .= ''; } return true; }
|| ==== ImageReference ==== ^ File ^ Changes ^ ^ script.js | More tests to prevent trying to access null objects | | --- dokuwiki-2011-05-25a/lib/plugins/imagereference/script.js 2009-01-07 21:48:25.000000000 +1300 +++ dokuwiki/lib/plugins/imagereference/script.js 2011-12-16 11:40:42.128166685 +1300 @@ -3,7 +3,8 @@ var divs=document.getElementsByTagName("DIV"); for (var i=0;i || ^ style.css | Altering colours to make caption bars fit in better with Monobook template | | --- dokuwiki-2011-05-25a/lib/plugins/imagereference/style.css 2008-09-11 02:56:24.000000000 +1200 +++ dokuwiki/lib/plugins/imagereference/style.css 2012-01-16 10:48:34.558129586 +1300 @@ -7,15 +7,17 @@ div.imgcaption { - border: 1px solid #ccc; + border: 0px solid #000; padding: 3px !important; - background-color: #f9f9f9; - font-size: 94%; + /*background-color: #113355;*/ + background-color: #777777; + /*font-size: 94%;*/ text-align: center; width: auto; overflow: hidden; margin: 1px auto; float: none; + font-weight: bold; } div.imgcaptionleft { @@ -62,7 +64,8 @@ } div.dokuwiki .undercaption a:hover { - text-decoration:none; + color: #002BB8 !important; + text-decoration:underline; } div.dokuwiki .undercaption span { || ^ syntax.php | Rewrote large chunks of this code to; a) allow for table captions too, b) preserve formatting (italics) in the captions, c) allow specially formatted 'HTML comments' to be inserted but not display (to allow capture and retention of explicit text ids) and d) fix minor bugs (looks like some things were in a state of change from strings to arrays - some bits of the code were expecting the other) | | --- dokuwiki-2011-05-25a/lib/plugins/imagereference/syntax.php 2008-09-11 18:29:12.000000000 +1200 +++ dokuwiki/lib/plugins/imagereference/syntax.php 2012-01-19 11:03:52.285067251 +1300 @@ -22,6 +22,7 @@ var $_figure_name_array = array(""); var $_figure_map = array(); + var $_captions = array(); /** @@ -80,13 +81,17 @@ * @see render() */ function connectTo($mode) { + $this->Lexer->addSpecialPattern('',$mode, 'plugin_imagereference'); - $this->Lexer->addEntryPattern('(?=.*?)',$mode,'plugin_imagereference'); - $this->Lexer->addEntryPattern('.*?)',$mode,'plugin_imagereference'); + $this->Lexer->addSpecialPattern('',$mode, 'plugin_imagereference'); + + $this->Lexer->addEntryPattern(']+(?=>.*?)',$mode,'plugin_imagereference'); + $this->Lexer->addEntryPattern(']+(?=>.*?)',$mode,'plugin_imagereference'); } - + function postConnect() { $this->Lexer->addExitPattern('', 'plugin_imagereference'); + $this->Lexer->addExitPattern('', 'plugin_imagereference'); } @@ -120,24 +125,39 @@ * @static */ function handle($match, $state, $pos, &$handler){ - switch ($state) { // ========================================================= case DOKU_LEXER_ENTER : { - /* --------------------------------------------------- */ - $refLabel = trim(substr($match, 11, -1)); + + /* --------------------------------------------------- */ + $refLabel = ''; //trim(substr($match, 11, -1)); + $caption = ''; + if (preg_match('/<(?:img|tbl)caption\s+([^\|]+)\|([^>]+)/', $match, $matches)) + { + $refLabel = $matches[1]; + $caption = $matches[2]; + } // ----------------------------------------------------- $parsedInput = $this->_parseParam($refLabel); - + // ------------------------------------------------------ //$data = $this->_imgstart($parsedInput); // store the figure name from imgcaption array_push($this->_figure_name_array, $parsedInput[0]); - - $this->_figure_map[$parsedInput[0]] = ""; - + + $this->_figure_map[$parsedInput[0]] = ''; + + $this->_captions[$parsedInput[0]] = $caption; + + ///cho '

refLabel:' . $refLabel . '

'; + ///cho '

parsedInput:' . print_r($parsedInput, true) . '

'; + ///cho '

figure_name_array: ' . print_r($this->_figure_name_array, true) . '

'; + ///cho '

figure_map: ' . print_r($this->_figure_map, true) . '

'; + ///cho '

captions: ' . print_r($this->_captions, true). '

'; + return array('caption_open', $parsedInput); // image anchor label /* --------------------------------------------------- */ + //} } // ========================================================= case DOKU_LEXER_UNMATCHED : { @@ -191,7 +211,6 @@ * @see handle() */ function render($mode, &$renderer, $indata) { - list($case, $data) = $indata; if($mode == 'xhtml'){ // --------------------------------------------- @@ -200,8 +219,14 @@ /* --------------------------------------- */ $refNumber = array_search($data, $this->_figure_name_array); if ($refNumber == null || $refNumber == "") - $refNumber = "##"; - $str = "".$this->getLang('figure').$refNumber." "; + { + $refNumber = "##"; + } + if (strpos($data,'#') === false) + { + $data = "#" . $data; + } + $str = "".$this->getLang('figure').$refNumber.""; $renderer->doc .= $str; break; // $renderer->_xmlEntities($str);break; /* --------------------------------------- */ @@ -210,10 +235,26 @@ case 'caption_close' : { // ------------------------------------------------------- list($name, $number, $caption) = $data; - $layout = "
".$this->getLang('fig').$number.": - ".$caption." -
"; - $renderer->doc .= $layout; break; + // - retrieve the caption separately + $caption = $this->_captions[$name]; + // - special case for 'hidden' tables + $layout = ''; + if ($caption != '##HIDDEN##') + { + // - manual do any formatting (as leaving it to the + // parser (to foobar) is why we had to do this in + // the first place + $caption = preg_replace('/\/\/%%(.+?)%%\/\//','\1',$caption); + $caption = preg_replace('/\/\/(.+?)\/\//','\1',$caption); + $caption = preg_replace('/\*\*(.+?)\*\*/','\1',$caption); + $caption = str_replace('%!--', '', $caption); + // - special case: nested image ref (we can't really resolve these) + $caption = preg_replace('/]+)><\/imgref>/','\1',$caption); + $layout = "
".$this->getLang('fig').$number.": ".$caption."
"; + } + $layout .= ""; + $renderer->doc .= $layout; break; } // ------------------------------------------------------- // data is mostly empty!!! @@ -284,7 +325,7 @@ function _imgstart($str) { // ============================================ // - if (!strlen($str)) return array(); + if (empty($str)) return ''; $layout = "
_figure_name_array); // get the position of the figure in the array @@ -311,8 +354,9 @@ return array($figureName, $refNumber, $str); + $layout = "
".$this->getLang('fig').$refNumber.": - _figure_name_array)."\">".$str."
"; + _figure_name_array)."\">".$str."
"; //$layout = "
Fig. ".$refNumber.": //_figure_name_array)."\">".$str."
";
|| ^ lang/en/lang.php | Changed the strings | | --- /dokuwiki-2011-05-25a/lib/plugins/imagereference/lang/en/lang.php 2008-09-11 02:56:24.000000000 +1200 +++ dokuwiki/lib/plugins/imagereference/lang/en/lang.php 2011-12-12 11:24:57.668503137 +1300 @@ -3,5 +3,5 @@ * english language file */ -$lang['fig'] = 'Fig. '; -$lang['figure'] = 'figure'; \ No newline at end of file +$lang['fig'] = 'Figure '; +$lang['figure'] = 'figure'; || ==== Publish ==== ^ 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) | | --- dokuwiki-2011-05-25a/lib/plugins/publish/action.php 2011-10-16 03:55:40.000000000 +1300 +++ dokuwiki/lib/plugins/publish/action.php 2012-01-24 10:34:18.115128733 +1300 @@ -147,10 +147,14 @@ if($approver && !$most_recent_approved) { $strings[] = 'yes'; } else { $strings[] = 'no'; } $strings[] = '">'; + # [jmt12] We may not display the message at all + $display_message = false; + if($most_recent_draft) { $strings[] = ''; $strings[] = sprintf($this->getLang('apr_recent_draft'), wl($ID, 'force_rev=1')); $strings[] = $this->difflink($ID, null, $REV) . ''; + $display_message = true; } if($most_recent_approved) { @@ -160,6 +164,7 @@ $strings[] = ''; $strings[] = sprintf($this->getLang('apr_outdated'), wl($ID, 'rev=' . $userrev)); $strings[] = $this->difflink($ID, $userrev, $REV) . ''; + $display_message = true; } if(!$approver) { @@ -168,28 +173,27 @@ $strings[] = sprintf($this->getLang('apr_draft'), '' . $longdate . ''); $strings[] = ''; + $display_message = true; } - if($approver) { + // [jmt12] Only display this notice to editors + if($approver && $INFO['perm'] >= AUTH_EDIT) { # Approved $strings[] = ''; $strings[] = sprintf($this->getLang('apr_approved'), '' . $longdate . '', editorinfo($approver)); $strings[] = ''; - } - - if($previous_approved) { - $strings[] = ''; - $strings[] = sprintf($this->getLang('apr_previous'), - wl($ID, 'rev=' . $previous_approved), - dformat($previous_approved)); - $strings[] = $this->difflink($ID, $previous_approved, $REV) . ''; + $display_message = true; } $strings[] = ''; - ptln(implode($strings)); + // [jmt12] if there is no message content, hide empty div + if ($display_message) + { + ptln(implode($strings)); + } return true; } || ^ style.css | Making the message bubbles at the top of pages a little smaller (it was taking up about 2 inches of vertical real-estate, which was expensive even on my wide screen---small screen users would have suffered greatly) | | --- dokuwiki-2011-05-25a/lib/plugins/publish/style.css 2011-10-16 03:55:40.000000000 +1300 +++ dokuwiki/lib/plugins/publish/style.css 2012-01-17 13:47:35.324065886 +1300 @@ -3,7 +3,7 @@ margin-left: auto; margin-right: auto; width: 70% !important; - min-height: 40px; + min-height: 20px; clear: both; text-align: justify; vertical-align: middle; || ===== Templates ===== ==== Monobook ==== ^ 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) | | --- 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 @@ -613,8 +613,8 @@ $ACT !== "media" && //var comes from DokuWiki (empty($conf["useacl"]) || //are there any users? $loginname !== "" || //user is logged in? - !tpl_getConf("monobook_closedwiki")) && - tpl_getConf("monobook_youarehere_position") === "top"){ + !tpl_getConf("monobook_closedwiki"))){// && + // tpl_getConf("monobook_youarehere_position") === "top"){ echo "\n \n"; @@ -665,8 +665,8 @@ $ACT !== "media" && //var comes from DokuWiki (empty($conf["useacl"]) || //are there any users? $loginname !== "" || //user is logged in? - !tpl_getConf("monobook_closedwiki")) && - tpl_getConf("monobook_youarehere_position") === "bottom"){ + !tpl_getConf("monobook_closedwiki"))){ // && + // tpl_getConf("monobook_youarehere_position") === "bottom"){ echo "\n \n"; || ^ 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. | | --- 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 @@ -678,6 +678,8 @@ line-height: 1.2em; padding: 0.5em; border-style: dashed; + overflow: scroll; + width: 800px; } div#content .dokuwiki dl.file, div#content .dokuwiki dl.file dd { || ^ static/3rd/monobook/main.css | Reduce the text area to around 1000px by centring main div and other absolute divs (logo and top navigation). | | --- dokuwiki-2011-05-25a/lib/tpl/monobook/static/3rd/monobook/main.css 2012-01-23 13:41:54.253064506 +1300 +++ dokuwiki/lib/tpl/monobook/static/3rd/monobook/main.css 2012-01-23 11:45:42.674067707 +1300 @@ -27,7 +27,7 @@ background: white; color: black; border: 1px solid #aaa; - border-right: none; + /*border-right: none;*/ line-height: 1.5em; position: relative; z-index: 2; @@ -54,6 +54,8 @@ /* scale back up to a sane default */ #globalWrapper { font-size: 127%; + width: 1024px; + margin: 0 auto; padding: 0; } .visualClear { @@ -702,7 +704,7 @@ z-index: 3; position: absolute; /*needed to use z-index */ top: 0; - left: 0; + /*left: 0;*/ height: 155px; width: 12em; overflow: visible; @@ -858,9 +860,10 @@ #p-cactions { position: absolute; top: 1.3em; - left: 11.5em; + /*left: 11.5em;*/ margin: 0; white-space: nowrap; + width: 1024px; line-height: 1.1em; 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; ||