summaryrefslogtreecommitdiff
path: root/tpl/blog
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/blog')
-rw-r--r--tpl/blog/drafts.php41
-rw-r--r--tpl/blog/index.php53
2 files changed, 94 insertions, 0 deletions
diff --git a/tpl/blog/drafts.php b/tpl/blog/drafts.php
new file mode 100644
index 0000000..5440cbc
--- /dev/null
+++ b/tpl/blog/drafts.php
@@ -0,0 +1,41 @@
+<?php
+
+require("tpl/general/top.php");
+
+echo '<div class="small_right">';
+echo '<a href="post-blog">post a message</a></div>';
+
+echo '<h2>My drafts</h2>';
+
+if (count($drafts) > 0) {
+ foreach ($drafts as $post) {
+ echo '<div class="blog_post">';
+ echo '<div class="small_right">';
+ echo '<a href="edit-blog-' . $post['id'] . '">edit</a>';
+ echo ' | <a href="delete-blog-' . $post['id'] . '">delete</a>';
+ echo ' | <a href="publish-blog-' . $post['id'] . '">publish</a>';
+ echo '</div>';
+ echo '<h2>' . $post['title'] . '</h2>';
+ echo $post['text_html'];
+ echo '</div>';
+ }
+} else {
+ echo '<p>No drafts</p>';
+}
+
+echo '<h2>My published posts</h2>';
+
+if (count($pub) > 0) {
+ echo '<table><tr><th>Title</th><th>Actions</th></tr>';
+ foreach ($pub as $post) {
+ echo '<tr><td>' . $post['title'] . '</td>';
+ echo '<td><a href="edit-blog-' . $post['id'] . '">edit</a>';
+ echo ' | <a href="delete-blog-' . $post['id'] . '">delete</a></td></tr>';
+ }
+ echo '</table>';
+} else {
+ echo '<p>No published posts</p>';
+}
+
+
+require("tpl/general/bottom.php");
diff --git a/tpl/blog/index.php b/tpl/blog/index.php
new file mode 100644
index 0000000..07e3388
--- /dev/null
+++ b/tpl/blog/index.php
@@ -0,0 +1,53 @@
+<?php
+require("tpl/general/top.php");
+
+if ($can_post) {
+ echo '<div class="small_right">';
+ echo '<a href="post-blog">post a message</a>';
+ echo ' | <a href="drafts-blog">my drafts</a>';
+ echo '</div>';
+}
+
+echo '<div class="ordering_links">' . filters_html_full() . '</div>';
+
+foreach ($posts as $post) {
+ echo '<div class="blog_post">';
+ echo '<div class="small_right">Written by ' . $post['owner'];
+ if ($can_edit && $post['owner_id'] == $user['id'])
+ echo ' | <a href="edit-blog-' . $post['id'] . '">edit</a>';
+ if ($can_delete && $post['owner_id'] == $user['id'])
+ echo ' | <a href="delete-blog-' . $post['id'] . '">delete</a>';
+ echo '</div>';
+ echo '<div class="small_right">published ' . $post['date'] . '</div>';
+ if ($post['tags'] != '') {
+ echo '<div class="small_right">tags: ' . $post['tags'] . '</div>';
+ }
+ echo '<h2>' . $post['title'] . '</h2>';
+ echo '<div class="inside">' . $post['text_html'] . '</div>';
+ echo '</div>';
+}
+
+echo '</div><div class="contents-left">';
+
+foreach ($fa as $kname => $kdata) {
+ echo '<h1>Filter by ' . $kname . '</h1>';
+ if (isset($fvalues[$kname])) {
+ echo '<p>Filtering ' . $kname . ' : ' . $kdata[$fvalues[$kname]]['name'] . '.<br />';
+ $n = array();
+ foreach ($fvalues as $k => $v) {
+ if ($k != $kname) $n[] = "$k-$v";
+ }
+ echo '<a href="index-blog-' . implode('-', $n) . '">remove filtering</a></p>';
+ } else {
+ echo '<ul>';
+ foreach ($kdata as $vid => $vdata) {
+ $n = array();
+ foreach ($fvalues as $k => $v) $n[] = "$k-$v";
+ $n[] = "$kname-$vid";
+ echo '<li><a href="index-blog-' . implode('-', $n) . '">' . $vdata['name'] . ' (' . $vdata['count'] . ')</a></li>';
+ }
+ echo '</ul>';
+ }
+}
+
+require("tpl/general/bottom.php");