Page 1 of 1
Own wiki integration plugin
Posted: 18 Feb 2010, 20:32
by PAB
Hello,
is there a way to replace the integrated wikiplugin of 1.2.0 RC2 with a custom one?
Greetings
PAB
Re: Own wiki integration plugin
Posted: 19 Feb 2010, 08:52
by atrol
Yes
Re: Own wiki integration plugin
Posted: 19 Feb 2010, 09:26
by PAB
Do you have some more info for me? (I know, i didn't explicitely requested...

)
Re: Own wiki integration plugin
Posted: 19 Feb 2010, 10:19
by atrol
Short question (still the same after your second post) without any more information.
I don't know where to start and can not imagine which information will be helpful for you or not.
You should start with some kind of:
I installed MantisBT 1.2.0rc2, I tried out the Wiki module which is delivered with Wiki XYZ.
But this module does not fit my expections, because I want to have .......
I tried out various configurations, but this was still not what I want ....
After that I had a look at the sourcecode and ....
Re: Own wiki integration plugin
Posted: 19 Feb 2010, 11:05
by PAB
I already patched the MediaWikiPlugin in core/classes/MantisCoreWikiPlugin.class.php, but want to separate my changes from the original code.
I had a look at core/wiki_api.php and found wiki_init with a hardcoded switch-case. My question is, how do i integrate a custom wikiplugin? Can I hook into the legacy style wiki integration or do i need to write a general plugin, which, for example, adds the "Wiki"-link in mantis' toolbar by itself?
Re: Own wiki integration plugin
Posted: 19 Feb 2010, 12:55
by atrol
much better
First to clarify: the current implementation is not a plugin in the way plugin's are meant in 1.2.x. (even if the name of it contains plugin)
There are at least two alternatives:
Change the current code, so that the hardcoding is replaced by customization.
Provide the patches to the developers.
They will have a look on it, and when they think that it's good enough, your changes will be merged into upcoming versions.
So there is no more need for you to seperate anything of your code.
However my opinion regarding long term development of MantisBT is, that this should be implemented as a seperated plugin (and after having the plugin the current implementation in core should be removed)
Check, whether the new plugin system provides enough functionality for it, I suggest it will.
If you think about starting with development of a new plugin, you should start with a source repository for it at:
http://git.mantisforge.org/
First you should write to
mantisbt-dev@lists.sourceforge.net where developers are listening.
I am pretty sure they will provide you with better technical and internal information than I am able to do.
But write more than: "Is there a way to replace the integrated wikiplugin of 1.2.0 RC2 with a custom one?"

Re: Own wiki integration plugin
Posted: 22 Feb 2010, 13:11
by PAB
I think i'll try to post my changes as a patch. None the less, i'll ask on the mailinglist to clarify the "official" way to integrate wikiplugins.
Thanks for your help.
Re: Own wiki integration plugin
Posted: 22 Feb 2010, 14:41
by atrol
If you think about providing patches you should read this:
http://www.mantisforge.org/dev/manual/e ... ubmit.html
Re: Own wiki integration plugin
Posted: 23 Feb 2010, 21:19
by PAB
Just played around with wikiplugins and found the way to implement: Inherit from MantisWikiPlugin and leave "wiki_engine" empty.
Here is a stub:
plugins/MyWiki/MyWiki.php
Code: Select all
<?php
require_once( config_get( 'class_path' ) . 'MantisWikiPlugin.class.php' );
class MyWikiPlugin extends MantisWikiPlugin {
function register() {
$this->name = 'Authors\' MyWikiPlugin';
$this->description = 'Own MediaWiki link';
$this->version = '0.1';
$this->requires = array(
'MantisCore' => '1.2.0',
);
$this->author = 'Author';
$this->contact = 'author@example.com';
$this->url = 'http://www.example.com';
}
function config(){}
function base_url( $p_project_id=null ) {
$t_base = 'http://example.com/mediawiki/index.php/';
if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) {
$t_base .= urlencode( project_get_name( $p_project_id ) ) . ':';
} else {
$t_base .= urlencode( 'root:' );
}
return $t_base;
}
function link_bug( $p_event, $p_bug_id ) {
return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . (int)$p_bug_id;
}
function link_project( $p_event, $p_project_id ) {
return $this->base_url( $p_project_id ) . 'Main_Page';
}
}
config_inc.php
Code: Select all
$g_wiki_enable = ON;
$g_wiki_engine = '';
Re: Own wiki integration plugin
Posted: 23 Feb 2010, 22:32
by atrol
Thank you for posting this information and also the patch you attached at
http://www.mantisbt.org/bugs/view.php?id=11544
Re: Own wiki integration plugin
Posted: 01 Jun 2011, 07:34
by wxfhnmdedc
I had a look at core/wiki_api.php and found wiki_init with a hardcoded switch-case. My question is, how do i integrate a custom wikiplugin? Can I hook into the legacy style wiki integration or do i need to write a general plugin, which, for example, adds the "Wiki"-link in mantis' toolbar by itself?