From c1f5f299d094b9660ba8bf2adc8b06b6d4f66921 Mon Sep 17 00:00:00 2001 From: Hamatoma Date: Tue, 11 Jun 2024 22:28:03 +0200 Subject: [PATCH] V 0.4.3 Page-Export - PageController: - neue Syntax in Exportdatei --- CHANGELOG.md | 6 +++ app/Http/Controllers/PageController.php | 71 +++++++++++++++---------- composer.lock | 14 ++--- lang/de_DE.json | 4 ++ public/temp | 1 + 5 files changed, 62 insertions(+), 34 deletions(-) create mode 120000 public/temp diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a5e90e..8a6ee47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# V 0.4.3 Page-Export + +# Changed +- PageController: + - neue Syntax in Exportdatei + # V 0.4.2 Modul Export, Refaktorierung Seeders ## Added diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index 3840607..55e926f 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -5,7 +5,6 @@ namespace App\Http\Controllers; use App\Models\File; use App\Models\Page; use App\Models\Module; -use App\Helpers\Helper; use App\Helpers\DbHelper; use App\Models\SProperty; use App\Helpers\MediaWiki; @@ -16,7 +15,6 @@ use Illuminate\Http\Request; use App\Helpers\StringHelper; use App\Helpers\TextProcessor; use App\Helpers\ContextLaraKnife; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Validator; @@ -69,25 +67,40 @@ class PageController extends Controller $fn = FileHelper::buildExportName('page-export', '.txt'); $sep = '~' . StringHelper::randomString(StringHelper::$charSetAlphaNumeric, 3) . '%'; $count = count($records); - $contents = "!Meta LaraKnife-Export -separator=$sep -records=$count - "; + $host = env('APP_URL'); + $date = (new \DateTime('now'))->format('Y-m-d H:i'); + $contents = ":LaraKnife-Export +:host=$host +:exported=$date +:separator=$sep +:records=$count +"; $recordNo = 0; foreach ($records as &$record) { $recordNo++; - $contents .= "action=insert -table=pages -primary=page$recordNo + $contents .= ":action=insert +:table=pages +!id=page$recordNo +!reference_id=$record->reference_id +!audio_id=$record->audio_id +!owner_id=$record->owner_id +!previous_id=$record->previous_id +!next_id=$record->next_id +!up_id=$record->up_id title=$record->title name=$record->name -contents=<< -$record->contents +pagetype_scope=$record->pagetype_scope +markup_scope=$record->markup_scope +order=$record->order +language_scope=$record->language_scope +~contents=$record->contents +$sep +~info=$record->info $sep "; } file_put_contents($fn, $contents); - $rc = redirect('/exported'); + $rc = redirect('/export-index'); return $rc; } /** @@ -157,8 +170,9 @@ $sep */ public function index(Request $request) { + $rc = null; if ($request->btnSubmit === 'btnNew') { - return redirect('/page-create'); + $rc = redirect('/page-create'); } else { $sql = " SELECT t0.*, @@ -199,20 +213,23 @@ LEFT JOIN sproperties t4 ON t4.id=t0.owner_id if ($request->btnSubmit === 'btnExport') { $rc = $this->export($records); } - $optionsPagetype = SProperty::optionsByScope('pagetype', $fields['pagetype'], 'all'); - $optionsMarkup = SProperty::optionsByScope('markup', $fields['markup'], 'all'); - $optionsLanguage = SProperty::optionsByScope('localization', $fields['markup'], 'all'); - $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner']); - $context = new ContextLaraKnife($request, $fields); - return view('page.index', [ - 'context' => $context, - 'records' => $records, - 'optionsPagetype' => $optionsPagetype, - 'optionsMarkup' => $optionsMarkup, - 'optionsLanguage' => $optionsLanguage, - 'optionsOwner' => $optionsOwner, - 'pagination' => $pagination - ]); + if ($rc == null) { + $optionsPagetype = SProperty::optionsByScope('pagetype', $fields['pagetype'], 'all'); + $optionsMarkup = SProperty::optionsByScope('markup', $fields['markup'], 'all'); + $optionsLanguage = SProperty::optionsByScope('localization', $fields['markup'], 'all'); + $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner']); + $context = new ContextLaraKnife($request, $fields); + $rc = view('page.index', [ + 'context' => $context, + 'records' => $records, + 'optionsPagetype' => $optionsPagetype, + 'optionsMarkup' => $optionsMarkup, + 'optionsLanguage' => $optionsLanguage, + 'optionsOwner' => $optionsOwner, + 'pagination' => $pagination + ]); + } + return $rc; } } /** diff --git a/composer.lock b/composer.lock index fc4b471..57bb023 100644 --- a/composer.lock +++ b/composer.lock @@ -1056,7 +1056,7 @@ "dist": { "type": "path", "url": "../laraknife", - "reference": "5571c586612a4a51475ac95ef30ac1bf91b8d115" + "reference": "31c805ca6f97201252f11b8bdd36192fc6fe7951" }, "require-dev": { "phpunit/phpunit": "11.0.x-dev" @@ -2903,16 +2903,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.3", + "version": "v0.12.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73" + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/2fd717afa05341b4f8152547f142cd2f130f6818", + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818", "shasum": "" }, "require": { @@ -2976,9 +2976,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.3" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.4" }, - "time": "2024-04-02T15:57:53+00:00" + "time": "2024-06-10T01:18:23+00:00" }, { "name": "ralouphie/getallheaders", diff --git a/lang/de_DE.json b/lang/de_DE.json index 541cd2e..281f4d2 100644 --- a/lang/de_DE.json +++ b/lang/de_DE.json @@ -12,6 +12,7 @@ "Administrator": "Administrator", "All": "Alle", "Amount": "Betrag", + "Analysis": "Analyse", "Assign Roles": "Rollen zuordnen", "Back": "Zur\u00fcck", "Body": "Info", @@ -92,6 +93,7 @@ "Hello": "Hallo", "I found :n error(s)": "Ich habe :n Fehler gefunden", "Id": "Id", + "Import": "Import", "Imprint": "Impressum", "Info": "Info", "Insert Position": "Einf\u00fcgeposition", @@ -193,6 +195,7 @@ "Wordtype": "Wortart", "ZZZ-last": "", "ZZZZZ_last": "", + "action|actions": "Aktion|Aktionen", "active": "aktiv", "chapter": "Kapitel", "closed": "geschlossen", @@ -222,6 +225,7 @@ "section": "Bereich", "snaketext": "Schlangentext", "standard": "Standard", + "table|tables": "Tabelle|Tabellen", "task": "Aufgabe", "work": "Arbeit" } \ No newline at end of file diff --git a/public/temp b/public/temp new file mode 120000 index 0000000..c381ab9 --- /dev/null +++ b/public/temp @@ -0,0 +1 @@ +../storage/app/public/temp/ \ No newline at end of file -- 2.39.5