]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6487 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Nov 2023 16:06:34 +0000 (17:06 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Nov 2023 16:06:34 +0000 (17:06 +0100)
app/Fluidbook/Compiler/Compiler.php
app/Models/FluidbookCollection.php
app/Models/FluidbookHealthIssues.php
app/Models/FluidbookPublication.php
public/packages/fluidbook/toolbox/css/audit.css
public/packages/fluidbook/toolbox/css/variables.less

index a2eb7b09f807b2e1032c242091185c9e1a025354..548cb95784c206a0c30170cfa7a71ca9772b08e5 100644 (file)
@@ -551,6 +551,7 @@ class Compiler extends Base implements CompilerInterface
             $this->addContentLock($this->config->maxPages);
         }
 
+        $this->checkConfig();
         $this->checkPageLabels();
 
         // We need to be able to reference both navOrder and navOrderH so convert both to arrays
@@ -582,6 +583,13 @@ class Compiler extends Base implements CompilerInterface
 
     }
 
+    protected function checkConfig()
+    {
+        if ($this->isMobileFirst() && $this->fluidbookSettings->mobilefirstFluidbookId) {
+            FluidbookHealthIssues::addIssue($this->book_id, FluidbookHealthIssues::TYPE_MOBILEFIRST_CONFIG, ['mobilefirstId' =>  $this->fluidbookSettings->mobilefirstFluidbookId]);
+        }
+    }
+
 
     public function log($step)
     {
index 048daf5261e8568fc65c9447bc7f35127e92f219..0763c07f8145cb51943874d10ea420b231a76bc3 100644 (file)
@@ -120,10 +120,11 @@ class FluidbookCollection extends ToolboxStatusModel
         parent::setStatus($newStatus);
 
         foreach ($this->getPageData()->publications as $publication) {
+            /** @var FluidbookPublication $fb */
             $fb = FluidbookPublication::withoutGlobalScopes()->find($publication['fluidbook']);
-            $fb->setStatus($newStatus);
             $fb->setOwner($this->owner);
-            $fb->save();
+            $fb->setStatus($newStatus);
+            $fb->saveQuietlyWithoutFlushingCache();
         }
 
         RefreshUsersTree::dispatchSync();
@@ -135,8 +136,9 @@ class FluidbookCollection extends ToolboxStatusModel
 
         foreach ($this->getPageData()->publications as $publication) {
             $fb = FluidbookPublication::withoutGlobalScopes()->find($publication['fluidbook']);
+            $fb->setStatus($this->status);
             $fb->setOwner($owner);
-            $fb->save();
+            $fb->saveQuietlyWithoutFlushingCache();
         }
 
         RefreshUsersTree::dispatchSync();
index f93fc726c9e254eba124d916f4fc2bc5ffb901b9..eebb80d970928f87a4fce669eff3151c81cec78e 100644 (file)
@@ -13,6 +13,7 @@ class FluidbookHealthIssues extends ToolboxModel
 {
     const TYPE_MISSING_FILE = 1;
     const TYPE_QRCODE_NOT_READABLE = 2;
+    const TYPE_MOBILEFIRST_CONFIG = 3;
 
     const CRIT_ERROR = 5;
     const CRIT_WARNING = 3;
@@ -61,25 +62,34 @@ class FluidbookHealthIssues extends ToolboxModel
     protected static function getTypeData($fluidbookId)
     {
         /*
- * __('Le chemin ":path" est introuvable')
- * __('Le QRcode du lien :uid (page :page) n\'a pas pu être décodé')
+         * __('Le chemin ":path" est introuvable')
+         * __('Le QRcode du lien :uid (page :page) n\'a pas pu être décodé')
+         * __(''Ce fluidbook mobile first a le paramètre "Identifiant du fluidbook Mobile first" défini. Ce paramètre est réservé aux fluidbooks Desktop')
+         *
  */
         return [
             static::TYPE_MISSING_FILE =>
                 [
                     'summary' => __('Erreur 404'),
                     'criticality' => self::CRIT_ERROR,
-                    'text' => 'Le chemin ":path" est introuvable',
+                    'text' => __('Le chemin ":path" est introuvable'),
 
                 ],
             static::TYPE_QRCODE_NOT_READABLE =>
                 [
                     'summary' => __('QRcode illisible'),
                     'criticality' => self::CRIT_ERROR,
-                    'text' => 'Le QRcode du lien :uid (page :page) n\'a pas pu être décodé',
+                    'text' => __('Le QRcode du lien :uid (page :page) n\'a pas pu être décodé'),
                     'fixText' => __('Aller sur l\'éditeur de liens'),
                     'fixURL' => route('fluidbook_linkeditor', ['id' => $fluidbookId]) . '#:page',
                 ],
+            static::TYPE_MOBILEFIRST_CONFIG => [
+                'summary' => __('Configuration MobileFirst'),
+                'criticality' => self::CRIT_WARNING,
+                'text' => 'Ce fluidbook mobile first a le paramètre "Identifiant du fluidbook Mobile first" défini. Ce paramètre est réservé aux fluidbooks Desktop',
+                'fixText' => __('Editer la configuration'),
+                'fixURL' => route('fluidbook_linkeditor', ['id' => $fluidbookId]) . '#s_section_mobilefirst',
+            ],
         ];
 
 
index deb1615dee09f38b9bfe58adf81a95b03ea53354..d1fae6073b329c83aee56ee4f3f6705ef4215a61 100644 (file)
@@ -849,6 +849,42 @@ class FluidbookPublication extends ToolboxStatusModel
         $this->saveQuietly();
     }
 
+    public function getMobileFirstId()
+    {
+        if ($this->getSettings()->get('mobileNavigationType') === "mobilefirst") {
+            return false;
+        }
+        return $this->getSettings()->get('mobilefirstFluidbookId', false);
+    }
+
+    public function setStatus($newStatus)
+    {
+        parent::setStatus($newStatus);
+        $mfid = $this->getMobileFirstId();
+        if ($mfid) {
+            $mf = static::withoutGlobalScopes()->find($mfid);
+            if ($mf) {
+                $mf->setStatus($newStatus);
+                $mf->setOwner($this->owner);
+                $mf->saveQuietlyWithoutFlushingCache();
+            }
+        }
+    }
+
+    public function setOwner($owner)
+    {
+        parent::setOwner($owner);
+        $mfid = $this->getMobileFirstId();
+        if ($mfid) {
+            $mf = static::withoutGlobalScopes()->find($mfid);
+            if ($mf) {
+                $mf->setOwner($owner);
+                $mf->setStatus($this->status);
+                $mf->saveQuietlyWithoutFlushingCache();
+            }
+        }
+    }
+
     protected function _replicateMedia($newId)
     {
         static::copyAssets($this->id, $newId, 'link');
index 8ca7e2876f82a95dbf7719824377ee56c4a3e9e7..a695ee58d35e1a29a9c78d87d177aa0a497a7a8b 100644 (file)
@@ -9,7 +9,7 @@ h2 {
   color: #c00;
 }
 .la-exclamation-triangle {
-  color: #F74D07;
+  color: #f7a307;
 }
 .message {
   text-align: center;
index f87c59c2026aa87102e3962b34995e146d89b134..fbb720e8b14440f4ec9bf03bdeb6029b931127b1 100644 (file)
@@ -1,2 +1,2 @@
 @error: #c00;
-@warning: #F74D07;
+@warning: #f7a307;