Media Datenbank 1.0
This commit is contained in:
parent
c11fc557bf
commit
c9f3d85d4e
50 changed files with 4774 additions and 172 deletions
|
|
@ -77,12 +77,26 @@ $('#multi_selection_toggle').click(function () {
|
|||
});
|
||||
|
||||
*/
|
||||
|
||||
$(document).on('click', '#lfm_add-file', function () {
|
||||
performLfmRequest('add-file', {})
|
||||
.done(function (data) {
|
||||
hideNavAndShowEditor(data, function () {
|
||||
performLfmRequest('add-dofile', {
|
||||
working_dir: $("#working_dir").val(),
|
||||
file_type: $("#from_file_type").val(),
|
||||
// file_name: $("#form_file_name").val(),
|
||||
file_content: $("#form_file_content").val(),
|
||||
}).done(refreshFoldersAndItems);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '#lfm_add-folder', function () {
|
||||
dialog(lang['message-name'], '', createFolder);
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).on('click', '#lfm_upload', function () {
|
||||
$('#uploadModal').modal('show');
|
||||
});
|
||||
|
|
@ -177,6 +191,16 @@ function toggleActions() {
|
|||
colors(item);
|
||||
});
|
||||
|
||||
$('a[data-action=item_crop]').on('click', function (e) {
|
||||
item = getOneSelectedElement($(this).parents('.file-item').data('id'));
|
||||
crop(item);
|
||||
});
|
||||
|
||||
$('a[data-action=item_resize]').on('click', function (e) {
|
||||
item = getOneSelectedElement($(this).parents('.file-item').data('id'));
|
||||
resize(item);
|
||||
});
|
||||
|
||||
$('a[data-action=item_trash]').on('click', function () {
|
||||
var items = [];
|
||||
items.push(getOneSelectedElement($(this).parents('.file-item').data('id')));
|
||||
|
|
@ -207,9 +231,12 @@ function toggleActions() {
|
|||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/* var one_selected = selected.length === 1;
|
||||
var many_selected = selected.length >= 1;
|
||||
var only_image = getSelectedItems()
|
||||
|
||||
.filter(function (item) { return !item.is_image; })
|
||||
.length === 0;
|
||||
var only_file = getSelectedItems()
|
||||
|
|
@ -342,10 +369,11 @@ var refreshFoldersAndItems = function (data) {
|
|||
}
|
||||
};
|
||||
|
||||
var hideNavAndShowEditor = function (data) {
|
||||
$('#nav-buttons > ul').addClass('d-none');
|
||||
$(lfm_content).html(data).removeClass('preserve_actions_space');
|
||||
clearSelected();
|
||||
var hideNavAndShowEditor = function (data, callback = false) {
|
||||
// $('#nav-buttons > ul').addClass('d-none');
|
||||
//console.log(data);
|
||||
notify(data, callback);
|
||||
|
||||
};
|
||||
|
||||
function loadItems() {
|
||||
|
|
@ -359,9 +387,7 @@ function loadItems() {
|
|||
lfm_items = response.items;
|
||||
var hasItems = lfm_items.length !== 0;
|
||||
$('#lfm_empty').toggleClass('d-none', hasItems);
|
||||
|
||||
//$(lfm_content).html(''); //.removeAttr('class');
|
||||
|
||||
var toprev = $('<div class="file-item" id="to-previous"><div class="file-item-icon file-item-level-up fas fa-level-up-alt text-secondary"></div><a href="javascript:void(0)" class="file-item-name">zurück</a></div>');
|
||||
$(lfm_content).html('').append(toprev);
|
||||
|
||||
|
|
@ -403,19 +429,39 @@ function loadItems() {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
if (item.thumb_url) {
|
||||
var image = $('<div>').addClass('file-item-img').css('background-image', 'url("' + item.thumb_url + '?timestamp=' + item.time + '")');
|
||||
var dot = $('<span>').addClass('badge badge-dot badge-default indicator').css({"background-color":item.color});
|
||||
} else {
|
||||
var image = $('<div>').addClass('file-item-icon fa ' + item.icon).css({"color":item.color});
|
||||
var dot = $('<span>').addClass('badge badge-dot badge-default indicator').css({"background-color":item.color});
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!item.is_file){
|
||||
if(!item.is_image){ //no image
|
||||
template.find('.link-item-crop').remove();
|
||||
template.find('.link-item-resize').remove();
|
||||
}else{
|
||||
// template.find('.link-item-color').remove();
|
||||
}
|
||||
|
||||
if(!item.is_file){ //dirs
|
||||
template.find('.link-item-download').remove();
|
||||
}
|
||||
|
||||
template.find('.file-item-name').before(image);
|
||||
template.find('.file-item-name').text(item.name);
|
||||
template.find('file-item-changed').text((new Date(item.time * 1000)).toLocaleString());
|
||||
template.find('.file-item-name').append(dot);
|
||||
var str = "";
|
||||
if(item.dimension){
|
||||
str += item.dimension + " | "
|
||||
}
|
||||
if(item.size){
|
||||
str += item.size + " | "
|
||||
}
|
||||
str += (new Date(item.time * 1000)).toLocaleString();
|
||||
template.find('.file-item-changed').text(str);
|
||||
$(lfm_content).append(template);
|
||||
});
|
||||
}
|
||||
|
|
@ -489,12 +535,15 @@ function rename(item) {
|
|||
}
|
||||
|
||||
function colors(item) {
|
||||
colorshue(lang['message-color'], item.color, function (color) {
|
||||
performLfmRequest('colorshue', {
|
||||
file: item.name,
|
||||
new_color: color
|
||||
}).done(refreshFoldersAndItems);
|
||||
});
|
||||
performLfmRequest('colorhue', {color: item.color})
|
||||
.done(function (data) {
|
||||
hideNavAndShowEditor(data, function () {
|
||||
performLfmRequest('docolorhue', {
|
||||
file: item.name,
|
||||
new_color: $('#notify').find('input').val(),
|
||||
}).done(refreshFoldersAndItems);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function trash(items) {
|
||||
|
|
@ -557,7 +606,11 @@ function preview(item) {
|
|||
|
||||
if(item.icon == "fa-image" || item.icon == "fa-file-pdf"){
|
||||
media.find('.media-preview').attr('src', item.url + '?timestamp=' + item.time).removeClass('d-none');
|
||||
|
||||
}else if(item.icon == "fab fa-youtube-square"){
|
||||
media.find('.embed-responsive-item').attr('src', 'https://www.youtube.com/embed/' +item.content + '?rel=0');
|
||||
media.find('.embed-responsive').removeClass('d-none');
|
||||
media.find('.media-content').val(item.content);
|
||||
media.find('.media-content').parent().removeClass('d-none');
|
||||
}else{
|
||||
var icon = $('<div>').addClass('file-item-icon fa ' + item.icon).css('color', item.color);
|
||||
media.find('.file-manager-col-view').html(icon).removeClass('d-none');
|
||||
|
|
@ -578,8 +631,6 @@ function preview(item) {
|
|||
.append($('<i class="fas fa-external-link-alt ml-2"></i>'));
|
||||
*/
|
||||
|
||||
|
||||
|
||||
notify(media);
|
||||
}
|
||||
|
||||
|
|
@ -800,26 +851,4 @@ function dialog(title, value, callback) {
|
|||
}
|
||||
});
|
||||
$('#dialog').modal('show').find('.modal-title').text(title);
|
||||
}
|
||||
|
||||
function colorshue(title, color, callback) {
|
||||
console.log(color);
|
||||
$('#minicolors-hue').minicolors('value', color);
|
||||
$('#colorhue').on('shown.bs.modal', function () {
|
||||
//$('#colorhue').find('input').focus();
|
||||
});
|
||||
$('#colorhue').find('.btn-primary').unbind('click').click(function (e) {
|
||||
callback($('#colorhue').find('input').val());
|
||||
});
|
||||
$('#colorhue').find('input').unbind('keypress.key13').bind('keypress.key13', function (e) {
|
||||
if (e.which === 13) {
|
||||
$('#colorhue').find('.btn-primary').click();
|
||||
}
|
||||
});
|
||||
$('#colorhue').modal('show').find('.modal-title').text(title);
|
||||
}
|
||||
|
||||
$('#minicolors-hue').minicolors({
|
||||
control: 'hue',
|
||||
position: 'bottom ' + 'left',
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue