diff --git a/app/Http/Controllers/PhotoController.php b/app/Http/Controllers/PhotoController.php index 51bc3cb..84345a2 100644 --- a/app/Http/Controllers/PhotoController.php +++ b/app/Http/Controllers/PhotoController.php @@ -9,21 +9,24 @@ class PhotoController extends Controller { use Multimedia; - protected $list_duplicates = 20; - protected $list_deletes = 50; - public function delete(Photo $o) { $o->remove = TRUE; $o->save(); - return redirect()->action('PhotoController@info',[$o->id]); + return redirect() + ->action('PhotoController@info',[$o->id]); } public function deletes($id=NULL) { return view('catalog.deletereview',[ - 'catalog'=>is_null($id) ? Photo::where('remove',1)->with(['software.model.make'])->paginate($this->list_deletes) : Photo::where('id',$id)->paginate(1), + 'catalog'=>is_null($id) + ? Photo::where('remove',1) + ->with(['software.model.make']) + ->paginate(self::list_deletes) + : Photo::where('id',$id) + ->paginate(1), 'return'=>url('p/deletes'), 'type'=>'photo', ]); @@ -32,7 +35,12 @@ class PhotoController extends Controller public function duplicates($id=NULL) { return view('catalog.duplicatereview',[ - 'catalog'=>is_null($id) ? Photo::duplicates()->with(['software.model.make'])->paginate($this->list_duplicates) : Photo::where('id',$id)->paginate(1), + 'catalog'=>is_null($id) + ? Photo::duplicates() + ->with(['software.model.make']) + ->paginate(self::list_duplicates) + : Photo::where('id',$id) + ->paginate(1), 'return'=>url('p/duplicates'), 'type'=>'photo', ]); diff --git a/app/Http/Controllers/VideoController.php b/app/Http/Controllers/VideoController.php index 0581448..502499e 100644 --- a/app/Http/Controllers/VideoController.php +++ b/app/Http/Controllers/VideoController.php @@ -10,21 +10,24 @@ class VideoController extends Controller { use Multimedia; - protected $list_duplicates = 20; - protected $list_deletes = 50; - public function delete(Video $o) { $o->remove = TRUE; $o->save(); - return redirect()->action('VideoController@info',[$o->id]); + return redirect() + ->action('VideoController@info',[$o->id]); } public function deletes($id=NULL) { return view('catalog.deletereview',[ - 'catalog'=>is_null($id) ? Video::where('remove',1)->with(['software.model.make'])->paginate($this->list_deletes) : Video::where('id',$id)->paginate(1), + 'catalog'=>is_null($id) + ? Video::where('remove',1) + ->with(['software.model.make']) + ->paginate(self::list_deletes) + : Video::where('id',$id) + ->paginate(1), 'return'=>url('v/deletes'), 'type'=>'video', ]); @@ -33,7 +36,12 @@ class VideoController extends Controller public function duplicates($id=NULL) { return view('catalog.duplicatereview',[ - 'catalog'=>is_null($id) ? Video::duplicates()->with(['software.model.make'])->paginate($this->list_duplicates) : Video::where('id',$id)->paginate(1), + 'catalog'=>is_null($id) + ? Video::duplicates() + ->with(['software.model.make']) + ->paginate(self::list_duplicates) + : Video::where('id',$id) + ->paginate(1), 'return'=>url('v/duplicates'), 'type'=>'video', ]); @@ -44,7 +52,8 @@ class VideoController extends Controller $o->remove = NULL; $o->save(); - return redirect()->action('VideoController@info',[$o->id]); + return redirect() + ->action('VideoController@info',[$o->id]); } public function view(Video $o) diff --git a/app/Models/Abstracted/Catalog.php b/app/Models/Abstracted/Catalog.php index 9b37d0d..4d18e74 100644 --- a/app/Models/Abstracted/Catalog.php +++ b/app/Models/Abstracted/Catalog.php @@ -322,67 +322,6 @@ abstract class Catalog extends Model return trim(chunk_split(sprintf("%0{$depth}s",$this->id),$sep,'/'),'/'); } - /** - * Return HTML Checkbox for duplicate - * @deprecated use a component - */ - public function getDuplicateCheckboxAttribute() - { - return $this->HTMLCheckbox('duplicate',$this->id,$this->duplicate); - } - - /** - * Return HTML Checkbox for flagged - * @deprecated use a component - */ - public function getFlagCheckboxAttribute() - { - return $this->HTMLCheckbox('flag',$this->id,$this->flag); - } - - /** - * Return HTML Checkbox for ignore - * @deprecated use a component - */ - public function getIgnoreCheckboxAttribute() - { - return $this->HTMLCheckbox('ignore_duplicate',$this->id,$this->ignore_duplicate); - } - - /** - * @deprecated use a component - */ - public function getDuplicateTextAttribute() - { - return $this->TextTrueFalse($this->duplicate); - } - - /** - * @deprecated use a component - */ - public function getFlagTextAttribute() - { - return $this->TextTrueFalse($this->flag); - } - - /** - * Return HTML Checkbox for remove - * @deprecated use a component - */ - public function getRemoveCheckboxAttribute() - { - return $this->HTMLCheckbox('remove',$this->id,$this->remove); - } - - /** - * Return an HTML checkbox - * @deprecated use a component - */ - protected function HTMLCheckbox($name,$id,$value) - { - return sprintf('',$name,$id,$value ? ' checked="checked"' : ''); - } - /** * Set values from the media object * @@ -558,12 +497,6 @@ abstract class Catalog extends Model return $this->filename !== $this->file_name(); } - /** @deprecated is this really needed? */ - private function TextTrueFalse($value): string - { - return $value ? 'TRUE' : 'FALSE'; - } - /** * Find duplicate images based on some attributes of the current image */ diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 3b8efa2..8c72363 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -5,6 +5,7 @@ namespace App\Providers; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Illuminate\Foundation\Bus\DispatchesJobs; +use Illuminate\Pagination\Paginator; use App\Models\{Photo,Video}; @@ -31,5 +32,7 @@ class AppServiceProvider extends ServiceProvider { Route::model('po',Photo::class); Route::model('vo',Video::class); + + Paginator::useBootstrapFour(); } } \ No newline at end of file diff --git a/app/Traits/Multimedia.php b/app/Traits/Multimedia.php index b9cc75b..e6bbf17 100644 --- a/app/Traits/Multimedia.php +++ b/app/Traits/Multimedia.php @@ -17,6 +17,9 @@ trait Multimedia { use Type; + protected const list_duplicates = 20; + protected const list_deletes = 50; + private function controller(string $type): string { switch (strtolower($type)) { @@ -31,10 +34,11 @@ trait Multimedia $class = $this->getModelType($request->input('type')); $this->updatePostItems($request,$class,TRUE); - return redirect()->action( - sprintf('%s@deletes',$this->controller($request->input('type'))), - sprintf('?page=%s',$request->input('page')) - ); + return redirect() + ->action( + sprintf('%s@deletes',$this->controller($request->input('type'))), + sprintf('?page=%s',$request->input('page')) + ); } public function duplicatesUpdate(Request $request) @@ -42,10 +46,11 @@ trait Multimedia $class = $this->getModelType($request->input('type')); $this->updatePostItems($request,$class); - return redirect()->action( - sprintf('%s@duplicates',$this->controller($request->input('type'))), - sprintf('?page=%s',$request->input('page')) - ); + return redirect() + ->action( + sprintf('%s@duplicates',$this->controller($request->input('type'))), + sprintf('?page=%s',$request->input('page')) + ); } private function updatePostItems(Request $request,string $class,bool $delete=FALSE) @@ -53,9 +58,11 @@ trait Multimedia foreach ($request->input('items') as $id) { try { $o = $class::findOrFail($id); + } catch (ModelNotFoundException $e) { Log::alert('Object not found: '.$id); continue; + } catch (\Exception $e) { dd($e); } @@ -70,7 +77,7 @@ trait Multimedia $o->flag = $request->input('flag.'.$id) ? 1 : NULL; // Set if delete - if ($delete AND $o->remove AND ($request->input('remove.'.$id) ? 1 : NULL)) { + if ($delete && $o->remove && ($request->input('remove.'.$id) ? 1 : NULL)) { switch (strtolower($request->input('type'))) { case 'photo': $this->dispatch((new PhotoDelete($o))->onQueue('delete')); diff --git a/resources/views/catalog/deletereview.blade.php b/resources/views/catalog/deletereview.blade.php index 7825e89..9dbd838 100644 --- a/resources/views/catalog/deletereview.blade.php +++ b/resources/views/catalog/deletereview.blade.php @@ -17,14 +17,17 @@ @section('main-content')
@if ($catalog->count()) - {{ $catalog->links() }} + + {{ $catalog->links() }} +
@csrf + - @include('catalog.widgets.duplicates') + @include('catalog.widgets.list')
diff --git a/resources/views/catalog/duplicatereview.blade.php b/resources/views/catalog/duplicatereview.blade.php index dccc320..6231882 100644 --- a/resources/views/catalog/duplicatereview.blade.php +++ b/resources/views/catalog/duplicatereview.blade.php @@ -17,15 +17,17 @@ @section('main-content')
@if ($catalog->count()) - {{ $catalog->links() }} + + {{ $catalog->links() }} +
@csrf + - - @include('catalog.widgets.duplicates') + @include('catalog.widgets.list')
diff --git a/resources/views/catalog/widgets/duplicates.blade.php b/resources/views/catalog/widgets/list.blade.php similarity index 84% rename from resources/views/catalog/widgets/duplicates.blade.php rename to resources/views/catalog/widgets/list.blade.php index ab727da..488bd7b 100644 --- a/resources/views/catalog/widgets/duplicates.blade.php +++ b/resources/views/catalog/widgets/list.blade.php @@ -11,8 +11,8 @@ @foreach ($catalog as $o) - @continue($rendered->search($o)) - @php($rendered->push($o)) + @continue($rendered->contains($o->id)) + @php($rendered->push($o->id)) @@ -28,8 +28,8 @@ @else @foreach($d as $item) - @continue($rendered->search($item)) - @php($rendered->push($item)) + @continue($rendered->contains($item->id)) + @php($rendered->push($item->id)) @include($item::config.'.widgets.thumbnail',['o'=>$item,'reference'=>$o,'css'=>'thumbnail']) diff --git a/resources/views/components/checkbox.blade.php b/resources/views/components/checkbox.blade.php new file mode 100644 index 0000000..d11f5f0 --- /dev/null +++ b/resources/views/components/checkbox.blade.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/views/photo/view.blade.php b/resources/views/photo/view.blade.php index 736f306..b50482c 100644 --- a/resources/views/photo/view.blade.php +++ b/resources/views/photo/view.blade.php @@ -31,6 +31,7 @@ @if($po->duplicate)@endif @if($po->ignore_duplicate)@endif @if($po->remove)@endif + @if($po->flag)@endif
Signature
{{ $po->signature(TRUE) }}
diff --git a/resources/views/photo/widgets/thumbnail.blade.php b/resources/views/photo/widgets/thumbnail.blade.php index fb42441..7031c93 100644 --- a/resources/views/photo/widgets/thumbnail.blade.php +++ b/resources/views/photo/widgets/thumbnail.blade.php @@ -5,10 +5,6 @@ 'Filename'=>['filename','filename'], 'Filesize'=>['filesize','filesize'], 'Dimensions'=>['height','dimensions'], - 'Duplicate'=>['duplicate','duplicatecheckbox'], - 'Flagged'=>['flag','flagcheckbox'], - 'Ignore Duplicate'=>['ignore','ignorecheckbox'], - 'Delete'=>['remove','removecheckbox'], ];?>
@@ -38,6 +34,19 @@ {!! $o->{$v[1]} !!} @endforeach + + + Flag + + + Duplicate + + + IGNORE Duplicate + + + Delete +
\ No newline at end of file diff --git a/resources/views/video/view.blade.php b/resources/views/video/view.blade.php index 2c236b6..4cf6462 100644 --- a/resources/views/video/view.blade.php +++ b/resources/views/video/view.blade.php @@ -31,6 +31,7 @@ @if($vo->duplicate)@endif @if($vo->ignore_duplicate)@endif @if($vo->remove)@endif + @if($po->flag)@endif
Signature
{{ $vo->signature(TRUE) }}
diff --git a/resources/views/video/widgets/thumbnail.blade.php b/resources/views/video/widgets/thumbnail.blade.php index 1515ee0..f476a5a 100644 --- a/resources/views/video/widgets/thumbnail.blade.php +++ b/resources/views/video/widgets/thumbnail.blade.php @@ -1,43 +1,52 @@ ['id','idlink'], 'Signature'=>['signature','signature'], 'File Signature'=>['file_signature','file_signature'], 'Date Created'=>['created','created'], 'Filename'=>['filename','filename'], 'Filesize'=>['filesize','filesize'], 'Dimensions'=>['height','dimensions'], - 'Length'=>['length','length'], - 'Duplicate'=>['duplicate','duplicatecheckbox'], - 'Flagged'=>['flag','flagcheckbox'], - 'Ignore Duplicate'=>['ignore','ignorecheckbox'], - 'Delete'=>['remove','removecheckbox'], ];?>
- #{{ $o->id }} - {{ \Illuminate\Support\Str::limit($o->filename,12).\Illuminate\Support\Str::substr($o->filename,-16) }} - {{ $o->created ? $o->created->toDateTimeString() : '-' }} [{{ $o->device() }}] + #{{ $o->id }} - {{ Str::limit($o->filename,12).Str::substr($o->filename,-16) }} + {{ $o->created ? $o->created->toDateTimeString() : '-' }} @if($o->device)[{{ $o->device }}]@else [No Device Info] @endif
- +
-
-
- {!! $o->getHtmlImageURL() !!} +
-
\ No newline at end of file