[Mapbender-commits] r7318 - in trunk/mapbender/http: javascripts php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Dec 16 06:40:51 EST 2010
Author: armin11
Date: 2010-12-16 03:40:51 -0800 (Thu, 16 Dec 2010)
New Revision: 7318
Modified:
trunk/mapbender/http/javascripts/map.php
trunk/mapbender/http/javascripts/mod_loadwmc.js
trunk/mapbender/http/php/mod_wmc2ol.php
Log:
New possibility to get url of openlayers client aut ouf the load wmc table.
Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php 2010-12-16 11:12:51 UTC (rev 7317)
+++ trunk/mapbender/http/javascripts/map.php 2010-12-16 11:40:51 UTC (rev 7318)
@@ -38,6 +38,12 @@
echo "Mapbender.sessionName = '".session_name()."';\n";
echo "var mb_session_name = Mapbender.sessionName;\n";
echo "Mapbender.loginUrl = '".Mapbender::session()->get("mb_login")."';\n";
+if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
+ echo "Mapbender.baseUrl = 'https://".$_SERVER['HTTP_HOST']."';\n";
+ }
+ else {
+ echo "Mapbender.baseUrl = 'http://".$_SERVER['HTTP_HOST']."';\n";
+}
echo "Mapbender.userId = '".Mapbender::session()->get("mb_user_id")."';\n";
echo "var mb_myLogin = Mapbender.loginUrl;\n";
echo "var mb_styleID = '".md5(Mapbender::session()->get("mb_user_name"))."';\n";
Modified: trunk/mapbender/http/javascripts/mod_loadwmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_loadwmc.js 2010-12-16 11:12:51 UTC (rev 7317)
+++ trunk/mapbender/http/javascripts/mod_loadwmc.js 2010-12-16 11:40:51 UTC (rev 7318)
@@ -9,6 +9,7 @@
options.publishWmc = typeof options.publishWmc === "number" ? options.publishWmc : 0;
options.showWmc = typeof options.showWmc === "number" ? options.showWmc : 1;
options.openLayers = typeof options.openLayers === "number" ? options.openLayers : 1;
+options.openLayersUrl = typeof options.openLayersUrl === "number" ? options.openLayersUrl : 1;
options.deleteWmc = typeof options.deleteWmc === "number" ? options.deleteWmc : 1;
options.uploadWmc = typeof options.uploadWmc === "number" ? options.uploadWmc : 1;
options.listWmc = typeof options.listWmc === "number" ? options.listWmc : 1;
@@ -38,6 +39,7 @@
"labelDelete": "delete",
"labelEditWmc": "edit",
"labelOpenLayers": "OpenLayers",
+ "labelOpenLayersUrl": "Link",
"labelCurrentState": "currentState",
"labelDeleteWmc": "delete this WMC",
"confirmDelete": "Do you really want to delete WMC '%s'?",
@@ -64,6 +66,7 @@
var $wmcPopup = null;
var $wmcDisplayPopup = null;
var $wmcOpenLayersPopup = null;
+ var $wmcOpenLayersUrlPopup = null;
var wmcPopupHtml = null;
var wmcListTableInitialized = false;
@@ -98,6 +101,11 @@
title: translatedI18nObject.labelOpenLayersExport
};
+ var OPENLAYERSURL_WMC_OPTIONS = {
+ src: "../img/url.png",
+ title: translatedI18nObject.labelOpenLayersUrl
+ };
+
var DELETE_WMC_OPTIONS = {
src: "../img/button_gray/del_disabled.png",
title: translatedI18nObject.labelDeleteWmc,
@@ -188,7 +196,7 @@
this.showOpenLayers = function (id) {
this.hideOpenLayers();
var url = "../php/mod_wmc2ol.php?wmc_id=" + id + "&" + mb_session_name + "=" + mb_nr;
- var $wmcOpenLayersPopup = $('<div class="wmcOpenLayersPopup"><iframe style="width:99%;height:99%;" src="' + url + '"></iframe></div>');
+ var $wmcOpenLayersPopup = $('<div class="wmcOpenLayersPopup"><iframe style="width:99%;height:99%;" src="' + url + '" frameborder="0"></iframe></div>');
$wmcOpenLayersPopup.dialog({
title: translatedI18nObject.labelOpenLayers,
bgiframe: true,
@@ -205,7 +213,28 @@
$('.wmcOpenLayersPopup').dialog('destroy');
}
};
+ //following is added to give a window with an interated link which can be included in external applications
+ this.showOpenLayersUrl = function (id) {
+ this.hideOpenLayersUrl();
+ var url = "/mapbender/php/mod_wmc2ol.php?wmc_id=" + id ;
+ var $wmcOpenLayersUrlPopup = $('<div><input size="35" type="text" value="' + Mapbender.baseUrl + url + '"/></div>');
+ $wmcOpenLayersUrlPopup.dialog({
+ title: translatedI18nObject.labelOpenLayersUrl,
+ bgiframe: true,
+ autoOpen: true,
+ modal: false,
+ width: 350,
+ height: 90,
+ pos: [600,40]
+ });
+ };
+ this.hideOpenLayersUrl = function () {
+ if($('.wmcOpenLayersUrlPopup').size() > 0) {
+ $('.wmcOpenLayersUrlPopup').dialog('destroy');
+ }
+ };
+ //end of the link-handle popup
this.refreshList = function () {
var req = new Mapbender.Ajax.Request({
url: serverSideFileName,
@@ -278,6 +307,7 @@
(options.publishWmc ? "<th>" + t.labelPublic + "</td>" : "") +
(options.showWmc ? "<th>" + t.labelShow + "</td>" : "") +
(options.openLayers ? "<th>" + t.labelOpenLayers + "</td>" : "") +
+ (options.openLayersUrl ? "<th>" + t.labelOpenLayersUrl + "</td>" : "") +
(options.editWmc ? "<th>" + t.labelEditWmc + "</td>" : "") +
(options.deleteWmc ? "<th>" + t.labelDelete + "</td>" : "") +
"</tr></thead></table>";
@@ -464,6 +494,14 @@
}
);
};
+
+ var createOpenLayersUrlWmcCell = function (wmc) {
+ return createTableCell(
+ OPENLAYERSURL_WMC_OPTIONS, function(){
+ that.showOpenLayersUrl(wmc.id);
+ }
+ );
+ };
var createDisplayWmcCell = function (wmc) {
return createTableCell(
@@ -575,6 +613,9 @@
if (options.openLayers) {
$tr.append(createOpenLayersWmcCell(currentWmc));
}
+ if (options.openLayersUrl) {
+ $tr.append(createOpenLayersUrlWmcCell(currentWmc));
+ }
if (options.editWmc) {
$tr.append(createEditWmcCell(currentWmc));
}
@@ -759,4 +800,4 @@
*/
};
-$loadWmc.mapbender(new LoadWmcApi());
\ No newline at end of file
+$loadWmc.mapbender(new LoadWmcApi());
Modified: trunk/mapbender/http/php/mod_wmc2ol.php
===================================================================
--- trunk/mapbender/http/php/mod_wmc2ol.php 2010-12-16 11:12:51 UTC (rev 7317)
+++ trunk/mapbender/http/php/mod_wmc2ol.php 2010-12-16 11:40:51 UTC (rev 7318)
@@ -301,6 +301,10 @@
//Check for numerical values for BBOX
$array_bbox=explode(',',$_REQUEST["mb_myBBOX"]);
if ((is_numeric($array_bbox[0])) and (is_numeric($array_bbox[1])) and (is_numeric($array_bbox[2])) and (is_numeric($array_bbox[3])) ) {
+ $minx_new=$array_bbox[0];
+ $miny_new=$array_bbox[1];
+ $maxx_new=$array_bbox[2];
+ $maxy_new=$array_bbox[3];
if(isset($_REQUEST["mb_myBBOXEpsg"])){
//Check epsg
$targetEpsg=intval($_REQUEST["mb_myBBOXEpsg"]);
@@ -339,10 +343,10 @@
else
{
//Set the new BBOX unaltered
- $minx=$array_bbox[0];
- $miny=$array_bbox[1];
- $maxx=$array_bbox[2];
- $maxy=$array_bbox[3];
+ $minx_new=$array_bbox[0];
+ $miny_new=$array_bbox[1];
+ $maxx_new=$array_bbox[2];
+ $maxy_new=$array_bbox[3];
}
}
}
@@ -611,7 +615,7 @@
$html.=" var point = new OpenLayers.Geometry.Point(";
$html.="".$coords[0].",".$coords[1].");\n";
- $html.=" pointFeatures[".$i."] = new OpenLayers.Feature.Vector(point, {title: \"".$georssXml->entry[$i]->title."\", description : \"".str_replace("\"", "'",$georssXml->entry[$i]->content)."\", link : \"".$georssXml->entry[$i]->id."\"});\n";
+ $html.=" pointFeatures[".$i."] = new OpenLayers.Feature.Vector(point, {title: \"".$georssXml->entry[$i]->title."\", description : \"".str_replace("\"", "'",$georssXml->entry[$i]->content)."\", link : \"".$georssXml->entry[$i]->link."\"});\n";
}
$html.=" return pointFeatures;\n";
$html.="}\n";
@@ -678,7 +682,7 @@
}
}
//*******************************
- //echo "<a href = 'http://www.geoportal.rlp.de' target='_blank'> <img src = '../img/geoportal_rlp.png' title=\"GeoPortal Rheinland-Pfalz\" border=0></a>";
+ //echo "<a href = 'http://www.geoportal.rlp.de' target='_blank'> <img src = '".$_SERVER['HTTP_HOST']."/mapbender/img/geoportal_rlp.png' title=\"GeoPortal Rheinland-Pfalz\" border=0></a>";
$html.="<div id='docs'>\n";
$html.="\n";
$html.="</div>\n";
More information about the Mapbender_commits
mailing list