From 97e430c540ed245fddd9a018f0fc8a595952c71b Mon Sep 17 00:00:00 2001 From: "Mark (ilosuna)" Date: Sun, 13 Oct 2013 14:33:52 +0200 Subject: [PATCH] Bootstrap adaptation for simple news page type --- cms/data/content.sqlite | Bin 393216 -> 393216 bytes cms/data/entries.sqlite | Bin 19456 -> 19456 bytes cms/data/userdata.sqlite | Bin 4096 -> 4096 bytes cms/includes/page_types/simple_news.php | 40 +++---- cms/lang/english.page.lang.php | 4 +- cms/templates/subtemplates/formmailer.inc.tpl | 2 +- .../subtemplates/simple_news.inc.tpl | 109 +++++++++++------- static/css/style.css | 2 + static/js/admin_frontend.js | 4 +- 9 files changed, 97 insertions(+), 64 deletions(-) diff --git a/cms/data/content.sqlite b/cms/data/content.sqlite index 28bdfd4b6bf1a38096ca3d7cadb6c3f49d4e3627..2ea9a0416fa186900fadc35acb1ba59485ce3981 100644 GIT binary patch delta 1438 zcmaJ=ZEO@p7~b8v1zLJ-k4mN2UY$~UEzr`IB2wC3MM^{vg;F6L;B|X9z1w8>cG=r) z_x9^Y zI%Uo->sqGE7Bi)eXdh2c+h+}rbHrI^m)qCVl6l=eklA6jo8Q}Y)?ew+OrxN*?1j8~0qMxW7=-jNQa1AhIk{+oVL zKdDdX8J*YrGv}SVPB3#UlX5Okx-W^76LX96w@1M^<1y2e2kQpt!xs!7mzpItpsGSa zDc(SNSkB&7|hyec5fn_vSzXM#8Ib_;Yvdo@)w zgRfW&mX}2(QA9~Kk`j4=N2&IO^DymzC-7AZbZ#oE1oZ@=k^2!Iji%blYeBt_P-G$^ z#Y@RGZT4G~eVEhBqfrtPeL_wKx4y0M>BThguH#*i^SmiE!*+51NH=}t3juai-~+P zLYyeXMMOrknOC;qR0h;HW^O+4T=N2W`bi{mybw{5u0}*o7f>>;CfeJ`z{fM7!9#@A z=GOUN&w@&?5uoVN4r;W+-fRR$^x1E=OUveXY-i4)N%s~*HsGV2duE~SjK}Hu6z!>h zZSR5Ssp{tbaBcv9;4sa2BE)`;pP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izG>uk_CPo^+)^ZDGX9zi*3klf^%!h7SAy72l=9s5v3hsCeOu1 zwt_d_I3kpig#W6)tvWPw~!F#^rQe!Fq86Jleuus#a#3EwmQ~ zSjVp>og0Pg9G@Pdq07+kK7bDL#jKJ@{NYWErY~75_rd!e6cZSD&VCZHD5a6y5lbvX z>mi2EI6TQ-#xr=GiQgMJ|L)9Q*XT*Br3}@<>8W9QeGb0aguZxfOe`vVJyHG!{K@)z z9)25a{-}BFtIQs@&E;gB>;V1k8Voo-k!kN;*iNrt=xbq@=h+>5ok`eCKOMOVgTqgCB3xJ3|Bi3k6h0`5;mAgAbJw^s$aQ6v!9pF4@lqZ4 iE*2a;c@u`MjSKJ$yYxRD48#AzRHrLnTeojPj(ZGspHaU6 diff --git a/cms/data/entries.sqlite b/cms/data/entries.sqlite index f54ffd2d8a06593946f2b6a3577d70c5c581b531..1660dd2071c2c00d523b19ca942ca0fafeca36c4 100644 GIT binary patch delta 40 ycmV+@0N4M3m;r#80gxL3>X95n0qU_}sRIGgvkC;t0|76Qfh)2I{{sOjq6|PV5e@h($ diff --git a/cms/includes/page_types/simple_news.php b/cms/includes/page_types/simple_news.php index a754dda..4a1526a 100644 --- a/cms/includes/page_types/simple_news.php +++ b/cms/includes/page_types/simple_news.php @@ -1,5 +1,5 @@ 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(':time', $time, PDO::PARAM_INT); $dbr->bindParam(':title', $title, PDO::PARAM_STR); $dbr->bindParam(':teaser', $teaser, 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->execute(); $id = $_POST['id']; @@ -63,7 +63,7 @@ if($authorized_to_edit && isset($_POST['text'])) $dbr->bindParam(':title', $title, PDO::PARAM_STR); $dbr->bindParam(':teaser', $teaser, 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->execute(); #$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['teaser'] = isset($_POST['teaser']) ? htmlspecialchars($_POST['teaser']) : ''; $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['linkname'] = isset($_POST['linkname']) ? htmlspecialchars($_POST['linkname']) : ''; $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') { - $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['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); @@ -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') { - $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->execute(); $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['teaser'] = htmlspecialchars($edit_news_item_data['teaser']); $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['time'] = date("Y-m-d H:i:s", $edit_news_item_data['time']); $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') { - $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->execute(); $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') { $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->bindValue(':now', time(), PDO::PARAM_STR); $dbr->execute(); @@ -213,8 +213,8 @@ elseif(isset($_GET['get_1']) && $_GET['get_1']=='rss') } 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]['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 { - $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->execute(); $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['title'] = htmlspecialchars($note_data['title']); $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']); $template->assign('display_time', true); $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>$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->bindValue(':now', time(), PDO::PARAM_STR); $dbr->execute(); @@ -291,8 +291,8 @@ else // overview $news[$i]['time'] = $news_data['time']; $news[$i]['title'] = $news_data['title']; $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']; $localization->bindReplacePlaceholder($news_data['id'], 'time', $news_data['time'], 'simple_news_time', Localization::FORMAT_TIME); $i++; diff --git a/cms/lang/english.page.lang.php b/cms/lang/english.page.lang.php index d074f8a..18e9ec6 100644 --- a/cms/lang/english.page.lang.php +++ b/cms/lang/english.page.lang.php @@ -122,10 +122,10 @@ $lang['simple_news_edit_text_format'] = 'auto formatting'; $lang['simple_news_edit_linkname'] = 'Link name:'; $lang['simple_news_default_linkname'] = 'more…'; $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_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_text'] = 'No text entered'; $lang['error_news_time_invalid'] = 'invalid date/time format'; diff --git a/cms/templates/subtemplates/formmailer.inc.tpl b/cms/templates/subtemplates/formmailer.inc.tpl index a0e6c72..44ccfcf 100644 --- a/cms/templates/subtemplates/formmailer.inc.tpl +++ b/cms/templates/subtemplates/formmailer.inc.tpl @@ -34,7 +34,7 @@ -

+

diff --git a/cms/templates/subtemplates/simple_news.inc.tpl b/cms/templates/subtemplates/simple_news.inc.tpl index 806f925..f290cdd 100644 --- a/cms/templates/subtemplates/simple_news.inc.tpl +++ b/cms/templates/subtemplates/simple_news.inc.tpl @@ -9,37 +9,56 @@ -
-
- - - - + +
+ + + + + -


-

+
+ +
+ +
+
-


-

+
+ +
+ +
+
- -


-

- -


-
- checked="checked" />

- +
+ +
+ +
+
-


-

+
+ +
+ +
+
-


-

+
+ +
+ +
+
-

+
+
+ +
+
-
+
@@ -49,7 +68,7 @@
-

+

@@ -58,46 +77,56 @@ -

 

+

+ + +

-

+

-
-

+
+
+ + + + + + +
+

- -


-

+

+

- +
-

[ - « +

    +
  • - .. +
  • - » - ]

    +
  • +
-

+
-

+

diff --git a/static/css/style.css b/static/css/style.css index b9b4f6d..f19a868 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -35,6 +35,8 @@ a.thumbnail:hover { opacity:0.9; } .news-teaser p { margin: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; } .topspace { margin-top:10px; } diff --git a/static/js/admin_frontend.js b/static/js/admin_frontend.js index 51a2382..79ac248 100644 --- a/static/js/admin_frontend.js +++ b/static/js/admin_frontend.js @@ -4,9 +4,11 @@ $("a[data-delete-confirm]").click(function(e) { e.preventDefault(); message = $(this).data('delete-confirm') ? decodeURIComponent($(this).data('delete-confirm')) : 'Delete?'; $(this).parents("tr").addClass('danger'); $(this).parents("div .comment").addClass('comment-delete'); + $(this).parents("div .simple-news").addClass('simple-news-delete'); var confirmed = confirm(decodeURIComponent(message)); if(confirmed) window.location.href = $(this).attr("href") + '&confirmed=true'; $(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'); }); });