summaryrefslogtreecommitdiffstats
path: root/modules-available/dozmod
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-21 18:23:11 +0200
committerSimon Rettberg2017-04-21 18:23:11 +0200
commit89370704762a0c9b76c3ad9d69ef0a737229e351 (patch)
tree30fafe596b7eb6c336fe3690a622e777601829d2 /modules-available/dozmod
parentUpdate phpStorm stuff (diff)
downloadslx-admin-89370704762a0c9b76c3ad9d69ef0a737229e351.tar.gz
slx-admin-89370704762a0c9b76c3ad9d69ef0a737229e351.tar.xz
slx-admin-89370704762a0c9b76c3ad9d69ef0a737229e351.zip
[dozmod] Make images pending deletion an extra section
Diffstat (limited to 'modules-available/dozmod')
-rw-r--r--modules-available/dozmod/page.inc.php61
1 files changed, 37 insertions, 24 deletions
diff --git a/modules-available/dozmod/page.inc.php b/modules-available/dozmod/page.inc.php
index 7f1e6ee3..9635aef1 100644
--- a/modules-available/dozmod/page.inc.php
+++ b/modules-available/dozmod/page.inc.php
@@ -32,7 +32,25 @@ class Page_DozMod extends Page
Util::redirect('?do=Main');
}
+ /* execute actions */
+ $action = Request::post('action', false, 'string');
+
+ if ($action === 'mail') {
+ $this->mailHandler();
+ } elseif ($action === 'runtime') {
+ $this->runtimeHandler();
+ } elseif ($action === 'delimages') {
+ $result = $this->handleDeleteImages();
+ if (!empty($result)) {
+ Message::addInfo('delete-images', $result);
+ }
+ Util::redirect('?do=DozMod');
+ } elseif ($action !== false) {
+ Util::traceError('Invalid action: ' . $action);
+ }
+
/* add sub-menus */
+ Dashboard::addSubmenu('?do=dozmod&section=expiredimages', Dictionary::translate('submenu_expiredimages', true));
Dashboard::addSubmenu('?do=dozmod&section=mailconfig', Dictionary::translate('submenu_mailconfig', true));
Dashboard::addSubmenu('?do=dozmod&section=templates', Dictionary::translate('submenu_templates', true));
Dashboard::addSubmenu('?do=dozmod&section=runtimeconfig', Dictionary::translate('submenu_runtime', true));
@@ -44,37 +62,34 @@ class Page_DozMod extends Page
$this->subPage->doPreprocess();
return;
}
-
- /* execute actions */
- $action = Request::post('action');
-
- if ($action === 'mail') {
- $this->mailHandler();
- }
- if ($action === 'runtime') {
- $this->runtimeHandler();
- }
- if ($action === 'delimages') {
- $result = $this->handleDeleteImages();
- if (!empty($result)) {
- Message::addInfo('delete-images', $result);
- }
- Util::redirect('?do=DozMod');
- }
}
protected function doRender()
{
- $this->listDeletePendingImages();
-
/* different pages for different sections */
if ($this->subPage !== false) {
$this->subPage->doRender();
return;
}
- $section = Request::get('section', 'mailconfig', 'string');
+ $section = Request::get('section', false, 'string');
+
+ if ($section === false || $section === 'expiredimages') {
+ $expiredImages = $this->loadExpiredImages();
+ if ($section === false && empty($expiredImages)) {
+ $section = 'mailconfig';
+ } else {
+ $section = 'expiredimages';
+ }
+ }
+ if ($section === 'expiredimages') {
+ if (empty($expiredImages)) {
+ Message::addSuccess('no-expired-images');
+ } else {
+ Render::addTemplate('images-delete', array('images' => $expiredImages));
+ }
+ }
if ($section === 'mailconfig') {
// Mail config
$mailConf = Database::queryFirst('SELECT value FROM sat.configuration WHERE parameter = :param', array('param' => 'mailconfig'));
@@ -140,7 +155,7 @@ class Page_DozMod extends Page
Render::addTemplate('blockstats', $data);
}
- private function listDeletePendingImages()
+ private function loadExpiredImages()
{
$res = Database::simpleQuery("SELECT b.displayname,"
. " own.firstname, own.lastname, own.email,"
@@ -168,9 +183,7 @@ class Page_DozMod extends Page
$row['filesize'] = Util::readableFileSize($row['filesize']);
$rows[] = $row;
}
- if (empty($rows))
- return;
- Render::addTemplate('images-delete', array('images' => $rows));
+ return $rows;
}
private function cleanMailArray()