[Cartoweb-users] Re: $_ENV['CW3_PROJECT'], and other variables

Alexandre Saunier alexandre.saunier at camptocamp.com
Tue Jan 16 12:35:57 EST 2007


Here are some *instances* of URL with CW3 GET parameters:

- recentering using coordinates:
http://example.com/?recenter_x=123456&recenter_y=54321&recenter_scale=10000&show_crosshair=1

- recentering on objects id's (ie objects defined in the mapfile for a 
given layer and with an id field specified in the layer definition):
http://example.com/?id_recenter_layer=cities&id_recenter_ids=12345,45634,789 
  (in this example we want to recenter on 3 different cities).

All the available parameters are listed in section 2.4.2.2 of the links 
I previously gave.

Note that those GET parameters do not require to use the FilterProvider 
interface in your plugins. Filters are "only" used to dynamically set or 
modify those parameters and to create customized behaviors.
For instance if you'd prefer to use an other name for some of this 
parameters you may add in on of your plugins something like:

function filterGetRequest(FilterRequestModifier $request)
     if ($request->getValue('x') && $request->getValue('y')) {
         $request->setValue('recenter_x', $request->getValue('x'));
         $request->setValue('recenter_y', $request->getValue('y'));
         $request->setValue('recenter_scale', '10000');
         $request->setValue('show_crosshair', '1');
     }
}

thus you may rewrite the first instance URL into:
http://example.com/?x=123456&y=54321

If you don't need to rewrite URLs depending on what GET/POST parameters 
you get (for instance if you call the built-in parameters), 
FilterProvider is not necessary.

Max Ueda wrote:
> Thanks Alexandre!
> 
> That is what I am looking for.
> Still, I got some questions about filterGetRequest()
> method.
> 
> When using a GET request, how should the URL be
> mounted? For example, by having the
> ClientRecenterExample.php just like the recenter
> example, how should the GET request URL look like?
> 
> Thanks again,
> 
> Max Ueda
> 
> --- Alexandre Saunier
> <alexandre.saunier at camptocamp.com> wrote:
> 
> 
>>Hello,
>>
>>you may directly load a given CartoWeb "state" by
>>calling CartoWeb URL 
>>with some special GET (or POST) parameters.
>>
>>For CW3.3 see:
>>
> 
> http://cartoweb.org/doc/cw3.3/xhtml/dev.newplugin.html#dev.newplugin.special.filters
> 
>>CVS version has some extra parameters:
>>
> 
> http://cartoweb.org/doc_head/docbook/xhtml/dev.newplugin.html#dev.newplugin.special.filters
> 
>>AS
>>
>>Max Ueda wrote:
>>
>>>Hi again,
>>>
>>>Hm, I forgot to say, I was also looking for
>>
>>something
>>
>>>that works like those url communicating stuff
>>
>>(getting
>>
>>>something done by a webpage through url lines,
>>
>>like
>>
> http://www.myproject.com/cartoweb3/htdocs/myProject.php?lang=fr).
> 
>>> 
>>>
>>>Can it be done?
>>>
>>>Thanks again!
>>>
>>>Max
>>>
>>>
>>>--- Max Ueda <mhanzo at yahoo.com> wrote:
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>What for is the $_ENV array?
>>>>
>>>>The question I have may sound stupid, but, I'm out
>>>>of
>>>>ideas, and this is the last one that came.
>>>>
>>>>I need to have access from a web application to
>>
>>the
>>
>>>>template variables of the Cartoweb Application I'm
>>>>using. 
>>>>
>>>>For example, I have the Cartoweb Application and
>>
>>its
>>
>>>>plugins, and a web application (one of those
>>>>websites
>>>>that does some database retrieval operations and
>>>>displays them as html pages). All I need is to
>>
>>throw
>>
>>>>the values retrieved from that application to the
>>>>Cartoweb Application, without accessing the
>>>>MyProject.php file explicitly. 
>>>>
>>>>In other words, all I need is to use the retrieved
>>>>data from my web application to use the Cartoweb
>>>>Plugins I've developed (mostly, recentering and
>>>>outline) without having to access the plugin
>>>>templates/forms.
>>>>
>>>>For example, I retrieve some data (lat/long
>>>>coordinates, street&number) from my webapp, and
>>
>>when
>>
>>>>I
>>>>click a submit button, I need it to transmit the
>>>>data
>>>>to the CArtoweb application, and then, it displays
>>>>the
>>>>main CW3 Project page with the recentered
>>>>coordinates
>>>>(that are related to the item I've retrieved from
>>>>the
>>>>web application) on it. 
>>>>
>>>>Is there any other way of doing that without
>>
>>having
>>
>>>>to
>>>>access such variables (for example, the $_REQUEST
>>>>and
>>>>$_POST from PHP)?
>>>>
>>>>Thanks in advance!
>>>>
>>>>Max Ueda
>>
> 
> 
> 
>  
> ____________________________________________________________________________________
> Food fight? Enjoy some healthy debate 
> in the Yahoo! Answers Food & Drink Q&A.
> http://answers.yahoo.com/dir/?link=list&sid=396545367
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users

-- 
Alexandre Saunier
Camptocamp SA
PSE A
CH-1015 Lausanne

+41 21 619 10 19 (direct)
+41 21 619 10 10 (centrale)
+41 21 619 10 00 (fax)


More information about the Cartoweb-users mailing list