Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
alexusmai committed Apr 21, 2018
0 parents commit b733ddf
Show file tree
Hide file tree
Showing 18 changed files with 1,505 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vendor/
node_modules/
npm-debug.log
.idea

22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2018 Aleksandr Manekin [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Laravel File Manager - Backend

![Laravel File Manager](https://raw.github.com/alexusmai/vue-laravel-file-manager/master/src/assets/laravel-file-manager.gif?raw=true)

## Installation

Composer

```
composer require alexusmai/laravel-file-manager
```

If you have Laravel 5.4, then add service provider to config/app.php

```
Alexusmai\LaravelFileManager\FileManagerServiceProvider::class,
```

Publish config file (file-manager.php)

```
php artisan vendor:publish --tag=fm-config
```

> Frontend
You can install npm package directly and use it in your vue application - more information about it -
[vue-laravel-file-manager](https://github.com/alexusmai/vue-laravel-file-manager)

OR

Publish compiled and minimized js and css files

```
php artisan vendor:publish --tag=fm-assets
```

## Settings

Open configuration file - config/file-manager.php

- fill the disk list from config/filesystem.php (select the desired drive names)
- set cache
- select file manager windows configuration

**Be sure to add your middleware to restrict access to the application**


### Open the view file where you want to place the application block, and add:

- add a csrf token to head block if you did not do it before
```html
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
```

- the frontend package uses Bootstrap 4 and Font Awesome 5 styles, if you already use it, then you do not need to connect any styles.
Otherwise add -

```html
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
```

Add file manager styles

```html
<link rel="stylesheet" href="{{ asset('vendor/file-manager/css/file-manager.css') }}">
```

- add file manager js
```html
<script src="{{ asset('vendor/file-manager/css/file-manager.js') }}"></script>
```

- add div for application (set application height!)
```html
<div style="height: 600px;">
<div id="fm"></div>
</div>
```

## WYSIWYG Editor Integration
37 changes: 37 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "alexusmai/laravel-file-manager",
"description": "File manager for Laravel",
"keywords": [
"laravel 5",
"file",
"manager"
],
"authors": [
{
"name": "Aleksandr Manekin",
"email": "[email protected]",
"role": "Developer"
}
],
"homepage": "https://github.com/alexusami/laravel-file-manager",
"license": "MIT",
"minimum-stability": "dev",
"require": {
"php": ">=5.6.4",
"illuminate/support": "^5.4",
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3"
},
"autoload": {
"psr-4": {
"Alexusmai\\LaravelFileManager\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Alexusmai\\LaravelFileManager\\FileManagerServiceProvider"
]
}
}
}
44 changes: 44 additions & 0 deletions config/file-manager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

return [

/**
* list of disk names that you want to use
* (from config/filesystems)
*/
'diskList' => ['public'],

/**
* Default disk for left manager
* null - auto select the first disk in the disk list
*/
'leftDisk' => null,

/**
* Default disk for right manager
* null - auto select the first disk in the disk list
*/
'rightDisk' => null,

/**
* Image cache ( Intervention Image Cache )
* set null, 0 - if you don't need cache (default)
* if you want use cache - set the number of minutes for which the value should be cached
*/
'cache' => null,

/**
* File manager modules configuration
* 1 - only one file manager window
* 2 - one file manager window with directories tree module
* 3 - two file manager windows
*/
'windowsConfig' => 2,

/**
* Middleware
* Add your middleware name to array -> ['web', 'auth', 'admin']
* !!!! RESTRICT ACCESS FOR NON ADMIN USERS !!!!
*/
'middleware' => ['web', 'auth']
];
1 change: 1 addition & 0 deletions resources/assets/css/file-manager.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions resources/assets/js/file-manager.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions resources/lang/en/response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

return [
'noConfig' => 'Config not found!',
'notFound' => 'Not found!',
'diskSelected' => 'Disk selected!',
'dirExist' => 'Directory already exists!',
'dirCreated' => 'Directory created!',
'uploaded' => 'All files uploaded!',
'delNotFound' => 'Some items not found! Refresh!',
'deleted' => 'Deleted!',
'renamed' => 'Renamed!',
'fileNotFound' => 'File not found!',
'copied' => 'Copied successfully!',
];
15 changes: 15 additions & 0 deletions resources/lang/ru/response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

return [
'noConfig' => 'Конфигурация не найдена!',
'notFound' => 'Не найдено!',
'diskSelected' => 'Диск выбран!',
'dirExist' => 'Директория существует!',
'dirCreated' => 'Директория создана!',
'uploaded' => 'Все файлы загружены!',
'delNotFound' => 'Не все элементы найдены!',
'deleted' => 'Удалено!',
'renamed' => 'Переименовано!',
'fileNotFound' => 'Файл не найден!',
'copied' => 'Скопировано!',
];
48 changes: 48 additions & 0 deletions resources/views/ckeditor.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'File Manager') }}</title>

<!-- Styles -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link href="{{ asset('vendor/file-manager/css/file-manager.css') }}" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12" style="height: 800px;">
<div id="fm"></div>
</div>
</div>
</div>

<!-- File manager -->
<script src="{{ asset('vendor/file-manager/js/file-manager.js') }}"></script>
<script>
// Helper function to get parameters from the query string.
function getUrlParam(paramName) {
const reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i');
const match = window.location.search.match(reParam);
return (match && match.length > 1) ? match[1] : null;
}
// Add callback to file manager
fm.$store.commit('fm/setFileCallBack', function (fileUrl) {
const funcNum = getUrlParam('CKEditorFuncNum');
window.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl);
window.close();
});
</script>
</body>
</html>

Loading

0 comments on commit b733ddf

Please sign in to comment.