[Cartoweb-users] Write a plugin

Pierre GIRAUD pierre.giraud at camptocamp.com
Wed May 31 07:33:48 EDT 2006

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 ?


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 
>I just need to get these variables and create my layers in postgis using 
>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 :
>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/ClientLayersManagement.php 
>on line 18"
>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) ?
>>Jacolin Yves wrote:
>>>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
>>>Stagaire Conservatoire Régional des Espaces Naturels de la région Centre
>>>- 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

Géomaticien, Analyste

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex 

Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com

More information about the Cartoweb-users mailing list