- $$(".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}),
var geom = elt.getAttribute('data-geom'),
baseLayer = new OpenLayers.Layer.OSM("OSM"),
map = new OpenLayers.Map(elt, { controls: [], theme: null}),
map.addLayers([baseLayer, viewLayer]);
viewLayer.addFeatures([wkt.read(geom)]);
map.zoomToExtent(viewLayer.getDataExtent());
map.addLayers([baseLayer, viewLayer]);
viewLayer.addFeatures([wkt.read(geom)]);
map.zoomToExtent(viewLayer.getDataExtent());
deleteSuccess: function() {
this.deactivate();
$("message").setMessage(SyjStrings.deleteSuccess, "success");
},
deactivate: function() {
deleteSuccess: function() {
this.deactivate();
$("message").setMessage(SyjStrings.deleteSuccess, "success");
},
deactivate: function() {
this.elt.down('.title').update();
this.elt.down('.geom').update().setStyle({backgroundColor: 'gray'});
this.deleteHandler.stop();
this.elt.down('.title').update();
this.elt.down('.geom').update().setStyle({backgroundColor: 'gray'});
this.deleteHandler.stop();