[Cartoweb-users] several shortcuts..

Valerio Noti valerionoti at yahoo.it
Fri Jan 27 08:29:37 EST 2006


it works,
thank you very much!

Valerio


----- Original Message ----- 
From: "oliver" <oliver.christen at camptocamp.com>
To: "Valerio Noti" <valerionoti at yahoo.it>; 
<cartoweb-users at lists.maptools.org>
Sent: Friday, January 27, 2006 2:02 PM
Subject: Re: [Cartoweb-users] several shortcuts..


> Effectively,
>
> after some discussion around, it seems you can use the parameter
> recenter_bbox to set a bbox (extent) via the url
> so just call your url with ?recenter_bbox="xmin,ymin,xmax,ymax"
>
> see
> http://www.cartoweb.org/doc_head/docbook/xhtml/dev.newplugin.html#dev.newplu
> gin.special.filters
> 2.4.2.2. Available Parameters
> Regards,
> Oliver
>
>
> ----- Original Message -----
> From: "Valerio Noti" <valerionoti at yahoo.it>
> To: "oliver" <oliver.christen at camptocamp.com>;
> <cartoweb-users at lists.maptools.org>
> Sent: Friday, January 27, 2006 9:53 AM
> Subject: Re: [Cartoweb-users] several shortcuts..
>
>
>> Oliver,
>> initialMapStates work but only if I close browser and reopen it.
>> If I want to call project via url in a form select with javascript
>> ..
>> strQuickView = "MyProject.php?initialState=place1";
>> window.location.href = strQuickView;
>> ..
>> nothing happens and it remains at the old coordinates.
>>
>> is it normal?
>>
>> Thanks
>>
>> Valerio
>>
>>
>>
>>
>> ----- Original Message -----
>> From: "oliver" <oliver.christen at camptocamp.com>
>> To: "Valerio Noti" <valerionoti at yahoo.it>;
>> <cartoweb-users at lists.maptools.org>
>> Sent: Friday, January 27, 2006 7:49 AM
>> Subject: Re: [Cartoweb-users] several shortcuts..
>>
>>
>> > Both solution are possible, but the 2nd is probably the easiest.
>> >
>> > Simply define some initialMapStates bbox in the "your_project_name".ini
>> > file
>> > in server_conf
>> > mapInfo.initialMapStates.default.location.bbox =
>> > "531800,149000,547000,163600"
>> > mapInfo.initialMapStates.place1.location.bbox =
>> > "431800,139000,547000,153600"
>> > mapInfo.initialMapStates.place2.location.bbox =
>> > "331800,129000,527000,143600"
>> > ...
>> >
>> > and call it via url with parameter ?initialState=place1 or place2 or 
>> > ...
>> >
>> >
> http://www.cartoweb.org/doc_head/docbook/xhtml/user.config.html#user.config.
>> > client
>> >
> http://www.cartoweb.org/doc_head/docbook/xhtml/user.config.html#user.config.
>> > server.maps_config.initial
>> >
>> > you can also define a list of shortcuts to locations of your choices,
> see
>> > http://www.cartoweb.org/doc_head/docbook/xhtml/user.location.html
>> >
>> > Oliver
>> >
>> >> Thank you very much Oliver,
>> >> I'll try your suggestions for new plugin.
>> >> As another way for solving this problem do you think possible one of
>> >> these
>> >> solutions ?
>> >>
>> >> 1)
>> >> I save several views with view plugin and I call cartoweb project with
> a
>> >> combo box changing the url with javascript
>> >>
>> >> 2)
>> >> is it possible to run via url a cartoweb project directly with
>> >> coordinates
>> >> values?
>> >>  (i.e. .../htdocs/italy.php?bbox=x1,y1,x2,y2)
>> >> This would be the best solutions for me....
>> >>
>> >> Thanks again
>> >>
>> >> Valerio
>> >>
>> >>
>> >>
>> >> ----- Original Message -----
>> >> From: "oliver.christen" <oliver.christen at camptocamp.com>
>> >> To: "Valerio Noti" <valerionoti at yahoo.it>;
>> >> <cartoweb-users at lists.maptools.org>
>> >> Sent: Thursday, January 26, 2006 7:55 PM
>> >> Subject: Re: [Cartoweb-users] several shortcuts..
>> >>
>> >>
>> >> >I forgot to say:
>> >> >
>> >> > the filename of the php file depend of the name of the plugin, hence
>> >> > the
>> >> > class you want to use. I my exemple, the class was
>> >> > 'ClientMyProjectLocation', the plugin name will be
> 'myProjectLocation',
>> >> > and the filename will be 'ClientMyProjectLocation.php'
>> >> > Create a folder named 'myProjectLocation' in the coreplugin folder 
>> >> > OF
>> > YOUR
>> >> > PROJECT ( not in the main coreplugin folder of cartoweb)(in
> coreplugin
>> >> > because you extend 'location' which is a coreplugin). In that 
>> >> > folder,
>> >> > create a folder named 'client', put the 
>> >> > 'ClientMyProjectLocation.php'
>> >> > inside.
>> >> >
>> >> > Let me know if that was usefull to you.
>> >> >
>> >> > Regards,
>> >> > Oliver
>> >> >
>> >> >> Hi Valerio,
>> >> >>
>> >> >> you cant do that directly in the location plugin, but it is quite
> easy
>> > to
>> >> >> extend that plugin to do what you want.
>> >> >>
>> >> >> basically, you create a new plugin, lets call it MyProjectLocation
>> >> >>
>> >> >> the template would look like this:
>> >> >>
>> >> >>
>> >> >> <?php
>> >> >> /**
>> >> >> * @package CorePlugins
>> >> >> * @version $Id: ClientMyProjectLocation.php,v 1.8 2005/02/23
> 11:52:43
>> >> >> Exp $
>> >> >> */
>> >> >>
>> >> >> class ClientMyProjectLocation extends ClientLocation {
>> >> >>
>> >> >>    public function replacePlugin() {
>> >> >>        return 'location';
>> >> >>    }
>> >> >>
>> >> >>    // here redefine the function you need, most probably
>> > drawShortcuts()
>> >> >> /**     * Draws shortcuts form     * @return string     */
>> >> >> protected
>> >> >> function drawShortcuts() {        $this->smarty = new
>> >> >> Smarty_Plugin($this->getCartoclient(), $this);
> $shortcutValues
>> >> >> =
>> >> >> array(-1);        $shortcutLabels = array('');        $shortcuts =
>> >> >> $this->shortcuts;        if (!is_array($shortcuts)) $shortcuts =
>> > array();
>> >> >> /* do what you want with the array containing the shortcuts, list
>> >> >> spliting, sorting, etc....             below is the original
> function
>> >> >> code, allowing to treat the shortcuts values and labels */
>> > foreach
>> >> >> ($shortcuts as $key => $shortcut) {            $shortcutValues[] =
>> > $key;
>> >> >> $shortcutLabels[] = 
>> >> >>  >label);                    }
>> >> >> /*
>> >> >> now let say you cuted your shortcuts in 3 arrays (hence 3 for 
>> >> >> values
>> > and
>> >> >> 3 for labels),         you assign them to your template vis smarty
> */
>> > /*
>> >> >> below the original code */
>> > $this->smarty->assign(array('shortcut_values'
>> >> >> => $shortcutValues, 'shortcut_labels' => $shortcutLabels));
> /*
>> > you
>> >> >> would have to do something like this */
>> >> >> $this->smarty->assign(array('shortcut_values_1' =>
> $shortcutValues_1,
>> >> >> 'shortcut_labels_1' => $shortcutLabels_1, 'shortcut_values_2' =>
>> >> >> $shortcutValues_2, 'shortcut_labels_2' => $shortcutLabels_2,
>> >> >> 'shortcut_values_3' => $shortcutValues_3, 'shortcut_labels_3' =>
>> >> >> $shortcutLabels_3));        return
>> >> >>  >smarty->fetch('shortcuts.tpl');    }    /* you will also have to
>> >> >> redefine the function handleShortcuts, because only one input
> (select)
>> >> >> can have one id,     so you need to tell the plugin to treat the
> value
>> >> >> returned by these inputs too */    protected function
>> >> >> handleShortcuts($request, $useDoit = true, $check = false)
> {        if
>> >> >> (isset($this->getHttpValue($request, 'shortcut_id')) {
>> >> >> $shortcut_id  = isset($this->getHttpValue($request,
>> >> >> ut_id');        } else if (isset($this->getHttpValue($request,
>> >> >> 'shortcut_id1')){ $shortcut_id  =
> isset($this->getHttpValue($request,
>> >> >> ut_id1');        } else if (isset($this->getHttpValue($request,
>> >> >> 'shortcut_id2')){ $shortcut_id  =
> isset($this->getHttpValue($request,
>> >> >> ut_id2');        } else if (isset($this->getHttpValue($request,
>> >> >> 'shortcut_id3')){            $shortcut_id  =
>> >> >> isset($this->getHttpValue($request, 'shortcut_id3');        }
>> >> >> $shortcutDoit = $this->getHttpValue($request, 'shortcut_doit'); if
>> >> >> (is_null($shortcut_id) || ($shortcutDoit != '1' && $useDoit))
>> >> >> {            return NULL;        }                if ($check) { if
>> >> >> (!$this->checkInt($shortcut_id, 'shortcut_id'))
> return
>> >> >> NULL;                            if 
>> >> >> (!array_key_exists($shortcut_id,
>> >> >> $this->shortcuts)) { $this->cartoclient->addMessage('Shortcut ID 
>> >> >> not
>> >> >> found'); return NULL;            }        } $bboxRequest = new
>> >> >> BboxLocationRequest();        $bboxRequest->bbox =
>> >> >> $this->shortcuts[$request['shortcut_id']]->bbox;
>> > $locationRequest
>> >> >> = new LocationRequest(); $locationRequest->locationType =
>> >> >> LocationRequest::LOC_REQ_BBOX; 
>> >> >> $locationRequest->bboxLocationRequest
> =
>> >> >> $bboxRequest; return $locationRequest;            }}?>
>> >> >>
>> >> >> and in your shortcuts.tpl simply put the smarty variable
>> >> >> $shortcut_values_1
>> >> >> $shortcut_labels_1 $shortcut_values_2 $shortcut_labels_2
>> >> >> $shortcut_values_3
>> >> >> $shortcut_labels_3 as needed
>> >> >>
>> >> >> <select name="shortcut_id1" id="shortcut_id1"
>> >> >>
>> >
> onchange="javascript:document.carto_form.shortcut_doit.value=1;FormItemSelec
>> > ted();">
>> >> >> {html_options values=$shortcut_values_1 output=$shortcut_labels_1}
>> >> >> </select>
>> >> >> <select name="shortcut_id2" id="shortcut_id2"
>> >> >>
>> >
> onchange="javascript:document.carto_form.shortcut_doit.value=1;FormItemSelec
>> > ted();">
>> >> >> {html_options values=$shortcut_values_2 output=$shortcut_labels_2}
>> >> >> </select>
>> >> >> <select name="shortcut_id3" id="shortcut_id3"
>> >> >>
>> >
> onchange="javascript:document.carto_form.shortcut_doit.value=1;FormItemSelec
>> > ted();">
>> >> >> {html_options values=$shortcut_values_3 output=$shortcut_labels_3}
>> >> >> </select>
>> >> >>
>> >> >> Finally, dont forget tp load your new plugin. In the file
>> >> >> client_conf/client.ini add it to the loadPlugins list
>> >> >>
>> >> >> That should cover most of it.
>> >> >>
>> >> >> All references are there:
>> >> >>
>> >
> http://www.cartoweb.org/doc_head/docbook/xhtml/dev.newplugin.html#dev.newplu
>> > gin.adapting.extending
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >> Oliver Christen
>> >> >> Camptocamp SA
>> >> >>
>> >> >>> Hi,
>> >> >>> is it possible to split shortcuts in two or more combo boxes (i.e.
>> > tows
>> >> >>> shortcuts and lakes shortcuts)?
>> >> >>> Do I have to modify php files or can I configure this in
> location.ini
>> > or
>> >> >>> similar?
>> >> >>>
>> >> >>>
>> >> >>> Thanks
>> >> >>>
>> >> >>> Valerio
>> >> >>> _______________________________________________
>> >> >>> Cartoweb-users mailing list
>> >> >>> Cartoweb-users at lists.maptools.org
>> >> >>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>> >> >>>
>> >> >>
>> >> >> _______________________________________________
>> >> >> Cartoweb-users mailing list
>> >> >> Cartoweb-users at lists.maptools.org
>> >> >> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>> >> >>
>> >> >
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > No virus found in this incoming message.
>> > Checked by AVG Free Edition.
>> > Version: 7.1.375 / Virus Database: 267.14.23/240 - Release Date:
>> > 25/01/2006
>> >
>> >
>>
>>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 
> 27/01/2006
>
> 



More information about the Cartoweb-users mailing list