+# V 0.3.3 Aufgaben mittels Note/Task, Email bei Note, Farben
+
+## Added
+- neu: TaskHelper
+- TextProcessor: neu compressSnakeText()
+- Note: neues Registerblatt "Aufgabe"
+- neues Farbschema Orange
+
+
# V 0.3.2 Phrase Word
## Added
--- /dev/null
+<?php
+namespace App\Helpers;
+
+class TaskHelper
+{
+ public static function contextHelper(string $task, string $parameter): string
+ {
+ $rc = '';
+ switch ($task) {
+ case 'page-index-icon':
+ $rc = "<a href=\"/task-create?page_id=$parameter\"><i class=\"bi bi-list-task text-primary\"></i></a>";
+ break;
+ default:
+ break;
+ }
+ return $rc;
+ }
+ public function buildButtonTask()
+ {
+
+ }
+}
\ No newline at end of file
class TextProcessor
{
+ public static function compressSnakeText(?string $text): string
+ {
+ $text = preg_replace('/[,.\s]+/', '', $text ?? '');
+ $text = strtolower($text);
+ return $text;
+ }
public static function expandStarItems(string $text): string
{
$rc = preg_replace(
$rc = null;
switch ($name) {
case 'note-edit':
- $rc = new NavigationTabs([
+ $list = [
"Properties;/note-edit/$referenceId",
"Documents;/note-index_documents/$referenceId",
"Shift;/note-edit_shift/$referenceId",
- ], $indexActive);
+ ];
+ 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");
+ }
+ }
+ $rc = new NavigationTabs($list, $indexActive);
break;
case 'word-edit':
$header = StringHelper::toCapital($options);
private function asHtml(Page &$page, ?string $contents = null): string
{
$contents ??= $page->contents;
- $type = $page->markup_scope;
- switch ($type) {
- case 1122: // mediawiki
- $wiki = new MediaWiki();
- $text = $wiki->toHtml($contents);
- break;
- case 1223: // html
- $text = $contents;
- break;
- default:
- case 1121: // plain text
- $text = '<p>' . str_replace('/\r?\n/', "</p>\n<p>", $contents) . "</p>";
- break;
- }
- return $text;
+ $rc = ViewHelper::asHtml($contents, $page->markup_scope);
+ return $rc;
}
/**
* Show the form for creating a new resource.
$optionsMarkup = SProperty::optionsByScope('markup', $page->markup_scope, '');
$optionsLanguage = SProperty::optionsByScope('localization', $page->language_scope, '');
$fields = $request->btnSubmit !== 'btnPreview' ? null : ['preview' => $this->asHtml($page)];
- if ($page->audio_id != null){
+ if ($page->audio_id != null) {
$file = File::find($page->audio_id);
$fields['audio'] = $file->filename;
}
$view = 'page.show-col1';
$audio = $page->audio_id == null ? null : File::relativeFileLink($page->audio_id);
$params = ['audio' => $audio];
- if ($page->pagetype_scope != 2031/* chapter */) {
- $columns = 1 + substr_count($textRaw, "\n---- %col%");
- if ($columns <= 1) {
- $params["text1"] = $this->asHtml($page);
- } else {
- $wiki = new MediaWiki();
- $parts = explode("\n---- %col%", $textRaw, 4);
- for ($no = 1; $no <= $columns; $no++) {
- $params["text$no"] = $wiki->toHtml($parts[$no - 1]);
+ switch ($page->pagetype_scope) {
+
+ case 2035/* snaketext */:
+ $text = TextProcessor::compressSnakeText($page->contents);
+ $params['text1'] = $this->asHtml($page, $text);
+ break;
+ case 2031/* chapter */ :
+ /* Chapter: */
+ $text1 = $this->asHtml($page);
+ $params['text1'] = $text1;
+ $text2 = null;
+ $lang = SProperty::idOfLocalization(auth()->user()->localization);
+ if (($page2 = Page::where(['reference_id' => $page->id, 'language_scope' => $lang])->first()) != null) {
+ $text2 = $this->asHtml($page2);
}
- $view = "page.show-col$columns";
- }
- } else {
- /* Chapter: */
- $text1 = $this->asHtml($page);
- $params['text1'] = $text1;
- $text2 = null;
- $lang = SProperty::idOfLocalization(auth()->user()->localization);
- if (($page2 = Page::where(['reference_id' => $page->id, 'language_scope' => $lang])->first()) != null) {
- $text2 = $this->asHtml($page2);
- }
- if ($text2 != null) {
- $params['text2'] = $text2;
- $view = 'page.translation-col2';
- }
+ if ($text2 != null) {
+ $params['text2'] = $text2;
+ $view = 'page.translation-col2';
+ }
+ break;
+ default:
+ $columns = 1 + substr_count($textRaw, "\n---- %col%");
+ if ($columns <= 1) {
+ $params["text1"] = $this->asHtml($page);
+ } else {
+ $wiki = new MediaWiki();
+ $parts = explode("\n---- %col%", $textRaw, 4);
+ for ($no = 1; $no <= $columns; $no++) {
+ $params["text$no"] = $wiki->toHtml($parts[$no - 1]);
+ }
+ $view = "page.show-col$columns";
+ }
+ break;
}
- if ($page->previous_id != null){
+ if ($page->previous_id != null) {
$params['prev'] = "/page-showpretty/$page->previous_id";
}
- if ($page->next_id != null){
+ if ($page->next_id != null) {
$params['next'] = "/page-showpretty/$page->next_id";
}
- if ($page->up_id != null){
+ if ($page->up_id != null) {
$params['up'] = "/page-showpretty/$page->up_id";
}
$context = new ContextLaraKnife($request, $params, $page);
public function update(Page $page, Request $request, array &$fields)
{
$rules = $this->rules(false);
- if ($fields['order'] == null){
+ if ($fields['order'] == null) {
$fields['order'] = 0;
}
- if ($fields['reference_id'] != null){
+ if ($fields['reference_id'] != null) {
$rules['reference_id'] = 'exists:pages,id';
}
- if ($fields['previous_id'] != null){
+ if ($fields['previous_id'] != null) {
$rules['previous_id'] = 'exists:pages,id';
}
- if ($fields['up_id'] != null){
+ if ($fields['up_id'] != null) {
$rules['up_id'] = 'exists:pages,id';
}
- if ($fields['next_id'] != null){
+ if ($fields['next_id'] != null) {
$rules['next_id'] = 'exists:pages,id';
}
$validator = Validator::make($fields, $rules);
--- /dev/null
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Helpers\TextProcessor;
+use App\Models\File;
+use App\Models\Note;
+use App\Models\Page;
+use App\Models\Group;
+use App\Models\Module;
+use App\Helpers\Helper;
+use App\Helpers\DbHelper;
+use App\Models\SProperty;
+use App\Helpers\FileHelper;
+use App\Helpers\Pagination;
+use App\Helpers\ViewHelper;
+use Illuminate\Http\Request;
+use App\Helpers\ViewHelperLocal;
+use App\Helpers\ContextLaraKnife;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Route;
+use Illuminate\Support\Facades\Validator;
+
+class TaskController extends Controller
+{
+ protected $noteId = null;
+ protected $pageId = null;
+ public static function generate(int $noteId, int $pageId = null)
+ {
+ $rc = new TaskController();
+
+ $rc->noteId = $noteId;
+ $rc->pageId = $pageId;
+ return $rc;
+ }
+ public function create(Request $request)
+ {
+ $rc = null;
+ if ($request->btnSubmit === 'btnCancel') {
+ $rc = redirect('/note-index');
+ } else {
+ $fields = $request->all();
+ $pageId = array_key_exists('page_id', $fields) ? $fields['page_id'] : null;
+ if (count($fields) <= 1) {
+ $fields = [
+ 'title' => '',
+ 'body' => '',
+ 'category_scope' => '1054',
+ 'visibility_scope' => '1091',
+ 'owner_id' => strval(auth()->id()),
+ 'task' => ''
+ ];
+ }
+ if ($pageId != null) {
+ $page = Page::find(intval($pageId));
+ if ($page != null) {
+ $fields['title'] = __('Task') . ": $page->title";
+ $fields['options'] = "ref-page=$page->id";
+ }
+ }
+ if ($request->btnSubmit === 'btnStore') {
+ $validator = Validator::make($fields, ['title' => 'required', 'task' => 'required']);
+ if ($validator->fails()) {
+ $rc = back()->withErrors($validator)->withInput();
+ } else {
+ $fields['notestatus_scope'] = 1011;
+ $fields['options'] .= "\ntask=" . $fields['task'];
+ $fields['owner_id'] = auth()->id();
+ $task = Note::create($fields);
+ $rc = redirect("/note-edit/$task->id");
+ }
+ }
+ if ($rc == null) {
+ $optionsVisibility = SProperty::optionsByScope('visibility', $fields['visibility_scope']);
+ $optionsTask = SProperty::optionsByScope('task', $fields['task'], '-');
+ $optionsCategory = SProperty::optionsByScope('category', $fields['category_scope']);
+ $context = new ContextLaraKnife($request, $fields);
+ $rc = view('task.create', [
+ 'context' => $context,
+ 'optionsVisibility' => $optionsVisibility,
+ 'optionsTask' => $optionsTask,
+ 'optionsCategory' => $optionsCategory,
+ ]);
+ }
+ }
+ return $rc;
+ }
+ public function editSnake(Note $note, Page $page, Request $request)
+ {
+ if ($request->btnSubmit === 'btnCancel') {
+ $rc = redirect('/page-index');
+ } else {
+ $fields = $request->all();
+ if (count($fields) <= 1) {
+ $fields['snaketext'] = TextProcessor::compressSnakeText($page->body);
+ $fields['solution'] = $note->body != null && $note->body !== '' ? $note->body : $fields['snaketext'];
+ if ($page != null && $note != null) {
+ $fields['pageId'] = $page->id;
+ }
+ }
+ if ($request->btnSubmit === 'btnStore') {
+ $note->update(['body' => $fields['solution']]);
+ }
+ $navigationTabInfo = ViewHelperLocal::getNavigationTabInfo('note-edit', 3, $note->id, $note->options);
+ $context = new ContextLaraKnife($request, $fields, $note);
+ $context->model2 = $page;
+ $rc = view('task.edit_snake', [
+ 'context' => $context,
+ 'navTabsInfo' => $navigationTabInfo
+ ]);
+ }
+ return $rc;
+
+ }
+
+ public static function routes()
+ {
+ Route::get('/task-create', [TaskController::class, 'create'])->middleware('auth');
+ 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');
+ }
+
+}
+
--- /dev/null
+../../vendor/hamatoma/laraknife/resources/mail/NoteNotification.php
\ No newline at end of file
"dist": {
"type": "path",
"url": "../laraknife",
- "reference": "51702fba5a786ac71dd1628e7aee3aae747d6003"
+ "reference": "25dda6c582df04ebf4ed061d2311d3612001e5fb"
},
"require-dev": {
"phpunit/phpunit": "11.0.x-dev"
"Creation of a Page": "Erstellen einer Seite",
"Creation of a Role": "Erstellen eine Rolle",
"Creation of a Scoped Property": "Erzeugen einer bereichsbasierten Eigenschaft",
+ "Creation of a Task": "Erstellen einer Aufgabe",
"Creation of a Term": "Erstellen eines Termins",
"Creation of a Word": "Neues Wort",
"Creation of an User": "Erstellen eines Benutzers",
"Groups": "Gruppen",
"Hello": "Hallo",
"Id": "Id",
- "Imperfect": "Imperfekt",
"Imprint": "Impressum",
"Info": "Info",
"Insert Position": "Einf\u00fcgeposition",
"Participle": "Partizip",
"Password": "Passwort",
"Password forgotten?": "Passwort vergessen?",
+ "Past tense": "Pr\u00e4teritum",
"Phrase": "Satz",
"Phrases": "S\u00e4tze",
"Please use the following link and change your password:": "Bitte benutze den folgenden Verweis und \u00e4ndere dein Passwort",
"Shift": "Verschiebung",
"Shortname": "Kurzname",
"Size (MByte)": "Gr\u00f6\u00dfe (MByte)",
+ "Snaketext": "Schlangentext",
+ "Solution": "L\u00f6sung",
"Someone has requested a password reset.": "Jemand hat das Zur\u00fccksetzen des Passworts angefordert.",
"Start Menu": "Startmen\u00fc",
"Status": "Status",
"Store": "Speichern",
"Store Menu": "Men\u00fc speichern",
"Superlative": "Superlativ",
+ "Task": "Aufgabe",
"Term": "Termin",
"Terms": "Termine",
"Text": "Text",
"active": "aktiv",
"chapter": "Kapitel",
"closed": "geschlossen",
+ "cloze": "L\u00fcckentext",
"cloze text": "L\u00fcckentext",
+ "description": "Beschreibung",
"feminine": "Femininum",
"free text": "Freier Text",
"grammar rules": "Grammatikregeln",
"section": "Bereich",
"snaketext": "Schlangentext",
"standard": "Standard",
+ "task": "Aufgabe",
"work": "Arbeit"
}
\ No newline at end of file
padding: 0.25rem;
color: white;
text-align: center;
- background-color: blue;
- border-bottom: solid 0.1rem blue;
+ background-color: #fdaf40;
+ border-bottom: solid 0.1rem #ffac03;;
border-radius: 0.25rem;
}
.lkn-text h2, .lkn-text h3{
/* color: rgb(213, 78, 29); */
- color: blue;
- border-bottom: solid 0.1rem blue;
+ color: #fdaf40;
+ border-bottom: solid 0.1rem #fdaf40;
+}
.lkn-text h4, .lkn-text h5{
+ color: #d86d0c;
+}
+#lkn-header { background-color: #4cb2be; color: white;}
+.lkn-text-frame-background{ background-color: #fdaf40 !important }
+.lkn-noform-frame,
+.lkn-standard-panel,
+.lkn-edit-panel,
+.lkn-create-panel,
+.lkn-show-panel,
+.lkn-panel,
+.lkn-nav-tab-panel,
+#main-content li.lkn-nav-item-active,
+.lkn-filter,
+.lkn-fieldset,
+.lkn-form-table,
+.lkn-filter,
+.lkn-fieldset,
+.lkn-form-table,
+.lkn-text-frame,
+.lkn-header-frame,
+.lkn-pagination-block
+{
+ background-color: #fdaf4030;
+}
+.lkn-page-item.active .lkn-page-link {
+ background-color: #ffac03;
+ border-color: #ffac03;
+}
+.lkn-field-error {
+ color: red;
+}
+a.lnk-overview-cell,
+a:visited.lkn-overview-cell,
+a:link.lkn-overview-cell,
+a:active.lkn-overview-cell {
+ border: 1px solid #ffac03;
+ color: #ffac03;;
+ box-shadow: 0 0 5px 0 #ffac03;
+}
+a.lkn-overview-cell,
+a:visited.lkn-overview-cell,
+a:link.lkn-overview-cell,
+a:active.lkn-overview-cell {
+ background-color: #EEE;
+ color: #ffac03;
+}
+#main-content .nav-item {
+ background-color: #EEE;
+}
+.lkn-text-info {
+ color: #ffac03;
+}
+.lkn-text-info2 {
+ color: green;
+}
+.lkn-text-info3 {
color: blue;
-}
\ No newline at end of file
+}
+.lkn-text-info4 {
+ color: cyan;
+}
+.lkn-text-error {
+ color: red;
+ background-color: yellow;
+}
+.lkn-text-warning {
+ color: green;
+ background-color: yellow;
+}
+.lkn-text-important {
+ color: red;
+}
+.lkn-text-tagged {
+ background-color: rgba(255, 166, 0, 0.418);
+}
+.lkn-text-tagged2 {
+ background-color: yellow;
+}
+.lkn-header-frame h1, .text-header-frame h2, .text-header-frame h3 {
+ color: whitesmoke;
+ background-color: #fdaf40;
+}
+.lkn-ins {
+ background-color: lightblue;
+}
+.lkn-del {
+ background-color: rgba(255, 166, 0, 0.418);
+}
+button.bg-primary {
+ background-color: #fdaf40 !important;
+}
+a, a:active.nav-item, a:link.nav-item, a:visited.nav-item, a:any-link.nav-item { color: #fdaf40; }
+.bi {
+ color: #fdaf40 !important;
+}
+nav a:active, nav a:link, nav a:visited, nav a:any-link {
+ color: white;
+}
+.page-link { color: black !important; background-color: #fdaf4030;; }
+.page-link.active, .active > .page-link { background-color: #fdaf40; }
+.page-item { color: black; background-color: #EEE; }
\ No newline at end of file
"chapter": "Kapitel",
"Chapter": "Kapitel",
"Chapters": "Kapitel",
+"cloze": "Lückentext",
"cloze text": "Lückentext",
"Comparative": "Komparativ",
"Contents": "Inhalt",
"Phrases": "Sätze",
"Preposition": "Präposition",
"snaketext": "Schlangentext",
+"Snaketext": "Schlangentext",
+"Solution": "Lösung",
"Superlative": "Superlativ",
"Translation": "Übersetzung",
"Verb": "Verb",
</head>
<body>
<header>
- <nav class="navbar navbar-expand-md bg-primary ">
+ <nav id="lkn-header" class="navbar navbar-expand-md ga-bg-primary">
<a class="navbar-brand" href="/menuitem-menu_main"><img id="img-logo" alt="Logo" src="/img/logo_64.png"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</head>
<body class="lkn-text-frame-background">
<header>
- <nav class="navbar navbar-expand-md bg-primary ">
+ <nav id="lkn-header" class="lkn-navbar navbar navbar-expand-md">
<a class="navbar-brand" href="/menuitem-menu_main"><img id="img-logo" alt="Logo" src="/img/logo_64.png"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
--- /dev/null
+../../../vendor/hamatoma/laraknife/resources/views/mails/note-notification.blade.php
\ No newline at end of file
<tbody>
@foreach ($records as $page)
<tr>
- <td><x-laraknife.icons.change-record module="page" no="{{ $page->id }}" /></td>
+ <td><x-laraknife.icons.change-record module="page" no="{{ $page->id }}" />
+ {!! $context->taskHelper('page-index-icon', strval($page->id)) !!}
+ </td>
<td> {{ __($page->id) }}</td>
<td><a href="/page-showpretty/{{ $page->id }}">{{$page->title}}</a></td>
<td> {{ __($page->pagetype) }}</td>
--- /dev/null
+@extends('layouts.backend')
+
+@section('content')
+ <form id="note-create" action="/task-create" method="POST">
+ @csrf
+ <x-laraknife.panels.create title="{{ __('Creation of a Task') }}">
+ <input type="hidden" name="options" value="{{ $context->valueOf('options') }}">
+ <x-laraknife.forms.combobox position="first" name="category_scope" label="Category" :options="$optionsCategory"
+ 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.text position="alone" name="body" label="Body" value="{{ $context->valueOf('body') }}"
+ width2="10" rows="10" />
+ <x-laraknife.forms.combobox position="first" name="task" label="Task" :options="$optionsTask"
+ width2="4" />
+ </x-laraknife.panels.create>
+ </form>
+@endsection
--- /dev/null
+@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">
+ @csrf
+ <x-laraknife.panels.edit title="{{ __('Change of a Task') }}">
+ <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="contents" label="Snaketext"
+ value="{{ $context->valueOf('snaketext') }}" width2="10" rows="4" 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" />
+ @if ($context->valueOf('note') != null)
+ <x-laraknife.forms.const-text text="" width2="10" />
+ @endif
+ </x-laraknife.layout.nav-tabs>
+ </x-laraknife.panels.edit>
+ @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