[Cartoweb-users] Show layers in a defined order

Simon ORTET simon.ortet at silogic.fr
Tue Oct 9 04:25:51 EDT 2007


Hi Oliver

On line 478 I have : $this->orderedMsLayerIds[] = 
$this->selectedMsLayerIds[$id];
Cartoweb can't find the $id index in the selectedMsLayerIds collection.
I made a print_r of the selectedMsLayerIds collection and i miss a layer 
that i checked by javascript /chargeVue() /function. So i assumed that 
Cartoweb needs first a /CartoWeb.trigger('Layers.LayerShowHide');/ call 
to gather the layers checked in the tree and update its collection. And 
only then, i can make the CartoWeb.trigger('LayerReorder.Apply'); to 
reorder these layers.

The problem is that i want to do that in only 1 ajax call. I'd like to 
avoid writing a new plugin. What could you advise me?

Thanks for your help.
Simon Ortet
Silogic

Oliver Christen a écrit :
> what do you have at line 478 of your ClientLayerReorder.php file?
> I only see a comment at that line
>  
> regards
> Oliver
>
>     ----- Original Message -----
>     *From:* Simon ORTET <mailto:simon.ortet at silogic.fr>
>     *To:* cartoweb <mailto:cartoweb-users at lists.maptools.org>
>     *Sent:* Monday, October 08, 2007 10:15 AM
>     *Subject:* [Cartoweb-users] Show layers in a defined order
>
>     Hi everyone.
>
>     I'm trying to do a 2 in 1 action with Cartoweb: Show some layers
>     in a special order. So it means i have to check some layers in the
>     layers tree and reorder them. Finally i make the ajax call to make
>     Cartoweb apply the changes.
>
>     The problem is Cartoweb seems not to know the layers i just
>     checked. Here's the error message.
>
>     version: 3.3.0 [$Revision: 1.2 $]
>     class:   CartocommonException
>     message:   Error [8, Undefined index:  1, /opt/cartoweb/cartoweb3/projects/aeag/plugins/layerReorder/client/ClientLayerReorder.php, 478]
>         
>
>
>     So here's the function i made to do this.
>
>         /function chargeVue() {    /
>         /    // Here i get the layers i need to show in a field of my
>         form/
>         /    for (var i=0; i<$('selectVue').options.length; i++) {/
>         /      if ($('selectVue').options[i].selected ) {/
>         /        selectione = $('selectVue').options[i].value;/
>         /      }/
>         /    }     /
>         /    /
>         /    // Here i check the layers i got in the layer tree/
>         /    var tabSel = $('vue_'+selectione).value.split(";");/
>         /    var tabOrdre = new Array();/
>         /    var celts = $('layersroot').getElementsByTagName('input');/
>
>         /    for (var j = 0; j < celts.length; j++) {/
>         /        if (!celts[j].checked &&
>         inArray(tabSel,celts[j].value)) {/
>         /            celts[j].checked = true;/
>         /            // Here i store the order of the layers in the
>         layers tree/
>         /            tabOrdre.push(celts[j].value);/
>         /        }else/
>         /            celts[j].checked = false;/
>         /    }/
>         /    /
>         /    // Here i fill an array with the new layers order/
>         /    var tabNewOrdre = new Array();/
>         /    for (j = 0; j < tabSel.length; j++) {/
>         /        // Ajoute l'indice de la couche dans tabOrdre/
>         /        tabNewOrdre.push(indexInArray(tabOrdre,tabSel[j]));/
>         /    }/
>         /    $('layersReorder').value = tabNewOrdre.join(",");/
>         /    /
>         /    // Here i update the map/
>         /    CartoWeb.trigger('Layers.LayerShowHide');/
>         /}/
>
>
>
>
>     *Is there a way to achieve this without making 2 ajax calls (one
>     to check the layers, the other to order them)?
>
>     *Thanks for your help
>
>     Simon Ortet
>     Silogic
>
>     ------------------------------------------------------------------------
>     _______________________________________________
>     Cartoweb-users mailing list
>     Cartoweb-users at lists.maptools.org
>     http://lists.maptools.org/mailman/listinfo/cartoweb-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20071009/5180a095/attachment.html


More information about the Cartoweb-users mailing list