refs #26 add new metadata fields 'link url' and 'link text'. they are loaded and saved

merge-requests/2/head
Julien Veyssier 2017-06-20 17:52:46 +02:00
parent 69d0872f90
commit d54b0c65dd
4 changed files with 28 additions and 3 deletions

View File

@ -813,6 +813,9 @@ h2.popupTitle{
background: url('images/symbols/geocache-open.png') no-repeat right 8px center rgba(240, 240, 240, 0.90);
background-size: 20px 20px;
}
#linktextinput, #linkurlinput {
width: 100%;
}
#desctext{
width: 100%;
height: 70px;

View File

@ -610,6 +610,16 @@
if (fileDesc) {
gpxText = gpxText + ' <desc>' + fileDesc + '</desc>\n';
}
var linkurl = $('#linkurlinput').val();
if (linkurl) {
gpxText = gpxText + ' <link href="' + linkurl + '">\n';
var linktext = $('#linktextinput').val();
if (linktext) {
gpxText = gpxText + ' <text>' + escapeHTML(linktext) + '</text>\n';
}
gpxText = gpxText + ' </link>\n';
}
gpxText = gpxText + '</metadata>\n';
var layerArray = [];
@ -834,10 +844,16 @@
// parse gpx xml text to draw it on the map
function parseGpx(xml) {
//var dom = $.parseXML(xml);
var dom = $(xml);
var fileDesc = dom.find('>metadata>desc').text();
var parseddom = $.parseXML(xml);
var dom = $(parseddom);
var fileDesc = dom.find('gpx>metadata>desc').text();
$('#desctext').val(fileDesc);
var linktext = dom.find('gpx>metadata>link>text').html();
$('#linktextinput').val(linktext);
var linkurl = dom.find('gpx>metadata>link').attr('href');
$('#linkurlinput').val(linkurl);
dom.find('wpt').each(function() {
var lat = $(this).attr('lat');
var lon = $(this).attr('lon');

View File

@ -68,6 +68,8 @@
"Your overlay tile servers" : "Vos serveurs de revêtements personnels",
"Your WMS overlay tile servers" : "Vos serveurs de revêtements WMS personnels",
"Transparent" : "Transparent",
"Link URL (optional)" : "URL du lien (facultatif)",
"Link text (optional)" : "Texte du lien (facultatif)",
"Upload new symbol image" : "Téléverser une nouvelle image de symbole"
},"pluralForm" :"nplurals=2; plural=(n > 1);"
}

View File

@ -41,6 +41,10 @@
<div style="clear:both"></div>
<label><?php p($l->t('Description (optional)'));?> :</label><br/>
<textarea id="desctext"></textarea>
<label><?php p($l->t('Link text (optional)'));?> :</label><br/>
<input id="linktextinput"/><br/>
<label><?php p($l->t('Link URL (optional)'));?> :</label><br/>
<input id="linkurlinput"/>
<button id="saveButton"><i class="fa fa-save"></i> <?php p($l->t('Choose directory and save'));?></button>
<div style="clear:both"></div>
<hr/>