From ecc2a5e8ea444b4a0f2384355e4fa21c6571ab2e Mon Sep 17 00:00:00 2001 From: arno Date: Sat, 14 Aug 2010 15:49:05 +0200 Subject: [PATCH] read initial geom from js object instead of form input --- application/controllers/IdxController.php | 3 ++- public/js/syj.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/application/controllers/IdxController.php b/application/controllers/IdxController.php index f85989c..d3c4bcb 100644 --- a/application/controllers/IdxController.php +++ b/application/controllers/IdxController.php @@ -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))); diff --git a/public/js/syj.js b/public/js/syj.js index 45ae794..4032cca 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -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. -- 2.39.2