]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5506 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 18:02:35 +0000 (20:02 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 18:02:35 +0000 (20:02 +0200)
15 files changed:
.docker/docker-compose.yml
.docker/update
app/Console/Commands/FluidbookDocumentProcess.php [new file with mode: 0644]
app/Console/Commands/WorkshopMigration.php
app/Jobs/FluidbookDocumentUpload.php
app/Jobs/LegacyBookSettingsGenerate.php
app/Models/FluidbookDocument.php
app/Models/FluidbookPublication.php
app/Models/ToolSVGSprite.php
app/Models/Traits/PublicationSettings.php
app/Util/FluidbookFarm.php
composer.json
composer.lock
resources/linkeditor/js/linkeditor.js
resources/views/fields/fluidbook_composition.blade.php

index 55853417a9ad87b7920cbf34c57920f19ac7692c..4e5df9534dc15d4bb85ad8515f6d2fb86fe19845 100644 (file)
@@ -23,6 +23,7 @@ services:
     container_name: fluidbook-toolbox
     build: /data1/extranet/toolbox/.docker/images/php
     working_dir: /application
+    hostname: fluidbook-toolbox
     environment:
       TZ: Europe/Paris
       HOME: /application
index 65d3c87bb71a08169be9833b2b4a0b2bb7d0bad1..b6971eda7b790f89660d6219a5fda47c55e53309 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/sh
 cd /docker/fluidbook-toolbox
 docker network create fluidbook-toolbox
-COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose pull
-COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose build
-docker-compose down
-docker-compose up -d
+COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose pull
+COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose build
+docker compose down
+docker compose up -d
 docker exec -it fluidbook-toolbox /application/scripts/update
diff --git a/app/Console/Commands/FluidbookDocumentProcess.php b/app/Console/Commands/FluidbookDocumentProcess.php
new file mode 100644 (file)
index 0000000..d4a5687
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Jobs\FluidbookCompiler;
+use App\Jobs\FluidbookDocumentUpload;
+use App\Models\FluidbookDocument;
+use App\Models\FluidbookPublication;
+use App\Models\User;
+use Cubist\Backpack\Console\Commands\CubistCommand;
+use Cubist\Util\PHP;
+use Cubist\Util\Str;
+
+class FluidbookDocumentProcess extends CubistCommand
+{
+    protected $signature = 'fluidbook:document:process {id}';
+    protected $description = 'Reprocess a fluidbook document';
+
+    /**
+     * @throws \Exception
+     */
+    public function handle()
+    {
+        PHP::neverStop(true);
+        $doc = FluidbookDocument::find($this->argument('id'));
+        $doc->clearAllFiles();
+        $user = User::withoutGlobalScope('ownerclause')->where('id', $doc->owner)->first();
+        FluidbookDocumentUpload::dispatchSync(Str::random(), $doc, $user);
+    }
+}
index 462daf14c54c8fc53f419069ab74aeb0e717c307..b02f0238be79eb11e61cf9c8986a322fd5c6f1c6 100644 (file)
@@ -35,7 +35,7 @@ class WorkshopMigration extends CubistCommand
         $actions = [
             //'Backup current database' => 'backup',
             'Migrate magic models' => 'migrate',
-            //'Import documents' => 'importDocuments',
+            'Import documents' => 'importDocuments',
             'Import publications' => 'importPublications',
             'Clean caches' => 'cleanCache'
         ];
@@ -58,18 +58,18 @@ class WorkshopMigration extends CubistCommand
 
     protected function migrate()
     {
-        $this->executeProcessQuiet('/usr/bin/php8.0 artisan cubist:magic:generate');
-        $this->executeProcessQuiet('/usr/bin/php8.0 artisan cubist:magic:migrate');
+        $this->executeProcessQuiet('php artisan cubist:magic:generate');
+        $this->executeProcessQuiet('php artisan cubist:magic:migrate');
     }
 
     protected function backup()
     {
-        $this->executeProcessQuiet('/usr/bin/php8.0 artisan backup:run');
+        $this->executeProcessQuiet('php artisan backup:run');
     }
 
     protected function cleanCache()
     {
-        $this->executeProcessQuiet('/usr/bin/php8.0 artisan optimize:clear');
+        $this->executeProcessQuiet('php artisan optimize:clear');
     }
 
     protected function importDocuments()
index 5aea092aa1ee34333af454a8cf7cedabfebe451a..a9ab125c0d3daf388b74f130dc6abc97cc32c9f0 100644 (file)
@@ -31,6 +31,7 @@ class FluidbookDocumentUpload extends Base
 
     public function handle()
     {
+
         FluidbookDocumentUpload::updateProgression($this->uploadID, __('Début du traitement du document'), 1.25);
         $this->document->processUpload($this->uploadID, $this->isSync());
     }
index 2878e290cf50f04e06d36b77d465bee14795efa3..9c4aba0d5c4209a18b820d6aad8bc7c836c71d5c 100644 (file)
@@ -65,7 +65,7 @@ class LegacyBookSettingsGenerate extends Base
 ### THIS FILE IS GENERATED BY THE FLUIDBOOK TOOLBOX ###
 ### Any manual change could be overriden
 ### Any change has to be done on the file app/Models/Traits/PublicationSettings.php (in Fluidbook Toolbox)
-### Then run /usr/bin/php8.0 artisan job:dispatchNow LegacyBookSettingsGenerate
+### Then run php artisan job:dispatchNow LegacyBookSettingsGenerate
 
 class wsBookParametres extends wsParametres
 {
index 655e7b6255620bff30dc6ccbccd79fbfd4a73920..7c4403d72af661ac84a73918120068f36e2af682 100644 (file)
@@ -12,6 +12,7 @@ use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\PDF\CommandLine\FWSTK;
 use Cubist\PDF\PDFTools;
 use Cubist\Util\Gzip;
+use Cubist\Util\Math;
 use Illuminate\Support\Facades\Cache;
 
 class FluidbookDocument extends ToolboxModel
@@ -23,6 +24,14 @@ class FluidbookDocument extends ToolboxModel
         'plural' => 'documents'];
     protected static $_permissionBase = 'fluidbook-document';
     protected $casts = ['bookmarks' => 'array', 'pdf_data' => 'array', 'file_data' => 'array'];
+
+    protected $manualcut = false;
+    protected $autocut = false;
+    protected $manualcrop = false;
+    protected $autocrop = false;
+
+    protected $processSync = true;
+
     const TEXT_PLAIN = 'p';
     const TEXT_INDEX = 'i';
     const TEXT_HTML = 'h';
@@ -50,17 +59,20 @@ class FluidbookDocument extends ToolboxModel
 
     public function processUpload($uploadID, $sync = false)
     {
-        FluidbookDocumentUpload::updateProgression($uploadID, __('Analyse du document'), 1.1);
-        $this->checkInfos();
-        FluidbookDocumentUpload::updateProgression($uploadID, __('Nettoyage du document'), 1.2);
+        $this->processSync = $sync;
+        $this->updateProgression($uploadID, __('Nettoyage du document'), 1.3);
         $this->fixPDF();
-        FluidbookDocumentUpload::updateProgression($uploadID, __('Découpe du document'), 1.3);
+        $this->updateProgression($uploadID, __('Découpe du document'), 1.4);
+        $this->cropAndCut();
+        $this->updateProgression($uploadID, __('Analyse du document'), 1.5);
+        $this->checkInfos(true);
+        $this->updateProgression($uploadID, __('Séparation des pages'), 1.6);
         $this->splitPDF();
-        FluidbookDocumentUpload::updateProgression($uploadID, __('Extraction des textes'), 1.75);
+        $this->updateProgression($uploadID, __('Extraction des textes'), 1.75);
         $this->extractTexts();
-        FluidbookDocumentUpload::updateProgression($uploadID, __('Extraction des liens'), 1.9);
+        $this->updateProgression($uploadID, __('Extraction des liens'), 1.9);
         $this->extractLinks();
-        FluidbookDocumentUpload::updateProgression($uploadID, __('Conversion des pages'), 2);
+        $this->updateProgression($uploadID, __('Conversion des pages'), 2);
         $jobs = [];
 
         $files = [
@@ -75,7 +87,7 @@ class FluidbookDocument extends ToolboxModel
         $delay = 0;
         for ($i = 1; $i <= $this->pages; $i++) {
             foreach ($files as $file) {
-                $job = new FluidbookDocumentFileProcess($this, $i, $file[0], $file[1], $file[2], $file[3]);
+                $job = new FluidbookDocumentFileProcess($this, $i, $file[0] ?? 'jpg', $file[1] ?? 150, $file[2] ?? true, $file[3] ?? true);
                 if ($sync) {
                     dispatch_sync($job);
                 } else {
@@ -97,21 +109,30 @@ class FluidbookDocument extends ToolboxModel
         }
     }
 
+    public function echoStatus($id)
+    {
+        if (!$this->processSync) {
+            return;
+        }
+        $p = FluidbookDocumentUpload::getProgression($id);
+        echo $p['progress'] . ' | ' . $p['message'] . "\n";
+    }
+
     public function extractTexts()
     {
-        PDFTools::extractTexts($this->path('original.pdf'), $this->path(), 'fluidbook', '');
-        PDFTools::extractHighlightsData($this->path('original.pdf'), $this->path());
+        PDFTools::extractTexts($this->getPDFSource(), $this->path(), 'fluidbook', '');
+        PDFTools::extractHighlightsData($this->getPDFSource(), $this->path());
     }
 
     public function extractLinks()
     {
-        PDFTools::extractLinks($this->path('original.pdf'), $this->path());
+        PDFTools::extractLinks($this->getPDFSource(), $this->path());
     }
 
     protected function _checkJobs($uploadID, $jobs, $nbfiles)
     {
+        $this->checkInfos();
         $nbjobs = $nbfiles * $this->pages;
-
         $done = 0;
         foreach ($jobs as $job) {
             /** @var $job FluidbookDocumentFileProcess */
@@ -121,9 +142,9 @@ class FluidbookDocument extends ToolboxModel
         }
         $progress = $done / $nbjobs;
         if ($progress === 1) {
-            FluidbookDocumentUpload::updateProgression($uploadID, __('Conversion terminée'), 3);
+            $this->updateProgression($uploadID, __('Conversion terminée'), 3);
         } else {
-            FluidbookDocumentUpload::updateProgression($uploadID, __('Conversion des pages (:done/:pages)', ['pages' => $this->pages, 'done' => round($done / $nbfiles)]), 2 + $progress);
+            $this->updateProgression($uploadID, __('Conversion des pages (:done/:pages)', ['pages' => $this->pages, 'done' => round($done / $nbfiles)]), 2 + $progress);
         }
         return $progress;
     }
@@ -134,34 +155,40 @@ class FluidbookDocument extends ToolboxModel
         return 620 / $this->pdf_data['size'][0];
     }
 
-    public function checkInfos()
+    public function checkInfos($force = false)
     {
-        if (null === $this->pdf_data) {
-            $infos = PDFTools::infos($this->path('original.pdf'));
-            $this->pages = $infos['pages'];
-            $this->pdf_data = $infos['infos'];
-            $this->bookmarks = $infos['bookmarks'];
+        if ($force || null === $this->pdf_data) {
+            $infos = $this->_getInfos();
+            $this->pages = $infos->pages;
+            $this->pdf_data = $infos->pdf_data;
+            $this->bookmarks = $infos->bookmarks;
             $this->saveWithoutFlushingCache();
         }
     }
 
+    protected function _getInfos($type = 'crop')
+    {
+        $res = new \stdClass();
+        $infos = PDFTools::infos($this->getPDFSource($type));
+        $res->pages = $infos['pages'];
+        $res->pdf_data = $infos['infos'];
+        $res->bookmarks = $infos['bookmarks'];
+        return $res;
+    }
+
     public function fixPDF()
     {
-        $fixed = $this->path('fixed.pdf');
-        $original = $this->path('original.pdf');
-        $crop = $this->path('crop.pdf');
+        $fixed = $this->getPDFSource('fixed');
+        $original = $this->getPDFSource('original');
         if (!file_exists($fixed) || filesize($fixed) === 0 || filemtime($fixed) < filemtime($original)) {
             PDFTools::fixPDF($original, $fixed);
         }
-        if (!file_exists($crop)) {
-            `ln -s $fixed $crop`;
-        }
         return $fixed;
     }
 
     public function splitPDF()
     {
-        PDFTools::split($this->fixPDF(), $this->path('pdf'));
+        PDFTools::split($this->getPDFSource(), $this->path('pdf'));
     }
 
     /**
@@ -307,7 +334,7 @@ class FluidbookDocument extends ToolboxModel
     {
         $path = $this->_getTextPath($page, $type, $extractionMethod, $ignoreSeparators);
         if (!$this->_checkTextFile($path)) {
-            PDFTools::extractTexts($this->path('original.pdf'), $this->path(), $extractionMethod, $ignoreSeparators);
+            PDFTools::extractTexts($this->getPDFSource(), $this->path(), $extractionMethod, $ignoreSeparators);
             if (!Gzip::file_exists($path)) {
                 throw new \Exception('An error occured while producing file ' . $path);
             }
@@ -324,7 +351,7 @@ class FluidbookDocument extends ToolboxModel
     {
         $path = $this->_getHightlightFilePath($page);
         if (!$this->_checkTextFile($path)) {
-            PDFTools::extractHighlightsData($this->path('original.pdf'), $this->path());
+            PDFTools::extractHighlightsData($this->getPDFSource(), $this->path());
             if (!Gzip::file_exists($path)) {
                 throw new \Exception('An error occured while producing file ' . $path);
             }
@@ -359,4 +386,148 @@ class FluidbookDocument extends ToolboxModel
         return $this->path($type . '.pdf');
     }
 
+    public function cutDocument($mode)
+    {
+        $fwstk = new FWSTK();
+        $fwstk->setArg('--input ' . $this->getPDFSource('fixed'));
+        $fwstk->setArg('--cut ' . $mode);
+        $fwstk->setArg('--output ' . $this->getPDFSource());
+        $fwstk->execute();
+    }
+
+    public function trimDocument()
+    {
+        $fwstk = new FWSTK();
+        $fwstk->setArg('--input ' . $this->getPDFSource('fixed'));
+        $fwstk->setArg('--trim');
+        $fwstk->setArg('--output ' . $this->getPDFSource());
+        $fwstk->execute();
+    }
+
+    public function lnCrop()
+    {
+        $root = $this->path();
+        `cd $root;ln -s fixed.pdf crop.pdf`;
+    }
+
+    protected function isCropped()
+    {
+        return $this->autocrop || $this->manualcrop || $this->autocut || $this->manualcut;
+    }
+
+    public function cropAndCut()
+    {
+        $infos = $this->_getInfos('fixed');
+
+        $this->detectSpreads($infos);
+        $this->detectPageDifferences($infos);
+
+        if (!$this->isCropped()) {
+            $this->lnCrop();
+            return false;
+        }
+        if ($this->autocut) {
+            $this->cutDocument($this->autocut);
+            return true;
+        }
+        if ($this->autocrop == 'trim') {
+            $this->trimDocument();
+        }
+        return false;
+    }
+
+    protected function detectPageDifferences($pagesInfos)
+    {
+        // Vérifie si la cropbox et la trimbox sont identiques pour toutes les pages
+        $difference = false;
+        foreach ($pagesInfos->pdf_data['page'] as $page => $infos) {
+            if (!isset($infos['crop']) || !isset($infos['crop'])) {
+                continue;
+            }
+            if ($infos['crop'] != $infos['trim']) {
+                $difference = true;
+            }
+        }
+        if (!$difference) {
+            return false;
+        }
+        // Vérifie si la trimbox définie toutes les pages de la même taille
+        $heights = array();
+        $widths = array();
+        foreach ($pagesInfos->pdf_data['page'] as $page => $infos) {
+            $heights[] = round($infos['trim']->height);
+            $widths[] = round($infos['trim']->width);
+        }
+        $heights = array_unique($heights);
+        $widths = array_unique($widths);
+        if (count($heights) == 1 && count($widths) == 1) {
+            $this->autocrop = 'trim';
+            $this->manualcrop = false;
+        } else {
+            $this->autocrop = false;
+            $this->manualcrop = true;
+        }
+    }
+
+    protected function detectSpreads($pagesInfos)
+    {
+        // Détection des spreads
+        $this->autocut = false;
+        $this->manualcut = false;
+        if ($pagesInfos->pages <= 2) {
+            return;
+        }
+
+        foreach ($pagesInfos->pdf_data['page'] as $page => $infos) {
+            if ($page == 1) {
+                $first = $infos['size'];
+            } elseif ($page == $pagesInfos->pages) {
+                $last = $infos['size'];
+            } elseif ($page == 2) {
+                $second = $infos['size'];
+            }
+        }
+
+        if ($first == $last && $last == $second) {
+            $ratio = $first[0] / $first[1];
+            $this->autocut = false;
+            if ($ratio <= 1) {
+                $this->manualcut = false;
+            } elseif ($ratio >= 6) {
+                $this->manualcut = 'L8';
+            } elseif ($ratio >= 3) {
+                $this->manualcut = 'L4';
+            } elseif ($ratio >= 2) {
+                $this->manualcut = 'L3';
+            } else {
+                $this->manualcut = '14-23';
+            }
+            return;
+        }
+        $this->manualcut = false;
+        if (self::compareSizes($last, $first) && Math::compare($first[0] * 2, $second[0], 0.9)) {
+            $this->autocut = '1-23-4';
+        }
+        if (Math::compare($first[0] * 2, $second[0], 0.9) && self::compareSizes($last, $second)) {
+            $this->autocut = '1-23';
+        }
+    }
+
+    public static function compareSizes($x, $y, $tolerance = 0.9)
+    {
+        return Math::compare($x[0], $y[0], $tolerance) && Math::compare($x[1], $y[1], $tolerance);
+    }
+
+    public function clearAllFiles()
+    {
+        $cmd = 'cd ' . $this->path() . ';find . ! -name \'original.pdf\' ! -name \'.\' ! -name \'..\' -exec rm -rf {} +';
+        `$cmd`;
+    }
+
+    protected function updateProgression($uploadID, $message, $progress)
+    {
+        FluidbookDocumentUpload::updateProgression($uploadID, $message, $progress);
+        $this->echoStatus($uploadID);
+    }
+
 }
index 6a6e0b147e861c1dae70086b614729a56407dc23..e9cf0c88a65c33229662925694431a177866b8f4 100644 (file)
@@ -71,6 +71,8 @@ class FluidbookPublication extends ToolboxSettingsModel
                 'column' => true,
                 'filter' => true,
                 'non_default_tracking' => false,
+                'allows_null' => false,
+                'default' => -1,
             ]
         );
 
@@ -240,6 +242,9 @@ class FluidbookPublication extends ToolboxSettingsModel
     {
         if (null === $this->_documentsSize) {
             $this->_documentsSize = [];
+            if (null === $this->composition) {
+                return $this->_documentsSize;
+            }
             foreach ($this->composition as $page => $data) {
                 if (isset($this->_documentsSize[$data[0]])) {
                     continue;
@@ -258,7 +263,8 @@ class FluidbookPublication extends ToolboxSettingsModel
     /**
      * @return int
      */
-    public function getPagesNumber() {
+    public function getPagesNumber()
+    {
         return count($this->composition);
     }
 
@@ -325,7 +331,7 @@ class FluidbookPublication extends ToolboxSettingsModel
 
     public function getLinksAndRulers(&$links, &$rulers)
     {
-        FluidbookLinks::getLinksAndRulers($this->id,$links,$rulers);
+        FluidbookLinks::getLinksAndRulers($this->id, $links, $rulers);
     }
 
 
index 59d386d6da1defdb26a8b0c5c5a657ae2f47d01c..83b544a3782ef9e4373111596be542b7e04f4db7 100644 (file)
@@ -6,6 +6,7 @@ use App\Http\Controllers\Admin\Operations\Tools\SVGSpriteDownload;
 use App\Models\Base\ToolboxModel;
 use App\SubForms\ToolSVGSpriteIcon;
 use Cubist\Backpack\Magic\Fields\BunchOfFieldsMultiple;
+use Cubist\Backpack\Magic\Fields\Checkbox;
 use Cubist\Backpack\Magic\Fields\Text;
 use Fluidbook\Tools\SVG\SVGTools;
 
@@ -29,6 +30,7 @@ class ToolSVGSprite extends ToolboxModel
 
         $this->addField('name', Text::class, __('Nom'), ['column' => true]);
         $this->addField('prefix', Text::class, __('Préfixe'), ['column' => true]);
+        $this->addField('convertColorsToCurrentColor', Checkbox::class, __('Convertir les couleurs en "currentColor"'), ['default' => true]);
         $this->addField('icons', BunchOfFieldsMultiple::class, __('Icônes'), ['bunch' => ToolSVGSpriteIcon::class, 'edit_label' => __('Edit :icon :name', ['name' => '%iconname', 'icon' => '<div class="icon">%svgcode</div>']), 'add_label' => __('Ajouter une icône')]);
     }
 
@@ -50,9 +52,11 @@ class ToolSVGSprite extends ToolboxModel
         foreach ($this->icons as $icon) {
             if (preg_match('/<svg(.*)viewBox="([^\"]+)"([^>]*)?>(.*)<\/svg>/ms', $icon['svgcode'], $matches)) {
                 $svg = $matches[4];
-                $svg = preg_replace('/#[0-9a-fA-F]{6}/', 'currentColor', $svg);
+                if ($this->convertColorsToCurrentColor) {
+                    $svg = preg_replace('/#[0-9a-fA-F]{6}/', 'currentColor', $svg);
+                }
                 $res .= '<symbol id="' . $this->prefix . $icon['iconname'] . '" viewBox="' . $matches[2] . '">' . $svg . '</symbol>';
-            }else{
+            } else {
                 dd($icon['svgcode']);
             }
         }
index 56ddd987bfc9570fe021f95523a432a73e5b362e..f673732e508b755191473f132d7056620adf92b4 100644 (file)
@@ -16,7 +16,6 @@ use Cubist\Backpack\Magic\Fields\LongText;
 use Cubist\Backpack\Magic\Fields\Number;
 use Cubist\Backpack\Magic\Fields\ReadOnlyValue;
 use Cubist\Backpack\Magic\Fields\SelectFromArray;
-use Cubist\Backpack\Magic\Fields\StaticValue;
 use Cubist\Backpack\Magic\Fields\Textarea;
 
 
@@ -437,6 +436,13 @@ trait PublicationSettings
             'translatable' => false,
         ]);
         $this->addField('', FormSeparator::class);
+        $this->addField('mobileReducedMargins', Checkbox::class, $this->__('Marges réduites sur mobile'), [
+            'v2' => '{"type":"boolean","default":0,"editable":true,"label":"\\u00a7!\\u00a7Marges réduites sur mobile!\\u00a7!","grade":3}',
+            'default' => false,
+            'fake' => true,
+            'store_in' => 'settings',
+            'translatable' => false,
+        ]);
         $this->addField('extraXSpace', Integer::class, $this->__('Marge supplémentaire horizontale'), [
             'v2' => '{"type":"integer","default":0,"editable":true,"label":"\\u00a7!\\u00a7Marge suppl\\u00e9mentaire horizontale!\\u00a7!","grade":3}',
             'default' => 0,
@@ -444,7 +450,7 @@ trait PublicationSettings
             'store_in' => 'settings',
             'translatable' => false,
         ]);
-        $this->addField('mobileExtraXSpace', Integer::class, $this->__('Marge supplémentaire horizontale'), [
+        $this->addField('mobileExtraXSpace', Integer::class, $this->__('Marge supplémentaire horizontale (Mobile)'), [
             'v2' => '{"type":"integer","default":0,"editable":true,"label":"\\u00a7!\\u00a7Marge suppl\\u00e9mentaire horizontale!\\u00a7!","grade":3}',
             'default' => 0,
             'fake' => true,
index d922062d0b4755133df7464997cf7d8c5109f35d..38765f958fce780e0a064e39534f23aacadfd09e 100644 (file)
@@ -17,7 +17,7 @@ class FluidbookFarm
         ['name' => 'godzilla', 'host' => 'godzilla.cubedesigners.com', 'weight' => 3],
         ['name' => 'dracula', 'host' => 'dracula.cubedesigners.com', 'weight' => 3],
         ['name' => 'her', 'host' => 'her2.cubedesigners.com', 'weight' => 4],
-        ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 6],
+        ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' =>6],
     ];
 
     protected static function _pingCache()
index 2856bc2e4b6956fab84b8581dfafb7bdbbb6ceec..80865ed8ec62de6559dde8231a7d50dba308a877 100644 (file)
@@ -38,6 +38,7 @@
         "cubist/pdf": "dev-master",
         "cubist/scorm": "dev-master",
         "fluidbook/tools": "dev-master",
+        "hollodotme/fast-cgi-client": "^3.1",
         "jolicode/slack-php-api": "^v4.5",
         "league/csv": "^9.8",
         "mxl/laravel-job": "^1.3",
index 2d126071b536eec8f8bbaf5c0fd5dcbbbdc82f46..2bbf9ca2845da50ccc7359c0296fbb141a2c483b 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "991377661ddf0ade008059ddae7f6a1f",
+    "content-hash": "3acc2c7a3b11e59ea58e6a1d34a3ad5f",
     "packages": [
         {
             "name": "ahmadshah/lucy",
             ],
             "time": "2022-06-20T21:43:03+00:00"
         },
+        {
+            "name": "hollodotme/fast-cgi-client",
+            "version": "v3.1.7",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/hollodotme/fast-cgi-client.git",
+                "reference": "062182d4eda73c161cc2839783acc83096ec0f37"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/hollodotme/fast-cgi-client/zipball/062182d4eda73c161cc2839783acc83096ec0f37",
+                "reference": "062182d4eda73c161cc2839783acc83096ec0f37",
+                "shasum": ""
+            },
+            "require": {
+                "ext-json": "*",
+                "php": ">=7.1"
+            },
+            "require-dev": {
+                "ext-xdebug": ">=2.6.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "hollodotme\\FastCGI\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Holger Woltersdorf",
+                    "email": "hw@hollo.me"
+                }
+            ],
+            "description": "A PHP fast CGI client to send requests (a)synchronously to PHP-FPM.",
+            "keywords": [
+                "Socket",
+                "async",
+                "fastcgi",
+                "php-fpm"
+            ],
+            "support": {
+                "issues": "https://github.com/hollodotme/fast-cgi-client/issues",
+                "source": "https://github.com/hollodotme/fast-cgi-client/tree/v3.1.7"
+            },
+            "time": "2021-12-07T10:10:20+00:00"
+        },
         {
             "name": "intervention/image",
             "version": "2.7.2",
         "php": ">=8.1",
         "ext-calendar": "*",
         "ext-dom": "*",
+        "ext-intl": "*",
         "ext-json": "*",
         "ext-libxml": "*",
         "ext-simplexml": "*",
index c9d632db470dfe2f54a99a8076e5bfa73e890e8d..1f6111bfda2198be731f3fbad870d75c3a9a9737 100644 (file)
@@ -69,7 +69,7 @@ LinkEditor.prototype = {
         $(window).on('keyup', function (e) {
             if (e.keyCode == 32) {
                 $this.zoom.resetZoomDrag();
-            }else if(e.keyCode==18){
+            } else if (e.keyCode == 18) {
                 $("#linkeditor-main").removeClass('duplicate');
                 return false;
             }
@@ -77,11 +77,10 @@ LinkEditor.prototype = {
         });
 
         $(document).on('mousedown', "#linkeditor-main", function (e) {
-            if (key.alt) {
+            if ($(this).hasClass('duplicate')) {
                 $this.links.duplicateLinkClick();
                 return;
-            }
-            if ($(this).hasClass('grab') && $this.zoom.zoom > 1) {
+            } else if ($(this).hasClass('grab') && $this.zoom.zoom > 1) {
                 $this.zoomdragging = {
                     x: e.pageX,
                     y: e.pageY,
index f14beb0c277a46ab3114d07c45eec784df099b3f..dabbafd4b253e970e462ae80d56c4efd1c42493c 100644 (file)
@@ -9,11 +9,18 @@
                 var selected = [];
 
                 function initPages() {
-                    var data = JSON.parse($("#compositionField").val());
-                    var numbers = $('input[name="page_numbers"]').val().split(',');
-                    var sizes = $("#compositionField").data('doc-sizes');
-                    var vectors = parseRange($('input[name="vectorPages"]').val());
-                    var rasters = parseRange($('input[name="rasterizePages"]').val());
+                    var data=[];
+                    var numbers=[];
+                    var sizes=[];
+                    var vectors=[];
+                    var rasters=[];
+                    if($("#compositionField").val()!=='') {
+                        data = JSON.parse($("#compositionField").val());
+                        numbers = $('input[name="page_numbers"]').val().split(',');
+                        sizes = $("#compositionField").data('doc-sizes');
+                        vectors = parseRange($('input[name="vectorPages"]').val());
+                        rasters = parseRange($('input[name="rasterizePages"]').val());
+                    }
 
                     $.each(data, function (pageNr, page) {
                         pageNr = parseInt(pageNr);