]> _ Git - fluidbook-toolbox.git/commitdiff
wip #4216 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 May 2021 10:19:56 +0000 (12:19 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 May 2021 10:19:56 +0000 (12:19 +0200)
app/Console/Commands/WorkshopMigration.php
app/Models/FluidbookTheme.php
composer.json
composer.lock

index 44cd67b352fa220a6266805529200b9f2b241f54..3c04c27e7bdd95ebc6601e2016934cda7e74e315 100644 (file)
@@ -69,8 +69,7 @@ class WorkshopMigration extends CubistCommand
 
     protected function importThemes()
     {
-        $this->themeCompatTable();
-        return;
+
         $map = ['theme_id' => 'id',
             'nom' => 'name',
             'proprietaire' => 'owner',
@@ -116,6 +115,8 @@ class WorkshopMigration extends CubistCommand
             }
             $c->save();
         }
+        $this->themeCompatTable();
+
     }
 
     protected function _unserialize($str)
index 268e7611d7cd384ea878e07ae6ff7d10e1bdc24f..686ca67a3f02fa2619b16c8acf83b0fdcba57420 100644 (file)
@@ -19,6 +19,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         'plural' => 'themes'];
 
     protected static $_colorToWS2Cache = [];
+    protected static $_colorToWS3Cache = [];
     protected static $_colorAlphaToWS2Cache = [];
     protected $_oldRoot = '/home/extranet/www/fluidbook/';
 
@@ -590,9 +591,9 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'backgroundImage',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Image de fond'),
-
             'translatable' => false,
         ]);
         $this->addField([
@@ -606,7 +607,6 @@ class FluidbookTheme extends CubistMagicAbstractModel
             ],
             'label' => __('Affichage du fond'),
             'default' => 0,
-
             'translatable' => false,
         ]);
         $this->addField([
@@ -674,6 +674,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'menuImage',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Image de fond'),
             'translatable' => false,
@@ -703,6 +704,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'topBar',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Top Bar'),
             'translatable' => false,
@@ -724,6 +726,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'afterSearch',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Image supplémentaire'),
             'hint' => __('Image disposée à droite du champ de recherche'),
@@ -736,6 +739,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'logo',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Logo'),
             'translatable' => false,
@@ -752,6 +756,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'favicon',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Icone (pour favicon et CD-ROM)'),
             'hint' => __('Image PNG de 256x256'),
@@ -759,6 +764,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'iosicon',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Icone (pour application iOS)'),
             'hint' => __('Image PNG de 1024x1024'),
@@ -766,6 +772,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'androidicon',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Icone (pour application Android)'),
             'hint' => __('Image PNG de 1024x1024'),
@@ -805,6 +812,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
         ]);
         $this->addField([
             'name' => 'logoLoader',
+            'name_as_collection' => true,
             'type' => 'Images',
             'label' => __('Logo affiché au chargement'),
             'translatable' => false,
@@ -852,6 +860,7 @@ class FluidbookTheme extends CubistMagicAbstractModel
 
     public function updateWS2Table()
     {
+        return;
         $fileFields = [];
         $colorFields = [];
         $colorAlphaFields = [];
@@ -907,19 +916,24 @@ class FluidbookTheme extends CubistMagicAbstractModel
 
     public static function _colorToWS3($data)
     {
-        if (strlen($data) === 6) {
-            $data = '#' . $data;
-        } else if (strlen($data) === 8) {
-            $e = str_split($data, 2);
-            if ($e[0] === '00') {
-                $data = 'transparent';
-            } else if ($e[0] === 'ff') {
-                $data = '#' . $e[1] . $e[2] . $e[3];
-            } else {
-                $data = 'rgba(' . hexdec($e[1]) . ', ' . hexdec($e[2]) . ', ' . hexdec($e[3]) . ', ' . round(hexdec($e[0]) / 255, 2) . ')';
+        if (!isset(self::$_colorToWS3Cache[$data])) {
+            if (strlen($data) === 6) {
+                $res = '#' . $data;
+            } else if (strlen($data) === 8) {
+                $e = str_split($data, 2);
+                if ($e[0] === '00') {
+                    $res = 'transparent';
+                } else if ($e[0] === 'ff') {
+                    $res = '#' . $e[1] . $e[2] . $e[3];
+                } else {
+                    $res = 'rgba(' . hexdec($e[1]) . ', ' . hexdec($e[2]) . ', ' . hexdec($e[3]) . ', ' . round(hexdec($e[0]) / 255, 2) . ')';
+                }
+            }else{
+                $res=$data;
             }
+            self::$_colorToWS3Cache[$data] = $res;
         }
-        return $data;
+        return self::$_colorToWS3Cache[$data];
     }
 
     public static function _colorAlphaToWS2($data)
@@ -1053,11 +1067,10 @@ class FluidbookTheme extends CubistMagicAbstractModel
         if ($data) {
             $file = $oldRoot . $data;
             if (file_exists($file)) {
-
                 try {
                     $this->addMediaToField($field->getName(), $file, true);
                 } catch (\Exception $e) {
-                    echo $copy . "\n";
+                    echo 'error adding '.$file . "\n";
                 }
             }
         }
index d0f785c96446dc73772de8ad24a95c127fe6339f..aa8403692de48d19dec486ac0e6bdd4d5c585681 100644 (file)
     "license": "MIT",
     "require": {
         "php": ">=7.4",
+        "ext-json": "*",
         "ext-simplexml": "*",
         "ext-tidy": "*",
         "ext-zip": "*",
-        "ext-json": "*",
         "cubedesigners/userdatabase": "dev-master",
         "cubist/cms-back": "dev-master",
         "league/csv": "^9.6",
+        "php-ffmpeg/php-ffmpeg": "^0.18.0",
         "phpoffice/phpspreadsheet": "^1.15"
     },
     "require-dev": {
index 0bb43972d71d18d3d71871105a9df57734d3828f..9b4d0d5b0ca59236ae0b316d6260b3ef3be4af68 100644 (file)
@@ -4,8 +4,74 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "f3d61fdde3fd92f5d104e6de7521d7e5",
+    "content-hash": "5cee2fb0edb201579f55a04458ffea79",
     "packages": [
+        {
+            "name": "alchemy/binary-driver",
+            "version": "v5.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alchemy-fr/BinaryDriver.git",
+                "reference": "e0615cdff315e6b4b05ada67906df6262a020d22"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alchemy-fr/BinaryDriver/zipball/e0615cdff315e6b4b05ada67906df6262a020d22",
+                "reference": "e0615cdff315e6b4b05ada67906df6262a020d22",
+                "shasum": ""
+            },
+            "require": {
+                "evenement/evenement": "^3.0|^2.0|^1.0",
+                "php": ">=5.5",
+                "psr/log": "^1.0",
+                "symfony/process": "^2.3|^3.0|^4.0|^5.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.0|^5.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Alchemy": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Nicolas Le Goff",
+                    "email": "legoff.n@gmail.com"
+                },
+                {
+                    "name": "Romain Neutron",
+                    "email": "imprec@gmail.com",
+                    "homepage": "http://www.lickmychip.com/"
+                },
+                {
+                    "name": "Phraseanet Team",
+                    "email": "info@alchemy.fr",
+                    "homepage": "http://www.phraseanet.com/"
+                },
+                {
+                    "name": "Jens Hausdorf",
+                    "email": "mail@jens-hausdorf.de",
+                    "homepage": "https://jens-hausdorf.de",
+                    "role": "Maintainer"
+                }
+            ],
+            "description": "A set of tools to build binary drivers",
+            "keywords": [
+                "binary",
+                "driver"
+            ],
+            "support": {
+                "issues": "https://github.com/alchemy-fr/BinaryDriver/issues",
+                "source": "https://github.com/alchemy-fr/BinaryDriver/tree/master"
+            },
+            "time": "2020-02-12T19:35:11+00:00"
+        },
         {
             "name": "backpack/backupmanager",
             "version": "2.0.5",
             },
             "time": "2021-03-23T18:08:45+00:00"
         },
+        {
+            "name": "evenement/evenement",
+            "version": "v3.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/igorw/evenement.git",
+                "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
+                "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=7.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^6.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Evenement": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Igor Wiedler",
+                    "email": "igor@wiedler.ch"
+                }
+            ],
+            "description": "Événement is a very simple event dispatching library for PHP",
+            "keywords": [
+                "event-dispatcher",
+                "event-emitter"
+            ],
+            "support": {
+                "issues": "https://github.com/igorw/evenement/issues",
+                "source": "https://github.com/igorw/evenement/tree/master"
+            },
+            "time": "2017-07-23T21:35:13+00:00"
+        },
         {
             "name": "ezimuel/guzzlestreams",
             "version": "3.0.1",
             ],
             "time": "2021-04-13T21:54:02+00:00"
         },
+        {
+            "name": "neutron/temporary-filesystem",
+            "version": "3.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/romainneutron/Temporary-Filesystem.git",
+                "reference": "60e79adfd16f42f4b888e351ad49f9dcb959e3c2"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/romainneutron/Temporary-Filesystem/zipball/60e79adfd16f42f4b888e351ad49f9dcb959e3c2",
+                "reference": "60e79adfd16f42f4b888e351ad49f9dcb959e3c2",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.6",
+                "symfony/filesystem": "^2.3 || ^3.0 || ^4.0 || ^5.0"
+            },
+            "require-dev": {
+                "symfony/phpunit-bridge": "^5.0.4"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Neutron": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Romain Neutron",
+                    "email": "imprec@gmail.com"
+                }
+            ],
+            "description": "Symfony filesystem extension to handle temporary files",
+            "support": {
+                "issues": "https://github.com/romainneutron/Temporary-Filesystem/issues",
+                "source": "https://github.com/romainneutron/Temporary-Filesystem/tree/3.0"
+            },
+            "time": "2020-07-27T14:00:33+00:00"
+        },
         {
             "name": "nothingworks/blade-svg",
             "version": "v0.3.4",
             },
             "time": "2021-04-09T13:42:10+00:00"
         },
+        {
+            "name": "php-ffmpeg/php-ffmpeg",
+            "version": "v0.18.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/PHP-FFMpeg/PHP-FFMpeg.git",
+                "reference": "edc0a7729d8818ed883e77b3d26ceb6d49ec41de"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/PHP-FFMpeg/PHP-FFMpeg/zipball/edc0a7729d8818ed883e77b3d26ceb6d49ec41de",
+                "reference": "edc0a7729d8818ed883e77b3d26ceb6d49ec41de",
+                "shasum": ""
+            },
+            "require": {
+                "alchemy/binary-driver": "^1.5 || ~2.0.0 || ^5.0",
+                "doctrine/cache": "^1.0",
+                "evenement/evenement": "^3.0 || ^2.0 || ^1.0",
+                "neutron/temporary-filesystem": "^2.1.1 || ^3.0",
+                "php": ">=5.3.9"
+            },
+            "require-dev": {
+                "silex/silex": "~1.0",
+                "symfony/phpunit-bridge": "^5.0.4",
+                "symfony/process": "2.8 || 3.3"
+            },
+            "suggest": {
+                "php-ffmpeg/extras": "A compilation of common audio & video drivers for PHP-FFMpeg"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "FFMpeg": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Romain Neutron",
+                    "email": "imprec@gmail.com",
+                    "homepage": "http://www.lickmychip.com/"
+                },
+                {
+                    "name": "Phraseanet Team",
+                    "email": "info@alchemy.fr",
+                    "homepage": "http://www.phraseanet.com/"
+                },
+                {
+                    "name": "Patrik Karisch",
+                    "email": "patrik@karisch.guru",
+                    "homepage": "http://www.karisch.guru"
+                },
+                {
+                    "name": "Romain Biard",
+                    "email": "romain.biard@gmail.com",
+                    "homepage": "https://www.strime.io/"
+                },
+                {
+                    "name": "Jens Hausdorf",
+                    "email": "hello@jens-hausdorf.de",
+                    "homepage": "https://jens-hausdorf.de"
+                }
+            ],
+            "description": "FFMpeg PHP, an Object Oriented library to communicate with AVconv / ffmpeg",
+            "keywords": [
+                "audio",
+                "audio processing",
+                "avconv",
+                "avprobe",
+                "ffmpeg",
+                "ffprobe",
+                "video",
+                "video processing"
+            ],
+            "support": {
+                "issues": "https://github.com/PHP-FFMpeg/PHP-FFMpeg/issues",
+                "source": "https://github.com/PHP-FFMpeg/PHP-FFMpeg/tree/v0.18.0"
+            },
+            "time": "2021-03-29T20:20:00+00:00"
+        },
         {
             "name": "phpoffice/phpspreadsheet",
             "version": "1.17.1",
             ],
             "time": "2021-03-23T23:28:01+00:00"
         },
+        {
+            "name": "symfony/filesystem",
+            "version": "v5.2.7",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/filesystem.git",
+                "reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/filesystem/zipball/056e92acc21d977c37e6ea8e97374b2a6c8551b0",
+                "reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=7.2.5",
+                "symfony/polyfill-ctype": "~1.8"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\Filesystem\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Provides basic utilities for the filesystem",
+            "homepage": "https://symfony.com",
+            "support": {
+                "source": "https://github.com/symfony/filesystem/tree/v5.2.7"
+            },
+            "funding": [
+                {
+                    "url": "https://symfony.com/sponsor",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2021-04-01T10:42:13+00:00"
+        },
         {
             "name": "symfony/finder",
             "version": "v5.2.4",
             },
             "time": "2020-07-07T18:42:57+00:00"
         },
-        {
-            "name": "symfony/filesystem",
-            "version": "v5.2.7",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/filesystem.git",
-                "reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/filesystem/zipball/056e92acc21d977c37e6ea8e97374b2a6c8551b0",
-                "reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=7.2.5",
-                "symfony/polyfill-ctype": "~1.8"
-            },
-            "type": "library",
-            "autoload": {
-                "psr-4": {
-                    "Symfony\\Component\\Filesystem\\": ""
-                },
-                "exclude-from-classmap": [
-                    "/Tests/"
-                ]
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Fabien Potencier",
-                    "email": "fabien@symfony.com"
-                },
-                {
-                    "name": "Symfony Community",
-                    "homepage": "https://symfony.com/contributors"
-                }
-            ],
-            "description": "Provides basic utilities for the filesystem",
-            "homepage": "https://symfony.com",
-            "support": {
-                "source": "https://github.com/symfony/filesystem/tree/v5.2.7"
-            },
-            "funding": [
-                {
-                    "url": "https://symfony.com/sponsor",
-                    "type": "custom"
-                },
-                {
-                    "url": "https://github.com/fabpot",
-                    "type": "github"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
-                    "type": "tidelift"
-                }
-            ],
-            "time": "2021-04-01T10:42:13+00:00"
-        },
         {
             "name": "theseer/tokenizer",
             "version": "1.2.0",
     "prefer-lowest": false,
     "platform": {
         "php": ">=7.4",
+        "ext-json": "*",
         "ext-simplexml": "*",
         "ext-tidy": "*",
-        "ext-zip": "*",
-        "ext-json": "*"
+        "ext-zip": "*"
     },
     "platform-dev": [],
     "plugin-api-version": "2.0.0"