]> gitweb.factorcode.org Git - factor.git/commitdiff
More wiki features
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 27 May 2008 07:42:21 +0000 (02:42 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 27 May 2008 07:42:21 +0000 (02:42 -0500)
extra/webapps/wiki/changes.xml [new file with mode: 0644]
extra/webapps/wiki/diff.xml
extra/webapps/wiki/revisions.xml
extra/webapps/wiki/user-edits.xml [new file with mode: 0644]
extra/webapps/wiki/view.xml
extra/webapps/wiki/wiki-common.xml
extra/webapps/wiki/wiki.factor

diff --git a/extra/webapps/wiki/changes.xml b/extra/webapps/wiki/changes.xml
new file mode 100644 (file)
index 0000000..5efa0c0
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version='1.0' ?>
+
+<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
+
+       <t:title>Recent Changes</t:title>
+
+       <ul>
+               <t:each-tuple t:values="changes">
+                       <li>
+                               <t:a t:href="title" t:query="title"><t:label t:name="title" /></t:a>
+                               on
+                               <t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
+                               by
+                               <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>
+                       </li>
+               </t:each-tuple>
+       </ul>
+
+</t:chloe>
index 378466f0bbb88eda6f70476626d5abbd4b707d42..0fb0d6bae678c5a47942df66003dc45834749938 100644 (file)
                <tr>
                        <th class="field-label">Old revision:</th>
                        <t:bind-tuple t:name="old">
-                               <td>Created on <t:label t:name="date" /> by <t:label t:name="author" />.</td>
+                               <td>Created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>.</td>
                        </t:bind-tuple>
                </tr>
                <tr>
                        <th class="field-label">New revision:</th>
                        <t:bind-tuple t:name="old">
-                               <td>Created on <t:label t:name="date" /> by <t:label t:name="author" />.</td>
+                               <td>Created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>.</td>
                        </t:bind-tuple>
                </tr>
        </table>
index fe741917730540a075062c93c530bd4409512985..4b7bdadf50251f11aa184486f9f0b0ca4eb80f76 100644 (file)
@@ -7,9 +7,9 @@
        <ul>
                <t:each-tuple t:values="revisions">
                        <li>
-                               <t:a t:href="revision" t:query="id">
-                                       <t:label t:name="date" /> by <t:label t:name="author" />
-                               </t:a>
+                               <t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
+                               by
+                               <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>
                        </li>
                </t:each-tuple>
        </ul>
diff --git a/extra/webapps/wiki/user-edits.xml b/extra/webapps/wiki/user-edits.xml
new file mode 100644 (file)
index 0000000..cf19a38
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version='1.0' ?>
+
+<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
+
+       <t:title>Edits by <t:label t:name="author" /></t:title>
+
+       <ul>
+               <t:each-tuple t:values="user-edits">
+                       <li>
+                               <t:a t:href="view" t:query="title"><t:label t:name="title" /></t:a>
+                               on
+                               <t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
+                       </li>
+               </t:each-tuple>
+       </ul>
+
+</t:chloe>
index c3536f374d0108861b82bee136dc905b81ab1ec4..56c8b37a1ded53378206ffce0e5148affecfc687 100644 (file)
@@ -13,7 +13,7 @@
                | <t:a t:href="$wiki/revisions" t:query="title">Revisions</t:a>
                | <t:a t:href="$wiki/edit" t:query="title">Edit</t:a>
                | <t:button t:action="$wiki/delete" t:for="title" class="link-button link">Delete</t:button>
-               | This revision created on <t:label t:name="date" /> by <t:label t:name="author" />.
+               | This revision created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>.
        </div>
 
 </t:chloe>
index d241f910ca2413a2acd4a5009e79726b00ecb7b0..23e61e55fe51d7f91dbf858b36d17019b6349807 100644 (file)
@@ -8,6 +8,7 @@
 
                <t:a t:href="$wiki">Front Page</t:a>
                | <t:a t:href="$wiki/articles">All Articles</t:a>
+               | <t:a t:href="$wiki/changes">Recent Changes</t:a>
 
                <t:if t:code="http.server.sessions:uid">
 
index d0e1aed7ce34f2dd6051374f44cfa2224267bd91..344a3d40bd9cd40d3ef7619513ee3632742c6e26 100644 (file)
@@ -127,6 +127,16 @@ revision "REVISIONS" {
 
         "revisions" wiki-template >>template ;
 
+: <list-changes-action> ( -- action )
+    <page-action>
+        [
+            f <revision> select-tuples
+            [ [ date>> ] compare invert-comparison ] sort
+            "changes" set-value
+        ] >>init
+
+        "changes" wiki-template >>template ;
+
 : <delete-action> ( -- action )
     <action>
         [ validate-title ] >>validate
@@ -156,9 +166,24 @@ revision "REVISIONS" {
 
 : <list-articles-action> ( -- action )
     <page-action>
-        [ f <article> select-tuples "articles" set-value ] >>init
+        [
+            f <article> select-tuples
+            [ [ title>> ] compare ] sort
+            "articles" set-value
+        ] >>init
+
         "articles" wiki-template >>template ;
 
+: <user-edits-action> ( -- action )
+    <page-action>
+        [
+            { { "author" [ v-username ] } } validate-params
+            f <revision> "author" value >>author
+            select-tuples "user-edits" set-value
+        ] >>init
+
+        "user-edits" wiki-template >>template ;
+
 TUPLE: wiki < dispatcher ;
 
 : <wiki> ( -- dispatcher )
@@ -167,8 +192,10 @@ TUPLE: wiki < dispatcher ;
         <view-article-action> "view" add-responder
         <view-revision-action> "revision" add-responder
         <list-revisions-action> "revisions" add-responder
+        <user-edits-action> "user-edits" add-responder
         <diff-action> "diff" add-responder
         <list-articles-action> "articles" add-responder
+        <list-changes-action> "changes" add-responder
         <edit-article-action> { } <protected> "edit" add-responder
         <delete-action> { } <protected> "delete" add-responder
     <boilerplate>