<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Oliver<br>
<br>
On line 478 I have : $this->orderedMsLayerIds[] =
$this->selectedMsLayerIds[$id];<br>
Cartoweb can't find the $id index in the selectedMsLayerIds collection.<br>
I made a print_r of the selectedMsLayerIds collection and i miss a
layer that i checked by javascript <i>chargeVue() </i>function. So i
assumed that Cartoweb needs first a <i>CartoWeb.trigger('Layers.LayerShowHide');</i>
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.<br>
<br>
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?<br>
<br>
Thanks for your help.<br>
Simon Ortet<br>
Silogic<br>
<br>
Oliver Christen a écrit :
<blockquote cite="mid:15DA8EE682014A418E20CAACAB159A9A@maunakea"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.6000.16525" name="GENERATOR">
<style></style>
<div><font size="2">what do you have at line 478 of your </font><font
size="3">ClientLayerReorder.php file?</font></div>
<div>I only see a comment at that line</div>
<div> </div>
<div><font size="2">regards</font></div>
<div><font size="2">Oliver</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div
style="background: rgb(228, 228, 228) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>From:</b>
<a moz-do-not-send="true" title="simon.ortet@silogic.fr"
href="mailto:simon.ortet@silogic.fr">Simon ORTET</a> </div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a moz-do-not-send="true" title="cartoweb-users@lists.maptools.org"
href="mailto:cartoweb-users@lists.maptools.org">cartoweb</a> </div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Monday, October 08, 2007 10:15 AM</div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b>
[Cartoweb-users] Show layers in a defined order</div>
<div><br>
</div>
Hi everyone.<br>
<br>
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.<br>
<br>
The problem is Cartoweb seems not to know the layers i just checked.
Here's the error message.<br>
<pre>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]
</pre>
<br>
So here's the function i made to do this.<br>
<br>
<blockquote><i>function chargeVue() { </i><br>
<i> <font color="#009900">// Here i get the layers i need to
show in a field of my form</font></i><br>
<i> for (var i=0; i<$('selectVue').options.length; i++) {</i><br>
<i> if ($('selectVue').options[i].selected ) {</i><br>
<i> selectione = $('selectVue').options[i].value;</i><br>
<i> }</i><br>
<i> } </i><br>
<i> </i><br>
<i> <font color="#009900">// Here i check the layers i got in
the layer tree</font></i><br>
<i> var tabSel = $('vue_'+selectione).value.split(";");</i><br>
<i> var tabOrdre = new Array();</i><br>
<i> var celts = $('layersroot').getElementsByTagName('input');</i><br>
<br>
<i> for (var j = 0; j < celts.length; j++) {</i><br>
<i> if (!celts[j].checked &&
inArray(tabSel,celts[j].value)) {</i><br>
<i> celts[j].checked = true;</i><br>
<i><font color="#009900"> // Here i store the order of
the layers in the layers tree</font></i><br>
<i> tabOrdre.push(celts[j].value);</i><br>
<i> }else</i><br>
<i> celts[j].checked = false;</i><br>
<i> }</i><br>
<i> </i><br>
<i> <font color="#009900">// Here i fill an array with the
new layers order</font></i><br>
<i> var tabNewOrdre = new Array();</i><br>
<i> for (j = 0; j < tabSel.length; j++) {</i><br>
<i> // Ajoute l'indice de la couche dans tabOrdre</i><br>
<i> tabNewOrdre.push(indexInArray(tabOrdre,tabSel[j]));</i><br>
<i> }</i><br>
<i> $('layersReorder').value = tabNewOrdre.join(",");</i><br>
<i> </i><br>
<i> <font color="#009900">// Here i update the map</font></i><br>
<i> CartoWeb.trigger('Layers.LayerShowHide');</i><br>
<i>}</i><span class="sourceRowText"></span><br>
<span class="sourceRowText"></span></blockquote>
<br>
<br>
<br>
<b>Is there a way to achieve this without making 2 ajax calls (one
to check the layers, the other to order them)?<br>
<br>
</b>Thanks for your help<br>
<br>
Simon Ortet<br>
Silogic<br>
<p> </p>
<hr> _______________________________________________<br>
Cartoweb-users mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:Cartoweb-users@lists.maptools.org">Cartoweb-users@lists.maptools.org</a><br>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/cartoweb-users">http://lists.maptools.org/mailman/listinfo/cartoweb-users</a><br>
</blockquote>
</blockquote>
</body>
</html>