Laravel version update
Laravel version update
This commit is contained in:
2
vendor/unisharp/laravel-filemanager/public/js/dropzone.min.js
vendored
Normal file
2
vendor/unisharp/laravel-filemanager/public/js/dropzone.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,33 +1,24 @@
|
||||
(function( $ ){
|
||||
|
||||
$.fn.filemanager = function(type = 'image') {
|
||||
$.fn.filemanager = function(type, options) {
|
||||
type = type || 'file';
|
||||
|
||||
if (type === 'image' || type === 'images') {
|
||||
type = 'Images';
|
||||
} else {
|
||||
type = 'Files';
|
||||
}
|
||||
this.on('click', function(e) {
|
||||
var route_prefix = (options && options.prefix) ? options.prefix : '/laravel-filemanager';
|
||||
localStorage.setItem('target_input', $(this).data('input'));
|
||||
localStorage.setItem('target_preview', $(this).data('preview'));
|
||||
window.open(route_prefix + '?type=' + type, 'FileManager', 'width=900,height=600');
|
||||
window.SetUrl = function (url, file_path) {
|
||||
//set the value of the desired input to image url
|
||||
var target_input = $('#' + localStorage.getItem('target_input'));
|
||||
target_input.val(file_path).trigger('change');
|
||||
|
||||
let input_id = this.data('input');
|
||||
let preview_id = this.data('preview');
|
||||
|
||||
this.on('click', function(e) {
|
||||
localStorage.setItem('target_input', input_id);
|
||||
localStorage.setItem('target_preview', preview_id);
|
||||
window.open('/laravel-filemanager?type=' + type, 'FileManager', 'width=900,height=600');
|
||||
return false;
|
||||
});
|
||||
}
|
||||
//set or change the preview image src
|
||||
var target_preview = $('#' + localStorage.getItem('target_preview'));
|
||||
target_preview.attr('src', url).trigger('change');
|
||||
};
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
function SetUrl(url){
|
||||
//set the value of the desired input to image url
|
||||
let target_input = $('#' + localStorage.getItem('target_input'));
|
||||
target_input.val(url);
|
||||
|
||||
//set or change the preview image src
|
||||
let target_preview = $('#' + localStorage.getItem('target_preview'));
|
||||
target_preview.attr('src',url);
|
||||
}
|
||||
|
98
vendor/unisharp/laravel-filemanager/public/js/mfb.js
vendored
Normal file
98
vendor/unisharp/laravel-filemanager/public/js/mfb.js
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Material floating button
|
||||
* By: Nobita
|
||||
* Repo and docs: https://github.com/nobitagit/material-floating-button
|
||||
*
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
// build script hook - don't remove
|
||||
;(function ( window, document, undefined ) {
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Some defaults
|
||||
*/
|
||||
var clickOpt = 'click',
|
||||
hoverOpt = 'hover',
|
||||
toggleMethod = 'data-mfb-toggle',
|
||||
menuState = 'data-mfb-state',
|
||||
isOpen = 'open',
|
||||
isClosed = 'closed',
|
||||
mainButtonClass = 'mfb-component__button--main';
|
||||
|
||||
/**
|
||||
* Internal references
|
||||
*/
|
||||
var elemsToClick,
|
||||
elemsToHover,
|
||||
mainButton,
|
||||
target,
|
||||
currentState;
|
||||
|
||||
/**
|
||||
* For every menu we need to get the main button and attach the appropriate evt.
|
||||
*/
|
||||
function attachEvt( elems, evt ){
|
||||
for( var i = 0, len = elems.length; i < len; i++ ){
|
||||
mainButton = elems[i].querySelector('.' + mainButtonClass);
|
||||
mainButton.addEventListener( evt , toggleButton, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the hover option, set a click toggle and a default,
|
||||
* initial state of 'closed' to menu that's been targeted.
|
||||
*/
|
||||
function replaceAttrs( elems ){
|
||||
for( var i = 0, len = elems.length; i < len; i++ ){
|
||||
elems[i].setAttribute( toggleMethod, clickOpt );
|
||||
elems[i].setAttribute( menuState, isClosed );
|
||||
}
|
||||
}
|
||||
|
||||
function getElemsByToggleMethod( selector ){
|
||||
return document.querySelectorAll('[' + toggleMethod + '="' + selector + '"]');
|
||||
}
|
||||
|
||||
/**
|
||||
* The open/close action is performed by toggling an attribute
|
||||
* on the menu main element.
|
||||
*
|
||||
* First, check if the target is the menu itself. If it's a child
|
||||
* keep walking up the tree until we found the main element
|
||||
* where we can toggle the state.
|
||||
*/
|
||||
function toggleButton( evt ){
|
||||
|
||||
target = evt.target;
|
||||
while ( target && !target.getAttribute( toggleMethod ) ){
|
||||
target = target.parentNode;
|
||||
if(!target) { return; }
|
||||
}
|
||||
|
||||
currentState = target.getAttribute( menuState ) === isOpen ? isClosed : isOpen;
|
||||
|
||||
target.setAttribute(menuState, currentState);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On touch enabled devices we assume that no hover state is possible.
|
||||
* So, we get the menu with hover action configured and we set it up
|
||||
* in order to make it usable with tap/click.
|
||||
**/
|
||||
if ( window.Modernizr && Modernizr.touch ){
|
||||
elemsToHover = getElemsByToggleMethod( hoverOpt );
|
||||
replaceAttrs( elemsToHover );
|
||||
}
|
||||
|
||||
elemsToClick = getElemsByToggleMethod( clickOpt );
|
||||
|
||||
attachEvt( elemsToClick, 'click' );
|
||||
|
||||
// build script hook - don't remove
|
||||
})( window, document );
|
||||
|
375
vendor/unisharp/laravel-filemanager/public/js/script.js
vendored
Normal file
375
vendor/unisharp/laravel-filemanager/public/js/script.js
vendored
Normal file
@@ -0,0 +1,375 @@
|
||||
var show_list;
|
||||
var sort_type = 'alphabetic';
|
||||
|
||||
$(document).ready(function () {
|
||||
bootbox.setDefaults({locale:lang['locale-bootbox']});
|
||||
loadFolders();
|
||||
performLfmRequest('errors')
|
||||
.done(function (data) {
|
||||
var response = JSON.parse(data);
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
$('#alerts').append(
|
||||
$('<div>').addClass('alert alert-warning')
|
||||
.append($('<i>').addClass('fa fa-exclamation-circle'))
|
||||
.append(' ' + response[i])
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$(window).on('dragenter', function(){
|
||||
$('#uploadModal').modal('show');
|
||||
});
|
||||
});
|
||||
|
||||
// ======================
|
||||
// == Navbar actions ==
|
||||
// ======================
|
||||
|
||||
$('#nav-buttons a').click(function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('#to-previous').click(function () {
|
||||
var previous_dir = getPreviousDir();
|
||||
if (previous_dir == '') return;
|
||||
goTo(previous_dir);
|
||||
});
|
||||
|
||||
$('#add-folder').click(function () {
|
||||
bootbox.prompt(lang['message-name'], function (result) {
|
||||
if (result == null) return;
|
||||
createFolder(result);
|
||||
});
|
||||
});
|
||||
|
||||
$('#upload').click(function () {
|
||||
$('#uploadModal').modal('show');
|
||||
});
|
||||
|
||||
$('#upload-btn').click(function () {
|
||||
$(this).html('')
|
||||
.append($('<i>').addClass('fa fa-refresh fa-spin'))
|
||||
.append(" " + lang['btn-uploading'])
|
||||
.addClass('disabled');
|
||||
|
||||
function resetUploadForm() {
|
||||
$('#uploadModal').modal('hide');
|
||||
$('#upload-btn').html(lang['btn-upload']).removeClass('disabled');
|
||||
$('input#upload').val('');
|
||||
}
|
||||
|
||||
$('#uploadForm').ajaxSubmit({
|
||||
success: function (data, statusText, xhr, $form) {
|
||||
resetUploadForm();
|
||||
refreshFoldersAndItems(data);
|
||||
displaySuccessMessage(data);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
displayErrorResponse(jqXHR);
|
||||
resetUploadForm();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#thumbnail-display').click(function () {
|
||||
show_list = 0;
|
||||
loadItems();
|
||||
});
|
||||
|
||||
$('#list-display').click(function () {
|
||||
show_list = 1;
|
||||
loadItems();
|
||||
});
|
||||
|
||||
$('#list-sort-alphabetic').click(function() {
|
||||
sort_type = 'alphabetic';
|
||||
loadItems();
|
||||
});
|
||||
|
||||
$('#list-sort-time').click(function() {
|
||||
sort_type = 'time';
|
||||
loadItems();
|
||||
});
|
||||
|
||||
// ======================
|
||||
// == Folder actions ==
|
||||
// ======================
|
||||
|
||||
$(document).on('click', '.file-item', function (e) {
|
||||
useFile($(this).data('id'));
|
||||
});
|
||||
|
||||
$(document).on('click', '.folder-item', function (e) {
|
||||
goTo($(this).data('id'));
|
||||
});
|
||||
|
||||
function goTo(new_dir) {
|
||||
$('#working_dir').val(new_dir);
|
||||
loadItems();
|
||||
}
|
||||
|
||||
function getPreviousDir() {
|
||||
var ds = '/';
|
||||
var working_dir = $('#working_dir').val();
|
||||
var last_ds = working_dir.lastIndexOf(ds);
|
||||
var previous_dir = working_dir.substring(0, last_ds);
|
||||
return previous_dir;
|
||||
}
|
||||
|
||||
function dir_starts_with(str) {
|
||||
return $('#working_dir').val().indexOf(str) === 0;
|
||||
}
|
||||
|
||||
function setOpenFolders() {
|
||||
var folders = $('.folder-item');
|
||||
|
||||
for (var i = folders.length - 1; i >= 0; i--) {
|
||||
// close folders that are not parent
|
||||
if (! dir_starts_with($(folders[i]).data('id'))) {
|
||||
$(folders[i]).children('i').removeClass('fa-folder-open').addClass('fa-folder');
|
||||
} else {
|
||||
$(folders[i]).children('i').removeClass('fa-folder').addClass('fa-folder-open');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====================
|
||||
// == Ajax actions ==
|
||||
// ====================
|
||||
|
||||
function performLfmRequest(url, parameter, type) {
|
||||
var data = defaultParameters();
|
||||
|
||||
if (parameter != null) {
|
||||
$.each(parameter, function (key, value) {
|
||||
data[key] = value;
|
||||
});
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
type: 'GET',
|
||||
dataType: type || 'text',
|
||||
url: lfm_route + '/' + url,
|
||||
data: data,
|
||||
cache: false
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
displayErrorResponse(jqXHR);
|
||||
});
|
||||
}
|
||||
|
||||
function displayErrorResponse(jqXHR) {
|
||||
notify('<div style="max-height:50vh;overflow: scroll;">' + jqXHR.responseText + '</div>');
|
||||
}
|
||||
|
||||
function displaySuccessMessage(data){
|
||||
if(data == 'OK'){
|
||||
var success = $('<div>').addClass('alert alert-success')
|
||||
.append($('<i>').addClass('fa fa-check'))
|
||||
.append(' File Uploaded Successfully.');
|
||||
$('#alerts').append(success);
|
||||
setTimeout(function () {
|
||||
success.remove();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
var refreshFoldersAndItems = function (data) {
|
||||
loadFolders();
|
||||
if (data != 'OK') {
|
||||
data = Array.isArray(data) ? data.join('<br/>') : data;
|
||||
notify(data);
|
||||
}
|
||||
};
|
||||
|
||||
var hideNavAndShowEditor = function (data) {
|
||||
$('#nav-buttons > ul').addClass('hidden');
|
||||
$('#content').html(data);
|
||||
}
|
||||
|
||||
function loadFolders() {
|
||||
performLfmRequest('folders', {}, 'html')
|
||||
.done(function (data) {
|
||||
$('#tree').html(data);
|
||||
loadItems();
|
||||
});
|
||||
}
|
||||
|
||||
function loadItems() {
|
||||
$('#lfm-loader').show();
|
||||
performLfmRequest('jsonitems', {show_list: show_list, sort_type: sort_type}, 'html')
|
||||
.done(function (data) {
|
||||
var response = JSON.parse(data);
|
||||
$('#content').html(response.html);
|
||||
$('#nav-buttons > ul').removeClass('hidden');
|
||||
$('#working_dir').val(response.working_dir);
|
||||
$('#current_dir').text(response.working_dir);
|
||||
console.log('Current working_dir : ' + $('#working_dir').val());
|
||||
if (getPreviousDir() == '') {
|
||||
$('#to-previous').addClass('hide');
|
||||
} else {
|
||||
$('#to-previous').removeClass('hide');
|
||||
}
|
||||
setOpenFolders();
|
||||
})
|
||||
.always(function(){
|
||||
$('#lfm-loader').hide();
|
||||
});
|
||||
}
|
||||
|
||||
function createFolder(folder_name) {
|
||||
performLfmRequest('newfolder', {name: folder_name})
|
||||
.done(refreshFoldersAndItems);
|
||||
}
|
||||
|
||||
function rename(item_name) {
|
||||
bootbox.prompt({
|
||||
title: lang['message-rename'],
|
||||
value: item_name,
|
||||
callback: function (result) {
|
||||
if (result == null) return;
|
||||
performLfmRequest('rename', {
|
||||
file: item_name,
|
||||
new_name: result
|
||||
}).done(refreshFoldersAndItems);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function trash(item_name) {
|
||||
bootbox.confirm(lang['message-delete'], function (result) {
|
||||
if (result == true) {
|
||||
performLfmRequest('delete', {items: item_name})
|
||||
.done(refreshFoldersAndItems);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cropImage(image_name) {
|
||||
performLfmRequest('crop', {img: image_name})
|
||||
.done(hideNavAndShowEditor);
|
||||
}
|
||||
|
||||
function resizeImage(image_name) {
|
||||
performLfmRequest('resize', {img: image_name})
|
||||
.done(hideNavAndShowEditor);
|
||||
}
|
||||
|
||||
function download(file_name) {
|
||||
var data = defaultParameters();
|
||||
data['file'] = file_name;
|
||||
location.href = lfm_route + '/download?' + $.param(data);
|
||||
}
|
||||
|
||||
// ==================================
|
||||
// == Ckeditor, Bootbox, preview ==
|
||||
// ==================================
|
||||
|
||||
function useFile(file_url) {
|
||||
|
||||
function getUrlParam(paramName) {
|
||||
var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i');
|
||||
var match = window.location.search.match(reParam);
|
||||
return ( match && match.length > 1 ) ? match[1] : null;
|
||||
}
|
||||
|
||||
function useTinymce3(url) {
|
||||
var win = tinyMCEPopup.getWindowArg("window");
|
||||
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = url;
|
||||
if (typeof(win.ImageDialog) != "undefined") {
|
||||
// Update image dimensions
|
||||
if (win.ImageDialog.getImageData) {
|
||||
win.ImageDialog.getImageData();
|
||||
}
|
||||
|
||||
// Preview if necessary
|
||||
if (win.ImageDialog.showPreviewImage) {
|
||||
win.ImageDialog.showPreviewImage(url);
|
||||
}
|
||||
}
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function useTinymce4AndColorbox(url, field_name) {
|
||||
parent.document.getElementById(field_name).value = url;
|
||||
|
||||
if(typeof parent.tinyMCE !== "undefined") {
|
||||
parent.tinyMCE.activeEditor.windowManager.close();
|
||||
}
|
||||
if(typeof parent.$.fn.colorbox !== "undefined") {
|
||||
parent.$.fn.colorbox.close();
|
||||
}
|
||||
}
|
||||
|
||||
function useCkeditor3(url) {
|
||||
if (window.opener) {
|
||||
// Popup
|
||||
window.opener.CKEDITOR.tools.callFunction(getUrlParam('CKEditorFuncNum'), url);
|
||||
} else {
|
||||
// Modal (in iframe)
|
||||
parent.CKEDITOR.tools.callFunction(getUrlParam('CKEditorFuncNum'), url);
|
||||
parent.CKEDITOR.tools.callFunction(getUrlParam('CKEditorCleanUpFuncNum'));
|
||||
}
|
||||
}
|
||||
|
||||
function useFckeditor2(url) {
|
||||
var p = url;
|
||||
var w = data['Properties']['Width'];
|
||||
var h = data['Properties']['Height'];
|
||||
window.opener.SetUrl(p,w,h);
|
||||
}
|
||||
|
||||
var url = file_url;
|
||||
var field_name = getUrlParam('field_name');
|
||||
var is_ckeditor = getUrlParam('CKEditor');
|
||||
var is_fcke = typeof data != 'undefined' && data['Properties']['Width'] != '';
|
||||
var file_path = url.replace(route_prefix, '');
|
||||
|
||||
if (window.opener || window.tinyMCEPopup || field_name || getUrlParam('CKEditorCleanUpFuncNum') || is_ckeditor) {
|
||||
if (window.tinyMCEPopup) { // use TinyMCE > 3.0 integration method
|
||||
useTinymce3(url);
|
||||
} else if (field_name) { // tinymce 4 and colorbox
|
||||
useTinymce4AndColorbox(url, field_name);
|
||||
} else if(is_ckeditor) { // use CKEditor 3.0 + integration method
|
||||
useCkeditor3(url);
|
||||
} else if (is_fcke) { // use FCKEditor 2.0 integration method
|
||||
useFckeditor2(url);
|
||||
} else { // standalone button or other situations
|
||||
window.opener.SetUrl(url, file_path);
|
||||
}
|
||||
|
||||
if (window.opener) {
|
||||
window.close();
|
||||
}
|
||||
} else {
|
||||
// No editor found, open/download file using browser's default method
|
||||
window.open(url);
|
||||
}
|
||||
}
|
||||
//end useFile
|
||||
|
||||
function defaultParameters() {
|
||||
return {
|
||||
working_dir: $('#working_dir').val(),
|
||||
type: $('#type').val()
|
||||
};
|
||||
}
|
||||
|
||||
function notImp() {
|
||||
notify('Not yet implemented!');
|
||||
}
|
||||
|
||||
function notify(message) {
|
||||
bootbox.alert(message);
|
||||
}
|
||||
|
||||
function fileView(file_url, timestamp) {
|
||||
bootbox.dialog({
|
||||
title: lang['title-view'],
|
||||
message: $('<img>')
|
||||
.addClass('img img-responsive center-block')
|
||||
.attr('src', file_url + '?timestamp=' + timestamp),
|
||||
size: 'large',
|
||||
onEscape: true,
|
||||
backdrop: true
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user