aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/course/room_requests.php11
-rw-r--r--app/views/course/room_requests/index.php16
-rw-r--r--app/views/course/timesrooms/_roomRequest.php172
3 files changed, 101 insertions, 98 deletions
diff --git a/app/controllers/course/room_requests.php b/app/controllers/course/room_requests.php
index 166bb84..22985fe 100644
--- a/app/controllers/course/room_requests.php
+++ b/app/controllers/course/room_requests.php
@@ -18,6 +18,8 @@
class Course_RoomRequestsController extends AuthenticatedController
{
+ protected $_autobind = true;
+
/**
* Common tasks for all actions
*
@@ -618,16 +620,12 @@ class Course_RoomRequestsController extends AuthenticatedController
/**
* delete one room request
*/
- public function delete_action($request_id)
+ public function delete_action(RoomRequest $request)
{
- $request = RoomRequest::find($request_id);
- if (!$request) {
- throw new Trails\Exception(403);
- }
if (Request::isGet()) {
PageLayout::postQuestion(sprintf(
_('Möchten Sie die Raumanfrage "%s" löschen?'),
- htmlReady($request->getTypeString())), $this->url_for('course/room_requests/delete/' . $request_id));
+ htmlReady($request->getTypeString())), $this->url_for('course/room_requests/delete/' . $request->id));
} else {
CSRFProtection::verifyUnsafeRequest();
if (Request::submitted('yes')) {
@@ -636,6 +634,7 @@ class Course_RoomRequestsController extends AuthenticatedController
}
}
}
+
$this->redirect('course/timesrooms/index');
}
diff --git a/app/views/course/room_requests/index.php b/app/views/course/room_requests/index.php
index 0b8fec2..1b3707c 100644
--- a/app/views/course/room_requests/index.php
+++ b/app/views/course/room_requests/index.php
@@ -92,16 +92,14 @@ echo $flash['message'];
['data-dialog' => '1']
) ?>
<? endif ?>
- <? $actionMenu->addLink(
- $controller->url_for('course/room_requests/delete/' . $rr->id),
+ <? $actionMenu->addButton(
+ 'delete',
_('Diese Anfrage löschen'),
- Icon::create(
- 'trash',
- Icon::ROLE_CLICKABLE,
- [
- 'title' => _('Diese Anfrage löschen')
- ]
- )
+ Icon::create('trash'),
+ [
+ 'data-confirm' => sprintf(_('Möchten Sie die Raumanfrage "%s" löschen?'), $rr->getTypeString()),
+ 'formaction' => $controller->deleteURL($rr),
+ ]
) ?>
<?= $actionMenu->render() ?>
</td>
diff --git a/app/views/course/timesrooms/_roomRequest.php b/app/views/course/timesrooms/_roomRequest.php
index ffa72b0..df85a56 100644
--- a/app/views/course/timesrooms/_roomRequest.php
+++ b/app/views/course/timesrooms/_roomRequest.php
@@ -28,93 +28,99 @@
<? if (count($room_requests)) : ?>
<section>
- <table class="default sortable-table">
- <colgroup>
- <col style="width: 40%">
- <col style="width: 20%">
- <col>
- <col style="width: 50px">
- </colgroup>
- <thead>
- <tr class="sortable">
- <th data-sort="text"><?= _('Art der Anfrage') ?></th>
- <th data-sort="text"><?= _('Angefragt von') ?></th>
- <th data-sort="text"><?= _('Bearbeitungsstatus') ?></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <? foreach ($room_requests as $rr): ?>
- <tr>
- <td>
- <?= htmlReady($rr->getTypeString(), 1, 1) ?>
- </td>
- <td>
- <?= htmlReady($rr->user ? $rr->user->getFullName() : '') ?>
- </td>
- <td>
- <?= htmlReady($rr->getStatusText()) ?>
- </td>
- <td class="actions">
- <a class="load-in-new-row"
- href="<?= $controller->link_for('course/room_requests/info/' . $rr->id) ?>"
- aria-expanded="false">
- <?= Icon::create('info')->asImg(['title' => _('Weitere Informationen einblenden')]) ?>
- </a>
- <? $params = [] ?>
- <? $dialog = []; ?>
- <? if (Request::isXhr()) : ?>
- <? $params['asDialog'] = true; ?>
- <? $dialog['data-dialog'] = 'size=big' ?>
- <? endif ?>
+ <form method="post">
+ <?= CSRFProtection::tokenTag() ?>
+ <table class="default sortable-table">
+ <colgroup>
+ <col style="width: 40%">
+ <col style="width: 20%">
+ <col>
+ <col style="width: 50px">
+ </colgroup>
+ <thead>
+ <tr class="sortable">
+ <th data-sort="text"><?= _('Art der Anfrage') ?></th>
+ <th data-sort="text"><?= _('Angefragt von') ?></th>
+ <th data-sort="text"><?= _('Bearbeitungsstatus') ?></th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <? foreach ($room_requests as $rr): ?>
+ <tr>
+ <td>
+ <?= htmlReady($rr->getTypeString(), 1, 1) ?>
+ </td>
+ <td>
+ <?= htmlReady($rr->user ? $rr->user->getFullName() : '') ?>
+ </td>
+ <td>
+ <?= htmlReady($rr->getStatusText()) ?>
+ </td>
+ <td class="actions">
+ <a class="load-in-new-row"
+ href="<?= $controller->link_for('course/room_requests/info/' . $rr->id) ?>"
+ aria-expanded="false">
+ <?= Icon::create('info')->asImg(['title' => _('Weitere Informationen einblenden')]) ?>
+ </a>
+ <? $params = [] ?>
+ <? $dialog = []; ?>
+ <? if (Request::isXhr()) : ?>
+ <? $params['asDialog'] = true; ?>
+ <? $dialog['data-dialog'] = 'size=big' ?>
+ <? endif ?>
- <? $actionMenu = ActionMenu::get()->setContext($rr->getTypeString()) ?>
- <? $actionMenu->addLink(
- $controller->url_for('course/room_requests/request_show_summary/' . $rr->id, ['clear_cache' => 1]),
- _('Diese Anfrage bearbeiten'),
- Icon::create('edit'),
- ['title' => _('Diese Anfrage bearbeiten'), 'data-dialog' => 'size=big']
- ) ?>
+ <? $actionMenu = ActionMenu::get()->setContext($rr->getTypeString()) ?>
+ <? $actionMenu->addLink(
+ $controller->url_for('course/room_requests/request_show_summary/' . $rr->id, ['clear_cache' => 1]),
+ _('Diese Anfrage bearbeiten'),
+ Icon::create('edit'),
+ ['title' => _('Diese Anfrage bearbeiten'), 'data-dialog' => 'size=big']
+ ) ?>
- <?php
- if ($rr->room && !$user_has_permissions) {
- $user_has_permissions = $rr->room->userHasPermission($current_user, 'admin');
- }
- ?>
+ <?php
+ if ($rr->room && !$user_has_permissions) {
+ $user_has_permissions = $rr->room->userHasPermission($current_user, 'admin');
+ }
+ ?>
- <? if ($user_has_permissions && !$rr->closed): ?>
- <? $actionMenu->addLink(
- URLHelper::getURL(
- 'dispatch.php/resources/room_request/resolve/' . $rr->id,
- [
- 'reload-on-close' => 1,
- 'single-request' => 1
- ]
- ),
- _('Diese Anfrage selbst auflösen'),
- Icon::create('admin'),
- ['title' => _('Diese Anfrage selbst auflösen'), 'data-dialog' => '']
+ <? if ($user_has_permissions && !$rr->closed): ?>
+ <? $actionMenu->addLink(
+ URLHelper::getURL(
+ 'dispatch.php/resources/room_request/resolve/' . $rr->id,
+ [
+ 'reload-on-close' => 1,
+ 'single-request' => 1
+ ]
+ ),
+ _('Diese Anfrage selbst auflösen'),
+ Icon::create('admin'),
+ ['title' => _('Diese Anfrage selbst auflösen'), 'data-dialog' => '']
+ ) ?>
+ <? endif ?>
+ <? $actionMenu->addButton(
+ 'delete',
+ _('Diese Anfrage löschen'),
+ Icon::create('trash'),
+ [
+ 'data-confirm' => sprintf(_('Möchten Sie die Raumanfrage "%s" löschen?'), $rr->getTypeString()),
+ 'formaction' => $controller->url_for('course/room_requests/delete', $rr),
+ ]
) ?>
- <? endif ?>
- <? $actionMenu->addLink(
- $controller->url_for('course/room_requests/delete/' . $rr->id),
- _('Diese Anfrage löschen'),
- Icon::create('trash'),
- ['title' => _('Diese Anfrage löschen')]
- ) ?>
- <?= $actionMenu->render() ?>
- </td>
- </tr>
- <? endforeach ?>
- <? if (isset($request_id) && $request_id === $rr->id) : ?>
- <tr>
- <td colspan="4">
- <?= $this->render_partial('course/room_requests/_request.php', ['request' => $rr]); ?>
- </td>
- </tr>
- <? endif ?>
- </tbody>
- </table>
+ <?= $actionMenu->render() ?>
+ </td>
+ </tr>
+ <? endforeach ?>
+ <? if (isset($request_id) && $request_id === $rr->id) : ?>
+ <tr>
+ <td colspan="4">
+ <?= $this->render_partial('course/room_requests/_request.php', ['request' => $rr]); ?>
+ </td>
+ </tr>
+ <? endif ?>
+ </tbody>
+ </table>
+ </form>
</section>
<? else : ?>
<?= MessageBox::info(_('Zu dieser Veranstaltung sind noch keine Raumanfragen vorhanden.')) ?>