]> gitweb.hamatoma.de Git - gadeku.git/commitdiff
V 0.4.6 Mediawiki: field area button
authorHamatoma <author@hamatoma.de>
Wed, 19 Jun 2024 17:27:15 +0000 (19:27 +0200)
committerHamatoma <author@hamatoma.de>
Wed, 19 Jun 2024 17:27:38 +0000 (19:27 +0200)
- MediaWiki:
  - neue Syntax "%field()%
  - neue Syntax "%area()%"
- PageController: neu: showPrettyClozeText()
- TaskController: Korrekturen SnakeText+Lückentext

18 files changed:
CHANGELOG.md
app/Helpers/MediaWiki.php
app/Helpers/ViewHelperLocal.php
app/Http/Controllers/PageController.php
app/Http/Controllers/TaskController.php
composer.lock
database/migrations/2024_05_09_165242_alter_notes.php [deleted file]
database/migrations/2024_06_18_105242_alter_notes.php [new file with mode: 0644]
database/migrations/2024_06_18_165242_alter_notes.php [new file with mode: 0644]
lang/de_DE.json
resources/views/chapter/showpretty.blade.php
resources/views/page/show-col1.blade.php
resources/views/page/show-col2.blade.php
resources/views/page/show-col3.blade.php
resources/views/page/show-col4.blade.php
resources/views/task/create.blade.php
resources/views/task/edit_cloze.blade.php [new file with mode: 0644]
resources/views/task/edit_snake.blade.php

index 5c4a55d5b9eb0b1f4cbeb43a474626fc13bc3cc0..0977ce8e8d23b35c2cd005a6d48ff35c1a62a513 100644 (file)
@@ -1,3 +1,11 @@
+# V 0.4.6 Mediawiki: field area button
+
+- MediaWiki:
+  - neue Syntax "%field()%
+  - neue Syntax "%area()%"
+- PageController: neu: showPrettyClozeText()
+- TaskController: Korrekturen SnakeText+Lückentext
+
 # V 0.4.5 Mediawiki: field area button
 
 - MediaWiki:
index 67cb7bc4490cae0e649b171071d9799aa928ee7b..ad2ac6c6618def1638b70206040171beb58c8bbd 100644 (file)
@@ -45,7 +45,7 @@ class MediaWiki extends MediaWikiBase
                     break;
                 case 'mark':
                     $mode = count($matches) > 3 ? substr($matches[3], 1) : 'info';
-                    if (str_starts_with($mode, '.')){
+                    if (str_starts_with($mode, '.')) {
                         $mode = substr($mode, 1);
                         $rc = "<span class=\"$mode\">$matches[2]</span>";
                     } else {
@@ -59,36 +59,10 @@ class MediaWiki extends MediaWikiBase
                     $rc = '<del class="lkn-del">' . (count($matches) == 4 ? ($matches[2] . $matches[3]) : $matches[2]) . '</del>';
                     break;
                 case 'field':
-                    // name | width | default | solution1 ; solution2...
-                    $name = $matches[2];
-                    $value = '';
-                    $width = 8;
-                    if (count($matches) > 3) {
-                        $parts = explode('|', substr($matches[3], 1));
-                        $width = $parts[0];
-                        if (count($parts) > 1) {
-                            $value = $parts[1];
-                        }
-                    }
-                    $rc = "<input class=\"lkn-field\" name=\"$name\" value=\"$value\" size=\"$width\">";
+                    $rc = $this->specialMacrosToHtmlField(true, $matches);
                     break;
                 case 'area':
-                    // name | width | rows | default | solution1 ; solution2...
-                    $name = $matches[2];
-                    $value = '';
-                    $width = 8;
-                    $rows = 2;
-                    if (count($matches) > 3) {
-                        $parts = explode('|', substr($matches[3], 1));
-                        $width = $parts[0];
-                        if (count($parts) > 1) {
-                            $rows = $parts[1];
-                        }
-                        if (count($parts) > 2) {
-                            $value = htmlentities($parts[2]);
-                        }
-                    }
-                    $rc = "<textarea class=\"lkn-field\" name=\"$name\" \" size=\"$width\" rows=\"$rows\">$value</textarea>";
+                    $rc = $this->specialMacrosToHtmlField(false, $matches);
                     break;
                 case 'button':
                     // name | label | classes | options
@@ -102,7 +76,7 @@ class MediaWiki extends MediaWikiBase
                             $classes = $parts[1];
                         }
                     }
-                    $rc = "<button class=\"lkn-text-button $classes\">$label</button>";
+                    $rc = "<button name=\"btnSubmit\" value=\"$name\" class=\"lkn-text-button $classes\">$label</button>";
                     break;
                 case 'icon':
                     $name = $matches[2];
@@ -119,4 +93,91 @@ class MediaWiki extends MediaWikiBase
         $body = preg_replace('/U\+(x[\dA-F]+;)/', '&#\1', $body);
         return $body;
     }
+    function specialMacrosToHtmlField(bool $isField, array &$matches): string
+    {
+        // name | width | default | solution1 ; solution2...
+        $name = $matches[2];
+        $value = '';
+        $width = $isField ? 8 : 20;
+        $rows = 2;
+        if (count($matches) > 3) {
+            $parts = explode('|', substr($matches[3], 1));
+            $width = $parts[0];
+            if (count($parts) > 1) {
+                if ($isField) {
+                }
+                $value = $parts[1];
+            } else {
+                $rows = $parts[1];
+            }
+            if (count($parts) > 2) {
+                if ($isField) {
+                    $solutions = $parts[2];
+                } else {
+                    $value = $parts[2];
+                }
+            }
+            if (!$isField && count($parts) > 3) {
+                $solutions = $parts[3];
+            }
+        }
+        switch ($this->clozeMode) {
+            case 'fill':
+                if ($this->clozeData != null && array_key_exists($name, $this->clozeData)){
+                    $value = $this->clozeData[$name];
+                }
+                if ($isField) {
+                    $rc = "<input class=\"lkn-field\" name=\"$name\" value=\"$value\" size=\"$width\">";
+                } else {
+                    $value = htmlentities($value);
+                    $rc = "<textarea class=\"lkn-field\" name=\"$name\" \" size=\"$width\" rows=\"$rows\">$value</textarea>";
+                }
+                break;
+            case 'preview':
+                if ($isField) {
+                    $rc = "<input class=\"lkn-field\" name=\"$name\" value=\"$solutions\" size=\"$width\">";
+                } else {
+                    $value = str_replace(';', "<br/>\n", $solutions);
+                    $rc = "<textarea class=\"lkn-field\" name=\"$name\" \" size=\"$width\" rows=\"$rows\">$value</textarea>";
+                }
+                break;
+            case 'check':
+            case 'correction':
+                $value = array_key_exists($name, $this->clozeData) ? $this->clozeData[$name] : '';
+                if (($pos = strpos($solutions, ';')) === false) {
+                    $ok = $value === $solutions;
+                } else {
+                    $ok = strpos(";$solutions;", ";$value;") != false;
+                    if (!$ok) {
+                        $solutions = substr($solutions, 0, $pos);
+                    }
+                }
+                if ($this->clozeMode == 'check') {
+                    $class = $ok ? '' : 'lkn-error-field';
+                    if ($isField) {
+                        $rc = "<input class=\"lkn-field $class\" name=\"$name\" value=\"$value\" size=\"$width\">";
+                    } else {
+                        $value = htmlentities($value);
+                        $rc = "<textarea class=\"lkn-field $class\" name=\"$name\" size=\"$width\" rows=\"$rows\">$value</textarea>";
+                    }
+                } else {
+                    if ($ok) {
+                        $value2 = htmlentities($value);
+                    } else {
+                        $value2 = '<del>' . htmlentities($value) . '</del> <ins>' . htmlentities($solutions) . '</ins>';
+                    }
+                    $class = $ok ? 'lkn-pseudo-field' : 'lkn-pseudo-field-error';
+                    $rc = "<span class=\"$class\">$value2</span><input type=\"hidden\" name=\"$name\" value=\"$value\"";
+                }
+                if (! $ok){
+                    $this->clozeErrors++;
+                }
+                break;
+            default:
+                $rc = "!! unknown mode: $this->clozeMode!!";
+                break;
+        }
+        return $rc;
+    }
+
 }
index 4eaec02793037e403dd2d84b57e1efae01ccea1a..857659c0670e106fb6b51f90c4db1722294e7bf8 100644 (file)
@@ -24,22 +24,21 @@ class ViewHelperLocal
      * @param string $options
      * @param int $referenceId2 used for other links
      */
-    public static function getNavigationTabInfo(string $name, int $indexActive, int $referenceId, ?string $options=null, ?int $referenceId2 = null): ?NavigationTabs
+    public static function getNavigationTabInfo(string $name, int $indexActive, int $referenceId, ?string $options = null, ?int $referenceId2 = null): ?NavigationTabs
     {
         $rc = null;
         switch ($name) {
             case 'note-edit':
                 $list = [
+                    'Notes;/note-index',
                     "Properties;/note-edit/$referenceId",
                     "Documents;/note-index_documents/$referenceId",
                     "Shift;/note-edit_shift/$referenceId",
                 ];
-                if (strpos($options, 'task=1302') !== false) {
-                    $match = null;
-                    if (preg_match('/ref-page=(\d+)/', $options, $match)) {
-                        $pageId = $match[1];
-                        array_push($list, "Task;/task-edit_snake/$referenceId/$pageId");
-                    }
+                if (strpos($options, '_task=1302') !== false) {
+                    array_push($list, "Task;/task-edit_snake/$referenceId/$referenceId2");
+                } elseif (strpos($options, '_task=1303') !== false) {
+                    array_push($list, "Task;/task-edit_cloze/$referenceId/$referenceId2");
                 }
                 $rc = new NavigationTabs($list, $indexActive);
                 break;
@@ -91,7 +90,7 @@ class ViewHelperLocal
                     "Document;/transaction-edit_document/$options/$referenceId"
                 ], $indexActive);
                 break;
-           case 'transaction-edit':
+            case 'transaction-edit':
                 $rc = new NavigationTabs([
                     'Mandators;/mandator-index',
                     "Accounts;/account-index/$referenceId2",
index 05ce5bde64a1d4942c292f8e8e8884a633b1c70a..4a96a38ec34f8d1c6bad0f618310a7c4b30e94cc 100644 (file)
@@ -140,7 +140,11 @@ $sep
             $optionsPagetype = SProperty::optionsByScope('pagetype', $page->pagetype_scope, '');
             $optionsMarkup = SProperty::optionsByScope('markup', $page->markup_scope, '');
             $optionsLanguage = SProperty::optionsByScope('localization', $page->language_scope, '');
-            $fields = $request->btnSubmit !== 'btnPreview' ? null : ['preview' => $this->asHtml($page)];
+            if ($request->btnSubmit === 'btnPreview') {
+                $wiki = new MediaWiki();
+                $wiki->setClozeParameters('preview');
+                $fields['preview'] = $wiki->toHtml($page->contents);
+            }
             if ($page->audio_id != null) {
                 $file = File::find($page->audio_id);
                 $fields['audio'] = $file->filename;
@@ -304,6 +308,9 @@ LEFT JOIN users t4 ON t4.id=t0.owner_id
                     $text = TextProcessor::compressSnakeText($page->contents);
                     $params['text1'] = $this->asHtml($page, $text);
                     break;
+                case 2033/* cloze text */ :
+                    $params['text1'] = $this->showPrettyClozeText($textRaw, $request);
+                    break;
                 case 2031/* chapter */ :
                     /* Chapter: */
                     $text1 = $this->asHtml($page);
@@ -346,6 +353,16 @@ LEFT JOIN users t4 ON t4.id=t0.owner_id
         }
         return $rc;
     }
+    protected function showPrettyClozeText(string $text, Request $request): string
+    {
+        $rc = '';
+        $fields = $request->all();
+        $check = $request->btnSubmit === 'btnStore';
+        $wiki = new MediaWiki();
+        $wiki->setClozeParameters($check ? 'check' : 'fill', $fields);
+        $rc = $wiki->toHtml($text);
+        return $rc;
+    }
     public function showByName(string $name, int $pageType, Request $request)
     {
         $page = Page::where(['name' => $name, 'pagetype_scope' => $pageType])->first();
index 5b8db955234ca30672941bfcf523fbb27f6eed57..a2b98aa521a20d2d22148056b2c8db12f0eaacba 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace App\Http\Controllers;
 
-use App\Helpers\TextProcessor;
+use App\Helpers\StringHelper;
 use App\Models\File;
 use App\Models\Note;
 use App\Models\Page;
@@ -11,10 +11,12 @@ use App\Models\Module;
 use App\Helpers\Helper;
 use App\Helpers\DbHelper;
 use App\Models\SProperty;
+use App\Helpers\MediaWiki;
 use App\Helpers\FileHelper;
 use App\Helpers\Pagination;
 use App\Helpers\ViewHelper;
 use Illuminate\Http\Request;
+use App\Helpers\TextProcessor;
 use App\Helpers\ViewHelperLocal;
 use App\Helpers\ContextLaraKnife;
 use Illuminate\Support\Facades\DB;
@@ -33,14 +35,15 @@ class TaskController extends Controller
         $rc->pageId = $pageId;
         return $rc;
     }
-    private function checkSnakeText($solution, $original): int{
+    private function checkSnakeText($solution, $original): int
+    {
         $solutionWords = TextProcessor::wordStatistics($solution);
         $originalWords = TextProcessor::wordStatistics($original);
         $rc = 0;
-        foreach ($originalWords as $key => $count){
-            if (! array_key_exists($key, $solutionWords)){
+        foreach ($originalWords as $key => $count) {
+            if (!array_key_exists($key, $solutionWords)) {
                 $rc += $count;
-            } elseif ($count != ($count2 = $solutionWords[$key])){
+            } elseif ($count != ($count2 = $solutionWords[$key])) {
                 $rc += abs($count - $count2);
             }
         }
@@ -61,14 +64,24 @@ class TaskController extends Controller
                     'category_scope' => '1054',
                     'visibility_scope' => '1091',
                     'owner_id' => strval(auth()->id()),
-                    'task' => ''
+                    'group_id' => '',
+                    'task' => '',
                 ];
             }
             if ($pageId != null) {
                 $page = Page::find(intval($pageId));
                 if ($page != null) {
                     $fields['title'] = __('Task') . ": $page->title";
-                    $fields['options'] = "ref-page=$page->id";
+                    $fields['reference_id'] = $page->id;
+                    if ($fields['task'] == null) {
+                        if ($page->pagetype_scope === 2033) {
+                            // cloze text
+                            $fields['task'] = '1303';
+                        } elseif ($page->pagetype_scope === 2035) {
+                            // snake text
+                            $fields['task'] = '1302';
+                        }
+                    }
                 }
             }
             if ($request->btnSubmit === 'btnStore') {
@@ -76,8 +89,9 @@ class TaskController extends Controller
                 if ($validator->fails()) {
                     $rc = back()->withErrors($validator)->withInput();
                 } else {
+                    $fields['module_id'] = Module::idOfModule('Page');
                     $fields['notestatus_scope'] = 1011;
-                    $fields['options'] .= "\ntask=" . $fields['task'];
+                    $fields['options'] .= "\n_task=" . $fields['task'];
                     $fields['owner_id'] = auth()->id();
                     $task = Note::create($fields);
                     $rc = redirect("/note-edit/$task->id");
@@ -87,17 +101,59 @@ class TaskController extends Controller
                 $optionsVisibility = SProperty::optionsByScope('visibility', $fields['visibility_scope']);
                 $optionsTask = SProperty::optionsByScope('task', $fields['task'], '-');
                 $optionsCategory = SProperty::optionsByScope('category', $fields['category_scope']);
+                $optionsGroup = Group::combobox($fields['group_id'], '<no group>');
                 $context = new ContextLaraKnife($request, $fields);
                 $rc = view('task.create', [
                     'context' => $context,
                     'optionsVisibility' => $optionsVisibility,
                     'optionsTask' => $optionsTask,
+                    'optionsGroup' => $optionsGroup,
                     'optionsCategory' => $optionsCategory,
                 ]);
             }
         }
         return $rc;
     }
+    public function editCloze(Note $note, Page $page, Request $request)
+    {
+        if ($request->btnSubmit === 'btnCancel') {
+            $rc = redirect('/page-index');
+        } else {
+            $fields = $request->all();
+            $mode = 'check';
+            if (count($fields) <= 1) {
+                $mode = 'fill';
+                $fields = StringHelper::explodeAssoc($note->options);
+                $fields['message'] = '';
+                if ($page != null && $note != null) {
+                    $fields['pageId'] = $page->id;
+                }
+            }
+            $wiki = new MediaWiki();
+            if ($request->btnSubmit === 'btnCorrect') {
+                $mode = 'correction';
+            }
+            if ($request->btnSubmit === 'btnStore') {
+                $value = "_task=1303\n" . StringHelper::implodeAssoc($fields);
+                $note->update(['options' => $value]);
+            }
+            $wiki->setClozeParameters($mode, $fields);
+            $fields['cloze-text'] = $wiki->toHtml($page->contents);
+            if ($wiki->clozeErrors > 0){
+                $fields['message'] = $wiki->clozeErrors == 1 ? __('I found one error') : str_replace('#', strval($wiki->clozeErrors), __('I found # errors'));
+            }
+            $fields['title'] = $page->title;
+            $navigationTabInfo = ViewHelperLocal::getNavigationTabInfo('note-edit', 4, $note->id, $note->options);
+            $context = new ContextLaraKnife($request, $fields, $note);
+            $context->model2 = $page;
+            $rc = view('task.edit_cloze', [
+                'context' => $context,
+                'navTabsInfo' => $navigationTabInfo
+            ]);
+        }
+        return $rc;
+
+    }
     public function editSnake(Note $note, Page $page, Request $request)
     {
         if ($request->btnSubmit === 'btnCancel') {
@@ -119,7 +175,8 @@ class TaskController extends Controller
             if ($request->btnSubmit === 'btnStore') {
                 $note->update(['body' => $fields['solution']]);
             }
-            $navigationTabInfo = ViewHelperLocal::getNavigationTabInfo('note-edit', 3, $note->id, $note->options);
+            $fields['right'] = $request->btnSubmit !== 'btnCorrection' ? '' : $page->contents;
+            $navigationTabInfo = ViewHelperLocal::getNavigationTabInfo('note-edit', 4, $note->id, $note->options);
             $context = new ContextLaraKnife($request, $fields, $note);
             $context->model2 = $page;
             $rc = view('task.edit_snake', [
@@ -137,6 +194,8 @@ class TaskController extends Controller
         Route::post('/task-create', [TaskController::class, 'create'])->middleware('auth');
         Route::get('/task-edit_snake/{note}/{page}', [TaskController::class, 'editSnake'])->middleware('auth');
         Route::post('/task-edit_snake/{note}/{page}', [TaskController::class, 'editSnake'])->middleware('auth');
+        Route::get('/task-edit_cloze/{note}/{page}', [TaskController::class, 'editCloze'])->middleware('auth');
+        Route::post('/task-edit_cloze/{note}/{page}', [TaskController::class, 'editCloze'])->middleware('auth');
     }
 
 }
index 22d54a6eb60c07dcb791addc0912bd31e30005a5..69cd1e73f679dd37dc0e5903a705700495de8c46 100644 (file)
         },
         {
             "name": "laravel/framework",
-            "version": "v11.10.0",
+            "version": "v11.11.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "99b4255194912044b75ab72329f8c19e6345720e"
+                "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/99b4255194912044b75ab72329f8c19e6345720e",
-                "reference": "99b4255194912044b75ab72329f8c19e6345720e",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/194102876df42f9f5bb618efa55fa7e15ebf40aa",
+                "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa",
                 "shasum": ""
             },
             "require": {
                 "league/flysystem-sftp-v3": "^3.0",
                 "mockery/mockery": "^1.6",
                 "nyholm/psr7": "^1.2",
-                "orchestra/testbench-core": "^9.0.15",
+                "orchestra/testbench-core": "^9.1.5",
                 "pda/pheanstalk": "^5.0",
                 "phpstan/phpstan": "^1.4.7",
                 "phpunit/phpunit": "^10.5|^11.0",
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-06-04T13:45:55+00:00"
+            "time": "2024-06-18T17:40:27+00:00"
         },
         {
             "name": "laravel/prompts",
-            "version": "v0.1.23",
+            "version": "v0.1.24",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/prompts.git",
-                "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400"
+                "reference": "409b0b4305273472f3754826e68f4edbd0150149"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400",
-                "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400",
+                "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149",
+                "reference": "409b0b4305273472f3754826e68f4edbd0150149",
                 "shasum": ""
             },
             "require": {
             "description": "Add beautiful and user-friendly forms to your command-line applications.",
             "support": {
                 "issues": "https://github.com/laravel/prompts/issues",
-                "source": "https://github.com/laravel/prompts/tree/v0.1.23"
+                "source": "https://github.com/laravel/prompts/tree/v0.1.24"
             },
-            "time": "2024-05-27T13:53:20+00:00"
+            "time": "2024-06-17T13:58:22+00:00"
         },
         {
             "name": "laravel/serializable-closure",
         },
         {
             "name": "laravel/pint",
-            "version": "v1.16.0",
+            "version": "v1.16.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/pint.git",
-                "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98"
+                "reference": "9266a47f1b9231b83e0cfd849009547329d871b1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/pint/zipball/1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98",
-                "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98",
+                "url": "https://api.github.com/repos/laravel/pint/zipball/9266a47f1b9231b83e0cfd849009547329d871b1",
+                "reference": "9266a47f1b9231b83e0cfd849009547329d871b1",
                 "shasum": ""
             },
             "require": {
                 "php": "^8.1.0"
             },
             "require-dev": {
-                "friendsofphp/php-cs-fixer": "^3.57.1",
-                "illuminate/view": "^10.48.10",
-                "larastan/larastan": "^2.9.6",
+                "friendsofphp/php-cs-fixer": "^3.59.3",
+                "illuminate/view": "^10.48.12",
+                "larastan/larastan": "^2.9.7",
                 "laravel-zero/framework": "^10.4.0",
                 "mockery/mockery": "^1.6.12",
                 "nunomaduro/termwind": "^1.15.1",
-                "pestphp/pest": "^2.34.7"
+                "pestphp/pest": "^2.34.8"
             },
             "bin": [
                 "builds/pint"
                 "issues": "https://github.com/laravel/pint/issues",
                 "source": "https://github.com/laravel/pint"
             },
-            "time": "2024-05-21T18:08:25+00:00"
+            "time": "2024-06-18T16:50:05+00:00"
         },
         {
             "name": "laravel/sail",
-            "version": "v1.29.2",
+            "version": "v1.29.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/sail.git",
-                "reference": "a8e4e749735ba2f091856eafeb3f99db8cd6b621"
+                "reference": "e35b3ffe1b9ea598246d7e99197ee8799f6dc2e5"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/sail/zipball/a8e4e749735ba2f091856eafeb3f99db8cd6b621",
-                "reference": "a8e4e749735ba2f091856eafeb3f99db8cd6b621",
+                "url": "https://api.github.com/repos/laravel/sail/zipball/e35b3ffe1b9ea598246d7e99197ee8799f6dc2e5",
+                "reference": "e35b3ffe1b9ea598246d7e99197ee8799f6dc2e5",
                 "shasum": ""
             },
             "require": {
                 "issues": "https://github.com/laravel/sail/issues",
                 "source": "https://github.com/laravel/sail"
             },
-            "time": "2024-05-16T21:39:11+00:00"
+            "time": "2024-06-12T16:24:41+00:00"
         },
         {
             "name": "mockery/mockery",
         },
         {
             "name": "phpunit/phpunit",
-            "version": "10.5.21",
+            "version": "10.5.22",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6"
+                "reference": "8afb89b399b17c2ce2618015bdc9f81a117c5ee1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ac837816fa52078f7a5e17ed774f256a72a51af6",
-                "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8afb89b399b17c2ce2618015bdc9f81a117c5ee1",
+                "reference": "8afb89b399b17c2ce2618015bdc9f81a117c5ee1",
                 "shasum": ""
             },
             "require": {
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.21"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.22"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-06-15T09:13:15+00:00"
+            "time": "2024-06-19T05:29:34+00:00"
         },
         {
             "name": "sebastian/cli-parser",
diff --git a/database/migrations/2024_05_09_165242_alter_notes.php b/database/migrations/2024_05_09_165242_alter_notes.php
deleted file mode 100644 (file)
index d7187d4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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('notes', function(Blueprint $table) {
-            $table->string('options')->nullable();
-            $table->renameColumn('user_id', 'owner_id');
-          });
-          
-    }
-
-    /**
-     * Reverse the migrations.
-     */
-    public function down(): void
-    {
-        //
-    }
-};
diff --git a/database/migrations/2024_06_18_105242_alter_notes.php b/database/migrations/2024_06_18_105242_alter_notes.php
new file mode 100644 (file)
index 0000000..7d7ee96
--- /dev/null
@@ -0,0 +1,27 @@
+<?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('notes', function(Blueprint $table) {
+            $table->dropColumn('options');
+           });
+          
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};
diff --git a/database/migrations/2024_06_18_165242_alter_notes.php b/database/migrations/2024_06_18_165242_alter_notes.php
new file mode 100644 (file)
index 0000000..f284669
--- /dev/null
@@ -0,0 +1,30 @@
+<?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('notes', function(Blueprint $table) {
+            $table->text('options')->nullable();
+            $table->foreignId('group_id')->nullable()->references('id')->on('groups');
+            $table->foreignId('module_id')->nullable()->references('id')->on('modules');
+            $table->bigInteger('reference_id')->nullable();
+          });
+          
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};
index 281f4d2aa457a03c6d77cb199f23dc6365ceda29..c76184a7491103ad27451a87b63dae38e2f199ef 100644 (file)
@@ -4,6 +4,7 @@
     "<All>": "<Alle>",
     "<Not verified>": "<Nicht verifiziert>",
     "<Please select>": "<Bitte w\u00e4hlen>",
+    "<no group>": "<keine Gruppe>",
     "A Scoped Property": "Eine bereichsbasierte Eigenschaft",
     "Account": "Konto",
     "Accounts": "Konten",
@@ -43,6 +44,7 @@
     "Confirmation": "Best\u00e4tigung",
     "Contents": "Inhalt",
     "Copy": "Kopieren",
+    "Correction": "Korrektur",
     "Creation of a Document": "Hochladen eines Dokuments",
     "Creation of a File": "Hochladen einer Datei",
     "Creation of a Group": "Erstellen einer Gruppe",
@@ -91,7 +93,9 @@
     "Group": "Gruppe",
     "Groups": "Gruppen",
     "Hello": "Hallo",
+    "I found # errors": "Ich habe # Fehler gefunden (roter Rahmen)",
     "I found :n error(s)": "Ich habe :n Fehler gefunden",
+    "I found one error": "Ich habe einen Fehler gefunden (roter Rahmen)",
     "Id": "Id",
     "Import": "Import",
     "Imprint": "Impressum",
     "Responsibility changed": "Verantwortung ge\u00e4ndert",
     "Role": "Rolle",
     "Roles": "Rollen",
+    "Sample solution": "Musterl\u00f6sung",
     "Scope": "Bereich",
     "Scoped Properties": "Bereichsbasierte Eigenschaften",
     "Search": "Suche",
     "plain text": "reiner Text",
     "private": "privat",
     "public": "\u00f6ffentlich",
+    "record|records": "Datensatz|Datens\u00e4tze",
     "section": "Bereich",
     "snaketext": "Schlangentext",
     "standard": "Standard",
index c36bac549228fe3f9a002a50f180b07e32d5f3f1..279b0ef0d8be640c48102ca39486dbecd985f57a 100644 (file)
@@ -1,7 +1,7 @@
 @extends('layouts.backend')
 
 @section('content')
-    <form id="chapter-show" action="/chapter-show/{{ $context->model->id }}" method="POST">
+    <form id="chapter-show" action="/page-showpretty/{{ $context->model->id }}" method="POST">
         @csrf
         <x-laraknife.panels.noform-text title="{{ $context->valueof('title') }}" prev="{{ $context->valueof('prev') }}"
             next="{{ $context->valueof('next') }}">
index 76588252a287273a4319d06a027837027c095c4f..0643dec819aad572d7a1ebab10095e88044eb93f 100644 (file)
@@ -1,7 +1,7 @@
 @extends('layouts.frontend')
 
 @section('content')
-    <form id="page-show" action="/page-show/{{ $context->model->id }}" method="POST">
+    <form id="page-showcol1" action="/page-showpretty/{{ $context->model->id }}" method="POST">
         @csrf
         <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') }}">
index 6ca3c9d4331ab2800adc76a570df656c5daf54a1..b31365d2864d8e5d07977fe16a4692a5e900ed12 100644 (file)
@@ -1,7 +1,7 @@
 @extends('layouts.frontend')
 
 @section('content')
-    <form id="page-show" action="/page-show/{{ $context->model->id }}" method="POST">
+    <form id="page-showcol2" action="/page-showpretty/{{ $context->model->id }}" method="POST">
         @csrf
         <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') }}">
index a0a4bd57babfa8a2a81d1b9942eae75621242ec2..2a0de4171f48eb33f8f0c978447726c73ee2a492 100644 (file)
@@ -1,7 +1,7 @@
 @extends('layouts.frontend')
 
 @section('content')
-    <form id="page-show" action="/page-show/{{ $context->model->id }}" method="POST">
+    <form id="page-showcol3" action="/page-showpretty/{{ $context->model->id }}" method="POST">
         @csrf
         <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') }}">
index 1fa8d127b7fe0b67636fadd22a87623781d0af9f..e5c743b65abfd14dc72a8e9240d78a2e3baa2c40 100644 (file)
@@ -1,7 +1,7 @@
 @extends('layouts.frontend')
 
 @section('content')
-    <form id="page-show" action="/page-show/{{ $context->model->id }}" method="POST">
+    <form id="page-showcol4" action="/page-showcol4/{{ $context->model->id }}" method="POST">
         @csrf
         <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') }}">
index 9893df00c9ff882880d717ab949dba086c684e7a..30dc511f068c83d95cfc543435be7863fe71cc72 100644 (file)
@@ -9,8 +9,10 @@
                 width2="4" />
             <x-laraknife.forms.combobox position="last" name="visibility_scope" label="Visibility" :options="$optionsVisibility"
                 width2="4" />
-            <x-laraknife.forms.string position="alone" name="title" label="Title"
-                value="{{ $context->valueOf('title') }}" width2="10" />
+            <x-laraknife.forms.string position="first" name="title" label="Title"
+                value="{{ $context->valueOf('title') }}" width2="4" />
+                <x-laraknife.forms.combobox position="last" name="group_id" label="Group" :options="$optionsGroup"
+                width2="4" />
             <x-laraknife.forms.combobox position="first" name="task" label="Task" :options="$optionsTask"
                 width2="4" />
         </x-laraknife.panels.create>
diff --git a/resources/views/task/edit_cloze.blade.php b/resources/views/task/edit_cloze.blade.php
new file mode 100644 (file)
index 0000000..012d873
--- /dev/null
@@ -0,0 +1,28 @@
+@extends('layouts.backend')
+
+@section('content')
+    <form id="page-edit_cloze" enctype="multipart/form-data"
+        action="/task-edit_cloze/{{ $context->model->id }}/{{ $context->model2->id }}" method="POST">
+        @csrf
+        <x-laraknife.panels.standard title="{{ __('Change of a Task') }}" fieldset="false" button1Name="" button2Name="">
+            <x-laraknife.layout.nav-tabs :info="$navTabsInfo" fieldset="false" button1Name="" button2Name=""
+                class="lkn-text-area">
+                <x-laraknife.buttons.button-position position="first" name="btnStore" label="Check" width1="1" width2="4"
+                    class="lkn-gap-bottom-1" />
+                <x-laraknife.buttons.button-position position="last" name="btnCorrect" label="Correction" width1="2" width2="4"
+                    class="lkn-gap-bottom-1" />
+                @if ($context->valueOf('message') != null)
+                    <x-laraknife.forms.const-text text="{{ $context->valueOf('message') }}" width1="0" width2="12" class="lkn-text-error"/>
+                @endif
+                <h2 class="lkn-background-white">{{ $context->valueOf('title') }}</h2>
+                {!! $context->valueOf('cloze-text') !!}
+            </x-laraknife.layout.nav-tabs>
+        </x-laraknife.panels.standard>
+        @if (!empty($context->valueOf('preview')))
+            <x-laraknife.panels.noform title="{{ __('Preview') }}">
+                <div class="lkn-text">{!! $context->valueOf('preview') !!}
+                </div>
+            </x-laraknife.panels.noform>
+        @endif
+    </form>
+@endsection
index 1373465a3120cedccff67b04fcd2dab1961b61d0..9c029390a0fcab7138df8a296f0366f2a3f68eed 100644 (file)
@@ -1,21 +1,28 @@
 @extends('layouts.backend')
 
 @section('content')
-    <form id="page-edit_snake" enctype="multipart/form-data" action="/task-edit_snake/{{ $context->model->id }}/{{ $context->model2->id}}" method="POST">
+    <form id="page-edit_snake" enctype="multipart/form-data"
+        action="/task-edit_snake/{{ $context->model->id }}/{{ $context->model2->id }}" method="POST">
         @csrf
-        <x-laraknife.panels.edit title="{{ __('Change of a Task') }}">
+        <x-laraknife.panels.standard title="{{ __('Change of a Task') }}" fieldset="false">
             <x-laraknife.layout.nav-tabs :info="$navTabsInfo" fieldset="true">
                 <input type="hidden" name="pageNo" value="{{ $context->valueOf('pageNo') }}" />
                 <x-laraknife.forms.text position="alone" name="snaketext" label="Snaketext"
-                    value="{{ $context->valueOf('snaketext') }}" width2="10" rows="4" attribute="readonly" />
+                    value="{{ $context->valueOf('snaketext') }}" width2="10" rows="2" attribute="readonly" />
                 <x-laraknife.forms.text position="alone" name="solution" label="Solution"
-                    value="{{ $context->valueOf('solution') }}" width2="10" rows="4" />
-                <x-laraknife.buttons.button-position position="alone" name="btnCheck" label="Check" width2="4" />
+                    value="{{ $context->valueOf('solution') }}" width2="10" rows="2" />
+                <x-laraknife.buttons.button-position position="first" name="btnCheck" label="Check" width2="4" />
+                <x-laraknife.buttons.button-position position="last" name="btnCorrection" label="Correction"
+                    width2="4" />
+                @if ($context->valueOf('right') != null)
+                    <x-laraknife.forms.text position="alone" name="right" label="Sample solution"
+                        value="{{ $context->valueOf('right') }}" width2="10" rows="2" />
+                @endif
                 @if ($context->valueOf('message') != null)
-                    <x-laraknife.forms.const-text text="{{ $context->valueOf('message')}}" width2="10" />
+                    <x-laraknife.forms.const-text text="{{ $context->valueOf('message') }}" width2="10" />
                 @endif
             </x-laraknife.layout.nav-tabs>
-        </x-laraknife.panels.edit>
+        </x-laraknife.panels.standard>
         @if (!empty($context->valueOf('preview')))
             <x-laraknife.panels.noform title="{{ __('Preview') }}">
                 <div class="lkn-text">{!! $context->valueOf('preview') !!}