Templating

This commit is contained in:
Dennis Eichhorn 2018-05-09 20:46:03 +02:00
parent e3fd863669
commit 3b8d21c78f
4 changed files with 19 additions and 11 deletions

View File

@ -187,6 +187,12 @@ class Controller extends ModuleAbstract implements WebInterface
$view->addData('task', $task);
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response));
$accGrpSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app, $request, $response);
$view->addData('accGrpSelector', $accGrpSelector);
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app, $request, $response);
$view->addData('editor', $editor);
return $view;
}
@ -256,7 +262,7 @@ class Controller extends ModuleAbstract implements WebInterface
{
$val = [];
if (($val['title'] = empty($request->getData('title')))
|| ($val['description'] = empty($request->getData('description')))
|| ($val['plain'] = empty($request->getData('plain')))
|| ($val['due'] = !((bool) strtotime((string) $request->getData('due'))))
|| ($val['forward'] = !(is_numeric($request->getData('forward') ?? 0)))
) {
@ -317,8 +323,8 @@ class Controller extends ModuleAbstract implements WebInterface
{
$task = new Task();
$task->setTitle((string) ($request->getData('title') ?? ''));
$task->setDescription(Markdown::parse((string) ($request->getData('description') ?? '')));
$task->setDescriptionRaw((string) ($request->getData('description') ?? ''));
$task->setDescription(Markdown::parse((string) ($request->getData('plain') ?? '')));
$task->setDescriptionRaw((string) ($request->getData('plain') ?? ''));
$task->setCreatedBy($request->getHeader()->getAccount());
$task->setDue(new \DateTime((string) ($request->getData('due') ?? 'now')));
$task->setStatus(TaskStatus::OPEN);

View File

@ -47,8 +47,8 @@ echo $this->getData('nav')->render(); ?>
<tr><td><label for="iTitle"><?= $this->getHtml('Title') ?></label>
<tr><td><input type="text" id="iTitle" name="title" placeholder="&#xf040; <?= $this->getHtml('Title') ?>" required>
<tr><td><label for="iMessage"><?= $this->getHtml('Message') ?></label>
<tr><td><?= $this->getData('editor')->render('task-editor-tools'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('task-editor-text', 'plain', 'fTask'); ?>
<tr><td><?= $this->getData('editor')->render('task-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('task-editor', 'plain', 'fTask'); ?>
<tr><td>
<input type="submit" value="<?= $this->getHtml('Create', 0, 0); ?>">
<input type="hidden" name="type" value="<?= $this->printHtml(TaskType::SINGLE); ?>">

View File

@ -35,7 +35,7 @@ echo $this->getData('nav')->render(); ?>
</div>
<header><h1><?= $this->printHtml($task->getTitle()); ?></h1></header>
<div class="inner">
<?= $this->printHtml($task->getDescription()); ?>
<?= $task->getDescription(); ?>
</div>
<?php if (!empty($taskMedia)) : ?>
@ -65,7 +65,7 @@ echo $this->getData('nav')->render(); ?>
<?php if ($element->getDescription() !== '') : ?>
<div class="inner">
<?= $this->printHtml($element->getDescription()); ?>
<?= $element->getDescription(); ?>
</div>
<?php endif; ?>
@ -98,9 +98,10 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<div class="inner">
<form id="taskElementCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/task/element?{?}&csrf={$CSRF}'); ?>">
<table class="layout wf-100">
<table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iMessage"><?= $this->getHtml('Message') ?></label>
<tr><td><textarea id="iMessage" name="description"></textarea>
<tr><td><?= $this->getData('editor')->render('task-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('task-editor', 'plain', 'fTask'); ?>
<tr><td><label for="iDue"><?= $this->getHtml('Due') ?></label>
<tr><td><input type="datetime-local" id="iDue" name="due" value="<?= $this->printHtml(!empty($elements) ? end($elements)->getDue()->format('Y-m-d\TH:i:s') : $task->getDue()->format('Y-m-d\TH:i:s')); ?>">
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
@ -112,7 +113,7 @@ echo $this->getData('nav')->render(); ?>
<option value="<?= $this->printHtml(TaskStatus::DONE); ?>">Done
</select>
<tr><td><label for="iReceiver"><?= $this->getHtml('To') ?></label>
<tr><td><input type="text" id="iReceiver" name="forward" value="<?= $this->printHtml($this->request->getHeader()->getAccount()); ?>" placeholder="&#xf007; Guest">
<tr><td><?= $this->getData('accGrpSelector')->render('iReceiver', true); ?>
<tr><td><label for="iMedia"><?= $this->getHtml('Media') ?></label>
<tr><td><div class="ipt-wrap">
<div class="ipt-first"><input type="text" id="iMedia" placeholder="&#xf15b; File"></div>

View File

@ -19,7 +19,8 @@
"dependencies": {
"Admin": "1.0.0",
"Calendar": "1.0.0",
"Media": "1.0.0"
"Media": "1.0.0",
"Editor": "1.0.0"
},
"providing": {
"Navigation": "*"