admin settings design
parent
bac51dc7cc
commit
2ef87ce9f8
|
@ -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
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -2,6 +2,9 @@ button#addExtraSymbol{
|
|||
width: 33px;
|
||||
height: 33px;
|
||||
}
|
||||
table#extraSymbolsTable td{
|
||||
text-align: center !important;
|
||||
}
|
||||
.extraSymbol img{
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
|
|
44
js/admin.js
44
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('<p class="extraSymbol" id="'+nameWe+'">'+
|
||||
'<img src="'+fullurl+'"><label> '+nameWe+' </label>'+
|
||||
'<button class="delExtraSymbol icon-delete icon" name="'+name+'" title="Remove"></button></p>');
|
||||
$('div#extraSymbols table').append('<tr class="extraSymbol" id="'+nameWe+'">'+
|
||||
'<td><img src="'+fullurl+'"></td><td><label> '+nameWe+' </label></td>'+
|
||||
'<td><button class="delExtraSymbol icon-delete icon" name="'+name+'" title="Remove"></button></td></tr>');
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,26 +6,27 @@ OCP\Util::addstyle('gpxedit', 'admin');
|
|||
<div class="section" id="gpxedit">
|
||||
<h2><?php p($l->t('GpxEdit additional settings')); ?></h2>
|
||||
<label><?php p($l->t( 'Extra symbols' )); ?> </label>
|
||||
<span id="extraSymbolsSettingsMsg" class="msg"></span>
|
||||
<br />
|
||||
<div id="extraSymbols">
|
||||
<table id="extraSymbolsTable">
|
||||
<?php
|
||||
foreach($_['extraSymbolList'] as $symbol){
|
||||
echo '<p class="extraSymbol" id="';
|
||||
echo '<tr class="extraSymbol" id="';
|
||||
p($symbol['smallname']);
|
||||
echo '">';
|
||||
echo '"><td>';
|
||||
echo '<img src="';
|
||||
p($symbol['name']);
|
||||
echo '"/>';
|
||||
echo '"/></td><td>';
|
||||
echo '<label> ';
|
||||
p($symbol['smallname']);
|
||||
echo ' </label>';
|
||||
echo ' </label></td><td>';
|
||||
echo '<button class="delExtraSymbol icon-delete icon" name="';
|
||||
p($symbol['name']);
|
||||
echo '" title="Remove"></button>';
|
||||
echo '</p>';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<!--button id="addExtraSymbol" class="inlineblock button icon-upload" title="Upload new symbol image"></button-->
|
||||
|
||||
|
@ -33,7 +34,8 @@ OCP\Util::addstyle('gpxedit', 'admin');
|
|||
<label for="addExtraSymbolName">New symbol name :</label>
|
||||
<input type="text" name="addExtraSymbolName" id="addExtraSymbolName"></input>
|
||||
|
||||
<input id="uploadsymbol" class="upload-symbol-field" name="uploadsymbol" type="file">
|
||||
<input id="uploadsymbol" class="upload-symbol-field" name="uploadsymbol" type="file"></input>
|
||||
<label for="uploadsymbol" class="button icon-upload svg" id="uploadsymbol" title="<?php p($l->t('Upload new symbol image')) ?>"></label>
|
||||
<span id="extraSymbolsSettingsMsg" class="msg"></span>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue