From: Vincent Vanwaelscappel Date: Wed, 24 Aug 2022 12:36:59 +0000 (+0200) Subject: wip #5414 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7a0d65f28bb8153031b02dadc96dd529efb01840;p=fluidbook-toolbox.git wip #5414 @0.25 --- diff --git a/app/Http/Controllers/Admin/Operations/Tools/Excel2JSON.php b/app/Http/Controllers/Admin/Operations/Tools/Excel2JSON.php index 025c92758..9f3e96131 100644 --- a/app/Http/Controllers/Admin/Operations/Tools/Excel2JSON.php +++ b/app/Http/Controllers/Admin/Operations/Tools/Excel2JSON.php @@ -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); diff --git a/app/Http/Controllers/Admin/Operations/Tools/JSON2Excel.php b/app/Http/Controllers/Admin/Operations/Tools/JSON2Excel.php index b8417bf20..8e95d34f2 100644 --- a/app/Http/Controllers/Admin/Operations/Tools/JSON2Excel.php +++ b/app/Http/Controllers/Admin/Operations/Tools/JSON2Excel.php @@ -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; diff --git a/app/Jobs/FluidbookCompiler.php b/app/Jobs/FluidbookCompiler.php index eb77069ba..b4ddcd4da 100644 --- a/app/Jobs/FluidbookCompiler.php +++ b/app/Jobs/FluidbookCompiler.php @@ -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; diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index 4e6025e33..de89ac656 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -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', diff --git a/composer.json b/composer.json index 826fdf976..41d4d5f09 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/composer.lock b/composer.lock index 1716e8314..73d7c43ce 100644 --- a/composer.lock +++ b/composer.lock @@ -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", @@ -1798,13 +1798,13 @@ "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", @@ -1829,7 +1829,7 @@ } ], "description": "Excel files manipulation", - "time": "2022-08-24T11:32:02+00:00" + "time": "2022-08-24T12:11:58+00:00" }, { "name": "cubist/gtag", diff --git a/resources/views/fields/fluidbook_chapters.blade.php b/resources/views/fields/fluidbook_chapters.blade.php index be5eedbcb..64498e54d 100644 --- a/resources/views/fields/fluidbook_chapters.blade.php +++ b/resources/views/fields/fluidbook_chapters.blade.php @@ -8,7 +8,7 @@ var json = $(this).closest('.bunchmultiple[data-values]').find('.hiddenfield').eq(0).val(); var form = $('
' + '' + - '' + + '' + '' + '
' ) @@ -22,7 +22,7 @@ $(document).on('click', '.chaptersImportExcel', function () { var 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); } }); });