[Mapbender-commits] r9535 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jul 11 02:12:30 PDT 2016
Author: armin11
Date: 2016-07-11 02:12:29 -0700 (Mon, 11 Jul 2016)
New Revision: 9535
Modified:
trunk/mapbender/http/javascripts/mod_addWMS.php
trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js
Log:
Fix - thanx to karl owesny
Modified: trunk/mapbender/http/javascripts/mod_addWMS.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMS.php 2016-07-10 15:44:09 UTC (rev 9534)
+++ trunk/mapbender/http/javascripts/mod_addWMS.php 2016-07-11 09:12:29 UTC (rev 9535)
@@ -45,6 +45,7 @@
return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900
-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
}
+<<<<<<< .mine
function paramterbuild(url){
if(url.indexOf("?") == -1){
url += '?';
@@ -64,6 +65,51 @@
function mod_addWMS() {
var dialogContainer = $("<form/>")
+ var input = $("<input type='text' name='test' style='margin:5px 0px;width:100%;' placeholder='URL eingeben'/>");
+ var label = "<div>Capabilities - URL:</div>";
+ var submitButton = $("<input type='submit' title='Speichern'/>");
+
+ submitButton.click(function ( event ) {
+ dialogContainer.dialog("close");
+ event.preventDefault();
+ var url = input.val().trim();
+ if (validateUrl(url)) {
+ mod_addWMS_load(paramterbuild(url));
+ } else {
+ input.css({border: '1px solid #FF435C'});
+ //input.addClass()
+ //debugger;
+ dialogContainer.dialog({title: "Es handelt sich nicht um eine URL."});
+ }
+ });
+
+ dialogContainer.append(label);
+ dialogContainer.append(input);
+ dialogContainer.append(submitButton);
+
+ dialogContainer.dialog({title: "WebMapService hinzufügen"});
+}
+
+=======
+function paramterbuild(url){
+ if(url.indexOf("?") == -1){
+ url += '?';
+ }
+ //if (url.indexOf("VERSION=") == -1) {
+ // url += '&VERSION=9.9.9';
+ //}
+ if(url.indexOf("REQUEST=") == -1){
+ url += '&REQUEST=GetCapabilities';
+ }
+ if (url.indexOf("SERVICE=") == -1){
+ url += '&SERVICE=WMS';
+ }
+
+ return url;
+}
+
+function mod_addWMS() {
+ var dialogContainer = $("<form/>")
var input = $("<input type='text' name='test'/>");
var label = "<div>Capabilities - URL:</div>";
var submitButton = $("<input type='submit' title='Speichern'/>");
@@ -89,6 +135,7 @@
dialogContainer.dialog({title: "WebMapService hinzufügen"});
}
+>>>>>>> .r9534
function base64_encode(data) {
// Encodes string using MIME base64 algorithm
//
Modified: trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js 2016-07-10 15:44:09 UTC (rev 9534)
+++ trunk/mapbender/http/javascripts/mod_addWMSgeneralFunctions.js 2016-07-11 09:12:29 UTC (rev 9535)
@@ -102,6 +102,7 @@
return url;
}
var mod_addWms_general = function (js, param) {
+<<<<<<< .mine
var ind = getMapObjIndexByName('mapframe1');
var map = mb_mapObj[ind];
var success = false;
@@ -114,6 +115,73 @@
if (errorcall[0] == "null") {
errorcall[0] = "Fehler";
}
+ var input = $("<input type='text' value='" + errorcall[1] + "' name='test' style='width:100%;margin:5px 0px;'/>");
+ var label = "<div>" + errorcall[0] + "</div>";
+ var submitButton = $("<input type='submit' title='Speichern'/>");
+ submitButton.click(function (event) {
+ dialogContainer.dialog("close");
+ event.preventDefault();
+ var urlError = input.val();
+ if (validateUrl(urlError)) {
+ mod_addWMS_load(paramterbuild(url));
+ } else {
+ input.css({border: '1px solid #FF435C'});
+ dialogContainer.dialog({title: "Es handelt sich nicht um eine URL."});
+ }
+ });
+ dialogContainer.append(label);
+ dialogContainer.append(input);
+ dialogContainer.append(submitButton);
+ dialogContainer.dialog({title: "WebMapService konnte nicht geladen werden"});
+ }
+ var newWmsCount = wms.length;
+ if (newWmsCount > oldWmsCount) {
+ success = true;
+ mb_mapObjaddWMS('mapframe1');
+ var lastwms = map.wms[map.wms.length - 1];
+ if (param && param.options && typeof param.options.zoomToExtent === "number" && param.options.zoomToExtent === 1) {
+ // zoom to bbox
+ var bbox_minx, bbox_miny, bbox_maxx, bbox_maxy;
+ for (var i = 0; i < lastwms.gui_epsg.length; i++) {
+ if (map.epsg == lastwms.gui_epsg[i]) {
+ bbox_minx = parseFloat(lastwms.gui_minx[i]);
+ bbox_miny = parseFloat(lastwms.gui_miny[i]);
+ bbox_maxx = parseFloat(lastwms.gui_maxx[i]);
+ bbox_maxy = parseFloat(lastwms.gui_maxy[i]);
+ if (bbox_minx === null || bbox_miny === null || bbox_maxx === null || bbox_maxy === null) {
+ continue;
+ }
+ map.calculateExtent(new Mapbender.Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy));
+ map.setMapRequest();
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (typeof param === "object"
+ && typeof param.callback === "function"
+ && typeof param.options === "object"
+ ) {
+ param.options.success = success;
+ param.callback(param.options);
+ }
+ mb_execloadWmsSubFunctions({
+ wms: map.wms.length > 0 ? map.wms[map.wms.length - 1] : null
+ });
+=======
+ var ind = getMapObjIndexByName('mapframe1');
+ var map = mb_mapObj[ind];
+ var success = false;
+ if (js) {
+ var oldWmsCount = wms.length;
+ eval(js);
+ if (errorcall) {
+ var errorcall = errorcall.split("|");
+ var dialogContainer = $("<form/>");
+ if (errorcall[0] == "null") {
+ errorcall[0] = "Fehler";
+ }
var input = $("<input type='text' value='" + errorcall[1] + "' name='test'/>");
var label = "<div>" + errorcall[0] + "</div>";
var submitButton = $("<input type='submit' title='Speichern'/>");
@@ -168,6 +236,7 @@
mb_execloadWmsSubFunctions({
wms: map.wms.length > 0 ? map.wms[map.wms.length - 1] : null
});
+>>>>>>> .r9534
};
function mod_addWMSById_ajax(gui_id, wms_id, param) {
var options = {
More information about the Mapbender_commits
mailing list