]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5468 @12
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 Dec 2022 17:44:30 +0000 (18:44 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 Dec 2022 17:44:30 +0000 (18:44 +0100)
18 files changed:
.docker/docker-compose.yml
app/Console/Commands/WorkshopMigration.php
app/Jobs/Tools/FluidbookAssetsDownloader.php
app/Models/FluidbookDocument.php
app/Models/FluidbookPublication.php
package-lock.json
package.json
public/images/linkeditor/dots-animated.svg [new file with mode: 0644]
public/images/linkeditor/dots-dark-animated.svg [new file with mode: 0644]
public/images/linkeditor/dots-dark.svg [new file with mode: 0644]
public/images/linkeditor/dots.svg [new file with mode: 0644]
resources/linkeditor/js/form.js [deleted file]
resources/linkeditor/js/linkeditor.form.js
resources/linkeditor/js/linkeditor.js
resources/linkeditor/style/form.sass
resources/linkeditor/webpack.mix.js
resources/views/fluidbook_publication/link_editor.blade.php
resources/views/layouts/linkeditor.blade.php

index 055e8f3971411923ea0d581e92bb3ba484abdd8d..8ee1e713240eb7c72212749ea6b9256eaaa0aa73 100644 (file)
@@ -14,7 +14,8 @@ services:
       - '/home/toolbox/www/storage/app/public/:/application/public/storage/'
       - '/home/toolbox/www/.docker/config/php.ini:/etc/php/8.1/fpm/conf.d/99-overrides.ini'
       - '/home/toolbox/www/.docker/config/cron/crontab:/etc/crontab'
-      - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbook/docs/'
+      - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbookpublication/docs/'
+      - '/data/extranet/www/fluidbook/books/working/:/application/protected/fluidbookpublication/working/'
       - '/home/extranet:/home/extranet'
       - '/data/extranet:/data/extranet'
     ports:
@@ -55,7 +56,8 @@ services:
       - '/home/toolbox/www/storage/app/public/:/application/public/storage/'
       - '/home/toolbox/www/.docker/config/php.ini:/etc/php/8.1/fpm/conf.d/99-overrides.ini'
       - '/home/toolbox/www/.docker/config/cron/crontab:/etc/crontab'
-      - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbook/docs/'
+      - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbookpublication/docs/'
+      - '/data/extranet/www/fluidbook/books/working/:/application/protected/fluidbookpublication/working/'
       - '/home/extranet:/home/extranet'
       - '/data/extranet:/data/extranet'
     tmpfs:
index b02f0238be79eb11e61cf9c8986a322fd5c6f1c6..7da8eef26444cfe25f0749460d1f703a0593f947 100644 (file)
@@ -190,7 +190,6 @@ class WorkshopMigration extends CubistCommand
 
         foreach ($q->get() as $e) {
             $this->line('Import ' . $e->book_id);
-            $oldRoot = $this->_oldRoot . 'books/working/' . $e->book_id . '/';
             $c = new FluidbookPublication();
             $c->setIncrementing(false);
             $c->id = $e->book_id;
index 53596fc26e98fc070deb64a3f2f3a73234b3f2b8..2454cc38892bfd9eae07d5d46295e3c1077bd7a4 100644 (file)
@@ -24,7 +24,7 @@ class FluidbookAssetsDownloader extends Base
             throw new \Exception('Fluidbook has not be set');
         }
         $this->setJobName(__('TĂ©lĂ©chargement massif d\'assets dans un fluidbook'));
-        $this->dest = '/home/extranet/www/fluidbook/books/working/' . $fluidbook . '/';
+        $this->dest = '/application/protected/fluidbookpublication/working/' . $fluidbook . '/';
         if ($folder !== 'working') {
             $this->dest .= $folder . '/';
         }
index 442845c0fd1d8addca57d6b1dfcba91c199cab1c..ded006f17778629005d5b91c115bf0205f5702b0 100644 (file)
@@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Cache;
 
 class FluidbookDocument extends ToolboxModel
 {
-    public const WS_DOCS = '/application/protected/fluidbook/docs/';
+    public const WS_DOCS = '/application/protected/fluidbookpublication/docs/';
     protected $table = 'fluidbook_document';
     protected $_options = ['name' => 'fluidbook-document',
         'singular' => 'document',
index 0519c9e9c4a6f48a83c6cb315cdd78cf2d643a87..9cba16bce234a7ace61c41ebd1abc0cd3fcc65ec 100644 (file)
@@ -183,7 +183,7 @@ class FluidbookPublication extends ToolboxSettingsModel
      */
     protected function _getFreeFileBaseDirectory()
     {
-        return '/data/extranet/www/fluidbook/books/working/' . $this->id;
+        return '/application/protected/fluidbookpublication/working/' . $this->id;
     }
 
     /**
@@ -320,7 +320,7 @@ class FluidbookPublication extends ToolboxSettingsModel
 
     public function getAssetDir()
     {
-        return Files::mkdir('/data/extranet/www/fluidbook/books/working/' . $this->id);
+        return Files::mkdir('/application/protected/fluidbookpublication/working/' . $this->id);
     }
 
     public function getCompositionUpdate(): int
index 895aff9e18ef36b2cb0966afddd26b08e3147c7e..a2037b847bbe850bd4f38b371c2f7b04a95aa2ce 100644 (file)
@@ -9,8 +9,8 @@
                 "codemirror": "^5",
                 "command-line-args": "^5.2.1",
                 "jquery-contextmenu": "^2.9.2",
+                "jquery-form": "^4.3.0",
                 "jquery.scrollto": "^2.1.3",
-                "keymaster": "^1.6.2",
                 "keymaster-reloaded": "^1.7.2",
                 "lz4js": "^0.2.0",
                 "noty": "^3.2.0-beta-deprecated",
@@ -21,6 +21,7 @@
                 "puppeteer": "^17.0.0",
                 "select2": "^4.1.0-rc.0",
                 "select2-bootstrap-theme": "^0.1.0-beta.10",
+                "spectrum-colorpicker": "^1.8.1",
                 "tippy.js": "^6.3.7"
             },
             "devDependencies": {
                 "jquery": ">=1.8.2"
             }
         },
+        "node_modules/jquery-form": {
+            "version": "4.3.0",
+            "resolved": "https://registry.npmjs.org/jquery-form/-/jquery-form-4.3.0.tgz",
+            "integrity": "sha512-q3uaVCEWdLOYUCI6dpNdwf/7cJFOsUgdpq6r0taxtGQ5NJSkOzofyWm4jpOuJ5YxdmL1FI5QR+q+HB63HHLGnQ==",
+            "dependencies": {
+                "jquery": ">=1.7.2"
+            }
+        },
         "node_modules/jquery.scrollto": {
             "version": "2.1.3",
             "resolved": "https://registry.npmjs.org/jquery.scrollto/-/jquery.scrollto-2.1.3.tgz",
                 "graceful-fs": "^4.1.6"
             }
         },
-        "node_modules/keymaster": {
-            "version": "1.6.2",
-            "resolved": "https://registry.npmjs.org/keymaster/-/keymaster-1.6.2.tgz",
-            "integrity": "sha512-OvA/AALN8IDKKkTk2Z+bDrzs/SQao4lo/QPbwSdDvm+frxfiYiYCSn1aHFUypJY3SruAO1y/c771agBmTXqUtg=="
-        },
         "node_modules/keymaster-reloaded": {
             "version": "1.7.2",
             "resolved": "https://registry.npmjs.org/keymaster-reloaded/-/keymaster-reloaded-1.7.2.tgz",
             "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
             "dev": true
         },
+        "node_modules/spectrum-colorpicker": {
+            "version": "1.8.1",
+            "resolved": "https://registry.npmjs.org/spectrum-colorpicker/-/spectrum-colorpicker-1.8.1.tgz",
+            "integrity": "sha512-x1picQ5giVso71ESII7jZ3+ZFdit8WthNkzwJqLNdPDPzrltKUQGpTohWyPfSAID+bK1zGdO6bDbSh1S6GoLYA=="
+        },
         "node_modules/split-string": {
             "version": "3.1.0",
             "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
                 "jquery": "^3.5.0"
             }
         },
+        "jquery-form": {
+            "version": "4.3.0",
+            "resolved": "https://registry.npmjs.org/jquery-form/-/jquery-form-4.3.0.tgz",
+            "integrity": "sha512-q3uaVCEWdLOYUCI6dpNdwf/7cJFOsUgdpq6r0taxtGQ5NJSkOzofyWm4jpOuJ5YxdmL1FI5QR+q+HB63HHLGnQ==",
+            "requires": {
+                "jquery": ">=1.7.2"
+            }
+        },
         "jquery.scrollto": {
             "version": "2.1.3",
             "resolved": "https://registry.npmjs.org/jquery.scrollto/-/jquery.scrollto-2.1.3.tgz",
                 "graceful-fs": "^4.1.6"
             }
         },
-        "keymaster": {
-            "version": "1.6.2",
-            "resolved": "https://registry.npmjs.org/keymaster/-/keymaster-1.6.2.tgz",
-            "integrity": "sha512-OvA/AALN8IDKKkTk2Z+bDrzs/SQao4lo/QPbwSdDvm+frxfiYiYCSn1aHFUypJY3SruAO1y/c771agBmTXqUtg=="
-        },
         "keymaster-reloaded": {
             "version": "1.7.2",
             "resolved": "https://registry.npmjs.org/keymaster-reloaded/-/keymaster-reloaded-1.7.2.tgz",
                 }
             }
         },
+        "spectrum-colorpicker": {
+            "version": "1.8.1",
+            "resolved": "https://registry.npmjs.org/spectrum-colorpicker/-/spectrum-colorpicker-1.8.1.tgz",
+            "integrity": "sha512-x1picQ5giVso71ESII7jZ3+ZFdit8WthNkzwJqLNdPDPzrltKUQGpTohWyPfSAID+bK1zGdO6bDbSh1S6GoLYA=="
+        },
         "split-string": {
             "version": "3.1.0",
             "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
index f9040b15b0f059317553fe0d4f2e7fc8b25e0585..12597d54d20ffc658432a2d38631d8ae20bef97c 100644 (file)
@@ -47,6 +47,7 @@
         "codemirror": "^5",
         "command-line-args": "^5.2.1",
         "jquery-contextmenu": "^2.9.2",
+        "jquery-form": "^4.3.0",
         "jquery.scrollto": "^2.1.3",
         "keymaster-reloaded": "^1.7.2",
         "lz4js": "^0.2.0",
@@ -58,6 +59,7 @@
         "puppeteer": "^17.0.0",
         "select2": "^4.1.0-rc.0",
         "select2-bootstrap-theme": "^0.1.0-beta.10",
+        "spectrum-colorpicker": "^1.8.1",
         "tippy.js": "^6.3.7"
     }
 }
diff --git a/public/images/linkeditor/dots-animated.svg b/public/images/linkeditor/dots-animated.svg
new file mode 100644 (file)
index 0000000..590de1a
--- /dev/null
@@ -0,0 +1,30 @@
+<svg version="1.1" id="L5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+     viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
+  <circle fill="#111" stroke="none" cx="6" cy="50" r="6">
+    <animateTransform
+        attributeName="transform"
+        dur="1s"
+        type="translate"
+        values="0 15 ; 0 -15; 0 15"
+        repeatCount="indefinite"
+        begin="0.1"/>
+  </circle>
+    <circle fill="#111" stroke="none" cx="30" cy="50" r="6">
+    <animateTransform
+        attributeName="transform"
+        dur="1s"
+        type="translate"
+        values="0 10 ; 0 -10; 0 10"
+        repeatCount="indefinite"
+        begin="0.2"/>
+  </circle>
+    <circle fill="#111" stroke="none" cx="54" cy="50" r="6">
+    <animateTransform
+        attributeName="transform"
+        dur="1s"
+        type="translate"
+        values="0 5 ; 0 -5; 0 5"
+        repeatCount="indefinite"
+        begin="0.3"/>
+  </circle>
+</svg>
diff --git a/public/images/linkeditor/dots-dark-animated.svg b/public/images/linkeditor/dots-dark-animated.svg
new file mode 100644 (file)
index 0000000..08f4c8d
--- /dev/null
@@ -0,0 +1,30 @@
+<svg version="1.1" id="L5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+     viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
+  <circle fill="#eee" stroke="none" cx="6" cy="50" r="6">
+    <animateTransform
+        attributeName="transform"
+        dur="1s"
+        type="translate"
+        values="0 15 ; 0 -15; 0 15"
+        repeatCount="indefinite"
+        begin="0.1"/>
+  </circle>
+    <circle fill="#eee" stroke="none" cx="30" cy="50" r="6">
+    <animateTransform
+        attributeName="transform"
+        dur="1s"
+        type="translate"
+        values="0 10 ; 0 -10; 0 10"
+        repeatCount="indefinite"
+        begin="0.2"/>
+  </circle>
+    <circle fill="#eee" stroke="none" cx="54" cy="50" r="6">
+    <animateTransform
+        attributeName="transform"
+        dur="1s"
+        type="translate"
+        values="0 5 ; 0 -5; 0 5"
+        repeatCount="indefinite"
+        begin="0.3"/>
+  </circle>
+</svg>
diff --git a/public/images/linkeditor/dots-dark.svg b/public/images/linkeditor/dots-dark.svg
new file mode 100644 (file)
index 0000000..d41b0c9
--- /dev/null
@@ -0,0 +1,9 @@
+<svg version="1.1" id="L5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+     viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
+  <circle fill="#eee" stroke="none" cx="6" cy="50" r="6">
+  </circle>
+    <circle fill="#eee" stroke="none" cx="30" cy="50" r="6">
+  </circle>
+    <circle fill="#eee" stroke="none" cx="54" cy="50" r="6">
+  </circle>
+</svg>
diff --git a/public/images/linkeditor/dots.svg b/public/images/linkeditor/dots.svg
new file mode 100644 (file)
index 0000000..a1f1a17
--- /dev/null
@@ -0,0 +1,9 @@
+<svg version="1.1" id="L5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+     viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
+  <circle fill="#111" stroke="none" cx="6" cy="50" r="6">
+  </circle>
+    <circle fill="#111" stroke="none" cx="30" cy="50" r="6">
+  </circle>
+    <circle fill="#111" stroke="none" cx="54" cy="50" r="6">
+  </circle>
+</svg>
diff --git a/resources/linkeditor/js/form.js b/resources/linkeditor/js/form.js
deleted file mode 100644 (file)
index 326ef62..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-window.$ = window.jQuery = require('jquery');
-window.key = require('keymaster-reloaded');
index 6672fcbcfbf17f0227b9b42c7a1eeb36d807d6f6..463d337abb48c61642726bfb827d941ff9b4ad6c 100644 (file)
@@ -21,8 +21,33 @@ LinkeditorForm.prototype = {
             if ($this._maskChangeEvent) {
                 return;
             }
+
             $this.saveFormDataInLink();
         });
+
+
+        $(document).on('change', ".freefile-file-input", function () {
+            var form = $('#linkupload').clone();
+
+
+            var id = 'linkupload_' + Math.round(Math.random() * 10000000);
+            $(form).attr('id', id);
+            $(this).attr('form', id);
+            $('body').append(form);
+
+            var parent = $(this).closest('.freefile-file');
+            $(parent).addClass('loading');
+            var f = $(form).ajaxSubmit({dataType: 'json'});
+            var xhr = f.data('jqxhr');
+            xhr.done(function (data) {
+                var tf = $(parent).find('.freefile-text-input');
+                tf.val(data[0]);
+                tf.trigger('change');
+                $(parent).removeClass('loading');
+            });
+        });
+
+
     },
 
     saveFormDataInLink: function () {
@@ -91,6 +116,7 @@ LinkeditorForm.prototype = {
         container.append(form);
 
         this.initSelect2();
+        this.initSpectrum();
     },
 
     updateFormData: function (form) {
@@ -167,5 +193,29 @@ LinkeditorForm.prototype = {
         });
     },
 
+    initSpectrum: function () {
+        $("#linkeditor-panel-form .spectrum:not(.init)").each(function () {
+            var t=$(this);
+            $(this).spectrum({
+                preferredFormat: 'hex3',
+                showAlpha: true,
+                allowEmpty: false,
+                showInput: true,
+                showInitial: true,
+                showButtons:false,
+                flat: true,
+                move:function(color){
+                    t.val(color.toString());
+                    $(t).trigger('change');
+                },
+                dragend:function(color){
+                    t.val(color.toString());
+                    $(t).trigger('change');
+                }
+            });
+            $(this).addClass('init');
+        });
+    }
+
 };
 module.exports = LinkeditorForm;
index 229b8f78e02153ef79d4b141e5ab798b54e4f099..f3d9e12ef68a75dc945f09155fb663a0157bc9dc 100644 (file)
@@ -33,6 +33,9 @@ window.key.filter = function (event) {
 
 require('jquery.scrollto');
 require('jquery-contextmenu');
+require('jquery-form');
+require('spectrum-colorpicker');
+import 'spectrum-colorpicker/spectrum.css';
 
 require('select2');
 import 'select2/dist/css/select2.css';
index 507dc2be37e23a1f600d44d5c0a2cb01c9a6bd7c..e8f7147008174fe8c3dbb5d951eb2174681e8ecf 100644 (file)
@@ -4,7 +4,6 @@
 #linkeditor-form-templates
     display: none
 
-
 .linkeditor-linktype
     &::before
         display: inline-block
 
     .freefile-file
         position: relative
+        &.loading
+            &::after
+                background-image: url("/images/linkeditor/dots-animated.svg")
+                @media (prefers-color-scheme: dark)
+                    background-image: url("/images/linkeditor/dots-dark-animated.svg")
+            input
+                pointer-events: none
+                cursor: wait
+
         &::after
-            content: "..."
+            content: ""
             position: absolute
             display: block
             padding: 6px
             right: 0
-            top: -3px
-            width: 34px
-            height: 34px
+            top: 6px
+            width: 25px
+            height: 25px
+            background-image: url("/images/linkeditor/dots.svg")
             color: var(--field-color)
             box-sizing: border-box
             pointer-events: none
             font-size: 17px
+            @media (prefers-color-scheme: dark)
+                background-image: url("/images/linkeditor/dots-dark.svg")
 
         input[type=file]
             position: absolute
             height: 100%
             cursor: pointer
 
+
     .input-group
         position: relative
         .input-group-append
index 423b5efba51a33883f9158828a540d8caf0150f0..8088c54998bdcee35f309294d95a40fecc842a68 100644 (file)
@@ -1,4 +1,3 @@
 const mix = require("laravel-mix");
-
 mix.setPublicPath('public/packages/linkeditor').js('resources/linkeditor/js/linkeditor.js', 'js')
     .sass('resources/linkeditor/style/style.sass', 'css').options({processCssUrls: false}).version();
index e6e51a3efa1edf3ff8aa5e7876f0938a0dae25ec..22a87ba7aeb67f78aaffebadc00700a4f644d07c 100644 (file)
     ];
 
     $rulers=!count($rulers)?'{}':json_encode($rulers);
+
+    if(can('fluidbook-publication:links:edit-animations')){
+        $links=\Fluidbook\Tools\Links\Link::decryptLinks($links);
+    }
     $links=!count($links)?'{}':json_encode($links);
     /** @var \App\Models\User $user */
     $user=backpack_user();
             @endphp
         @endforeach
     </div>
+    <form id="linkupload" class="filesorurlupload" action="{{backpack_url('filesorurlupload')}}" method="post"
+          enctype="multipart/form-data">
+        <input type="hidden" name="entity" value="{{ \App\Models\FluidbookPublication::class}}">
+        <input type="hidden" name="entry_id" value="{{ $id }}">
+        <input type="hidden" name="attribute" value="linksAssets">
+    </form>
 @endsection
 
 @push('linkeditor_scripts')
index f2ba37aacc0add0a3d21b9cf790c6f6cb28195d3..c3fb87f71beda87471fc61e786ecfc0b2fe083d9 100644 (file)
@@ -21,5 +21,6 @@
 @yield('content')
 @yield('linkeditor_scripts')
 @stack('linkeditor_scripts')
+
 </body>
 </html>