From: Vincent Vanwaelscappel Date: Thu, 23 Nov 2023 16:06:34 +0000 (+0100) Subject: wait #6487 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3105c682fb32b0b60bb5ed88ed1604b58694762b;p=fluidbook-toolbox.git wait #6487 @1.5 --- diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index a2eb7b09f..548cb9578 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -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) { diff --git a/app/Models/FluidbookCollection.php b/app/Models/FluidbookCollection.php index 048daf526..0763c07f8 100644 --- a/app/Models/FluidbookCollection.php +++ b/app/Models/FluidbookCollection.php @@ -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(); diff --git a/app/Models/FluidbookHealthIssues.php b/app/Models/FluidbookHealthIssues.php index f93fc726c..eebb80d97 100644 --- a/app/Models/FluidbookHealthIssues.php +++ b/app/Models/FluidbookHealthIssues.php @@ -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', + ], ]; diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index deb1615de..d1fae6073 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -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'); diff --git a/public/packages/fluidbook/toolbox/css/audit.css b/public/packages/fluidbook/toolbox/css/audit.css index 8ca7e2876..a695ee58d 100644 --- a/public/packages/fluidbook/toolbox/css/audit.css +++ b/public/packages/fluidbook/toolbox/css/audit.css @@ -9,7 +9,7 @@ h2 { color: #c00; } .la-exclamation-triangle { - color: #F74D07; + color: #f7a307; } .message { text-align: center; diff --git a/public/packages/fluidbook/toolbox/css/variables.less b/public/packages/fluidbook/toolbox/css/variables.less index f87c59c20..fbb720e8b 100644 --- a/public/packages/fluidbook/toolbox/css/variables.less +++ b/public/packages/fluidbook/toolbox/css/variables.less @@ -1,2 +1,2 @@ @error: #c00; -@warning: #F74D07; +@warning: #f7a307;