replace jqueryfiletree by amazing OC.dialogs.filepicker
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
### 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
|
||||||
- design : borders around file trees, button icons
|
- design : borders around file trees, button icons
|
||||||
|
- improve load and save : use OC dialogs instead of jqueryfiletree
|
||||||
|
|
||||||
## 0.0.2 – 2016-12-08
|
## 0.0.2 – 2016-12-08
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -22,8 +22,6 @@ return [
|
||||||
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
||||||
['name' => 'page#getgpx', 'url' => '/getgpx', 'verb' => 'POST'],
|
['name' => 'page#getgpx', 'url' => '/getgpx', 'verb' => 'POST'],
|
||||||
['name' => 'page#savegpx', 'url' => '/savegpx', 'verb' => 'POST'],
|
['name' => 'page#savegpx', 'url' => '/savegpx', 'verb' => 'POST'],
|
||||||
['name' => 'page#getdircontent', 'url' => '/getdircontent', 'verb' => 'POST'],
|
|
||||||
['name' => 'page#getdircontentdir', 'url' => '/getdircontentdir', 'verb' => 'POST'],
|
|
||||||
['name' => 'utils#addTileServer', 'url' => '/addTileServer', 'verb' => 'POST'],
|
['name' => 'utils#addTileServer', 'url' => '/addTileServer', 'verb' => 'POST'],
|
||||||
['name' => 'utils#deleteTileServer', 'url' => '/deleteTileServer', 'verb' => 'POST'],
|
['name' => 'utils#deleteTileServer', 'url' => '/deleteTileServer', 'verb' => 'POST'],
|
||||||
['name' => 'utils#getOptionsValues', 'url' => '/getOptionsValues', 'verb' => 'POST'],
|
['name' => 'utils#getOptionsValues', 'url' => '/getOptionsValues', 'verb' => 'POST'],
|
||||||
|
|
|
@ -321,100 +321,6 @@ class PageController extends Controller {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function getdircontent($dir) {
|
|
||||||
$userFolder = \OC::$server->getUserFolder();
|
|
||||||
$userfolder_path = $userFolder->getPath();
|
|
||||||
$gpsbabelpath = getProgramPath('gpsbabel');
|
|
||||||
$responseTxt = '<ul class="jqueryFileTree">';
|
|
||||||
|
|
||||||
//error_log('DIR : '.$dir);
|
|
||||||
|
|
||||||
if ($userFolder->nodeExists($dir)){
|
|
||||||
$direlem = $userFolder->get($dir);
|
|
||||||
if ($direlem->getType() === \OCP\Files\FileInfo::TYPE_FOLDER){
|
|
||||||
foreach($direlem->getDirectoryListing() as $elem){
|
|
||||||
$elempath = str_replace($userfolder_path, '', $elem->getPath());
|
|
||||||
if ($elem->getType() === \OCP\Files\FileInfo::TYPE_FOLDER){
|
|
||||||
$responseTxt .= '<li class="directory collapsed"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
|
|
||||||
}
|
|
||||||
else if ($elem->getType() === \OCP\Files\FileInfo::TYPE_FILE){
|
|
||||||
if (endswith($elempath, '.gpx') or endswith($elempath, '.GPX')){
|
|
||||||
$responseTxt .= '<li class="gpx ext_gpx"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
|
|
||||||
}
|
|
||||||
else if ($gpsbabelpath !== null and
|
|
||||||
(endswith($elempath, '.csv') or endswith($elempath, '.CSV'))){
|
|
||||||
$responseTxt .= '<li class="csv ext_csv"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
|
|
||||||
}
|
|
||||||
else if ($gpsbabelpath !== null and
|
|
||||||
(endswith($elempath, '.kml') or endswith($elempath, '.KML'))){
|
|
||||||
$responseTxt .= '<li class="kml ext_kml"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
|
|
||||||
}
|
|
||||||
else if ($gpsbabelpath !== null and
|
|
||||||
(endswith($elempath, '.jpg') or endswith($elempath, '.JPG'))){
|
|
||||||
$responseTxt .= '<li class="jpg ext_jpg"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$responseTxt .= '</ul>';
|
|
||||||
|
|
||||||
$response = new Response();
|
|
||||||
$csp = new ContentSecurityPolicy();
|
|
||||||
$csp->addAllowedImageDomain('*')
|
|
||||||
->addAllowedMediaDomain('*')
|
|
||||||
->addAllowedConnectDomain('*');
|
|
||||||
$response->setContentSecurityPolicy($csp);
|
|
||||||
//error_log($responseTxt);
|
|
||||||
echo $responseTxt;
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function getdircontentdir($dir) {
|
|
||||||
$userFolder = \OC::$server->getUserFolder();
|
|
||||||
$userfolder_path = $userFolder->getPath();
|
|
||||||
$responseTxt = '<ul class="jqueryFileTree">';
|
|
||||||
|
|
||||||
if ($userFolder->nodeExists($dir)){
|
|
||||||
$direlem = $userFolder->get($dir);
|
|
||||||
if ($direlem->getType() === \OCP\Files\FileInfo::TYPE_FOLDER){
|
|
||||||
foreach($direlem->getDirectoryListing() as $elem){
|
|
||||||
$elempath = str_replace($userfolder_path, '', $elem->getPath());
|
|
||||||
if ($elem->getType() === \OCP\Files\FileInfo::TYPE_FOLDER){
|
|
||||||
$responseTxt .= '<li class="directory collapsed"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
|
|
||||||
}
|
|
||||||
//else if ($elem->getType() === \OCP\Files\FileInfo::TYPE_FILE and
|
|
||||||
//(endswith($elempath, '.gpx') or endswith($elempath, '.GPX'))){
|
|
||||||
// $responseTxt .= '<li class="file ext_gpx"><a href="#" rel="'.$elempath.'">'.$elem->getName().'</a></li>';
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$responseTxt .= '</ul>';
|
|
||||||
|
|
||||||
$response = new Response();
|
|
||||||
$csp = new ContentSecurityPolicy();
|
|
||||||
$csp->addAllowedImageDomain('*')
|
|
||||||
->addAllowedMediaDomain('*')
|
|
||||||
->addAllowedConnectDomain('*');
|
|
||||||
$response->setContentSecurityPolicy($csp);
|
|
||||||
//error_log($responseTxt);
|
|
||||||
echo $responseTxt;
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getUserTileServers(){
|
private function getUserTileServers(){
|
||||||
// custom tile servers management
|
// custom tile servers management
|
||||||
$sqlts = 'SELECT servername, url FROM *PREFIX*gpxedit_tile_servers ';
|
$sqlts = 'SELECT servername, url FROM *PREFIX*gpxedit_tile_servers ';
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
Colorbox Core Style:
|
|
||||||
The following CSS is consistent between example themes and should not be altered.
|
|
||||||
*/
|
|
||||||
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden; -webkit-transform: translate3d(0,0,0);}
|
|
||||||
#cboxWrapper {max-width:none;}
|
|
||||||
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
|
||||||
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
|
||||||
#cboxContent{position:relative;}
|
|
||||||
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
|
|
||||||
#cboxTitle{margin:0;}
|
|
||||||
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
|
||||||
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
|
||||||
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
|
|
||||||
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
|
|
||||||
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
|
||||||
|
|
||||||
/*
|
|
||||||
User Style:
|
|
||||||
Change the following styles to modify the appearance of Colorbox. They are
|
|
||||||
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
|
||||||
*/
|
|
||||||
#cboxOverlay{background:#000; opacity: 0.9; filter: alpha(opacity = 90);}
|
|
||||||
#colorbox{outline:0;}
|
|
||||||
#cboxContent{margin-top:20px;background:#000;}
|
|
||||||
.cboxIframe{background:#fff;}
|
|
||||||
#cboxError{padding:50px; border:1px solid #ccc;}
|
|
||||||
#cboxLoadedContent{border:5px solid #000; background:#fff;}
|
|
||||||
#cboxTitle{position:absolute; top:-20px; left:0; color:#ccc;}
|
|
||||||
#cboxCurrent{position:absolute; top:-20px; right:0px; color:#ccc;}
|
|
||||||
#cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
|
|
||||||
|
|
||||||
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
|
||||||
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
|
|
||||||
|
|
||||||
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
|
||||||
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
|
|
||||||
|
|
||||||
#cboxSlideshow{position:absolute; top:-20px; right:90px; color:#fff;}
|
|
||||||
#cboxPrevious{position:absolute; top:50%; left:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top left; width:28px; height:65px; text-indent:-9999px;}
|
|
||||||
#cboxPrevious:hover{background-position:bottom left;}
|
|
||||||
#cboxNext{position:absolute; top:50%; right:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top right; width:28px; height:65px; text-indent:-9999px;}
|
|
||||||
#cboxNext:hover{background-position:bottom right;}
|
|
||||||
#cboxClose{position:absolute; top:5px; right:5px; display:block; background:url(images/controls.png) no-repeat top center; width:38px; height:19px; text-indent:-9999px;}
|
|
||||||
#cboxClose:hover{background-position:bottom center;}
|
|
|
@ -792,11 +792,14 @@ h2.popupTitle{
|
||||||
#clearButton i{
|
#clearButton i{
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
#saveButton{
|
#saveButton, #loadButton{
|
||||||
display:block;
|
display:block;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
#loadButton i{
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
#saveNameLabel, #savePathLabel{
|
#saveNameLabel, #savePathLabel{
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 603 B |
Before Width: | Height: | Size: 618 B |
Before Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 579 B |
Before Width: | Height: | Size: 670 B |
Before Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 614 B |
Before Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 653 B |
Before Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 583 B |
Before Width: | Height: | Size: 389 B |
Before Width: | Height: | Size: 734 B |
Before Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 668 B |
Before Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 538 B |
Before Width: | Height: | Size: 606 B |
Before Width: | Height: | Size: 588 B |
Before Width: | Height: | Size: 856 B |
Before Width: | Height: | Size: 626 B |
Before Width: | Height: | Size: 859 B |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 342 B |
Before Width: | Height: | Size: 663 B |
Before Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 54 B |
Before Width: | Height: | Size: 64 B |
Before Width: | Height: | Size: 54 B |
|
@ -1,39 +0,0 @@
|
||||||
/* tables */
|
|
||||||
table.tablesorter {
|
|
||||||
font-family:arial;
|
|
||||||
background-color: #CDCDCD;
|
|
||||||
margin:10px 0pt 15px;
|
|
||||||
font-size: 8pt;
|
|
||||||
width: 100%;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
|
|
||||||
background-color: #e6EEEE;
|
|
||||||
border: 1px solid #FFF;
|
|
||||||
font-size: 8pt;
|
|
||||||
padding: 4px;
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr .header {
|
|
||||||
background-image: url(bg.gif);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
/*background-position: center right;*/
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody td {
|
|
||||||
color: #3D3D3D;
|
|
||||||
padding: 4px;
|
|
||||||
/*background-color: #FFF;*/
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody tr.odd td {
|
|
||||||
background-color:#F0F0F6;
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr .headerSortUp {
|
|
||||||
background-image: url(asc.gif);
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr .headerSortDown {
|
|
||||||
background-image: url(desc.gif);
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
|
|
||||||
background-color: #8dbdd8;
|
|
||||||
}
|
|
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
|
@ -1,39 +0,0 @@
|
||||||
table.tablesorter {
|
|
||||||
font-size: 12px;
|
|
||||||
background-color: #4D4D4D;
|
|
||||||
width: 1024px;
|
|
||||||
border: 1px solid #000;
|
|
||||||
}
|
|
||||||
table.tablesorter th {
|
|
||||||
text-align: left;
|
|
||||||
padding: 5px;
|
|
||||||
background-color: #6E6E6E;
|
|
||||||
}
|
|
||||||
table.tablesorter td {
|
|
||||||
color: #FFF;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
table.tablesorter .even {
|
|
||||||
background-color: #3D3D3D;
|
|
||||||
}
|
|
||||||
table.tablesorter .odd {
|
|
||||||
background-color: #6E6E6E;
|
|
||||||
}
|
|
||||||
table.tablesorter .header {
|
|
||||||
background-image: url(bg.png);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
border-left: 1px solid #FFF;
|
|
||||||
border-right: 1px solid #000;
|
|
||||||
border-top: 1px solid #FFF;
|
|
||||||
padding-left: 30px;
|
|
||||||
padding-top: 8px;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
table.tablesorter .headerSortUp {
|
|
||||||
background-image: url(asc.png);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
||||||
table.tablesorter .headerSortDown {
|
|
||||||
background-image: url(desc.png);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
134
js/gpxedit.js
|
@ -6,7 +6,6 @@ var gpxedit = {
|
||||||
baseLayers: null,
|
baseLayers: null,
|
||||||
drawControl: null,
|
drawControl: null,
|
||||||
id: 0,
|
id: 0,
|
||||||
saveDirPath: '/',
|
|
||||||
// indexed by gpxedit_id
|
// indexed by gpxedit_id
|
||||||
layersData: {}
|
layersData: {}
|
||||||
};
|
};
|
||||||
|
@ -813,7 +812,6 @@ function hideFailedSuccessAnimation(){
|
||||||
|
|
||||||
function showSaveSuccessAnimation(path){
|
function showSaveSuccessAnimation(path){
|
||||||
$('#saved').find('b#content').html('File successfully saved as<br/>'+path);
|
$('#saved').find('b#content').html('File successfully saved as<br/>'+path);
|
||||||
//$('#saved').show();
|
|
||||||
$('#saved').fadeIn();
|
$('#saved').fadeIn();
|
||||||
setTimeout(hideSaveSuccessAnimation, 4000);
|
setTimeout(hideSaveSuccessAnimation, 4000);
|
||||||
}
|
}
|
||||||
|
@ -830,7 +828,6 @@ function loadAction(file){
|
||||||
$('input#saveName').val(
|
$('input#saveName').val(
|
||||||
basename.replace(/\.jpg$/, '.gpx').replace(/\.kml$/, '.gpx').replace(/\.csv$/, '.gpx')
|
basename.replace(/\.jpg$/, '.gpx').replace(/\.kml$/, '.gpx').replace(/\.csv$/, '.gpx')
|
||||||
);
|
);
|
||||||
updateSavePath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadFile(file){
|
function loadFile(file){
|
||||||
|
@ -1034,15 +1031,6 @@ function fillWaypointStyles(){
|
||||||
$('select#markerstyleselect').val('marker');
|
$('select#markerstyleselect').val('marker');
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSavePath(){
|
|
||||||
var dir = gpxedit.saveDirPath;
|
|
||||||
if (dir === '/'){
|
|
||||||
dir = '';
|
|
||||||
}
|
|
||||||
var filename = $('#saveName').val();
|
|
||||||
$('#savePath').val(dir+'/'+filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addExtraSymbols(){
|
function addExtraSymbols(){
|
||||||
var url = OC.generateUrl('/apps/gpxedit/getExtraSymbol?');
|
var url = OC.generateUrl('/apps/gpxedit/getExtraSymbol?');
|
||||||
$('ul#extrasymbols li').each(function(){
|
$('ul#extrasymbols li').each(function(){
|
||||||
|
@ -1058,6 +1046,33 @@ function addExtraSymbols(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveAction(targetPath){
|
||||||
|
var saveFilePath = targetPath+'/'+$('input#saveName').val();
|
||||||
|
var gpxText = generateGpx();
|
||||||
|
var req = {
|
||||||
|
path: saveFilePath,
|
||||||
|
content: gpxText
|
||||||
|
}
|
||||||
|
var url = OC.generateUrl('/apps/gpxedit/savegpx');
|
||||||
|
$.post(url, req).done(function (response) {
|
||||||
|
if (response.status === 'fiw'){
|
||||||
|
showFailedSuccessAnimation(saveFilePath, 'Impossible to write file : write access denied');
|
||||||
|
}
|
||||||
|
else if (response.status === 'fu'){
|
||||||
|
showFailedSuccessAnimation(saveFilePath, 'Impossible to write file : folder does not exist');
|
||||||
|
}
|
||||||
|
else if (response.status === 'fw'){
|
||||||
|
showFailedSuccessAnimation(saveFilePath, 'Impossible to write file : folder write access denied');
|
||||||
|
}
|
||||||
|
else if (response.status === 'bfn'){
|
||||||
|
showFailedSuccessAnimation(saveFilePath, 'Bad file name, must end with ".gpx"');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showSaveSuccessAnimation(saveFilePath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
gpxedit.username = $('p#username').html();
|
gpxedit.username = $('p#username').html();
|
||||||
load_map();
|
load_map();
|
||||||
|
@ -1123,93 +1138,17 @@ $(document).ready(function(){
|
||||||
$('button#clearButton').click(function(e){
|
$('button#clearButton').click(function(e){
|
||||||
clear();
|
clear();
|
||||||
});
|
});
|
||||||
|
$('button#loadButton').click(function(e){
|
||||||
|
OC.dialogs.filepicker(t('gpxedit', 'Load file (gpx, kml, csv, png)'), function(targetPath) {
|
||||||
|
loadAction(targetPath);
|
||||||
|
}, false, null, true);
|
||||||
|
});
|
||||||
|
|
||||||
$('button#saveButton').click(function(e){
|
$('button#saveButton').click(function(e){
|
||||||
var gpxText = generateGpx();
|
var filename = $('#saveName').val();
|
||||||
var nbExpanded = $('#savetree li.expanded').length;
|
OC.dialogs.filepicker(t('gpxedit', 'Where to save')+' <b>'+filename+'</b>', function(targetPath) {
|
||||||
if (nbExpanded == 0){
|
saveAction(targetPath);
|
||||||
var saveFilePath = '/'+$('input#saveName').val();
|
}, false, "httpd/unix-directory", true);
|
||||||
}
|
|
||||||
else{
|
|
||||||
var saveFilePath = gpxedit.saveDirPath+'/'+$('input#saveName').val();
|
|
||||||
}
|
|
||||||
var req = {
|
|
||||||
path: saveFilePath,
|
|
||||||
content: gpxText
|
|
||||||
}
|
|
||||||
var url = OC.generateUrl('/apps/gpxedit/savegpx');
|
|
||||||
$.post(url, req).done(function (response) {
|
|
||||||
if (response.status === 'fiw'){
|
|
||||||
showFailedSuccessAnimation(saveFilePath, 'Impossible to write file : write access denied');
|
|
||||||
}
|
|
||||||
else if (response.status === 'fu'){
|
|
||||||
showFailedSuccessAnimation(saveFilePath, 'Impossible to write file : folder does not exist');
|
|
||||||
}
|
|
||||||
else if (response.status === 'fw'){
|
|
||||||
showFailedSuccessAnimation(saveFilePath, 'Impossible to write file : folder write access denied');
|
|
||||||
}
|
|
||||||
else if (response.status === 'bfn'){
|
|
||||||
showFailedSuccessAnimation(saveFilePath, 'Bad file name, must end with ".gpx"');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
showSaveSuccessAnimation(saveFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// reload load tree root
|
|
||||||
var tree = $('#loadtree').data('fileTree');
|
|
||||||
$('#loadtree').empty();
|
|
||||||
tree.showTree($('#loadtree'), escape(tree.options.root), function () {
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
var treeurl = OC.generateUrl('/apps/gpxedit/getdircontent');
|
|
||||||
$('#loadtree').fileTree({root: '/', script: treeurl, multiFolder: false }, function(file) {
|
|
||||||
loadAction(file);
|
|
||||||
});
|
|
||||||
|
|
||||||
var savetreeurl = OC.generateUrl('/apps/gpxedit/getdircontentdir');
|
|
||||||
$('#savetree').fileTree({root: '/', script: savetreeurl, multiFolder: false, onlyFolders: true }, function(file) {
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#savetree').on('filetreeexpand', function(e, data){
|
|
||||||
gpxedit.saveDirPath = data.rel;
|
|
||||||
$('#savetree a').removeClass('selectedFolder');
|
|
||||||
data.li.find('>a').addClass('selectedFolder');
|
|
||||||
updateSavePath();
|
|
||||||
});
|
|
||||||
$('#savetree').on('filetreecollapse', function(e, data){
|
|
||||||
gpxedit.saveDirPath = data.li.parent().parent().find('>a').attr('rel') || '/';
|
|
||||||
data.li.find('li.expanded').removeClass('expanded');
|
|
||||||
data.li.find('>a').removeClass('selectedFolder');
|
|
||||||
data.li.parent().parent().find('>a').addClass('selectedFolder');
|
|
||||||
updateSavePath();
|
|
||||||
});
|
|
||||||
$('#saveName').on('input',function(e){
|
|
||||||
updateSavePath();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('body').on('click','h2#loadtitle', function(e) {
|
|
||||||
if ($('#loaddiv').is(':visible')){
|
|
||||||
$('#loaddiv').slideUp();
|
|
||||||
$('#loadoptiontoggle').html('<i class="fa fa-expand"></i>');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$('#loaddiv').slideDown();
|
|
||||||
$('#loadoptiontoggle').html('<i class="fa fa-compress"></i>');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('body').on('click','h2#savetitle', function(e) {
|
|
||||||
if ($('#savediv').is(':visible')){
|
|
||||||
$('#savediv').slideUp();
|
|
||||||
$('#saveoptiontoggle').html('<i class="fa fa-expand"></i>');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$('#savediv').slideDown();
|
|
||||||
$('#saveoptiontoggle').html('<i class="fa fa-compress"></i>');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Custom tile server management
|
// Custom tile server management
|
||||||
|
@ -1242,7 +1181,6 @@ $(document).ready(function(){
|
||||||
if (urlfileparam && urlfileparam !== undefined){
|
if (urlfileparam && urlfileparam !== undefined){
|
||||||
loadAction(fileparam);
|
loadAction(fileparam);
|
||||||
}
|
}
|
||||||
updateSavePath();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
var bind=function(e,t){return function(){return e.apply(t,arguments)}};!function(e,t){var n;return n=function(){function t(t,n,r){this.onEvent=bind(this.onEvent,this);var a,i,l;a=e(t),i=this,l={root:"/",script:"/files/filetree",folderEvent:"click",expandSpeed:500,collapseSpeed:500,expandEasing:"swing",collapseEasing:"swing",multiFolder:!0,loadMessage:"Loading...",errorMessage:"Unable to get file tree information",multiSelect:!1,onlyFolders:!1,onlyFiles:!1,preventLinkAction:!1},this.jqft={container:a},this.options=e.extend(l,n),this.callback=r,this.data={},a.html('<ul class="jqueryFileTree start"><li class="wait">'+this.options.loadMessage+"<li></ul>"),i.showTree(a,escape(this.options.root),function(){return i._trigger("filetreeinitiated",{})}),a.delegate("li a",this.options.folderEvent,i.onEvent)}return t.prototype.onEvent=function(t){var n,r,a,i,l,s;return n=e(t.target),l=this.options,i=this.jqft,r=this,a=this.callback,r.data={},r.data.li=n.closest("li"),r.data.type=null!=(s=r.data.li.hasClass("directory"))?s:{directory:"file"},r.data.value=n.text(),r.data.rel=n.prop("rel"),r.data.container=i.container,l.preventLinkAction&&t.preventDefault(),n.parent().hasClass("directory")?n.parent().hasClass("collapsed")?(l.multiFolder||(n.parent().parent().find("UL").slideUp({duration:l.collapseSpeed,easing:l.collapseEasing}),n.parent().parent().find("LI.directory").removeClass("expanded").addClass("collapsed")),n.parent().removeClass("collapsed").addClass("expanded"),n.parent().find("UL").remove(),r.showTree(n.parent(),n.attr("rel"),function(){return r._trigger("filetreeexpanded",r.data),null!=a})):n.parent().find("UL").slideUp({duration:l.collapseSpeed,easing:l.collapseEasing,start:function(){return r._trigger("filetreecollapse",r.data)},complete:function(){return n.parent().removeClass("expanded").addClass("collapsed"),r._trigger("filetreecollapsed",r.data),null!=a}}):(l.multiSelect?n.parent().find("input").is(":checked")?(n.parent().find("input").prop("checked",!1),n.parent().removeClass("selected")):(n.parent().find("input").prop("checked",!0),n.parent().addClass("selected")):(i.container.find("li").removeClass("selected"),n.parent().addClass("selected")),r._trigger("filetreeclicked",r.data),"function"==typeof a?a(n.attr("rel")):void 0)},t.prototype.showTree=function(t,n,r){var a,i,l,s,o,d,p;return a=e(t),d=this.options,i=this,a.addClass("wait"),e(".jqueryFileTree.start").remove(),l={dir:n,onlyFolders:d.onlyFolders,onlyFiles:d.onlyFiles,multiSelect:d.multiSelect},o=function(t){var l;return a.find(".start").html(""),a.removeClass("wait").append(t),d.root===n?a.find("UL:hidden").show("undefined"!=typeof callback&&null!==callback):(void 0===jQuery.easing[d.expandEasing]&&(console.log("Easing library not loaded. Include jQueryUI or 3rd party lib."),d.expandEasing="swing"),a.find("UL:hidden").slideDown({duration:d.expandSpeed,easing:d.expandEasing,start:function(){return i._trigger("filetreeexpand",i.data)},complete:r})),l=e('[rel="'+decodeURIComponent(n)+'"]').parent(),d.multiSelect&&l.children("input").is(":checked")&&l.find("ul li input").each(function(){return e(this).prop("checked",!0),e(this).parent().addClass("selected")}),!1},s=function(){return a.find(".start").html(""),a.removeClass("wait").append("<p>"+d.errorMessage+"</p>"),!1},"function"==typeof d.script?(p=d.script(l),"string"==typeof p||p instanceof jQuery?o(p):s()):e.ajax({url:d.script,type:"POST",dataType:"HTML",data:l}).done(function(e){return o(e)}).fail(function(){return s()})},t.prototype._trigger=function(e,t){var n;return n=this.jqft.container,n.triggerHandler(e,t)},t}(),e.fn.extend({fileTree:function(t,r){return this.each(function(){var a,i;return a=e(this),i=a.data("fileTree"),i||a.data("fileTree",i=new n(this,t,r)),"string"==typeof t?i[option].apply(i):void 0})}})}(window.jQuery,window);
|
|
|
@ -1,122 +0,0 @@
|
||||||
/*
|
|
||||||
* Metadata - jQuery plugin for parsing metadata from elements
|
|
||||||
*
|
|
||||||
* Copyright (c) 2006 John Resig, Yehuda Katz, J<EFBFBD>örn Zaefferer, Paul McLanahan
|
|
||||||
*
|
|
||||||
* Dual licensed under the MIT and GPL licenses:
|
|
||||||
* http://www.opensource.org/licenses/mit-license.php
|
|
||||||
* http://www.gnu.org/licenses/gpl.html
|
|
||||||
*
|
|
||||||
* Revision: $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
|
||||||
* in the JSON will become a property of the element itself.
|
|
||||||
*
|
|
||||||
* There are three supported types of metadata storage:
|
|
||||||
*
|
|
||||||
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
|
||||||
*
|
|
||||||
* class: Inside the class attribute, wrapped in curly braces: { }
|
|
||||||
*
|
|
||||||
* elem: Inside a child element (e.g. a script tag). The
|
|
||||||
* name parameter indicates *which* element.
|
|
||||||
*
|
|
||||||
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
|
||||||
*
|
|
||||||
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
|
||||||
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
|
||||||
*
|
|
||||||
* @name $.metadata.setType
|
|
||||||
*
|
|
||||||
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
|
||||||
* @before $.metadata.setType("class")
|
|
||||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
|
||||||
* @desc Reads metadata from the class attribute
|
|
||||||
*
|
|
||||||
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
|
||||||
* @before $.metadata.setType("attr", "data")
|
|
||||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
|
||||||
* @desc Reads metadata from a "data" attribute
|
|
||||||
*
|
|
||||||
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
|
||||||
* @before $.metadata.setType("elem", "script")
|
|
||||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
|
||||||
* @desc Reads metadata from a nested script element
|
|
||||||
*
|
|
||||||
* @param String type The encoding type
|
|
||||||
* @param String name The name of the attribute to be used to get metadata (optional)
|
|
||||||
* @cat Plugins/Metadata
|
|
||||||
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
|
||||||
* @type undefined
|
|
||||||
* @see metadata()
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function($) {
|
|
||||||
|
|
||||||
$.extend({
|
|
||||||
metadata : {
|
|
||||||
defaults : {
|
|
||||||
type: 'class',
|
|
||||||
name: 'metadata',
|
|
||||||
cre: /({.*})/,
|
|
||||||
single: 'metadata'
|
|
||||||
},
|
|
||||||
setType: function( type, name ){
|
|
||||||
this.defaults.type = type;
|
|
||||||
this.defaults.name = name;
|
|
||||||
},
|
|
||||||
get: function( elem, opts ){
|
|
||||||
var settings = $.extend({},this.defaults,opts);
|
|
||||||
// check for empty string in single property
|
|
||||||
if ( !settings.single.length ) settings.single = 'metadata';
|
|
||||||
|
|
||||||
var data = $.data(elem, settings.single);
|
|
||||||
// returned cached data if it already exists
|
|
||||||
if ( data ) return data;
|
|
||||||
|
|
||||||
data = "{}";
|
|
||||||
|
|
||||||
if ( settings.type == "class" ) {
|
|
||||||
var m = settings.cre.exec( elem.className );
|
|
||||||
if ( m )
|
|
||||||
data = m[1];
|
|
||||||
} else if ( settings.type == "elem" ) {
|
|
||||||
if( !elem.getElementsByTagName )
|
|
||||||
return undefined;
|
|
||||||
var e = elem.getElementsByTagName(settings.name);
|
|
||||||
if ( e.length )
|
|
||||||
data = $.trim(e[0].innerHTML);
|
|
||||||
} else if ( elem.getAttribute != undefined ) {
|
|
||||||
var attr = elem.getAttribute( settings.name );
|
|
||||||
if ( attr )
|
|
||||||
data = attr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( data.indexOf( '{' ) <0 )
|
|
||||||
data = "{" + data + "}";
|
|
||||||
|
|
||||||
data = eval("(" + data + ")");
|
|
||||||
|
|
||||||
$.data( elem, settings.single, data );
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the metadata object for the first member of the jQuery object.
|
|
||||||
*
|
|
||||||
* @name metadata
|
|
||||||
* @descr Returns element's metadata object
|
|
||||||
* @param Object opts An object contianing settings to override the defaults
|
|
||||||
* @type jQuery
|
|
||||||
* @cat Plugins/Metadata
|
|
||||||
*/
|
|
||||||
$.fn.metadata = function( opts ){
|
|
||||||
return $.metadata.get( this[0], opts );
|
|
||||||
};
|
|
||||||
|
|
||||||
})(jQuery);
|
|
|
@ -24,38 +24,18 @@ p($_['gpxedit_version']);
|
||||||
<div style="clear:both"></div>
|
<div style="clear:both"></div>
|
||||||
</form>
|
</form>
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2 id="loadtitle"><?php p($l->t('Load'));?> <b id="loadoptiontoggle"><i class="fa fa-expand"></i></b></h2>
|
<button id="loadButton"><i class="fa fa-file-o"></i> <?php p($l->t('Load'));?></button>
|
||||||
<div id="loaddiv" style="display:none;">
|
|
||||||
<p><?php p($l->t('Select a file to load it on the map'));?></p>
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" id="clearbeforeload" checked></input>
|
|
||||||
<label for="clearbeforeload"><?php p($l->t('Clear map before loading'));?></label>
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
<div id="loadtree"></div>
|
|
||||||
</div>
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2 id="savetitle"><?php p($l->t('Save'));?> <b id="saveoptiontoggle"><i class="fa fa-expand"></i></b></h2>
|
<h2 id="savetitle"><?php p($l->t('Save'));?></h2>
|
||||||
<div id="savediv" style="display:none;">
|
<div>
|
||||||
<p><?php p($l->t('Select a folder, set a name and click "Save" button'));?></p><br/>
|
<label id="saveNameLabel"><?php p($l->t('File name'));?> :</label><br/>
|
||||||
<div id="savetree"></div>
|
<input id="saveName" type="text"></input>
|
||||||
<br/>
|
|
||||||
<div>
|
|
||||||
<label id="saveNameLabel"><?php p($l->t('File name'));?> :</label><br/>
|
|
||||||
<input id="saveName" type="text"></input>
|
|
||||||
</div>
|
|
||||||
<div style="clear:both"></div>
|
|
||||||
<div>
|
|
||||||
<label id="savePathLabel">Destination :</label><br/>
|
|
||||||
<input id="savePath" type="text" readonly></input>
|
|
||||||
</div>
|
|
||||||
<br/><br/>
|
|
||||||
<label><?php p($l->t('Description (optional)'));?> :</label><br/>
|
|
||||||
<textarea id="desctext"></textarea>
|
|
||||||
<button id="saveButton"><i class="fa fa-save"></i> <?php p($l->t('Save'));?></button>
|
|
||||||
<br/>
|
|
||||||
</div>
|
</div>
|
||||||
<div style="clear:both"></div>
|
<div style="clear:both"></div>
|
||||||
|
<label><?php p($l->t('Description (optional)'));?> :</label><br/>
|
||||||
|
<textarea id="desctext"></textarea>
|
||||||
|
<button id="saveButton"><i class="fa fa-save"></i> <?php p($l->t('Choose directory and save'));?></button>
|
||||||
|
<div style="clear:both"></div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<br/>
|
<br/>
|
||||||
<button id="clearButton"><i class="fa fa-bomb"></i> <?php p($l->t('Clear map'));?></button>
|
<button id="clearButton"><i class="fa fa-bomb"></i> <?php p($l->t('Clear map'));?></button>
|
||||||
|
@ -104,6 +84,10 @@ echo '</ul>'."\n";
|
||||||
<input id="symboloverwrite" type="checkbox" checked></input>
|
<input id="symboloverwrite" type="checkbox" checked></input>
|
||||||
<label for="symboloverwrite"><?php p($l->t('Use defined symbols')); ?></label>
|
<label for="symboloverwrite"><?php p($l->t('Use defined symbols')); ?></label>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" id="clearbeforeload" checked></input>
|
||||||
|
<label for="clearbeforeload"><?php p($l->t('Clear map before loading'));?></label>
|
||||||
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<hr/>
|
<hr/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
@ -8,14 +8,11 @@ script('gpxedit', 'L.Control.Locate.min');
|
||||||
script('gpxedit', 'leaflet-sidebar.min');
|
script('gpxedit', 'leaflet-sidebar.min');
|
||||||
script('gpxedit', 'jquery-ui.min');
|
script('gpxedit', 'jquery-ui.min');
|
||||||
script('gpxedit', 'jquery.mousewheel');
|
script('gpxedit', 'jquery.mousewheel');
|
||||||
script('gpxedit', 'tablesorter/jquery.tablesorter');
|
|
||||||
script('gpxedit', 'detect_timezone');
|
script('gpxedit', 'detect_timezone');
|
||||||
script('gpxedit', 'jquery.detect_timezone');
|
script('gpxedit', 'jquery.detect_timezone');
|
||||||
script('gpxedit', 'moment-timezone-with-data.min');
|
script('gpxedit', 'moment-timezone-with-data.min');
|
||||||
script('gpxedit', 'jquery.colorbox-min');
|
|
||||||
script('gpxedit', 'leaflet.draw');
|
script('gpxedit', 'leaflet.draw');
|
||||||
script('gpxedit', 'leaflet.measurecontrol');
|
script('gpxedit', 'leaflet.measurecontrol');
|
||||||
script('gpxedit', 'jQueryFileTree.min');
|
|
||||||
script('gpxedit', 'gpxedit');
|
script('gpxedit', 'gpxedit');
|
||||||
|
|
||||||
style('gpxedit', 'style');
|
style('gpxedit', 'style');
|
||||||
|
@ -28,11 +25,8 @@ style('gpxedit', 'jquery-ui.min');
|
||||||
style('gpxedit', 'font-awesome.min');
|
style('gpxedit', 'font-awesome.min');
|
||||||
style('gpxedit', 'gpxedit');
|
style('gpxedit', 'gpxedit');
|
||||||
style('gpxedit', 'L.Control.Locate.min');
|
style('gpxedit', 'L.Control.Locate.min');
|
||||||
style('gpxedit', 'tablesorter/themes/blue/style');
|
|
||||||
style('gpxedit', 'leaflet.draw');
|
style('gpxedit', 'leaflet.draw');
|
||||||
style('gpxedit', 'leaflet.measurecontrol');
|
style('gpxedit', 'leaflet.measurecontrol');
|
||||||
style('gpxedit', 'jQueryFileTree.min');
|
|
||||||
style('gpxedit', 'colorbox');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|