From 07f2f3c30a6e0bc811e436925dfdfcf5befdecb7 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Sat, 12 Nov 2011 14:33:35 +0100 Subject: Entry single pages: handle permalinks gracefully, populate with attribute. * A single page is generated from the single-page attribute on element (stored in database as do_single_page). * Permalink refers to the single page. Same from weblog index. Other links are subject to debate (e.g., what about internal links? now we link to single page when link has a supplement part, but this is debatable). --- org/madore/damlengine/WeblogSummary.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'org/madore/damlengine/WeblogSummary.java') diff --git a/org/madore/damlengine/WeblogSummary.java b/org/madore/damlengine/WeblogSummary.java index babfcf5..997f67a 100644 --- a/org/madore/damlengine/WeblogSummary.java +++ b/org/madore/damlengine/WeblogSummary.java @@ -13,13 +13,16 @@ public final class WeblogSummary { String date; String lang; String title; String titleXml; + String doSinglePage; public EntrySummary(int id, String date, String lang, - String title, String titleXml) { + String title, String titleXml, + String doSinglePage) { this.id = id; this.date = date; this.lang = lang; this.title = title; this.titleXml = titleXml; + this.doSinglePage = doSinglePage; } } @@ -38,7 +41,7 @@ public final class WeblogSummary { try { final Connection conn = WeblogDatabaseConnection.getConnection(); final PreparedStatement selSt - = conn.prepareStatement("SELECT id , edate , lang , title , title_xml FROM entries"); + = conn.prepareStatement("SELECT id , edate , lang , title , title_xml , do_single_page FROM entries"); final ResultSet selRes = selSt.executeQuery(); while ( selRes.next() ) { int id = selRes.getInt(1); @@ -46,7 +49,8 @@ public final class WeblogSummary { String lang = selRes.getString(3); String title = selRes.getString(4); String titleXml = selRes.getString(5); - singleton.entries.put(new Integer(id), new EntrySummary(id, date, lang, title, titleXml)); + String doSinglePage = selRes.getString(6); + singleton.entries.put(new Integer(id), new EntrySummary(id, date, lang, title, titleXml, doSinglePage)); } } catch (SQLException e) { // Well, we'll have no summary. Too bad, but better than abort. -- cgit v1.2.3