Added a Discussion link to the page headers.
diff --git a/doc/latest_release.txt b/doc/latest_release.txt --- a/doc/latest_release.txt +++ b/doc/latest_release.txt @@ -0,0 +1,9 @@ +I added explicit support for "Discussion" links in page headers. +The special page, "TalkPageDoesNotExist" is displayed if no talk page exists yet. + +I had to modify the DumpWiki CLI client to handle the new page header format. +You need to handle a new %s for the talk page href. +See ./templates/wiki_dump_template.html for an example. + + + diff --git a/freesite.cfg b/freesite.cfg --- a/freesite.cfg +++ b/freesite.cfg @@ -2,7 +2,7 @@ [default] # Human readable site name. # MUST match value in cut_release.py -site_name = jfniki_releases_tst002 +site_name = jfniki_releases # Directory to insert from relative to the repository root. site_dir = release/generated_freesite # Optional external file to load the site key from, relative diff --git a/readme.txt b/readme.txt --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -20110429 +20110515 djk@isFiaD04zgAgnrEC5XJt1i4IE7AkNPqhBG5bONi6Yks WARNING: @@ -84,13 +84,13 @@ sethcg@a-tin0kMl1I~8xn5lkQDqYZRExKLzJITr --- Dev notes --- +BUG: Header links to discussion pages. [requested by a real user] BUG: Default FCP port wrong for CLI client. [requested by a real user] BUG: fix the discover UI to correctly handle posts from a different nym than the insert BUG: wikitext should use unix line terminators not DOS (+1 byte per line) BUG: MUST show in the UI when edited wikitext has been truncated because it's too big. *BUG: Make Freetalk configuration work like fms configuration. i.e. no need for public key. --- -CHORE: Write a script to cut releases and insert them into freeneet. CHORE: Fix references to "FMS" to reflect the fact that either Freetalk or FMS may be used. --- @@ -141,3 +141,5 @@ 08d1b85d8ddd: IDEA: Pillage glog graph d PUNT: Don't worry about it. Attacker has to break SHA1 to create a cycle because of the way the version is string is generated. +Finished Chores: +cce3742a46d6: CHORE: Write a script to cut releases and insert them into freeneet. diff --git a/release/cut_release.py b/release/cut_release.py --- a/release/cut_release.py +++ b/release/cut_release.py @@ -22,7 +22,7 @@ """ # This script isn't really for public consumption. -# +# It is brittle and not fully debugged. # It assumes you have hg infocalypse installed and configured. # # BUG: ANONYMITY ISSUE: This script currently leaks the *nix user id @@ -53,10 +53,10 @@ FMS_HOST = '127.0.0.1' FMS_PORT = 11119 FMS_ID = 'djk' -FMS_GROUP = 'test' +FMS_GROUP = 'sites' # REQUIRES: must match name in freesite.cfg. LATER: fix. -SITE_NAME = 'jfniki_releases_tst002' +SITE_NAME = 'jfniki_releases' PUBLIC_SITE = "USK@kRM~jJVREwnN2qnA8R0Vt8HmpfRzBZ0j4rHC2cQ-0hw," + \ "2xcoQVdQLyqfTpF2DpkdUIbHFCeL4W~2X1phUYymnhM,AQACAAE/%s/%%d/" % \ @@ -67,7 +67,7 @@ PUBLIC_SITE = "USK@kRM~jJVREwnN2qnA8R0Vt FREENET_DOC_WIKI_IDX = 30 FNIKI_IDX = 81 -REPO_IDX = 13 +REPO_IDX = 14 ############################################################ diff --git a/src/fniki/standalone/DumpWiki.java b/src/fniki/standalone/DumpWiki.java --- a/src/fniki/standalone/DumpWiki.java +++ b/src/fniki/standalone/DumpWiki.java @@ -56,8 +56,9 @@ public class DumpWiki { " [[template_file] [[fcp_port] [fcp_host]]]\n\n" + "NOTE:\nfreenet.jar and jfniki.jar MUST be in your classpath.\n\n" + "The <dump_path> directory must already exist and any files in it will be overwritten.\n\n" + - "The template_file should contain 3 %s place holders. The first two will be replaced \n"+ - "with the title and the third will be replaced with the wiki content.\n"+ + "The template_file should contain 4 %s place holders. The first two will be replaced \n"+ + "with the title. The third will be replaced by the href value for the discusion page.\n" + + "The fourth will be replaced with the wiki content.\n"+ "You can use the literal value 'default' to get the built in template file.\n\n"+ "DumpWiki was written as part of the fniki Freenet Wiki project\n\n"; @@ -161,7 +162,10 @@ public class DumpWiki { FileOutputStream out = new FileOutputStream(ouputDirectory + "/" + name + ".html"); PrintStream p = new PrintStream(out); cleanName = unescapeHTML(name.replace("_", " ")); + String talkName = (archiveManager.getStorage().hasPage("Talk_" + name)) ? "Talk_" + name + ".html": + "PageDoesNotExist.html"; p.printf(wikiTemplate, cleanName, cleanName, + talkName, (archiveManager.getStorage().hasPage(name)) ? new FreenetWikiTextParser(archiveManager.getStorage().getPage(name), mParserDelegate).toString() : "Page doesn't exist in the wiki yet." diff --git a/src/fniki/wiki/child/WikiContainer.java b/src/fniki/wiki/child/WikiContainer.java --- a/src/fniki/wiki/child/WikiContainer.java +++ b/src/fniki/wiki/child/WikiContainer.java @@ -144,31 +144,56 @@ public class WikiContainer implements Ch } private String unescapedTitleFromName(String name) { + if (name.startsWith("Talk_")) { + // LATER: Localization. + name = "Talk:" + name.substring("Talk_".length()); + } return name.replace("_", " "); } + private String getTalkPage(WikiContext context, String name) throws IOException { + if (name.startsWith("Talk_") || (!context.getStorage().hasPage(name))) { + return null; + } + // LATER: Localization + return "Talk_" + name; + } + private String getPageHtml(WikiContext context, String name) throws IOException { StringBuilder buffer = new StringBuilder(); - addHeader(context, name, buffer); + addHeader(context, name, getTalkPage(context, name), buffer); if (context.getStorage().hasPage(name)) { buffer.append(renderXHTML(context, context.getStorage().getPage(name))); } else { + // Hmmmm... too branchy if (name.equals(context.getString("default_page", "Front_Page"))) { buffer.append(renderXHTML(context, context.getString("default_wikitext", "Page doesn't exist in the wiki yet."))); - } else if (context.getStorage().hasPage("PageDoesNotExist")) { - // LATER: Revisit. Also, ExternalLink. Evil submissions can change this to something confusing. - buffer.append(renderXHTML(context, context.getStorage().getPage("PageDoesNotExist"))); } else { - buffer.append("Page doesn't exist in the wiki yet."); + if (name.startsWith("Talk_")) { + if (context.getStorage().hasPage("TalkPageDoesNotExist")) { + // LATER: Revisit. Also, ExternalLink. Evil submissions can change this to something confusing. + buffer.append(renderXHTML(context, context.getStorage().getPage("TalkPageDoesNotExist"))); + } else { + buffer.append("Discussion page doesn't exist in the wiki yet."); + } + } else { + if (context.getStorage().hasPage("PageDoesNotExist")) { + // LATER: as above. + buffer.append(renderXHTML(context, context.getStorage().getPage("PageDoesNotExist"))); + } else { + buffer.append("Page doesn't exist in the wiki yet."); + } + } } } addFooter(context, name, buffer); return buffer.toString(); } - private void addHeader(WikiContext context, String name, StringBuilder buffer) throws IOException { + private void addHeader(WikiContext context, String name, String talkName, + StringBuilder buffer) throws IOException { buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); buffer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" " + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"); @@ -183,8 +208,17 @@ public class WikiContainer implements Ch buffer.append("</style>\n"); buffer.append("</head>\n"); buffer.append("<body>\n"); - buffer.append("<h1>\n"); + buffer.append("<h1 class=\"pagetitle\">\n"); buffer.append(escapeHTML(unescapedTitleFromName(name))); + buffer.append("</h1>\n"); + if (talkName != null) { + String talkClass = context.getStorage().hasPage(talkName) ? "talktitle" : "notalktitle"; + buffer.append(String.format("<h4 class=\"%s\">\n", talkClass)); + String href = makeHref(context.makeLink("/" + talkName), null, talkName, null, null); + buffer.append(String.format("<a class=\"%s\" href=\"%s\">%s</a>", + talkClass, href, escapeHTML("Discussion"))); + buffer.append("</h4>\n"); + } buffer.append("</h1><hr>\n"); } diff --git a/style/add_header.css b/style/add_header.css --- a/style/add_header.css +++ b/style/add_header.css @@ -4,3 +4,6 @@ blockquote{margin-left:20px;background-c span.underline{text-decoration:underline;} body { background-color: #FFFFFF; color: #000000 } a { color: #1f6b9e } +.pagetitle {text-align:left;} +.talktitle {text-align:right;} +.notalktitle {color:#c0c0c0;text-align:right;} diff --git a/templates/wiki_dump_template.html b/templates/wiki_dump_template.html --- a/templates/wiki_dump_template.html +++ b/templates/wiki_dump_template.html @@ -8,6 +8,7 @@ </head> <body> <h1>%s</h1> +<h4 style="text-align:right;"><a href="%s">Discussion</a></h4> <hr> %s </body>