From 4a557176e00972d6d7c8487e24bd31555a1b35e3 Mon Sep 17 00:00:00 2001 From: Hamatoma Date: Fri, 28 Mar 2025 22:27:15 +0100 Subject: [PATCH] V0.1.4 Process - Process: neu: +xmlfile +image - ProcessController: - parseDrawIoXml(): Fehler bei "Data sources" - store(): Speichern der Bilddatei - index.blade: - Spalte "Bild" --- CHANGELOG.md | 9 ++ app/Http/Controllers/ProcessController.php | 45 ++++--- app/Models/Process.php | 4 +- composer.lock | 120 +++++++++--------- ...25_03_25_125345_create_processes_table.php | 2 + resources/views/process/create.blade.php | 4 +- resources/views/process/edit.blade.php | 11 +- resources/views/process/index.blade.php | 6 + resources/views/process/show.blade.php | 4 + 9 files changed, 123 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf2f7d8..a9aaebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Änderungen an zentrum +# V0.1.4 Process + +- Process: neu: +xmlfile +image +- ProcessController: + - parseDrawIoXml(): Fehler bei "Data sources" + - store(): Speichern der Bilddatei +- index.blade: + - Spalte "Bild" + # V0.1.3 Process ExportController drawio2db.py - ExportController: $_SERVER['documentroot] replaced by FileHelper::documentRoot() diff --git a/app/Http/Controllers/ProcessController.php b/app/Http/Controllers/ProcessController.php index 7cd1cb1..ca9b30e 100644 --- a/app/Http/Controllers/ProcessController.php +++ b/app/Http/Controllers/ProcessController.php @@ -38,8 +38,8 @@ class ProcessController extends Controller ]; } $context = new ContextLaraKnife($request, $fields); - $optionsDivision = SProperty::optionsByScope('division', $fields['division_scope'], ''); - $optionsActivity = SProperty::optionsByScope('activity', $fields['activity_scope'], ''); + $optionsDivision = SProperty::optionsByScope('division', $fields['division_scope'], '-'); + $optionsActivity = SProperty::optionsByScope('activity', $fields['activity_scope'], '-'); $rc = view('process.create', [ 'context' => $context, 'optionsDivision' => $optionsDivision, @@ -69,13 +69,15 @@ class ProcessController extends Controller 'datasources' => $process->datasources, 'texts' => $process->texts, 'info' => $process->info, - 'owner_id' => $process->owner_id + 'owner_id' => $process->owner_id, + 'xmlfile' => $process->xmlfile, + 'image' => $process->image ]; } $context = new ContextLaraKnife($request, $fields, $process); $optionsDivision = SProperty::optionsByScope('division', $process->division_scope, ''); $optionsActivity = SProperty::optionsByScope('activity', $process->activity_scope, ''); - $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner_id'], __('')); + $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner_id'], __('-')); $rc = view('process.edit', [ 'context' => $context, 'optionsDivision' => $optionsDivision, @@ -147,7 +149,7 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id $records = $pagination->records; $optionsDivision = SProperty::optionsByScope('division', $fields['division'], 'all'); $optionsActivity = SProperty::optionsByScope('activity', $fields['activity'], 'all'); - $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner'], __('all')); + $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner'], 'all'); $context = new ContextLaraKnife($request, $fields); return view('process.index', [ 'context' => $context, @@ -174,7 +176,7 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id $fields['title'] = substr($line, 7); } elseif (str_starts_with($line, ' ')) { $multiline .= substr($line, 2) . "\n"; - } elseif (preg_match('/^(Roles|SubProcesses|Data Sources|Texts)/', $line, $matches)) { + } elseif (preg_match('/^(Roles|SubProcesses|Data sources|Texts)/', $line, $matches)) { switch ($target) { case 'Roles': $fields['roles'] = $multiline; @@ -182,7 +184,7 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id case 'SubProcesses': $fields['subprocesses'] = $multiline; break; - case 'Data Sources': + case 'Data sources': $fields['datasources'] = $multiline; break; case 'Texts': @@ -210,14 +212,16 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id 'serialno' => $isCreate ? '' : 'required', 'division_scope' => $isCreate ? '' : 'required', 'activity_scope' => $isCreate ? '' : 'required', - 'path' => $isCreate ? '' : 'required', - 'title' => $isCreate ? '' : 'required', + 'path' => '', + 'title' => '', 'roles' => '', 'subprocesses' => '', 'datasources' => '', 'texts' => '', 'info' => '', - 'owner_id' => $isCreate ? '' : 'required' + 'owner_id' => '', + 'xmlfile' => '', + 'image' => '', ]; return $rc; } @@ -243,7 +247,7 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id } else { $optionsDivision = SProperty::optionsByScope('division', $process->division_scope, ''); $optionsActivity = SProperty::optionsByScope('activity', $process->activity_scope, ''); - $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $process->owner_id, __('')); + $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $process->owner_id, '-'); $context = new ContextLaraKnife($request, null, $process); $rc = view('process.show', [ 'context' => $context, @@ -268,11 +272,12 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id $rc = back()->withErrors($validator)->withInput(); } else { $validated = $validator->validated(); - $fullName = $this->storeFile($request); - if ($fullName == null) { + $relativeName = $this->storeFile($request); + if ($relativeName == null) { $rc = back()->withErrors($validator)->withInput(); } else { - $this->parseDrawIoXml($fullName, $validated); + $this->parseDrawIoXml($relativeName, $validated); + $validated['xmlfile'] = $relativeName; $process = Process::create($validated); Change::createFromFields($validated, Change::$CREATE, 'Process', $process->id); $rc = redirect('/process-edit/' . $process->id); @@ -295,8 +300,7 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id $file = $request->file(); $file = $request->file('file'); if ($file != null) { - $name = $file->getClientOriginalName(); - $filename = session('userName') . '_' . strval(time()) . '!' . $name; + $filename = substr($file->getClientOriginalName(), 0, 200); $rc = FileHelper::storeFile($request, 'file', $filename); } return $rc; @@ -312,6 +316,7 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id $fields = $request->all(); $validator = Validator::make($fields, $this->rules(false)); if ($validator->fails()) { + $errors = $validator->errors(); $rc = back()->withErrors($validator)->withInput(); } else { $validated = $validator->validated(); @@ -321,6 +326,14 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id $validated['datasources'] = strip_tags($validated['datasources']); $validated['texts'] = strip_tags($validated['texts']); $validated['info'] = strip_tags($validated['info']); + if ($request->file('file') != null) { + $relativeName = $this->storeFile($request); + if ($relativeName == null) { + $rc = back()->withErrors($validator)->withInput(); + } else { + $validated['image'] = $relativeName; + } + } $process->update($validated); } } diff --git a/app/Models/Process.php b/app/Models/Process.php index 307ca87..797f688 100644 --- a/app/Models/Process.php +++ b/app/Models/Process.php @@ -23,7 +23,9 @@ class Process extends Model 'datasources', 'texts', 'info', - 'owner_id' + 'owner_id', + 'xmlfile', + 'image', ]; public static function nextSerialNo(): int { diff --git a/composer.lock b/composer.lock index 697ec82..70b44cd 100644 --- a/composer.lock +++ b/composer.lock @@ -645,16 +645,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.9.2", + "version": "7.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "shasum": "" }, "require": { @@ -751,7 +751,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" }, "funding": [ { @@ -767,20 +767,20 @@ "type": "tidelift" } ], - "time": "2024-07-24T11:22:20+00:00" + "time": "2025-03-27T13:37:11+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.4", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "shasum": "" }, "require": { @@ -834,7 +834,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.4" + "source": "https://github.com/guzzle/promises/tree/2.2.0" }, "funding": [ { @@ -850,20 +850,20 @@ "type": "tidelift" } ], - "time": "2024-10-17T10:06:22+00:00" + "time": "2025-03-27T13:27:01+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.7.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "shasum": "" }, "require": { @@ -950,7 +950,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.0" + "source": "https://github.com/guzzle/psr7/tree/2.7.1" }, "funding": [ { @@ -966,7 +966,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T11:15:46+00:00" + "time": "2025-03-27T12:30:47+00:00" }, { "name": "guzzlehttp/uri-template", @@ -1060,7 +1060,7 @@ "dist": { "type": "path", "url": "../laraknife", - "reference": "919c89cab04807f66b7f4a4881139e8df5b687b9" + "reference": "31ee280aefb8164691f9d80d4f6e60e0338430e1" }, "require-dev": { "phpunit/phpunit": "11.0.x-dev" @@ -1365,16 +1365,16 @@ }, { "name": "laravel/serializable-closure", - "version": "v2.0.3", + "version": "v2.0.4", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "f379c13663245f7aa4512a7869f62eb14095f23f" + "reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/f379c13663245f7aa4512a7869f62eb14095f23f", - "reference": "f379c13663245f7aa4512a7869f62eb14095f23f", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/b352cf0534aa1ae6b4d825d1e762e35d43f8a841", + "reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841", "shasum": "" }, "require": { @@ -1422,7 +1422,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2025-02-11T15:03:05+00:00" + "time": "2025-03-19T13:51:03+00:00" }, { "name": "laravel/tinker", @@ -3543,16 +3543,16 @@ }, { "name": "symfony/console", - "version": "v7.2.1", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3" + "reference": "e51498ea18570c062e7df29d05a7003585b19b88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3", - "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "url": "https://api.github.com/repos/symfony/console/zipball/e51498ea18570c062e7df29d05a7003585b19b88", + "reference": "e51498ea18570c062e7df29d05a7003585b19b88", "shasum": "" }, "require": { @@ -3616,7 +3616,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.2.1" + "source": "https://github.com/symfony/console/tree/v7.2.5" }, "funding": [ { @@ -3632,7 +3632,7 @@ "type": "tidelift" } ], - "time": "2024-12-11T03:49:26+00:00" + "time": "2025-03-12T08:11:12+00:00" }, { "name": "symfony/css-selector", @@ -3768,16 +3768,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "aabf79938aa795350c07ce6464dd1985607d95d5" + "reference": "102be5e6a8e4f4f3eb3149bcbfa33a80d1ee374b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/aabf79938aa795350c07ce6464dd1985607d95d5", - "reference": "aabf79938aa795350c07ce6464dd1985607d95d5", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/102be5e6a8e4f4f3eb3149bcbfa33a80d1ee374b", + "reference": "102be5e6a8e4f4f3eb3149bcbfa33a80d1ee374b", "shasum": "" }, "require": { @@ -3823,7 +3823,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.2.4" + "source": "https://github.com/symfony/error-handler/tree/v7.2.5" }, "funding": [ { @@ -3839,7 +3839,7 @@ "type": "tidelift" } ], - "time": "2025-02-02T20:27:07+00:00" + "time": "2025-03-03T07:12:39+00:00" }, { "name": "symfony/event-dispatcher", @@ -4063,16 +4063,16 @@ }, { "name": "symfony/http-foundation", - "version": "v7.2.3", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "ee1b504b8926198be89d05e5b6fc4c3810c090f0" + "reference": "371272aeb6286f8135e028ca535f8e4d6f114126" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ee1b504b8926198be89d05e5b6fc4c3810c090f0", - "reference": "ee1b504b8926198be89d05e5b6fc4c3810c090f0", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/371272aeb6286f8135e028ca535f8e4d6f114126", + "reference": "371272aeb6286f8135e028ca535f8e4d6f114126", "shasum": "" }, "require": { @@ -4121,7 +4121,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.2.3" + "source": "https://github.com/symfony/http-foundation/tree/v7.2.5" }, "funding": [ { @@ -4137,20 +4137,20 @@ "type": "tidelift" } ], - "time": "2025-01-17T10:56:55+00:00" + "time": "2025-03-25T15:54:33+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "9f1103734c5789798fefb90e91de4586039003ed" + "reference": "b1fe91bc1fa454a806d3f98db4ba826eb9941a54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9f1103734c5789798fefb90e91de4586039003ed", - "reference": "9f1103734c5789798fefb90e91de4586039003ed", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b1fe91bc1fa454a806d3f98db4ba826eb9941a54", + "reference": "b1fe91bc1fa454a806d3f98db4ba826eb9941a54", "shasum": "" }, "require": { @@ -4235,7 +4235,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.2.4" + "source": "https://github.com/symfony/http-kernel/tree/v7.2.5" }, "funding": [ { @@ -4251,7 +4251,7 @@ "type": "tidelift" } ], - "time": "2025-02-26T11:01:22+00:00" + "time": "2025-03-28T13:32:50+00:00" }, { "name": "symfony/mailer", @@ -5055,16 +5055,16 @@ }, { "name": "symfony/process", - "version": "v7.2.4", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf" + "reference": "87b7c93e57df9d8e39a093d32587702380ff045d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", - "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", + "url": "https://api.github.com/repos/symfony/process/zipball/87b7c93e57df9d8e39a093d32587702380ff045d", + "reference": "87b7c93e57df9d8e39a093d32587702380ff045d", "shasum": "" }, "require": { @@ -5096,7 +5096,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.2.4" + "source": "https://github.com/symfony/process/tree/v7.2.5" }, "funding": [ { @@ -5112,7 +5112,7 @@ "type": "tidelift" } ], - "time": "2025-02-05T08:33:46+00:00" + "time": "2025-03-13T12:21:46+00:00" }, { "name": "symfony/routing", @@ -8123,16 +8123,16 @@ }, { "name": "symfony/yaml", - "version": "v7.2.3", + "version": "v7.2.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec" + "reference": "4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ac238f173df0c9c1120f862d0f599e17535a87ec", - "reference": "ac238f173df0c9c1120f862d0f599e17535a87ec", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912", + "reference": "4c4b6f4cfcd7e52053f0c8bfad0f7f30fb924912", "shasum": "" }, "require": { @@ -8175,7 +8175,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.2.3" + "source": "https://github.com/symfony/yaml/tree/v7.2.5" }, "funding": [ { @@ -8191,7 +8191,7 @@ "type": "tidelift" } ], - "time": "2025-01-07T12:55:42+00:00" + "time": "2025-03-03T07:12:39+00:00" }, { "name": "theseer/tokenizer", diff --git a/database/migrations/2025_03_25_125345_create_processes_table.php b/database/migrations/2025_03_25_125345_create_processes_table.php index 471de75..06a68d3 100644 --- a/database/migrations/2025_03_25_125345_create_processes_table.php +++ b/database/migrations/2025_03_25_125345_create_processes_table.php @@ -25,6 +25,8 @@ return new class extends Migration $table->text('texts')->nullable(); $table->text('info')->nullable(); $table->foreignId('owner_id')->nullable()->references('id')->on('users'); + $table->string('xmlfile')->nullable(); + $table->string('image')->nullable(); }); } diff --git a/resources/views/process/create.blade.php b/resources/views/process/create.blade.php index 5235774..aedbd04 100644 --- a/resources/views/process/create.blade.php +++ b/resources/views/process/create.blade.php @@ -9,9 +9,9 @@ - - diff --git a/resources/views/process/edit.blade.php b/resources/views/process/edit.blade.php index e861983..127c1ac 100644 --- a/resources/views/process/edit.blade.php +++ b/resources/views/process/edit.blade.php @@ -1,7 +1,7 @@ @extends('layouts.backend') @section('content') -
+ @csrf - + + + +
@endsection diff --git a/resources/views/process/index.blade.php b/resources/views/process/index.blade.php index 33fc8c6..3256cdf 100644 --- a/resources/views/process/index.blade.php +++ b/resources/views/process/index.blade.php @@ -25,6 +25,7 @@ Abteilung Tätigkeitsfeld Pfad + Bild Besitzer @@ -38,6 +39,11 @@ {{ __($process->division) }} {{ __($process->activity) }} {{$process->path}} + + @if ($process->image != null && $process) + {{basename($process->image)}} + @endif + {{$process->owner}} diff --git a/resources/views/process/show.blade.php b/resources/views/process/show.blade.php index 5bb7199..64f957a 100644 --- a/resources/views/process/show.blade.php +++ b/resources/views/process/show.blade.php @@ -31,6 +31,10 @@ value="{{ $context->valueOf('datasources') }}" width2="4" attribute="readonly" rows="4" /> + + @endsection -- 2.39.5