Page 1 of 1

[RESOLU] Problème de création de plugiciel

Posted: 25 Jul 2013, 12:57
by sham73
Bonjour à tous.
Je suis en train de créer un nouveau plugiciel sur Mantis mais l'erreur suivante apparait : "APPLICATION ERROR #2500
Le plugiciel n'est pas enrégisté avec MantisBT." Je bloque completement, si vous pourriez m'aider svp
Voici mon code :
-Example.php

Code: Select all

<?php
class ExamplePlugin extends MantisPlugin {
    function register() {
        $this->name = 'Example';    # Proper name of plugin
        $this->description = 'Il sagit dun test';    # Short description of the plugin
        $this->page = '';           # Default plugin page

        $this->version = '1.0';     # Plugin version string
        $this->requires = array(    # Plugin dependencies, array of basename => version pairs
            'MantisCore' => '1.2.0, <= 1.2.0',  #   Should always depend on an appropriate version of MantisBT
            );

        $this->author = 'Cécile Favre';         # Author/team name
        $this->contact = '';        # Author/team e-mail address
        $this->url = '';            # Support webpage
    }

     function config() {
        return array(
            'foo_or_bar' => 'foo',
        );
    }

    function events() {
        return array(
            'EVENT_EXAMPLE_FOO' => EVENT_TYPE_EXECUTE,
            'EVENT_EXAMPLE_BAR' => EVENT_TYPE_CHAIN,
        );
    }

    function hooks() {
        return array(
            'EVENT_EXAMPLE_FOO' => 'foo',
            'EVENT_EXAMPLE_BAR' => 'bar',
        );
    }


    function foo( $p_event ) {
      return array( '<a href="' . plugin_page( 'foo' ) . '">' . plugin_lang_get( 'foo' ) . '</a>', );
    }

    function bar( $p_event, $p_chained_param ) {
        return $p_chained_param;
    }
}
-foo.php :

Code: Select all

<?php
echo '<p>Here is a link to <a href="', plugin_page( 'foo' ), '">page foo</a>.</p>';
echo '<link rel="stylesheet" type="text/css" href="', plugin_file( 'foo.css' ), '"/>',
     '<p class="foo">This is red text.</p>';

     event_signal( 'EVENT_EXAMPLE_FOO' );

$t_string = 'A sentence with the word "foo" in it.';
$t_new_string = event_signal( 'EVENT_EXAMPLE_BAR', array( $t_string ) );

echo $t_new_string, '</p>';
Il s'agit du code donné par Mantis pour apprendre à créer un plugiciel ... http://www.mantisbt.org/docs/master/en/ ... lding.html

Merci d'avance pour votre aide :)

Re: Problème de création de plugiciel

Posted: 25 Jul 2013, 14:07
by Lapinkiller
Bonjour

Tu as bien été dans l'administration Mantis et tu as fait "installer le plugin" ?

Tu as cette erreur quand ? dès que tu affiche une page de Mantis ?

sinon pour t'aider voici un des plugin que j'ai développé pour mantis : https://github.com/Jguilbaud/mantispluginPiwik

Re: Problème de création de plugiciel

Posted: 25 Jul 2013, 14:34
by sham73
Merci pour la réponse ! Et merci pour le fichier je vais aller voir :)

Alors en fait non je n'est pas installé le plugin car la couleur des dépendances de mon plugin siginifie " Dépendances périmées". Je ne sais pas comment faire pour changer ce problème..
Et non l'erreur se produit uniquement quand je vais dans la page plugin.php?page=Example/foo (le dossier se nomme "Example" et le fichier "foo")

Re: Problème de création de plugiciel

Posted: 26 Jul 2013, 07:30
by sham73
En fait il fallait tout simplement modifier cette ligne :

Code: Select all

$this->requires = array(   
            'MantisCore' => '1.2.0',  => '1.2.0' [code]
par [code]$this->requires = array(   
            'MantisCore' => '1.2.0',   

Re: Problème de création de plugiciel

Posted: 29 Jul 2013, 13:35
by Lapinkiller
Le message d'erreur est donc normal vu que le plugin n'est pas installé il fallait donc effectivement voir du côté de tes problèmes de dépendances de version. :)