[Mapbender-commits] r9489 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri May 27 00:19:06 PDT 2016
Author: armin11
Date: 2016-05-27 00:19:06 -0700 (Fri, 27 May 2016)
New Revision: 9489
Removed:
trunk/mapbender/http/plugins/adminpopup.js_deprecated
trunk/mapbender/http/plugins/kmlTree.js
trunk/mapbender/http/plugins/mb_div2jqdialog.js_deprecated
trunk/mapbender/http/plugins/mb_downloadFeedClient.php~
trunk/mapbender/http/plugins/mb_iframeButtonPopup.js_deprecated
trunk/mapbender/http/plugins/mb_measure.js_deprecated
trunk/mapbender/http/plugins/mb_measure_widget.js_deprecated
trunk/mapbender/http/plugins/mb_print.js_deprecated
trunk/mapbender/http/plugins/mb_twitter.php_deprecated
trunk/mapbender/http/plugins/mb_twitter_signin.js_deprecated
trunk/mapbender/http/plugins/mb_twitter_update.js_deprecated
trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer.php.old
Log:
Fix wrong commit
Deleted: trunk/mapbender/http/plugins/adminpopup.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/adminpopup.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/adminpopup.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,65 +0,0 @@
-/**
- * Package: button
- *
- * Description:
- * Imagine you have a DIV element in your application. In order to save screen
- * real estate, you might want to only show the DIV if the user clicked a
- * button. That's what this module does. The button will open a dialog
- * containing the element specified in the target column. In the example, a
- * button will open the print form in a new dialog.
- *
- * Files:
- * - ../plugins/mb_button.js
- *
- * 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>','printButton',1,1,'',
- * > 'Print','img','../img/button_blue_red/print_off.png','',NULL ,NULL ,24,24,
- * > NULL ,'','','','../plugins/mb_button.js','','printPDF','','');
- *
- * Maintainer:
- * http://www.mapbender.org/User:Christoph_Baudson
- *
- * Parameters:
- *
- * 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
- */
-
-var $button = $(this);
-
-var ButtonApi = function (o) {
- var that = this;
- var target = (o.$target && o.$target.jquery && o.$target.size() === 1) ?
- o.$target : $([]);
- var dialog = target.css({
- position: "static",
- width: "auto",
- height: "auto",
- top: "auto",
- left: "auto"
- }).hide().dialog({
- autoOpen: false
- });
-
- var openDialog = function () {
- dialog.dialog("open");
- button.stop();
- };
-
- var button = new Mapbender.Button({
- domElement: $button.get(0),
- over: o.src.replace(/_off/, "_over"),
- on: o.src.replace(/_off/, "_on"),
- off: o.src,
- name: o.id,
- go: openDialog
- });
-};
-
-$button.mapbender(new ButtonApi(options));
Deleted: trunk/mapbender/http/plugins/kmlTree.js
===================================================================
--- trunk/mapbender/http/plugins/kmlTree.js 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/kmlTree.js 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,884 +0,0 @@
-/**
- * Package: kmlTree
- *
- * Description:
- * Module to load KML temporary in a tree
- *
- * Files:
- * - mapbender/http/plugins/kmlTree.js
- * - mapebnder/lib/mb.ui.displayKmlFeatures.js
- * - mapbender/http/css/kmltree.css
- *
- * 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('<app_id>',
- * > 'kmlTree',2,1,'Displays KML on the map','KML','ul','','',1,1,200,200,NULL ,
- * > 'visibility:visible','','ul','../plugins/kmlTree.js','../../lib/mb.ui.displayKmlFeatures.js',
- * > 'mapframe1','jq_ui_widget','http://www.mapbender.org/Loadkml');
- * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type) VALUES('gui', 'kmlTree',
- * > 'buffer', '100', '' ,'var');
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type)
- * > VALUES('gui', 'kmlTree', 'styles', '../css/kmltree.css', '' ,'file/css');
- *
- * Help:
- * http://www.mapbender.org/Loadkml
- *
- * Maintainer:
- * http://www.mapbender.org/User:Armin_Retterath
- *
- *
- * 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
- */
-
-if (typeof window.DOMParser === "undefined") {
- window.DOMParser = function() {};
-
- window.DOMParser.prototype.parseFromString = function(str, contentType) {
- if (typeof ActiveXObject !== 'undefined') {
- var xmldata = new ActiveXObject('MSXML.DomDocument');
- xmldata.async = false;
- xmldata.loadXML(str);
- return xmldata;
- } else if (typeof XMLHttpRequest !== 'undefined') {
- var xmldata = new XMLHttpRequest;
-
- if (!contentType) {
- contentType = 'application/xml';
- }
-
- xmldata.open('GET', 'data:' + contentType + ';charset=utf-8,' + encodeURIComponent(str), false);
-
- if (xmldata.overrideMimeType) {
- xmldata.overrideMimeType(contentType);
- }
-
- xmldata.send(null);
- return xmldata.responseXML;
- }
- };
-
-}
-
-var $kmlTree = $(this);
-var KmlTree = function(o) {
- $kmlTree.children().remove();
- $kmlTree.addClass('kmlTree');
- var $KMLfolder = $('<li class="open kml"><ul></ul></li>');
- $kmlTree.append($KMLfolder);
-
- $addButton = $('<button class="add" name="addkml" value="addkml"></button>');
-
- var selectButton = $('<img id="toggle-select-features" src="../img/osgeo_graphics/geosilk/cursor.png"></img>');
-
- $addButton.click(function() {
- if ($('#mySpatialData').dialog('isOpen') === true) {
-
-
- return;
-
- } else {
- var dlg = $('<div id="mySpatialData"></div>').dialog({
- "title": "My spatial data",
- width: 720,
- height: 420,
- close: function() {
- $('#kml-load-tabs').tabs('destroy');
- $(this).html('').dialog('destroy');
- // $('#mySpatialData').dialog('destroy');
- $('#mySpatialData').remove();
- }
- });
- var dlgcontent = '<div id="kml-load-tabs">' + '<ul><li><a class="icon icon-wmc" href="#kml-from-wmc">Stored data</a></li>' + '<li><a class="icon icon-local" href="#kml-from-upload">Upload</a></li>' + '<li><a class="icon icon-remote" href="#kml-from-url">External source</a></li>' + '<li><a class="icon icon-new" href="#kml-new">New</a></li></ul>' + '<div id="kml-from-wmc">wmc</div>' + '<div id="kml-from-upload">' + '<iframe name="kml-upload-target" style="width: 0; height: 0; border: 0px;"></iframe>' + '<form action="../php/uploadKml.php" method="post" enctype="multipart/form-data" target="kml-upload-target">' + '<input type="file" name="kml"></input>' + '<input type="submit" class="upload" value="Upload"></input><br>' + 'You can upload local KML, GPX and geoJSON files here. The filename should' + ' have the typical file extension (.kml, .gpx or .geojson) and the size' + ' is limited to 250kb of data.' + '</div>' + '</form>' + '<div id="kml-from-url">URL: <input class="kmlurl" /><b
utton class="add" name="add" value="add"></button><br>' + 'You can give an url to a datafile which is located somewhere in the www. ' + 'Only KML, geoJSON and GPX files are supported. The files will be validated before they' + ' are loaded into the mapviewer.' + '</div>' + '<div id="kml-new">' + '<label>Title: <input type="text" name="kml-new-title"></input></label>' + '<button class="add-kml"></button>' + '</div>' + '</div>';
- $('#kml-load-tabs').remove();
- $(dlg).append(dlgcontent);
- $.ajax({
- type: 'get',
- url: '../php/mb_list_wmc_local_data.php',
- success: function(data) {
- var origData = $.extend(true, {}, data);
- $.each(data, function(_, v) {
- v[2] = new Date(v[2] * 1000);
- if (v[3]) {
- v[3] = '<img src="' + v[3] + '"></img>';
- }
- if (v[4]) {
- v[4] = '<img class="publishIcon" src="../img/osgeo_graphics/check.png"></img><img class="exportImage" src="../img/osgeo_graphics/geosilk/link22.png"></img>';
- } else {
- v[4] = '<img class="publishIcon" src="../img/button_digitize/geomRemove.png"></img>';
- }
- v[5] = Math.round(v[5] / 1024) + 'kb';
- });
-
- // add dialog for ópen links
- $('#kml-from-wmc').html('<table class="display"></table>').find('table').dataTable({
- aaData: data,
- aoColumns: [{
- sTitle: 'ID'
- }, {
- sTitle: 'Title'
- }, {
- sTitle: 'last change'
- }, {
- sTitle: 'License'
- }, {
- sTitle: 'public'
- }, {
- sTitle: 'size'
- }, {
- sTitle: 'owner'
- }]
- })
- .find('tr').bind('dblclick', function() {
- var id = $($(this).find('td')[0]).text();
- $.ajax({
- type: 'post',
- url: '../php/mb_load_local_data.php',
- data: {
- id: id
- },
- success: function(data) {
- var kml = $('#mapframe1').data('kml');
- $.each(data, function(url, json) {
- kml.addLayer(url, json.data);
- });
- $(dlg).dialog('destroy');
- }
- });
- }).end()
- .find('.exportImage').bind('click', function(event) { // add click event to the link image
- // stop event propagation beacause the following bind has to catch the click events on the 'tr'
- event.stopPropagation();
- if ($('#dataExportDialog').dialog('isOpen') === true) {
-
- $('#dataExportDialog').dialog('close');
- $('#dataExportDialog').remove();
- $(this).trigger('click');
-
- } else {
- var title = $(this).parent().siblings().eq(1).html();
- var wmc_serial_id = $(this).parent().siblings().eq(0).html();
- var outputFormat;
-
- var dataExportDlg = $('<div id="dataExportDialog"></div>').dialog({
- title: "Export my data " + title,
- width: 250,
- height: 212,
- position: {
- my: "center",
- at: "top",
- of: window
- },
- close: function() {
-
- $('#dataExportDialog').dialog('destroy');
- $('#dataExportDialog').remove();
- }
- });
- // var exportHtmlsdfdsf = '<div id="exportHtml">' + '<form>' + '<label class="export-format-kml">KML<input type="radio" name="export-format" value="kml" checked="checked"></input></label>' + '<label class="export-format-kml">KML<input type="radio" name="export-format" value="kml" checked="checked"></input></label>' + '<label class="export-format-kml">KML<input type="radio" name="export-format" value="kml" checked="checked"></input></label><br><br>' +
- // '<img src="../img/osgeo_graphics/geosilk/link22.png"/>' + '<label class="export-format-gpx">GPX</label>' + '<label class="export-format-geojson">geoJSON</label><br></br>' +
- // '<a download="myfeatures.kml" href="#" class="digitize-image digitize-export" style="float: left;"></a>' + '</form>' + '</div>';
- var exportHtml = '<div id="exportHtml"><table><tbody>' +
- '<tr><td>KML:</td><td><label class="export-format-kml exportDatasetIcon" style="padding-top:11px;"></label></td><td class="exportDataLink kml" wmcId="' + wmc_serial_id + '"outputFormat="kml"><img src="../img/osgeo_graphics/geosilk/link22.png"/></td></tr>' +
- '<tr><td>GPX:</td><td><label class="export-format-gpx exportDatasetIcon" style="padding-top:11px;"></label></td><td class="exportDataLink gpx" wmcId="' + wmc_serial_id + '"outputFormat="gpx"><img src="../img/osgeo_graphics/geosilk/link22.png"/></td></tr>' +
- '<tr><td>GeoJson:</td><td><label class="export-format-geojson exportDatasetIcon" style="padding-top:11px;"></label></td><td class="exportDataLink geojson" wmcId="' + wmc_serial_id + '"outputFormat="geojson"><img src="../img/osgeo_graphics/geosilk/link22.png"/></td></tr>' +
- '</tbody></table></div><iframe id="export-DataCollection" style="border:0;height:0; width:0;"></iframe>';
- // append the context
- $(dataExportDlg).append(exportHtml);
- //export the data
- $('.exportDatasetIcon').bind('click', function(event) {
-
- var exportClass = $(this).attr('class').toString().split(' ')[0];
- //getting the outputformat
- switch (exportClass) {
- case 'export-format-kml':
-
- outputFormat = 'kml';
- break;
- case 'export-format-gpx':
-
- outputFormat = 'gpx';
- break;
- case 'export-format-geojson':
-
- outputFormat = 'geojson';
- break;
- }
- $('#export-DataCollection').attr("src", "../php/mod_GetPublishedData.php?wmc_id=" + wmc_serial_id + "&outputFormat=" + outputFormat);
-
-
- });
-
- $('.exportDataLink').bind('click', function(event) {
- var format = $(this).attr('outputFormat');
- var exportDataLinkDlg = $('<div id="exportDataLinkDlg"></div>').dialog({
- "title": "Link to your Dataset",
- width: 350,
- height: 80,
- close: function() {
- $('#exportDataLinkDlg').dialog('destroy');
- $('#exportDataLinkDlg').remove();
-
- }
- });
-
- var exportDataLinkContent = '<div><label for="exportLinkInput">Link: </label><input id="exportLinkInput" size="35" type="text" value="http://' + window.location.hostname + '/mapbender/php/mod_GetPublishedData.php?wmc_id=' + wmc_serial_id + '&outputFormat=' + format + '"></div>';
- $(exportDataLinkDlg).append(exportDataLinkContent);
- });
- }
- })
- .end()
- .find('.publishIcon').bind('click', function() {
- // var id = $($(this).find('td')[0]).text();
- var id = $(this).parent().parent().children(':first').html();
- var d;
- $.each(origData, function(_, val) {
- if (val[0] == id) {
- d = val;
- }
- });
- var dlg = '<div title="Options ' + d[1] + '">' +
- '<ul class="kmltree-metadata-list">' + '<li class="kmltree-metadata-delete"><img style="vertical-align: middle;" src="../img/button_digitize/geomRemove.png"></img>Delete datacollection</li>';
-
- if (d[4]) {
- dlg += '<li class="kmltree-metadata-unpublish"><img style="vertical-align: middle;" src="../img/gnome/emblem-unreadable.png"></img>Withdraw publication</li>';
- } else {
- dlg += '<li class="kmltree-metadata-publish"><img style="vertical-align: middle;" src="../img/gnome/share.png"></img>Publish datacollection</li>';
- }
-
- dlg += '</ul></div>';
-
- dlg = $(dlg).appendTo('body');
-
- $(dlg).dialog({
- create: function() {
- $(dlg).find('li.kmltree-metadata-delete').bind('click', function() {
- if (confirm('Really delete spatial data set?')) {
- $(dlg).dialog('destroy');
- $.ajax({
- type: 'post',
- url: '../php/mb_delete_local_data.php',
- data: {
- id: id
- },
- success: function(data) {
- if (arguments[1] == 'success') {
-
- alert('Deleting local data was succesfull');
- $('#mySpatialData').dialog('destroy');
- $('#mySpatialData').remove();
- $($addButton).trigger('click');
- } else {
- alert('Problem when deleting local data');
-
- }
-
- }
- });
- }
- });
-
- $(dlg).find('li.kmltree-metadata-unpublish').bind('click', function() {
- if (confirm('Really unpublish spatial data set?')) {
- $(dlg).dialog('destroy');
- $.ajax({
- url: '../php/mb_unpublish_wmc.php',
- type: 'POST',
- data: {
- wmc_serial_id: id
- },
-
- success: function(data) {
-
- $('#mySpatialData').dialog('destroy');
- $('#mySpatialData').remove();
- $($addButton).trigger('click');
-
-
-
- }
-
-
- });
-
-
-
- }
- });
-
- $(dlg).find('li.kmltree-metadata-publish').bind('click', function() {
-
- // check if the user is public(guest-user) or not
- var isPublic;
- $.ajax({
- url: '../php/mb_checkGuest.php',
- type: 'POST',
- success: function(data) {
- isPublic = data;
- if (isPublic == 1){
-
- alert('To publicate a WMC is not allowed for the Guest-User!'+
- 'If you want to use this function, please create an account.');
- return false;
- }
- var publishDialog;
- $(dlg).dialog('destroy');
- if ($('#wmcPublishConfirm').dialog('isOpen') === true) {
-
-
- return;
-
- } else {
-
- publishDialog = $('<div id="wmcPublishConfirm"></div>').dialog({
- title: "Publish datacollection " + d[1],
- width: 373,
- height: 'auto',
- position: {
- my: "center",
- at: "top",
- of: window
- },
- close: function() {
- // $('#kml-load-tabs').tabs('destroy');
- // $(this).html('').dialog('destroy');
- $('#wmcPublishConfirm').dialog('destroy');
- $('#wmcPublishConfirm').remove();
- }
- });
-
- var publishDlgContent = "<div style='font-size:16px;text-align:justify'>If you want to publish a datacolletcion, you first have to choose a license" +
- " under which you want to distribute your data. Actually only OpenData compatible" +
- " licences are supported in this application. Please read the licenses carefully before" +
- " you activate this option. All of your data will be available for each person in the web" +
- " in different formats and may be redistributed freely without any copyright. </div>" +
- "<table style='margin-top:7px' ><tr><th id = 'publishDenied'><img src='../img/button_digitize/geomRemove.png'></img> No, I dont't want to publish</th>" +
- "<th style='width:16%;visibility:hidden'>empty</th>" +
- "<th id = 'publishConfirmed'><img src='../img/osgeo_graphics/check.png'></img> Yes, I know what I am doing </th></tr></table>";
-
- $(publishDialog).append(publishDlgContent);
-
-
- }
-
-
-
-
-
-
- $(publishDialog).find('#publishConfirmed').bind('click', function() {
- $(publishDialog).dialog('close');
- var chooseLicenseDialog = $('<div id="chooseLicenseDialog"></div>').dialog({
- title: "Choose OpenData license for datacollection " + d[1],
- width: 720,
- height: 150,
- position: {
- my: "center",
- at: "top",
- of: window
- },
- close: function() {
-
- $('#chooseLicenseDialog').dialog('destroy');
- $('#chooseLicenseDialog').remove();
- }
- });
-
- var chooseLicenseDlgCont = "<div><table id='licenseTbl'style='border-collapse: collapse'>" +
- "<tr><th>Lizenz</th>" +
- "<th>Logo</th><th>Beschreibung</th><th>Opendata</th></tr>" +
- "<tr><td><select id='licenseChooser name='license'>" +
- "</select></td>" +
- "<td id='licenseImg'></td>" +
- "<td id='licenseDescription'></td>" +
- "<td id='licenseOpen' nowrap></td></tr>" +
- "<tr id='submitLicense' ><td style='border:none;cursor:pointer; nowrap'><img src='../img/osgeo_graphics/check.png' style='margin-top:10px'/> <span>Publish data</span></td></tr>" +
- "</table></div>";
-
- // add options for the select box
- $(chooseLicenseDialog).append(chooseLicenseDlgCont);
-
- $.ajax({
- url: '../php/mb_publish_wmc.php',
- type: 'POST',
- data: {
- wmc_serial_id: id,
- mode: 'getAllLicencesMode',
- license: 'empty',
- openData_only: options.openData_only,
- },
-
- success: function(data) {
-
- for (var i = 0; i < data.length; i++) {
-
- $('#licenseTbl select').append("<option>" + data[i].name + "</option>");
- }
-
- }
-
- });
-
-
- $.ajax({
- url: '../php/mb_publish_wmc.php',
- type: 'POST',
- data: {
- wmc_serial_id: id,
- mode: 'getLicenseMode',
- license: 'cc-by'
- },
-
- success: function(data) {
-
- $('#licenseImg').html('<img src="' + data.symbollink + '" />');
- $('#licenseDescription').html('<a href="' + data.description + '" />' + data.description + '</a>');
- if (data.isopen == 1) {
-
- $('#licenseOpen').html('<img src="../img/od_80x15_blue.png" />');
- } else {
-
- $('#licenseOpen').html('<span>No OpenData</span>');
- }
-
- }
-
- });
-
-
- $('#licenseTbl select').bind('change', function(event) {
- $('#licenseImg').html('');
- $('#licenseDescription').html('');
-
- $.ajax({
- url: '../php/mb_publish_wmc.php',
- type: 'POST',
- data: {
- wmc_serial_id: id,
- mode: 'getLicenseMode',
- license: $('#licenseTbl select').val()
- },
-
- success: function(data) {
-
- $('#licenseImg').html('<img src="' + data.symbollink + '" />');
- $('#licenseDescription').html('<a href="' + data.description + '" />' + data.description + '</a>');
- if (data.isopen == 1) {
-
- $('#licenseOpen').html('<img src="../img/od_80x15_blue.png" />');
-
- } else {
-
- $('#licenseOpen').html('<span>No OpenData</span>');
- }
-
- }
-
- });
- });
-
- $('#submitLicense').bind('click', function(event) {
- //save the license from the choosed wmc
-
- $.ajax({
- url: '../php/mb_publish_wmc.php',
- type: 'POST',
- data: {
- wmc_serial_id: id,
- mode: 'saveLicenseMode',
- license: $('#licenseTbl select').val()
- },
-
- success: function(data) {
-
- $('#chooseLicenseDialog').dialog('destroy');
- $('#chooseLicenseDialog').remove();
- $('#mySpatialData').dialog('destroy');
- $('#mySpatialData').remove();
- $($addButton).trigger('click');
-
-
-
-
- }
-
- });
- });
-
- });
-
- $(publishDialog).find('#publishDenied').bind('click', function() {
- $(publishDialog).dialog('close');
-
-
- });
- }
- });
-
-
-
-
- });
-
- }
- });
- });
- // .bind('dblclick', function() {
- // var id = $($(this).find('td')[0]).text();
- // $.ajax({
- // type: 'post',
- // url: '../php/mb_load_local_data.php',
- // data: {
- // id: id
- // },
- // success: function(data) {
- // var kml = $('#mapframe1').data('kml');
- // $.each(data, function(url, json) {
- // kml.addLayer(url, json.data);
- // });
- // $(dlg).dialog('destroy');
- // }
- // });
- // });
- }
- });
- $('#kml-load-tabs').tabs();
- $('#kml-load-tabs').find('button.add').bind('click', function() {
- $('#mapframe1').kml({ //TODO: what is happening?
- url: $('#kml-load-tabs').find('.kmlurl').val()
- });
- // $(dlg).dialog('destroy');
- });
- $('#kml-load-tabs').find('button.add-kml').bind('click', function() {
- var kml = $('#mapframe1').data('kml');
- var title = $('#kml-load-tabs input[name="kml-new-title"]').val();
- var version = 'v1'
- if (title == '') {
- return;
- }
- kml.addLayer(title, {
- uuid: UUID.genV4().toString(),
- created: new Date().toISOString(),
- title: title,
- updated: new Date().toISOString(),
- version: version,
- type: 'FeatureCollection',
- features: []
- });
- $(dlg).dialog('destroy');
- });
- var ifr = $('iframe[name="kml-upload-target"]')[0];
- var onloadfun = function() {
- ifr.onload = null;
- var txt = $(this).contents().find('pre').text(); // result von uploadKML.php
- var data;
- try {
- data = JSON.parse(txt);
-
- } catch (e) {
-
- var xml = new DOMParser().parseFromString(txt, 'application/xml');
- data = toGeoJSON.gpx(xml);
- }
- var kml = $('#mapframe1').data('kml');
- var name;
- // check the features for properties
- data = setFeatureAttr(data);
-
- if (data.hasOwnProperty('title')) {
-
- name = data['title'];
- kml.addLayer(name, data);
- } else {
-
- name = $('#kml-from-upload input[type="file"]').val();
-
- // test.replace(/\\/g,"/").split("/")
- if (name.replace(/\\/g, "/").split("/")) {
- // name = name.match(/[\\]([^\\]+)/g);
- name = name.replace(/\\/g, "/").split("/");
- }
- name = name[name.length - 1];
- kml.addLayer(name, data);
- }
-
- $(dlg).dialog('destroy');
- };
- $('#kml-from-upload form').bind('submit', function() {
- if ( $( "#kml-from-upload > form > input[type='file'] " ).val() === "") {
- return;
- }
- ifr.onload = onloadfun;
- });
-
- }
- });
- $KMLfolder.find('ul').before(selectButton);
- $KMLfolder.find("ul").before($addButton);
-
- var btn = new Mapbender.Button({
- domElement: selectButton[0],
- over: '../img/osgeo_graphics/geosilk/cursor_selected.png',
- on: '../img/osgeo_graphics/geosilk/cursor_selected.png',
- off: '../img/osgeo_graphics/geosilk/cursor.png',
- name: 'toggle-select-features',
- go: function() {
- var kml = $('#mapframe1').data('kml');
- kml.setQueriedLayer(true);
- },
- stop: function() {
- var kml = $('#mapframe1').data('kml');
- kml.setQueriedLayer(false);
- }
- });
-
- o.$target.bind('kml:loaded', function(e, obj) {
- var checked = obj.display ? 'checked="checked"' : '';
- title = obj.url;
- if (obj.refreshing) {
- $KMLfolder.find('ul li[title="' + title + '"]').remove();
- }
- abbrevTitle = title.length < 20 ? title : title.substr(0, 17) + "...";
- $kmlEntry = $('<li title="' + title + '" class="open"><button class="digitize-menu-arrow"></button><button class="toggle" name="toggle" value="toggle" ></button> <input type="checkbox"' + checked + '/><a href="#">' + abbrevTitle + '</a></li>');
- $KMLfolder.children("ul").append($kmlEntry);
-
- $kmlEntry.find("a").bind("click", (function(url) {
- return function() {
- $('#mapframe1').data('kml').zoomToLayer(url);
- };
- })(obj.url));
- //@TODO: add default icon for points,polygons and linestrings on import
- $featureList = $("<ul />");
- $kmlEntry.append($featureList);
- var pointCount = 1;
- var polygonCount = 1;
- var linestringCount = 1;
- for (var i = obj.data.features.length - 1; i >= 0; --i) { //FIXME: for feature without the "type: FeatureCollection ",change functionallity: if (obj.data.type == "Feature") ...
- var multi = obj.data.features[i].geometry.type.match(/^Multi/i);
- var toggle = '';
- if (multi) {
- toggle = '<button class="toggle" name="toggle" value="toggle"></button>';
- }
-
- if (obj.data.features[i].properties.name) {
-
- title = obj.data.features[i].properties.name;
-
- } else if (obj.data.features[i].properties.title) {
-
- title = obj.data.features[i].properties.title;
- } else {
-
- switch (obj.data.features[i].geometry.type){
-
- case 'Point':
- title = 'point_'+pointCount;
- pointCount += 1;
- break;
- case 'Polygon':
- title = 'polygon_'+polygonCount;
- polygonCount += 1;
- break;
- case 'LineString':
- title = 'linestring_'+linestringCount;
- linestringCount += 1;
- break;
- }
- // title = 'Title undefined';
-
- }
- // title = obj.data.features[i].properties.name;
-
-
- abbrevTitle = title.length < 20 ? title : title.substr(0, 17) + "...";
- var displ = obj.data.features[i].display === true || obj.data.features[i].display === undefined;
- $feature = $('<li idx="' + i + '" title="' + title + '"><button class="digitize-menu-arrow"></button>' + toggle + '<input type="checkbox" ' + (displ ? 'checked="checked"' : '') + '/><div class="style-preview" style="width: 20px; height: 20px; display: inline;"></div><a href="#" >' + abbrevTitle + '</a></li>');
- $featureList.append($feature);
-
- var preview = $feature.find('.style-preview').get(0);
- $('#mapframe1').data('kml').renderPreview(obj.data.features[i], preview, 20);
-
- title = obj.data.features[i].properties.name;
-
- $feature.bind('mouseout', (function(jsonFeature) {
- return function() {
- var map = o.$target.mapbender();
- var g = new GeometryArray();
- g.importGeoJSON(jsonFeature, false);
- var feature = g.get(0);
-
- if (feature.geomType != "point") {
- var me = $kmlTree.mapbender();
- me.resultHighlight.clean();
- me.resultHighlight.paint();
- }
- }
- })(obj.data.features[i]));
- $feature.bind('mouseover', (function(jsonFeature) {
- return function() {
- var map = o.$target.mapbender();
- var g = new GeometryArray();
- g.importGeoJSON(jsonFeature, false);
- var feature = g.get(0);
-
- if (feature.geomType != "point") {
- var me = $kmlTree.mapbender();
- feature = feature.getBBox4();
- me.resultHighlight = new Highlight(
- [o.target],
- "KmlTreeHighlight", {
- "position": "absolute",
- "top": "0px",
- "left": "0px",
- "z-index": 100
- },
- 2);
-
- me.resultHighlight.add(feature, "#00ff00");
- me.resultHighlight.paint();
- } else if (feature.geomType == "point") {
-
- }
-
- };
- })(obj.data.features[i]));
- }
-
- $('button.digitize-layer', $kmlEntry).bind('click', function() {
- var active = $(this).toggleClass('active').hasClass('active');
- if (active) {
- $(this).parent().siblings().find('button.digitize-layer').removeClass('active');
- }
- });
-
- $('#kmlTree > li > ul').sortable({
- update: function() {
- var kml = $('#mapframe1').data('kml');
- var urls = [];
- $(this).children('li[title]').each(function(k, v) {
- urls.push($(this).attr('title'));
- });
- kml.setOrder(urls);
- }
- });
-
- $('#kmlTree > li > ul > li > ul').sortable({
- update: function(evt, data) {
- var kml = $('#mapframe1').data('kml');
- var url = $(this).parent().attr('title');
- var ids = [];
- var i = $(this).children().length;;
- $.each($(this).children(), function(k, v) {
- ids.push($(v).attr('idx'));
- $(v).attr('idx', --i);
- });
- kml.reorderFeatures(url, ids.reverse());
- }
- });
-
- $('input[type="checkbox"]', $kmlEntry).bind('click', function() {
- var idx = $(this).parent().attr('idx');
-
- if (idx === undefined) {
- if ($(this).attr('checked')) {
- o.$target.kml('show', obj.url);
- } else {
- o.$target.kml('hide', obj.url);
- }
- } else {
- var kml = $('#mapframe1').data('kml');
- if ($(this).attr('checked')) {
- kml.showFeature(obj.url, idx);
- } else {
- kml.hideFeature(obj.url, idx);
- }
- }
- });
-
- $("button.toggle", $kmlEntry).bind('click', function() {
- if ($(this).parent().hasClass("open")) {
- $(this).parent().removeClass("open");
- $(this).parent().addClass("closed");
- } else {
- $(this).parent().removeClass("closed");
- $(this).parent().addClass("open");
- }
-
- // IE8 workaround to make style previews visible...
- $(this).parent().find('ul.ui-sortable li .rvml').removeClass('rvml').addClass('rvml');
- });
-
- $('#tabs_kmlTree').bind('click', function() {
- window.setTimeout(function() {
- // IE8 workaround to make style previews visible...
- $('#kmlTree').find('ul.ui-sortable li .rvml').removeClass('rvml').addClass('rvml');
- }, 1000);
- });
-
- });
-
- var setFeatureAttr = function(data) {
- var simpleStyleDefaults = {
-
- "title": "",
- "description": "",
- "marker-size": "medium",
- "marker-symbol": "",
- "marker-color": "7e7e7e",
- "stroke": "#555555",
- "stroke-opacity": 1.0,
- "stroke-width": 2,
- "fill": "#555555",
- "fill-opacity": 0.5
- };
-
- if (data.type == 'Feature') {
-
- if (Object.getOwnPropertyNames(data.properties).length === 0 || data.properties === null) {
-
- data.properties = simplyStyleDefaults;
-
- } else {
-
- $.each(simpleStyleDefaults, function(index, val) {
-
- if (!data.properties.hasOwnProperty(index)) {
-
- data.properties[index] = value;
- }
-
- });
-
- }
-
- } else if (data.type == 'FeatureCollection') {
- // get all features in the featureCollection and set the default properties if they are not set
- $.each(data.features, function(index, val) {
-
- $.each(simpleStyleDefaults, function(prop, propVal) {
-
- if (!val.properties.hasOwnProperty(prop)) {
-
- //TODO: get index in this scope
- data.features[index].properties[prop] = propVal;
- }
-
- });
- });
-
- }
-
- return data;
-
-
- };
-};
-
-Mapbender.events.init.register(function() {
- $kmlTree.mapbender(new KmlTree(options));
-});
Deleted: trunk/mapbender/http/plugins/mb_div2jqdialog.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_div2jqdialog.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_div2jqdialog.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,68 +0,0 @@
-/**
- * Package: mb_div2jqdialog
- *
- * Description:
- *
- *
- *
- *
- *
- *
- * Files:
- * - ../plugins/mb_div2jqdialog.js
- *
- * SQL:
-
- *
- * Maintainer:
- * http://www.mapbender.org/User:Armin_Retterath
- *
- * Parameters:
- *
- * 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
- */
-//check for elementVars
-options.divPopupTitle = options.divPopupTitle || "Popup";
-options.divPopupHeight = options.divPopupHeight || 250;
-options.divPopupWidth = options.divPopupWidth || 400;
-// see http://docs.jquery.com/UI/Dialog for possible values
-options.position = options.position || 'center';
-
-var $divjqdialog = $(this);
-
-
-var DivJqDialogApi = function(o) {
- $(this).click(function(e) {
- e.preventDefault();
- var $this = $(this);
- var horizontalPadding = 30;
- var verticalPadding = 30;
- var infoPopup = $('<div class="infoPopup"></div>');
- infoPopup.dialog({
- title: ($this.attr('title')) ? $this.attr('title') : "Popup",
- autoOpen: true,
- width: 800,
- height: 500,
- modal: true,
- resizable: true,
- autoResize: true,
- overlay: {
- opacity: 0.5,
- background: "black"
- }
- }).width(800 - horizontalPadding).height(500 - verticalPadding);
- infoPopup.dialog("open");
- });
-
- };
-
-
-
-Mapbender.events.init.register(function(){
- $divjqdialog.mapbender(new DivJqDialogApi(options));
-});
-
Deleted: trunk/mapbender/http/plugins/mb_downloadFeedClient.php~
===================================================================
--- trunk/mapbender/http/plugins/mb_downloadFeedClient.php~ 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_downloadFeedClient.php~ 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,178 +0,0 @@
-<?php
- //http://localhost/mapbender_trunk/plugins/mb_downloadFeedClient.php
- require_once dirname(__FILE__) . "/../../core/globalSettings.php";
- require_once dirname(__FILE__) . "/../classes/class_user.php";
-
-if (isset($_REQUEST['url']) & $_REQUEST['url'] != "") {
- //validate to iso date format YYYY-MM-DD
- $testMatch = $_REQUEST["url"];
- $pattern = '/^http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?$/';
- if (!preg_match($pattern,$testMatch)){
- echo 'url: <b>'.$testMatch.'</b> is not a valid url.<br/>';
- die();
- }
- $url = urldecode($testMatch);
- $testMatch = NULL;
-}
-
-?>
-<html>
-<head>
-<title><?php echo _mb("INSPIRE ATOM Feed Client");?></title>
-<meta name="description" content="INSPIRE ATOM Feed Client" xml:lang="en" />
-<meta name="keywords" content="INSPIRE SDI GDI Download" xml:lang="en" />
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<meta http-equiv="content-language" content="en" />
-<meta http-equiv="content-style-type" content="text/css" />
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link rel="stylesheet" href="../extensions/OpenLayers-2.9.1/theme/default/style.css" type="text/css">
- <style type="text/css">
- select, textarea {
- font: 0.9em Verdana, Arial, sans-serif;
- }
- textarea {
- position: absolute;
- right: 0;
- width: 300px;
- height: 40px;
- }
- #client {
- width: 650px;
- height: 870px;
- }
- #input_feed_url {
- }
- #dataset_select {
- }
- #dataset_info {
- position: relative;
- }
- #representation_select {
- }
- #representation_info {
- position: relative;
- }
- #dataset_info {
- width: 1000px;
- height: 300px;
- }
- #mapframe_dataset_list {
- position: absolut;
- top: 0;
- left: 0;
- width: 350px;
- height: 250px;
- border: 1px solid #ccc;
- }
- #dataset_information{
- position: absolute;
- left: 400;
- top: 0;
- width: 500px;
- height: 270px;
- }
- #mapframe {
-
- }
- #mapframe_file_list {
- width: 325px;
- height: 225px;
- border: 1px solid #ccc;
- }
- #section_list {
- position: relative;
- top: 0;
- left: 0;
- width: 325px;
- height: 225px;
- }
- #input {
- width: 512px;
- }
- #text {
- font-size: 0.85em;
- margin: 1em 0 1em 0;
- width: 100%;
- height: 10em;
- }
- p {
- margin: 0;
- padding: 0.75em 0 0.75em 0;
- }
- </style>
- <!--<script src="../extensions/OpenLayers-2.9.1/OpenLayers.js"></script>-->
- <script src="http://openlayers.org/api/OpenLayers.js"></script>
- <script src="../extensions/jquery-ui-1.8.16.custom/js/jquery-1.6.2.min.js"></script>
- <script src="../extensions/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script>
- <script src="../javascripts/mb_downloadFeedClient.js"></script>
-</head>
-<body onload="init()">
-
-<fieldset id="client">
- <legend><?php echo _mb("INSPIRE Download Service ATOM Feed Client");?><img src="../img/inspire_tr_36.png" /><!--<img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Client to download INSPIRE data on an easy way.");?>'}" src="../img/questionmark.png" alt="" />--></legend>
- <div id="input_feed_url">
- <p>
- <form id="service_feed_form">
- <label for="download_feed_url"><?php echo _mb("ATOM Feed url");?></label>
- <input name="download_feed_url" id="download_feed_url" class="required" <?php if (isset($url)) {echo " value=\"".$url."\"";} else { echo " value=\"\"";}?>/><input type="button" title="Get Feed" id="download_feed_button" value="Get Feed Content"/>
- </form>
- </p>
- </div>
- <div id="dataset_list">
- <div id="dataset_select"></div>
- </div>
- <br>
- <div id="dataset_info">
- <!--<fieldset>
- <legend><?php echo _mb("Select dataset");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Select single dataset either in list or on map");?>'}" src="../img/questionmark.png" alt="" /></legend>-->
- <div id="mapframe_dataset_list"></div>
- <div id="dataset_information">
- <!--<fieldset>
- <legend><?php echo _mb("Dataset Feed entries");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("The fieldset shows the content of the INSPIRE Download Service service-feed document. It contains one or more links to different datasets.");?>'}" src="../img/questionmark.png" alt="" /></legend>-->
- <p>
- <label for="dataset_title"><?php echo _mb("Dataset title");?>:</label>
- <textarea readonly="readonly" name="dataset_title" id="dataset_title"></textarea>
- </p>
- <p>
- <label for="dataset_abstract"><?php echo _mb("Dataset abstract");?>:</label>
- <textarea type="text" readonly="readonly" name="dataset_abstract" id="dataset_abstract" width="250px" height="20px"></textarea>
- </p>
- <p>
- <!--<label for="resource_identifier"><?php echo _mb("Resource identifier");?>:</label>-->
- <div id="dataset_identifier"><?php echo _mb("Resource identifier");?>:<br></div>
- </p>
- <p>
- <label for="dataset_rights"><?php echo _mb("Rights");?>:</label>
- <textarea readonly="readonly" name="dataset_rights" id="dataset_rights"></textarea>
- </p>
- <!--</fieldset>-->
- </div>
- <!--</fieldset>-->
- </div>
- <div id="representation_select">
- <p>
- <label for="representations"><?php echo _mb("Available representations");?>:</label>
- <div id="dataset_representation_list"></div>
- </p>
- </div>
- <div id="representation_info">
- <!--<fieldset>
- <legend><?php echo _mb("Files");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Files which can be downloaded");?>'}" src="../img/questionmark.png" alt="" /></legend>-->
- <!--<input id="multi_select" type="checkbox" disabled ><?php echo _mb("Select multiple tiles");?></input><br>-->
- <!--<label for="mapframe_file_list"><?php echo _mb("Position of files (if available)");?>:</label>-->
- <!--<input type="list" id="file_list"/>-->
- <div id="mapframe_file_list"></div>
- <br>
-
- <!--<label for="section_list"><?php echo _mb("List of files");?>:</label>-->
- <div id="section_list"><?php echo _mb("Select to download dataset");?>:<br></div>
- <!--<select id="section_file_list" multiple='multiple'>-->
- <!--<input type="button" title="Download selected files" value="Download selection"/>-->
- <!--</fieldset> -->
- </div>
-</fieldset>
-
-</body>
-</html>
Deleted: trunk/mapbender/http/plugins/mb_iframeButtonPopup.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_iframeButtonPopup.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_iframeButtonPopup.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,57 +0,0 @@
-/**
- * Package: mb_iframeButtonPopup
- *
- * Description:
- *
- *
- *
- *
- *
- *
- * Files:
- * - ../plugins/mb_iframeButtonPopup.js
- *
- * SQL:
- *
- * Maintainer:
- * http://www.mapbender.org/User:Armin_Retterath
- *
- * Parameters:
- *
- * 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
- */
-
-var $iframebuttonpopup = $(this);
-
-
-var IframeButtonPopup = function(o) {
- $(this).find('img').click(function(e) {
- e.preventDefault();
- var $this = $(this);
- var horizontalPadding = 30;
- var verticalPadding = 30;
- $('<iframe src="' + this.href + '" target="'+this.target+'"/>').dialog({
- title: ($this.attr('title')) ? $this.attr('title') : 'External Site',
- autoOpen: true,
- width: 800,
- height: 500,
- modal: true,
- resizable: true,
- autoResize: true,
- overlay: {
- opacity: 0.5,
- background: "black"
- }
- }).width(800 - horizontalPadding).height(500 - verticalPadding);
- });
- };
-
-
-Mapbender.events.init.register(function(){
- $iframebuttonpopup.mapbender(new IframeButtonPopup(options));
-});
-
Deleted: trunk/mapbender/http/plugins/mb_measure.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_measure.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_measure.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,330 +0,0 @@
-var $measure = $(this);
-
-var MeasureApi = function (o) {
-
- var measureDialog,
- measurePoints = [],
- button,
- canvases = {},
- that = this,
- opacity = 0.4,
- srs;
-
- var hideMeasureData = function () {
- measureDialog.find(".mb-measure-clicked-point").parent().hide();
- measureDialog.find(".mb-measure-current-point").parent().hide();
- measureDialog.find(".mb-measure-distance").parent().hide();
- measureDialog.find(".mb-measure-area").parent().hide();
- };
-
- var create = function () {
- //
- // Initialise measure dialog
- //
-
- var html = "<div>" +
- "<p class='mb-measure-text'>Fahren Sie mit der Maus über die Karte, um die Koordinaten anzuzeigen.<br> Klicken Sie, um eine Messung zu starten</p>" +
- "<p>Letzter Punkt: <span class='mb-measure-clicked-point' /></p>" +
- "<p>Aktuelle Koordinaten: <span class='mb-measure-current-point' /></p>" +
- "<p>Distanz: <span class='mb-measure-distance' /> m</p>" +
- "<p>Fläche: <span class='mb-measure-area' /> <span class='mb-measure-area-unit' /></p>" +
- "</div>";
-
- measureDialog = $(html).appendTo(o.$target);
-
- measureDialog.dialog({
- autoOpen: false
- }).bind("dialogclose", function () {
- button.stop();
- });
-
- // Initialise Raphael canvas
- Mapbender.events.init.register(function () {
- o.$target.each(function () {
- var map = $(this).mapbender();
- var $canvas = $("<div />").css({
- "z-index": 100,
- "position": "relative"
- }).appendTo(this);
- canvases[map.elementName] =
- Raphael($canvas.get(0), map.getWidth(), map.getHeight());
- });
- });
-
- //
- // Initialise button
- //
- button = new Mapbender.Button({
- domElement: $measure.get(0),
- over: o.src.replace(/_off/, "_over"),
- on: o.src.replace(/_off/, "_on"),
- off: o.src,
- name: o.id,
- go: that.activate,
- stop: that.deactivate
- });
- };
-
- var draw = function (map, pos) {
- var canvas = canvases[map.elementName];
- canvas.clear();
-
- var str_path = "";
-
- measurePoints.push(pos);
-
- var len = measurePoints.length;
- if (len > 0){
- for (var k=0; k < len; k++) {
- var pk = measurePoints[k];
-
- var q = map.convertRealToPixel(pk);
- if (k === 0) {
- str_path += 'M';
- }
- else {
- str_path += 'L';
- }
- str_path += q.x + ' ' + q.y;
-
- var circle = canvas.circle(q.x, q.y, 3);
-
- if (k === 0) {
- circle.attr({
- fill: "#f00",
- stroke: "none",
- opacity: opacity
- });
- }
- else {
- circle.attr({
- fill: "#f00",
- stroke: "none",
- opacity: opacity
- });
- }
- }
- }
- measurePoints.pop();
-
- if (isPolygon(measurePoints, pos)) {
- var poly = canvas.path(str_path + 'Z');
- poly.attr({
- fill: "#0f0",
- opacity: opacity
- });
- }
-
- var line = canvas.path(str_path);
- line.attr({
- stroke: "#00f",
- "stroke-width": 2,
- opacity: opacity
- });
- line.toFront();
- };
-
- var updateCurrentPoint = function (p) {
- measureDialog.find(".mb-measure-current-point").text(
- p.x + " " + p.y
- ).parent().show();
- };
-
- var updateClickedPoint = function (p) {
- measureDialog.find(".mb-measure-clicked-point").text(
- p.x + " " + p.y
- ).parent().show();
- };
-
- var updateDistance = function (dist) {
- if (!dist) {
- return;
- }
- measureDialog.find(".mb-measure-distance").text(Math.abs(dist)).parent().show();
- };
-
- var updateArea = function (area) {
- if (area === null) {
- return;
- }
- var areaUnit = "m²";
- if (area > 10000000){
- area /= 1000000;
- areaUnit = "km²";
- }
- else if (area > 100000){
- area /= 10000;
- areaUnit = "ha";
- }
- area = Math.round(area*10)/10;
-
- measureDialog.find(".mb-measure-area-unit").html(areaUnit);
- measureDialog.find(".mb-measure-area").text(area).parent().show();
- };
-
- var calculateDistanceGeographic = function (a, b) {
- var lon_from = (a.x * Math.PI) / 180;
- var lat_from = (a.y * Math.PI) / 180;
- var lon_to = (b.x * Math.PI) / 180;
- var lat_to = (b.y * Math.PI) / 180;
- return Math.abs(6371229 * Math.acos(
- Math.sin(lat_from) * Math.sin(lat_to) +
- Math.cos(lat_from) * Math.cos(lat_to) *
- Math.cos(lon_from - lon_to)
- ));
- };
-
- var calculateDistanceMetric = function (a, b) {
- return Math.abs(Math.sqrt(
- Math.pow(Math.abs(b.x - a.x), 2) +
- Math.pow(Math.abs(b.y - a.y), 2)
- ));
- };
-
- var calculateDistance = function (map, a, b) {
- if (a !== null && b !== null) {
- switch (map.getSrs()) {
- case "EPSG:4326":
- return calculateDistanceGeographic(a, b);
- default:
- return calculateDistanceMetric(a, b);
- }
- }
- return null;
- };
-
- var calculateArea = function (pos) {
- if (measurePoints.length < 2) {
- return null;
- }
-
- var area = 0;
- var p0 = measurePoints[0], pi, pj;
- for (var i = 0; i < measurePoints.length - 1; i++) {
- pi = measurePoints[i];
- pj = measurePoints[i + 1];
- area += (pi.y + pj.y) * (pi.x - pj.x) / 2;
- }
- area += (p0.y + pj.y) * (p0.x - pj.x) / 2;
- return Math.abs(area);
- };
-
- var isPolygon = function (measurePoints, pos) {
-
- var len = measurePoints.length;
- if (len < 2) {
- return false;
- }
-/*
- var pn = measurePoints[len - 1];
-
- for (var i = 0; i < measurePoints.length - 2; i++) {
- var p1 = measurePoints[i];
- var p2 = measurePoints[i + 1];
-
- if (lineIntersect(p1.x, p1.y, p2.x, p2.y, pn.x, pn.y, pos.x, pos.y)) {
- return false;
- }
- }
-*/
- return true;
- };
-
- var lineIntersect = function ( a1, a2, b1, b2, c1, c2, d1, d2 ) {
- var s, t, N = (b1-a1)*(d2-c2)-(b2-a2)*(d1-c1);
- if (N === 0) {
- // parallel
- return false;
- }
- s = ((c1-a1)*(d2-c2)-(c2-a2)*(d1-c1)) / N;
- t = (a1-c1 + s*(b1-a1)) / (d1-c1);
-
- if (s <= 1 && s>=0 && t <= 1 && t>=0) {
- return true;
- }
- return false;
- };
-
- var measure = function (e) {
- var map = $(e.currentTarget).mapbender();
-
- if (srs !== map.getSrs()){
- button.stop();
- return;
- }
-
- var pos = map.convertPixelToReal(map.getMousePosition(e));
- updateCurrentPoint(pos);
-
- var previousPoint = measurePoints.length > 0 ?
- measurePoints[measurePoints.length - 1] : null;
- var distance = calculateDistance(map, previousPoint, pos);
- updateDistance(distance);
-
- if (isPolygon(measurePoints, pos)) {
- updateArea(calculateArea(pos));
- }
- draw(map, pos);
- };
-
- var addPoint = function (e) {
- var map = $(e.currentTarget).mapbender();
-
- var pos = map.convertPixelToReal(map.getMousePosition(e));
- updateClickedPoint(pos);
-
- draw(map, pos);
-
- measurePoints.push(pos);
- };
-
- var addLastPoint = function (e) {
- if ($(e.currentTarget).size() > 0) {
- $(e.currentTarget).unbind("mousedown", addPoint)
- .unbind("dblclick", addLastPoint)
- .unbind("mousemove", measure);
- $(e.currentTarget).css("cursor", "auto");
- }
-
- addPoint(e);
- };
-
- this.activate = function () {
- if (o.$target.size() > 0) {
- o.$target.bind("mousedown", addPoint)
- .bind("dblclick", addLastPoint)
- .bind("mousemove", measure);
- o.$target.css("cursor", "crosshair");
- }
-
- srs = o.$target.mapbender().getSrs();
-
- measureDialog.dialog("open");
- };
-
- this.deactivate = function () {
- if (o.$target.size() > 0) {
- o.$target.unbind("mousedown", addPoint)
- .unbind("dblclick", addLastPoint)
- .unbind("mousemove", measure);
- o.$target.css("cursor", "auto");
- }
-
- srs = undefined;
-
- for (var i in canvases) {
- canvases[i].clear();
- }
-
- measurePoints = [];
-
- hideMeasureData();
-
- measureDialog.dialog("close");
- button.stop();
- };
-
- create();
-};
-
-$measure.mapbender(new MeasureApi(options));
Deleted: trunk/mapbender/http/plugins/mb_measure_widget.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_measure_widget.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_measure_widget.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,184 +0,0 @@
-/**
- * Package: measure_widget
- *
- * Description:
- * Measure module with jQuery UI widget factory and RaphaelJS
- *
- * Files:
- * - http/plugins/mb_measure_widget.js
- * - http/widgets/w_measure.js
- *
- * 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>','measure_widget',2,1,
- * > 'Measure','Measure distance','img',
- * > '../img/button_blink_red/measure_off.png','',515,60,24,24,1,'','','',
- * > '../plugins/mb_measure_widget.js',
- * > '../widgets/w_measure.js,../extensions/RaphaelJS/raphael-1.4.7.min.js',
- * > 'mapframe1','jq_ui_dialog,jq_ui_widget',
- * > 'http://www.mapbender.org/index.php/Measure');
- *
- * Help:
- * http://www.mapbender.org/Measure_widget
- *
- * Maintainer:
- * http://www.mapbender.org/User:Christoph_Baudson
- *
- * 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
- */
-
-var $measure = $(this);
-
-var MeasureApi = function (o) {
-
- var measureDialog,
- button,
- that = this,
- title = "Messung",
- defaultHtml = "<div title='" + title + "'>" +
- "<div class='mb-measure-text'>Fahren Sie mit der Maus über die Karte, um die Koordinaten anzuzeigen.<br> Klicken Sie, um eine Messung zu starten</div>" +
- "</div>",
- totalDistance,
- currentDistance,
- informationHtml =
- "<div>Letzter Punkt: <span class='mb-measure-clicked-point' /></div>" +
- "<div>Aktuelle Koordinaten: <span class='mb-measure-current-point' /></div>" +
- "<div>Distanz (zum letzten Punkt): <span class='mb-measure-distance-last' /> <span class='mb-measure-distance-last-unit' /></div>" +
- "<div>Distanz (gesamt): <span class='mb-measure-distance-total' /> <span class='mb-measure-distance-total-unit' /></div>" +
- "<div>Fläche: <span class='mb-measure-area' /> <span class='mb-measure-area-unit' /></div>" +
- "<a class='mb-measure-clear' href='#' title='Messung löschen'/>";
-
- var hideMeasureData = function () {
- measureDialog.find(".mb-measure-clicked-point").parent().hide();
-// measureDialog.find(".mb-measure-current-point").parent().hide();
- measureDialog.find(".mb-measure-distance-last").parent().hide();
- measureDialog.find(".mb-measure-distance-total").parent().hide();
- measureDialog.find(".mb-measure-area").parent().hide();
- };
-
- var changeDialogContent = function () {
- measureDialog.html(informationHtml);
- hideMeasureData();
- o.$target.unbind("mouseenter", changeDialogContent);
- };
-
- var create = function () {
- //
- // Initialise measure dialog
- //
- measureDialog = $(defaultHtml);
- measureDialog.dialog({
- autoOpen: false,
- position: [o.$target.offset().left, o.$target.offset().top]
- }).bind("dialogclose", function () {
- that.deactivate();
- });
-
- //
- // Initialise button
- //
- button = new Mapbender.Button({
- domElement: $measure.get(0),
- over: o.src.replace(/_off/, "_over"),
- on: o.src.replace(/_off/, "_on"),
- off: o.src,
- name: o.id,
- go: that.activate,
- stop: that.deactivate
- });
- };
-
- var updateCurrentPoint = function (evt, p) {
- measureDialog.find(".mb-measure-current-point").text(
- p.pos.x + " " + p.pos.y
- ).parent().show();
- };
-
- var updateClickedPoint = function (evt, p) {
- totalDistance = typeof totalDistance === "number" ? totalDistance + currentDistance : currentDistance;
-
- measureDialog.find(".mb-measure-clicked-point").text(
- p.pos.x + " " + p.pos.y
- ).parent().show();
- };
-
- var updateDistance = function (evt, dist) {
- if (typeof dist !== "number") {
- return;
- }
- var lastDistanceUnit = "m";
- currentDistance = dist;
- displayDistance = dist;
- if (displayDistance > 10000){
- displayDistance /= 1000;
- lastDistanceUnit = "km";
- }
- measureDialog.find(".mb-measure-distance-last-unit").html(lastDistanceUnit);
- measureDialog.find(".mb-measure-distance-last").text(Math.round(displayDistance*10)/10).parent().show();
-
- var totalDistanceUnit = "m";
- var displayTotalDistance = typeof totalDistance === "number" ? totalDistance + dist : dist;
- if (displayTotalDistance > 10000){
- displayTotalDistance = displayTotalDistance / 1000;
- totalDistanceUnit = "km";
- }
-
- measureDialog.find(".mb-measure-distance-total-unit").html(totalDistanceUnit);
- measureDialog.find(".mb-measure-distance-total").text(Math.round(displayTotalDistance*10)/10).parent().show();
- };
-
- var updateArea = function (evt, area) {
- if (area === null) {
- return;
- }
- var areaUnit = "m²";
- if (area > 10000000){
- area /= 1000000;
- areaUnit = "km²";
- }
- else if (area > 100000){
- area /= 10000;
- areaUnit = "ha";
- }
- area = Math.round(area*10)/10;
-
- measureDialog.find(".mb-measure-area-unit").html(areaUnit);
- measureDialog.find(".mb-measure-area").text(area).parent().show();
- };
-
- this.activate = function () {
- if (o.$target.size() > 0) {
- o.$target
- .mb_measure()
- .bind("mb_measurepointadded", updateClickedPoint)
- .bind("mb_measureonmeasure", updateCurrentPoint)
- .bind("mb_measureonmeasuredistance", updateDistance)
- .bind("mb_measureonmeasurearea", updateArea)
- .bind("mouseenter", changeDialogContent);
- }
-
- measureDialog.dialog("open");
- };
-
- this.deactivate = function () {
- if (o.$target.size() > 0) {
- o.$target.mb_measure("destroy");
- }
-
- hideMeasureData();
-
- if (measureDialog.dialog("isOpen")) {
- measureDialog.dialog("close");
- }
- };
-
- create();
-};
-
-$measure.mapbender(new MeasureApi(options));
Deleted: trunk/mapbender/http/plugins/mb_print.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_print.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_print.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,565 +0,0 @@
-/**
- * Package: printPDF
- *
- * Description:
- * Mapbender print PDF with PDF templates module.
- *
- * Files:
- * - http/plugins/mb_print.php
- * - http/print/classes
- * - http/print/printFactory.php
- * - http/print/printPDF_download.php
- * - lib/printbox.js
- *
- * 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>','printPDF',
- * > 2,1,'pdf print','Print','div','','',1,1,2,2,5,'',
- * > '<div id="printPDF_working_bg"></div><div id="printPDF_working"><img src="../img/indicator_wheel.gif" style="padding:10px 0 0 10px">Generating PDF</div><div id="printPDF_input"><form id="printPDF_form" action="../print/printFactory.php"><div id="printPDF_selector"></div><div class="print_option"><input type="hidden" id="map_url" name="map_url" value=""/><input type="hidden" id="legend_url" name="legend_url" value=""/><input type="hidden" id="overview_url" name="overview_url" value=""/><input type="hidden" id="map_scale" name="map_scale" value=""/><input type="hidden" name="measured_x_values" /><input type="hidden" name="measured_y_values" /><br /></div><div class="print_option" id="printPDF_formsubmit"><input id="submit" type="submit" value="Print"><br /></div></form><div id="printPDF_result"></div></div>',
- * > 'div','../plugins/mb_print.php',
- * > '../../lib/printbox.js,../extensions/jquery-ui-1.7.2.custom/development-bundle/external/bgiframe/jquery.bgiframe.min.js,../extensions/jquery.form.min.js',
- * > 'mapframe1','','http://www.mapbender.org/index.php/Print');
- * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
- * > var_value, context, var_type) VALUES('<appId>', 'printPDF',
- * > 'mbPrintConfig', '{"Standard": "mapbender_template.json"}', '' ,'var');
- * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
- * > var_value, context, var_type) VALUES('<appId>', 'body',
- * > 'print_css', '../css/print_div.css', '' ,'file/css');
- *
- * Help:
- * http://www.mapbender.org/PrintPDF_with_template
- *
- * Maintainer:
- * http://www.mapbender.org/User:Michael_Schulz
- * http://www.mapbender.org/User:Christoph_Baudson
- *
- * Parameters:
- * mbPrintConfig - *[optional]* object with name and filename of template,
- * like {
- * "Standard": "a_template.json",
- * "Different": "another_template.json"
- * }
- *
- * 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
- */
-
-var myTarget = options.target ? options.target[0] : "mapframe1";
-var myId = options ? options.id : "printPDF";
-
-var mbPrintConfig = options.mbPrintConfig;
-
-/* the array of json print config files */
-
-if (typeof mbPrintConfig === "object") {
- mbPrintConfigFilenames = [];
- mbPrintConfigTitles = [];
- for (var i in mbPrintConfig) {
- mbPrintConfigFilenames.push(mbPrintConfig[i]);
- mbPrintConfigTitles.push(i);
- }
-}
-if (typeof mbPrintConfigFilenames === "undefined") {
- mbPrintConfigFilenames = ["mapbender_template.json"];
-}
-
-if (typeof mbPrintConfigTitles === "undefined") {
- mbPrintConfigTitles = ["Default"];
-}
-
-
-var mbPrintConfigPath = "../print/";
-
-
-/* ------------- printbox addition ------------- */
-
-var PrintPDF = function (options) {
-
- var that = this;
-
- /**
- * Property: actualConfig
- *
- * object, holds the actual configuration after loading the json file
- */
- var actualConfig;
-
- /**
- * constructor
- */
- eventInit.register(function () {
- mod_printPDF_init();
- });
-
- /**
- * Property: printBox
- *
- * the movable printframe
- */
- var printBox = null;
-
- eventAfterMapRequest.register(function () {
- if (printBox !== null) {
- printBox.repaint();
- }
- });
- /**
- * Method: createPrintBox
- *
- * creates a printBox in the current view, calculates the scale
- * (tbd. if not set from the config) so that the printbox fits in the mapframe.
- * Width and height are taken from the configuration.
- */
- this.createPrintBox = function () {
- size = "A4";
- //document.form1.size.value = size;
- format = "portrait";
- var w, h;
- //validate();
- var map = getMapObjByName(myTarget);
- var map_el = map.getDomElement();
- var jqForm = $("#"+myId+"_form");
- var $scaleInput = $("#scale");
-
- if (printBox !== null) {
- printBox.destroy();
- printBox = null;
- jqForm[0].scale.value = "";
- jqForm[0].coordinates.value = "";
- jqForm[0].angle.value = "";
- }
- else {
- printBox = new Mapbender.PrintBox({
- target : myTarget,
- printWidth : getPDFMapSize("width")/10,
- printHeight : getPDFMapSize("height")/10,
- scale : $scaleInput.size() > 0 && !isNaN(parseInt($scaleInput.val(), 10)) ?
- parseInt($scaleInput.val(), 10) :
- Math.pow(10, Math.floor(Math.log(map.getScale())/Math.LN10)),
- afterChangeAngle : function (obj) {
- if (typeof(obj) == "object") {
- if (typeof(obj.angle) == "number") {
- jqForm[0].angle.value = obj.angle;
- }
- if (obj.coordinates) {
- jqForm[0].coordinates.value = String(obj.coordinates);
- }
- }
- },
- afterChangeSize : function (obj) {
- if (typeof(obj) == "object") {
- if (obj.scale) {
- jqForm[0].scale.value = parseInt(obj.scale / 10, 10) * 10;
- }
- if (obj.coordinates) {
- jqForm[0].coordinates.value = String(obj.coordinates);
- }
- }
- }
- });
- printBox.paintPoints();
- printBox.paintBox();
-
- }
- };
-
- /**
- * Method: getPDFMapSize
- *
- * checks the actual config for the size w/h values.
- *
- * Parameters:
- * key - string, the key which value to retrieve (currently width or height)
- */
- var getPDFMapSize = function (key) {
- for (var page in actualConfig.pages) {
- for (var pageElement in actualConfig.pages[page].elements) {
- if (actualConfig.pages[page].elements[pageElement].type == "map") {
- return actualConfig.pages[page].elements[pageElement][key];
- }
- }
- }
- };
-
- /**
- * Method: destroyPrintBox
- *
- * removes an existing printBox.
- */
- var destroyPrintBox = function () {
- if (printBox) {
- printBox.destroy();
- }
- };
-
- /**
- * Method: mod_printPDF_init
- *
- * initializes the print modules, generates template chooser and loads first configuration.
- */
- var mod_printPDF_init = function () {
- /* first we'd need to build the configuration selection */
- buildConfigSelector();
- /* second we'd need to read the json configuration */
- that.loadConfig(mbPrintConfigFilenames[0]);
- };
-
- /**
- * Method: loadConfig
- *
- * GETs the config, build corresponding form, remove an existing printBox
- */
- this.loadConfig = function (configFilename, callback) {
- $.get(mbPrintConfigPath + configFilename, function(json, status){
- actualConfig = $.parseJSON(json);
- buildForm();
- hookForm();
- if (typeof callback === "function") {
- printBox = null;
- callback();
- }
- });
- destroyPrintBox();
- };
-
- /**
- * Method: hookForm
- *
- * utility method to connect the form plugin to the print form.
- */
- var hookForm = function () {
- var o = {
- url: '../print/printFactory.php',
- type: 'post',
- dataType: 'json',
- beforeSubmit: validate,
- success: showResult
- };
- $("#"+myId+"_form").ajaxForm(o);
- };
-
- /**
- * Change status of the working elements. These should begin with "$myId_working"
- *
- * @param {String} newStatus either "hide or "show"
- */
- var showHideWorking = function (newStatus) {
- if (newStatus=="hide") {
- $("[id^='"+myId+"_working']").hide();
- }
- else {
- $("[id^='"+myId+"_working']").show();
- }
- };
-
- /**
- * update form values helper function
- *
- */
- var updateFormField = function (formData, key, value) {
- for(var j=0; j < formData.length; j++){
- if (formData[j].name == key) {
- formData[j].value = value;
- break;
- }
- }
- };
-
- var getCurrentResolution = function (type) {
-
- // default resolution is 72 dpi
- var dpi = 72;
-
- // set resolution according to map configuration in template
- for (var i in actualConfig.pages) {
- var page = actualConfig.pages[i];
- for (var j in page.elements) {
- var el = page.elements[j];
- if (type === el.type && typeof el.res_dpi === "number") {
- dpi = el.res_dpi;
- }
- }
- }
- // set resolution according to resolution select box (if present)
-
- // check if hq print is requested
- var resolutionControl = null;
- for (var i in actualConfig.controls) {
- var c = actualConfig.controls[i];
- try {
- for (var j in c.pageElementsLink) {
- if (c.pageElementsLink[j] === "res_dpi") {
- resolutionControl = typeof c.id === "string" &&
- c.id.length > 0 ? $("#" + c.id) : null;
- }
- }
- }
- catch (e) {
- }
- }
- if (resolutionControl !== null && resolutionControl.size() === 1) {
- dpi = resolutionControl.val();
- }
- return parseInt(dpi, 10);
- };
-
- var replaceMapFileForHighQualityPrint = function (currentMapUrl, type) {
- var dpi = getCurrentResolution(type);
- // replace map file with hq map file (if configured)
- var hqmapfiles = $.isArray(options.highqualitymapfiles) ?
- options.highqualitymapfiles : [];
- for (var i = 0; i < hqmapfiles.length; i++) {
- var exp = new RegExp(hqmapfiles[i].pattern);
- if (hqmapfiles[i].pattern && typeof currentMapUrl === "string" && currentMapUrl.match(exp)) {
- // check if mapping in current resolution exists
- var resolutions = hqmapfiles[i].replacement;
- var resolutionExists = false;
- for (var r in resolutions) {
- if (parseInt(r, 10) === dpi) {
- resolutionExists = true;
- }
- }
- if (resolutionExists) {
- // replace with hqmapfile
- var hqmapfile = resolutions[dpi];
- currentMapUrl = currentMapUrl.replace(exp, hqmapfile);
- }
- }
- }
- return currentMapUrl;
- };
-
- /**
- * Validates and updates form data values.
- * Adds the elements before the submit button.
- *
- * @see jquery.forms#beforeSubmitHandler
- */
- var validate = function (formData, jqForm, params) {
- showHideWorking("show");
-
- // map urls
- var ind = getMapObjIndexByName(myTarget);
- var f = jqForm[0];
- f.map_url.value = '';
-
- var scale = f.scale.value || mb_mapObj[ind].getScale();
- scale = parseInt(scale, 10);
-
- var legendUrlArray = [];
- f.overview_url.value = '';
- for(var i=0; i < mb_mapObj[ind].wms.length; i++){
- var currentWms = mb_mapObj[ind].wms[i];
- if(mb_mapObj[ind].wms[i].gui_wms_visible > 0){
- if (mb_mapObj[ind].wms[i].mapURL != false && mb_mapObj[ind].wms[i].mapURL != 'false' && mb_mapObj[ind].wms[i].mapURL != ''){
- if(f.map_url.value != ""){
- f.map_url.value += '___';
- }
- var currentMapUrl = mb_mapObj[ind].getMapUrl(i, mb_mapObj[ind].getExtentInfos(), scale);
-
- currentMapUrl = replaceMapFileForHighQualityPrint(currentMapUrl, "map");
- f.map_url.value += currentMapUrl
-
- var wmsLegendObj = [];
-
- var layers = currentWms.getLayers(mb_mapObj[ind], scale);
- for (var j = 0; j < layers.length; j++) {
- var currentLayer = currentWms.getLayerByLayerName(layers[j]);
- // TODO: add only visible layers
- var isVisible = (currentLayer.gui_layer_visible === 1);
- var hasNoChildren = (!currentLayer.has_childs);
- if (isVisible && hasNoChildren){
- var layerLegendObj = {};
- layerLegendObj.name = currentLayer.layer_name;
- layerLegendObj.title = currentWms.getTitleByLayerName(currentLayer.layer_name);
- var layerStyle = currentWms.getCurrentStyleByLayerName(currentLayer.layer_name);
- if (layerStyle === false) {
- layerStyle = "default";
- }
- layerLegendObj.legendUrl = currentWms.getLegendUrlByGuiLayerStyle(currentLayer.layer_name, layerStyle);
- if (layerLegendObj.legendUrl !== false) {
- wmsLegendObj.push(layerLegendObj);
- }
- }
- }
- if (wmsLegendObj.length > 0) {
- var tmpObj = {};
- tmpObj[currentWms.wms_currentTitle] = wmsLegendObj;
- legendUrlArray.push(tmpObj);
- }
- }
- }
- }
- updateFormField(formData, "legend_url", $.toJSON(legendUrlArray));
- updateFormField(formData, "map_url", f.map_url.value);
- updateFormField(formData, "scale", scale);
-
- //overview_url
- var ind_overview = getMapObjIndexByName('overview');
- if(mb_mapObj[ind_overview].mapURL != false ){
- var overviewUrl = mb_mapObj[ind_overview].mapURL;
- overviewUrl = $.isArray(overviewUrl) ? overviewUrl[0] : overviewUrl;
-
- f.overview_url.value = replaceMapFileForHighQualityPrint(overviewUrl, "overview");
-
- updateFormField(formData, "overview_url", f.overview_url.value);
- }
-
- updateFormField(formData, "map_scale", mb_getScale(myTarget));
- // write the measured coordinates
- if (typeof(mod_measure_RX) !== "undefined") {
- var tmp_x = '';
- var tmp_y = '';
- for(i = 0; i < mod_measure_RX.length; i++) {
- if(tmp_x != '') {
- tmp_x += ',';
- }
- tmp_x += mod_measure_RX[i];
- }
- for(i = 0; i < mod_measure_RY.length; i++) {
- if(tmp_y != '') {
- tmp_y += ',';
- }
- tmp_y += mod_measure_RY[i];
- }
- updateFormField(formData, "measured_x_values", tmp_x);
- updateFormField(formData, "measured_y_values", tmp_y);
- }
-
-
- if (f.map_url.value!="") {
- //return true;
- } else {
- showHideWorking("hide");
- return false;
- }
- };
-
- /**
- * Method: showResult
- *
- * load the generated PDF from the returned URL as an attachment,
- * that triggers a download popup or is displayed in PDF plugin.
- */
- var showResult = function (res, text) {
- if (text == 'success') {
- var $downloadFrame = $("#" + myId + "_frame");
- if ($downloadFrame.size() === 0) {
- $downloadFrame = $(
- "<iframe id='" + myId + "_frame' name='" +
- myId + "_frame' width='0' height='0' style='display:none'></iframe>"
- ).appendTo("body");
- }
- if ($.browser.msie && $.browser.version === "6.0") {
- var newWin = window.open(stripslashes(res.outputFileName), "Druckausgabe", "width=200,height=200,left=700,top=200,resizable=yes");
- }
- else {
- window.frames[myId + "_frame"].location.href =
- stripslashes(res.outputFileName);
- }
- showHideWorking("hide");
- }
- else {
- /* something went wrong */
- $("#"+myId+"_result").html(text);
- }
- };
-
- /**
- * Generates form elements as specified in the config controls object.
- * Adds the elements before the submit button.
- *
- * @param {Object} json the config object in json
- */
- var buildForm = function () {
- $(".print_option_dyn").remove();
- var str = "";
- for (var item in actualConfig.controls) {
- var element = actualConfig.controls[item];
- var element_id = myId + "_" + element.id;
- if (element.type != "hidden") {
- str += '<div class="print_option_dyn">\n';
- str += '<label class="print_label" for="'+element.id+'">'+element.label+'</label>\n';
- } else {
- str += '<div class="print_option_dyn" style="display:none;">\n';
- }
- switch (element.type) {
- case "text":
- str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'" size="'+element.size+'"><br>\n';
- break;
- case "hidden":
- str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'">\n';
- break;
- case "textarea":
- str += '<textarea id="'+element.id+'" name="'+element.id+'" size="'+element.size+'"></textarea><br>\n';
- break;
- case "select":
- str += '<select id="'+element.id+'" name="'+element.id+'" size="1">\n';
- for (var option_index in element.options) {
- option = element.options[option_index];
- str += '<option value="'+option.value+'">'+option.label+'</option>\n';
- }
- str += '</select><br>\n';
- break;
- }
- str += '</div>\n';
- }
- if (str) {
- $("#" + myId + "_formsubmit").before(str);
- $("#scale").keydown(function (e) {
- if (e.keyCode !== 13) {
- return;
- }
- var scale = parseInt(this.value, 10);
- if (isNaN(scale) || typeof printBox === "undefined") {
- return false;
- }
- printBox.setScale(scale);
- return false;
- });
- }
- };
-
- /**
- * Generates the configuration select element from the gui element vars
- * mbPrintConfigFilenames and mbPrintConfigTitles
- */
- var buildConfigSelector = function () {
- var str = "";
- str += '<label class="print_label" for="printPDF_template">Vorlage</label>\n';
- str += '<select id="printPDF_template" name="printPDF_template" size="1">\n';
- for (var i = 0; i < mbPrintConfigFilenames.length; i++) {
- str += '<option value="'+mbPrintConfigFilenames[i]+'">'+mbPrintConfigTitles[i]+'</option>\n';
- }
- str += '</select><img id="printPDF_handle" src="../print/img/shape_handles.png" title="Use printbox">\n';
- if (str) {
- $("#printPDF_selector").append(str).find("#printPDF_template").change(function () {
- printObj.loadConfig(mbPrintConfigFilenames[this.selectedIndex], function () {
- printObj.createPrintBox()
- });
- });
- $("#printPDF_handle").click(function () {
- printObj.createPrintBox();
- });
- $("#printPDF_working").bgiframe({
- src: "BLOCKED SCRIPT'<html></html>';",
- width: 200,
- height: 200
- });
- }
- };
-
- var stripslashes = function ( str ) {
- return (str+'').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1');
- };
-
-};
-
-var printObj = new PrintPDF(options);
Deleted: trunk/mapbender/http/plugins/mb_twitter.php_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter.php_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_twitter.php_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,130 +0,0 @@
-<?php
-# 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__) . "/../../core/globalSettings.php";
-require_once '../extensions/epicode/EpiCurl.php';
-require_once '../extensions/epicode/EpiOAuth.php';
-require_once '../extensions/epicode/EpiTwitter.php';
-
-$gui_id = Mapbender::session()->get("mb_user_gui");
-$e_id = "twitter_signin";
-
-require_once '../include/dyn_php.php';
-
-$ajaxResponse = new AjaxResponse($_POST);
-
-if (!isset($consumerKey) || !isset($consumerSecret)) {
- $ajaxResponse->setSuccess(false);
- $ajaxResponse->setMessage(_mb("Element vars consumerKey and consumerSecret are not set. If you don't have them, get them from Twitter."));
- $ajaxResponse->send();
-}
-
-function isSignedIn ($token = null) {
- global $Twitter;
-
- if (!is_null($token)) {
- try {
- $Twitter->setToken($token);
- $accessToken = $Twitter->getAccessToken();
- Mapbender::session()->set("twitter_token", $accessToken->oauth_token);
- Mapbender::session()->set("twitter_token_secret", $accessToken->oauth_token_secret);
- }
- catch (Exception $e) {
- Mapbender::session()->delete("twitter_token");
- Mapbender::session()->delete("twitter_token_secret");
- return false;
- }
- }
-
- if (Mapbender::session()->exists("twitter_token") && Mapbender::session()->exists("twitter_token_secret")) {
- $Twitter->setToken(
- Mapbender::session()->get("twitter_token"),
- Mapbender::session()->get("twitter_token_secret")
- );
- new mb_exception("token: " . Mapbender::session()->get("twitter_token"));
- new mb_exception("token_secret: " . Mapbender::session()->get("twitter_token_secret"));
- return true;
-
- }
- return false;
-}
-
-$Twitter = new EpiTwitter($consumerKey, $consumerSecret);
-
-switch ($ajaxResponse->getMethod()) {
- case "isSignedIn" :
- $token = $ajaxResponse->getParameter("token");
-
- if (isSignedIn($token)) {
- $ajaxResponse->setResult(array("signedIn" => true));
- $ajaxResponse->setMessage(_mb("Signed in."));
- $ajaxResponse->send();
- }
-
- $ajaxResponse->setResult(array("signedIn" => false));
- $ajaxResponse->setMessage(_mb("Not signed in."));
- $ajaxResponse->setSuccess(true);
- break;
-
- case "signin" :
- try {
- $url = $Twitter->getAuthenticateUrl();
- }
- catch (Exception $e) {
- $ajaxResponse->setSuccess(false);
- $ajaxResponse->setMessage(_mb("Could not connect to Twitter."));
- $ajaxResponse->send();
- }
-
- $ajaxResponse->setResult(array("url" => $url));
- $ajaxResponse->setSuccess(true);
- break;
-
- case "signout" :
- Mapbender::session()->delete("twitter_token");
- Mapbender::session()->delete("twitter_token_secret");
-
- $ajaxResponse->setResult(array("signedOut" => true));
- $ajaxResponse->setMessage(_mb("Signed out."));
- $ajaxResponse->setSuccess(true);
- break;
-
- case "update":
- if (!isSignedIn()) {
- $ajaxResponse->setResult(array("signedIn" => false));
- $ajaxResponse->setMessage(_mb("Not signed in."));
- $ajaxResponse->setSuccess(true);
- $ajaxResponse->send();
- }
- $Twitter = new EpiTwitter($consumerKey, $consumerSecret);
- $status = $ajaxResponse->getParameter("status");
- $lat = $ajaxResponse->getParameter("lat");
- $lon = $ajaxResponse->getParameter("lon");
- try {
- $newStatus = $Twitter->post_statusesUpdate(array(
- 'status' => $text,
- 'lat' => $lat,
- 'long' => $long
- ));
- }
- catch (Exception $e) {
- $ajaxResponse->setSuccess(false);
- $ajaxResponse->setMessage(_mb("Could not connect to Twitter."));
- $ajaxResponse->send();
- }
- $ajaxResponse->setResult(array(
- "res" => serialize($newStatus)
- ));
- $ajaxResponse->setSuccess(true);
- break;
- default:
- $ajaxResponse->setSuccess(false);
- $ajaxResponse->setMessage(_mb("An unknown error occured."));
- break;
-}
-$ajaxResponse->send();
-?>
Deleted: trunk/mapbender/http/plugins/mb_twitter_signin.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter_signin.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_twitter_signin.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,171 +0,0 @@
-/**
- * Package: twitter_signin
- *
- * Description:
- * Authenticate with Twitter
- *
- * Files:
- * - http/plugins/mb_twitter_signin.js
- *
- * 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>','twitter_signin',
- * > 1,1,'Authenticate with Twitter','Authenticate with Twitter','img',
- * > '../img/twitter_signin.png','',900,10,NULL ,NULL ,NULL ,'','','',
- * > '../plugins/mb_twitter_signin.js','','','','');
- * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
- * > var_value, context, var_type) VALUES('<appId>', 'twitter_signin',
- * > 'consumerKey', '<your key>', '' ,'php_var');
- * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
- * > var_value, context, var_type) VALUES('<appId>', 'twitter_signin',
- * > 'consumerSecret', '<your secret>',
- * > '' ,'php_var');
- *
- * Help:
- * http://www.mapbender.org/Twitter_signin
- *
- * Maintainer:
- * http://www.mapbender.org/User:Christoph_Baudson
- *
- * Parameters:
- * consumerKey - your consumer key from Twitter (PHP var)
- * consumerSecret - your consumer secret from Twitter (PHP var)
- *
- * 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
- */
-
-var $this = $(this);
-
-var originalI18nObject = {
- "logIn" : "Log in at Twitter",
- "logOut" : "Log out at Twitter"
-};
-
-var translatedI18nObject = Mapbender.cloneObject(originalI18nObject);
-
-
-var TwitterSignin = function (options) {
- var that = this;
- this.isSignedIn = function () {
- var req = new Mapbender.Ajax.Request({
- url: "../plugins/mb_twitter.php",
- method: "isSignedIn",
- parameters: {
- token: getOauthToken()
- },
- callback: function (obj, result, message) {
- if (!result) {
- alert(message);
- $this.text(translatedI18nObject.logIn);
- return;
- }
- if (obj.signedIn) {
- alert(message);
- $this.text(translatedI18nObject.logOut);
- $this.mapbender(function () {
- this.signedIn = true;
- this.events.signedIn.trigger();
- });
- }
- else {
- $this.text(translatedI18nObject.logIn);
- $this.mapbender(function () {
- this.signedIn = false;
- this.events.signedOut.trigger();
- });
- }
- }
- });
- req.send();
-
- };
-
- this.signedIn = false;
-
- this.events = {
- signedIn: new Mapbender.Event(),
- signedOut: new Mapbender.Event()
- };
- var getOauthToken = function () {
- var getString = document.location.search.substr(1,document.location.search.length);
- if (getString === '') {
- return null;
- }
-
- var gArr = getString.split('&');
- for (i = 0; i < gArr.length; ++i) {
- var v = '';
- vArr = gArr[i].split('=');
- if (vArr.length > 1) {
- v = vArr[1];
- }
- var key = unescape(vArr[0]);
- if (key === "oauth_token") {
- return unescape(v);
- }
- }
- return null;
- };
-
- $this.click(function () {
-
- var method = that.signedIn ? "signout" : "signin";
- var req = new Mapbender.Ajax.Request({
- url: "../plugins/mb_twitter.php",
- method: method,
- parameters: {
- },
- callback: function (obj, result, message) {
- if (!result) {
- alert(message);
- return;
- }
-
- if (method === "signin" && obj.url && typeof obj.url === "string") {
- window.location.href = obj.url;
- }
- else if (method === "signout") {
- var newUrl = window.location.href.replace(/oauth_token\=[0-9a-zA-Z]+/g, "");
- window.location.href = newUrl;
-
- }
- }
- });
- req.send();
- });
-
-};
-
-$this.mapbender(new TwitterSignin());
-
-Mapbender.events.init.register(function () {
- // check if signed in
- $this.mapbender(function () {
- this.isSignedIn();
- });
-
- Mapbender.events.localize.register(function () {
- Mapbender.modules.i18n.queue(options.id, originalI18nObj, function (translatedObj) {
- if (typeof translatedObj !== "object") {
- return;
- }
- translatedI18nObj = translatedObj;
- try {
- $this.mapbender(function () {
- this.isSignedIn();
- });
- }
- catch (exc) {
- new Mb_warning("Error when translating: " . exc.message);
- }
- });
- });
-});
Deleted: trunk/mapbender/http/plugins/mb_twitter_update.js_deprecated
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter_update.js_deprecated 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mb_twitter_update.js_deprecated 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,116 +0,0 @@
-$twitterUpdate = $(this);
-var that = this;
-
-Mapbender.events.beforeInit.register(function () {
- var signIn = Mapbender.modules.twitter_signin;
- if (signIn !== undefined) {
- signIn.events.signedIn.register(function () {
- $twitterUpdate.fadeIn();
- });
- signIn.events.signedOut.register(function () {
- $twitterUpdate.fadeOut();
- });
- }
-});
-Mapbender.events.init.register(function () {
-
- var updateStatus = function (status, lat, lon, callback) {
- var req = new Mapbender.Ajax.Request({
- url: "../plugins/mb_twitter.php",
- method: "update",
- parameters: {
- status: status,
- lat: lat,
- lon: lon
- },
- callback: function (obj, result, message) {
- if (!result) {
- alert(message);
- return;
- }
-
- if (typeof callback === "function") {
- callback();
- }
- alert("Updated");
- new Mapbender.Notice($.toJSON(obj));
- }
- });
- req.send();
- };
-
- var button = new Mapbender.Button({
- domElement: that,
- over: options.src.replace(/_off/, "_over"),
- on: options.src.replace(/_off/, "_on"),
- off: options.src,
- name: options.id,
- go: function () {
- options.$target.each(function () {
- var $twitterStatus, m;
- var cancel = function () {
-
- $twitterStatus.fadeOut("slow", function () {
- m.remove();
- $(this).remove();
- });
- };
- $(this).mapbender(function () {
- this.events.afterMapRequest.register(cancel);
- });
- $(this).css("cursor", "pointer")
- .mousedown(function (e) {
- mb_disableThisButton(options.id);
- var map = $(this).mapbender();
- var height = map.getHeight();
- var width = map.getWidth();
- var offset = 10;
-
- var pix = map.getMousePosition(e);
- var p = map.convertPixelToReal(pix);
- m = new Mapbender.Marker(p, map);
-
- $twitterStatus = $("<div style='z-index:999;position:absolute;top:" +
- (pix.y + parseInt(this.style.top, 10)) + "px;" +
- "left:" + (offset + parseInt(this.style.left, 10)) + "px;width:"+(width-2*offset)+"px;display:none'>" +
- "<div style='width:100%;height:10px;background-position:" + (pix.x-offset-10) + "px 0px;background-image:url(http://s.twimg.com/a/1266605807/images/arr2.gif);background-repeat:no-repeat;'/>" +
- "<div style='background-color:#fff;height:110px;padding:8px;'>" +
- "<div>What's happening?<span class='chars-left' style='float:right'>140</span></div>" +
- "<textarea rows='2' cols='70'></textarea>" +
- "<br><span style='float:right;margin:10px;'>" +
- "<span id='twitter_update_send' style='cursor:pointer;margin:5px;padding:5px;' " +
- "class='ui-state-default ui-corner-all'>update</span>" +
- "<a id='twitter_cancel' href='#'>cancel</a></span>" +
- "</div></div>").appendTo("body").fadeIn("slow");
- var $charsLeft = $("span.chars-left", $twitterStatus);
- var $textarea = $("textarea", $twitterStatus);
- $textarea.focus().keypress(function () {
- var chars = $textarea.val().length;
- var avail = 140 - chars;
- $charsLeft.text(avail);
- });
- var $button = $("#twitter_update_send");
- $button.click(function () {
- $twitterStatus.fadeOut("slow", function () {
- m.remove();
- });
- // show sandclock
- updateStatus($textarea.val(), p.y, p.x, function () {
- // hide sandclock
- });
- });
- var $cancel = $("#twitter_cancel");
- $cancel.click(function () {
- return cancel();
- });
- return false;
- });
- });
- },
- stop: function () {
- options.$target.each(function () {
- $(this).css("cursor", "default").unbind("mousedown");
- });
- }
- });
-});
Deleted: trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer.php.old
===================================================================
--- trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer.php.old 2016-05-27 07:16:01 UTC (rev 9488)
+++ trunk/mapbender/http/plugins/mod_jsonAutocompleteGazetteer.php.old 2016-05-27 07:19:06 UTC (rev 9489)
@@ -1,306 +0,0 @@
-<?php
-/** ENWICKLUNGSumgebung
- * Package: mod_jsonAutocompleteGazetteer
- *
- * Description:
- * This module is a client for a json gazetteer webservice as used by http://www.geonames.org. The default
- * service is the service from geonames.org which allows searching for
- *
- *
- * Files:
- * - http/plugins/mod_jsonAutocompleteGazetteer.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('<app_id>','jq_ui_autocomplete',5,1,
- * > 'Module to manage jQuery UI autocomplete module','','div','','',-1,-1,15,15,NULL ,'','','div',
- * > '','../extensions/jquery-ui-1.8.16.custom/development-bundle/ui/jquery.ui.autocomplete.js',
- * > '','jq_ui,jq_ui_widget,jq_ui_position','');
- * >
- * > 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('<app_id>',
- * > 'jsonAutocompleteGazetteer',12,1,'Client for json webservices like geonames.org','Gazetteer',
- * > 'div','','',230,30,NULL ,NULL ,999,'','','div','../plugins/mod_jsonAutocompleteGazetteer.php',
- * > '','mapframe1','','http://www.mapbender.org/index.php/mod_jsonAutocompleteGazetteer');
- * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type)
- * > VALUES('<app_id>', 'jsonAutocompleteGazetteer', 'gazetteerUrl', 'http://www.geoportal.rlp.de/mapbender/geoportal/gaz_geom_mobile.php',
- * > '' ,'var');
- * >
- * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type)
- * > VALUES('<app_id>', 'jsonAutocompleteGazetteer', 'isGeonames', 'true', '' ,'var');
- * >
- * Help:
- * http://www.mapbender.org/mod_jsonAutocompleteGazetteer
- *
- * Maintainer:
- * http://www.mapbender.org/User:Armin_Retterath
- *
- * Parameters:
- * none
- *
- *
- * 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__)."/../php/mb_validateSession.php");
-?>
-var standingHighlight = null;
-Mapbender.events.afterMapRequest.register( function(){
- if(standingHighlight){
- standingHighlight.paint();
- }
-});
-
-//initialize modul
-if (options.gazetteerUrl === undefined) {
- options.gazetteerUrl = 'http://10.176.178.10/mapbender/geoportal/gaz_geom_mobile.php';
-}
-if (options.isGeonames === undefined) {
- options.isGeonames = true;
-}
-if (options.latLonZoomExtension === undefined) {
- options.latLonZoomExtension = 0.1;
-}
-if (options.minLength === undefined) {
- options.minLength = 3;
-}
-if (options.delay === undefined) {
- options.delay = 400;
-}
-if (options.isDraggable === undefined) {
- options.isDraggable = true;
-}
-if (options.maxResults === undefined) {
- options.maxResults = 15;
-}
-if (options.inputWidth === undefined) {
- options.inputWidth = 250;
-}
-if (options.searchEpsg === undefined) {
- options.searchEpsg = "25832";
-}
-if (options.drawCentrePoint === undefined) {
- options.drawCentrePoint = true;
-}
-if (options.gazetteerFrontImageOn === undefined) {
- options.gazetteerFrontImageOn = "../img/button_blue_red/gazetteer3_on.png";
-}
-if (options.gazetteerFrontImageOff === undefined) {
- options.gazetteerFrontImageOff = "../img/button_blue_red/gazetteer3_off.png";
-}
-if (options.helpText === undefined) {
- options.helpText = "";
-}
-
-var JsonAutocompleteGazetteer = function() {
- var that = this;
- var targetName = options.target;
- var ind = getMapObjIndexByName(targetName);
- var my = mb_mapObj[ind];
-
- this.zoomToExtent = function(fromSrs,minx,miny,maxx,maxy) {
- var parameters = {
- fromSrs: fromSrs,
- toSrs: Mapbender.modules[targetName].epsg
- };
-
- parameters.bbox = parseFloat(minx)+ "," +parseFloat(miny)+ "," +parseFloat(maxx)+ "," +parseFloat(maxy);
-
- //function to transform from one crs to another
- var req = new Mapbender.Ajax.Request({
- url: "../php/mod_coordsLookup_server.php",
- method: "transform",
- parameters: parameters,
- callback: function (obj, success, message) {
- if (!success) {
- new Mapbender.Exception(message);
- return;
- }
- if (options.drawCentrePoint) {
- //generate layer for visualization of point
- if(standingHighlight !== null){
- standingHighlight.clean();
- }else{
- standingHighlight = new Highlight(
- [options.target],
- "standingHighlight",
- {"position":"absolute", "top":"0px", "left":"0px", "z-index":999},
- 2);
- }
- var point0 = new Point(obj.points[0].x,obj.points[0].y);
- var point1 = new Point(obj.points[1].x,obj.points[1].y);
- var x = point0.x + (point1.x - point0.x)/2;
- var y = point0.y + (point1.y - point0.y)/2;
- var point = new Point(x,y);
- var ga = new GeometryArray();
- ga.importPoint({
- coordinates:[x,y,null]
- },Mapbender.modules[targetName].epsg)
- var m = ga.get(-1,-1);
- standingHighlight.add(m, "#ff0000");
- //alert(m);
- standingHighlight.paint();
- }
- if (obj.points) {
- if (obj.points.length === 2) {
- var newExtent = new Extent(
- obj.points[0].x,
- obj.points[0].y,
- obj.points[1].x,
- obj.points[1].y
- );
- my.calculateExtent(newExtent);
- }
- my.setMapRequest();
- }
- }
- });
- req.send();
- };
- this.showSearchHelp = function(){
-
-
- }
- this.toggleInput = function(){
- if ($("#geographicName").css("display") == 'none') {
- $("#geographicName").show();
- $("#helpSymbolId").show();
- $("#symboldForInputId").attr({'src':options.gazetteerFrontImageOn});
- } else {
- $("#geographicName").hide();
- $("#helpSymbolId").hide();
- $("#symboldForInputId").attr({'src':options.gazetteerFrontImageOff});
- }
- }
-
- this.initForm = function() {
- epsg = Mapbender.modules[targetName].epsg.replace('EPSG:', '');
- this.formContainer = $(document.createElement('form')).attr({'id':'json-autocomplete-gazetteer'}).appendTo('#' + options.id);
- this.formContainer.submit(function() {
- return false;
- });
- if (options.isDraggable){
- //this.formContainer.draggable();//problem with print module
- }
- this.symbolForInput = $(document.createElement('img')).appendTo(this.formContainer);
- this.symbolForInput.attr({'id':'symboldForInputId'});
- this.symbolForInput.attr({'src':options.gazetteerFrontImageOn});
- this.symbolForInput.attr({'title':'<?php echo _mb('Address'); ?>'});
- $("#symboldForInputId").click(function() {
- that.toggleInput();
- });
- this.inputAddress = $(document.createElement('input')).appendTo(this.formContainer);
-
- //do the following things only if
- if (options.helpText != '') {
- this.helpSymbol = $(document.createElement('img')).appendTo(this.formContainer);
-
- this.helpText = $(document.createElement('div')).appendTo(this.formContainer);
- this.helpText.attr({'id':'helpTextId'});
- $("#helpTextId").hide();
- $("#helpTextId").append(options.helpText);
-
- this.helpSymbol.attr({'id':'helpSymbolId'});
- this.helpSymbol.attr({'src':'../img/questionmark.png'});
- this.helpSymbol.attr({'width':'17'});
- this.helpSymbol.attr({'height':'17'});
-
- $("#helpSymbolId").hover(
- function () {
- //create dialog
- $("#helpTextId").dialog({ title: "<?php echo _mb('Help for address search'); ?>" });
- },
- function () {
- //create dialog
- $("#helpTextId").dialog('close');
- }
- );
- }
- this.inputAddress.attr({'id':'geographicName'});
- //default value
- this.inputAddress.val('<?php echo _mb('Search for addresses'); ?>');
- this.inputAddress.click(function() {
- that.inputAddress.val('');
- });
- this.inputAddress.css('width',options.inputWidth);
- $('.ui-menu').css('width','100px');
- $('.ui-menu-item').css('width','100px');
- //set the loading symbol for autoloader class
- //$('.ui-autocomplete-loading').css('background','white url("../img/indicator_wheel.gif") right center no-repeat');
- //http://stackoverflow.com/questions/622122/how-can-i-change-the-css-class-rules-using-jquery
- //$("<style type='text/css'> .ui-autocomplete { position: absolute; cursor: default; background:black; color:white} </style>").appendTo("head");
- $(function() {
- $( "#geographicName" ).autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: options.gazetteerUrl,
- dataType: "jsonp",
- data: {
- outputFormat: 'json',
- resultTarget: 'web',
- searchEPSG: options.searchEpsg,
- maxResults: options.maxResults,
- maxRows: options.maxResults,
- searchText: request.term,
- featureClass: "P",
- style: "full",
- name_startsWith: request.term
-
- },
- success: function( data ) {
- if (options.isGeonames) {
- response( $.map( data.geonames, function( item ) {
- return {
- label: item.name+" - "+item.fclName+" - "+item.countryName,
- minx: item.lng-options.latLonZoomExtension,
- miny: item.lat-options.latLonZoomExtension,
- maxx: item.lng+options.latLonZoomExtension,
- maxy: item.lat+options.latLonZoomExtension
- }
- }));
- } else {
- response( $.map( data.geonames, function( item ) {
- return {
- label: item.title,
- minx: item.minx,
- miny: item.miny,
- maxx: item.maxx,
- maxy: item.maxy
- }
- }));
- }
- }
- });
- },
- minLength: options.minLength,
- delay: options.delay,
- select: function( event, ui ) {
- that.zoomToExtent("EPSG:"+options.searchEpsg,ui.item.minx,ui.item.miny,ui.item.maxx,ui.item.maxy);
- },
- open: function() {
- $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
- },
- close: function() {
- $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
- }
- });
- });
- }
- this.initForm();
-}
-
-Mapbender.events.init.register(function() {
- Mapbender.modules[options.id] = $.extend(new JsonAutocompleteGazetteer(),Mapbender.modules[options.id]);
-});
-
-
-
-
More information about the Mapbender_commits
mailing list