]> gitweb.hamatoma.de Git - zentrum.gemeinwohl-gesellschaft.org.git/commitdiff
V0.1.6 ProcessController
authorHamatoma <author@hamatoma.de>
Sat, 29 Mar 2025 20:41:37 +0000 (21:41 +0100)
committerHamatoma <author@hamatoma.de>
Sat, 29 Mar 2025 20:41:37 +0000 (21:41 +0100)
- ProcessController: destroy(): Löschen der Dateien xmlfile und image

CHANGELOG.md
app/Http/Controllers/ProcessController.php
resources/views/process/edit.blade.php
resources/views/process/show.blade.php

index 1aee7c8ce9e235f79c083f29361bc514d4c10496..2bf302ecd43618fe2ae0a8475cf342f1ffb6892d 100644 (file)
@@ -1,5 +1,9 @@
 # Änderungen an zentrum
 
+# V0.1.6 ProcessController
+
+- ProcessController: destroy(): Löschen der Dateien xmlfile und image
+
 # V0.1.5 ProcessController
 
 - ProcessController:
index d446ae9788360188f7b4dca1efa4f6d1fb077d0d..c443cc8e75e2eea2d573251bc53ca2f13a52f12d 100644 (file)
@@ -75,7 +75,7 @@ class ProcessController extends Controller
                 ];
             }
             $fields['referenceXml'] = FileHelper::urlUpload() . '/' . $process->xmlfile;
-            $fields['referenceImage'] = $process->image == null ? '#' : FileHelper::urlUpload() . '/' . $process->image;
+            $fields['referenceImage'] = $process->image == null ? '' : FileHelper::urlUpload() . '/' . $process->image;
             $context = new ContextLaraKnife($request, $fields, $process);
             $optionsDivision = SProperty::optionsByScope('division', $process->division_scope, '');
             $optionsActivity = SProperty::optionsByScope('activity', $process->activity_scope, '');
@@ -95,6 +95,10 @@ class ProcessController extends Controller
     public function destroy(Process $process, Request $request)
     {
         if ($request->btnSubmit === 'btnDelete') {
+            unlink(FileHelper::pathUpload($process->xmlfile));
+            if ($process->image != null) {
+                unlink(FileHelper::pathUpload($process->image));
+            }
             $process->delete();
         }
         return redirect('/process-index');
@@ -250,6 +254,8 @@ LEFT JOIN users t3 ON t3.id=t0.owner_id
             $optionsDivision = SProperty::optionsByScope('division', $process->division_scope, '');
             $optionsActivity = SProperty::optionsByScope('activity', $process->activity_scope, '');
             $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $process->owner_id, '-');
+            $fields['referenceXml'] = FileHelper::urlUpload() . '/' . $process->xmlfile;
+            $fields['referenceImage'] = $process->image == null ? '' : FileHelper::urlUpload() . '/' . $process->image;
             $context = new ContextLaraKnife($request, null, $process);
             $rc = view('process.show', [
                 'context' => $context,
index 99ed05229fd37034a3e67c1b27dd3de5768cb9af..8f0d60f4d9bcab2bdd184759e15b06cf245c303d 100644 (file)
             <x-laraknife.forms.link position="alone" name="xmlfile" label="XML-Datei"
                 reference="{{ $context->valueOf('referenceXml') }}" text="{{ basename($context->valueOf('xmlfile')) }}"
                 width2="4" />
-            @if ($context->valueOf('image') != null)
-                <x-laraknife.forms.link position="first" name="image" label="Bild-Datei"
-                    reference="{{ $context->valueOf('referenceImage') }}"
-                    text="{{ basename($context->valueOf('image')) }}" width2="4" />
-            @else
-                <x-laraknife.forms.const-text position="first" name="image" label="Bild-Datei"
-                    text="" width2="4" />
-            @endif
+            <x-laraknife.forms.link position="first" name="image" label="Bild-Datei"
+                reference="{{ $context->valueOf('referenceImage') }}" text="{{ basename($context->valueOf('image')) }}"
+                width2="4" />
             <x-laraknife.forms.file position="last" name="file" label="Neue Bilddatei" width2="4" />
         </x-laraknife.panels.edit>
     </form>
index 64f957a3678360e1c692dcc20b85c6a05e301289..8d70b5eecb290e7d74ce5c6ecb237ce97873b3ed 100644 (file)
                 value="{{ $context->valueOf('datasources') }}" width2="4" attribute="readonly" rows="4" />
             <x-laraknife.forms.text position="alone" name="info" label="Info" value="{{ $context->valueOf('info') }}"
                 width2="10" attribute="readonly" rows="2" />
-                <x-laraknife.forms.string position="first" name="xmlfile" label="XML-Datei"
-                value="{{ $context->valueOf('xmlfile') }}" width2="4" attribute="readonly" />
-            <x-laraknife.forms.string position="last" name="image" label="Bild-Datei"
-                value="{{ $context->valueOf('image') }}" width2="4" attribute="readonly" />
+            <x-laraknife.forms.link position="first" name="xmlfile" label="XML-Datei"
+                reference="{{ $context->valueOf('referenceXml') }}" text="{{ basename($context->valueOf('xmlfile')) }}"
+                width2="4" />
+            <x-laraknife.forms.link position="last" name="image" label="Bild-Datei"
+                reference="{{ $context->valueOf('referenceImage') }}" text="{{ basename($context->valueOf('image')) }}"
+                width2="4" />
         </x-laraknife.panels.show>
     </form>
 @endsection