[Cartoweb-users] mapOverlay cartoweb

Oliver Christen oliver.christen at camptocamp.com
Fri Mar 23 01:27:53 EST 2007


Hi Luigi,

the error is certainly not in your client side.
see the last part of the error stack:

message:   Error [8, Trying to get property of non-object,
C:\wamp\www\cartoweb3\server\Cartoserver.php, 229]

the problem happens on the server side.

now, to know what happen, you must try to see if the events in the chain 
happen correcty one after another.

put some print(); (http://ch2.php.net/manual/en/function.print.php) or 
print_r(); (http://ch2.php.net/manual/en/function.print-r.php) at each 
steps: in handleHttpPostRequest, buildRequest, initializeRequest and 
handlePreDrawing until you find exactly where the problem is.

regards
Oliver

>
> This erore is originated in:
>
> public function handleHttpPostRequest($request) {
>      if (isset($request['specialactiontrigger'])) {
>        $this->specialactiontrigger = true;
>      }
>      else {
>        $this->specialactiontrigger = false;
>      }
>    }
>
> in Client part of my plugin, I suppose. You Can halp me again?
> Thanks
>
>
>
> --------- Original Message --------
> Da: Oliver Christen <oliver.christen at camptocamp.com>
> To: cartoweb-users at lists.maptools.org <cartoweb-users at lists.maptools.org>
> Oggetto: Re: [Cartoweb-users] mapOverlay cartoweb
> Data: 22/03/07 14:05
>
> >
>>
>>
>> hi Luigi
>>
>> first you need to recover the submit action. a simple <input 
>> type="submit"
>
>> value="ok" /> as you set in your template will simply post the form but
>> initiate no action.
>> give a name to you input <input type="submit" name="specialactiontrigger"
>> value="ok" />
>> if you dont give a name to your input they are simply ignored.
>>
>> next step is to recover the "specialactiontrigger" in the client part
>>
>> declare the variable at the beginning of the plugin:
>>
>> protected $specialactiontrigger;
>>
>> to do so use the handleHttpPostRequest($request) function, like this:
>>
>> handleHttpPostRequest($request) {
>>     if (isset($request['specialactiontrigger']) {
>>         $this->specialactiontrigger = true;
>>     } else {
>>         $this->specialactiontrigger = false;
>>     }
>> }
>>
>> you need to put something in the buildRequest() { } function, otherwise
> the
>> server part will not be called
>> something like :
>>
>>     public function buildRequest() {
>>         if ($this->specialactiontrigger) {
>>             return $this->specialactiontrigger;
>>         }
>>
>>     }
>>
>> then, on the server part:
>>
>>     protected $specialactiontrigger;
>>
>>     public function initializeRequest($requ) {
>>         if ($requ) {
>>             $this->specialactiontrigger = $requ;
>>         }
>>     }
>>
>> and finally
>>
>> public function handlePreDrawing($request){
>>   if (isset($this->specialactiontrigger ) {
>>     $msMapObj = $this->serverContext->getMapObj();
>>     $layer = new LayerOverlay();
>>     $layer->action = BasicOverlay::ACTION_INSERT;
>>     $layer->name = "mappa";
>>     $layer->data = "images/cc_20050603.tif";
>>     $mapOverlay = $this->serverContext->getPluginManager()->mapOverlay;
>>     $mapOverlay = updateMap($layer);
>>     $this->serverContext->getMapObj()->save('debug.map');
>>   }
>> }
>>
>> you notice its like a chain of events:
>>
> input->handleHttpPostRequest->buildRequest->//->initializeRequest->handlePreDrawing
>>
>> see http://www.cartoweb.org/doc/misc/plugins_diagram.pdf to understand 
>> the
>
>> flow of events in Cartoweb
>>
>> Regards
>> Oliver
>>
>> ----- Original Message ----- 
>> From: "Luigi.marotta" <luigi.marotta at email.it>
>> To: <cartoweb-users at lists.maptools.org>
>> Sent: Thursday, March 22, 2007 8:04 AM
>> Subject: [Cartoweb-users] mapOverlay cartoweb
>>
>>
>> >
>> > Salve a tutti,
>> > sto usando CartoWeb ed ho la necessità di rendere
>> > modificabile, al volo, un raster. Ho implementato un plugin per
> modificare
>> > il campo "data" di un raster.
>> > Client:
>> > <?php
>> > /**
>> > * ClientDataMappa.php
>> > */
>> >
>> > class ClientDataMappa extends ClientPlugin
>> > implements GuiProvider, serverCaller {
>> >
>> > /**
>> > * GuiProvider methods
>> > */
>> > public function handleHttpPostRequest($request) {}
>> > public function handleHttpGetRequest($request) {}
>> >
>> > public function buildRequest() {}
>> > //public function renderForm(Smarty $template) {}
>> >
>> > protected function drawUserForm() {
>> > $smarty = new Smarty_Plugin($this->getCartoclient(), $this);
>> > return $smarty->fetch('dataInput.tpl');
>> > }
>> >
>> > public function renderForm(Smarty $template) {
>> > $template->assign('dataInput', $this->drawUserForm());
>> > }
>> >
>> > public function initializeResult ($request){}
>> > public function handleResult($request){}
>> >
>> >
>> > }
>> > ?>
>> >
>> > Template:
>> > <!-- dataInput.tpl -->
>> > <input type="submit" value="ok" />
>> >
>> > Server:
>> > <?php
>> > class ServerDataMappa extends ClientResponderAdapter {
>> > //public function updateMap(BasicOverlay $overlay){
>> > public function handlePreDrawing($request){
>> > $msMapObj = $this->serverContext->getMapObj();
>> > $layer = new LayerOverlay();
>> > $layer->action = BasicOverlay::ACTION_INSERT;
>> > $layer->name = "mappa";
>> > $layer->data = "images/cc_20050603.tif";
>> > $mapOverlay = $this->serverContext->getPluginManager()->mapOverlay;
>> > $mapOverlay = updateMap($layer);
>> > $this->serverContext->getMapObj()->save('debug.map');
>> > }
>> > }
>> > ?>
>> >
>> > Il template presenta solo un pulsante che dovrebbe richiamare la parte
>> > server per modificare il raster ma non funziona ed anche se lascio il
>> > campo
>> > data vuoto o vi inserisco un indirizzo inesistente non ottengo nessun
>> > cambiamente. Dove sbaglio!
>> > Grazie a tutti anticipatamente
>> >
>> > Luigi
>> > --
>> > Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>> >
>> > Sponsor:
>> >
>> > Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6119&d=20070322
>> >
>> >
>> > _______________________________________________
>> > Cartoweb-users mailing list
>> > Cartoweb-users at lists.maptools.org
>> > http://lists.maptools.org/mailman/listinfo/cartoweb-users
>> >
>>
>>
>>
>>
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> CD-DVD Vergini. Ampia scelta tra le migliori marche: Verbatim, Sony, Benq.
> Prezzi sotto costo, visita il sito
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6120&d=20070322
>
>
> 



More information about the Cartoweb-users mailing list