[Mapbender-commits] r8677 - in trunk/mapbender: conf core http/classes http/extensions/mobilemap http/extensions/mobilemap/js/dev http/extensions/mobilemap/mod_mapbender http/frames http/geoportal http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Jul 30 05:34:32 PDT 2013
Author: armin11
Date: 2013-07-30 05:34:32 -0700 (Tue, 30 Jul 2013)
New Revision: 8677
Added:
trunk/mapbender/http/classes/class_cache.php
Modified:
trunk/mapbender/conf/mapbender.conf-dist
trunk/mapbender/core/system.php
trunk/mapbender/http/classes/class_gui.php
trunk/mapbender/http/classes/class_map.php
trunk/mapbender/http/classes/class_metadata_new.php
trunk/mapbender/http/classes/class_wmc_factory.php
trunk/mapbender/http/extensions/mobilemap/js/dev/5_ngms_jq.js
trunk/mapbender/http/extensions/mobilemap/map.php
trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search_proxy.php
trunk/mapbender/http/frames/index.php
trunk/mapbender/http/geoportal/mod_initialStartWmc.php
trunk/mapbender/http/php/mod_callMetadata.php
trunk/mapbender/http/php/mod_dataISOMetadata.php
trunk/mapbender/http/php/mod_wmc2ol.php
trunk/mapbender/http/php/wms.php
Log:
Some bugfixes and new possibility to cache guis in php variable caches (apc)
Modified: trunk/mapbender/conf/mapbender.conf-dist
===================================================================
--- trunk/mapbender/conf/mapbender.conf-dist 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/conf/mapbender.conf-dist 2013-07-30 12:34:32 UTC (rev 8677)
@@ -238,6 +238,13 @@
# --------------------------------------------
#define("SESSION_NAME", "MAPBENDER");
+# --------------------------------------------
+# Activate APC variable cache if wished and installed
+# class_map.php, frames/index.php, class_gui
+#
+#define("MAPBENDER_VARIABLE_CACHE", false);
+#define("MAPBENDER_CACHE_TYPE", "apc");
+
#---------------------------------------------
# HOSTNAME WHITELIST
# The whitelist is used for some modules who generate urls from a given hostName GET parameter. In such a case it is usefull to give a whitelist for security reasons! If no hostName is given, the parameter $_SERVER['HTTP_HOST'] is used for the urls!
Modified: trunk/mapbender/core/system.php
===================================================================
--- trunk/mapbender/core/system.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/core/system.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -25,9 +25,9 @@
#
# mapbender version
#
-define("MB_VERSION_NUMBER", "2.7.2trunk");
+define("MB_VERSION_NUMBER", "2.7.4trunk");
define("MB_VERSION_APPENDIX", "");
-define("MB_RELEASE_DATE", mktime(0,0,0,07,26,2011));//h, min,sec,month,day,year
+define("MB_RELEASE_DATE", mktime(0,0,0,07,30,2013));//h, min,sec,month,day,year
#
# constants from map.js
Added: trunk/mapbender/http/classes/class_cache.php
===================================================================
--- trunk/mapbender/http/classes/class_cache.php (rev 0)
+++ trunk/mapbender/http/classes/class_cache.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -0,0 +1,83 @@
+<?php
+# $Id: class_cache.php 2013-07-30 11:30:35Z armin11 $
+# http://www.mapbender.org/index.php/class_cache.php
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+/**
+ * A class for using a variable cache such as apc or mechached.
+ * In the first version only some functions from apc are provided.
+ */
+class Cache {
+ var $cacheType;
+ var $isActive; # boolean
+
+ /**
+ * @constructor
+ * @param String url the URL that will be loaded (optional)
+ */
+ public function __construct() {
+ $this->isActive = false;
+ if (DEFINED("MAPBENDER_VARIABLE_CACHE") && MAPBENDER_VARIABLE_CACHE) {
+ if (DEFINED("MAPBENDER_CACHE_TYPE") && MAPBENDER_CACHE_TYPE != "") {
+ $this->cacheType = MAPBENDER_CACHE_TYPE;
+ switch ($this->cacheType) {
+ case 'apc':
+ $this->isActive = true;
+ break;
+ }
+ }
+ }
+ }
+
+ final public function cachedVariableFetch($key) {
+ switch ($this->cacheType) {
+ case "apc":
+ return apc_fetch($key);
+ break;
+ default:
+ return false;
+ break;
+ }
+ }
+
+ final public function cachedVariableExists($key) {
+ switch ($this->cacheType) {
+ case "apc":
+ return apc_exists($key);
+ break;
+ default:
+ return false;
+ break;
+ }
+ }
+
+ final public function cachedVariableAdd($key, $value) {
+ switch ($this->cacheType) {
+ case "apc":
+ return apc_add($key, $value);
+ break;
+ default:
+ return false;
+ break;
+ }
+ }
+
+
+}
+?>
Modified: trunk/mapbender/http/classes/class_gui.php
===================================================================
--- trunk/mapbender/http/classes/class_gui.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/classes/class_gui.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -20,6 +20,7 @@
require_once(dirname(__FILE__)."/../../core/globalSettings.php");
require_once(dirname(__FILE__)."/../classes/class_element.php");
require_once(dirname(__FILE__)."/../classes/class_RPCEndpoint.php");
+require_once(dirname(__FILE__)."/../classes/class_cache.php");
/**
* GUI is a set of GUI elements and services.
@@ -255,23 +256,38 @@
}
public function selectElements () {
- $sql = "SELECT e_id FROM gui_element WHERE fkey_gui_id = $1 " .
+ //cache this!
+ //instantiate cache if available
+ $cache = new Cache();
+ //define key name cache
+ $cacheKeyElements = 'guiElements_'.$this->id;
+ /*if ($cache->isActive && $cache->cachedVariableExists($cacheKeyElements)) {
+ $e = new mb_exception("classes/class_gui.php: read gui elements from ".$cache->cacheType." cache!");
+ return $cache->cachedVariableFetch($cacheKeyElements);
+
+ } else {*/
+ $sql = "SELECT e_id FROM gui_element WHERE fkey_gui_id = $1 " .
"ORDER BY e_pos";
- $v = array($this->id);
- $t = array('s');
- $res = db_prep_query($sql,$v,$t);
- $elementArray = array();
- while ($row = db_fetch_array($res)) {
- array_push($elementArray, $row[0]);
- }
+ $v = array($this->id);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ $elementArray = array();
+ while ($row = db_fetch_array($res)) {
+ array_push($elementArray, $row[0]);
+ }
- $this->elementArray = array();
- for ($i = 0; $i < count($elementArray); $i++) {
- $currentElement = new Element();
- $currentElement->select($elementArray[$i], $this->id);
- array_push($this->elementArray, $currentElement);
- }
- return $this->elementArray;
+ $this->elementArray = array();
+ for ($i = 0; $i < count($elementArray); $i++) {
+ $currentElement = new Element();
+ $currentElement->select($elementArray[$i], $this->id);
+ array_push($this->elementArray, $currentElement);
+ }
+ //cache elementArray
+ /*if ($cache->isActive) {
+ $cache->cachedVariableAdd($cacheKeyElements,$this->elementArray);
+ }*/
+ return $this->elementArray;
+ //}
}
public function toHtml () {
Modified: trunk/mapbender/http/classes/class_map.php
===================================================================
--- trunk/mapbender/http/classes/class_map.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/classes/class_map.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -1,5 +1,6 @@
<?php
require_once(dirname(__FILE__)."/../classes/class_bbox.php");
+require_once(dirname(__FILE__)."/../classes/class_cache.php");
/**
* Representing a map object, identical to the JS object in javascripts/map.js
* @class
@@ -683,103 +684,138 @@
// ------------------------------------------------------------------------
private static function selectByApplication ($appId, $frameName) {
- // find the mapframe in the application elements...
- $sql = "SELECT * FROM gui_element WHERE fkey_gui_id = $1 AND " .
- "e_id = $2 AND e_public = 1 LIMIT 1";
- $v = array($appId, $frameName);
- $t = array('s', 's');
+ //cache only, when cache is explicitly demanded by element var!
+ //check if element var for caching gui is set to true!
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_gui_id = $1 AND fkey_e_id = 'body' AND var_name='cacheGuiHtml'";
+ $v = array($appId);
+ $t = array('s');
$res = db_prep_query($sql,$v,$t);
$row = db_fetch_array($res);
- // if found...
- if ($row) {
- $currentMap = new Map();
+ if (count($row['var_name']) == 1) {
+ $activatedGuiHtmlCache = $row['var_value'];
+ if ($activatedGuiHtmlCache == 'true') {
+ $activatedGuiHtmlCache = true;
+ } else {
+ $activatedGuiHtmlCache = false;
+ }
+ } else {
+ $activatedGuiHtmlCache = false;
+ }
+ //instantiate cache if available
+ $cache = new Cache();
+ //define key name cache
+ $mapByAppKey = 'mapApp_'.$appId.'_'.$frameName;
+ if ($cache->isActive && $activatedGuiHtmlCache && $cache->cachedVariableExists($mapByAppKey)) {
+ $e = new mb_exception("class_map.php: read ".$mapByAppKey." from ".$cache->cacheType." cache!");
+ return $cache->cachedVariableFetch($mapByAppKey);
+ } else {
+ // find the mapframe in the application elements...
+ $sql = "SELECT * FROM gui_element WHERE fkey_gui_id = $1 AND " .
+ "e_id = $2 AND e_public = 1 LIMIT 1";
+ $v = array($appId, $frameName);
+ $t = array('s', 's');
+ $res = db_prep_query($sql,$v,$t);
+ $row = db_fetch_array($res);
+
+ // if found...
+ if ($row) {
+ $currentMap = new Map();
- // use settings from database
- $currentMap->setWidth($row["e_width"]);
- $currentMap->setHeight($row["e_height"]);
- $currentMap->setFrameName($row["e_id"]);
-
- // get the WMS
- $wmsArray = wms::selectMyWmsByApplication($appId);
-
-// $e = new mb_notice("WMS in this map: " . implode(",", $wmsArray));
-
- // if this is the overview, find the WMS index and
- // reset the WMS array
- // BEWARE, SUPER UGLY CODE AHEAD!!
- // (BUT THERE IS NO OTHER WAY TO DO IT)
- if (strpos($row["e_js_file"], "mb_overview.js") !== false) {
-// $e = new mb_exception("guess this is the OV");
+ // use settings from database
+ $currentMap->setWidth($row["e_width"]);
+ $currentMap->setHeight($row["e_height"]);
+ $currentMap->setFrameName($row["e_id"]);
+
+ // get the WMS
+ $wmsArray = wms::selectMyWmsByApplication($appId);
+
+// $e = new mb_notice("WMS in this map: " . implode(",", $wmsArray));
+
+ // if this is the overview, find the WMS index and
+ // reset the WMS array
+ // BEWARE, SUPER UGLY CODE AHEAD!!
+ // (BUT THERE IS NO OTHER WAY TO DO IT)
+ if (strpos($row["e_js_file"], "mb_overview.js") !== false) {
+// $e = new mb_exception("guess this is the OV");
- $ov_sql = "SELECT var_value FROM gui_element_vars WHERE " .
- "var_name = 'overview_wms' AND fkey_e_id = $1 AND " .
- "fkey_gui_id = $2";
- $ov_v = array($frameName, $appId);
- $ov_t = array('s', 's');
- $ov_res = db_prep_query($ov_sql, $ov_v, $ov_t);
- $ov_row = db_fetch_array($ov_res);
- if ($ov_row) {
- $ovIndex = intval($ov_row["var_value"]);
- }
+ $ov_sql = "SELECT var_value FROM gui_element_vars WHERE " .
+ "var_name = 'overview_wms' AND fkey_e_id = $1 AND " .
+ "fkey_gui_id = $2";
+ $ov_v = array($frameName, $appId);
+ $ov_t = array('s', 's');
+ $ov_res = db_prep_query($ov_sql, $ov_v, $ov_t);
+ $ov_row = db_fetch_array($ov_res);
+ if ($ov_row) {
+ $ovIndex = intval($ov_row["var_value"]);
+ }
-// $e = new mb_exception("OV index: " . $ovIndex);
- if (!isset($ovIndex)) {
- $ovIndex = 0;
- }
- $wmsArray = array($wmsArray[$ovIndex]);
+// $e = new mb_exception("OV index: " . $ovIndex);
+ if (!isset($ovIndex)) {
+ $ovIndex = 0;
+ }
+ $wmsArray = array($wmsArray[$ovIndex]);
- $sql = "SELECT * from gui_wms JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON ";
- $sql .= "gui_wms.fkey_wms_id = wms.wms_id AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_id = $1 ORDER BY gui_wms_position";
- $v = array ($appId);
- $t = array ('s');
- $res = db_prep_query($sql, $v, $t);
- $count_wms = -1;
+ $sql = "SELECT * from gui_wms JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON ";
+ $sql .= "gui_wms.fkey_wms_id = wms.wms_id AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_id = $1 ORDER BY gui_wms_position";
+ $v = array ($appId);
+ $t = array ('s');
+ $res = db_prep_query($sql, $v, $t);
+ $count_wms = -1;
- while ($row = db_fetch_array($res)) {
- $count_wms++;
- }
+ while ($row = db_fetch_array($res)) {
+ $count_wms++;
+ }
- if($ovIndex > $count_wms) {
- $e = new mb_exception("class_map.php: selectByApplication : OverviewIndex (set in overview element var 'overview_wms')does not exist!");
- return null;
- }
-// $e = new mb_notice("WMS in this map (corrected): " . implode(",", $wmsArray));
- }
- else {
-// $e = new mb_exception("guess this is NOT the OV");
- }
+ if($ovIndex > $count_wms) {
+ $e = new mb_exception("class_map.php: selectByApplication : OverviewIndex (set in overview element var 'overview_wms')does not exist!");
+ if ($cache->isActive) {
+ $cache->cachedVariableAdd($mapByAppKey,null);
+ }
+ return null;
+ }
+// $e = new mb_notice("WMS in this map (corrected): " . implode(",", $wmsArray));
+ }
+ else {
+// $e = new mb_exception("guess this is NOT the OV");
+ }
- $currentMap->wmsArray = $wmsArray;
+ $currentMap->wmsArray = $wmsArray;
- // EXTENT
- $sql = "SELECT gui_wms_epsg FROM gui_wms WHERE gui_wms_position = 0 AND fkey_gui_id = $1";
- $v = array($appId);
- $t = array('s');
- $res = db_prep_query($sql, $v, $t);
- $row = db_fetch_array($res);
- $epsg = $row["gui_wms_epsg"];
- $layer_epsg = $wmsArray[0]->objLayer[0]->layer_epsg;
- $j = 0;
- for ($i = 0; $i < count($layer_epsg); $i++) {
- if ($layer_epsg[$i]["epsg"] === $epsg) {
- $j = $i;
- break;
+ // EXTENT
+ $sql = "SELECT gui_wms_epsg FROM gui_wms WHERE gui_wms_position = 0 AND fkey_gui_id = $1";
+ $v = array($appId);
+ $t = array('s');
+ $res = db_prep_query($sql, $v, $t);
+ $row = db_fetch_array($res);
+ $epsg = $row["gui_wms_epsg"];
+ $layer_epsg = $wmsArray[0]->objLayer[0]->layer_epsg;
+ $j = 0;
+ for ($i = 0; $i < count($layer_epsg); $i++) {
+ if ($layer_epsg[$i]["epsg"] === $epsg) {
+ $j = $i;
+ break;
+ }
}
+ $minx = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["minx"];
+ $miny = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["miny"];
+ $maxx = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["maxx"];
+ $maxy = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["maxy"];
+ $epsg = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["epsg"];
+ $mapExtent = new Mapbender_bbox($minx, $miny, $maxx, $maxy, $epsg);
+ $currentMap->setExtent($mapExtent);
+ if ($cache->isActive) {
+ $cache->cachedVariableAdd($mapByAppKey,$currentMap);
+ }
+ return $currentMap;
}
- $minx = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["minx"];
- $miny = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["miny"];
- $maxx = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["maxx"];
- $maxy = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["maxy"];
- $epsg = $wmsArray[0]->objLayer[0]->layer_epsg[$j]["epsg"];
- $mapExtent = new Mapbender_bbox($minx, $miny, $maxx, $maxy, $epsg);
-
- $currentMap->setExtent($mapExtent);
- return $currentMap;
+ else {
+ if ($cache->isActive) {
+ $cache->cachedVariableAdd($mapByAppKey,null);
+ }
+ return null;
+ }
}
- else {
- return null;
- }
}
Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/classes/class_metadata_new.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -238,8 +238,8 @@
$this->databaseIdColumnName = 'layer_id';
$this->databaseTableName = 'layer';
//$this->keywordRelation = 'layer_keyword';
- $this->searchView = 'wms_search_table';
- //$this->searchView = 'search_wms_view';
+ //$this->searchView = 'wms_search_table';
+ $this->searchView = 'search_wms_view';
$this->whereStrCatExtension = " AND custom_category.custom_category_hidden = 0";
switch ($this->orderBy) {
case "rank":
@@ -1573,7 +1573,11 @@
if (count($queryArray) == 1){
//remove request parameter from url by regexpr or replace
$str2search = $paramName."=".$queryList;
- $str2exchange = "";
+ if ($paramName == "searchText") {
+ $str2exchange = "searchText=*&";
+ } else {
+ $str2exchange = "";
+ }
$queryStringNew = str_replace($str2search, $str2exchange, $queryString);
$queryStringNew = str_replace("&&", "&", $queryStringNew);
} else {
@@ -1593,8 +1597,6 @@
return $queryStringNew;
}
-
-
private function getValueForParam($paramName,$queryString) {
#another approach:
parse_str($queryString, $allQueries);
@@ -1675,8 +1677,14 @@
// function to delete one GET parameter totally from a query url
private function delTotalFromQuery($paramName,$queryString) {
$queryString = "&".$queryString;
+ //only delete totally if not searchText itself
+ if ($paramName == "searchText") {
+ $str2exchange = "searchText=*&";
+ } else {
+ $str2exchange = "";
+ }
#echo "<br>queryString: ".$queryString."<br>";
- $queryStringNew = preg_replace('/\b'.$paramName.'\=[^&]+&?/',"",$queryString);
+ $queryStringNew = preg_replace('/\b'.$paramName.'\=[^&]+&?/',$str2exchange,$queryString);
$queryStringNew = ltrim($queryStringNew,'&');
$queryStringNew = rtrim($queryStringNew,'&');
return $queryStringNew;
Modified: trunk/mapbender/http/classes/class_wmc_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc_factory.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/classes/class_wmc_factory.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -50,4 +50,4 @@
}
}
-?>
\ No newline at end of file
+?>
Modified: trunk/mapbender/http/extensions/mobilemap/js/dev/5_ngms_jq.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/js/dev/5_ngms_jq.js 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/extensions/mobilemap/js/dev/5_ngms_jq.js 2013-07-30 12:34:32 UTC (rev 8677)
@@ -74,24 +74,17 @@
map.zoomOut();
});
- //Popup für erweitertes Popup-Menü initialisieren und öffnen
- $("#popupMenu").popup();
+ //Nachrichtenfenster schließen
+ $("#xheader").click(function(){
+ $('#markerhint').css('visibility','hidden');
+ vector_marker.removeAllFeatures();
+ });
- $("#menubut").click(function(){
- $("#popupMenu").popup( "open" );
- });
-
//Nachrichtenfenster schließen
- $("#xheader").click(function(){
- $('#markerhint').css('visibility','hidden');
- vector_marker.removeAllFeatures();
- });
-
- //Nachrichtenfenster schließen
$("#mheader").click(function(){
- $('#measurehint').css('visibility','hidden');
+ $('#measurehint').css('visibility','hidden');
toggleMeasure('off');
- });
+ });
//Suchbutton
$('#searchformbut').click(function() {
@@ -99,7 +92,7 @@
});
//Suchfeld
- $(document).on('keypress', '#searchfield', function(e) {
+ $(document).on('keydown', '#searchfield', function(e) {
if(e.keyCode === 13){
searchCall();
}
Modified: trunk/mapbender/http/extensions/mobilemap/map.php
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/map.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/extensions/mobilemap/map.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -130,7 +130,7 @@
<div data-role="content">
<div id="logo"><a href="map.php?lang=<?php echo $mylang; ?>" target="_self"><img src="img/logo.png" ></a></div>
<div id="map"></div>
-
+ <div id="gpsinfo"></div>
<div id="navbutgroup">
<div id="ovbut" class="navbuttons" style="margin-top:2px"></div>
<div id="zoominbut" class="navbuttons" style="margin-top:2px"></div>
Modified: trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search_proxy.php
===================================================================
--- trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search_proxy.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/extensions/mobilemap/mod_mapbender/search_proxy.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -9,7 +9,9 @@
//$mapbenderurl = "http://www.geoportal.rlp.de/mapbender/php/mod_callMetadata.php?";
//Url-Parameter
$urlparam = $_SERVER['QUERY_STRING'];
-$url = $mapbenderurl.$urlparam ;
+$url = $mapbenderurl.$urlparam;
+$url = str_replace(" ",",",$url);
+$url = str_replace("%20",",",$url);
//angefragtes Format GetMap
if ((isset($_GET['FORMAT'])) && ($_GET['FORMAT'] != "")) {
$myformat = $_GET["FORMAT"];
Modified: trunk/mapbender/http/frames/index.php
===================================================================
--- trunk/mapbender/http/frames/index.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/frames/index.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -20,6 +20,7 @@
require_once("../php/mb_validateSession.php");
require_once(dirname(__FILE__)."/../classes/class_gui.php");
+require_once(dirname(__FILE__)."/../classes/class_cache.php");
//new for geoportal.rlp - some guis has special functions - for normal mapbender installation this doesn't matter
if (Mapbender::session()->get("mb_user_gui") !== false) {
@@ -56,35 +57,77 @@
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title><?php echo $gui_id;?> - presented by Mapbender</title>
<?php
- $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = 'body' AND fkey_gui_id = $1 and var_name='favicon' ORDER BY var_name";
+ //check if element var for caching gui is set to true!
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_gui_id = $1 AND fkey_e_id = 'body' AND var_name='cacheGuiHtml'";
$v = array($gui_id);
$t = array('s');
$res = db_prep_query($sql,$v,$t);
+ $row = db_fetch_array($res);
+ //$e = new mb_notice("count row: ".count($row['var_name']));
+ if (count($row['var_name']) == 1) {
+ $activatedGuiHtmlCache = $row['var_value'];
+ if ($activatedGuiHtmlCache == 'true') {
+ $activatedGuiHtmlCache = true;
+ } else {
+ $activatedGuiHtmlCache = false;
+ }
+ } else {
+ $activatedGuiHtmlCache = false;
+ }
+ //use cache is cache is activated
+ //instantiate cache if available
+ $cache = new Cache();
+ //define key name cache
+ $cacheKeyElementVars = 'guiElementVars_'.$gui_id;
+ /*if ($cache->isActive && $cache->cachedVariableExists($cacheKeyElementVars)) {
+ $e = new mb_exception("frames/index.php: read elementVars from ".$cache->cacheType." cache!");
+ $res = $cache->cachedVariableFetch($cacheKeyElementVars);
+ } else {*/
+ //do sql instead
+ $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = 'body' AND fkey_gui_id = $1 and var_name='favicon' ORDER BY var_name";
+ $v = array($gui_id);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ /*if ($cache->isActive) {
+ $cache->cachedVariableAdd($cacheKeyElementVars,$res);
+ }*/
+ //}//uncomment for cache
$cnt = 0;
while($row = db_fetch_array($res)){
echo "<link rel=\"shortcut icon\" type=\"image/png\" href=\"".$row["var_value"]."\">\n";
}
?>
<?php
- // reset CSS
+ //reset CSS
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/reset.css\">\n";
+ //define new key name cache
+ $cacheKeyGuiCss = 'guiCss_'.$gui_id;
+ /*if ($cache->isActive && $cache->cachedVariableExists($cacheKeyGuiCss)) {
+ $e = new mb_exception("frames/index.php: read guiCss from ".$cache->cacheType." cache!");
+ $res = $cache->cachedVariableFetch($cacheKeyGuiCss);
+ } else {*/
- $sql = <<<SQL
+ $sql = <<<SQL
+
SELECT DISTINCT e_id, e_element, var_value, var_name, var_type FROM gui_element, gui_element_vars
WHERE
- e_id = fkey_e_id
- AND e_element <> 'iframe'
- AND gui_element.fkey_gui_id = $1
- AND gui_element_vars.fkey_gui_id = $1
- AND var_type='file/css'
-ORDER BY var_name
+ e_id = fkey_e_id
+ AND e_element <> 'iframe'
+ AND gui_element.fkey_gui_id = $1
+ AND gui_element_vars.fkey_gui_id = $1
+ AND var_type='file/css'
+ ORDER BY var_name
SQL;
- $v = array($gui_id);
- $t = array('s');
- $res = db_prep_query($sql,$v,$t);
+ $v = array($gui_id);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ /*if ($cache->isActive) {
+ $cache->cachedVariableAdd($cacheKeyGuiCss,$res);
+ }*/
+ //}//for cache
$cnt = 0;
while($row = db_fetch_array($res)){
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$row["var_value"]."\">\n";
@@ -122,9 +165,20 @@
if (defined(LOAD_JQUERY_FROM_GOOGLE) && LOAD_JQUERY_FROM_GOOGLE) {
echo "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>";
}
- $currentApplication = new gui($gui_id);
- echo $currentApplication->toHtml();
-
+ //cache complete application ;-)
+ $cacheKeyGuiHtml = 'guiHtml_'.$gui_id;
+ //$e = new mb_notice("frames/index.php: activatedGuiHtmlCache: ". $activatedGuiHtmlCache);
+ if ($cache->isActive && $activatedGuiHtmlCache && $cache->cachedVariableExists($cacheKeyGuiHtml)) {
+ //$e = new mb_notice("frames/index.php: read gui html from ".$cache->cacheType." cache!");
+ echo $cache->cachedVariableFetch($cacheKeyGuiHtml);
+ } else {
+ $currentApplication = new gui($gui_id);
+ $guiHtml = $currentApplication->toHtml();
+ if ($cache->isActive) {
+ $cache->cachedVariableAdd($cacheKeyGuiHtml,$guiHtml);
+ }
+ echo $guiHtml;
+ }
$mapPhpParameters = htmlentities($urlParameters, ENT_QUOTES, CHARSET);
$mapPhpParameters .= "&".htmlentities($_SERVER["QUERY_STRING"]);
Modified: trunk/mapbender/http/geoportal/mod_initialStartWmc.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_initialStartWmc.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/geoportal/mod_initialStartWmc.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -1,7 +1,7 @@
<?php
require_once(dirname(__FILE__)."/../../core/globalSettings.php");
require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once dirname(__FILE__) . "/../classes/class_Uuid.php";
+//require_once dirname(__FILE__) . "/../classes/class_Uuid.php";
require_once dirname(__FILE__) . "/../extensions/phpqrcode/phpqrcode.php";
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
@@ -107,7 +107,7 @@
$initialWmc = array();
$i = 0;
while($row = db_fetch_array($res)){
- $mobileUrl = $row['wmc_serial_id'];
+ //$mobileUrl = $row['wmc_serial_id'];
//$uuid = new Uuid;
$filename = "qr_wmc_".$row['wmc_serial_id'].".png";
//generate qr on the fly in tmp folder if not already exists
Modified: trunk/mapbender/http/php/mod_callMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callMetadata.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/php/mod_callMetadata.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -710,7 +710,8 @@
if ($classificationElements[$i]['name'] != 'searchText') {
$queryJSON->searchFilter->{$classificationElements[$i]['name']}->delLink = delTotalFromQuery($classificationElements[$i]['name'],$searchURL);
} else {
- $queryJSON->searchFilter->{$classificationElements[$i]['name']}->delLink = NULL;
+ //$queryJSON->searchFilter->{$classificationElements[$i]['name']}->delLink = NULL;
+ $queryJSON->searchFilter->{$classificationElements[$i]['name']}->delLink = delTotalFromQuery($classificationElements[$i]['name'],$searchURL);
}
$queryJSON->searchFilter->{$classificationElements[$i]['name']}->item = array();
$queryArray = explode(',',${$classificationElements[$i]['name']});
@@ -731,7 +732,10 @@
}
//generate links to disable filters on a simple way
if ($classificationElements[$i]['name'] === 'searchText' & count(explode(',',${$classificationElements[$i]['name']})) === 1) {
- $queryJSON->searchFilter->{$classificationElements[$i]['name']}->item[$j]->delLink = NULL;
+ //$queryJSON->searchFilter->{$classificationElements[$i]['name']}->item[$j]->delLink = NULL;
+ $newSearchLink = delFromQuery($classificationElements[$i]['name'], $searchURL,$queryArray[$j],$queryArray,${$classificationElements[$i]['name']});
+ $newSearchLink = delTotalFromQuery('searchId',$newSearchLink);
+ $queryJSON->searchFilter->{$classificationElements[$i]['name']}->item[$j]->delLink = $newSearchLink;
} else {
$newSearchLink = delFromQuery($classificationElements[$i]['name'], $searchURL,$queryArray[$j],$queryArray,${$classificationElements[$i]['name']});
$newSearchLink = delTotalFromQuery('searchId',$newSearchLink);
@@ -892,7 +896,11 @@
if (count($queryArray) == 1){
//remove request parameter from url by regexpr or replace
$str2search = $paramName."=".$queryList;
- $str2exchange = "";
+ if ($paramName == "searchText") {
+ $str2exchange = "searchText=*&";
+ } else {
+ $str2exchange = "";
+ }
$queryStringNew = str_replace($str2search, $str2exchange, $queryString);
$queryStringNew = str_replace("&&", "&", $queryStringNew);
} else {
@@ -918,7 +926,12 @@
function delTotalFromQuery($paramName,$queryString) {
//echo $paramName ."<br>";
$queryString = "&".$queryString;
- $queryStringNew = preg_replace('/\b'.$paramName.'\=[^&]*&?/',"",$queryString); //TODO find empty get params
+ if ($paramName == "searchText") {
+ $str2exchange = "searchText=*&";
+ } else {
+ $str2exchange = "";
+ }
+ $queryStringNew = preg_replace('/\b'.$paramName.'\=[^&]*&?/',$str2exchange,$queryString); //TODO find empty get params
$queryStringNew = ltrim($queryStringNew,'&');
$queryStringNew = rtrim($queryStringNew,'&');
return $queryStringNew;
Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -353,7 +353,7 @@
$language ->appendChild($languagecode);
$language = $MD_Metadata->appendChild($language);
- //generate Characterset
+ //generate Characterset TODO: alter this to utf8 and add new element to data identification
$characterSet = $iso19139->createElement("gmd:characterSet");
$characterSetCode = $iso19139->createElement("gmd:MD_CharacterSetCode");
$characterSetCode->setAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_CharacterSetCode");
Modified: trunk/mapbender/http/php/mod_wmc2ol.php
===================================================================
--- trunk/mapbender/http/php/mod_wmc2ol.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/php/mod_wmc2ol.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -240,7 +240,13 @@
//initialize markers
$html.="var markers = new OpenLayers.Layer.Markers(\"Markers\", {'calculateInRange': function() { return true; }});\n";
//initialize logo
- $html.="var logo = \"<a href = 'http://www.mapbender.org' target='_blank'><img src='../img/Mapbender_logo_and_text.png' height='20' width='120' alt='Mapbender Logo'/></a><br><a href = 'mod_getWmcDisclaimer.php?&id=".$wmcId."&languageCode=de&hostName=".$hostName."' target='_blank'>"._mb('Terms of use')."</a>\";\n";
+ if(isset($_REQUEST["withoutLogo"])){
+ if($_REQUEST["withoutLogo"]=='1'){
+ $html.="var logo = \"<a href = 'mod_getWmcDisclaimer.php?&id=".$wmcId."&languageCode=de&hostName=".$hostName."' target='_blank'>"._mb('Terms of use')."</a>\";\n";
+ }
+ } else {
+ $html.="var logo = \"<a href = 'http://www.mapbender.org' target='_blank'><img src='../img/Mapbender_logo_and_text.png' height='20' width='120' alt='Mapbender Logo'/></a><br><a href = 'mod_getWmcDisclaimer.php?&id=".$wmcId."&languageCode=de&hostName=".$hostName."' target='_blank'>"._mb('Terms of use')."</a>\";\n";
+ }
//$html.="var logo = \"<a href = 'http://www.geoportal.rlp.de' target='_blank'><img src='../img/logo_geoportal_neu.png' height='20' width='120' alt='Geoportal Logo'/></a><br><a href = 'mod_getWmcDisclaimer.php?&id=".$wmcId."&languageCode=de&hostName=".$hostName."' target='_blank'>"._mb('Terms of use')."</a>\";\n";
//check for some queryable layer in web map context document
$someLayerQueryable=false;
Modified: trunk/mapbender/http/php/wms.php
===================================================================
--- trunk/mapbender/http/php/wms.php 2013-07-24 08:49:26 UTC (rev 8676)
+++ trunk/mapbender/http/php/wms.php 2013-07-30 12:34:32 UTC (rev 8677)
@@ -1003,7 +1003,7 @@
$parent = $parentLayerArray[$sub_layer_row['layer_parent']];
$e = new mb_notice("wms.php: type of parent:".gettype($parent));
if (gettype($parent) == "NULL") {
- $e = new mb_exception("wms.php: layer_parent not found in parent array - root layer info will be used!");
+ $e = new mb_notice("wms.php: layer_parent not found in parent array - root layer info will be used!");
$parent = $parentLayerArray[0];
}
$sub_layer = $parent->appendChild($sub_layer);
More information about the Mapbender_commits
mailing list