Browse Source

Bootstrap adaptation for simple news page type

pull/2/head
Mark (ilosuna) 12 years ago
parent
commit
97e430c540
9 changed files with 97 additions and 64 deletions
  1. BIN
      cms/data/content.sqlite
  2. BIN
      cms/data/entries.sqlite
  3. BIN
      cms/data/userdata.sqlite
  4. +20
    -20
      cms/includes/page_types/simple_news.php
  5. +2
    -2
      cms/lang/english.page.lang.php
  6. +1
    -1
      cms/templates/subtemplates/formmailer.inc.tpl
  7. +69
    -40
      cms/templates/subtemplates/simple_news.inc.tpl
  8. +2
    -0
      static/css/style.css
  9. +3
    -1
      static/js/admin_frontend.js

BIN
cms/data/content.sqlite View File


BIN
cms/data/entries.sqlite View File


BIN
cms/data/userdata.sqlite View File


+ 20
- 20
cms/includes/page_types/simple_news.php View File

@ -1,5 +1,5 @@
<?php <?php
if($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) && $_GET['get_2']=='delete' && isset($_GET['get_3']) && $_GET['get_3']=='confirmed')
if($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) && $_GET['get_2']=='delete' && isset($_REQUEST['confirmed']))
{ {
$delete_id = $_GET['get_1']; $delete_id = $_GET['get_1'];
} }
@ -23,7 +23,7 @@ if($authorized_to_edit && isset($_POST['text']))
$title = isset($_POST['title']) ? trim($_POST['title']) : ''; $title = isset($_POST['title']) ? trim($_POST['title']) : '';
$teaser = isset($_POST['teaser']) ? trim($_POST['teaser']) : ''; $teaser = isset($_POST['teaser']) ? trim($_POST['teaser']) : '';
$text = isset($_POST['text']) ? trim($_POST['text']) : ''; $text = isset($_POST['text']) ? trim($_POST['text']) : '';
$text_formatting = isset($_POST['text_formatting']) && $_POST['text_formatting']==1 ? 1 : 0;
#$text_formatting = isset($_POST['text_formatting']) && $_POST['text_formatting']==1 ? 1 : 0;
$linkname = isset($_POST['linkname']) ? trim($_POST['linkname']) : ''; $linkname = isset($_POST['linkname']) ? trim($_POST['linkname']) : '';
$time = isset($_POST['time']) && trim($_POST['time'])!='' ? trim($_POST['time']) : date("Y-m-d H:i:s"); $time = isset($_POST['time']) && trim($_POST['time'])!='' ? trim($_POST['time']) : date("Y-m-d H:i:s");
@ -44,13 +44,13 @@ if($authorized_to_edit && isset($_POST['text']))
{ {
if(isset($_POST['id'])) if(isset($_POST['id']))
{ {
$dbr = Database::$content->prepare("UPDATE ".Database::$db_settings['news_table']." SET time=:time, title=:title, teaser=:teaser, text=:text, text_formatting=:text_formatting, linkname=:linkname WHERE id=:id");
$dbr = Database::$content->prepare("UPDATE ".Database::$db_settings['news_table']." SET time=:time, title=:title, teaser=:teaser, text=:text, linkname=:linkname WHERE id=:id");
$dbr->bindParam(':id', $_POST['id'], PDO::PARAM_INT); $dbr->bindParam(':id', $_POST['id'], PDO::PARAM_INT);
$dbr->bindParam(':time', $time, PDO::PARAM_INT); $dbr->bindParam(':time', $time, PDO::PARAM_INT);
$dbr->bindParam(':title', $title, PDO::PARAM_STR); $dbr->bindParam(':title', $title, PDO::PARAM_STR);
$dbr->bindParam(':teaser', $teaser, PDO::PARAM_STR); $dbr->bindParam(':teaser', $teaser, PDO::PARAM_STR);
$dbr->bindParam(':text', $text, PDO::PARAM_STR); $dbr->bindParam(':text', $text, PDO::PARAM_STR);
$dbr->bindParam(':text_formatting', $text_formatting, PDO::PARAM_INT);
#$dbr->bindParam(':text_formatting', $text_formatting, PDO::PARAM_INT);
$dbr->bindParam(':linkname', $linkname, PDO::PARAM_STR); $dbr->bindParam(':linkname', $linkname, PDO::PARAM_STR);
$dbr->execute(); $dbr->execute();
$id = $_POST['id']; $id = $_POST['id'];
@ -63,7 +63,7 @@ if($authorized_to_edit && isset($_POST['text']))
$dbr->bindParam(':title', $title, PDO::PARAM_STR); $dbr->bindParam(':title', $title, PDO::PARAM_STR);
$dbr->bindParam(':teaser', $teaser, PDO::PARAM_STR); $dbr->bindParam(':teaser', $teaser, PDO::PARAM_STR);
$dbr->bindParam(':text', $text, PDO::PARAM_STR); $dbr->bindParam(':text', $text, PDO::PARAM_STR);
$dbr->bindParam(':text_formatting', $text_formatting, PDO::PARAM_INT);
#$dbr->bindParam(':text_formatting', $text_formatting, PDO::PARAM_INT);
$dbr->bindParam(':linkname', $linkname, PDO::PARAM_STR); $dbr->bindParam(':linkname', $linkname, PDO::PARAM_STR);
$dbr->execute(); $dbr->execute();
#$id = $dbr->lastInsertId(); #$id = $dbr->lastInsertId();
@ -104,7 +104,7 @@ if($authorized_to_edit && isset($_POST['text']))
$edit_news['title'] = isset($_POST['title']) ? htmlspecialchars($_POST['title']) : ''; $edit_news['title'] = isset($_POST['title']) ? htmlspecialchars($_POST['title']) : '';
$edit_news['teaser'] = isset($_POST['teaser']) ? htmlspecialchars($_POST['teaser']) : ''; $edit_news['teaser'] = isset($_POST['teaser']) ? htmlspecialchars($_POST['teaser']) : '';
$edit_news['text'] = isset($_POST['text']) ? htmlspecialchars($_POST['text']) : ''; $edit_news['text'] = isset($_POST['text']) ? htmlspecialchars($_POST['text']) : '';
$edit_news['text_formatting'] = isset($_POST['text_formatting']) && $_POST['text_formatting']==1 ? 1 : 0;
#$edit_news['text_formatting'] = isset($_POST['text_formatting']) && $_POST['text_formatting']==1 ? 1 : 0;
$edit_news['link'] = isset($_POST['link']) ? htmlspecialchars($_POST['link']) : ''; $edit_news['link'] = isset($_POST['link']) ? htmlspecialchars($_POST['link']) : '';
$edit_news['linkname'] = isset($_POST['linkname']) ? htmlspecialchars($_POST['linkname']) : ''; $edit_news['linkname'] = isset($_POST['linkname']) ? htmlspecialchars($_POST['linkname']) : '';
$edit_news['time'] = isset($_POST['time']) ? htmlspecialchars($_POST['time']) : date("Y-m-d H:i:s"); $edit_news['time'] = isset($_POST['time']) ? htmlspecialchars($_POST['time']) : date("Y-m-d H:i:s");
@ -119,8 +119,8 @@ if($authorized_to_edit && isset($_POST['text']))
if($authorized_to_edit && isset($_GET['get_1']) && $_GET['get_1']=='add_item') if($authorized_to_edit && isset($_GET['get_1']) && $_GET['get_1']=='add_item')
{ {
$edit_news['text_formatting'] = $settings['default_formatting'];
$edit_news['text_formatting'] = 1;
#$edit_news['text_formatting'] = $settings['default_formatting'];
#$edit_news['text_formatting'] = 1;
$edit_news['linkname'] = Localization::$lang['simple_news_default_linkname']; $edit_news['linkname'] = Localization::$lang['simple_news_default_linkname'];
$edit_news['time'] = date("Y-m-d H:i:s", time()); $edit_news['time'] = date("Y-m-d H:i:s", time());
if($settings['wysiwyg_editor'] && isset($_SESSION[$settings['session_prefix'].'wysiwyg']) && $_SESSION[$settings['session_prefix'].'wysiwyg']==1) $template->assign('wysiwyg', true); if($settings['wysiwyg_editor'] && isset($_SESSION[$settings['session_prefix'].'wysiwyg']) && $_SESSION[$settings['session_prefix'].'wysiwyg']==1) $template->assign('wysiwyg', true);
@ -139,7 +139,7 @@ if($authorized_to_edit && isset($_GET['get_1']) && $_GET['get_1']=='add_item')
} }
elseif($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) && $_GET['get_2']=='edit') elseif($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) && $_GET['get_2']=='edit')
{ {
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, text_formatting, linkname FROM ".Database::$db_settings['news_table']." WHERE id=:id LIMIT 1");
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, linkname FROM ".Database::$db_settings['news_table']." WHERE id=:id LIMIT 1");
$dbr->bindParam(':id', $_GET['get_1'], PDO::PARAM_STR); $dbr->bindParam(':id', $_GET['get_1'], PDO::PARAM_STR);
$dbr->execute(); $dbr->execute();
$edit_news_item_data = $dbr->fetch(); $edit_news_item_data = $dbr->fetch();
@ -149,7 +149,7 @@ elseif($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) &&
$edit_news['title'] = htmlspecialchars($edit_news_item_data['title']); $edit_news['title'] = htmlspecialchars($edit_news_item_data['title']);
$edit_news['teaser'] = htmlspecialchars($edit_news_item_data['teaser']); $edit_news['teaser'] = htmlspecialchars($edit_news_item_data['teaser']);
$edit_news['text'] = htmlspecialchars($edit_news_item_data['text']); $edit_news['text'] = htmlspecialchars($edit_news_item_data['text']);
$edit_news['text_formatting'] = $edit_news_item_data['text_formatting'];
#$edit_news['text_formatting'] = $edit_news_item_data['text_formatting'];
$edit_news['linkname'] = htmlspecialchars($edit_news_item_data['linkname']); $edit_news['linkname'] = htmlspecialchars($edit_news_item_data['linkname']);
$edit_news['time'] = date("Y-m-d H:i:s", $edit_news_item_data['time']); $edit_news['time'] = date("Y-m-d H:i:s", $edit_news_item_data['time']);
$template->assign('edit_news', $edit_news); $template->assign('edit_news', $edit_news);
@ -177,7 +177,7 @@ elseif($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) &&
} }
elseif($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) && $_GET['get_2']=='delete') elseif($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) && $_GET['get_2']=='delete')
{ {
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, text_formatting, linkname FROM ".Database::$db_settings['news_table']." WHERE id=:id LIMIT 1");
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, linkname FROM ".Database::$db_settings['news_table']." WHERE id=:id LIMIT 1");
$dbr->bindParam(':id', $_GET['get_1'], PDO::PARAM_STR); $dbr->bindParam(':id', $_GET['get_1'], PDO::PARAM_STR);
$dbr->execute(); $dbr->execute();
$delete_news_item_data = $dbr->fetch(); $delete_news_item_data = $dbr->fetch();
@ -199,7 +199,7 @@ elseif($authorized_to_edit && isset($_GET['get_1']) && isset($_GET['get_2']) &&
elseif(isset($_GET['get_1']) && $_GET['get_1']=='rss') elseif(isset($_GET['get_1']) && $_GET['get_1']=='rss')
{ {
$rss = true; $rss = true;
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, text_formatting, linkname FROM ".Database::$db_settings['news_table']." WHERE page_id=:page_id AND time<=:now ORDER BY time DESC LIMIT ".$settings['rss_maximum_items']);
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, linkname FROM ".Database::$db_settings['news_table']." WHERE page_id=:page_id AND time<=:now ORDER BY time DESC LIMIT ".$settings['rss_maximum_items']);
$dbr->bindParam(':page_id', $data['id'], PDO::PARAM_STR); $dbr->bindParam(':page_id', $data['id'], PDO::PARAM_STR);
$dbr->bindValue(':now', time(), PDO::PARAM_STR); $dbr->bindValue(':now', time(), PDO::PARAM_STR);
$dbr->execute(); $dbr->execute();
@ -213,8 +213,8 @@ elseif(isset($_GET['get_1']) && $_GET['get_1']=='rss')
} }
else else
{ {
if($rss_data['text_formatting']==1) $rss_items[$i]['content'] = auto_html($rss_data['text']);
else $rss_items[$i]['content'] = $rss_data['text'];
#if($rss_data['text_formatting']==1) $rss_items[$i]['content'] = auto_html($rss_data['text']);
$rss_items[$i]['content'] = $rss_data['text'];
} }
$rss_items[$i]['linkname'] = htmlspecialchars($rss_data['linkname']); $rss_items[$i]['linkname'] = htmlspecialchars($rss_data['linkname']);
$rss_items[$i]['link'] = BASE_URL.PAGE.','.$rss_data['id']; $rss_items[$i]['link'] = BASE_URL.PAGE.','.$rss_data['id'];
@ -228,7 +228,7 @@ elseif(isset($_GET['get_1']) && $_GET['get_1']=='rss')
} }
elseif(isset($_GET['get_1']) && intval($_GET['get_1'])>0) // item opened elseif(isset($_GET['get_1']) && intval($_GET['get_1'])>0) // item opened
{ {
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, text_formatting FROM ".Database::$db_settings['news_table']." WHERE id=:id LIMIT 1");
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text FROM ".Database::$db_settings['news_table']." WHERE id=:id LIMIT 1");
$dbr->bindParam(':id', $_GET['get_1'], PDO::PARAM_STR); $dbr->bindParam(':id', $_GET['get_1'], PDO::PARAM_STR);
$dbr->execute(); $dbr->execute();
$note_data = $dbr->fetch(); $note_data = $dbr->fetch();
@ -237,8 +237,8 @@ elseif(isset($_GET['get_1']) && intval($_GET['get_1'])>0) // item opened
$news_item['id'] = $note_data['id']; $news_item['id'] = $note_data['id'];
$news_item['title'] = htmlspecialchars($note_data['title']); $news_item['title'] = htmlspecialchars($note_data['title']);
$news_item['teaser'] = htmlspecialchars($note_data['teaser']); $news_item['teaser'] = htmlspecialchars($note_data['teaser']);
if($note_data['text_formatting']==1) $news_item['text'] = auto_html($note_data['text']);
else $news_item['text'] = $note_data['text'];
#if($note_data['text_formatting']==1) $news_item['text'] = auto_html($note_data['text']);
$news_item['text'] = $note_data['text'];
$news_item['time'] = date("Y-m-d H:i:s", $note_data['time']); $news_item['time'] = date("Y-m-d H:i:s", $note_data['time']);
$template->assign('display_time', true); $template->assign('display_time', true);
$localization->replacePlaceholder('time', $note_data['time'], 'page_time', Localization::FORMAT_TIME); $localization->replacePlaceholder('time', $note_data['time'], 'page_time', Localization::FORMAT_TIME);
@ -280,7 +280,7 @@ else // overview
if($current_page<1) $current_page = 1; if($current_page<1) $current_page = 1;
if($current_page>$total_pages) $current_page = $total_pages; if($current_page>$total_pages) $current_page = $total_pages;
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, text_formatting, linkname FROM ".Database::$db_settings['news_table']." WHERE page_id=:page_id ORDER BY time DESC LIMIT ".(($current_page-1)*$settings['simple_news_per_page']).", ".$settings['simple_news_per_page']); // AND time<=:now
$dbr = Database::$content->prepare("SELECT id, time, title, teaser, text, linkname FROM ".Database::$db_settings['news_table']." WHERE page_id=:page_id ORDER BY time DESC LIMIT ".(($current_page-1)*$settings['simple_news_per_page']).", ".$settings['simple_news_per_page']); // AND time<=:now
$dbr->bindParam(':page_id', $data['id'], PDO::PARAM_STR); $dbr->bindParam(':page_id', $data['id'], PDO::PARAM_STR);
//$dbr->bindValue(':now', time(), PDO::PARAM_STR); //$dbr->bindValue(':now', time(), PDO::PARAM_STR);
$dbr->execute(); $dbr->execute();
@ -291,8 +291,8 @@ else // overview
$news[$i]['time'] = $news_data['time']; $news[$i]['time'] = $news_data['time'];
$news[$i]['title'] = $news_data['title']; $news[$i]['title'] = $news_data['title'];
$news[$i]['teaser'] = $news_data['teaser']; $news[$i]['teaser'] = $news_data['teaser'];
if($news_data['text_formatting']==1) $news[$i]['text'] = auto_html($news_data['text']);
else $news[$i]['text'] = $news_data['text'];
#if($news_data['text_formatting']==1) $news[$i]['text'] = auto_html($news_data['text']);
$news[$i]['text'] = $news_data['text'];
$news[$i]['linkname'] = $news_data['linkname']; $news[$i]['linkname'] = $news_data['linkname'];
$localization->bindReplacePlaceholder($news_data['id'], 'time', $news_data['time'], 'simple_news_time', Localization::FORMAT_TIME); $localization->bindReplacePlaceholder($news_data['id'], 'time', $news_data['time'], 'simple_news_time', Localization::FORMAT_TIME);
$i++; $i++;


+ 2
- 2
cms/lang/english.page.lang.php View File

@ -122,10 +122,10 @@ $lang['simple_news_edit_text_format'] = 'auto formatting';
$lang['simple_news_edit_linkname'] = 'Link name:'; $lang['simple_news_edit_linkname'] = 'Link name:';
$lang['simple_news_default_linkname'] = 'more…'; $lang['simple_news_default_linkname'] = 'more…';
$lang['simple_news_edit_time'] = 'Date/time:'; $lang['simple_news_edit_time'] = 'Date/time:';
$lang['simple_news_edit_time_format'] = '(YYYY-MM-DD HH:MM:SS)';
$lang['simple_news_edit_time_format'] = 'YYYY-MM-DD HH:MM:SS';
$lang['simple_news_add_item'] = 'Add entry'; $lang['simple_news_add_item'] = 'Add entry';
$lang['simple_news_edit_item'] = 'Edit item'; $lang['simple_news_edit_item'] = 'Edit item';
$lang['simple_news_delete_confirm'] = 'Do you really want to delete this entry?';
$lang['simple_news_delete_confirm'] = 'Delete this entry?';
$lang['error_news_no_title'] = 'No title specified'; $lang['error_news_no_title'] = 'No title specified';
$lang['error_news_no_text'] = 'No text entered'; $lang['error_news_no_text'] = 'No text entered';
$lang['error_news_time_invalid'] = 'invalid date/time format'; $lang['error_news_time_invalid'] = 'invalid date/time format';


+ 1
- 1
cms/templates/subtemplates/formmailer.inc.tpl View File

@ -34,7 +34,7 @@
<textarea id="message" class="form-control" name="message" rows="12"><?php if(isset($message)) echo $message; ?></textarea> <textarea id="message" class="form-control" name="message" rows="12"><?php if(isset($message)) echo $message; ?></textarea>
</div> </div>
<p><button class="btn btn-success btn-lg" type="submit"><span class="glyphicon glyphicon-envelope"></span> <?php echo $lang['formmailer_button_send']; ?></button></p>
<p><button class="btn btn-primary btn-lg" type="submit"><span class="glyphicon glyphicon-envelope"></span> <?php echo $lang['formmailer_button_send']; ?></button></p>
</div> </div>
</form> </form>


+ 69
- 40
cms/templates/subtemplates/simple_news.inc.tpl View File

@ -9,37 +9,56 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<form action="<?php echo BASE_URL . PAGE; ?>" method="post">
<div id="edit-news">
<input type="hidden" name="mode" value="news" />
<?php if(isset($edit_news['id'])): ?>
<input type="hidden" name="id" value="<?php echo $edit_news['id']; ?>" />
<?php endif; ?>
<form class="form-horizontal" action="<?php echo BASE_URL . PAGE; ?>" method="post">
<div>
<input type="hidden" name="mode" value="news" />
<input type="hidden" name="edit_news_submit" value="true" />
<?php if(isset($edit_news['id'])): ?>
<input type="hidden" name="id" value="<?php echo $edit_news['id']; ?>" />
<?php endif; ?>
<p><label for="title"><?php echo $lang['simple_news_edit_title']; ?></label><br />
<input id="title" type="text" name="title" value="<?php if(isset($edit_news['title'])) echo $edit_news['title']; ?>" size="40" /></p>
<div class="form-group">
<label for="title" class="col-md-2 control-label"><?php echo $lang['simple_news_edit_title']; ?></label>
<div class="col-md-10">
<input id="title" class="form-control" type="text" name="title" value="<?php if(isset($edit_news['title'])) echo $edit_news['title']; ?>">
</div>
</div>
<p><label for="teaser"><?php echo $lang['simple_news_edit_teaser']; ?></label><br />
<textarea id="teaser" name="teaser" cols="60" rows="3"><?php if(isset($edit_news['teaser'])) echo $edit_news['teaser']; ?></textarea></p>
<div class="form-group">
<label for="teaser" class="col-md-2 control-label"><?php echo $lang['simple_news_edit_teaser']; ?></label>
<div class="col-md-10">
<textarea id="teaser" class="form-control" name="teaser" rows="5"><?php if(isset($edit_news['teaser'])) echo $edit_news['teaser']; ?></textarea>
</div>
</div>
<?php if(isset($wysiwyg)): ?>
<p><label for="text"><?php echo $lang['simple_news_edit_text']; ?></label><br />
<textarea id="text" name="text" cols="60" rows="15"><?php if(isset($edit_news['text'])) echo $edit_news['text']; ?></textarea><input type="hidden" name="text_formatting" value="0" /></p>
<?php else: ?>
<p><label for="text"><?php echo $lang['simple_news_edit_text']; ?></label><br />
<textarea id="text" name="text" cols="60" rows="12"><?php if(isset($edit_news['text'])) echo $edit_news['text']; ?></textarea><br />
<span class="small"><input id="simple_news_edit_text_formatting" type="checkbox" name="text_formatting" value="1"<?php if(isset($edit_news['text_formatting']) && $edit_news['text_formatting']==1): ?> checked="checked"<?php endif; ?> /><label for="simple_news_edit_text_formatting"><?php echo $lang['simple_news_edit_text_format']; ?></label></span></p>
<?php endif; ?>
<div class="form-group">
<label for="text" class="col-md-2 control-label"><?php echo $lang['simple_news_edit_text']; ?></label>
<div class="col-md-10">
<textarea id="text" class="form-control" name="text" rows="10"><?php if(isset($edit_news['text'])) echo $edit_news['text']; ?></textarea>
</div>
</div>
<p><label for="linkname"><?php echo $lang['simple_news_edit_linkname']; ?></label><br />
<input id="linkname" type="text" name="linkname" value="<?php if(isset($edit_news['linkname'])) echo $edit_news['linkname']; ?>" size="40" /></p>
<div class="form-group">
<label for="linkname" class="col-md-2 control-label"><?php echo $lang['simple_news_edit_linkname']; ?></label>
<div class="col-md-10">
<input id="linkname" class="form-control" type="text" name="linkname" value="<?php if(isset($edit_news['linkname'])) echo $edit_news['linkname']; ?>">
</div>
</div>
<p><label for="newstime"><?php echo $lang['simple_news_edit_time']; ?></label> <small><?php echo $lang['simple_news_edit_time_format']; ?></small><br />
<input id="newstime" type="text" name="time" value="<?php if(isset($edit_news['time'])) echo $edit_news['time']; ?>" size="40" /></p>
<div class="form-group">
<label for="newstime" class="col-md-2 control-label"><?php echo $lang['simple_news_edit_time']; ?></label>
<div class="col-md-10">
<input id="newstime" class="form-control" type="text" name="newstime" value="<?php if(isset($edit_news['time'])) echo $edit_news['time']; ?>" placeholder="<?php echo $lang['simple_news_edit_time_format']; ?>">
</div>
</div>
<p><input type="submit" name="edit_news_submit" value="<?php echo $lang['submit_button_ok']; ?>" /></p>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button class="btn btn-primary" type="submit"><?php echo $lang['submit_button_ok']; ?></button>
</div>
</div>
</div>
</div>
</form> </form>
<?php elseif(isset($delete_news)): ?> <?php elseif(isset($delete_news)): ?>
@ -49,7 +68,7 @@
<form action="<?php echo BASE_URL . PAGE; ?>" method="post"> <form action="<?php echo BASE_URL . PAGE; ?>" method="post">
<div> <div>
<input type="hidden" name="delete" value="<?php echo $delete_news['id']; ?>" /> <input type="hidden" name="delete" value="<?php echo $delete_news['id']; ?>" />
<p><input class="delete" type="submit" name="confirmed" value="<?php echo $lang['delete_news_confirm_submit']; ?>" /></p>
<p><input class="btn btn-danger btn-lg" type="submit" name="confirmed" value="<?php echo $lang['delete_news_confirm_submit']; ?>" /></p>
</div> </div>
</form> </form>
@ -58,46 +77,56 @@
<?php echo $news_item['text']; ?> <?php echo $news_item['text']; ?>
<?php if($authorized_to_edit): ?> <?php if($authorized_to_edit): ?>
<p class="small"><a href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>,edit"><img src="<?php echo BASE_URL; ?>templates/images/edit_link.png" width="15" height="10" alt="" /><?php echo $lang['edit']; ?></a> &nbsp;<a href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>,delete" onclick="return confirm_link('<?php echo rawurlencode($lang['simple_news_delete_confirm']); ?>',this,1)"><img src="<?php echo BASE_URL; ?>templates/images/delete_link.png" width="13" height="9" alt="" /><?php echo $lang['delete']; ?></a></p>
<p>
<a class="btn btn-primary btn-xs" href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>,edit" title="<?php echo $lang['edit']; ?>"><span class="glyphicon glyphicon-pencil"></span></a>
<a class="btn btn-danger btn-xs" href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>,delete" title="<?php echo $lang['delete']; ?>" data-delete-confirm="<?php echo rawurlencode($lang['simple_news_delete_confirm']); ?>"><span class="glyphicon glyphicon-remove"></span></a>
</p>
<?php endif; ?> <?php endif; ?>
<?php elseif(isset($news)): ?> <?php elseif(isset($news)): ?>
<?php if($authorized_to_edit): ?> <?php if($authorized_to_edit): ?>
<p><a class="additem" href="<?php echo BASE_URL . PAGE; ?>,add_item"><?php echo $lang['simple_news_add_item']; ?></a></p>
<p><a class="btn btn-success" href="<?php echo BASE_URL . PAGE; ?>,add_item"><span class="glyphicon glyphicon-plus"></span> <?php echo $lang['simple_news_add_item']; ?></a></p>
<?php endif; ?> <?php endif; ?>
<?php foreach($news as $news_item): ?> <?php foreach($news as $news_item): ?>
<div class="news">
<p class="time"><?php echo $lang['simple_news_time'][$news_item['id']]; ?></p>
<div class="panel panel-default simple-news">
<div class="panel-heading"><?php echo $lang['simple_news_time'][$news_item['id']]; ?>
<?php if($authorized_to_edit): ?>
<span class="pull-right">
<a class="btn btn-primary btn-xs" href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>,edit" title="<?php echo $lang['edit']; ?>"><span class="glyphicon glyphicon-pencil"></span></a>
<a class="btn btn-danger btn-xs" href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>,delete" title="<?php echo $lang['delete']; ?>" data-delete-confirm="<?php echo rawurlencode($lang['simple_news_delete_confirm']); ?>"><span class="glyphicon glyphicon-remove"></span></a>
</span>
<?php endif; ?>
</div>
<div class="panel-body">
<h2><a href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>"><?php echo $news_item['title']; ?></a></h2> <h2><a href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>"><?php echo $news_item['title']; ?></a></h2>
<?php if(empty($news_item['teaser'])): ?> <?php if(empty($news_item['teaser'])): ?>
<?php echo $news_item['text']; ?> <?php echo $news_item['text']; ?>
<?php else: ?> <?php else: ?>
<p><?php echo $news_item['teaser']; ?><br />
<a href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>"><?php echo $news_item['linkname']; ?></a></p>
<p><?php echo $news_item['teaser']; ?></p>
<p><a class="btn btn-primary" href="<?php echo BASE_URL . PAGE; ?>,<?php echo $news_item['id']; ?>"><?php echo $news_item['linkname']; ?></a></p>
<?php endif; ?> <?php endif; ?>
</div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($pagination): ?> <?php if($pagination): ?>
<p class="pagination"><?php echo $lang['pagination']; ?> [
<?php if($pagination['previous']): ?> <a href="<?php echo BASE_URL . PAGE; if($pagination['previous']>1): ?>,,<?php echo $pagination['previous']; endif; ?>">&laquo;</a> <?php endif; ?>
<ul class="pagination">
<?php if($pagination['previous']): ?><li><a href="<?php echo BASE_URL . PAGE; if($pagination['previous']>1): ?>,,<?php echo $pagination['previous']; endif; ?>"><span class="glyphicon glyphicon-chevron-left"></span></a></li><?php endif; ?>
<?php foreach($pagination['items'] as $item): ?> <?php foreach($pagination['items'] as $item): ?>
<?php if(empty($item)): ?> ..<?php elseif($item==$pagination['current']): ?> <span class="current"><?php echo $item; ?></span><?php else: ?> <a href="<?php echo BASE_URL . PAGE; if($item>1): ?>,,<?php echo $item; endif; ?>"><?php echo $item; ?></a><?php endif; ?>
<?php if(empty($item)): ?><li><span>&hellip;</span></li><?php elseif($item==$pagination['current']): ?><li class="active"><span><?php echo $item; ?></span></li><?php else: ?><li><a href="<?php echo BASE_URL . PAGE; if($item>1): ?>,,<?php echo $item; endif; ?>"><?php echo $item; ?></a></li><?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($pagination['next']): ?> <a href="<?php echo BASE_URL . PAGE; ?>,,<?php echo $pagination['next']; ?>">&raquo;</a><?php endif; ?>
]</p>
<?php if($pagination['next']): ?><li><a href="<?php echo BASE_URL . PAGE; ?>,,<?php echo $pagination['next']; ?>"><span class="glyphicon glyphicon-chevron-right"></span></a></li><?php endif; ?>
</ul>
<?php endif; ?> <?php endif; ?>
<?php else: ?> <?php else: ?>
<p><?php echo $lang['no_news']; ?></p>
<div class="alert alert-warning"><?php echo $lang['no_news']; ?></div>
<?php if($authorized_to_edit): ?> <?php if($authorized_to_edit): ?>
<p><a class="additem" href="<?php echo BASE_URL . PAGE; ?>,add_item"><?php echo $lang['simple_news_add_item']; ?></a></p>
<p><a class="btn btn-success" href="<?php echo BASE_URL . PAGE; ?>,add_item"><span class="glyphicon glyphicon-plus"></span> <?php echo $lang['simple_news_add_item']; ?></a></p>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>

+ 2
- 0
static/css/style.css View File

@ -35,6 +35,8 @@ a.thumbnail:hover { opacity:0.9; }
.news-teaser p { margin:0; padding:0; } .news-teaser p { margin:0; padding:0; }
.news-teaser .time { color:#808080; font-size:13px; margin:0 0 7px 0; padding:0; } .news-teaser .time { color:#808080; font-size:13px; margin:0 0 7px 0; padding:0; }
.simple-news-delete { background:#f2dede; }
.caption + p { margin-top:20px; } .caption + p { margin-top:20px; }
.topspace { margin-top:10px; } .topspace { margin-top:10px; }


+ 3
- 1
static/js/admin_frontend.js View File

@ -4,9 +4,11 @@ $("a[data-delete-confirm]").click(function(e) { e.preventDefault();
message = $(this).data('delete-confirm') ? decodeURIComponent($(this).data('delete-confirm')) : 'Delete?'; message = $(this).data('delete-confirm') ? decodeURIComponent($(this).data('delete-confirm')) : 'Delete?';
$(this).parents("tr").addClass('danger'); $(this).parents("tr").addClass('danger');
$(this).parents("div .comment").addClass('comment-delete'); $(this).parents("div .comment").addClass('comment-delete');
$(this).parents("div .simple-news").addClass('simple-news-delete');
var confirmed = confirm(decodeURIComponent(message)); var confirmed = confirm(decodeURIComponent(message));
if(confirmed) window.location.href = $(this).attr("href") + '&confirmed=true'; if(confirmed) window.location.href = $(this).attr("href") + '&confirmed=true';
$(this).parents("tr").removeClass('danger'); $(this).parents("tr").removeClass('danger');
$(this).parents("div .comment").removeClass('comment-delete'); });
$(this).parents("div .comment").removeClass('comment-delete');
$(this).parents("div .simple-news").removeClass('simple-news-delete'); });
}); });

Loading…
Cancel
Save