refs #30 add metadata field 'track name' loaded from metadata>name; make metadata hidden by default

merge-requests/3/head
Julien Veyssier 2017-06-25 19:10:27 +02:00
parent f8a18cc788
commit 1f6bdfb4f3
4 changed files with 44 additions and 21 deletions

View File

@ -792,27 +792,17 @@ h2.popupTitle{
color: red; color: red;
} }
#saveButton { #saveButton, #saveName {
width: 100%; width: 100%;
} }
#loadButton i, #loadFolderButton i{ #loadButton i, #loadFolderButton i{
color: blue; color: blue;
} }
#saveNameLabel, #savePathLabel{
float:left;
}
#saveName, #savePath{
width: 100%;
float: right;
}
#savePath{
background-color: #C9C9C9;
}
.selectimg{ .selectimg{
background: url('images/symbols/geocache-open.png') no-repeat right 8px center rgba(240, 240, 240, 0.90); background: url('images/symbols/geocache-open.png') no-repeat right 8px center rgba(240, 240, 240, 0.90);
background-size: 20px 20px; background-size: 20px 20px;
} }
#linktextinput, #linkurlinput { #linktextinput, #linkurlinput, #tracknameinput {
width: 100%; width: 100%;
} }
#desctext{ #desctext{
@ -904,3 +894,14 @@ div#ho button {
.customtiletitle { .customtiletitle {
cursor: pointer; cursor: pointer;
} }
#metadata {
display: none;
}
#metadatalabel {
width: 100%;
height: 25px;
text-align: center;
cursor: pointer;
background-color: #F7F7F7;
border: solid 1px lightgrey;
}

View File

@ -606,6 +606,10 @@
' http://www.garmin.com/xmlschemas/TrackPointExtension/v1' + ' http://www.garmin.com/xmlschemas/TrackPointExtension/v1' +
' http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">\n'; ' http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">\n';
gpxText = gpxText + '<metadata>\n <time>' + now_utc_str + '</time>\n'; gpxText = gpxText + '<metadata>\n <time>' + now_utc_str + '</time>\n';
var trackName = $('#tracknameinput').val();
if (trackName) {
gpxText = gpxText + ' <name>' + trackName + '</name>\n';
}
var fileDesc = $('#desctext').val(); var fileDesc = $('#desctext').val();
if (fileDesc) { if (fileDesc) {
gpxText = gpxText + ' <desc>' + fileDesc + '</desc>\n'; gpxText = gpxText + ' <desc>' + fileDesc + '</desc>\n';
@ -847,6 +851,8 @@
var parseddom = $.parseXML(xml); var parseddom = $.parseXML(xml);
var dom = $(parseddom); var dom = $(parseddom);
var trackName = dom.find('gpx>metadata>name').text();
$('#tracknameinput').val(trackName);
var fileDesc = dom.find('gpx>metadata>desc').text(); var fileDesc = dom.find('gpx>metadata>desc').text();
$('#desctext').val(fileDesc); $('#desctext').val(fileDesc);
var linktext = dom.find('gpx>metadata>link>text').html(); var linktext = dom.find('gpx>metadata>link>text').html();
@ -1735,6 +1741,17 @@
} }
}); });
$('body').on('click','#metadatalabel', function(e) {
if ($('div#metadata').is(':visible')) {
$('#metadata').slideUp();
$(this).find('i').removeClass('fa-angle-double-up').addClass('fa-angle-double-down');
}
else{
$('div#metadata').slideDown();
$(this).find('i').removeClass('fa-angle-double-down').addClass('fa-angle-double-up');
}
});
}); });
})(jQuery, OC); })(jQuery, OC);

View File

@ -69,6 +69,8 @@
"Transparent" : "Transparent", "Transparent" : "Transparent",
"Link URL (optional)" : "URL du lien (facultatif)", "Link URL (optional)" : "URL du lien (facultatif)",
"Link text (optional)" : "Texte du lien (facultatif)", "Link text (optional)" : "Texte du lien (facultatif)",
"Track name (optional)" : "Nom de la trace (facultatif)",
"Metadata" : "Métadonnées",
"Upload new symbol image" : "Téléverser une nouvelle image de symbole" "Upload new symbol image" : "Téléverser une nouvelle image de symbole"
},"pluralForm" :"nplurals=2; plural=(n > 1);" },"pluralForm" :"nplurals=2; plural=(n > 1);"
} }

View File

@ -31,20 +31,23 @@
<option value=".csv">csv</option> <option value=".csv">csv</option>
</select> </select>
</div> </div>
<div style="clear:both"></div>
<hr/> <hr/>
<h2 id="savetitle"><?php p($l->t('Save'));?></h2> <h2 id="savetitle"><?php p($l->t('Save'));?></h2>
<div> <div>
<label id="saveNameLabel"><?php p($l->t('File name'));?> :</label><br/> <label id="saveNameLabel"><?php p($l->t('File name'));?> :</label>
<input id="saveName" type="text"></input> <input id="saveName" type="text"></input>
</div> </div>
<div style="clear:both"></div> <p id="metadatalabel"><b><?php p($l->t('Metadata'));?> </b> <i class="fa fa-angle-double-down"></i></p>
<div id="metadata">
<label><?php p($l->t('Track name (optional)'));?> :</label><br/>
<input id="tracknameinput"/><br/>
<label><?php p($l->t('Description (optional)'));?> :</label><br/> <label><?php p($l->t('Description (optional)'));?> :</label><br/>
<textarea id="desctext"></textarea> <textarea id="desctext"></textarea>
<label><?php p($l->t('Link text (optional)'));?> :</label><br/> <label><?php p($l->t('Link text (optional)'));?> :</label><br/>
<input id="linktextinput"/><br/> <input id="linktextinput"/><br/>
<label><?php p($l->t('Link URL (optional)'));?> :</label><br/> <label><?php p($l->t('Link URL (optional)'));?> :</label><br/>
<input id="linkurlinput"/> <input id="linkurlinput"/>
</div>
<button id="saveButton"><i class="fa fa-save"></i> <?php p($l->t('Choose directory and save'));?></button> <button id="saveButton"><i class="fa fa-save"></i> <?php p($l->t('Choose directory and save'));?></button>
<div style="clear:both"></div> <div style="clear:both"></div>
<hr/> <hr/>