summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-03-02 16:19:50 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-03-02 16:19:50 +0100
commit2d698a74f90b0915dd8c2e3e42ce0f21d0a7bd1c (patch)
treee4da3067dde6aedb30436d28ec5701b701fcacfc
parentdd5772e4b88dd41e210a4b789a52ae8656e5f1fd (diff)
Add comment support to article template, add support for multiple page templates.
-rw-r--r--schema.sql19
-rw-r--r--templates/article.html56
-rw-r--r--templates/journal_page.html15
-rw-r--r--templates/page_skeleton.html15
4 files changed, 101 insertions, 4 deletions
diff --git a/schema.sql b/schema.sql
index 914398c..909f6b3 100644
--- a/schema.sql
+++ b/schema.sql
@@ -40,11 +40,20 @@ CREATE TABLE login_certificates(
FOREIGN KEY ("user") REFERENCES users
);
-CREATE TABLE articles(
- id SERIAL NOT NULL,
+CREATE TABLE article_types(
+ id SERIAL NOT NULL,
+ name VARCHAR,
+ page_template VARCHAR,
PRIMARY KEY (id)
);
+CREATE TABLE articles(
+ id SERIAL NOT NULL,
+ type INTEGER NOT NULL,
+ PRIMARY KEY (id),
+ FOREIGN KEY (type) REFERENCES article_types
+);
+
CREATE TABLE article_aliases(
alias VARCHAR NOT NULL,
article INTEGER NOT NULL,
@@ -66,11 +75,13 @@ CREATE TABLE article_revisions(
title VARCHAR NOT NULL,
content VARCHAR NOT NULL,
author INTEGER,
- format varchar NOT NULL,
+ format VARCHAR NOT NULL,
+ status VARCHAR NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (article) REFERENCES articles,
FOREIGN KEY (author) REFERENCES users,
- CHECK (format IN ('html'))
+ CHECK (format IN ('html')),
+ CHECK (status IN ('draft', 'published', 'syndicated'))
);
CREATE TABLE article_revision_characteristics(
diff --git a/templates/article.html b/templates/article.html
index 8eef256..24b5b17 100644
--- a/templates/article.html
+++ b/templates/article.html
@@ -33,3 +33,59 @@
</footer>
</div>
</article>
+
+{.section commentary}
+<div class="comments">
+ <h2>{comments-heading|html}</h2>
+
+ {.repeated section comments}
+ <div class="comment">
+ <div class="comment-header">
+ {publishing-date|html-human-date}
+ <a rel="nofollow" {.section link}href="{@|html-attr-value}"{.end}>{.section author}{@|html}{.or}{generic-commenter-name|html}{.end}</a>:
+ </div>
+ <div class="comment-body">
+ {body}
+ </div>
+ </div>
+ {.end}
+
+ {.section comment-submission}
+ <h2>{title}</h2>
+ {notes}
+ <form action="{action|html-attr-value}" accept-charset="UTF-8"
+ enctype="application/x-www-form-urlencoded" method="post">
+ <div style="display: none">
+ <input name="id" type="hidden" value="98" />
+ <input name="action" type="hidden" value="post-comment" />
+ </div>
+ <div class="comment-form-table">
+ {.repeated section fields}
+ <div class="comment-form-row">
+ <div class="comment-form-label">
+ <label style="vertical-align: top"
+ for="{field-id|html-attr-value}">{field-label|html}:</label>
+ </div>
+ <div class="comment-form-input">
+ <input id="{field-id|html-attr-value}"
+ name="{field-name|html-attr-value}" type="text" />
+ </div>
+ </div>
+ {.end}
+ <div class="comment-form-row">
+ <div class="comment-form-label">
+ <label style="vertical-align: top" for="comment-body">{body-label|html}:</label>
+ </div>
+ <div class="comment-form-input">
+ <textarea id="comment-body" cols="60" rows="15"
+ name="comment-body">
+ </textarea>
+ </div>
+ </div>
+ </div>
+ <div><input type="submit" value="{submit-button-label|html-attr-value}"></div>
+ </form>
+ {.end}
+
+</div>
+{.end}
diff --git a/templates/journal_page.html b/templates/journal_page.html
new file mode 100644
index 0000000..3106ca7
--- /dev/null
+++ b/templates/journal_page.html
@@ -0,0 +1,15 @@
+{.section head}
+<link rel="stylesheet" type="text/css"
+ href="{root|html-attr-value}/style/journal.css" />
+{.end}
+
+{.section body}
+ <h1 id="main-title">{site-name|html}</h1>
+ <div id="main-subtitle">{site-subtitle|html}</div>
+
+ <div id="articles">
+ {.repeated section articles}
+ {article|article-html}
+ {.end}
+ </div>
+{.end}
diff --git a/templates/page_skeleton.html b/templates/page_skeleton.html
new file mode 100644
index 0000000..daa8781
--- /dev/null
+++ b/templates/page_skeleton.html
@@ -0,0 +1,15 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE html>
+<html lang="de" xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta charset="utf-8" />
+ <meta content="initial-scale=1.0, width=device-width" name="viewport" />
+ <title>{title|html}</title>
+ {head}
+ </head>
+
+ <body>
+ {body}
+ </body>
+</html>
+