]> _ Git - odl.git/commitdiff
wip #5084 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 17 Feb 2022 08:45:19 +0000 (09:45 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 17 Feb 2022 08:45:19 +0000 (09:45 +0100)
app/Http/Middleware/CheckIfAdmin.php
app/Jobs/ProcessFluidbook.php

index 626b015adb977605fc07285223ecd1ce5934931c..2d6b651632c5a71d422d411abbd8b4747e29cda9 100644 (file)
@@ -22,6 +22,9 @@ class CheckIfAdmin
      */
     private function checkIfUserIsAdmin($user)
     {
+        if(request()->getHttpHost()==='odl.paris.cubedesigners.com'){
+            return true;
+        }
         return preg_match('/@odile\.space$/', $user->email, $matches);
     }
 
index 6ba1b41041ef595ed78856ea537d6f06027f4f0b..37e353a4c40417de8a40d65cc21c09727d0e5f03 100644 (file)
@@ -38,10 +38,13 @@ class ProcessFluidbook extends Compiler
         $this->out = storage_path('fluidbook/out/');
 
         /** @var Media $demo */
-        $demo = $this->pub->getMediaInField($this->pub->getAttributeValue('animdemo'))->first()->getPath();
-        $path = storage_path('fluidbook/demo/');
-        Files::rmdir($path);
-        Zip::extract($demo, $path);
+        $fdemo = $this->pub->getMediaInField($this->pub->getAttributeValue('animdemo'))->first();
+        if ($fdemo) {
+            $demo = $fdemo->getPath();
+            $path = storage_path('fluidbook/demo/');
+            Files::rmdir($path);
+            Zip::extract($demo, $path);
+        }
     }
 
     /**
@@ -141,7 +144,60 @@ class ProcessFluidbook extends Compiler
             $e = explode(':', $link['to']);
             $ee = explode('/', $e[0]);
 
-            if ($e[0] === 'pdf') {
+            if ($ee[0] == 'anim') {
+                $base = [['ease' => 'Power2.easeOut', 'duration' => 1.5, 'backgroundColor' => '#ffffff', 'transformOrigin' => 'center', 'delay' => 1], []];
+                switch ($ee[1]) {
+                    case 'fadein':
+                        $link['type'] = 14;
+                        $base[0]['type'] = 'fadeout';
+                        $base[0]['ease'] = 'Power0.easeInOut';
+                        break;
+                    case 'appearfromtop':
+                    case 'appearfrombottom':
+                        $link['type'] = 39;
+                        $base[0]['type'] = 'translatefrom';
+                        $base[0]['y'] = 100 * ($ee[1] == 'appearfromtop' ? -1 : 1);
+                        $base[1]['type'] = 'fadein';
+                        break;
+                    case 'zoomout':
+                        $link['type'] = 39;
+                        $base[0]['type'] = 'zoomout';
+                        $base[0]['scale'] = 1.3;
+                        $base[0]['duration'] = 3;
+                        $base[0]['ease'] = 'Power0.easeOut';
+                        break;
+                }
+
+                if (isset($e[1]) && $e[1] !== '') {
+                    $overriden = explode('&', $e[1]);
+                    foreach ($overriden as $i => $o) {
+                        if ($i === 0) {
+                            if ($link['type'] == 14) {
+                                $link['to'] = $o;
+                            } else {
+                                $base[0]['backgroundColor'] = $o;
+                            }
+                        } else {
+                            $eo = explode('=', $o);
+                            if (count($eo) == 2) {
+                                $base[0][$eo[0]] = $eo[1];
+                            }
+                        }
+                    }
+                }
+                $anim = '';
+
+                foreach ($base as $item) {
+                    if (!count($item)) {
+                        continue;
+                    }
+                    foreach ($item as $k => $v) {
+                        $anim .= $k . '=' . $v . "\n";
+                    }
+                    $anim .= '---' . "\n";
+                }
+                $link['image_rollover'] = $anim;
+            } else if ($e[0] === 'pdf') {
                 $cc = explode('#', $e[1]);
                 $link['type'] = 16;
                 $link['to'] = $this->_getAssetFile($cc[0]);