Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of 7075 which integrates DokuWiki with Mantis.
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4126 f5dc347c-c33d-0410-90a0-b07cc1902cb9
- Loading branch information
Showing
8 changed files
with
250 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
# Mantis - a php based bugtracking system | ||
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org | ||
# Copyright (C) 2002 - 2006 Mantis Team - mantisbt-dev@lists.sourceforge.net | ||
# This program is distributed under the terms and conditions of the GPL | ||
# See the README and LICENSE files for details | ||
|
||
# -------------------------------------------------------- | ||
# $Id: wiki_api.php,v 1.1 2006-08-09 07:55:01 vboctor Exp $ | ||
# -------------------------------------------------------- | ||
|
||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'helper_api.php' ); | ||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'utility_api.php' ); | ||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'database_api.php' ); | ||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'authentication_api.php' ); | ||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'gpc_api.php' ); | ||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'access_api.php' ); | ||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'project_api.php' ); | ||
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'wiki_' . config_get( 'wiki_engine' ) . '_api.php' ); | ||
|
||
# ---------------------- | ||
# Calls a function with the specified name (not including prefix) and given the array | ||
# of parameters supplied. An example prefix is "wiki_dokuwiki_". | ||
function wiki_call( $p_function, $p_args_array ) { | ||
$t_function = 'wiki_' . config_get_global( 'wiki_engine' ) . '_' . $p_function; | ||
return call_user_func_array( $t_function, $p_args_array ); | ||
} | ||
|
||
# ---------------------- | ||
# Checks if the Wiki feature is enabled or not. | ||
function wiki_is_enabled() { | ||
return config_get( 'wiki_enable' ) == ON; | ||
} | ||
|
||
# ---------------------- | ||
# Ensures that the wiki feature is enabled. | ||
function wiki_ensure_enabled() { | ||
if ( !wiki_is_enabled() ) { | ||
access_denied(); | ||
} | ||
} | ||
|
||
# ---------------------- | ||
# Gets the wiki URL for the issue with the specified id. | ||
function wiki_get_url_for_issue( $p_issue_id ) { | ||
return wiki_call( 'get_url_for_issue', array( $p_issue_id ) ); | ||
} | ||
|
||
# ---------------------- | ||
# Gets the wiki URL for the project with the specified id. The project id can be ALL_PROJECTS. | ||
function wiki_get_url_for_project( $p_project_id ) { | ||
return wiki_call( 'get_url_for_project', array( $p_project_id ) ); | ||
} | ||
|
||
# ---------------------- | ||
/* | ||
function wiki_string_display_links( $p_string ) { | ||
if ( !wiki_is_enabled() ) { | ||
return $p_string; | ||
} | ||
return wiki_call( 'string_display_links', array( $p_string ) ); | ||
} | ||
*/ | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
# Mantis - a php based bugtracking system | ||
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org | ||
# Copyright (C) 2002 - 2006 Mantis Team - mantisbt-dev@lists.sourceforge.net | ||
# This program is distributed under the terms and conditions of the GPL | ||
# See the README and LICENSE files for details | ||
|
||
# -------------------------------------------------------- | ||
# $Id: wiki_dokuwiki_api.php,v 1.1 2006-08-09 07:55:01 vboctor Exp $ | ||
# -------------------------------------------------------- | ||
|
||
# ---------------------- | ||
# Gets the URL for the page with the specified page id. This function is used | ||
# internally by this API. | ||
function wiki_dokuwiki_get_url_for_page_id( $p_page_id ) { | ||
$t_root_url = config_get_global( 'wiki_engine_url' ); | ||
|
||
$t_root_namespace = config_get( 'wiki_root_namespace' ); | ||
|
||
if ( is_blank( $t_root_namespace ) ) { | ||
$t_page_id = $p_page_id; | ||
} else { | ||
$t_page_id = $t_root_namespace . ':' . $p_page_id; | ||
} | ||
|
||
return $t_root_url . 'doku.php?id=' . urlencode( $t_page_id ); | ||
} | ||
|
||
# ---------------------- | ||
# Gets the page id for the specified issue. The page id can then be converted | ||
# to a URL using wiki_dokuwiki_get_url_for_page_id(). | ||
function wiki_dokuwiki_get_page_id_for_issue( $p_issue_id ) { | ||
$c_issue_id = db_prepare_int( $p_issue_id ); | ||
|
||
$t_project_id = bug_get_field( $p_issue_id, 'project_id' ); | ||
$t_project_name = project_get_name( $t_project_id ); | ||
|
||
# create a namespace for the project to contain all project documentation. | ||
# create within it a namespace for issues. This is to allow the creation of a _template.txt | ||
# file to act as the template for issues belonging to this project. | ||
return $t_project_name . ':issue:' . $c_issue_id; | ||
} | ||
|
||
# ---------------------- | ||
# Gets the page url for the specified issue id. | ||
function wiki_dokuwiki_get_url_for_issue( $p_issue_id ) { | ||
return wiki_dokuwiki_get_url_for_page_id( wiki_dokuwiki_get_page_id_for_issue( $p_issue_id ) ); | ||
} | ||
|
||
# ---------------------- | ||
# Gets the page id for the specified project. The project id can be ALL_PROJECTS | ||
# The page id can then be converted to URL using wiki_dokuwiki_get_url_for_page_id(). | ||
function wiki_dokuwiki_get_page_id_for_project( $p_project_id ) { | ||
$t_home = 'start'; | ||
if ( $p_project_id == ALL_PROJECTS ) { | ||
return $t_home; | ||
} else { | ||
$t_project_name = project_get_name( $p_project_id ); | ||
return $t_project_name . ':' . $t_home; | ||
} | ||
} | ||
|
||
# ---------------------- | ||
# Get URL for the specified project id. The project is can be ALL_PROJECTS. | ||
function wiki_dokuwiki_get_url_for_project( $p_project_id ) { | ||
return wiki_dokuwiki_get_url_for_page_id( wiki_dokuwiki_get_page_id_for_project( $p_project_id ) ); | ||
} | ||
|
||
/* | ||
function wiki_dokuwiki_string_display_links( $p_string ) { | ||
#$t_string = $p_string; | ||
#$t_string = str_replace( '[[', '{', $p_string ); | ||
$t_wiki_web = config_get_global( 'wiki_engine_url' ); | ||
preg_match_all( '/(^|.+?)(?:(?<=^|\W)' . '\[\[' . '([a-zA-Z0-9_:]+)\]\]|$)/s', | ||
$p_string, $t_matches, PREG_SET_ORDER ); | ||
$t_result = ''; | ||
foreach ( $t_matches as $t_match ) { | ||
$t_result .= $t_match[1]; | ||
if ( isset( $t_match[2] ) ) { | ||
$t_result .= '<a href="' . wiki_dokuwiki_get_url_for_page_id( $t_match[2] ) . '">[[' . $t_match[2] . ']]</a>'; | ||
} | ||
} | ||
return $t_result; | ||
} | ||
*/ | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
# Mantis - a php based bugtracking system | ||
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org | ||
# Copyright (C) 2002 - 2006 Mantis Team - mantisbt-dev@lists.sourceforge.net | ||
# This program is distributed under the terms and conditions of the GPL | ||
# See the README and LICENSE files for details | ||
|
||
# -------------------------------------------------------- | ||
# $Id: wiki.php,v 1.1 2006-08-09 07:55:01 vboctor Exp $ | ||
# -------------------------------------------------------- | ||
?> | ||
<?php | ||
require_once( 'core.php' ); | ||
|
||
$t_core_path = config_get( 'core_path' ); | ||
|
||
require_once( $t_core_path . 'wiki_api.php' ); | ||
|
||
$f_id = gpc_get_int( 'id' ); | ||
$f_type = gpc_get_string( 'type', 'issue' ); | ||
|
||
if ( $f_type == 'project' ) { | ||
project_ensure_exists( $f_id ); | ||
$t_url = wiki_get_url_for_project( $f_id ); | ||
} else { | ||
bug_ensure_exists( $f_id ); | ||
$t_url = wiki_get_url_for_issue( $f_id ); | ||
} | ||
|
||
print_header_redirect( $t_url ); | ||
?> |