listing files in backend

This commit is contained in:
Arno Kaimbacher 2018-10-11 16:49:08 +02:00
parent 4ac1c34b6a
commit ccff83fa66
9 changed files with 153 additions and 93 deletions

View File

@ -11,6 +11,7 @@ use Illuminate\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Models\File;
class DatasetController extends Controller
{
@ -109,7 +110,7 @@ class DatasetController extends Controller
public function edit($id) : View
{
$document = Dataset::findOrFail($id);
$document->load('licenses', 'titles', 'abstracts');
$document->load('licenses', 'titles', 'abstracts', 'files');
$projects = Project::pluck('label', 'id');
@ -191,6 +192,7 @@ class DatasetController extends Controller
return redirect()->route('settings.document');
}
/**
* Remove the specified resource from storage.
*

View File

@ -0,0 +1,18 @@
<?php
namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use Illuminate\View\View;
use Illuminate\Http\Request;
use App\Models\File;
class FileController extends Controller
{
public function download($id)
{
//$report = $this->report->find($id);
$file = File::findOrFail($id);
$file_path = public_path('storage/' . $file->path_name);
return response()->download($file_path, $file->label, ['Content-Type:' . $file->mime_type]);
}
}

View File

@ -66,4 +66,9 @@ class File extends Model
{
return storage_path('app/public/' . $this->path_name);
}
public function exists()
{
return \Illuminate\Support\Facades\File::exists(public_path('storage/' . $this->path_name));
}
}

167
composer.lock generated
View File

@ -279,16 +279,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.5",
"version": "2.1.6",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "54859fabea8b3beecbb1a282888d5c990036b9e3"
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/54859fabea8b3beecbb1a282888d5c990036b9e3",
"reference": "54859fabea8b3beecbb1a282888d5c990036b9e3",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
"shasum": ""
},
"require": {
@ -332,7 +332,7 @@
"validation",
"validator"
],
"time": "2018-08-16T20:49:45+00:00"
"time": "2018-09-25T20:47:26+00:00"
},
{
"name": "erusev/parsedown",
@ -502,32 +502,32 @@
},
{
"name": "jakub-onderka/php-console-color",
"version": "0.1",
"version": "v0.2",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Color.git",
"reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1"
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1",
"reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191",
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
"php": ">=5.4.0"
},
"require-dev": {
"jakub-onderka/php-code-style": "1.0",
"jakub-onderka/php-parallel-lint": "0.*",
"jakub-onderka/php-parallel-lint": "1.0",
"jakub-onderka/php-var-dump-check": "0.*",
"phpunit/phpunit": "3.7.*",
"phpunit/phpunit": "~4.3",
"squizlabs/php_codesniffer": "1.*"
},
"type": "library",
"autoload": {
"psr-0": {
"JakubOnderka\\PhpConsoleColor": "src/"
"psr-4": {
"JakubOnderka\\PhpConsoleColor\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -537,11 +537,10 @@
"authors": [
{
"name": "Jakub Onderka",
"email": "jakub.onderka@gmail.com",
"homepage": "http://www.acci.cz"
"email": "jakub.onderka@gmail.com"
}
],
"time": "2014-04-08T15:00:19+00:00"
"time": "2018-09-29T17:23:10+00:00"
},
{
"name": "jakub-onderka/php-console-highlighter",
@ -589,16 +588,16 @@
},
{
"name": "laravel/framework",
"version": "v5.5.43",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "84f4ed02ec6eb4a56629fb6acbee1df56891e3c7"
"reference": "00615aa27eb98f0ee6fb9f2160c6c60ae04abd1b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/84f4ed02ec6eb4a56629fb6acbee1df56891e3c7",
"reference": "84f4ed02ec6eb4a56629fb6acbee1df56891e3c7",
"url": "https://api.github.com/repos/laravel/framework/zipball/00615aa27eb98f0ee6fb9f2160c6c60ae04abd1b",
"reference": "00615aa27eb98f0ee6fb9f2160c6c60ae04abd1b",
"shasum": ""
},
"require": {
@ -719,7 +718,7 @@
"framework",
"laravel"
],
"time": "2018-09-02T11:45:05+00:00"
"time": "2018-10-04T14:51:24+00:00"
},
{
"name": "laravel/tinker",
@ -1115,16 +1114,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.0.4",
"version": "v4.1.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c"
"reference": "d0230c5c77a7e3cfa69446febf340978540958c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fa6ee28600d21d49b2b4e1006b48426cec8e579c",
"reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/d0230c5c77a7e3cfa69446febf340978540958c0",
"reference": "d0230c5c77a7e3cfa69446febf340978540958c0",
"shasum": ""
},
"require": {
@ -1140,7 +1139,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
"dev-master": "4.1-dev"
}
},
"autoload": {
@ -1162,7 +1161,7 @@
"parser",
"php"
],
"time": "2018-09-18T07:03:24+00:00"
"time": "2018-10-10T09:24:14+00:00"
},
{
"name": "paragonie/random_compat",
@ -1628,16 +1627,16 @@
},
{
"name": "symfony/console",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73"
"reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/6b217594552b9323bcdcfc14f8a0ce126e84cd73",
"reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73",
"url": "https://api.github.com/repos/symfony/console/zipball/3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b",
"reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b",
"shasum": ""
},
"require": {
@ -1693,20 +1692,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2018-07-26T11:19:56+00:00"
"time": "2018-10-02T16:33:53+00:00"
},
{
"name": "symfony/css-selector",
"version": "v4.1.4",
"version": "v4.1.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "2a4df7618f869b456f9096781e78c57b509d76c7"
"reference": "d67de79a70a27d93c92c47f37ece958bf8de4d8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/2a4df7618f869b456f9096781e78c57b509d76c7",
"reference": "2a4df7618f869b456f9096781e78c57b509d76c7",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/d67de79a70a27d93c92c47f37ece958bf8de4d8a",
"reference": "d67de79a70a27d93c92c47f37ece958bf8de4d8a",
"shasum": ""
},
"require": {
@ -1746,20 +1745,20 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2018-07-26T09:10:45+00:00"
"time": "2018-10-02T16:36:10+00:00"
},
{
"name": "symfony/debug",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "c4625e75341e4fb309ce0c049cbf7fb84b8897cd"
"reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/c4625e75341e4fb309ce0c049cbf7fb84b8897cd",
"reference": "c4625e75341e4fb309ce0c049cbf7fb84b8897cd",
"url": "https://api.github.com/repos/symfony/debug/zipball/0a612e9dfbd2ccce03eb174365f31ecdca930ff6",
"reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6",
"shasum": ""
},
"require": {
@ -1802,11 +1801,11 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2018-08-03T10:42:44+00:00"
"time": "2018-10-02T16:33:53+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@ -1869,16 +1868,16 @@
},
{
"name": "symfony/finder",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "8a84fcb207451df0013b2c74cbbf1b62d47b999a"
"reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/8a84fcb207451df0013b2c74cbbf1b62d47b999a",
"reference": "8a84fcb207451df0013b2c74cbbf1b62d47b999a",
"url": "https://api.github.com/repos/symfony/finder/zipball/54ba444dddc5bd5708a34bd095ea67c6eb54644d",
"reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d",
"shasum": ""
},
"require": {
@ -1914,20 +1913,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2018-07-26T11:19:56+00:00"
"time": "2018-10-03T08:46:40+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "2fb33cb6eefe6e790e4023f7c534a9e4214252fc"
"reference": "3a4498236ade473c52b92d509303e5fd1b211ab1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/2fb33cb6eefe6e790e4023f7c534a9e4214252fc",
"reference": "2fb33cb6eefe6e790e4023f7c534a9e4214252fc",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a4498236ade473c52b92d509303e5fd1b211ab1",
"reference": "3a4498236ade473c52b92d509303e5fd1b211ab1",
"shasum": ""
},
"require": {
@ -1968,20 +1967,20 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2018-08-27T17:45:33+00:00"
"time": "2018-10-03T08:48:18+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "2819693b25f480966cbfa13b651abccfed4871ca"
"reference": "a0944a9a1d8845da724236cde9a310964acadb1c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/2819693b25f480966cbfa13b651abccfed4871ca",
"reference": "2819693b25f480966cbfa13b651abccfed4871ca",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/a0944a9a1d8845da724236cde9a310964acadb1c",
"reference": "a0944a9a1d8845da724236cde9a310964acadb1c",
"shasum": ""
},
"require": {
@ -2057,7 +2056,7 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2018-08-28T06:06:12+00:00"
"time": "2018-10-03T12:03:34+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -2237,16 +2236,16 @@
},
{
"name": "symfony/process",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "4d6b125d5293cbceedc2aa10f2c71617e76262e7"
"reference": "1dc2977afa7d70f90f3fefbcd84152813558910e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/4d6b125d5293cbceedc2aa10f2c71617e76262e7",
"reference": "4d6b125d5293cbceedc2aa10f2c71617e76262e7",
"url": "https://api.github.com/repos/symfony/process/zipball/1dc2977afa7d70f90f3fefbcd84152813558910e",
"reference": "1dc2977afa7d70f90f3fefbcd84152813558910e",
"shasum": ""
},
"require": {
@ -2282,20 +2281,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2018-08-03T10:42:44+00:00"
"time": "2018-10-02T12:28:39+00:00"
},
{
"name": "symfony/routing",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "e20f4bb79502c3c0db86d572f7683a30d4143911"
"reference": "585f6e2d740393d546978769dd56e496a6233e0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/e20f4bb79502c3c0db86d572f7683a30d4143911",
"reference": "e20f4bb79502c3c0db86d572f7683a30d4143911",
"url": "https://api.github.com/repos/symfony/routing/zipball/585f6e2d740393d546978769dd56e496a6233e0b",
"reference": "585f6e2d740393d546978769dd56e496a6233e0b",
"shasum": ""
},
"require": {
@ -2359,20 +2358,20 @@
"uri",
"url"
],
"time": "2018-07-26T11:19:56+00:00"
"time": "2018-10-02T12:28:39+00:00"
},
{
"name": "symfony/translation",
"version": "v4.1.4",
"version": "v4.1.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f"
"reference": "9f0b61e339160a466ebcde167a6c5521c810e304"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/fa2182669f7983b7aa5f1a770d053f79f0ef144f",
"reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f",
"url": "https://api.github.com/repos/symfony/translation/zipball/9f0b61e339160a466ebcde167a6c5521c810e304",
"reference": "9f0b61e339160a466ebcde167a6c5521c810e304",
"shasum": ""
},
"require": {
@ -2428,20 +2427,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2018-08-07T12:45:11+00:00"
"time": "2018-10-02T16:36:10+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v3.4.15",
"version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "f62a394bd3de96f2f5e8f4c7d685035897fb3cb3"
"reference": "ff8ac19e97e5c7c3979236b584719a1190f84181"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/f62a394bd3de96f2f5e8f4c7d685035897fb3cb3",
"reference": "f62a394bd3de96f2f5e8f4c7d685035897fb3cb3",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/ff8ac19e97e5c7c3979236b584719a1190f84181",
"reference": "ff8ac19e97e5c7c3979236b584719a1190f84181",
"shasum": ""
},
"require": {
@ -2497,7 +2496,7 @@
"debug",
"dump"
],
"time": "2018-07-26T11:19:56+00:00"
"time": "2018-10-02T16:33:53+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@ -2598,16 +2597,16 @@
},
{
"name": "yajra/laravel-datatables-oracle",
"version": "v8.8.0",
"version": "v8.9.1",
"source": {
"type": "git",
"url": "https://github.com/yajra/laravel-datatables.git",
"reference": "f2959bf773fc315e1b3319fb0a34c880b97706d5"
"reference": "851c4d4d307a66a4f8ab5c12444c1eb0104ecc80"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/f2959bf773fc315e1b3319fb0a34c880b97706d5",
"reference": "f2959bf773fc315e1b3319fb0a34c880b97706d5",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/851c4d4d307a66a4f8ab5c12444c1eb0104ecc80",
"reference": "851c4d4d307a66a4f8ab5c12444c1eb0104ecc80",
"shasum": ""
},
"require": {
@ -2665,7 +2664,7 @@
"jquery",
"laravel"
],
"time": "2018-09-05T05:43:38+00:00"
"time": "2018-10-05T06:10:33+00:00"
},
{
"name": "zizaco/entrust",

File diff suppressed because one or more lines are too long

View File

@ -56,7 +56,7 @@ const app = new Vue({
dataset: {
type: '',
state: '',
rights: 0,
rights: null,
project_id: '',
creating_corporation: "GBA",

View File

@ -111,6 +111,32 @@
</fieldset>
<fieldset id="fieldset-abstracts">
<legend>Files</legend>
<table id="items" class="pure-table pure-table-horizontal">
<thead>
<tr>
<th>Path Name</th>
<th>Label</th>
</tr>
</thead>
<tbody>
@foreach($document->files as $key => $file)
<tr>
<td>
@if($file->exists() === true)
<a href="{{ route('settings.file.download', ['id' => $file->id]) }}"> {{ $file->path_name }} </a>
@else
<span class="alert">missing file: {{ $file->path_name }}</span>
@endif
</td>
<td> {{ $file->label }} </td>
</tr>
@endforeach
</tbody>
</table>
</fieldset>
<br />
<div class="pure-controls">
<button type="submit" class="pure-button button-small">

View File

@ -17,13 +17,13 @@
{!! Form::text('search', null, array('class'=>'pure-u-1 pure-u-md-1-2', 'placeholder'=>'filter for the title...')) !!}
<div class="select pure-u-1 pure-u-md-1-2">
{!! Form::select('state', Config::get('enums.server_states'), 'published', ['class' => 'pure-u-1']) !!}
{!! Form::select('state', Config::get('enums.server_states'), 'published', ['class' => 'pure-u-1', 'onchange' => "this.form.submit()"]) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2">
<button type="submit">
{{-- <button type="submit">
<i class="fa fa-search"></i>
</button>
</button> --}}
</div>
</p>
<input type="hidden" name="searchtype" id="searchtype" value="simple" />
@ -81,14 +81,15 @@
</table>
</div>
{!! Form::close() !!}
<div class="pure-u-1">
{{ $documents
->appends(Input::except('page'))
->links('vendor.pagination.default') }}
</div>
{!! Form::close() !!}
</div>

View File

@ -16,7 +16,7 @@ use Illuminate\Support\Facades\Route;
Route::get('/oai', ['as' => 'oai', 'uses' => 'Oai\RequestController@index']);
//=================================================publish dataasets================================================
//=================================================publish datasets================================================
Route::group(
[
'namespace' => 'Publish',
@ -119,6 +119,15 @@ Route::group(['middleware' => ['permission:settings']], function () {
Route::patch('settings/document/update/{id}', [
'as' => 'settings.document.update', 'uses' => 'Settings\DatasetController@update',
]);
Route::get('settings/file/download/{id}', [
'as' => 'settings.file.download', 'uses' => 'Settings\DatasetController@download',
]);
//=============================================================================================================
//=================================================setting file=============================================
Route::get('settings/file/download/{id}', [
'as' => 'settings.file.download', 'uses' => 'Settings\FileController@download',
]);
//=================================================setting collection=============================================
Route::get('/settings/collection', [
'as' => 'settings.collection.index', 'uses' => 'Settings\CollectionController@index',