[Cartoweb-users] Write a plugin

Jacolin Yves yjacolin at free.fr
Wed May 31 07:37:28 EDT 2006


Ok, I don't want to modify any methods, but just add something !
So I have to create a new plugin ;-)

Y.
Le Mercredi 31 Mai 2006 13:33, Pierre GIRAUD a écrit :
> Do you really need your plugin to be an Edit plugin extension ?
> Isn't a new stand-alone plugin sufficient ? This might also be a good
> start. What are the edit plugin methods you imagine to replace ?
>
> Pierre
>
> Jacolin Yves wrote:
> >The aim of my plugin is to allow user to create new layers (postgis
> > Layers) or to import data in postgis. My form is :
> >an input text for ther name of the layer, another one for the 1st column
> > and a list for its type and a javascript code to add new input text and
> > list box for another fields. Further fields will be add to create
> > metadata (author, date, description, ...). Two columns will be create
> > outomaticly (id and the_geom).
> >I just need to get these variables and create my layers in postgis using
> >PEAR::DB.
> >I think this plugin is quiet easy (does it ?) to write and will be a good
> >beginning for my first plugin.
> >
> >My code for ClientLayersManagement is :
> ><?php
> >class ClientlayersManagement extends ClientEdit implements GuiProvider {
> >   public function replacePlugin(){
> >      return 'edit';
> >   }
> >    /**
> >    * Constructor
> >    */
> >    public function __construct() {
> >        $this->log =& LoggerManager::getLogger(__CLASS__);
> >        parent::__construct();
> >    }
> >    public function handleHttpPostRequest($request) {
> >         $test = $request['nameNewColunm1'];
> >    }
> >    public function handleHttpGetRequest($request) {}
> >}
> >?>
> >
> >And I get this error :
> >"PHP Parse error:  parse error, unexpected T_STRING
> >in
> > /var/www/html/cartoweb3/projects/script/plugins/layersManagement/client/C
> >lientLayersManagement.php on line 18"
> >
> >Thanks,
> >
> >Y.
> >
> >Le Mercredi 31 Mai 2006 11:42, vous avez écrit :
> >>Your new plugin class implements the GuiProvider interface, doesn't it ?
> >>In this case, you can use 2 public methods :
> >>
> >>------------------
> >>public function handleHttpPostRequest($request) {
> >>    $variable_to_use = $request['the_variable_sent_by_form'];
> >>}
> >>
> >>public function handleHttpGetRequest($request) {}
> >>-----------------
> >>
> >>Those methods let you access to your posted variables.
> >>
> >>Do you need to work on your variables before you use them (apply filters)
> >> ? Do you need to do some jobs before you retrieve request variables
> >> (initialize your plugin) ?
> >>
> >>Regards
> >>
> >>Pierre
> >>
> >>Jacolin Yves wrote:
> >>>Hi,
> >>>
> >>>I have some difficulities to write my plugin. Actually, I am a newby in
> >>>php OO so I am a little bit lost. I would like to use my variable create
> >>>by adding a form in the edit template (done). I know that these
> >>> variables are send in the request(they appear in the log request), and
> >>> I have to do something before to use them in php code. But I don't know
> >>> how !
> >>>
> >>>Thanks for your help,
> >>>
> >>>Yves Jacolin
> >>>http://yjacolin.gloobe.org
> >>>----
> >>>Stagaire Conservatoire Régional des Espaces Naturels de la région Centre
> >>>http://cahiersnaturalistes.free.fr/cpnrc/
> >>>----
> >>>- Qu'est-ce que cela peut faire que je lutte pour la mauvaise cause
> >>>puisque je suis de bonne foi?
> >>>- Et qu'est-ce que ça peut faire que je sois de mauvaise foi
> >>>puisque c'est pour la bonne cause. (Jacques Prévert)
> >>>
> >>>_______________________________________________
> >>>Cartoweb-users mailing list
> >>>Cartoweb-users at lists.maptools.org
> >>>http://lists.maptools.org/mailman/listinfo/cartoweb-users

-- 
Yves Jacolin
http://yjacolin.gloobe.org
----
Stagaire Conservatoire Régional des Espaces Naturels de la région Centre
http://cahiersnaturalistes.free.fr/cpnrc/
----
- Qu'est-ce que cela peut faire que je lutte pour la mauvaise cause 
puisque je suis de bonne foi?
- Et qu'est-ce que ça peut faire que je sois de mauvaise foi
puisque c'est pour la bonne cause. (Jacques Prévert)



More information about the Cartoweb-users mailing list