]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7868 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 10 Feb 2026 14:04:20 +0000 (15:04 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 10 Feb 2026 14:04:20 +0000 (15:04 +0100)
app/Http/Controllers/Admin/Operations/FluidbookCollection/AuditLinksOperation.php
app/Models/ShortLink.php
resources/views/columns/http_code.blade.php [new file with mode: 0644]

index affcef2b47ccae61ed1f50b73a1617ea7fffb5e3..60e64c1e1b47fa98af154a2ae1bc97c54fe89d78 100644 (file)
@@ -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;
index eb5c0b26a6981e5eaef9cec39748943d75e2c867..9d9e58ace199a9aa70ae4ed1fa691941f5786276 100644 (file)
@@ -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 (file)
index 0000000..b3c1dc0
--- /dev/null
@@ -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]))
+<abbr title="{{$messages[$value]}}">{{$value}}</abbr>
+@else
+{{$value}}
+@endif