Skip to content

Commit 8933f25

Browse files
committed
Merge pull request #15 from tsawler/Development
Development
2 parents f90a94e + 636f44c commit 8933f25

File tree

5 files changed

+126
-26
lines changed

5 files changed

+126
-26
lines changed

src/config/lfm.php

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,36 @@
66
'images_dir' => 'public/vendor/laravel-filemanager/images/',
77
'images_url' => '/vendor/laravel-filemanager/images/',
88

9-
'files_dir' => 'public/vendor/laravel-filemanager/files/',
10-
'files_url' => '/vendor/laravel-filemanager/files/',
9+
'files_dir' => 'public/vendor/laravel-filemanager/files/',
10+
'files_url' => '/vendor/laravel-filemanager/files/',
1111

12-
'params' => 'type=Images&CKEditor=editor&CKEditorFuncNum=1&langCode=en',
13-
];
12+
'file_type_array' => [
13+
"pdf" => "Adobe Acrobat",
14+
"docx" => "Microsoft Word",
15+
"docx" => "Microsoft Word",
16+
"xls" => "Microsoft Excel",
17+
"xls" => "Microsoft Excel",
18+
"zip" => 'Archive',
19+
"gif" => 'GIF Image',
20+
"jpg" => 'JPEG Image',
21+
"jpeg" => 'JPEG Image',
22+
"png" => 'PNG Image',
23+
"ppt" => 'Microsoft PowerPoint',
24+
"pptx" => 'Microsoft PowerPoint',
25+
],
26+
27+
'file_icon_array' => [
28+
"pdf" => "fa-file-pdf-o",
29+
"docx" => "fa-file-word-o",
30+
"docx" => "fa-file-word-o",
31+
"xls" => "fa-file-excel-o",
32+
"xls" => "fa-file-excel-o",
33+
"zip" => 'fa-file-archive-o',
34+
"gif" => 'fa-file-image-o',
35+
"jpg" => 'fa-file-image-o',
36+
"jpeg" => 'fa-file-image-o',
37+
"png" => 'fa-file-image-o',
38+
"ppt" => 'fa-file-powerpoint-o',
39+
"pptx" => 'fa-file-powerpoint-o',
40+
],
41+
];

src/controllers/FolderController.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,4 @@ public function getAddfolder()
7171

7272
}
7373

74-
75-
/**
76-
* Delete a folder and all of it's contents
77-
*
78-
* @return mixed
79-
*/
80-
public function getDeletefolder()
81-
{
82-
$folder_name = Input::get('name');
83-
$path = base_path($this->file_location);
84-
File::deleteDirectory($path . $folder_name, $preserve = false);
85-
86-
return Redirect::to('/laravel-filemanager?' . Config::get('lfm.params'));
87-
}
88-
8974
}

src/controllers/ItemsController.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function __construct()
3535
}
3636

3737

38+
/**
39+
* Return json list of files
40+
*
41+
* @return mixed
42+
*/
3843
public function getFiles()
3944
{
4045
if (Input::has('base'))
@@ -55,20 +60,35 @@ public function getFiles()
5560
}
5661

5762
$file_info = [];
63+
$icon_array = Config::get('lfm.file_icon_array');
64+
$type_array = Config::get('lfm.file_type_array');
5865

5966
foreach ($files as $file)
6067
{
6168
$file_name = $file;
6269
$file_size = 1;
70+
$extension = strtolower(File::extension($file_name));
71+
72+
if (array_key_exists($extension, $icon_array))
73+
{
74+
$icon = $icon_array[$extension];
75+
$type = $type_array[$extension];
76+
} else
77+
{
78+
$icon = "fa-file";
79+
$type= "File";
80+
}
6381

6482
$file_created = filemtime($file);
6583
$file_type = '';
6684
$file_info[] = [
67-
'name' => $file_name,
68-
'size' => $file_size,
69-
'created' => $file_created,
70-
'type' => $file_type,
71-
'icon' => 'fa-file-archive-o'
85+
'name' => $file_name,
86+
'size' => $file_size,
87+
'created' => $file_created,
88+
'type' => $file_type,
89+
'extension' => $extension,
90+
'icon' => $icon,
91+
'type' => $type,
7292
];
7393
}
7494

src/views/files-list.blade.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<div class="container">
2+
@if((sizeof($file_info) > 0) || (sizeof($directories) > 0))
3+
<table class="table table-condensed table-striped">
4+
<thead>
5+
<tr>
6+
<th>Item</th>
7+
<th>Size</th>
8+
<th>Type</th>
9+
<th>Modified</th>
10+
<th>Action</th>
11+
</tr>
12+
</thead>
13+
<tbody>
14+
@foreach($directories as $key => $dir)
15+
<tr>
16+
<td>
17+
<i class="fa fa-folder-o"></i>
18+
<a id="large_folder_{{ $key }}" href="javascript:clickFolder('large_folder_{{ $key }}',1)"
19+
data-id="{{ $dir }}">
20+
{!! basename($dir) !!}
21+
</a>
22+
</td>
23+
<td></td>
24+
<td>Folder</td>
25+
<td></td>
26+
<td></td>
27+
</tr>
28+
@endforeach
29+
30+
@foreach($file_info as $file)
31+
<tr>
32+
<td>
33+
<i class="fa <?= $file['icon']; ?>"></i>
34+
<a href="javascript:useFile('<?= basename($file['name']) ?>')">
35+
{!! basename($file['name']) !!}
36+
</a>
37+
&nbsp;&nbsp;
38+
<a href="javascript:rename('<?= basename($file['name']) ?>')">
39+
<i class="fa fa-edit"></i>
40+
</a>
41+
</td>
42+
<td>
43+
{!! $file['size'] !!}
44+
</td>
45+
<td>
46+
{!! $file['type'] !!}
47+
</td>
48+
<td>
49+
{!! date("Y-m-d h:m", $file['created']) !!}
50+
</td>
51+
<td>
52+
<a href="javascript:trash('<?= basename($file['name']) ?>')">
53+
<i class="fa fa-trash fa-fw"></i>
54+
</a>
55+
</td>
56+
</tr>
57+
@endforeach
58+
</tbody>
59+
</table>
60+
61+
@else
62+
<div class="col-md-12">
63+
<p>Folder is empty.</p>
64+
</div>
65+
@endif
66+
67+
</div>

src/views/files.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class="btn btn-default btn-xs">
3737

3838
<div class="col-sm-6 col-md-2 img-row">
3939

40-
<div class="thumbnail thumbnail-img text-center" data-id="{{ basename($file['name']) }}" id="img_thumbnail_{{ $key }}">
41-
<i class="fa <?= $file['icon'] ?> fa-5x"></i>
40+
<div class="thumbnail thumbnail-img text-center" style="border: none;" data-id="{{ basename($file['name']) }}" id="img_thumbnail_{{ $key }}">
41+
<i class="fa <?= $file['icon']; ?> fa-5x"></i>
4242
</div>
4343

4444
<div class="caption text-center">

0 commit comments

Comments
 (0)