User Tools

Site Tools


mantisbt:7075:integration_with_dokuwiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mantisbt:7075:integration_with_dokuwiki [2006/05/17 10:44]
vboctor Update Mantis Issue syntax plug-in.
— (current)
Line 1: Line 1:
-====== Integrating DokuWiki with Mantis ====== 
  
-===== Disclaimer ===== 
- 
-This document describes the steps needed to integrate DokuWiki with Mantis.  This is just for experimenting with the concept, and it is not a supported feature of Mantis.  A formal implementation may be available in future releases. 
- 
- 
-===== Integration Functionality ===== 
- 
-The integration between Mantis and DokuWiki so far achieves the following: 
- 
-  * Customises DokuWiki to honour Mantis authentication (i.e. single sign-on). 
-  * Customises DokuWiki authorisation based on Mantis access levels (i.e. groups). 
-  * Adds a Wiki link on the issue view simple/advanced pages to their corresponding Wiki issue page. 
-  * Adds a Wiki menu option which maps to the corresponding project Wiki page, or general page in case of "All Projects". 
-  * Provides a way for Wiki pages to link to Mantis issues, e.g. ~~Mantis:7075~~. 
- 
-===== Tips ===== 
- 
-Following are some tips that are of interest to Mantis / DokuWiki integration: 
- 
-  * To define a template for all Wiki pages within a namespace, create ''_template.txt'' in the namespace folder.  All pages created within this namespace will use the contents of the templates as a start point.  This will affect the way the Wiki is structure.   For example, if all issues within a project have a namespace, then they can all share one template, if there is a namespace per category, then there can be a template per category.  The exact structure to be used should be configurable through Mantis configuration. 
- 
-===== DockuWiki Steps ===== 
- 
-==== Installation ==== 
- 
-Install [[http://www.dokuwiki.org|DokuWiki]] and make sure it is working properly.  This involves making sure that you can create pages, edit them, view them, etc. 
- 
-==== Configuration ==== 
- 
-Modify the configuration values in ''dokuwiki\conf\dokuwiki.php'' to match the values below: 
- 
-<code php> 
-# 
-# Add the following lines: 
-# 
- 
-define( 'MANTIS_ROOT', 'c:/inetpub/wwwroot/mantisbt/' );  // file path to Mantis, must terminate with / 
-define( 'MANTIS_URL', 'http://localhost/mantisbt/' );     // url to Mantis, must terminate with / 
- 
-# 
-# Modify the following configuration options to match the values below: 
-# 
- 
-$conf['useacl'      = 1;                // Use Access Control Lists to restrict access? 
-$conf['authtype'    = 'mantis';         // which authentication backend should be used 
-$conf['defaultgroup'] = 'VIEWER';         // Default groups new Users are added to 
-</code> 
- 
-==== Authentication (Single Sign-On) ==== 
- 
-Create ''dokuwiki\inc\auth\mantis.class.php'' with the code below. 
- 
-<code php> 
-<?php 
-/** 
- * Mantis auth backend 
- * 
- * Uses external Trust mechanism to check against Mantis' 
- * user cookie. 
- * 
- * @author    Victor Boctor (http://www.futureware.biz) 
- */ 
- 
-require_once( MANTIS_ROOT . 'core.php' ); 
- 
-#dbg($GLOBALS); 
- 
-class auth_mantis extends auth_basic { 
-  /** 
-   * Constructor. 
-   * 
-   * Sets additional capabilities and config strings 
-   */ 
-  function auth_mantis(){ 
-    $this->cando['external'] = true; 
-  } 
- 
-  /** 
-   * Authenticates the user using Mantis APIs. 
-   */ 
-  function trustExternal($user,$pass,$sticky=false){ 
-    global $USERINFO; 
-    global $conf; 
- 
-    if ( auth_is_user_authenticated() ) { 
-      // okay we're logged in - set the globals 
-      $USERINFO['pass'] = current_user_get_field( 'password' ); 
-      $USERINFO['name'] = current_user_get_field( 'username' ); 
-      $USERINFO['mail'] = current_user_get_field( 'email' ); 
- 
-      $t_project_name = getNS( getID() ); 
-      $t_project_id = project_get_id_by_name( $t_project_name ); 
-      $t_access_level = access_get_project_level( $t_project_id ); 
-      $t_access_level_string = strtoupper( get_enum_to_string( config_get( 'access_levels_enum_string' ),  $t_access_level ) ); 
- 
-      $USERINFO['grps'] = array( $t_access_level_string ); 
- 
-      $_SERVER['REMOTE_USER'] = $USERINFO['name']; 
-      $_SESSION[$conf['title']]['auth']['user'] = $USERINFO['name']; 
-      $_SESSION[$conf['title']]['auth']['info'] = $USERINFO; 
- 
-      return true; 
-    } 
- 
-    // to be sure 
-    auth_logoff(); 
- 
-    return false; 
-  } 
- 
-  /** 
-   * Logout from Mantis 
-   */ 
-  function logOff(){ 
- auth_logout(); 
-  } 
-} 
-</code> 
- 
-==== Authorisation Configuration ==== 
- 
-Create ''dokuwiki\conf\acl.auth.php'' with the code below. 
- 
-<code php> 
-# acl.auth.php 
-# <?php exit()?> 
-# Don't modify the lines above 
-# 
-# Access Control Lists 
-# 
-# Editing this file by hand shouldn't be necessary. Use the ACL 
-# Manager interface instead. 
-# 
-# If your auth backend allows special char like spaces in groups 
-# or user names you need to urlencode them (only chars <128, leave 
-# UTF-8 multibyte chars as is) 
-# 
-# none   0 
-# read   1 
-# edit   2 
-# create 4 
-# upload 8 
- 
-* @VIEWER 1 
-* @REPORTER 2 
-* @DEVELOPER 8 
-* @MANAGER 8 
-* @ADMINISTRATOR 8 
-* @ALL 0 
-</code> 
- 
-==== Mantis Syntax Plug-in ==== 
- 
-This plugin is to be placed in ''dokuwiki\lib\plugins\mantis\syntax.php''. 
- 
-<code php> 
-<?php 
-/** 
- * Mantis Plugin: Hyperlinks references to Mantis Issues 
-  
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) 
- * @author     Victor Boctor (http://www.futureware.biz) 
- */ 
- 
- 
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
-require_once(DOKU_PLUGIN.'syntax.php'); 
- 
-/** 
- * A plug-in that hyper links references to Mantis issues.  References 
- * to Mantis issues should use the following format: ~~Mantis:123~~. 
- * 
- * All DokuWiki plugins to extend the parser/rendering mechanism 
- * need to inherit from this class 
- */ 
-class syntax_plugin_mantis extends DokuWiki_Syntax_Plugin { 
- 
-    /** 
-     * return some info 
-     */ 
-    function getInfo(){ 
-        return array( 
-            'author' => 'Victor Boctor', 
-            'email'  => 'vboctor at users . sourceforge . net', 
-            'date'   => '2006-05-18', 
-            'name'   => 'Mantis Issues Plugin', 
-            'desc'   => 'Support References to Mantis Issues', 
-            'url'    => 'http://www.futureware.biz', 
-        ); 
-    } 
- 
-    /** 
-     * What kind of syntax are we? 
-     */ 
-    function getType(){ 
-        return 'substition';  # typo is intentional 
-    } 
-    
-    /** 
-     * What about paragraphs? 
-     */ 
-    function getPType(){ 
-        return 'normal'; 
-    } 
- 
-    /** 
-     * Where to sort in? 
-     */  
-    function getSort(){ 
-        return 156; 
-    } 
- 
- 
-    /** 
-     * Connect pattern to lexer 
-     */ 
-    function connectTo($mode) { 
-        $this->Lexer->addSpecialPattern('~~Mantis:[0-9]+~~', $mode, 'plugin_mantis'); 
-    } 
- 
- 
-    /** 
-     * Handle the match 
-     */ 
-    function handle($match, $state, $pos, &$handler){ 
-        $match = substr( $match, 9, -2 ); // strip "~~Mantis:" from start and "~~" from end 
-        return array( strtolower( $match ) ); 
-    } 
- 
-    /** 
-     * Create output 
-     */ 
-    function render($format, &$renderer, $data) { 
-        if ( $format == 'xhtml' ) { 
- $renderer->externallink( MANTIS_URL . 'view.php?id=' . $data[0], $data[0] ); 
-            return true; 
-        } 
-        return false; 
-    } 
-} 
-?> 
-</code> 
- 
-===== Mantis Steps ===== 
- 
-==== Configuration ==== 
- 
-==== wiki_api.php ==== 
- 
-==== wiki_dokuwiki_api.php ==== 
- 
-==== html_api.php ==== 
mantisbt/7075/integration_with_dokuwiki.1147877074.txt.gz ยท Last modified: 2008/10/29 04:36 (external edit)