]> gitweb.hamatoma.de Git - gadeku.git/commitdiff
0.2.6 MediaWiki
authorHamatoma <author@hamatoma.de>
Sun, 5 May 2024 15:27:54 +0000 (17:27 +0200)
committerHamatoma <author@hamatoma.de>
Sun, 5 May 2024 21:18:33 +0000 (23:18 +0200)
- MediaWiki:
  - verbesserte RegEx-Ausdrücke in expandStarItems()
  - Korrekturen in specialMacrosToHtml()

CHANGELOG.md
app/Helpers/MediaWiki.php
app/Http/Controllers/PageController.php
app/Models/Page.php
composer.lock
database/migrations/2024_05_05_161051_alter_pages_table.php [new file with mode: 0644]
lang/de_DE.json
resources/views/chapter/showpretty.blade.php
resources/views/page/edit.blade.php
resources/views/page/show-col1.blade.php

index f7f8de0f040f12af8bb295f2528a31e5efa8e9a5..2aab8761e7c3806c9a0e165087719062af7aa0ea 100644 (file)
@@ -1,4 +1,16 @@
-# V 0.2.6 Word umgebaut, verbImperfect
+# V 0.2.7 Pages
+
+## Added
+- Neue Attribute für Seitenverlinkung: previous_id, up_id, next_id
+
+# V 0.2.6 MediaWiki
+
+## Changed
+- MediaWiki: 
+  - verbesserte RegEx-Ausdrücke in expandStarItems()
+  - Korrekturen in specialMacrosToHtml()
+
+# V 0.2.7 Word umgebaut, verbImperfect
 
 ## Changed
 - Module Verb und Noun entfallen, Word arbeitet mit strukturiertem Attribut options
index e752d057693c00d866a36a80ece144ec998c4a18..f9afb286f48b9bb60195b2c538b401cfd9b5ad3e 100644 (file)
@@ -9,16 +9,18 @@ class MediaWiki extends MediaWikiBase
     {
         $rc = preg_replace(
             [
-                '/\*(\w[^*]+\w)\*/',
+                '/\*(\w.*?\w)\*/',
                 '/\*<(.+?)>\*/',
-                '/\*-(\w[^*]+\w)-\*/',
-                '/\*\+(\w[^*]+\w)\+\*/'
+                '/\*-(\w.*?\w)-\*/',
+                '/\*\+(\w.*?\w)\+\*/',
+                '/\*(\w)\*/'
             ],
             [
                 '%trans($1)%',
                 '%field($1)%',
                 '%del($1)%',
-                '%add($1)%'
+                '%add($1)%',
+                '%trans($1)%',
             ],
             $text
         );
@@ -38,14 +40,14 @@ class MediaWiki extends MediaWikiBase
                     break;
                 case 'trans':
                     $text = $matches[2];
-                    $info = count($matches) > 3 ? $text : substr($matches[3], 1);
+                    $info = count($matches) <= 3 ? $text : substr($matches[3], 1);
                     $rc = "<i><b data-toggle=\"tooltip\" data-placement=\"top\" title=\"$info\">$text</b></i>";
                     break;
                 case 'mark':
                     $rc = '<span class="lkn-text-' . substr($matches[3], 1) . '">' . $matches[2] . '</span>';
                     break;
                 case 'add':
-                    $rc = '<ins class="lkn-ins">' . (count($matches) == 4 ? ($matches[2] . $matches[3]) : $matches[2]) . '</ins>';
+                    $rc = '<ins class="lkn-ins">' . (count($matches) >= 4 ? ($matches[2] . $matches[3]) : $matches[2]) . '</ins>';
                     break;
                 case 'del':
                     $rc = '<del class="lkn-del">' . (count($matches) == 4 ? ($matches[2] . $matches[3]) : $matches[2]) . '</del>';
@@ -69,12 +71,6 @@ class MediaWiki extends MediaWikiBase
                     $class = $size == 0 ? '' : "lkn-icon-$size";
                     $rc = "<i class=\"$name $class\"></i>";
                     break;
-                case 'image':
-                    $name = $matches[2];
-                    $size = count($matches) < 4 ? null : $matches[3];
-                    $class = $size == 0 ? '' : "lkn-icon-$size";
-                    $rc = "<img class=\"$name $class\"></i>";
-                    break;
                 default:
                     $rc = $matches[0];
                     break;
index 9580a7b7d1c75dd874402bf612e726d55e283df2..e8ff792043aa81bc9b65eff490f5517e900dd68c 100644 (file)
@@ -97,7 +97,10 @@ class PageController extends Controller
                     'markup_scope' => $page->markup_scope,
                     'language_scope' => $page->language_scope,
                     'order' => $page->order ?? '0',
-                    'audio_id' => $page->audio_id
+                    'audio_id' => $page->audio_id,
+                    'previous_id' => $page->previous_id,
+                    'next_id' => $page->next_id,
+                    'up_id' => $page->up_id
                 ];
             } else {
                 $fields['pagetype_scope'] = $page->pagetype_scope;
@@ -285,6 +288,15 @@ LEFT JOIN sproperties t4 ON t4.id=t0.owner_id
                     $view = 'page.text-col2';
                 }
             }
+            if ($page->previous_id != null){
+                $params['prev'] = "/page-showpretty/$page->previous_id";
+            }
+           if ($page->next_id != null){
+                $params['next'] = "/page-showpretty/$page->next_id";
+            }
+           if ($page->up_id != null){
+                $params['up'] = "/page-showpretty/$page->up_id";
+            }
             $context = new ContextLaraKnife($request, $params, $page);
             $rc = view($view, ['context' => $context]);
         }
@@ -358,6 +370,15 @@ LEFT JOIN sproperties t4 ON t4.id=t0.owner_id
         if ($fields['reference_id'] != null){
             $rules['reference_id'] = 'exists:pages,id';
         }
+        if ($fields['previous_id'] != null){
+            $rules['previous_id'] = 'exists:pages,id';
+        }
+        if ($fields['up_id'] != null){
+            $rules['up_id'] = 'exists:pages,id';
+        }
+        if ($fields['next_id'] != null){
+            $rules['next_id'] = 'exists:pages,id';
+        }
         $validator = Validator::make($fields, $rules);
         if ($validator->fails()) {
             $errors = $validator->errors();
index 39cdb7e503cf5a72c2a8753038a5b5a88f516e76..96fffa504ac46e8f6deffb4ad2a645e57ab06389 100644 (file)
@@ -24,6 +24,9 @@ class Page extends Model
         'columns',
         'audio_id',
         'reference_id',
+        'previous_id',
+        'up_id',
+        'next_id',
         'owner_id'
     ];
 }
index 5ef73e4e9be9e60024d5e1df6ea268d9a7c6048a..297b6e5fc34c6651ba0480106339cac708ec6bfe 100644 (file)
             "dist": {
                 "type": "path",
                 "url": "../laraknife",
-                "reference": "fdc1af63b7d821c111b630663be1f0bcbba93fa5"
+                "reference": "646e4764a06caa8ed60766fd98c8ce6882479d9c"
             },
             "require-dev": {
                 "phpunit/phpunit": "11.0.x-dev"
diff --git a/database/migrations/2024_05_05_161051_alter_pages_table.php b/database/migrations/2024_05_05_161051_alter_pages_table.php
new file mode 100644 (file)
index 0000000..4796c07
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::table('pages', function(Blueprint $table) {
+            $table->foreignId('previous_id')->nullable()->references('id')->on('pages');
+            $table->foreignId('next_id')->nullable()->references('id')->on('pages');
+            $table->foreignId('up_id')->nullable()->references('id')->on('pages');
+          });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};
index b0f207121618258af2ae480f2b3efa680b6d08c2..dff33496107b7c5dcbc5135309d6008d7ffc846f 100644 (file)
@@ -10,6 +10,7 @@
     "Administrator": "Administrator",
     "All": "Alle",
     "Assign Roles": "Rollen zuordnen",
+    "Back": "Zur\u00fcck",
     "Body": "Info",
     "Cancel": "Abbrechen",
     "Category": "Kategorie",
@@ -87,6 +88,7 @@
     "Markup": "Sprachtyp",
     "Name": "Name",
     "New": "Neu",
+    "Next": "Weiter",
     "Not Assigned Menu Items": "Nicht zugeordnete Men\u00fceintr\u00e4ge",
     "Not verified": "Nicht \u00fcberpr\u00fcft",
     "Notes": "Notizen",
index 15c88531c8c5b6bbc663211974ec498bea61099f..c36bac549228fe3f9a002a50f180b07e32d5f3f1 100644 (file)
@@ -3,7 +3,8 @@
 @section('content')
     <form id="chapter-show" action="/chapter-show/{{ $context->model->id }}" method="POST">
         @csrf
-        <x-laraknife.panels.noform-text title="{{ $context->valueof('title') }}">
+        <x-laraknife.panels.noform-text title="{{ $context->valueof('title') }}" prev="{{ $context->valueof('prev') }}"
+            next="{{ $context->valueof('next') }}">
             <div class="row">
                 {!! $context->valueOf('text') !!}
             </div>
index ec0c1635463ba34e0543d237e0a54a667851e083..236a15fd7e2559c2ce7a75f98f3bbd50ad97996e 100644 (file)
                 value="{{ $context->valueOf('contents') }}" width2="10" rows="10" />
             <x-laraknife.forms.text position="alone" name="info" label="Info" value="{{ $context->valueOf('info') }}"
                 width2="10" rows="2" />
-            <x-laraknife.forms.file-protected position="first" name="file" fieldId="{{ $context->model->audio_id }}"
+            <x-laraknife.forms.file-protected position="alone" name="file" fieldId="{{ $context->model->audio_id }}"
                 label="Audio" width2="4" />
-            <x-laraknife.buttons.button position="last" name="btnPreview" label="Preview" />
+            <x-laraknife.forms.string position="first" name="previous_id" label="Previous"
+                value="{{ $context->valueOf('previous_id') }}" width2="1" />
+            <x-laraknife.forms.string position="middle" name="up_id" label="Up"
+                value="{{ $context->valueOf('up_id') }}" width1="1" width2="1" />
+            <x-laraknife.forms.string position="middle" name="next_id" label="Next"
+                value="{{ $context->valueOf('next_id') }}" width1="1" width2="1" />
+            <x-laraknife.buttons.button-position position="last" name="btnPreview" label="Preview" width1="1"
+                width2="4" />
         </x-laraknife.panels.edit>
         @if (!empty($context->valueOf('preview')))
             <x-laraknife.panels.noform title="{{ __('Preview') }}">
index ad3f0be47ea0c3a9da67c5758adee99a45e60e00..76588252a287273a4319d06a027837027c095c4f 100644 (file)
@@ -3,15 +3,11 @@
 @section('content')
     <form id="page-show" action="/page-show/{{ $context->model->id }}" method="POST">
         @csrf
-        <x-laraknife.panels.text-area title="{{ $context->valueof('title') }}">
+        <x-laraknife.panels.text-area title="{{ $context->valueof('title') }}" prev="{{ $context->valueof('prev') }}"
+            up="{{ $context->valueof('up') }}"  next="{{ $context->valueof('next') }}" audio="{{ $context->valueof('audio') }}">
             <div class="lkn-text">
                 {!! $context->valueOf('text1') !!}
             </div>
         </x-laraknife.panels.text-area>
-        @if ($context->valueof('audio') != null)
-            <div class="row">
-                <x-laraknife.forms.audio width1="5" width2="2" fileLink="{{ $context->valueof('audio') }}" />
-            </div>
-        @endif
     </form>
 @endsection