var LFileManager = { lfm_route : location.origin + '/laravel-filemanager', lfm_show_list : '', lfm_sort_type : 'alphabetic', lfm_selected : {}, lfm_items : {}, lfm_content : '#file-manager-content', lfm_config : {}, initFileManager : function($editor = false) { var _self = this; //if(!$editor){ this.initDropzone(); $(document).on('click', '#lfm_add-file', function () { _self.performLfmRequest('add-file', {}) .done(function (data) { _self.hideNavAndShowEditor(data, function () { _self.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(_self.refreshFoldersAndItems); }); }); }); $(document).on('click', '#lfm_add-folder', function () { _self.dialog(_self.lfm_config['lfm_lang']['message-name'], '', _self.createFolder); }); $(document).on('click', '#lfm_upload', function () { $('#uploadModal').modal('show'); }); $('#uploadModal').on('hidden.bs.modal', function(e) { $('#uploadForm')[0].dropzone.removeAllFiles(); }); $('#uploadClearButton').on('click', function () { $('#uploadForm')[0].dropzone.removeAllFiles(); }); // } if($(this.lfm_content).length) { _self.loadItems(); _self.performLfmRequest('errors') .done(function (response) { JSON.parse(response).forEach(function (message) { $('#alerts').append( $('
' + title + '
\n' + '' + title + '
\n' + ''+description+'
'; } return insert; } return false; }, notImp : function() { this.notify('Not yet implemented!'); }, notify : function(body, callback) { $('#notify').find('.btn-primary').toggle(callback !== undefined); if(callback !== 'success'){ $('#notify').find('.btn-primary').unbind().click(callback); }else{ $('#notify').find('.btn-primary').unbind(); } $('#notify').modal('show').find('.modal-body').html(body); }, dialog : function(title, value, callback) { $('#dialog').find('input').val(value); $('#dialog').on('shown.bs.modal', function () { $('#dialog').find('input').focus(); }); $('#dialog').find('.btn-primary').unbind('click').click(function (e) { callback($('#dialog').find('input').val()); }); $('#dialog').find('input').unbind('keypress.key13').bind('keypress.key13', function (e) { if (e.which === 13) { $('#dialog').find('.btn-primary').click(); } }); $('#dialog').modal('show').find('.modal-title').text(title); }, }; $(document).ready(function () { LFileManager.initFileManager(); }); // ==================== // == Ajax actions == // ====================