[Mapbender-commits] r5738 - in trunk/mapbender: conf http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Mar 9 09:17:05 EST 2010
Author: verenadiewald
Date: 2010-03-09 09:17:02 -0500 (Tue, 09 Mar 2010)
New Revision: 5738
Added:
trunk/mapbender/http/plugins/mb_initWmc.php
Modified:
trunk/mapbender/conf/session.conf
Log:
http://trac.osgeo.org/mapbender/ticket/624
Modified: trunk/mapbender/conf/session.conf
===================================================================
--- trunk/mapbender/conf/session.conf 2010-03-09 08:26:07 UTC (rev 5737)
+++ trunk/mapbender/conf/session.conf 2010-03-09 14:17:02 UTC (rev 5738)
@@ -30,8 +30,8 @@
Mapbender::session()->set("mb_myWmc","");
Mapbender::session()->set("mb_myWmc_action","");
-if ($_REQUEST["wmc_id"]) {
- Mapbender::session()->set("mb_myWmc",$_REQUEST["wmc_id"]);
+if ($_REQUEST["load_wmc_id"]) {
+ Mapbender::session()->set("mb_myWmc",$_REQUEST["load_wmc_id"]);
Mapbender::session()->set("mb_myWmc_action","load");
}
else if ($_REQUEST["merge_wmc_id"]) {
Added: trunk/mapbender/http/plugins/mb_initWmc.php
===================================================================
--- trunk/mapbender/http/plugins/mb_initWmc.php (rev 0)
+++ trunk/mapbender/http/plugins/mb_initWmc.php 2010-03-09 14:17:02 UTC (rev 5738)
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Package: initWmc
+ *
+ * Description:
+ * Mapbender is initialized with a WMC document given as parameter load_wmc_id
+ *
+ * Files:
+ * - http/plugins/mb_initWmc.php
+ *
+ * SQL:
+ * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment,
+ * > e_title, e_element, e_src, e_attributes, e_left, e_top, e_width,
+ * > e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file,
+ * > e_mb_mod, e_target, e_requires, e_url) VALUES('<appId>','initWmc',
+ * > 2,1,'init Wmc','initWmc','div','','',1,1,2,2,5,'','',
+ * > 'div','../plugins/mb_initWmc.php','',
+ * > 'mapframe1','','http://www.mapbender.org/index.php/InitWMC');
+ * >
+ *
+ * Help:
+ * http://www.mapbender.org/InitWMC
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Christoph_Baudson
+ * http://www.mapbender.org/User:Verena_Diewald
+ *
+ *
+ *
+ * License:
+ * Copyright (c) 2009, Open Source Geospatial Foundation
+ * This program is dual licensed under the GNU General Public License
+ * and Simplified BSD license.
+ * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+ */
+require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
+?>
+var myTarget = options.target ? options.target[0] : "mapframe1";
+var myId = options ? options.id : "initWmc";
+
+var initWmc = function () {
+
+ var that = this;
+
+ <?php
+ function initWmcById () {
+ global $firephp;
+
+ $wmcId = Mapbender::session()->get("mb_myWmc");
+ $wmcAction = Mapbender::session()->get("mb_myWmc_action");
+
+ $wmc = new wmc();
+
+ $wmc->createFromDb($wmcId);
+
+ $updatedWMC = $wmc->updateUrlsFromDb();
+ $wmc->createFromXml($updatedWMC);
+
+ $jsArray = $wmc->toJavaScript();
+
+ if ($jsArray) {
+ $jsString = implode("", $jsArray);
+ echo $jsString;
+ }
+ else {
+ $e = new mb_exception("WMC could not be loaded.");
+ }
+ }
+ initWmcById();
+ ?>
+};
+
+Mapbender.events.beforeInit.register(function () {
+ initWmc();
+});
More information about the Mapbender_commits
mailing list