Fwd: Re: [Cartoweb-users] Plugins

Jacolin Yves yjacolin at free.fr
Tue May 30 04:22:18 EDT 2006


Hello,
thanks you alexandre for your informations. I do not understand so well the 
difference between server and client even if it is clearer now. I am able to  
begin to write my own plugin now. All the structure in the plugin directory 
of my project is running without any error !

Y.
Le Lundi 29 Mai 2006 20:51, vous avez écrit :
> Hello,
>
> Jacolin Yves wrote:
> > I'd like to create a plugin to manage postgis Layers : create layers,
> > export and import layers.
> >
> > First of all, what is the difference between client side and server side.
> > the aim of the client side code, is it to create dynamic content for the
> > interface and the server side to realise request, calculation, ... ?
>
> CartoWeb has two main parts:
> - Cartoclient (client-side core + client-side plugins parts)
> - Cartoserver (server-side core + server-side plugins parts)
>
> One of the main reasons of this distinction is the ability to have
> CartoWeb set up as a SOAP web-service (one or several Cartoclients
> queriing a Cartoserver that is not necessarily on the same webserver).
> Even when using CartoWeb in direct mode (no web service) both sides have
> separated tasks:
> - Cartoclient: user interface management (HTML generation + POST/GET
> processing), request compilation, "classical" web tasks such as search
> tools, carts,..., etc.
> - Cartoserver: MapServer management (calls to MapScript), most
> geographical computing and request processing, data storage, etc.
>
> > So about my plugin, I will use a template to display the form (to create
> > a new layer), the client side will be empty (may be not) and the server
> > side will do the request into the postgis DB ?
>
> Smarty templates and forms processing must be handled by your plugin
> client side. Make it implement the GuiProvider interface.
> See http://cartoweb.org/doc/misc/plugins_diagram.pdf
>
> All that deals with MapServer layers is a job for your plugin server side.
>
> > If I extend the edit plugin with my own class. Can I use all config
> > parameter of this class (like parameter for the connection to db) ?
>
> Yes. Please note that extended plugins use the same config files than
> their parent plugins (in your case, edit.ini, even if your extended
> plugin is called someCrazyOtherName).
> Same thing for templates: you may overload templates files or create
> some new ones, but you will have to save them in your project in the
> parent plugin directory, not in your extended plugin directory.
>
> > Last (but not least), how does cw3 to use plugin ? I know that the name
> > of the plugin and the files have to be the same (well almost), but I
> > don't know exactly the plugin is run ... Can you help me ?
>
> Most of your questions are probably answered in the doc:
> http://cartoweb.org/doc/cw3.2/xhtml/dev.newplugin.html
> especially
> http://cartoweb.org/doc/cw3.2/xhtml/dev.newplugin.html#dev.newplugin.adapti
>ng
>
> Say you want to extend the "edit" plugin and name your new plugin
> "someExample".
>
> Write in your client_conf/client.ini:
> loadPlugins = plugin1, plugin2, ..., edit, someExample
> and in server_conf/yourProject.ini:
> mapInfo.loadPlugins = pluginA, pluginB, ..., edit, someExample
>
> In your project directory, files are then:
> o someExample/client/ClientSomeExample.php (with class ClientSomeExample
> extending ClientEdit)
> o someExample/server/ServerSomeExample.php (with class ServerSomeExample
> extending ServerEdit)
> o possibly: someExample/common/SomeExample.php (with class SomeExample
> extending Edit) + some WSDL file if you plan to use SOAP
> o edit/templates/whateverName.tpl
> o client_conf/edit.ini
>
> AS
>
> -------------------------------------------------------

-- 
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