diff --git a/CHANGELOG.md b/CHANGELOG.md index 76bc566..95931f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### TODO +- check if name is valid in admin settings +- explain things in admin settings +- compat jpg ### Added - file description field - 'destination' readonly field indicating full save path diff --git a/controller/utilscontroller.php b/controller/utilscontroller.php index 817b789..fc86461 100644 --- a/controller/utilscontroller.php +++ b/controller/utilscontroller.php @@ -153,7 +153,6 @@ class UtilsController extends Controller { Http::STATUS_UNPROCESSABLE_ENTITY ); } - $name = ''; if(!empty($newSymbol)) { $filepath = $this->config->getSystemValue('datadirectory').'/gpxedit/symbols/'.$filename.'.png'; $content = file_get_contents($newSymbol['tmp_name']); diff --git a/css/admin.css b/css/admin.css index b67e255..40d4f44 100644 --- a/css/admin.css +++ b/css/admin.css @@ -2,6 +2,9 @@ button#addExtraSymbol{ width: 33px; height: 33px; } +table#extraSymbolsTable td{ + text-align: center !important; +} .extraSymbol img{ width: 25px; height: 25px; diff --git a/js/admin.js b/js/admin.js index 6db1628..9cf933f 100644 --- a/js/admin.js +++ b/js/admin.js @@ -2,42 +2,15 @@ if (!OCA.GpxEdit) { OCA.GpxEdit = {}; } - - OCA.GpxEdit.Admin = { - initialize: function() { - $('#submitMaxUpload').on('click', _.bind(this._onClickSubmitMaxUpload, this)); - }, - - _onClickSubmitMaxUpload: function () { - OC.msg.startSaving('#maxUploadSizeSettingsMsg'); - - var request = $.ajax({ - url: OC.generateUrl('/apps/files/settings/maxUpload'), - type: 'POST', - data: { - maxUploadSize: $('#maxUploadSize').val() - } - }); - - request.done(function (data) { - $('#maxUploadSize').val(data.maxUploadSize); - OC.msg.finishedSuccess('#maxUploadSizeSettingsMsg', 'Saved'); - }); - - request.fail(function () { - OC.msg.finishedError('#maxUploadSizeSettingsMsg', 'Error'); - }); - } - } })(); function addLogoLine(name){ var url = OC.generateUrl('/apps/gpxedit/getExtraSymbol?'); var fullurl = url+'name='+encodeURI(name); var nameWe = name.replace(/\.png$/, ''); - $('div#extraSymbols').append('

'+ - ''+ - '

'); + $('div#extraSymbols table').append(''+ + ''+ + ''); } function deleteLogo(button){ @@ -48,7 +21,7 @@ function deleteLogo(button){ } var url = OC.generateUrl('/apps/gpxedit/deleteExtraSymbol'); $.post(url, req).done(function (response) { - button.parent().remove(); + button.parent().parent().remove(); OC.msg.finishedSuccess('#extraSymbolsSettingsMsg', response.data.message); }).fail(function(){ OC.msg.finishedError('#extraSymbolsSettingsMsg', 'Failed'); @@ -57,9 +30,8 @@ function deleteLogo(button){ } $(document).ready(function() { - OCA.GpxEdit.Admin.initialize(); var url = OC.generateUrl('/apps/gpxedit/getExtraSymbol?'); - $('p.extraSymbol img').each(function(){ + $('tr.extraSymbol img').each(function(){ var filename = $(this).attr('src'); var fullurl = url+'name='+encodeURI(filename); $(this).attr('src', fullurl); @@ -70,6 +42,7 @@ $(document).ready(function() { dropZone: null, done: function (e, response) { //preview('logoMime', response.result.data.name); + //alert('success '+response.result.data.name); addLogoLine(response.result.data.name); OC.msg.finishedSaving('#extraSymbolsSettingsMsg', response.result); $('label#uploadsymbol').addClass('icon-upload').removeClass('icon-loading-small'); @@ -77,9 +50,12 @@ $(document).ready(function() { submit: function(e, response) { OC.msg.startSaving('#extraSymbolsSettingsMsg'); $('label#uploadsymbol').removeClass('icon-upload').addClass('icon-loading-small'); + //alert(Object.keys(e.target)); + //alert('submit '+e.target); }, fail: function (e, response){ - OC.msg.finishedError('#extraSymbolsSettingsMsg', response.data.message); + //alert('fail '+Object.keys(response)); + OC.msg.finishedError('#extraSymbolsSettingsMsg', 'failed'); $('label#uploadsymbol').addClass('icon-upload').removeClass('icon-loading-small'); } }; diff --git a/templates/admin.php b/templates/admin.php index dfb14b0..6f7775b 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -6,26 +6,27 @@ OCP\Util::addstyle('gpxedit', 'admin');

t('GpxEdit additional settings')); ?>

-
+ '; + echo '">'; } ?> +
'; echo ''; + echo '"/>'; echo ''; + echo ' '; echo ''; - echo '

'; + echo '
@@ -33,7 +34,8 @@ OCP\Util::addstyle('gpxedit', 'admin'); - + +