update v 1.0.7.5
This commit is contained in:
235
vendor/unisharp/laravel-filemanager/README.md
vendored
235
vendor/unisharp/laravel-filemanager/README.md
vendored
@@ -1,4 +1,6 @@
|
||||
# laravel-filemanager
|
||||
# Laravel Filemanager
|
||||
|
||||
[](https://packagist.org/packages/unisharp/laravel-filemanager) [](https://packagist.org/packages/unisharp/laravel-filemanager) [](https://packagist.org/packages/unisharp/laravel-filemanager) [](https://packagist.org/packages/unisharp/laravel-filemanager)
|
||||
|
||||
A files and images management user interface with file uploading support. (Works well with CKEditor and TinyMCE)
|
||||
|
||||
@@ -7,217 +9,46 @@ PR is welcome!
|
||||
## Overview
|
||||
|
||||
* The project was forked from [tsawler/laravel-filemanager](http://packalyst.com/packages/package/tsawler/laravel-filemanager)
|
||||
* Support public and private folders for multi users
|
||||
* Customizable views, routes and middlewares
|
||||
* Supported locales : en, fr, zh-TW, zh-CN, pt-BR
|
||||
* Customizable routes and middlewares
|
||||
* Supported locales : en, fr, pt-BR, tr, zh-CN, zh-TW
|
||||
* Supports public and private folders for multi users
|
||||
* Supports multi-level folders
|
||||
* Supports using independently(see integration doc)
|
||||
|
||||
## Documents
|
||||
|
||||
## Requirements
|
||||
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
|
||||
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
|
||||
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
|
||||
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
|
||||
|
||||
* php >= 5.5
|
||||
* Laravel 5
|
||||
* requires [intervention/image](https://github.com/Intervention/image) (to make thumbs, crop and resize images).
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install package
|
||||
|
||||
```bash
|
||||
composer require unisharp/laravel-filemanager
|
||||
```
|
||||
|
||||
1. Edit `config/app.php` :
|
||||
|
||||
Add service providers
|
||||
|
||||
```php
|
||||
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
|
||||
Intervention\Image\ImageServiceProvider::class,
|
||||
```
|
||||
|
||||
And add class aliases
|
||||
|
||||
```php
|
||||
'Image' => Intervention\Image\Facades\Image::class,
|
||||
```
|
||||
|
||||
1. Publish the package's config and assets :
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=lfm_config
|
||||
php artisan vendor:publish --tag=lfm_public
|
||||
```
|
||||
|
||||
1. Ensure that the files & images directories (in `config/lfm.php`) are writable by your web server.
|
||||
|
||||
## WYSIWYG Editor Integration:
|
||||
### Option 1: CKEditor
|
||||
|
||||
1. Install [laravel-ckeditor](https://github.com/UniSharp/laravel-ckeditor) package
|
||||
|
||||
1. Modify the views
|
||||
|
||||
Sample 1 - Replace by ID:
|
||||
```html
|
||||
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
|
||||
<textarea id="my-editor" name="content" class="form-control">{!! old('content', $content) !!}</textarea>
|
||||
<script>
|
||||
CKEDITOR.replace( 'my-editor', {
|
||||
filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
|
||||
filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token={{csrf_token()}}',
|
||||
filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
|
||||
filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token={{csrf_token()}}'
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Sample 2 - With JQuery Selector:
|
||||
|
||||
```html
|
||||
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
|
||||
<script src="/vendor/unisharp/laravel-ckeditor/adapters/jquery.js"></script>
|
||||
<textarea name="content" class="form-control my-editor">{!! old('content', $content) !!}</textarea>
|
||||
<script>
|
||||
$('textarea.my-editor').ckeditor({
|
||||
filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
|
||||
filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token={{csrf_token()}}',
|
||||
filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
|
||||
filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token={{csrf_token()}}'
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### Option 2: TinyMCE4
|
||||
|
||||
```html
|
||||
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
|
||||
<textarea name="content" class="form-control my-editor">{!! old('content', $content) !!}</textarea>
|
||||
<script>
|
||||
var editor_config = {
|
||||
path_absolute : "/",
|
||||
selector: "textarea",
|
||||
plugins: [
|
||||
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
|
||||
"searchreplace wordcount visualblocks visualchars code fullscreen",
|
||||
"insertdatetime media nonbreaking save table contextmenu directionality",
|
||||
"emoticons template paste textcolor colorpicker textpattern"
|
||||
],
|
||||
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
|
||||
relative_urls: false,
|
||||
file_browser_callback : function(field_name, url, type, win) {
|
||||
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
|
||||
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
|
||||
|
||||
var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
|
||||
if (type == 'image') {
|
||||
cmsURL = cmsURL + "&type=Images";
|
||||
} else {
|
||||
cmsURL = cmsURL + "&type=Files";
|
||||
}
|
||||
|
||||
tinyMCE.activeEditor.windowManager.open({
|
||||
file : cmsURL,
|
||||
title : 'Filemanager',
|
||||
width : x * 0.8,
|
||||
height : y * 0.8,
|
||||
resizable : "yes",
|
||||
close_previous : "no"
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
tinymce.init(editor_config);
|
||||
</script>
|
||||
```
|
||||
|
||||
## Config
|
||||
|
||||
In `config/lfm.php` :
|
||||
|
||||
```php
|
||||
'rename_file' => true,
|
||||
// true : files will be renamed as uniqid
|
||||
// false : files will remain original names
|
||||
|
||||
'use_package_routes' => true,
|
||||
// set this to false to customize route for file manager
|
||||
|
||||
'middlewares' => ['auth'],
|
||||
// determine middlewares that apply to all file manager routes
|
||||
|
||||
'allow_multi_user' => true,
|
||||
// true : user can upload files to shared folder and their own folder
|
||||
// false : all files are put together in shared folder
|
||||
|
||||
'user_field' => 'id',
|
||||
// determine which column of users table will be used as user's folder name
|
||||
|
||||
'shared_folder_name' => 'shares',
|
||||
// the name of shared folder
|
||||
|
||||
'thumb_folder_name' => 'thumbs',
|
||||
// the name of thumb folder
|
||||
|
||||
'images_dir' => 'public/photos/',
|
||||
'images_url' => '/photos/',
|
||||
// path and url of images
|
||||
|
||||
'files_dir' => 'public/files/',
|
||||
'files_url' => '/files/',
|
||||
// path and url of files
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
1. If the route is changed, make sure urls below is correspond to your route :
|
||||
|
||||
CKEditor
|
||||
```javascript
|
||||
<script>
|
||||
CKEDITOR.replace( 'editor', {
|
||||
filebrowserImageBrowseUrl: '/your-custom-route?type=Images',
|
||||
filebrowserBrowseUrl: '/your-custom-route?type=Files',
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
And be sure to include the `?type=Images` or `?type=Files` parameter.
|
||||
|
||||
TinyMCE
|
||||
```javascript
|
||||
...
|
||||
var cmsURL = editor_config.path_absolute + 'your-custom-route?field_name='+field_name+'&lang='+ tinymce.settings.language;
|
||||
if (type == 'image') {
|
||||
cmsURL = cmsURL + "&type=Images";
|
||||
} else {
|
||||
cmsURL = cmsURL + "&type=Files";
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
1. To customize the views :
|
||||
|
||||
on Linux :
|
||||
|
||||
```bash
|
||||
cp -rf vendor/unisharp/laravel-filemanager/src/views/* resources/views/vendor/laravel-filemanager/
|
||||
```
|
||||
|
||||
on MAC :
|
||||
|
||||
```bash
|
||||
cp -rf vendor/unisharp/laravel-filemanager/src/views/ resources/views/vendor/laravel-filemanager/
|
||||
```
|
||||
## Upgrade guide
|
||||
* `composer update unisharp/laravel-filemanager`
|
||||
* `php artisan vendor:publish --tag=lfm_view --force`
|
||||
* `php artisan vendor:publish --tag=lfm_config --force`(remember to keep your previous settings in `config/lfm.php`)
|
||||
|
||||
## Screenshots
|
||||
* Independent usage example :
|
||||
|
||||

|
||||
|
||||
* List view :
|
||||
|
||||

|
||||
|
||||
* Grid view :
|
||||
|
||||

|
||||
|
||||
## Credits
|
||||
* All contibutors from GitHub. (issues / PR)
|
||||
* Special thanks to
|
||||
* [@taswler](https://github.com/tsawler) the author.
|
||||
* [@taswler](https://github.com/tsawler) the original author.
|
||||
* [@olivervogel](https://github.com/olivervogel) for the awesome [image library](https://github.com/Intervention/image)
|
||||
* [@welcoMattic](https://github.com/welcoMattic) providing fr translations and lots of bugfixes.
|
||||
* [@fraterblack](https://github.com/fraterblack) TinyMCE 4 support and pt-BR translations.
|
||||
* [@olivervogel](https://github.com/olivervogel) for the awesome [image library](https://github.com/Intervention/image)
|
||||
* [All @UniSharp members](https://github.com/UniSharp)
|
||||
* [@1dot44mb](https://github.com/1dot44mb) tr translations.
|
||||
* [@Nikita240](https://github.com/Nikita240) fixing controller extending errors.
|
||||
* [@amin101](https://github.com/amin101) guide for independent use and fixes for url/directory error on Windows
|
||||
* [@nasirkhan](https://github.com/nasirkhan) bug fixes and alphanumeric filename check
|
||||
* All [@UniSharp](https://github.com/UniSharp) members
|
||||
|
@@ -9,7 +9,8 @@
|
||||
"tinymce",
|
||||
"upload",
|
||||
"file",
|
||||
"manager"
|
||||
"manager",
|
||||
"image"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
@@ -26,6 +27,10 @@
|
||||
"illuminate/support": ">=4.2.0",
|
||||
"intervention/image": "2.*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "to use GD library based image processing.",
|
||||
"ext-imagick": "to use Imagick based image processing."
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Unisharp\\Laravelfilemanager\\": "src/"
|
||||
|
67
vendor/unisharp/laravel-filemanager/doc/config.md
vendored
Normal file
67
vendor/unisharp/laravel-filemanager/doc/config.md
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
## Documents
|
||||
|
||||
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
|
||||
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
|
||||
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
|
||||
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
|
||||
|
||||
## Config
|
||||
|
||||
In `config/lfm.php` :
|
||||
|
||||
```php
|
||||
'rename_file' => true,
|
||||
// true : files will be renamed as uniqid
|
||||
// false : files will remain original names
|
||||
|
||||
// true : filter filename characters which are not alphanumeric, and replace them with '_'
|
||||
'alphanumeric_filename' => true,
|
||||
|
||||
'use_package_routes' => true,
|
||||
// set this to false to customize route for file manager
|
||||
|
||||
'middlewares' => ['auth'],
|
||||
// determine middlewares that apply to all file manager routes
|
||||
// NOTE: for laravel 5.2, please use ['web', 'auth']
|
||||
|
||||
'allow_multi_user' => true,
|
||||
// true : user can upload files to shared folder and their own folder
|
||||
// false : all files are put together in shared folder
|
||||
|
||||
'user_field' => 'id',
|
||||
// determine which column of users table will be used as user's folder name
|
||||
|
||||
'shared_folder_name' => 'shares',
|
||||
// the name of shared folder
|
||||
|
||||
'thumb_folder_name' => 'thumbs',
|
||||
// the name of thumb folder
|
||||
|
||||
'images_dir' => 'public/photos/',
|
||||
'images_url' => '/photos/',
|
||||
// path and url of images
|
||||
|
||||
'files_dir' => 'public/files/',
|
||||
'files_url' => '/files/',
|
||||
// path and url of files
|
||||
|
||||
|
||||
// valid image mimetypes
|
||||
'valid_image_mimetypes' => [
|
||||
'image/jpeg',
|
||||
'image/pjpeg',
|
||||
'image/png',
|
||||
'image/gif'
|
||||
],
|
||||
|
||||
|
||||
// valid file mimetypes (only when '/laravel-filemanager?type=Files')
|
||||
'valid_file_mimetypes' => [
|
||||
'image/jpeg',
|
||||
'image/pjpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'application/pdf',
|
||||
'text/plain'
|
||||
],
|
||||
```
|
48
vendor/unisharp/laravel-filemanager/doc/customization.md
vendored
Normal file
48
vendor/unisharp/laravel-filemanager/doc/customization.md
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
## Documents
|
||||
|
||||
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
|
||||
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
|
||||
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
|
||||
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
|
||||
|
||||
## Customization
|
||||
|
||||
Feel free to customize the routes and views if your need.
|
||||
|
||||
### Routes
|
||||
|
||||
1. Copy the routes in /vendor/unisharp/laravel-filemanager/src/routes.php
|
||||
|
||||
1. Make sure urls below is correspond to your route :
|
||||
|
||||
CKEditor
|
||||
```javascript
|
||||
<script>
|
||||
CKEDITOR.replace( 'editor', {
|
||||
filebrowserImageBrowseUrl: '/your-custom-route?type=Images',
|
||||
filebrowserBrowseUrl: '/your-custom-route?type=Files',
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
And be sure to include the `?type=Images` or `?type=Files` parameter.
|
||||
|
||||
TinyMCE
|
||||
```javascript
|
||||
...
|
||||
var cmsURL = editor_config.path_absolute + 'your-custom-route?field_name='+field_name+'&lang='+ tinymce.settings.language;
|
||||
if (type == 'image') {
|
||||
cmsURL = cmsURL + "&type=Images";
|
||||
} else {
|
||||
cmsURL = cmsURL + "&type=Files";
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
### Views
|
||||
|
||||
1. Copy the views from /vendor/unisharp/laravel-filemanager/src/views/ :
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=lfm_views
|
||||
```
|
49
vendor/unisharp/laravel-filemanager/doc/installation.md
vendored
Normal file
49
vendor/unisharp/laravel-filemanager/doc/installation.md
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
## Documents
|
||||
|
||||
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
|
||||
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
|
||||
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
|
||||
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
|
||||
|
||||
## Requirements
|
||||
|
||||
* php >= 5.5
|
||||
* Laravel 5
|
||||
* requires [intervention/image](https://github.com/Intervention/image) (to make thumbs, crop and resize images).
|
||||
|
||||
## Notes
|
||||
|
||||
* For `laravel 5.2`, please set `'middlewares' => ['web', 'auth'],` in config/lfm.php
|
||||
* With laravel-filemanager >= 1.3.0, the new configs `valid_image_mimetypes` and `valid_file_mimetypes` restrict the MIME types of the uploading files.
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install package
|
||||
|
||||
```bash
|
||||
composer require unisharp/laravel-filemanager
|
||||
```
|
||||
|
||||
1. Edit `config/app.php` :
|
||||
|
||||
Add service providers
|
||||
|
||||
```php
|
||||
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
|
||||
Intervention\Image\ImageServiceProvider::class,
|
||||
```
|
||||
|
||||
And add class aliases
|
||||
|
||||
```php
|
||||
'Image' => Intervention\Image\Facades\Image::class,
|
||||
```
|
||||
|
||||
1. Publish the package's config and assets :
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=lfm_config
|
||||
php artisan vendor:publish --tag=lfm_public
|
||||
```
|
||||
|
||||
1. Ensure that the files & images directories (in `config/lfm.php`) are writable by your web server.
|
123
vendor/unisharp/laravel-filemanager/doc/integration.md
vendored
Normal file
123
vendor/unisharp/laravel-filemanager/doc/integration.md
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
## Documents
|
||||
|
||||
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
|
||||
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
|
||||
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
|
||||
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
|
||||
|
||||
## WYSIWYG Editor Integration:
|
||||
### Option 1: CKEditor
|
||||
|
||||
1. Install [laravel-ckeditor](https://github.com/UniSharp/laravel-ckeditor) package
|
||||
|
||||
1. Modify the views
|
||||
|
||||
Sample 1 - Replace by ID:
|
||||
```html
|
||||
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
|
||||
<textarea id="my-editor" name="content" class="form-control">{!! old('content', $content) !!}</textarea>
|
||||
<script>
|
||||
CKEDITOR.replace( 'my-editor', {
|
||||
filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
|
||||
filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token={{csrf_token()}}',
|
||||
filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
|
||||
filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token={{csrf_token()}}'
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Sample 2 - With JQuery Selector:
|
||||
|
||||
```html
|
||||
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
|
||||
<script src="/vendor/unisharp/laravel-ckeditor/adapters/jquery.js"></script>
|
||||
<textarea name="content" class="form-control my-editor">{!! old('content', $content) !!}</textarea>
|
||||
<script>
|
||||
$('textarea.my-editor').ckeditor({
|
||||
filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
|
||||
filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token={{csrf_token()}}',
|
||||
filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
|
||||
filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token={{csrf_token()}}'
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### Option 2: TinyMCE4
|
||||
|
||||
```html
|
||||
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
|
||||
<textarea name="content" class="form-control my-editor">{!! old('content', $content) !!}</textarea>
|
||||
<script>
|
||||
var editor_config = {
|
||||
path_absolute : "/",
|
||||
selector: "textarea",
|
||||
plugins: [
|
||||
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
|
||||
"searchreplace wordcount visualblocks visualchars code fullscreen",
|
||||
"insertdatetime media nonbreaking save table contextmenu directionality",
|
||||
"emoticons template paste textcolor colorpicker textpattern"
|
||||
],
|
||||
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
|
||||
relative_urls: false,
|
||||
file_browser_callback : function(field_name, url, type, win) {
|
||||
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
|
||||
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
|
||||
|
||||
var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
|
||||
if (type == 'image') {
|
||||
cmsURL = cmsURL + "&type=Images";
|
||||
} else {
|
||||
cmsURL = cmsURL + "&type=Files";
|
||||
}
|
||||
|
||||
tinyMCE.activeEditor.windowManager.open({
|
||||
file : cmsURL,
|
||||
title : 'Filemanager',
|
||||
width : x * 0.8,
|
||||
height : y * 0.8,
|
||||
resizable : "yes",
|
||||
close_previous : "no"
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
tinymce.init(editor_config);
|
||||
</script>
|
||||
```
|
||||
|
||||
##Independent use
|
||||
|
||||
If you are going to use filemanager independently, meaning set the value of an input to selected photo/file url, follow this structure:
|
||||
|
||||
1. Create a button, input, and image preview holder if you are going to choose images.
|
||||
|
||||
Specify the id to the input and image preview by `data-input` and `data-preview`.
|
||||
|
||||
```html
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<a id="lfm" data-input="thumbnail" data-preview="holder" class="btn btn-primary">
|
||||
<i class="fa fa-picture-o"></i> Choose
|
||||
</a>
|
||||
</span>
|
||||
<input id="thumbnail" class="form-control" type="text" name="filepath">
|
||||
</div>
|
||||
<img id="holder" style="margin-top:15px;max-height:100px;">
|
||||
```
|
||||
|
||||
1. Import lfm.js(run `php artisan vendor:publish` if you need).
|
||||
|
||||
```javascript
|
||||
<script src="/vendor/laravel-filemanager/js/lfm.js"></script>
|
||||
```
|
||||
|
||||
1. Init filemanager with type. (requires jQuery)
|
||||
|
||||
```javascript
|
||||
$('#lfm').filemanager('image');
|
||||
```
|
||||
or
|
||||
|
||||
```javascript
|
||||
$('#lfm').filemanager('file');
|
||||
```
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
BIN
vendor/unisharp/laravel-filemanager/public/img/folder.png
vendored
Normal file
BIN
vendor/unisharp/laravel-filemanager/public/img/folder.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
33
vendor/unisharp/laravel-filemanager/public/js/lfm.js
vendored
Normal file
33
vendor/unisharp/laravel-filemanager/public/js/lfm.js
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
(function( $ ){
|
||||
|
||||
$.fn.filemanager = function(type = 'image') {
|
||||
|
||||
if (type === 'image' || type === 'images') {
|
||||
type = 'Images';
|
||||
} else {
|
||||
type = 'Files';
|
||||
}
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
})(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);
|
||||
}
|
@@ -31,6 +31,10 @@ class LaravelFilemanagerServiceProvider extends ServiceProvider {
|
||||
$this->publishes([
|
||||
__DIR__.'/../public' => public_path('vendor/laravel-filemanager'),
|
||||
], 'lfm_public');
|
||||
|
||||
$this->publishes([
|
||||
__DIR__.'/views' => base_path('resources/views/vendor/laravel-filemanager'),
|
||||
], 'lfm_view');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,25 +1,55 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'rename_file' => true,
|
||||
// If true, the uploaded file will be renamed to uniqid() + file extension.
|
||||
'rename_file' => true,
|
||||
|
||||
'use_package_routes' => true,
|
||||
// If rename_file set to false and this set to true, then filter filename characters which are not alphanumeric.
|
||||
'alphanumeric_filename' => true,
|
||||
|
||||
'middlewares' => ['auth'],
|
||||
'use_package_routes' => true,
|
||||
|
||||
'allow_multi_user' => true,
|
||||
// For laravel 5.2, please set to ['web', 'auth']
|
||||
'middlewares' => ['auth'],
|
||||
|
||||
'user_field' => 'id',
|
||||
// Allow multi_user mode or not.
|
||||
// If true, laravel-filemanager create private folders for each signed-in user.
|
||||
'allow_multi_user' => true,
|
||||
|
||||
'shared_folder_name' => 'shares',
|
||||
'thumb_folder_name' => 'thumbs',
|
||||
// The database field to identify a user.
|
||||
// When set to 'id', the private folder will be named as the user id.
|
||||
// NOTE: make sure to use an unique field.
|
||||
'user_field' => 'id',
|
||||
|
||||
'images_dir' => 'public/photos/',
|
||||
'images_url' => '/photos/',
|
||||
'shared_folder_name' => 'shares',
|
||||
'thumb_folder_name' => 'thumbs',
|
||||
|
||||
'files_dir' => 'public/files/',
|
||||
'files_url' => '/files/',
|
||||
'images_dir' => 'public/photos/',
|
||||
'images_url' => '/photos/',
|
||||
|
||||
'files_dir' => 'public/files/',
|
||||
'files_url' => '/files/',
|
||||
|
||||
// available since v1.3.0
|
||||
'valid_image_mimetypes' => [
|
||||
'image/jpeg',
|
||||
'image/pjpeg',
|
||||
'image/png',
|
||||
'image/gif'
|
||||
],
|
||||
|
||||
// available since v1.3.0
|
||||
// only when '/laravel-filemanager?type=Files'
|
||||
'valid_file_mimetypes' => [
|
||||
'image/jpeg',
|
||||
'image/pjpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'application/pdf',
|
||||
'text/plain',
|
||||
],
|
||||
|
||||
// file extensions array, only for showing file information, it won't affect the upload process.
|
||||
'file_type_array' => [
|
||||
'pdf' => 'Adobe Acrobat',
|
||||
'docx' => 'Microsoft Word',
|
||||
@@ -35,6 +65,7 @@ return [
|
||||
'pptx' => 'Microsoft PowerPoint',
|
||||
],
|
||||
|
||||
// file extensions array, only for showing icons, it won't affect the upload process.
|
||||
'file_icon_array' => [
|
||||
'pdf' => 'fa-file-pdf-o',
|
||||
'docx' => 'fa-file-word-o',
|
||||
|
10
vendor/unisharp/laravel-filemanager/src/controllers/Controller.php
vendored
Normal file
10
vendor/unisharp/laravel-filemanager/src/controllers/Controller.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
|
||||
abstract class Controller extends BaseController
|
||||
{
|
||||
use DispatchesJobs, ValidatesRequests;
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\View;
|
||||
@@ -20,7 +20,7 @@ class CropController extends LfmController {
|
||||
public function getCrop()
|
||||
{
|
||||
$working_dir = Input::get('working_dir');
|
||||
$img = parent::getUrl() . Input::get('img');
|
||||
$img = parent::getUrl('directory') . Input::get('img');
|
||||
|
||||
return View::make('laravel-filemanager::crop')
|
||||
->with(compact('working_dir', 'img'));
|
||||
@@ -46,7 +46,7 @@ class CropController extends LfmController {
|
||||
// make new thumbnail
|
||||
$thumb_img = Image::make(public_path() . $image);
|
||||
$thumb_img->fit(200, 200)
|
||||
->save(parent::getPath('thumb') . parent::getFileName($image));
|
||||
->save(parent::getPath('thumb') . parent::getFileName($image)['short']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Lang;
|
||||
|
||||
/**
|
||||
@@ -22,7 +21,7 @@ class DeleteController extends LfmController {
|
||||
{
|
||||
$name_to_delete = Input::get('items');
|
||||
|
||||
$file_path = parent::getPath();
|
||||
$file_path = parent::getPath('directory');
|
||||
|
||||
$file_to_delete = $file_path . $name_to_delete;
|
||||
$thumb_to_delete = parent::getPath('thumb') . $name_to_delete;
|
||||
@@ -43,11 +42,11 @@ class DeleteController extends LfmController {
|
||||
|
||||
File::delete($file_to_delete);
|
||||
|
||||
if (Session::get('lfm_type') == 'Images') {
|
||||
if ('Images' === $this->file_type) {
|
||||
File::delete($thumb_to_delete);
|
||||
}
|
||||
|
||||
return 'OK';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
/**
|
||||
* Class DownloadController
|
||||
@@ -19,7 +18,7 @@ class DownloadController extends LfmController {
|
||||
*/
|
||||
public function getDownload()
|
||||
{
|
||||
return Response::download(parent::getPath() . Input::get('file'));
|
||||
return Response::download(parent::getPath('directory') . Input::get('file'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,8 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\Str;
|
||||
use Lang;
|
||||
|
||||
/**
|
||||
@@ -22,14 +18,18 @@ class FolderController extends LfmController {
|
||||
*/
|
||||
public function getFolders()
|
||||
{
|
||||
$dir_path = parent::getPath();
|
||||
$directories = parent::getDirectories($dir_path);
|
||||
$user_path = parent::getPath('user');
|
||||
$lfm_user_path = parent::getFileName($user_path);
|
||||
$user_folders = parent::getDirectories($user_path);
|
||||
|
||||
$share_path = parent::getPath('share');
|
||||
$share_path = parent::getPath('share');
|
||||
$lfm_share_path = parent::getFileName($share_path);
|
||||
$shared_folders = parent::getDirectories($share_path);
|
||||
|
||||
return View::make('laravel-filemanager::tree')
|
||||
->with('dirs', $directories)
|
||||
return view('laravel-filemanager::tree')
|
||||
->with('user_dir', $lfm_user_path['long'])
|
||||
->with('dirs', $user_folders)
|
||||
->with('share_dir', $lfm_share_path['long'])
|
||||
->with('shares', $shared_folders);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class FolderController extends LfmController {
|
||||
{
|
||||
$folder_name = Input::get('name');
|
||||
|
||||
$path = parent::getPath() . $folder_name;
|
||||
$path = parent::getPath('directory') . $folder_name;
|
||||
|
||||
if (!File::exists($path)) {
|
||||
File::makeDirectory($path, $mode = 0777, true, true);
|
||||
|
@@ -1,14 +1,9 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Intervention\Image\Facades\Image;
|
||||
|
||||
/**
|
||||
* Class ItemsController
|
||||
@@ -33,20 +28,20 @@ class ItemsController extends LfmController {
|
||||
$directories = parent::getDirectories($path);
|
||||
$thumb_url = parent::getUrl('thumb');
|
||||
|
||||
return View::make($view)
|
||||
return view($view)
|
||||
->with(compact('files', 'file_info', 'directories', 'thumb_url'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function getFileInfos($files, $type = 'Images')
|
||||
{
|
||||
$file_info = [];
|
||||
|
||||
foreach ($files as $key => $file) {
|
||||
$file_name = parent::getFileName($file);
|
||||
$file_name = parent::getFileName($file)['short'];
|
||||
$file_created = filemtime($file);
|
||||
$file_size = number_format((File::size($file) / 1024), 2, ".", "");
|
||||
|
||||
|
||||
if ($file_size > 1024) {
|
||||
$file_size = number_format(($file_size / 1024), 2, ".", "") . " Mb";
|
||||
} else {
|
||||
|
@@ -1,12 +1,9 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Intervention\Image\Facades\Image;
|
||||
|
||||
/**
|
||||
* Class LfmController
|
||||
@@ -17,20 +14,30 @@ class LfmController extends Controller {
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $file_location;
|
||||
public $dir_location;
|
||||
|
||||
public $file_location = null;
|
||||
public $dir_location = null;
|
||||
public $file_type = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->setPathAndType();
|
||||
|
||||
$this->checkMyFolderExists();
|
||||
|
||||
$this->checkSharedFolderExists();
|
||||
$this->file_type = Input::get('type', 'Images'); // default set to Images.
|
||||
|
||||
if ('Images' === $this->file_type) {
|
||||
$this->dir_location = Config::get('lfm.images_url');
|
||||
$this->file_location = Config::get('lfm.images_dir');
|
||||
} elseif ('Files' === $this->file_type) {
|
||||
$this->dir_location = Config::get('lfm.files_url');
|
||||
$this->file_location = Config::get('lfm.files_dir');
|
||||
} else {
|
||||
throw new \Exception('unexpected type parameter');
|
||||
}
|
||||
|
||||
$this->checkDefaultFolderExists('user');
|
||||
$this->checkDefaultFolderExists('share');
|
||||
}
|
||||
|
||||
|
||||
@@ -41,14 +48,12 @@ class LfmController extends Controller {
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
if (Input::has('working_dir')) {
|
||||
$working_dir = Input::get('working_dir');
|
||||
} else {
|
||||
$working_dir = '/';
|
||||
}
|
||||
$working_dir = '/';
|
||||
$working_dir .= (Config::get('lfm.allow_multi_user')) ? $this->getUserSlug() : Config::get('lfm.shared_folder_name');
|
||||
|
||||
return View::make('laravel-filemanager::index')
|
||||
->with('working_dir', $working_dir);
|
||||
return view('laravel-filemanager::index')
|
||||
->with('working_dir', $working_dir)
|
||||
->with('file_type', $this->file_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,37 +62,13 @@ class LfmController extends Controller {
|
||||
*****************************/
|
||||
|
||||
|
||||
private function setPathAndType()
|
||||
private function checkDefaultFolderExists($type = 'share')
|
||||
{
|
||||
// dd('type:'.Input::get('type'));
|
||||
|
||||
if (Input::has('type') && Input::get('type') === 'Files') {
|
||||
Session::put('lfm_type', 'Files');
|
||||
Session::put('lfm.file_location', Config::get('lfm.files_dir'));
|
||||
Session::put('lfm.dir_location', Config::get('lfm.files_url'));
|
||||
} else if (Input::has('type') && Input::get('type') === 'Images') {
|
||||
Session::put('lfm_type', 'Images');
|
||||
Session::put('lfm.file_location', Config::get('lfm.images_dir'));
|
||||
Session::put('lfm.dir_location', Config::get('lfm.images_url'));
|
||||
if ($type === 'user' && \Config::get('lfm.allow_multi_user') !== true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function checkMyFolderExists()
|
||||
{
|
||||
if (\Config::get('lfm.allow_multi_user') === true) {
|
||||
$path = $this->getPath();
|
||||
|
||||
if (!File::exists($path)) {
|
||||
File::makeDirectory($path, $mode = 0777, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function checkSharedFolderExists()
|
||||
{
|
||||
$path = $this->getPath('share');
|
||||
$path = $this->getPath($type);
|
||||
|
||||
if (!File::exists($path)) {
|
||||
File::makeDirectory($path, $mode = 0777, true, true);
|
||||
@@ -95,20 +76,34 @@ class LfmController extends Controller {
|
||||
}
|
||||
|
||||
|
||||
private function formatLocation($location, $type = null)
|
||||
private function formatLocation($location, $type = null, $get_thumb = false)
|
||||
{
|
||||
if ($type === 'share') {
|
||||
return $location . Config::get('lfm.shared_folder_name') . '/';
|
||||
return $location . Config::get('lfm.shared_folder_name');
|
||||
} elseif ($type === 'user') {
|
||||
return $location . $this->getUserSlug();
|
||||
}
|
||||
|
||||
$working_dir = Input::get('working_dir');
|
||||
|
||||
if ($working_dir !== '/') {
|
||||
$location .= $working_dir . '/';
|
||||
// remove first slash
|
||||
if (substr($working_dir, 0, 1) === '/') {
|
||||
$working_dir = substr($working_dir, 1);
|
||||
}
|
||||
|
||||
if ($type === 'thumb') {
|
||||
$location = $location . Config::get('lfm.thumb_folder_name') . '/';
|
||||
|
||||
$location .= $working_dir;
|
||||
|
||||
if ($type === 'directory' || $type === 'thumb') {
|
||||
$location .= '/';
|
||||
}
|
||||
|
||||
//if user is inside thumbs folder there is no need
|
||||
// to add thumbs substring to the end of $location
|
||||
$in_thumb_folder = preg_match('/'.Config::get('lfm.thumb_folder_name').'$/i',$working_dir);
|
||||
|
||||
if ($type === 'thumb' && !$in_thumb_folder) {
|
||||
$location .= Config::get('lfm.thumb_folder_name') . '/';
|
||||
}
|
||||
|
||||
return $location;
|
||||
@@ -120,9 +115,15 @@ class LfmController extends Controller {
|
||||
****************************/
|
||||
|
||||
|
||||
public function getPath($type = null)
|
||||
public function getUserSlug()
|
||||
{
|
||||
$path = base_path() . '/' . Session::get('lfm.file_location');
|
||||
return empty(auth()->user()) ? '' : \Auth::user()->user_field;
|
||||
}
|
||||
|
||||
|
||||
public function getPath($type = null, $get_thumb = false)
|
||||
{
|
||||
$path = base_path() . '/' . $this->file_location;
|
||||
|
||||
$path = $this->formatLocation($path, $type);
|
||||
|
||||
@@ -132,10 +133,12 @@ class LfmController extends Controller {
|
||||
|
||||
public function getUrl($type = null)
|
||||
{
|
||||
$url = Session::get('lfm.dir_location');
|
||||
$url = $this->dir_location;
|
||||
|
||||
$url = $this->formatLocation($url, $type);
|
||||
|
||||
$url = str_replace('\\','/',$url);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
@@ -150,7 +153,7 @@ class LfmController extends Controller {
|
||||
foreach ($all_directories as $directory) {
|
||||
$dir_name = $this->getFileName($directory);
|
||||
|
||||
if ($dir_name !== $thumb_folder_name) {
|
||||
if ($dir_name['short'] !== $thumb_folder_name) {
|
||||
$arr_dir[] = $dir_name;
|
||||
}
|
||||
}
|
||||
@@ -161,10 +164,14 @@ class LfmController extends Controller {
|
||||
|
||||
public function getFileName($file)
|
||||
{
|
||||
$path_parts = explode('/', $file);
|
||||
$lfm_dir_start = strpos($file, $this->file_location);
|
||||
$working_dir_start = $lfm_dir_start + strlen($this->file_location);
|
||||
$lfm_file_path = substr($file, $working_dir_start);
|
||||
|
||||
$filename = end($path_parts);
|
||||
$arr_dir = explode('/', $lfm_file_path);
|
||||
$arr_filename['short'] = end($arr_dir);
|
||||
$arr_filename['long'] = '/' . $lfm_file_path;
|
||||
|
||||
return $filename;
|
||||
return $arr_filename;
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Str;
|
||||
use Lang;
|
||||
|
||||
@@ -22,7 +21,7 @@ class RenameController extends LfmController {
|
||||
$old_name = Input::get('file');
|
||||
$new_name = Input::get('new_name');
|
||||
|
||||
$file_path = parent::getPath();
|
||||
$file_path = parent::getPath('directory');
|
||||
$thumb_path = parent::getPath('thumb');
|
||||
|
||||
$old_file = $file_path . $old_name;
|
||||
@@ -42,10 +41,10 @@ class RenameController extends LfmController {
|
||||
File::move($old_file, $new_file);
|
||||
return 'OK';
|
||||
}
|
||||
|
||||
|
||||
File::move($old_file, $new_file);
|
||||
|
||||
if (Session::get('lfm_type') == 'Images') {
|
||||
if ('Images' === $this->file_type) {
|
||||
File::move($thumb_path . $old_name, $thumb_path . $new_name);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\View;
|
||||
@@ -22,7 +22,7 @@ class ResizeController extends LfmController {
|
||||
$ratio = 1.0;
|
||||
$image = Input::get('img');
|
||||
|
||||
$path_to_image = parent::getPath() . $image;
|
||||
$path_to_image = parent::getPath('directory') . $image;
|
||||
$original_width = Image::make($path_to_image)->width();
|
||||
$original_height = Image::make($path_to_image)->height();
|
||||
|
||||
@@ -46,7 +46,7 @@ class ResizeController extends LfmController {
|
||||
}
|
||||
|
||||
return View::make('laravel-filemanager::resize')
|
||||
->with('img', parent::getUrl() . $image)
|
||||
->with('img', parent::getUrl('directory') . $image)
|
||||
->with('height', number_format($height, 0))
|
||||
->with('width', $width)
|
||||
->with('original_height', $original_height)
|
||||
|
@@ -1,13 +1,13 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Str;
|
||||
use Lang;
|
||||
use Intervention\Image\Facades\Image;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
/**
|
||||
* Class UploadController
|
||||
@@ -15,6 +15,9 @@ use Intervention\Image\Facades\Image;
|
||||
*/
|
||||
class UploadController extends LfmController {
|
||||
|
||||
private $default_file_types = ['application/pdf'];
|
||||
private $default_image_types = ['image/jpeg', 'image/png', 'image/gif'];
|
||||
|
||||
/**
|
||||
* Upload an image/file and (for images) create thumbnail
|
||||
*
|
||||
@@ -23,15 +26,20 @@ class UploadController extends LfmController {
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
if (!Input::hasFile('upload')) {
|
||||
return Lang::get('laravel-filemanager::lfm.error-file-empty');
|
||||
try {
|
||||
$res = $this->uploadValidator();
|
||||
if (true !== $res) {
|
||||
return Lang::get('laravel-filemanager::lfm.error-invalid');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
$file = Input::file('upload');
|
||||
|
||||
$new_filename = $this->getNewName($file);
|
||||
|
||||
$dest_path = parent::getPath();
|
||||
$dest_path = parent::getPath('directory');
|
||||
|
||||
if (File::exists($dest_path . $new_filename)) {
|
||||
return Lang::get('laravel-filemanager::lfm.error-file-exist');
|
||||
@@ -39,7 +47,7 @@ class UploadController extends LfmController {
|
||||
|
||||
$file->move($dest_path, $new_filename);
|
||||
|
||||
if (Session::get('lfm_type') == 'Images') {
|
||||
if ('Images' === $this->file_type) {
|
||||
$this->makeThumb($dest_path, $new_filename);
|
||||
}
|
||||
|
||||
@@ -51,14 +59,57 @@ class UploadController extends LfmController {
|
||||
return 'OK';
|
||||
}
|
||||
|
||||
private function uploadValidator()
|
||||
{
|
||||
// when uploading a file with the POST named "upload"
|
||||
|
||||
$expected_file_type = $this->file_type;
|
||||
$is_valid = false;
|
||||
|
||||
$file = Input::file('upload');
|
||||
if (empty($file)) {
|
||||
throw new \Exception(Lang::get('laravel-filemanager::lfm.error-file-empty'));
|
||||
}
|
||||
if (!$file instanceof UploadedFile) {
|
||||
throw new \Exception(Lang::get('laravel-filemanager::lfm.error-instance'));
|
||||
}
|
||||
|
||||
$mimetype = $file->getMimeType();
|
||||
|
||||
if ($expected_file_type === 'Files') {
|
||||
$config_name = 'lfm.valid_file_mimetypes';
|
||||
$valid_mimetypes = Config::get($config_name, $this->default_file_types);
|
||||
} else {
|
||||
$config_name = 'lfm.valid_image_mimetypes';
|
||||
$valid_mimetypes = Config::get($config_name, $this->default_image_types);
|
||||
}
|
||||
|
||||
if (!is_array($valid_mimetypes)) {
|
||||
throw new \Exception('Config : ' . $config_name . ' is not set correctly');
|
||||
}
|
||||
|
||||
if (in_array($mimetype, $valid_mimetypes)) {
|
||||
$is_valid = true;
|
||||
}
|
||||
|
||||
if (false === $is_valid) {
|
||||
throw new \Exception(Lang::get('laravel-filemanager::lfm.error-mime') . $mimetype);
|
||||
}
|
||||
return $is_valid;
|
||||
}
|
||||
|
||||
private function getNewName($file)
|
||||
{
|
||||
$new_filename = $file->getClientOriginalName();
|
||||
|
||||
if (Config::get('lfm.rename_file') === true) {
|
||||
$new_filename = uniqid() . '.' . $file->getClientOriginalExtension();
|
||||
$new_filename = uniqid();
|
||||
} elseif (Config::get('lfm.alphanumeric_filename') === true) {
|
||||
$new_filename = preg_replace('/[^A-Za-z0-9\-\']/', '_', $file->getClientOriginalName());
|
||||
}
|
||||
|
||||
$new_filename = $new_filename . '.' . $file->getClientOriginalExtension();
|
||||
|
||||
return $new_filename;
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'nav-back' => 'Back',
|
||||
'nav-new' => 'New Folder',
|
||||
'nav-upload' => 'Upload',
|
||||
'nav-thumbnails' => 'Thumbnails',
|
||||
'nav-list' => 'List',
|
||||
|
||||
'menu-new' => 'New Folder',
|
||||
'menu-rename' => 'Rename',
|
||||
'menu-delete' => 'Delete',
|
||||
'menu-view' => 'View',
|
||||
@@ -39,10 +40,13 @@ return [
|
||||
'error-delete' => 'You cannot delete this folder because it is not empty!',
|
||||
'error-folder-name' => 'Folder name cannot be empty!',
|
||||
'error-folder-exist'=> 'A folder with this name already exists!',
|
||||
'error-mime' => 'Unexpected MimeType: ',
|
||||
'error-instance' => 'The uploaded file should be an instance of UploadedFile',
|
||||
'error-invalid' => 'Invalid upload request',
|
||||
|
||||
'btn-upload' => 'Upload File',
|
||||
'btn-close' => 'Close',
|
||||
'btn-uploading' => 'Uploading...',
|
||||
'btn-close' => 'Close',
|
||||
'btn-crop' => 'Crop',
|
||||
'btn-cancel' => 'Cancel',
|
||||
'btn-resize' => 'Resize',
|
||||
@@ -56,5 +60,4 @@ return [
|
||||
'resize-new-width' => 'Width:',
|
||||
|
||||
'locale-bootbox' => 'en',
|
||||
|
||||
];
|
||||
|
63
vendor/unisharp/laravel-filemanager/src/lang/fa/lfm.php
vendored
Normal file
63
vendor/unisharp/laravel-filemanager/src/lang/fa/lfm.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'nav-back' => 'بازگشت',
|
||||
'nav-new' => 'پوشه جدید',
|
||||
'nav-upload' => 'آپلود',
|
||||
'nav-thumbnails' => 'تصویرک ها',
|
||||
'nav-list' => 'لیست',
|
||||
|
||||
'menu-rename' => 'تغییر نام',
|
||||
'menu-delete' => 'حذف',
|
||||
'menu-view' => 'مشاهده',
|
||||
'menu-download' => 'دانلود',
|
||||
'menu-resize' => 'تغییر اندازه',
|
||||
'menu-crop' => 'برش',
|
||||
|
||||
'title-page' => 'مدیریت فایل',
|
||||
'title-panel' => 'مدیریت فایل لاراول',
|
||||
'title-upload' => 'آپلود کردن فایل',
|
||||
'title-view' => 'مشاهده فایل',
|
||||
'title-root' => 'فایل ها',
|
||||
'title-shares' => 'فایل های اشتراکی',
|
||||
'title-item' => 'آیتم',
|
||||
'title-size' => 'اندازه',
|
||||
'title-type' => 'نوع',
|
||||
'title-modified' => 'تاریخ آخرین ویرایش',
|
||||
'title-action' => 'اقدام',
|
||||
|
||||
'type-folder' => 'پوشه',
|
||||
|
||||
'message-empty' => 'پوشه خالی است.',
|
||||
'message-choose' => 'انتخاب فایل',
|
||||
'message-delete' => 'آیا برای حذف این آیتم مطمئن هستید؟',
|
||||
'message-name' => 'نام پوشه:',
|
||||
'message-rename' => 'تغییر نام به:',
|
||||
|
||||
'error-rename' => 'این نام قبلا استفاده شده!',
|
||||
'error-file-empty' => 'شما باید یک فایل را انتخاب کنید!',
|
||||
'error-file-exist' => 'یک فایل دیگر با این نام قبلا ایجاد شده است!',
|
||||
'error-delete' => 'به دلیل خالی نبودن پوشه امکان حذف آن وجود ندارد!',
|
||||
'error-folder-name' => 'نام پوشه نمی تواند خالی باشد!',
|
||||
'error-folder-exist'=> 'یک پوشه با این نام قبلا ایجاد شده است!',
|
||||
'error-mime' => 'پسوند غیرمجاز: ',
|
||||
'error-instance' => 'فایل آپلود شده باید نمونه ای از UploadedFile باشد',
|
||||
'error-invalid' => 'درخواست آپلود غیرمعتبر',
|
||||
|
||||
'btn-upload' => 'آپلود فایل',
|
||||
'btn-uploading' => 'در حال آپلود',
|
||||
'btn-close' => 'بستن',
|
||||
'btn-crop' => 'برش',
|
||||
'btn-cancel' => 'انصراف',
|
||||
'btn-resize' => 'تغییر اندازه',
|
||||
|
||||
'resize-ratio' => 'نسبت:',
|
||||
'resize-scaled' => 'تصویر مفیاس شده:',
|
||||
'resize-true' => 'بله',
|
||||
'resize-old-height' => 'ارتفاع اصلی:',
|
||||
'resize-old-width' => 'پهنای اصلی:',
|
||||
'resize-new-height' => 'ارتفاع:',
|
||||
'resize-new-width' => 'پهنا:',
|
||||
|
||||
'locale-bootbox' => 'fa',
|
||||
];
|
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'nav-back' => 'Back',
|
||||
'nav-new' => 'Nouveau dossier',
|
||||
'nav-upload' => 'Charger',
|
||||
'nav-thumbnails' => 'Vignettes',
|
||||
'nav-list' => 'Liste',
|
||||
|
||||
'menu-new' => 'Nouveau dossier',
|
||||
'menu-rename' => 'Renommez',
|
||||
'menu-delete' => 'Effacer',
|
||||
'menu-view' => 'Voir le',
|
||||
@@ -39,10 +40,13 @@ return [
|
||||
'error-delete' => "Vous ne pouvez pas supprimer ce dossier car il n'est pas vide",
|
||||
'error-folder-name' => 'Le nom du dossier ne peut pas être vide',
|
||||
'error-folder-exist'=> 'Un dossier avec ce nom existe déjà !',
|
||||
'error-mime' => 'Unexpected MimeType: ',
|
||||
'error-instance' => 'The uploaded file should be an instance of UploadedFile',
|
||||
'error-invalid' => 'Invalid upload request',
|
||||
|
||||
'btn-upload' => 'Envoyer le fichier',
|
||||
'btn-close' => 'Fermer',
|
||||
'btn-uploading' => 'Envoi...',
|
||||
'btn-close' => 'Fermer',
|
||||
'btn-crop' => 'Rogner',
|
||||
'btn-cancel' => 'Annuler',
|
||||
'btn-resize' => 'Redimensionner',
|
||||
@@ -56,5 +60,4 @@ return [
|
||||
'resize-new-width' => 'Largeur',
|
||||
|
||||
'locale-bootbox' => 'fr',
|
||||
|
||||
];
|
||||
|
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'nav-back' => 'Back',
|
||||
'nav-new' => 'Nova Pasta',
|
||||
'nav-upload' => 'Enviar',
|
||||
'nav-thumbnails' => 'Miniatura',
|
||||
'nav-list' => 'Lista',
|
||||
|
||||
'menu-new' => 'Nova Pasta',
|
||||
'menu-rename' => 'Renomear',
|
||||
'menu-delete' => 'Deletar',
|
||||
'menu-view' => 'Ver',
|
||||
@@ -39,10 +40,13 @@ return [
|
||||
'error-delete' => 'Você não pode deletar esta pasta, pois ela não está vazia!',
|
||||
'error-folder-name' => 'Nome da pasta não pode ser vazio!',
|
||||
'error-folder-exist'=> 'Uma pasta com este nome já existe!',
|
||||
'error-mime' => 'Unexpected MimeType: ',
|
||||
'error-instance' => 'The uploaded file should be an instance of UploadedFile',
|
||||
'error-invalid' => 'Invalid upload request',
|
||||
|
||||
'btn-upload' => 'Enviar Arquivo',
|
||||
'btn-close' => 'Fechar',
|
||||
'btn-uploading' => 'Enviando...',
|
||||
'btn-close' => 'Fechar',
|
||||
'btn-crop' => 'Cortar',
|
||||
'btn-cancel' => 'Cancelar',
|
||||
'btn-resize' => 'Redimensionar',
|
||||
|
63
vendor/unisharp/laravel-filemanager/src/lang/tr/lfm.php
vendored
Normal file
63
vendor/unisharp/laravel-filemanager/src/lang/tr/lfm.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'nav-back' => 'Back',
|
||||
'nav-new' => 'Yeni Klasör',
|
||||
'nav-upload' => 'Yükle',
|
||||
'nav-thumbnails' => 'Küçük Resim',
|
||||
'nav-list' => 'Liste',
|
||||
|
||||
'menu-rename' => 'Ad değiştir',
|
||||
'menu-delete' => 'Sil',
|
||||
'menu-view' => 'Görüntüle',
|
||||
'menu-download' => 'İndir',
|
||||
'menu-resize' => 'Boyutlandır',
|
||||
'menu-crop' => 'Kırp',
|
||||
|
||||
'title-page' => 'Dosya Kütüphanesi',
|
||||
'title-panel' => 'Laravel Dosya Kütüphanesi',
|
||||
'title-upload' => 'Dosya Yükle',
|
||||
'title-view' => 'Dosya Gör',
|
||||
'title-root' => 'Dosyalarım',
|
||||
'title-shares' => 'Paylaşılan Dosyalar',
|
||||
'title-item' => 'Dosya',
|
||||
'title-size' => 'Boyut',
|
||||
'title-type' => 'Tür',
|
||||
'title-modified' => 'Güncelleme',
|
||||
'title-action' => 'Komutlar',
|
||||
|
||||
'type-folder' => 'Klasör',
|
||||
|
||||
'message-empty' => 'Klasör boş.',
|
||||
'message-choose' => 'Dosya seç',
|
||||
'message-delete' => 'Bu dosyayı silmek istediğinizden emin misiniz?',
|
||||
'message-name' => 'Klasör adı:',
|
||||
'message-rename' => 'Yeni ad:',
|
||||
|
||||
'error-rename' => 'Dosya adı kullanımda!',
|
||||
'error-file-empty' => 'Bir dosya seçmelisiniz!',
|
||||
'error-file-exist' => 'Bu adda bir dosya zaten var!',
|
||||
'error-delete' => 'Klasör boş olmadığından, klasörü silemezsiniz!',
|
||||
'error-folder-name' => 'Klasör adı yazılmalıdır!',
|
||||
'error-folder-exist'=> 'Bu adda bir klasör zaten var!',
|
||||
'error-mime' => 'Unexpected MimeType: ',
|
||||
'error-instance' => 'The uploaded file should be an instance of UploadedFile',
|
||||
'error-invalid' => 'Invalid upload request',
|
||||
|
||||
'btn-upload' => 'Yükle',
|
||||
'btn-uploading' => 'Yükleniyor...',
|
||||
'btn-close' => 'Kapat',
|
||||
'btn-crop' => 'Kırp',
|
||||
'btn-cancel' => 'İptal',
|
||||
'btn-resize' => 'Boyutlandır',
|
||||
|
||||
'resize-ratio' => 'Oran:',
|
||||
'resize-scaled' => 'Boyutlandırıldı mı:',
|
||||
'resize-true' => 'Evet',
|
||||
'resize-old-height' => 'Orijinal Yükseklik:',
|
||||
'resize-old-width' => 'Orijinal Genişlik:',
|
||||
'resize-new-height' => 'Yükseklik:',
|
||||
'resize-new-width' => 'Genişlik:',
|
||||
|
||||
'locale-bootbox' => 'tr',
|
||||
];
|
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'nav-back' => '回上一页',
|
||||
'nav-new' => '添加文件夹',
|
||||
'nav-upload' => '上传档案',
|
||||
'nav-thumbnails' => '缩略图显示',
|
||||
'nav-list' => '列表显示',
|
||||
|
||||
'menu-new' => '添加文件夹',
|
||||
'menu-rename' => '重命名',
|
||||
'menu-delete' => '删除',
|
||||
'menu-view' => '预览',
|
||||
@@ -33,16 +34,19 @@ return [
|
||||
'message-name' => '文件夹名称:',
|
||||
'message-rename' => '重命名为:',
|
||||
|
||||
'error-rename' => '名稱重複,請重新輸入!',
|
||||
'error-file-empty' => '請選擇檔案!',
|
||||
'error-file-exist' => '相同檔名的檔案已存在!',
|
||||
'error-delete' => '資料夾未清空,無法刪除!',
|
||||
'error-folder-name' => '請輸入資料夾名稱!',
|
||||
'error-folder-exist'=> '相同名稱的資料夾已存在!',
|
||||
'error-rename' => '名称重复,请重新输入!',
|
||||
'error-file-empty' => '请选择档案!',
|
||||
'error-file-exist' => '相同档名的档案已存在!',
|
||||
'error-delete' => '资料夹未清空,无法删除!',
|
||||
'error-folder-name' => '请输入资料夹名称!',
|
||||
'error-folder-exist'=> '相同名称的资料夹已存在!',
|
||||
'error-mime' => 'Mime 格式错误 : ',
|
||||
'error-instance' => '上传档案的 instance 应为 UploadedFile',
|
||||
'error-invalid' => '验证失败,上传未成功',
|
||||
|
||||
'btn-upload' => '上传',
|
||||
'btn-close' => '关闭',
|
||||
'btn-uploading' => '上传中...',
|
||||
'btn-close' => '关闭',
|
||||
'btn-crop' => '裁剪',
|
||||
'btn-cancel' => '取消',
|
||||
'btn-resize' => '缩放',
|
||||
@@ -56,5 +60,4 @@ return [
|
||||
'resize-new-width' => '目前宽度:',
|
||||
|
||||
'locale-bootbox' => 'zh_CN',
|
||||
|
||||
];
|
||||
|
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'nav-back' => '回上一頁',
|
||||
'nav-new' => '新增資料夾',
|
||||
'nav-upload' => '上傳檔案',
|
||||
'nav-thumbnails' => '縮圖顯示',
|
||||
'nav-list' => '列表顯示',
|
||||
|
||||
'menu-new' => '新增資料夾',
|
||||
'menu-rename' => '重新命名',
|
||||
'menu-delete' => '刪除',
|
||||
'menu-view' => '預覽',
|
||||
@@ -39,10 +40,13 @@ return [
|
||||
'error-delete' => '資料夾未清空,無法刪除!',
|
||||
'error-folder-name' => '請輸入資料夾名稱!',
|
||||
'error-folder-exist'=> '相同名稱的資料夾已存在!',
|
||||
'error-mime' => 'Mime 格式錯誤 : ',
|
||||
'error-instance' => '上傳檔案的 instance 應為 UploadedFile',
|
||||
'error-invalid' => '驗證失敗,上傳未成功',
|
||||
|
||||
'btn-upload' => '上傳',
|
||||
'btn-close' => '關閉',
|
||||
'btn-uploading' => '上傳中...',
|
||||
'btn-close' => '關閉',
|
||||
'btn-crop' => '裁剪',
|
||||
'btn-cancel' => '取消',
|
||||
'btn-resize' => '縮放',
|
||||
@@ -56,5 +60,4 @@ return [
|
||||
'resize-new-width' => '目前寬度:',
|
||||
|
||||
'locale-bootbox' => 'zh_TW',
|
||||
|
||||
];
|
||||
|
@@ -12,31 +12,28 @@ class MultiUser
|
||||
$slug = \Config::get('lfm.user_field');
|
||||
|
||||
\Auth::user()->user_field = \Auth::user()->$slug;
|
||||
$new_working_dir = '/' . \Auth::user()->user_field;
|
||||
|
||||
$base = $request->input('working_dir');
|
||||
$previous_dir = $request->input('working_dir');
|
||||
|
||||
if ($base == null) {
|
||||
$request->merge(['working_dir' => \Auth::user()->user_field]);
|
||||
} elseif ($this->wrongDir($base)) {
|
||||
$request->replace(['working_dir' => \Auth::user()->user_field]);
|
||||
if ($previous_dir == null) {
|
||||
$request->merge(['working_dir' => $new_working_dir]);
|
||||
} elseif (! $this->validDir($previous_dir)) {
|
||||
$request->replace(['working_dir' => $new_working_dir]);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
private function wrongDir($base)
|
||||
private function validDir($previous_dir)
|
||||
{
|
||||
if (strpos($base, \Config::get('lfm.shared_folder_name')) !== false) {
|
||||
return false;
|
||||
if (starts_with($previous_dir, '/' . \Config::get('lfm.shared_folder_name'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strpos($base, (string)\Auth::user()->user_field) !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strpos($base, (string)\Auth::user()->user_field) === false) {
|
||||
return true;
|
||||
if (starts_with($previous_dir, '/' . (string)\Auth::user()->user_field)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -1,67 +1,68 @@
|
||||
<div class="row fill">
|
||||
<div class="col-md-8 fill">
|
||||
<div class="crop-container">
|
||||
<img src="{{ $img }}" class="img img-responsive">
|
||||
</div>
|
||||
<div class="col-md-8 fill">
|
||||
<div class="crop-container">
|
||||
<img src="{{ $img }}" class="img img-responsive">
|
||||
</div>
|
||||
<div class="col-md-4 fill">
|
||||
<div class="text-center">
|
||||
</div>
|
||||
<div class="col-md-4 fill">
|
||||
<div class="text-center">
|
||||
|
||||
<div class="img-preview center-block"></div>
|
||||
<br>
|
||||
<button class="btn btn-primary" onclick="performCrop()">{{ Lang::get('laravel-filemanager::lfm.btn-crop') }}</button>
|
||||
<button class="btn btn-info" onclick="loadItems()">{{ Lang::get('laravel-filemanager::lfm.btn-cancel') }}</button>
|
||||
<form action="{{url('/laravel-filemanager/crop')}}" role='form' name='cropForm' id='cropForm' mathod='post'>
|
||||
<input type="hidden" id="img" name="img" value="{{ $img }}">
|
||||
<input type="hidden" id="working_dir" name="working_dir" value="{{ $working_dir }}">
|
||||
<input type="hidden" id="dataX" name="dataX">
|
||||
<input type="hidden" id="dataY" name="dataY">
|
||||
<input type="hidden" id="dataWidth" name="dataWidth">
|
||||
<input type="hidden" id="dataHeight" name="dataHeight">
|
||||
<input type='hidden' name='_token' value='{{csrf_token()}}'>
|
||||
</form>
|
||||
</div>
|
||||
<div class="img-preview center-block"></div>
|
||||
<br>
|
||||
<button class="btn btn-primary" onclick="performCrop()">{{ Lang::get('laravel-filemanager::lfm.btn-crop') }}</button>
|
||||
<button class="btn btn-info" onclick="loadItems()">{{ Lang::get('laravel-filemanager::lfm.btn-cancel') }}</button>
|
||||
<form action="{{url('/laravel-filemanager/crop')}}" role='form' name='cropForm' id='cropForm' mathod='post'>
|
||||
<input type="hidden" id="img" name="img" value="{{ $img }}">
|
||||
<input type="hidden" id="working_dir" name="working_dir" value="{{ $working_dir }}">
|
||||
<input type="hidden" id="dataX" name="dataX">
|
||||
<input type="hidden" id="dataY" name="dataY">
|
||||
<input type="hidden" id="dataWidth" name="dataWidth">
|
||||
<input type="hidden" id="dataHeight" name="dataHeight">
|
||||
<input type='hidden' name='_token' value='{{csrf_token()}}'>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var $dataX = $('#dataX'),
|
||||
$dataY = $('#dataY'),
|
||||
$dataHeight = $('#dataHeight'),
|
||||
$dataWidth = $('#dataWidth');
|
||||
$(document).ready(function () {
|
||||
var $dataX = $('#dataX'),
|
||||
$dataY = $('#dataY'),
|
||||
$dataHeight = $('#dataHeight'),
|
||||
$dataWidth = $('#dataWidth');
|
||||
|
||||
$('.crop-container > img').cropper({
|
||||
//aspectRatio: 16 / 9,
|
||||
preview: ".img-preview",
|
||||
strict: false,
|
||||
crop: function (data) {
|
||||
// Output the result data for cropping image.
|
||||
$dataX.val(Math.round(data.x));
|
||||
$dataY.val(Math.round(data.y));
|
||||
$dataHeight.val(Math.round(data.height));
|
||||
$dataWidth.val(Math.round(data.width));
|
||||
}
|
||||
});
|
||||
$('.crop-container > img').cropper({
|
||||
//aspectRatio: 16 / 9,
|
||||
preview: ".img-preview",
|
||||
strict: false,
|
||||
crop: function (data) {
|
||||
// Output the result data for cropping image.
|
||||
$dataX.val(Math.round(data.x));
|
||||
$dataY.val(Math.round(data.y));
|
||||
$dataHeight.val(Math.round(data.height));
|
||||
$dataWidth.val(Math.round(data.width));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function performCrop() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "text",
|
||||
url: "/laravel-filemanager/cropimage",
|
||||
data: {
|
||||
img: $("#img").val(),
|
||||
working_dir: $("#working_dir").val(),
|
||||
dataX: $("#dataX").val(),
|
||||
dataY: $("#dataY").val(),
|
||||
dataHeight: $("#dataHeight").val(),
|
||||
dataWidth: $("#dataWidth").val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
loadItems();
|
||||
});
|
||||
}
|
||||
function performCrop() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "text",
|
||||
url: "/laravel-filemanager/cropimage",
|
||||
data: {
|
||||
img: '{{ $img }}',
|
||||
working_dir: $("#working_dir").val(),
|
||||
dataX: $("#dataX").val(),
|
||||
dataY: $("#dataY").val(),
|
||||
dataHeight: $("#dataHeight").val(),
|
||||
dataWidth: $("#dataWidth").val(),
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
loadItems();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
@@ -1,68 +1,68 @@
|
||||
<div class="container">
|
||||
|
||||
@if((sizeof($file_info) > 0) || (sizeof($directories) > 0))
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th style='width:50%;'>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-size') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-type') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-modified') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-action') }}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-folder-o"></i>
|
||||
<a id="large_folder_{{ $key }}" data-id="{{ $dir_name }}" href="javascript:clickFolder('large_folder_{{ $key }}',1)">
|
||||
{{ $dir_name }}
|
||||
</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.type-folder') }}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if((sizeof($file_info) > 0) || (sizeof($directories) > 0))
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th style='width:50%;'>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-size') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-type') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-modified') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-action') }}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-folder-o"></i>
|
||||
<a class="folder-item pointer" data-id="{{ $dir_name['long'] }}">
|
||||
{{ $dir_name['short'] }}
|
||||
</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.type-folder') }}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@foreach($file_info as $file)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa <?= $file['icon']; ?>"></i>
|
||||
<?php $file_name = $file['name'];?>
|
||||
<a href="javascript:useFile('{{ $file_name }}')">
|
||||
{{ $file_name }}
|
||||
</a>
|
||||
|
||||
<a href="javascript:rename('{{ $file_name }}')">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['size'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['type'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ date("Y-m-d h:m", $file['created']) }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:trash('{{ $file_name }}')">
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@foreach($file_info as $file)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa {{ $file['icon'] }}"></i>
|
||||
<?php $file_name = $file['name'];?>
|
||||
<a href="javascript:useFile('{{ $file_name }}')">
|
||||
{{ $file_name }}
|
||||
</a>
|
||||
|
||||
<a href="javascript:rename('{{ $file_name }}')">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['size'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['type'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ date("Y-m-d h:m", $file['created']) }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:trash('{{ $file_name }}')">
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
@@ -1,75 +1,70 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
|
||||
@if((sizeof($files) > 0) || (sizeof($directories) > 0))
|
||||
@if((sizeof($files) > 0) || (sizeof($directories) > 0))
|
||||
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<div class="col-sm-6 col-md-2">
|
||||
<div class="thumbnail text-center" data-id="{{ $dir_name }}">
|
||||
<a id="folder_{{ $key }}" data-id="{{ $dir_name }}" onclick="clickFolder('folder_{{ $key }}',0)" class="folder-icon pointer">
|
||||
<img src="/vendor/laravel-filemanager/img/folder.jpg">
|
||||
</a>
|
||||
</div>
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" onclick="clickFolder('folder_{{ $key }}',0)" class="btn btn-default btn-xs">
|
||||
{{ str_limit($dir_name, $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $dir_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:trash('{{ $dir_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach($file_info as $key => $file)
|
||||
|
||||
<?php $file_name = $file_info[$key]['name'];?>
|
||||
|
||||
<div class="col-sm-6 col-md-2 img-row">
|
||||
|
||||
<div class="thumbnail thumbnail-img text-center" data-id="{{ $file_name }}" id="img_thumbnail_{{ $key }}">
|
||||
<i class="fa {{ $file['icon'] }} fa-5x" style="height:200px;cursor:pointer;padding-top:60px;" onclick="useFile('{{ $file_name }}')"></i>
|
||||
</div>
|
||||
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group ">
|
||||
<button type="button" onclick="useFile('{{ $file_name }}')" class="btn btn-default btn-xs">
|
||||
{{ str_limit($file_name, $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:fileView('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-view') }}</a></li>
|
||||
<li><a href="javascript:download('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-download') }}</a></li>
|
||||
<li class="divider"></li>
|
||||
{{--<li><a href="javascript:notImp()">Rotate</a></li>--}}
|
||||
<li><a href="javascript:resizeImage('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-resize') }}</a></li>
|
||||
<li><a href="javascript:cropImage('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-crop') }}</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:trash('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<div class="col-sm-6 col-md-2">
|
||||
<div class="thumbnail text-center" data-id="{{ $dir_name['long'] }}">
|
||||
<a data-id="{{ $dir_name['long'] }}" class="folder-icon pointer folder-item">
|
||||
<img src="/vendor/laravel-filemanager/img/folder.png">
|
||||
</a>
|
||||
</div>
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" data-id="{{ $dir_name['long'] }}" class="btn btn-default btn-xs folder-item">
|
||||
{{ str_limit($dir_name['short'], $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $dir_name['short'] }}')"><i class="fa fa-edit fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:trash('{{ $dir_name['short'] }}')"><i class="fa fa-trash fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach($file_info as $key => $file)
|
||||
|
||||
<?php $file_name = $file_info[$key]['name'];?>
|
||||
|
||||
<div class="col-sm-6 col-md-2 img-row">
|
||||
|
||||
<div class="thumbnail thumbnail-img text-center" data-id="{{ $file_name }}" id="img_thumbnail_{{ $key }}">
|
||||
<i class="fa {{ $file['icon'] }} fa-5x" style="height:200px;cursor:pointer;padding-top:60px;" onclick="useFile('{{ $file_name }}')"></i>
|
||||
</div>
|
||||
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group ">
|
||||
<button type="button" onclick="useFile('{{ $file_name }}')" class="btn btn-default btn-xs">
|
||||
{{ str_limit($file_name, $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $file_name }}')"><i class="fa fa-edit fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:download('{{ $file_name }}')"><i class="fa fa-download fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-download') }}</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:trash('{{ $file_name }}')"><i class="fa fa-trash fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,77 +1,77 @@
|
||||
<div class="container">
|
||||
|
||||
@if((sizeof($file_info) > 0) || (sizeof($directories) > 0))
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th style='width:50%;'>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-size') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-type') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-modified') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-action') }}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-folder-o"></i>
|
||||
<a id="large_folder_{{ $key }}" data-id="{{ $dir_name }}" href="javascript:clickFolder('large_folder_{{ $key }}',1)">
|
||||
{{ $dir_name }}
|
||||
</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.type-folder') }}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if((sizeof($file_info) > 0) || (sizeof($directories) > 0))
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-item') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-size') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-type') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-modified') }}</th>
|
||||
<th>{{ Lang::get('laravel-filemanager::lfm.title-action') }}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-folder-o"></i>
|
||||
<a class="folder-item pointer" data-id="{{ $dir_name['long'] }}">
|
||||
{{ $dir_name['short'] }}
|
||||
</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.type-folder') }}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@foreach($file_info as $file)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-image"></i>
|
||||
<?php $file_name = $file['name'];?>
|
||||
<a href="javascript:useFile('{{ $file_name }}')">
|
||||
{{ $file_name }}
|
||||
</a>
|
||||
|
||||
<a href="javascript:rename('{{ $file_name }}')">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['size'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['type'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ date("Y-m-d h:m", $file['created']) }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:trash('{{ $file_name }}')">
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
</a>
|
||||
<a href="javascript:cropImage('{{ $file_name }}')">
|
||||
<i class="fa fa-crop fa-fw"></i>
|
||||
</a>
|
||||
<a href="javascript:resizeImage('{{ $file_name }}')">
|
||||
<i class="fa fa-arrows fa-fw"></i>
|
||||
</a>
|
||||
{{--<a href="javascript:notImp()">--}}
|
||||
{{--<i class="fa fa-rotate-left fa-fw"></i>--}}
|
||||
{{--</a>--}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@foreach($file_info as $file)
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-image"></i>
|
||||
<?php $file_name = $file['name'];?>
|
||||
<a href="javascript:useFile('{{ $file_name }}')">
|
||||
{{ $file_name }}
|
||||
</a>
|
||||
|
||||
<a href="javascript:rename('{{ $file_name }}')">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['size'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $file['type'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ date("Y-m-d h:m", $file['created']) }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:trash('{{ $file_name }}')">
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
</a>
|
||||
<a href="javascript:cropImage('{{ $file_name }}')">
|
||||
<i class="fa fa-crop fa-fw"></i>
|
||||
</a>
|
||||
<a href="javascript:resizeImage('{{ $file_name }}')">
|
||||
<i class="fa fa-arrows fa-fw"></i>
|
||||
</a>
|
||||
{{--<a href="javascript:notImp()">--}}
|
||||
{{--<i class="fa fa-rotate-left fa-fw"></i>--}}
|
||||
{{--</a>--}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
@@ -1,77 +1,76 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
|
||||
@if((sizeof($files) > 0) || (sizeof($directories) > 0))
|
||||
@if((sizeof($files) > 0) || (sizeof($directories) > 0))
|
||||
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<div class="col-sm-6 col-md-2">
|
||||
<div class="thumbnail text-center" data-id="{{ $dir_name }}">
|
||||
<a id="folder_{{ $key }}" data-id="{{ $dir_name }}" onclick="clickFolder('folder_{{ $key }}',0)" class="folder-icon pointer">
|
||||
{{--<i class="fa fa-folder-o fa-5x"></i>--}}
|
||||
<img src="/vendor/laravel-filemanager/img/folder.jpg">
|
||||
</a>
|
||||
</div>
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" onclick="clickFolder('folder_{{ $key }}',0)" class="btn btn-default btn-xs">
|
||||
{{ str_limit($dir_name, $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $dir_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:trash('{{ $dir_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach($files as $key => $file)
|
||||
|
||||
<?php $file_name = $file_info[$key]['name'];?>
|
||||
<?php $thumb_src = $thumb_url . $file_name;?>
|
||||
|
||||
<div class="col-sm-6 col-md-2 img-row">
|
||||
|
||||
<div class="thumbnail thumbnail-img" data-id="{{ $file_name }}" id="img_thumbnail_{{ $key }}">
|
||||
<img id="{{ $file }}" src="{{ $thumb_src }}" alt="" style="cursor:pointer;" onclick="useFile('{{ $file_name }}')">
|
||||
</div>
|
||||
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group ">
|
||||
<button type="button" onclick="useFile('{{ $file_name }}')" class="btn btn-default btn-xs">
|
||||
{{ str_limit($file_name, $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:fileView('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-view') }}</a></li>
|
||||
<li><a href="javascript:download('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-download') }}</a></li>
|
||||
<li class="divider"></li>
|
||||
{{--<li><a href="javascript:notImp()">Rotate</a></li>--}}
|
||||
<li><a href="javascript:resizeImage('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-resize') }}</a></li>
|
||||
<li><a href="javascript:cropImage('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-crop') }}</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:trash('{{ $file_name }}')">{{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
@foreach($directories as $key => $dir_name)
|
||||
<div class="col-sm-3 col-md-2">
|
||||
<div class="thumbnail text-center" data-id="{{ $dir_name['long'] }}">
|
||||
<a data-id="{{ $dir_name['long'] }}" class="folder-icon pointer folder-item">
|
||||
<img src="/vendor/laravel-filemanager/img/folder.png">
|
||||
</a>
|
||||
</div>
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" data-id="{{ $dir_name['long'] }}" class="btn btn-default btn-xs folder-item">
|
||||
{{ str_limit($dir_name['short'], $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $dir_name['short'] }}')"><i class="fa fa-edit fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:trash('{{ $dir_name['short'] }}')"><i class="fa fa-trash fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach($files as $key => $file)
|
||||
|
||||
<?php $file_name = $file_info[$key]['name'];?>
|
||||
<?php $thumb_src = $thumb_url . $file_name;?>
|
||||
|
||||
<div class="col-sm-3 col-md-2 img-row">
|
||||
|
||||
<div class="thumbnail thumbnail-img" data-id="{{ $file_name }}" id="img_thumbnail_{{ $key }}">
|
||||
<img id="{{ $file }}" src="{{ $thumb_src }}" alt="" class="pointer" onclick="useFile('{{ $file_name }}')">
|
||||
</div>
|
||||
|
||||
<div class="caption text-center">
|
||||
<div class="btn-group ">
|
||||
<button type="button" onclick="useFile('{{ $file_name }}')" class="btn btn-default btn-xs">
|
||||
{{ str_limit($file_name, $limit = 10, $end = '...') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript:rename('{{ $file_name }}')"><i class="fa fa-edit fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-rename') }}</a></li>
|
||||
<li><a href="javascript:fileView('{{ $file_name }}')"><i class="fa fa-image fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-view') }}</a></li>
|
||||
<li><a href="javascript:download('{{ $file_name }}')"><i class="fa fa-download fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-download') }}</a></li>
|
||||
<li class="divider"></li>
|
||||
{{--<li><a href="javascript:notImp()">Rotate</a></li>--}}
|
||||
<li><a href="javascript:resizeImage('{{ $file_name }}')"><i class="fa fa-arrows fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-resize') }}</a></li>
|
||||
<li><a href="javascript:cropImage('{{ $file_name }}')"><i class="fa fa-crop fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-crop') }}</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:trash('{{ $file_name }}')"><i class="fa fa-trash fa-fw"></i> {{ Lang::get('laravel-filemanager::lfm.menu-delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<p>{{ Lang::get('laravel-filemanager::lfm.message-empty') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,522 +1,154 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ Lang::get('laravel-filemanager::lfm.title-page') }}</title>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="/vendor/laravel-filemanager/css/cropper.min.css">
|
||||
<link rel="stylesheet" href="/vendor/laravel-filemanager/css/lfm.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.css">
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ Lang::get('laravel-filemanager::lfm.title-page') }}</title>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="/vendor/laravel-filemanager/css/cropper.min.css">
|
||||
<link rel="stylesheet" href="/vendor/laravel-filemanager/css/lfm.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="container">
|
||||
<div class="row fill">
|
||||
<div class="panel panel-primary fill">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{{ Lang::get('laravel-filemanager::lfm.title-panel') }}</h3>
|
||||
</div>
|
||||
<div class="panel-body fill">
|
||||
<div class="row fill">
|
||||
<div class="wrapper fill">
|
||||
<div class="col-md-2 col-lg-2 col-sm-2 col-xs-2 left-nav fill" id="lfm-leftcol">
|
||||
<div id="tree1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10 col-lg-10 col-sm-10 col-xs-10 right-nav" id="right-nav">
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav" id="nav-buttons">
|
||||
<li>
|
||||
<a href="#!" id="upload" data-toggle="modal" data-target="#uploadModal"><i class="fa fa-upload"></i> {{ Lang::get('laravel-filemanager::lfm.nav-upload') }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#!" class="thumbnail-display" id="thumbnail-display"><i class="fa fa-picture-o"></i> {{ Lang::get('laravel-filemanager::lfm.nav-thumbnails') }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#!" class="list-display" id="list-display"><i class="fa fa-list"></i> {{ Lang::get('laravel-filemanager::lfm.nav-list') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<ul>
|
||||
@foreach($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div id="content" class="row fill">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary fill">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{{ Lang::get('laravel-filemanager::lfm.title-panel') }}</h3>
|
||||
</div>
|
||||
<div class="panel-body fill">
|
||||
<div class="row fill">
|
||||
<div class="wrapper fill">
|
||||
<div class="col-md-2 col-lg-2 col-sm-2 col-xs-2 left-nav fill" id="lfm-leftcol">
|
||||
<div id="tree1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aia-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">{{ Lang::get('laravel-filemanager::lfm.title-upload') }}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{url('/laravel-filemanager/upload')}}" role='form' id='uploadForm' name='uploadForm' method='post' enctype='multipart/form-data'>
|
||||
<div class="form-group" id="attachment">
|
||||
<label for='upload' class='control-label'>{{ Lang::get('laravel-filemanager::lfm.message-choose') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-group" style="width: 100%">
|
||||
<input type="file" id="upload" name="upload">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10 col-lg-10 col-sm-10 col-xs-10 right-nav" id="right-nav">
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<input type='hidden' name='working_dir' id='working_dir' value='{{$working_dir}}'>
|
||||
<input type='hidden' name='show_list' id='show_list' value='0'>
|
||||
<input type='hidden' name='_token' value='{{csrf_token()}}'>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ Lang::get('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
<button type="button" class="btn btn-primary" id="upload-btn">{{ Lang::get('laravel-filemanager::lfm.btn-upload') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav" id="nav-buttons">
|
||||
<li>
|
||||
<a href="#!" id="to-previous">
|
||||
<i class="fa fa-arrow-left"></i> {{ Lang::get('laravel-filemanager::lfm.nav-back') }}
|
||||
</a>
|
||||
</li>
|
||||
<li><a style='cursor:default;'>|</a></li>
|
||||
<li>
|
||||
<a href="#!" id="add-folder">
|
||||
<i class="fa fa-plus"></i> {{ Lang::get('laravel-filemanager::lfm.nav-new') }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#!" id="upload" data-toggle="modal" data-target="#uploadModal">
|
||||
<i class="fa fa-upload"></i> {{ Lang::get('laravel-filemanager::lfm.nav-upload') }}
|
||||
</a>
|
||||
</li>
|
||||
<li><a style='cursor:default;'>|</a></li>
|
||||
<li>
|
||||
<a href="#!" id="thumbnail-display">
|
||||
<i class="fa fa-picture-o"></i> {{ Lang::get('laravel-filemanager::lfm.nav-thumbnails') }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#!" id="list-display">
|
||||
<i class="fa fa-list"></i> {{ Lang::get('laravel-filemanager::lfm.nav-list') }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="modal fade" id="fileViewModal" tabindex="-1" role="dialog" aria-labelledby="fileLabel" aria-hidden="true">
|
||||
@if ($errors->any())
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<ul>
|
||||
@foreach($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div id="content" class="row fill">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aia-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">{{ Lang::get('laravel-filemanager::lfm.title-upload') }}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{url('/laravel-filemanager/upload')}}" role='form' id='uploadForm' name='uploadForm' method='post' enctype='multipart/form-data'>
|
||||
<div class="form-group" id="attachment">
|
||||
<label for='upload' class='control-label'>{{ Lang::get('laravel-filemanager::lfm.message-choose') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-group" style="width: 100%">
|
||||
<input type="file" id="upload" name="upload">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type='hidden' name='working_dir' id='working_dir' value='{{$working_dir}}'>
|
||||
<input type='hidden' name='show_list' id='show_list' value='0'>
|
||||
<input type='hidden' name='type' id='type' value='{{$file_type}}'>
|
||||
<input type='hidden' name='_token' value='{{csrf_token()}}'>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ Lang::get('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
<button type="button" class="btn btn-primary" id="upload-btn">{{ Lang::get('laravel-filemanager::lfm.btn-upload') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="fileViewModal" tabindex="-1" role="dialog" aria-labelledby="fileLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="fileLabel">{{ Lang::get('laravel-filemanager::lfm.title-view') }}</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="fileview_body">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ Lang::get('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="fileLabel">{{ Lang::get('laravel-filemanager::lfm.title-view') }}</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="fileview_body">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ Lang::get('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
|
||||
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
|
||||
<script src="/vendor/laravel-filemanager/js/cropper.min.js"></script>
|
||||
<script src="/vendor/laravel-filemanager/js/jquery.form.min.js"></script>
|
||||
<script>
|
||||
var shared_folder = "{{ Config::get('lfm.shared_folder_name') }}";
|
||||
var image_url = "{{ Config::get('lfm.images_url') }}";
|
||||
var file_url = "{{ Config::get('lfm.files_url') }}";
|
||||
|
||||
$(document).ready(function () {
|
||||
bootbox.setDefaults({locale:"{{ Lang::get('laravel-filemanager::lfm.locale-bootbox') }}"});
|
||||
// load folders
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/folders',
|
||||
data: 'working_dir={{ $working_dir }}',
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#tree1').html(data);
|
||||
});
|
||||
loadItems();
|
||||
refreshFolders();
|
||||
});
|
||||
|
||||
$('#upload-btn').click(function () {
|
||||
var options = {
|
||||
beforeSubmit: showRequest,
|
||||
success: showResponse
|
||||
};
|
||||
|
||||
function showRequest(formData, jqForm, options) {
|
||||
$('#upload-btn').html('<i class="fa fa-refresh fa-spin"></i> {{ Lang::get("laravel-filemanager::lfm.btn-uploading") }}');
|
||||
return true;
|
||||
}
|
||||
|
||||
function showResponse(responseText, statusText, xhr, $form) {
|
||||
$('#uploadModal').modal('hide');
|
||||
$('#upload-btn').html('{{ Lang::get("laravel-filemanager::lfm.btn-upload") }}');
|
||||
if (responseText != 'OK'){
|
||||
notify(responseText);
|
||||
}
|
||||
$('#upload').val('');
|
||||
loadItems();
|
||||
}
|
||||
|
||||
$('#uploadForm').ajaxSubmit(options);
|
||||
return false;
|
||||
});
|
||||
|
||||
function clickRoot() {
|
||||
$('.folder-item').removeClass('fa-folder-open').addClass('fa-folder');
|
||||
$('#folder_shared > i').removeClass('fa-folder-open').addClass('fa-folder');
|
||||
$('#folder_root > i').addClass('fa-folder-open').removeClass('fa-folder');
|
||||
$('#working_dir').val("{{ (Config::get('lfm.allow_multi_user')) ? Auth::user()->user_field : '/'}}");
|
||||
loadItems();
|
||||
}
|
||||
|
||||
function clickShared() {
|
||||
$('.folder-item').removeClass('fa-folder-open').addClass('fa-folder');
|
||||
$('#folder_root > i').removeClass('fa-folder-open').addClass('fa-folder');
|
||||
$('#folder_shared > i').addClass('fa-folder-open').removeClass('fa-folder');
|
||||
$('#working_dir').val(shared_folder);
|
||||
loadItems();
|
||||
}
|
||||
|
||||
function clickFolder(x, y) {
|
||||
$('.folder-item').addClass('fa-folder');
|
||||
$('#folder_shared > i').removeClass('fa-folder-open').addClass('fa-folder');
|
||||
$('#folder_root > i').addClass('fa-folder-open').removeClass('fa-folder');
|
||||
$('.folder-item').not('#folder_root > i').removeClass('fa-folder-open');
|
||||
if (y == 0) {
|
||||
if ($('#' + x + ' > i').hasClass('fa-folder')) {
|
||||
$('#' + x + ' > i').not('#folder_root > i').removeClass('fa-folder');
|
||||
$('#' + x + ' > i').not('#folder_root > i').addClass('fa-folder-open');
|
||||
} else {
|
||||
$('#' + x + ' > i').removeClass('fa-folder-open');
|
||||
$('#' + x + ' > i').addClass('fa-folder');
|
||||
}
|
||||
}
|
||||
$('#working_dir').val("{{ (Config::get('lfm.allow_multi_user')) ? Auth::user()->user_field.'/' : '' }}" + $('#' + x).data('id'));
|
||||
loadItems();
|
||||
}
|
||||
|
||||
function clickSharedFolder(x, y) {
|
||||
$('.folder-item').addClass('fa-folder');
|
||||
$('#folder_root > i').removeClass('fa-folder-open').addClass('fa-folder');
|
||||
$('#folder_shared > i').addClass('fa-folder-open').removeClass('fa-folder');
|
||||
$('.folder-item').not('#folder_shared > i').removeClass('fa-folder-open');
|
||||
if (y == 0) {
|
||||
if ($('#' + x + ' > i').hasClass('fa-folder')) {
|
||||
$('#' + x + ' > i').not('#folder_shared > i').removeClass('fa-folder');
|
||||
$('#' + x + ' > i').not('#folder_shared > i').addClass('fa-folder-open');
|
||||
} else {
|
||||
$('#' + x + ' > i').removeClass('fa-folder-open');
|
||||
$('#' + x + ' > i').addClass('fa-folder');
|
||||
}
|
||||
}
|
||||
$('#working_dir').val(shared_folder + '/' + $('#' + x).data('id'));
|
||||
loadItems();
|
||||
}
|
||||
|
||||
function download(x) {
|
||||
location.href = '/laravel-filemanager/download?'
|
||||
+ 'working_dir='
|
||||
+ $('#working_dir').val()
|
||||
+ '&file='
|
||||
+ x;
|
||||
}
|
||||
|
||||
function loadItems() {
|
||||
var type = 'Images';
|
||||
|
||||
@if ((Session::has('lfm_type')) && (Session::get('lfm_type') == 'Files'))
|
||||
type = 'Files';
|
||||
@endif
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'html',
|
||||
url: '/laravel-filemanager/jsonitems',
|
||||
data: {
|
||||
working_dir: $('#working_dir').val(),
|
||||
show_list: $('#show_list').val(),
|
||||
type: type
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#content').html(data);
|
||||
$('#nav-buttons').removeClass('hidden');
|
||||
$('.dropdown-toggle').dropdown();
|
||||
refreshFolders();
|
||||
});
|
||||
}
|
||||
|
||||
function trash(x) {
|
||||
bootbox.confirm("{{ Lang::get('laravel-filemanager::lfm.message-delete') }}", function (result) {
|
||||
if (result == true) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/delete',
|
||||
data: {
|
||||
working_dir: $('#working_dir').val(),
|
||||
items: x
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data != 'OK') {
|
||||
notify(data);
|
||||
} else {
|
||||
if ($('#working_dir').val() == '{{ Auth::user()->user_field }}') {
|
||||
loadFolders();
|
||||
}
|
||||
loadItems();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadFolders() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'html',
|
||||
url: '/laravel-filemanager/folders',
|
||||
data: {
|
||||
working_dir: $('#working_dir').val(),
|
||||
show_list: $('#show_list').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#tree1').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
function refreshFolders() {
|
||||
var wd = $('#working_dir').val();
|
||||
if (wd != '/') {
|
||||
try {
|
||||
$('#' + wd + '-folder').removeClass('fa-folder');
|
||||
$('#' + wd + '-folder').addClass('fa-folder-open');
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
function cropImage(x) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/crop',
|
||||
data: {
|
||||
img: x,
|
||||
working_dir: $('#working_dir').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#nav-buttons').addClass('hidden');
|
||||
$('#content').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
function notImp() {
|
||||
bootbox.alert('Not yet implemented!');;
|
||||
}
|
||||
|
||||
$('body').on('click', '#add-folder', function () {
|
||||
bootbox.prompt("{{ Lang::get('laravel-filemanager::lfm.message-name') }}", function (result) {
|
||||
if (result === null) {
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/newfolder',
|
||||
data: {
|
||||
name: result,
|
||||
working_dir: $('#working_dir').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data == 'OK') {
|
||||
loadFolders();
|
||||
loadItems();
|
||||
refreshFolders();
|
||||
} else {
|
||||
notify(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function useFile(file) {
|
||||
var path = $('#working_dir').val();
|
||||
|
||||
var item_url = image_url;
|
||||
|
||||
@if ((Session::has('lfm_type')) && (Session::get('lfm_type') != "Images"))
|
||||
item_url = file_url;
|
||||
@endif
|
||||
|
||||
if (path != '/') {
|
||||
item_url = item_url + path + '/';
|
||||
}
|
||||
|
||||
function getUrlParam(paramName) {
|
||||
var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i');
|
||||
var match = window.location.search.match(reParam);
|
||||
return ( match && match.length > 1 ) ? match[1] : null;
|
||||
}
|
||||
|
||||
var field_name = getUrlParam('field_name');
|
||||
var url = item_url + file;
|
||||
|
||||
if(window.opener || window.tinyMCEPopup || field_name || getUrlParam('CKEditorCleanUpFuncNum') || getUrlParam('CKEditor')) {
|
||||
if(window.tinyMCEPopup){
|
||||
// use TinyMCE > 3.0 integration method
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
// tinymce 4 and colorbox
|
||||
if (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();
|
||||
}
|
||||
|
||||
} else if(getUrlParam('CKEditor')) {
|
||||
// use CKEditor 3.0 + integration method
|
||||
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'));
|
||||
}
|
||||
} else {
|
||||
|
||||
// use FCKEditor 2.0 integration method
|
||||
if (data['Properties']['Width'] != '') {
|
||||
var p = url;
|
||||
var w = data['Properties']['Width'];
|
||||
var h = data['Properties']['Height'];
|
||||
window.opener.SetUrl(p,w,h);
|
||||
} else {
|
||||
window.opener.SetUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
if (window.opener) {
|
||||
window.close();
|
||||
}
|
||||
} else {
|
||||
$.prompt(lg.fck_select_integration);
|
||||
}
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
function rename(x) {
|
||||
bootbox.prompt({
|
||||
title: "{{ Lang::get('laravel-filemanager::lfm.message-rename') }}",
|
||||
value: x,
|
||||
callback: function (result) {
|
||||
if (result !== null) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/rename',
|
||||
data: {
|
||||
file: x,
|
||||
working_dir: $('#working_dir').val(),
|
||||
new_name: result
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data == 'OK') {
|
||||
loadItems();
|
||||
loadFolders();
|
||||
} else {
|
||||
notify(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function notify(x) {
|
||||
bootbox.alert(x);
|
||||
}
|
||||
|
||||
function resizeImage(x) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/resize',
|
||||
data: {
|
||||
img: x,
|
||||
working_dir: $('#working_dir').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#nav-buttons').addClass('hidden');
|
||||
$('#content').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
$('#thumbnail-display').click(function () {
|
||||
$('#show_list').val(0);
|
||||
loadItems();
|
||||
});
|
||||
|
||||
$('#list-display').click(function () {
|
||||
$('#show_list').val(1);
|
||||
loadItems();
|
||||
});
|
||||
|
||||
function fileView(x) {
|
||||
var rnd = makeRandom();
|
||||
var img_src = image_url + $('#working_dir').val() + '/' + x;
|
||||
var img = "<img class='img img-responsive center-block' src='" + img_src + "'>";
|
||||
$('#fileview_body').html(img);
|
||||
$('#fileViewModal').modal();
|
||||
}
|
||||
|
||||
function makeRandom() {
|
||||
var text = '';
|
||||
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
for( var i=0; i < 20; i++ )
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
return text;
|
||||
}
|
||||
</script>
|
||||
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
|
||||
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
|
||||
<script src="/vendor/laravel-filemanager/js/cropper.min.js"></script>
|
||||
<script src="/vendor/laravel-filemanager/js/jquery.form.min.js"></script>
|
||||
@include('laravel-filemanager::script');
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,96 +1,95 @@
|
||||
<div class="container">
|
||||
<div class="row fill">
|
||||
<div class="col-md-8 fill" id="containment">
|
||||
<img id="resize" src="{{ $img }}" height="{{ $height }}" width="{{ $width }}">
|
||||
</div>
|
||||
<div class="col-md-4 fill">
|
||||
|
||||
<table class="table table-compact table-striped">
|
||||
<thead></thead>
|
||||
<tbody>
|
||||
@if ($scaled)
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-ratio') }}</td>
|
||||
<td>{{ number_format($ratio, 2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-scaled') }}</td>
|
||||
<td>
|
||||
{{ Lang::get('laravel-filemanager::lfm.resize-true') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-old-height') }}</td>
|
||||
<td>{{ $original_height }}px</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-old-width') }}</td>
|
||||
<td>{{ $original_width }}px</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-new-height') }}</td>
|
||||
<td><span id="height_display"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-new-width') }}</td>
|
||||
<td><span id="width_display"></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button class="btn btn-primary" onclick="doResize()">{{ Lang::get('laravel-filemanager::lfm.btn-resize') }}</button>
|
||||
<button class="btn btn-info" onclick="loadItems()">{{ Lang::get('laravel-filemanager::lfm.btn-cancel') }}</button>
|
||||
|
||||
<input type="hidden" name="ratio" value="{{ $ratio }}"><br>
|
||||
<input type="hidden" name="scaled" value="{{ $scaled }}"><br>
|
||||
<input type="hidden" id="original_height" name="original_height" value="{{ $original_height }}"><br>
|
||||
<input type="hidden" id="original_width" name="original_width" value="{{ $original_width }}"><br>
|
||||
<input type="hidden" id="height" name="height" value=""><br>
|
||||
<input type="hidden" id="width" name="width">
|
||||
|
||||
</div>
|
||||
<div class="row fill">
|
||||
<div class="col-md-8 fill" id="containment">
|
||||
<img id="resize" src="{{ $img }}" height="{{ $height }}" width="{{ $width }}">
|
||||
</div>
|
||||
<div class="col-md-4 fill">
|
||||
|
||||
<table class="table table-compact table-striped">
|
||||
<thead></thead>
|
||||
<tbody>
|
||||
@if ($scaled)
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-ratio') }}</td>
|
||||
<td>{{ number_format($ratio, 2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-scaled') }}</td>
|
||||
<td>
|
||||
{{ Lang::get('laravel-filemanager::lfm.resize-true') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-old-height') }}</td>
|
||||
<td>{{ $original_height }}px</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-old-width') }}</td>
|
||||
<td>{{ $original_width }}px</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-new-height') }}</td>
|
||||
<td><span id="height_display"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ Lang::get('laravel-filemanager::lfm.resize-new-width') }}</td>
|
||||
<td><span id="width_display"></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button class="btn btn-primary" onclick="doResize()">{{ Lang::get('laravel-filemanager::lfm.btn-resize') }}</button>
|
||||
<button class="btn btn-info" onclick="loadItems()">{{ Lang::get('laravel-filemanager::lfm.btn-cancel') }}</button>
|
||||
|
||||
<input type="hidden" name="ratio" value="{{ $ratio }}"><br>
|
||||
<input type="hidden" name="scaled" value="{{ $scaled }}"><br>
|
||||
<input type="hidden" id="original_height" name="original_height" value="{{ $original_height }}"><br>
|
||||
<input type="hidden" id="original_width" name="original_width" value="{{ $original_width }}"><br>
|
||||
<input type="hidden" id="height" name="height" value=""><br>
|
||||
<input type="hidden" id="width" name="width">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function () {
|
||||
$("#height_display").html($("#resize").height() + "px");
|
||||
$("#width_display").html($("#resize").width() + "px");
|
||||
|
||||
$("#resize").resizable({
|
||||
aspectRatio: true,
|
||||
containment: "#containment",
|
||||
handles: "n, e, s, w, se, sw, ne, nw",
|
||||
resize: function (event, ui) {
|
||||
$("#width").val($("#resize").width());
|
||||
$("#height").val($("#resize").height());
|
||||
$("#height_display").html($("#resize").height() + "px");
|
||||
$("#width_display").html($("#resize").width() + "px");
|
||||
|
||||
$("#resize").resizable({
|
||||
aspectRatio: true,
|
||||
containment: "#containment",
|
||||
handles: "n, e, s, w, se, sw, ne, nw",
|
||||
resize: function (event, ui) {
|
||||
$("#width").val($("#resize").width());
|
||||
$("#height").val($("#resize").height());
|
||||
$("#height_display").html($("#resize").height() + "px");
|
||||
$("#width_display").html($("#resize").width() + "px");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function doResize() {
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "text",
|
||||
url: "/laravel-filemanager/doresize",
|
||||
data: {
|
||||
img: '{{ $img }}',
|
||||
working_dir: $("#working_dir").val(),
|
||||
dataX: $("#dataX").val(),
|
||||
dataY: $("#dataY").val(),
|
||||
dataHeight: $("#height").val(),
|
||||
dataWidth: $("#width").val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data == "OK") {
|
||||
loadItems();
|
||||
} else {
|
||||
notify(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
function doResize() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "text",
|
||||
url: "/laravel-filemanager/doresize",
|
||||
data: {
|
||||
img: '{{ $img }}',
|
||||
working_dir: $("#working_dir").val(),
|
||||
dataX: $("#dataX").val(),
|
||||
dataY: $("#dataY").val(),
|
||||
dataHeight: $("#height").val(),
|
||||
dataWidth: $("#width").val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data == "OK") {
|
||||
loadItems();
|
||||
} else {
|
||||
notify(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
406
vendor/unisharp/laravel-filemanager/src/views/script.blade.php
vendored
Normal file
406
vendor/unisharp/laravel-filemanager/src/views/script.blade.php
vendored
Normal file
@@ -0,0 +1,406 @@
|
||||
<script>
|
||||
var ds = '/';
|
||||
var home_dir = ds + "{{ (Config::get('lfm.allow_multi_user')) ? Auth::user()->user_field : '' }}";
|
||||
var shared_folder = ds + "{{ Config::get('lfm.shared_folder_name') }}";
|
||||
var image_url = "{{ Config::get('lfm.images_url') }}";
|
||||
var file_url = "{{ Config::get('lfm.files_url') }}";
|
||||
|
||||
$(document).ready(function () {
|
||||
bootbox.setDefaults({locale:"{{ Lang::get('laravel-filemanager::lfm.locale-bootbox') }}"});
|
||||
// load folders
|
||||
loadFolders();
|
||||
loadItems();
|
||||
setOpenFolders();
|
||||
});
|
||||
|
||||
// ======================
|
||||
// == Navbar actions ==
|
||||
// ======================
|
||||
|
||||
$('#to-previous').click(function () {
|
||||
var working_dir = $('#working_dir').val();
|
||||
var last_ds = working_dir.lastIndexOf(ds);
|
||||
var previous_dir = working_dir.substring(0, last_ds);
|
||||
$('#working_dir').val(previous_dir);
|
||||
loadItems();
|
||||
setOpenFolders();
|
||||
});
|
||||
|
||||
$('#add-folder').click(function () {
|
||||
bootbox.prompt("{{ Lang::get('laravel-filemanager::lfm.message-name') }}", function (result) {
|
||||
if (result !== null) {
|
||||
createFolder(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#upload-btn').click(function () {
|
||||
var options = {
|
||||
beforeSubmit: showRequest,
|
||||
success: showResponse
|
||||
};
|
||||
|
||||
function showRequest(formData, jqForm, options) {
|
||||
$('#upload-btn').html('<i class="fa fa-refresh fa-spin"></i> {{ Lang::get("laravel-filemanager::lfm.btn-uploading") }}');
|
||||
return true;
|
||||
}
|
||||
|
||||
function showResponse(responseText, statusText, xhr, $form) {
|
||||
$('#uploadModal').modal('hide');
|
||||
$('#upload-btn').html('{{ Lang::get("laravel-filemanager::lfm.btn-upload") }}');
|
||||
if (responseText != 'OK'){
|
||||
notify(responseText);
|
||||
}
|
||||
$('#upload').val('');
|
||||
loadItems();
|
||||
}
|
||||
|
||||
$('#uploadForm').ajaxSubmit(options);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#thumbnail-display').click(function () {
|
||||
$('#show_list').val(0);
|
||||
loadItems();
|
||||
});
|
||||
|
||||
$('#list-display').click(function () {
|
||||
$('#show_list').val(1);
|
||||
loadItems();
|
||||
});
|
||||
|
||||
// ======================
|
||||
// == Folder actions ==
|
||||
// ======================
|
||||
|
||||
$(document).on('click', '.folder-item', function (e) {
|
||||
clickFolder($(this).data('id'));
|
||||
});
|
||||
|
||||
function clickFolder(new_dir) {
|
||||
$('#working_dir').val(new_dir);
|
||||
setOpenFolders();
|
||||
loadItems();
|
||||
}
|
||||
|
||||
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 loadFolders() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'html',
|
||||
url: '/laravel-filemanager/folders',
|
||||
data: {
|
||||
working_dir: $('#working_dir').val(),
|
||||
show_list: $('#show_list').val(),
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#tree1').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
function loadItems() {
|
||||
var working_dir = $('#working_dir').val();
|
||||
console.log('Current working_dir : ' + working_dir);
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'html',
|
||||
url: '/laravel-filemanager/jsonitems',
|
||||
data: {
|
||||
working_dir: working_dir,
|
||||
show_list: $('#show_list').val(),
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#content').html(data);
|
||||
$('#nav-buttons').removeClass('hidden');
|
||||
$('.dropdown-toggle').dropdown();
|
||||
setOpenFolders();
|
||||
});
|
||||
}
|
||||
|
||||
function createFolder(folder_name) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/newfolder',
|
||||
data: {
|
||||
name: folder_name,
|
||||
working_dir: $('#working_dir').val(),
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data == 'OK') {
|
||||
loadFolders();
|
||||
loadItems();
|
||||
setOpenFolders();
|
||||
} else {
|
||||
notify(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function rename(item_name) {
|
||||
bootbox.prompt({
|
||||
title: "{{ Lang::get('laravel-filemanager::lfm.message-rename') }}",
|
||||
value: item_name,
|
||||
callback: function (result) {
|
||||
if (result !== null) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/rename',
|
||||
data: {
|
||||
file: item_name,
|
||||
working_dir: $('#working_dir').val(),
|
||||
new_name: result,
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data == 'OK') {
|
||||
loadItems();
|
||||
loadFolders();
|
||||
} else {
|
||||
notify(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function trash(item_name) {
|
||||
bootbox.confirm("{{ Lang::get('laravel-filemanager::lfm.message-delete') }}", function (result) {
|
||||
if (result == true) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/delete',
|
||||
data: {
|
||||
working_dir: $('#working_dir').val(),
|
||||
items: item_name,
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
if (data != 'OK') {
|
||||
notify(data);
|
||||
} else {
|
||||
if ($('#working_dir').val() === home_dir || $('#working_dir').val() === shared_folder) {
|
||||
loadFolders();
|
||||
}
|
||||
loadItems();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cropImage(image_name) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/crop',
|
||||
data: {
|
||||
img: image_name,
|
||||
working_dir: $('#working_dir').val(),
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#nav-buttons').addClass('hidden');
|
||||
$('#content').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
function resizeImage(image_name) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'text',
|
||||
url: '/laravel-filemanager/resize',
|
||||
data: {
|
||||
img: image_name,
|
||||
working_dir: $('#working_dir').val(),
|
||||
type: $('#type').val()
|
||||
},
|
||||
cache: false
|
||||
}).done(function (data) {
|
||||
$('#nav-buttons').addClass('hidden');
|
||||
$('#content').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
function download(file_name) {
|
||||
location.href = '/laravel-filemanager/download?'
|
||||
+ 'working_dir='
|
||||
+ $('#working_dir').val()
|
||||
+ '&type='
|
||||
+ $('#type').val()
|
||||
+ '&file='
|
||||
+ file_name;
|
||||
}
|
||||
|
||||
// ==================================
|
||||
// == Ckeditor, Bootbox, preview ==
|
||||
// ==================================
|
||||
|
||||
function useFile(file) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
function getFileUrl(file) {
|
||||
var path = $('#working_dir').val();
|
||||
var item_url = image_url;
|
||||
|
||||
@if ("Images" !== $file_type)
|
||||
item_url = file_url;
|
||||
@endif
|
||||
|
||||
if (path.indexOf(ds) === 0) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
|
||||
if (path != ds) {
|
||||
item_url = item_url + path + ds;
|
||||
}
|
||||
|
||||
var url = item_url + file;
|
||||
url = url.replace(/\\/g, "/");
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
var url = getFileUrl(file);
|
||||
var field_name = getUrlParam('field_name');
|
||||
|
||||
if (window.opener || window.tinyMCEPopup || field_name || getUrlParam('CKEditorCleanUpFuncNum') || getUrlParam('CKEditor')) {
|
||||
if (window.tinyMCEPopup) {
|
||||
// use TinyMCE > 3.0 integration method
|
||||
useTinymce3(url);
|
||||
return;
|
||||
} else if (field_name) {
|
||||
// tinymce 4 and colorbox
|
||||
useTinymce4AndColorbox(url, field_name);
|
||||
} else if(getUrlParam('CKEditor')) {
|
||||
// use CKEditor 3.0 + integration method
|
||||
useCkeditor3(url);
|
||||
} else if (typeof data != 'undefined' && data['Properties']['Width'] != '') {
|
||||
// use FCKEditor 2.0 integration method
|
||||
useFckeditor2(url);
|
||||
} else {
|
||||
window.opener.SetUrl(url);
|
||||
}
|
||||
|
||||
if (window.opener) {
|
||||
window.close();
|
||||
}
|
||||
} else {
|
||||
$.prompt(lg.fck_select_integration);
|
||||
}
|
||||
|
||||
window.close();
|
||||
}
|
||||
//end useFile
|
||||
|
||||
function notImp() {
|
||||
bootbox.alert('Not yet implemented!');;
|
||||
}
|
||||
|
||||
function notify(x) {
|
||||
bootbox.alert(x);
|
||||
}
|
||||
|
||||
function fileView(x) {
|
||||
var rnd = makeRandom();
|
||||
var img_src = image_url + $('#working_dir').val() + ds + x;
|
||||
var img = "<img class='img img-responsive center-block' src='" + img_src + "'>";
|
||||
$('#fileview_body').html(img);
|
||||
$('#fileViewModal').modal();
|
||||
}
|
||||
|
||||
function makeRandom() {
|
||||
var text = '';
|
||||
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
for (var i = 0; i < 20; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
</script>
|
@@ -1,32 +1,29 @@
|
||||
<ul class="list-unstyled">
|
||||
@if(Config::get('lfm.allow_multi_user'))
|
||||
<li style="margin-left: -10px;">
|
||||
<a class="pointer" id="folder_root" data-id="/" onclick="clickRoot()">
|
||||
<i class="fa fa-folder-open" data-id="/"></i> {{ Lang::get('laravel-filemanager::lfm.title-root') }}
|
||||
</a>
|
||||
</li>
|
||||
@foreach($dirs as $key => $dir_name)
|
||||
<li>
|
||||
<a class="pointer" id="folder_{{ $key }}" data-id="{{ $dir_name }}" onclick="clickFolder('folder_{{ $key }}', 0)">
|
||||
<i class="fa fa-folder folder-item" data-id="{{ $dir_name }}" id="{{ $dir_name }}-folder"></i> {{ $dir_name }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
<a id="add-folder" class="add-folder btn btn-default btn-xs" style='margin-top:15px;'>
|
||||
<i class="fa fa-plus"></i> {{ Lang::get('laravel-filemanager::lfm.menu-new') }}
|
||||
@if(Config::get('lfm.allow_multi_user'))
|
||||
<li style="margin-left: -10px;">
|
||||
<a class="pointer folder-item" data-id="{{ $user_dir }}">
|
||||
<i class="fa fa-folder-open"></i> {{ Lang::get('laravel-filemanager::lfm.title-root') }}
|
||||
</a>
|
||||
<hr>
|
||||
@endif
|
||||
<li style="margin-left: -10px;">
|
||||
<a class="pointer" id="folder_shared" data-id="/" onclick="clickShared()">
|
||||
<i class="fa fa-folder" data-id="/"></i> {{ Lang::get('laravel-filemanager::lfm.title-shares') }}
|
||||
</a>
|
||||
</li>
|
||||
@foreach($shares as $key => $dir_name)
|
||||
<li>
|
||||
<a class="pointer" id="shared_{{ $key }}" data-id="{{ $dir_name }}" onclick="clickSharedFolder('shared_{{ $key }}', 0)">
|
||||
<i class="fa fa-folder folder-item" data-id="{{ $dir_name }}" id="{{ $dir_name }}-folder-shared"></i> {{ $dir_name }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</li>
|
||||
@foreach($dirs as $key => $dir_name)
|
||||
<li>
|
||||
<a class="pointer folder-item" data-id="{{ $dir_name['long'] }}">
|
||||
<i class="fa fa-folder"></i> {{ $dir_name['short'] }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
<hr>
|
||||
@endif
|
||||
<li style="margin-left: -10px;">
|
||||
<a class="pointer folder-item" data-id="{{ $share_dir }}">
|
||||
<i class="fa fa-folder"></i> {{ Lang::get('laravel-filemanager::lfm.title-shares') }}
|
||||
</a>
|
||||
</li>
|
||||
@foreach($shares as $key => $dir_name)
|
||||
<li>
|
||||
<a class="pointer folder-item" data-id="{{ $dir_name['long'] }}">
|
||||
<i class="fa fa-folder"></i> {{ $dir_name['short'] }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user