]> dev.renevier.net Git - syj.git/commitdiff
read initial geom from js object instead of form input
authorarno <arno@renevier.net>
Sat, 14 Aug 2010 13:49:05 +0000 (15:49 +0200)
committerarno <arno@renevier.net>
Sat, 14 Aug 2010 13:49:05 +0000 (15:49 +0200)
application/controllers/IdxController.php
public/js/syj.js

index f85989ccb7d716b1805cea478560aed8bf35953a..d3c4bcb20238c6f7727d6b1392cdb806fb3f4664 100644 (file)
@@ -39,8 +39,9 @@ class IdxController extends Zend_Controller_Action
             $title = $path->displayTitle;
             $this->view->path = $path;
             $geomform->geom_title->setValue($path->title);
-            $geomform->geom_data->setValue((string)$path->geom);
             $loginform->login_geom_id->setValue((string)$path->id);
+            $jsgeom = new phptojs\JsObject('gInitialGeom', array('data' => (string) $path->geom));
+            $this->view->headScript()->prependScript((string) $jsgeom);
         } else {
             $geomform->setAction('path');
             $extent = new phptojs\JsObject('gMaxExtent', $this->_helper->syjGeoip($this->getRequest()->getClientIp(true)));
index 45ae794c5289fdfbcc533ac4b0f38ba7e7508fad..4032cca7989f10060fcbd970f7528f016bedee82 100644 (file)
@@ -289,8 +289,8 @@ var SYJView = {
             this.messenger.hide();
         }
 
-        if ($("geom_data").value) {
-            this.viewLayer.addFeatures([this.wkt.read($("geom_data").value)]);
+        if (typeof gInitialGeom !== "undefined" && typeof gInitialGeom.data !== "undefined") {
+            this.viewLayer.addFeatures([this.wkt.read(gInitialGeom.data)]);
             extent = this.viewLayer.getDataExtent();
             // XXX: ie has not guessed height of map main div yet during map
             // initialisation. Now, it will read it correctly.