From: Vincent Vanwaelscappel Date: Tue, 10 Feb 2026 14:04:20 +0000 (+0100) Subject: wip #7868 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=964b1b362a0f66f6efd7d6b40620e94afca89eb4;p=fluidbook-toolbox.git wip #7868 @3 --- diff --git a/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php index affcef2b4..60e64c1e1 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php @@ -251,15 +251,9 @@ trait AuditLinksOperation return response()->download($tmpfile, $filename)->deleteFileAfterSend(); } - /** - * @param $sheet Worksheet - * @param $links array - * @param $columns array - * @return void - */ - protected function _setDataInSheet($sheet, $links, $columns) + public static function getCodesMessages() { - $codes = [ + return [ 200 => __('Everything is fine'), 301 => __('Permanent redirection: the page has definitively moved, please update the url; the former URL may not be valid indefinitely'), 308 => __('Permanent redirection: the page has definitively moved, please update the url; the former URL may not be valid indefinitely'), @@ -281,6 +275,17 @@ trait AuditLinksOperation 696 => __('There is a problem with the SSL certificate. The auditing tool could not check if the URL is valid or not. Please check manually'), 697 => __('There is a problem with the SSL certificate. The auditing tool could not check if the URL is valid or not. Please check manually'), ]; + } + + /** + * @param $sheet Worksheet + * @param $links array + * @param $columns array + * @return void + */ + protected function _setDataInSheet($sheet, $links, $columns) + { + $codes = self::getCodesMessages(); $row = 1; $col = 1; diff --git a/app/Models/ShortLink.php b/app/Models/ShortLink.php index eb5c0b26a..9d9e58ace 100644 --- a/app/Models/ShortLink.php +++ b/app/Models/ShortLink.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Models\Base\ToolboxModel; +use Cubist\Backpack\CubistBackpackServiceProvider; use Cubist\Backpack\Magic\Fields\Hidden; use Cubist\Backpack\Magic\Fields\Integer; use Cubist\Backpack\Magic\Fields\SelectFromArray; @@ -41,12 +42,12 @@ class ShortLink extends ToolboxModel $this->addField('server', SelectFromArray::class, __('Serveur'), ['type' => 'hidden', 'options' => LinkShortener::getAvaiableShorteners()]); $this->addField('url', URL::class, __('URL'), ['column' => true]); - $this->addField('shortlink', URL::class, __('URL courte'), ['type' => 'hidden_visible', 'column' => 'url', 'database_unique' => true]); - $this->addField('http_code', Integer::class, __('Code HTTP'), ['type' => 'hidden_visible', 'column' => true]); + $this->addField('shortlink', URL::class, __('URL courte'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url', 'database_unique' => true]); + $this->addField('http_code', Integer::class, __('Code HTTP'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'http_code', 'column_view_namespace' => 'columns',]); $this->addField('code_date', \Cubist\Backpack\Magic\Fields\Datetime::class, __('Code observé le'), ['type' => 'hidden_visible', 'column' => true]); - $this->addField('target_code', Integer::class, __('Code final'), ['type' => 'hidden_visible', 'column' => true]); - $this->addField('target_url', URL::class, __('URL finale'), ['type' => 'hidden_visible', 'column' => true]); - $this->addField('fluidbook_links', Textarea::class, __('Présence dans les fluidbooks'), ['type' => 'hidden_visible', 'column' => true]); + $this->addField('target_code', Integer::class, __('Code final'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'http_code', 'column_view_namespace' => 'columns']); + $this->addField('target_url', URL::class, __('URL finale'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url']); + $this->addField('fluidbook_links', Textarea::class, __('Présence dans les fluidbooks'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'shortlinks_fluidbooks','column_view_namespace'=>'columns']); $this->addOwnerField(['column' => false, 'type' => Hidden::class]); } @@ -84,7 +85,7 @@ class ShortLink extends ToolboxModel } else { continue; } - $d['fluidbook_links']=json_encode($d['fluidbook_links']); + $d['fluidbook_links'] = json_encode($d['fluidbook_links']); $data[$d['id']] = $d; } } diff --git a/resources/views/columns/http_code.blade.php b/resources/views/columns/http_code.blade.php new file mode 100644 index 000000000..b3c1dc06b --- /dev/null +++ b/resources/views/columns/http_code.blade.php @@ -0,0 +1,12 @@ +{{-- regular object attribute --}} +@php + $value = data_get($entry, $column['name']); + $value = is_array($value) ? json_encode($value) : $value; + $messages=\App\Http\Controllers\Admin\Operations\FluidbookCollection\AuditLinksOperation::getCodesMessages(); +@endphp + +@if(isset($messages[$value])) +{{$value}} +@else +{{$value}} +@endif