[Cartoweb-dev] edit plugin

Pierre GIRAUD pierre.giraud at camptocamp.com
Fri Feb 16 11:11:25 EST 2007


Attached is a double patch that may help you for the
isLayerVisibleAtCurrentScale exception.

Can you try to apply it ?

Sylvain Beorchia wrote:
> Yes, in fact my edit layers are only allowed for admin. could it be the
> problem ?
>
> ok, i've tried with no auth config on those layers, and it works...i
> mean CW does not fail. But still, when i choose a layer to edit, the map
>  always goes with the loading splash screen and never stops.
>   
Do you have any javascript error ?
Important note : the edit_plugin isn't AJAX proof.

Regards

Pierre

-------------- next part --------------
### Eclipse Workspace Patch 1.0
#P cartoweb3
Index: coreplugins/layers/client/ClientLayers.php
===================================================================
RCS file: /var/lib/cvs/projects/cw3/cartoweb3/coreplugins/layers/client/ClientLayers.php,v
retrieving revision 1.117
diff -u -r1.117 ClientLayers.php
--- coreplugins/layers/client/ClientLayers.php	20 Sep 2006 13:11:10 -0000	1.117
+++ coreplugins/layers/client/ClientLayers.php	16 Feb 2007 15:58:39 -0000
@@ -1438,9 +1438,10 @@
      * @return boolean
      */
     public function isLayerVisibleAtCurrentScale($layerId) {
-        $layer = $this->getLayerByName($layerId, false);
+        if (!($layer = $this->getLayerByName($layerId, false))) {
+            return false;
+        };
         $scale = $this->getCurrentScale();
-
         if (($layer->maxScale && $scale > $layer->maxScale) ||
             ($layer->minScale && $scale < $layer->minScale))
             return false;
Index: plugins/edit/client/ClientEdit.php
===================================================================
RCS file: /var/lib/cvs/projects/cw3/cartoweb3/plugins/edit/client/ClientEdit.php,v
retrieving revision 1.15
diff -u -r1.15 ClientEdit.php
--- plugins/edit/client/ClientEdit.php	23 Aug 2006 11:40:46 -0000	1.15
+++ plugins/edit/client/ClientEdit.php	16 Feb 2007 15:58:40 -0000
@@ -315,13 +315,18 @@
             $this->getConfig()->editDisplayAction : 'both';       
 
         $template->assign(array('edit_active' => true,
-                                'edit_allowed' => $allowed,
-                                'edit_snapping' => $this->editState->snapping,
+                                'edit_allowed' => $allowed));
+                               
+        if (!$allowed) {
+            return;
+        }
+        
+        $template->assign(array('edit_snapping' => $this->editState->snapping,
                                 'edit_shape_type' => $this->editState->shapeType,
                                 'edit_max_insert' => $edit_max_insert,
                                 'edit_resultNbCol' => $editResultNbCol,
                                 'edit_displayAction' => $editDisplayAction));
-                               
+        
         // editable layers list
         $layersList =  $this->getConfig()->editLayers;
         



More information about the Cartoweb-dev mailing list