From 66441b64eacf64a0f7a14246139ed807ab816a04 Mon Sep 17 00:00:00 2001 From: arno Date: Thu, 12 Aug 2010 00:25:13 +0200 Subject: [PATCH] list of created routes: ie support --- application/controllers/PathController.php | 4 ++-- public/css/list.css | 1 + public/js/list.js | 28 ++++++++++++---------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/application/controllers/PathController.php b/application/controllers/PathController.php index b521a26..bb969e8 100644 --- a/application/controllers/PathController.php +++ b/application/controllers/PathController.php @@ -24,14 +24,14 @@ class PathController extends Zend_Controller_Action $formData = $this->_helper->SyjPostData->getPostData('Syj_Form_Geom'); $path = $this->getPath(); $this->save($path, $formData); - $this->_helper->SyjApi->setCode(204); + $this->_helper->SyjApi->setCode(200); // we should use 204, but ie mangles 204 to 1223 } public function deleteAction() { $path = $this->getPath(); $pathMapper = new Syj_Model_PathMapper(); $pathMapper->delete ($path); - $this->_helper->SyjApi->setCode(204); + $this->_helper->SyjApi->setCode(200); // we should use 204, but ie mangles 204 to 1223 } public function getPath() { diff --git a/public/css/list.css b/public/css/list.css index 65715c1..4f87230 100644 --- a/public/css/list.css +++ b/public/css/list.css @@ -15,6 +15,7 @@ .map { position: absolute; + width: 100%; height: 100%; top: 0; bottom: 0; right: 0; left: 0; } diff --git a/public/js/list.js b/public/js/list.js index 62f7b06..fe0eb62 100644 --- a/public/js/list.js +++ b/public/js/list.js @@ -4,7 +4,19 @@ var Mercator = new OpenLayers.Projection("EPSG:900913"); document.observe("dom:loaded", function() { $("message").hide(); - $$(".map").each(function(elt) { + + $$(".item").each(function(elt) { + new item(elt); + }); +}); + +function item(elt) { + this.deleteHandler = elt.on('click', '.delete-link', this.remove.bindAsEventListener(this)); + this.elt = elt; + this.map = this.createmap(elt.down('.map')); +} +item.prototype = { + createmap: function(elt) { var geom = elt.getAttribute('data-geom'), baseLayer = new OpenLayers.Layer.OSM("OSM"), map = new OpenLayers.Map(elt, { controls: [], theme: null}), @@ -24,24 +36,16 @@ document.observe("dom:loaded", function() { map.addLayers([baseLayer, viewLayer]); viewLayer.addFeatures([wkt.read(geom)]); map.zoomToExtent(viewLayer.getDataExtent()); - }); - - $$(".item").each(function(elt) { - new item(elt); - }); -}); + return map; + }, -function item(elt) { - this.deleteHandler = elt.on('click', '.delete-link', this.remove.bindAsEventListener(this)); - this.elt = elt; -} -item.prototype = { deleteSuccess: function() { this.deactivate(); $("message").setMessage(SyjStrings.deleteSuccess, "success"); }, deactivate: function() { + this.map.destroy(); this.elt.down('.title').update(); this.elt.down('.geom').update().setStyle({backgroundColor: 'gray'}); this.deleteHandler.stop(); -- 2.39.2