]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5414 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Aug 2022 12:36:59 +0000 (14:36 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Aug 2022 12:36:59 +0000 (14:36 +0200)
app/Http/Controllers/Admin/Operations/Tools/Excel2JSON.php
app/Http/Controllers/Admin/Operations/Tools/JSON2Excel.php
app/Jobs/FluidbookCompiler.php
app/Models/FluidbookPublication.php
composer.json
composer.lock
resources/views/fields/fluidbook_chapters.blade.php

index 025c92758395219f37fcf694028ccf9e165a2913..9f3e961310ae84c6f7f97ae7e70f181f614c34c1 100644 (file)
@@ -5,8 +5,7 @@ namespace App\Http\Controllers\Admin\Operations\Tools;
 use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Backpack\Magic\Fields\StandardFile;
 use Cubist\Backpack\Magic\Form;
-use ExcelToArray;
-use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
+use Cubist\Excel\ExcelToArray;
 use Symfony\Component\HttpFoundation\File\UploadedFile;
 
 trait Excel2JSON
@@ -53,8 +52,8 @@ trait Excel2JSON
     {
         /** @var UploadedFile $file */
         $file = request()->file('file');
-        $dataorg = request()->file('dataorg', 'excelToArray');
-        $format = request()->file('format', 'json');
+        $dataorg = request()->input('dataorg', 'excelToArray');
+        $format = request()->input('format', 'json');
 
         ExcelToArray::setCache(protected_path('tools/exceltojson'));
 
@@ -63,7 +62,8 @@ trait Excel2JSON
             throw new \Exception('Type not allowed');
         }
         $function = $dataOrgs[$dataorg]['function'] ?? $dataorg;
-        $res = ExcelToArray::$function($file->getFilename());
+
+        $res = ExcelToArray::$function($file->getPathname());
 
         if ($format === 'json') {
             return response()->json($res);
index b8417bf208307dca89cc4f7d94472557ec311fef..8e95d34f28cc7e47f043d0af9ef0b052447a3d97 100644 (file)
@@ -34,6 +34,9 @@ trait JSON2Excel
     {
         $json = request()->get('json');
         $name = request()->get('filename', 'json');
+        if (!$name) {
+            $name = 'json';
+        }
         $safename = Str::slug($name);
         $data = json_decode($json, true);
         $first = true;
index eb77069ba361e13f815b03185e98dced04869396..b4ddcd4da2743e84d2d7a327b09c4e0a7157fb8e 100644 (file)
@@ -12,6 +12,7 @@ use App\Models\FluidbookTheme;
 use App\Models\FluidbookTranslate;
 use App\Models\Traits\FluidbookPlayerBranches;
 use App\Util\FluidbookLinks;
+use Cubist\Excel\ExcelToArray;
 use Cubist\Locale\Country;
 use Cubist\Locale\Locale;
 use Cubist\PDF\CommandLine\FWSTK;
@@ -30,7 +31,6 @@ use Cubist\Util\WebVideo;
 use DOMDocument;
 use DOMElement;
 use DOMXPath;
-use ExcelToArray;
 use Fluidbook\Tools\Compiler\CompilerInterface;
 use Fluidbook\Tools\Links\AnchorLink;
 use Fluidbook\Tools\Links\ContentLink;
index 4e6025e339dd328a380558977444c5cf2e54f230..de89ac656f8c308bb2739028e64e77c23e6a66c3 100644 (file)
@@ -26,7 +26,6 @@ use Cubist\Util\Files\Files;
 
 class FluidbookPublication extends ToolboxSettingsModel
 {
-    public mixed $pdfName;
     protected $table = 'fluidbook_publication';
     protected $_options = ['name' => 'fluidbook-publication',
         'singular' => 'publication',
index 826fdf976ddc1b1d65293a06a2a76c720b6d86ab..41d4d5f091fb177de650030b7c1d2736725d7228 100644 (file)
@@ -43,7 +43,7 @@
         "nyholm/psr7": "^1.5",
         "php-ffmpeg/php-ffmpeg": "^0.18.0",
         "rustici-software/scormcloud-api-v2-client-php": "^2.0",
-        "symfony/http-client": "^v6.1"
+        "symfony/http-client": "^v6.0"
     },
     "require-dev": {
         "facade/ignition": "^2.17",
index 1716e83142d2e022cdf8fce704afed7405b27769..73d7c43ce9b55de6adddc6bbae425f2f7285d721 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": "019aa2a9f00c7b3efacf70112d0d11fc",
+    "content-hash": "ddfabb800534167f67df33102116b584",
     "packages": [
         {
             "name": "ahmadshah/lucy",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_excel.git",
-                "reference": "b6f1ddf50862ffef4dfaf50836d5bfad02a66152"
+                "reference": "afa5add00dc6e002c6c5ee072c956e11371d3450"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/excel/cubist-excel-dev-master-f2dc61.tar",
-                "reference": "b6f1ddf50862ffef4dfaf50836d5bfad02a66152",
-                "shasum": "71e74b43b9740684f4a4bf3cdb151216223fee1d"
+                "url": "https://composer.cubedesigners.com/dist/cubist/excel/cubist-excel-dev-master-604639.tar",
+                "reference": "afa5add00dc6e002c6c5ee072c956e11371d3450",
+                "shasum": "14e9a9b90d49d77cb775115ac0ccf42f3bb9ce6f"
             },
             "require": {
                 "cubist/util": "dev-master",
                 }
             ],
             "description": "Excel files manipulation",
-            "time": "2022-08-24T11:32:02+00:00"
+            "time": "2022-08-24T12:11:58+00:00"
         },
         {
             "name": "cubist/gtag",
index be5eedbcbba78de36d80edbdbe65617442f20fa9..64498e54d4666ff236b9034a45675ea62d3de7d6 100644 (file)
@@ -8,7 +8,7 @@
                     var json = $(this).closest('.bunchmultiple[data-values]').find('.hiddenfield').eq(0).val();
                     var form = $('<form action="{{backpack_url('tools/dojson2excel')}}" method="post">' +
                             '<input type="hidden" name="json" value="" />' +
-                            '<input type="hidden" name="filename" value="" />' +
+                            '<input type="hidden" name="filename" value="chapters_{{$entry->id}}" />' +
                             '<input type="hidden" name="_token" value="{{csrf_token()}}" />' +
                             '</form>'
                         )
@@ -22,7 +22,7 @@
                 $(document).on('click', '.chaptersImportExcel', function () {
                     var form = $('<form style="opacity:0;position:absolute;top:0;left:0;" action="{{backpack_url('opentools/doexcel2json')}}" enctype="multipart/form-data" method="post">' +
                             '<input type="file" name="file" value="" accept=".xlsx" />' +
-                            '<input type="hidden" name="dataorg" value="excelToArrayKeyVars" />' +
+                            '<input type="hidden" name="dataorg" value="excelToArrayIndexKeyVars" />' +
                             '<input type="hidden" name="format" value="json" />' +
                             '<input type="hidden" name="_token" value="{{csrf_token()}}" />' +
                             '</form>'
@@ -34,7 +34,7 @@
                         $(form).ajaxSubmit({
                             success: function (data) {
                                 var bm = $('[data-bunch-name="{{$field['name']}}"]').data('bunchmultiple');
-                                bm.replaceData(data[0].data);
+                                bm.replaceData(data);
                             }
                         });
                     });