summaryrefslogtreecommitdiffstats
path: root/modules/news.inc.php
diff options
context:
space:
mode:
authorJonathan Bauer2014-06-23 12:41:53 +0200
committerJonathan Bauer2014-06-23 12:41:53 +0200
commitf6cc509d0a8ccc4d6186d71564dad2e2184f2643 (patch)
tree87388332374e0e0cb1d30c34b1d3d2acf1bbd72b /modules/news.inc.php
parentminor - comments were misleading (diff)
downloadslx-admin-f6cc509d0a8ccc4d6186d71564dad2e2184f2643.tar.gz
slx-admin-f6cc509d0a8ccc4d6186d71564dad2e2184f2643.tar.xz
slx-admin-f6cc509d0a8ccc4d6186d71564dad2e2184f2643.zip
[news] added 'clear' button to clearup the form
Diffstat (limited to 'modules/news.inc.php')
-rw-r--r--modules/news.inc.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/news.inc.php b/modules/news.inc.php
index 3b7ef2bc..b5fad69b 100644
--- a/modules/news.inc.php
+++ b/modules/news.inc.php
@@ -20,7 +20,13 @@ class Page_News extends Page
// check which action we need to do
$action = Request::any('action', 'show');
- if ($action === 'show') {
+ if ($action === 'clear') {
+ // clear news input fields
+ $this->newsId = false;
+ $this->newsTitle = false;
+ $this->newsContent = false;
+ $this->newsDate = false;
+ } elseif ($action === 'show') {
// show news
if (!$this->loadNews(Request::any('newsid'))) {
Message::addError('news-empty');
@@ -86,7 +92,7 @@ class Page_News extends Page
// check if news content were set by the user
$newsTitle = Request::post('news-title');
$newsContent = Request::post('news-content');
- if ($newsContent !== false && $newsTitle !== false) {
+ if ($newsContent !== '' && $newsTitle !== '') {
// we got title and content, save it to DB
Database::exec("INSERT INTO news (dateline, title, content) VALUES (:dateline, :title, :content)", array(
'dateline' => time(),
@@ -96,6 +102,8 @@ class Page_News extends Page
// all done, redirect to main news page
Message::addSuccess('news-set-success');
Util::redirect('?do=News');
+ } else {
+ Message::addError('empty-field');
}
}