From 27464d08f70c63b3aae412627b2024a508650c67 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Wed, 11 Mar 2020 17:21:27 +0100 Subject: [PATCH] =?UTF-8?q?-=20ersistent=20Identifier:=20ID=20mit=20Url=20?= =?UTF-8?q?bei=20technischen=20Metadaten=20-=20Embargo-Datum=20in=20den=20?= =?UTF-8?q?Tab=20"Inhalt"=20-=20Filegr=C3=B6=C3=9Fe=20in=20den=20Tab=20"In?= =?UTF-8?q?halt"=20-=20Publisher=20und=20Herausgeber=20in=20den=20Tab=20"T?= =?UTF-8?q?echnische=20Metadaten"=20-=20us=C3=A4tzliche=20Titel,=20=20Refe?= =?UTF-8?q?renzen=20-=20OAI=20Link=20unten=20bei=20Hilfe=20-=20composer=20?= =?UTF-8?q?updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Dataset.php | 4 ++ app/Models/File.php | 18 +++-- composer.lock | 26 +++---- .../views/frontend/dataset/show.blade.php | 69 ++++++++++++++----- resources/views/layouts/app.blade.php | 3 +- 5 files changed, 85 insertions(+), 35 deletions(-) diff --git a/app/Models/Dataset.php b/app/Models/Dataset.php index 63f13b1..e93f806 100644 --- a/app/Models/Dataset.php +++ b/app/Models/Dataset.php @@ -187,6 +187,10 @@ class Dataset extends Model { return $this->hasMany(Title::class, 'document_id', 'id'); } + public function additionalTitles() + { + return $this->hasMany(Title::class, 'document_id', 'id')->where('type', '!=', 'Main'); + } public function mainTitle() { diff --git a/app/Models/File.php b/app/Models/File.php index 246caf8..afa4045 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -23,7 +23,7 @@ class File extends Model return $this->hasMany(HashValue::class, 'file_id', 'id'); } - /** + /** * Create hash value model objects from original file. * * TODO throws Exception in case hash computation is not possible @@ -34,7 +34,7 @@ class File extends Model public function createHashValues() { $hashtypes = array('md5', 'sha512'); - + foreach ($hashtypes as $type) { $hash = new HashValue(); $hash->type = $type; @@ -44,7 +44,7 @@ class File extends Model } } - /** + /** * Get the hash value of the file * * @param string $type Type of the hash value, @see hash_file(); @@ -65,11 +65,21 @@ class File extends Model private function getPath() { //return storage_path('app/public/' . $this->path_name); - return public_path('storage/' . $this->path_name); + return public_path('storage/' . $this->path_name); } public function exists() { return \Illuminate\Support\Facades\File::exists(public_path('storage/' . $this->path_name)); } + + public function formatSize($precision = 1) + { + $size = $this->file_size; + $unit = ['Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; + for ($i = 0; $size >= 1024 && $i < count($unit) - 1; $i++) { + $size /= 1024; + } + return round($size, $precision) . ' ' . $unit[$i]; + } } diff --git a/composer.lock b/composer.lock index 882aa3c..3c0d842 100755 --- a/composer.lock +++ b/composer.lock @@ -496,26 +496,26 @@ }, { "name": "felixkiss/uniquewith-validator", - "version": "3.3.1", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/felixkiss/uniquewith-validator.git", - "reference": "c9d088543f93d3ebca6c1cc40ba8cbd6d855d79c" + "reference": "7ce4ff83c9003718e8febe1d4670eb869a720c5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixkiss/uniquewith-validator/zipball/c9d088543f93d3ebca6c1cc40ba8cbd6d855d79c", - "reference": "c9d088543f93d3ebca6c1cc40ba8cbd6d855d79c", + "url": "https://api.github.com/repos/felixkiss/uniquewith-validator/zipball/7ce4ff83c9003718e8febe1d4670eb869a720c5c", + "reference": "7ce4ff83c9003718e8febe1d4670eb869a720c5c", "shasum": "" }, "require": { - "illuminate/support": "5.*|^6.0", - "illuminate/validation": "5.*|^6.0", + "illuminate/support": "^5.5|^6.0|^7.0", + "illuminate/validation": "^5.5|^6.0|^7.0", "php": "^7.1.3" }, "require-dev": { "bossa/phpspec2-expect": "^3.0", - "phpspec/phpspec": "^5.0" + "phpspec/phpspec": "^5.0|^6.0" }, "type": "library", "extra": { @@ -545,7 +545,7 @@ "keywords": [ "laravel" ], - "time": "2019-09-10T07:24:13+00:00" + "time": "2020-03-10T21:45:55+00:00" }, { "name": "fideloper/proxy", @@ -970,16 +970,16 @@ }, { "name": "league/flysystem", - "version": "1.0.64", + "version": "1.0.65", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0" + "reference": "8f17b3ba67097aafb8318cd5c553b1acf7c891c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d13c43dbd4b791f815215959105a008515d1a2e0", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/8f17b3ba67097aafb8318cd5c553b1acf7c891c8", + "reference": "8f17b3ba67097aafb8318cd5c553b1acf7c891c8", "shasum": "" }, "require": { @@ -1050,7 +1050,7 @@ "sftp", "storage" ], - "time": "2020-02-05T18:14:17+00:00" + "time": "2020-03-08T18:53:20+00:00" }, { "name": "mcamara/laravel-localization", diff --git a/resources/views/frontend/dataset/show.blade.php b/resources/views/frontend/dataset/show.blade.php index 653dbd5..e748f31 100644 --- a/resources/views/frontend/dataset/show.blade.php +++ b/resources/views/frontend/dataset/show.blade.php @@ -26,15 +26,15 @@
@@ -42,6 +42,18 @@
+ @if($dataset->embargo_date != null) +

Ende des Embargo-Zeitraums: + {{ $dataset->embargo_date->toDateString() }}

+ @else +

Ende des Embargo-Zeitraums: -

+ @endif + @if($dataset->hasEmbargoPassed() == true) + @@ -91,6 +120,9 @@ missing file: {{ $file->path_name }} @endif + @endforeach @@ -101,14 +133,14 @@ @@ -150,6 +182,9 @@ ul.tab-nav li span.active.button { border-bottom: 0.175em solid #fff; + border-bottom-color: #00bfffcc; + color: #00bfffcc; + /* background-color: #6c6e6b; */ } .tab-content .tab-pane { @@ -260,8 +295,8 @@ @section('after-scripts') -
Path NameFile Size
+ {{ $file->formatSize(2) }} +