aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Siegfried <ds.siegfried@gmail.com>2023-11-30 16:40:59 +0100
committerDavid Siegfried <ds.siegfried@gmail.com>2023-12-01 13:54:04 +0100
commit0b397e2e485424db566aebbb95eaf7c230b2dcf4 (patch)
treec7344dc06028b6ea87e346c8de7f6615b2f44b72
parent9e9384903c0d4fd5dacfa32f05edb7d1e8572463 (diff)
cleanup, re #2660
-rw-r--r--app/controllers/admin/login_faq.php74
-rw-r--r--app/controllers/admin/login_style.php (renamed from app/controllers/admin/loginstyle.php)11
-rw-r--r--app/views/admin/login_style/edit_faq.php7
-rw-r--r--app/views/admin/login_style/login_faq.php91
-rw-r--r--app/views/admin/login_style/newpic.php5
-rw-r--r--public/pictures/loginbackgrounds/9.pngbin0 -> 173856 bytes
-rw-r--r--templates/_standard_loginform.php10
7 files changed, 72 insertions, 126 deletions
diff --git a/app/controllers/admin/login_faq.php b/app/controllers/admin/login_faq.php
deleted file mode 100644
index 611277f..0000000
--- a/app/controllers/admin/login_faq.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * login_faq.php - controller class for administrating FAQ showing on login screen
- *
- * @author Michaela Brückner <brueckner@data-quest.de>
- * @license GPL2 or any later version
- * @category Stud.IP
- * @package admin
- * @since 5.5
- */
-class Admin_LoginFaqController extends AuthenticatedController
-{
- protected $_autobind = true;
- public function before_filter(&$action, &$args)
- {
- if ($action === 'add') {
- $action = 'edit';
- }
-
- parent::before_filter($action, $args);
- $GLOBALS['perm']->check('admin');
- PageLayout::setTitle(_('Hinweise zum Login'));
- Navigation::activateItem('/admin/locations/login_faq');
- }
-
- public function index_action()
- {
- $this->setupSidebar();
- $this->faq_entries = LoginFaq::findBySql('1');
- }
-
-
- public function edit_action(LoginFaq $entry = null)
- {
- PageLayout::setTitle(
- $entry->isNew() ? _('Hilfetext hinzufügen') : _('Hilfetext bearbeiten')
- );
- }
-
- public function store_action(LoginFaq $entry = null)
- {
- CSRFProtection::verifyRequest();
- $entry->setData([
- 'title' => Request::get('title'),
- 'description' => Request::get('description'),
- ]);
-
- if ($entry->store()) {
- PageLayout::postSuccess(_('Hilfetext wurde gespeichert.'));
- }
- $this->redirect($this->indexURL());
- }
-
- public function delete_action($faq_entry_id)
- {
- CSRFProtection::verifyRequest();
-
- if (LoginFaq::deleteBySQL('faq_id = ?', [$faq_entry_id])) {
- PageLayout::postSuccess(_("Der Hilfetext wurde gelöscht."));
- }
- $this->relocate($this->indexURL());
- }
-
- protected function setupSidebar()
- {
- $actions = new ActionsWidget();
- $actions->addLink(
- _('Hilfetext hinzufügen'),
- $this->edit_URL(),
- Icon::create('add')
- )->asDialog();
- Sidebar::get()->addWidget($actions);
- }
-}
diff --git a/app/controllers/admin/loginstyle.php b/app/controllers/admin/login_style.php
index 6358d26..7d379d9 100644
--- a/app/controllers/admin/loginstyle.php
+++ b/app/controllers/admin/login_style.php
@@ -36,7 +36,7 @@ class Admin_LoginStyleController extends AuthenticatedController
$views->addLink(
_('Hinweise zum Login'),
- $this->url_for('admin/loginstyle/login_faq')
+ $this->login_faqURL()
)->setActive($action === 'login_faq');
Sidebar::Get()->addWidget($views);
@@ -146,7 +146,7 @@ class Admin_LoginStyleController extends AuthenticatedController
} else {
PageLayout::postSuccess(_('Der Aktivierungsstatus konnte nicht gespeichert werden.'));
}
- $this->relocate('admin/loginstyle');
+ $this->relocate($this->indexURL());
}
@@ -184,11 +184,11 @@ class Admin_LoginStyleController extends AuthenticatedController
$this->relocate($this->login_faqURL());
}
- public function delete_faq_action($faq_entry_id)
+ public function delete_faq_action(LoginFaq $entry)
{
CSRFProtection::verifyRequest();
- if (LoginFaq::deleteBySQL('faq_id = ?', [$faq_entry_id])) {
+ if ($entry->delete()) {
PageLayout::postSuccess(_('Der Hilfetext wurde gelöscht'));
}
@@ -200,7 +200,6 @@ class Admin_LoginStyleController extends AuthenticatedController
*/
protected function setSidebar($action)
{
-
$links = new ActionsWidget();
if ($action === 'index') {
$links->addLink(
@@ -211,7 +210,7 @@ class Admin_LoginStyleController extends AuthenticatedController
} else if ($action === 'login_faq') {
$links->addLink(
_('Hilfetext hinzufügen'),
- $this->add_faqURL(),
+ $this->edit_faqURL(),
Icon::create('add')
)->asDialog();
}
diff --git a/app/views/admin/login_style/edit_faq.php b/app/views/admin/login_style/edit_faq.php
index 768434e..b31a7a5 100644
--- a/app/views/admin/login_style/edit_faq.php
+++ b/app/views/admin/login_style/edit_faq.php
@@ -8,14 +8,17 @@
method="post"
enctype="multipart/form-data"
class="default">
+ <?= CSRFProtection::tokenTag() ?>
- <label for="title">
+ <label class="studiprequired">
<?= _('Titel') ?>
+ <span title="Dies ist ein Pflichtfeld" aria-hidden="true" class="asterisk">*</span>
<input type="text" name="title" value="<?= htmlReady($entry->title) ?>" required>
</label>
- <label for="description">
+ <label class="studiprequired">
<?= _('Text') ?>
+ <span title="Dies ist ein Pflichtfeld" aria-hidden="true" class="asterisk">*</span>
<textarea name="description"
class="add_toolbar wysiwyg" data-editor="toolbar=minimal"><?= htmlReady($entry->description)?></textarea>
</label>
diff --git a/app/views/admin/login_style/login_faq.php b/app/views/admin/login_style/login_faq.php
index 7af48e7..351c22e 100644
--- a/app/views/admin/login_style/login_faq.php
+++ b/app/views/admin/login_style/login_faq.php
@@ -1,40 +1,59 @@
-<table class="default">
- <caption><?= _('Hinweise zum Login') ?></caption>
- <thead>
- <tr>
- <th><?= _('Titel') ?></th>
- <th class="actions"><?= _('Löschen') ?></th>
- </tr>
- </thead>
- <tbody>
- <? if (count($faq_entries) > 0) : ?>
- <? foreach ($faq_entries as $entry) : ?>
+<?php
+/**
+ * @var Admin_LoginStyleController $controller
+ * @var LoginFaq[] $faq_entries
+ */
+?>
+<form method="post">
+ <?= CSRFProtection::tokenTag() ?>
+ <table class="default">
+ <caption><?= _('Hinweise zum Login') ?></caption>
+ <thead>
+ <tr>
+ <th><?= _('Titel') ?></th>
+ <th class="actions"><?= _('Aktionen') ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <? if (count($faq_entries) > 0) : ?>
+ <? foreach ($faq_entries as $entry) : ?>
+ <tr>
+ <td><?= htmlReady($entry->title) ?></td>
+ <td class="actions">
+ <?= ActionMenu::get()
+ ->setContext($entry->title)
+ ->addLink(
+ $controller->edit_faqURL($entry),
+ _('Hinweistext bearbeiten'),
+ Icon::create('edit'),
+ [
+ 'data-dialog' => 'size=medium'
+ ]
+ )->addButton(
+ 'delete',
+ _('Hinweistext löschen'),
+ Icon::create('trash'),
+ [
+ 'formaction' => $controller->delete_faqURL($entry),
+ 'data-confirm' => sprintf(
+ _('Wollen Sie den Hinweistext "%s" wirklich löschen?'),
+ $entry->title
+ ),
+ 'data-dialog' => 'size=auto',
+ ]
+ )->render()
+ ?>
+ </td>
+ </tr>
+ <? endforeach ?>
+ <? else : ?>
<tr>
- <td><a href="<?= $controller->link_for("admin/loginstyle/edit_faq", ['entry_id' => $entry->getId()]) ?>" data-dialog="size=medium"><?= htmlReady($entry->title) ?></a></td>
- <td class="actions">
- <? $actionmenu = ActionMenu::get() ?>
- <? $actionmenu->addLink(
- $controller->url_for("admin/loginstyle/delete_faq/{$entry->getId()}"),
- _('Hinweistext löschen'),
- Icon::create('trash'),
- [
- 'data-confirm' => sprintf(
- _('Wollen Sie den Hinweistext "%s" wirklich löschen?'),
- $entry->title),
- 'data-dialog' => 'size=auto',
- ]
- ); ?>
- <?= $actionmenu->render() ?>
+ <td colspan="3" style="text-align: center">
+ <?= _('Keine Hilfetexte vorhanden') ?>
</td>
</tr>
- <? endforeach ?>
- <? else : ?>
- <tr>
- <td colspan="3" style="text-align: center">
- <?=_('Keine Hilfetexte vorhanden')?>
- </td>
- </tr>
- <? endif ?>
- </tbody>
+ <? endif ?>
+ </tbody>
-</table>
+ </table>
+</form>
diff --git a/app/views/admin/login_style/newpic.php b/app/views/admin/login_style/newpic.php
index 760848f..c5f7fbf 100644
--- a/app/views/admin/login_style/newpic.php
+++ b/app/views/admin/login_style/newpic.php
@@ -3,7 +3,8 @@
* @var Admin_LoginStyleController $controller
*/
?>
-<form class="default" action="<?= $controller->link_for('admin/loginstyle/add_pic') ?>" method="post" enctype="multipart/form-data">
+<form class="default" action="<?= $controller->add_pic() ?>" method="post" enctype="multipart/form-data">
+ <?= CSRFProtection::tokenTag() ?>
<fieldset>
<legend>
<?= _('Bild(er) hinzufügen') ?>
@@ -33,6 +34,6 @@
<footer data-dialog-button>
<?= CSRFProtection::tokenTag() ?>
<?= Studip\Button::createAccept(_('Speichern'), 'store') ?>
- <?= Studip\LinkButton::createCancel(_('Abbrechen'), $controller->url_for('loginstyle/index')) ?>
+ <?= Studip\LinkButton::createCancel(_('Abbrechen'), $controller->indexURL()) ?>
</footer>
</form>
diff --git a/public/pictures/loginbackgrounds/9.png b/public/pictures/loginbackgrounds/9.png
new file mode 100644
index 0000000..78039c0
--- /dev/null
+++ b/public/pictures/loginbackgrounds/9.png
Binary files differ
diff --git a/templates/_standard_loginform.php b/templates/_standard_loginform.php
index 1134b2e..94eef49 100644
--- a/templates/_standard_loginform.php
+++ b/templates/_standard_loginform.php
@@ -3,7 +3,7 @@
use Studip\Button;
?>
-<form class="default" name="login_form" id="login_form" method="post" action="<?= URLHelper::getLink(Request::url(), ['cancel_login' => NULL]) ?>" style="display: <?= $display ?>">
+<form class="default" name="login_form" id="login_form" method="post" action="<?= URLHelper::getLink(Request::url(), ['cancel_login' => null]) ?>" style="display: <?= $display ?>">
<section>
<label>
@@ -36,9 +36,9 @@ use Studip\Button;
required>
<i id="password-toggle" href=""
- <?= tooltip(_('Passwort zeigen/verstecken'), true) ?>>
- <?= Icon::create('visibility-checked')->asImg(20, ['id' => 'visible-password']) ?>
- <?= Icon::create('visibility-invisible')->asImg(20, ['id' => 'invisible-password']) ?>
+ <?= tooltip(_('Passwort zeigen/verstecken')) ?>>
+ <?= Icon::create('visibility-checked')->asImg(['id' => 'visible-password']) ?>
+ <?= Icon::create('visibility-invisible')->asImg(['id' => 'invisible-password']) ?>
</i>
</label>
@@ -59,6 +59,4 @@ use Studip\Button;
</a>
</div>
<?= Button::createAccept(_('Anmelden'), _('Login'), ['id' => 'submit_login']); ?>
-
-
</form>