[Gd-chatter] r10798 - in trunk/libraries/koala: sources/examples/wiki www/wiki
hannes at gwydiondylan.org
hannes at gwydiondylan.org
Fri Jun 16 00:27:30 CEST 2006
Author: hannes
Date: Fri Jun 16 00:27:27 2006
New Revision: 10798
Added:
trunk/libraries/koala/www/wiki/version.dsp (contents, props changed)
Modified:
trunk/libraries/koala/sources/examples/wiki/classes.dylan
trunk/libraries/koala/sources/examples/wiki/library.dylan
trunk/libraries/koala/sources/examples/wiki/parser.dylan
trunk/libraries/koala/sources/examples/wiki/wiki.dylan
trunk/libraries/koala/www/wiki/footer.dsp
Log:
Bug: 7219
*implemented a version page
*escape <, > and & in <pre> syntax
*minor other fixes
Modified: trunk/libraries/koala/sources/examples/wiki/classes.dylan
==============================================================================
--- trunk/libraries/koala/sources/examples/wiki/classes.dylan (original)
+++ trunk/libraries/koala/sources/examples/wiki/classes.dylan Fri Jun 16 00:27:27 2006
@@ -44,10 +44,23 @@
define method save (diff :: <wiki-page-diff>) => ()
next-method();
- let text = concatenate(diff.wiki-page-content.page-title, " (http://wiki.opendylan.org/wiki/view.dsp?title=", diff.wiki-page-content.page-title, ")",
- " [version ", integer-to-string(diff.page-version), "] ",
- "was changed by ", diff.author, " comment was ", diff.comment);
- broadcast-message(*xmpp-bot*, text);
+ if (*xmpp-bot*)
+ block()
+ let com = if (diff.comment = "")
+ "empty"
+ else
+ diff.comment
+ end;
+ let text = concatenate(diff.wiki-page-content.page-title,
+ " (\"http://wiki.opendylan.org/wiki/view.dsp?title=",
+ diff.wiki-page-content.page-title, "\")",
+ " [version ", integer-to-string(diff.page-version),
+ "] was changed by ", diff.author,
+ " comment was ", com);
+ broadcast-message(*xmpp-bot*, text);
+ exception (e :: <condition>)
+ end;
+ end;
end;
define method save-page (title, content, #key comment = "")
Modified: trunk/libraries/koala/sources/examples/wiki/library.dylan
==============================================================================
--- trunk/libraries/koala/sources/examples/wiki/library.dylan (original)
+++ trunk/libraries/koala/sources/examples/wiki/library.dylan Fri Jun 16 00:27:27 2006
@@ -45,6 +45,7 @@
use users;
use storage;
use sequence-diff;
+ use simple-xml, import: { escape-xml };
use substring-search;
use xmpp-bot;
end;
Modified: trunk/libraries/koala/sources/examples/wiki/parser.dylan
==============================================================================
--- trunk/libraries/koala/sources/examples/wiki/parser.dylan (original)
+++ trunk/libraries/koala/sources/examples/wiki/parser.dylan Fri Jun 16 00:27:27 2006
@@ -86,8 +86,9 @@
// Find next line with no leading whitespace...
let (epos, #rest xs) = regexp-position(markup, "\n\\S", start: start + 1) | markup.size;
write(out, "<pre>");
- //XXX escape <, > and & here!
- write(out, markup, start: start, end: epos);
+ //XXX more speed
+ let raw-text = copy-sequence(markup, start: start, end: epos);
+ write(out, escape-xml(raw-text));
write(out, "</pre>");
epos
end
Modified: trunk/libraries/koala/sources/examples/wiki/wiki.dylan
==============================================================================
--- trunk/libraries/koala/sources/examples/wiki/wiki.dylan (original)
+++ trunk/libraries/koala/sources/examples/wiki/wiki.dylan Fri Jun 16 00:27:27 2006
@@ -594,6 +594,30 @@
source: "wiki/admin.dsp")
end;
+define page version-page (<wiki-page>)
+ (url: "/wiki/version.dsp",
+ source: "wiki/version.dsp")
+end;
+
+define body tag show-versions in wiki
+ (page :: <wiki-page>, response :: <response>, do-body :: <function>)
+ ()
+ for (version in reverse(find-page(*title*).revisions))
+ dynamic-bind (*change* = version)
+ do-body();
+ end;
+ end;
+end;
+
+define method respond-to-get
+ (page :: <version-page>, request :: <request>, response :: <response>)
+ dynamic-bind (*title* = get-query-value("title"))
+ next-method();
+ end;
+end;
+
+
+
define variable *xmpp-bot* = #f;
define function main
() => ()
@@ -604,6 +628,7 @@
//register-url("/wiki/wiki.css", maybe-serve-static-file);
dumper();
*xmpp-bot* := make(<xmpp-bot>, jid: "dylanbot at jabber.berlin.ccc.de/here", password: "fnord");
+ sleep(5);
start-server(config-file: config-file);
end;
Modified: trunk/libraries/koala/www/wiki/footer.dsp
==============================================================================
--- trunk/libraries/koala/www/wiki/footer.dsp (original)
+++ trunk/libraries/koala/www/wiki/footer.dsp Fri Jun 16 00:27:27 2006
@@ -18,6 +18,7 @@
</dsp:if>
<a href="/wiki/recent.dsp">Recent Changes</a>
<a href="/wiki/index.dsp">Index</a>
+ <a href="/wiki/version.dsp?title=<wiki:show-title/>">History</a>
<span class="lastrevisions">
<wiki:show-revisions count="10">
<a class="revisionlink" href="/wiki/view.dsp?title=<wiki:show-title v="false"/>&v=<wiki:version/>">[<wiki:version/>]</a>
Added: trunk/libraries/koala/www/wiki/version.dsp
==============================================================================
--- (empty file)
+++ trunk/libraries/koala/www/wiki/version.dsp Fri Jun 16 00:27:27 2006
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%dsp:taglib name="wiki"/>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Dylan Wiki: Versions of Page <wiki:show-title/></title>
+ <link rel="stylesheet" href="/wiki/wiki.css"/>
+</head>
+
+<body>
+ <%dsp:include url="header.dsp"/>
+ <div id="content">
+
+ <dsp:show-form-notes/>
+ <h3>Version History of <wiki:show-title/></h3>
+ <ul>
+ <wiki:show-versions>
+ <li><wiki:show-change-timestamp/> version <wiki:show-change-version/> <a href="/wiki/diff.dsp?title=<wiki:show-change-title/>&version=<wiki:show-change-version/>">diff</a> by <wiki:show-change-author/> Comment <wiki:show-change-comment/></li>
+ </wiki:show-versions>
+ </ul>
+ </div>
+ <%dsp:include url="footer.dsp"/>
+</body>
+</html>
More information about the chatter
mailing list