add file description field

merge-requests/1/head
Julien Veyssier 2016-12-12 15:28:15 +01:00
parent 3e655feccd
commit e2bd1c525b
4 changed files with 19 additions and 1 deletions

View File

@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
###
- file description field
### Changed ### Changed
- keep time information in loaded tracks/routes/waypoints, written in saved files - keep time information in loaded tracks/routes/waypoints, written in saved files

View File

@ -792,3 +792,7 @@ h2.popupTitle{
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;
} }
#desctext{
width: 100%;
height: 70px;
}

View File

@ -512,7 +512,12 @@ function generateGpx(){
' http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd'+ ' http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd'+
' 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</metadata>\n'; gpxText = gpxText + '<metadata>\n <time>'+now_utc_str+'</time>\n';
var fileDesc = $('#desctext').val();
if (fileDesc){
gpxText = gpxText + ' <desc>'+fileDesc+'</desc>\n';
}
gpxText = gpxText + '</metadata>\n';
gpxedit.editableLayers.eachLayer(function(layer){ gpxedit.editableLayers.eachLayer(function(layer){
var id = layer.gpxedit_id; var id = layer.gpxedit_id;
@ -674,6 +679,8 @@ function drawLine(latlngs, name, desc, cmt, gpxtype, times){
function parseGpx(xml){ function parseGpx(xml){
//var dom = $.parseXML(xml); //var dom = $.parseXML(xml);
var dom = $(xml); var dom = $(xml);
var fileDesc = dom.find('>metadata>desc').text();
$('#desctext').val(fileDesc);
dom.find('wpt').each(function(){ dom.find('wpt').each(function(){
var lat = $(this).attr('lat'); var lat = $(this).attr('lat');
var lon = $(this).attr('lon'); var lon = $(this).attr('lon');

View File

@ -39,8 +39,12 @@ p($_['gpxedit_version']);
<div id="savediv" style="display:none;"> <div id="savediv" style="display:none;">
<p>Select a folder, set a name and click "Save" button</p><br/> <p>Select a folder, set a name and click "Save" button</p><br/>
<div id="savetree"></div> <div id="savetree"></div>
<br/>
<input id="saveName"></input> <input id="saveName"></input>
<button id="saveButton">Save</button> <button id="saveButton">Save</button>
<br/>
<label>Description (optional) :</label><br/>
<textarea id="desctext"></textarea>
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<hr/> <hr/>