[MKDoc-commit] [1.8] Comment plugin/component forward-ported from 1.6.

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Fri Aug 26 17:06:58 BST 2005


Log Message:
-----------
[1.8] Comment plugin/component forward-ported from 1.6. enabled by default

Modified Files:
--------------
    mkd/conf:
        www.conf
    mkd/resources/css:
        admin.css
        admin.ltr.css
        admin.rtl.css
        colours.css
        public.css
    mkd/resources/templates/document/default:
        en.html

Added Files:
-----------
    mkd/flo/editor:
        Comment.pm
    mkd/flo/plugin:
        Comment.pm
    mkd/resources/templates/comment:
        en.html
    mkd/resources/templates/comment/email:
        en.xml
    mkd/resources/templates/component/comment:
        en.html
    mkd/resources/templates/editor/comment:
        en.html
    mkd/resources/templates/macros/comments:
        en.html

-------------- next part --------------
Index: colours.css
===================================================================
RCS file: /var/spool/cvs/mkd/resources/css/colours.css,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lresources/css/colours.css -Lresources/css/colours.css -u -r1.13 -r1.14
--- resources/css/colours.css
+++ resources/css/colours.css
@@ -25,6 +25,14 @@
   border: solid #008 1px;
 }
 
+div.comment {
+  background: #EEF;
+}
+
+div.comment-header {
+  background: #DDE;
+}
+
 /* IE 6 on XP need the legend text colour setting */
 legend {
   background: transparent;
Index: admin.css
===================================================================
RCS file: /var/spool/cvs/mkd/resources/css/admin.css,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lresources/css/admin.css -Lresources/css/admin.css -u -r1.7 -r1.8
--- resources/css/admin.css
+++ resources/css/admin.css
@@ -276,6 +276,10 @@
   color: #000;
   background-color: #9C6;
 }
+.comment-component {
+  color: #000;
+  background-color: #9CC;
+}
 .image-component {
   color: #000;
   background-color: #69C;
Index: public.css
===================================================================
RCS file: /var/spool/cvs/mkd/resources/css/public.css,v
retrieving revision 1.12
retrieving revision 1.13
diff -Lresources/css/public.css -Lresources/css/public.css -u -r1.12 -r1.13
--- resources/css/public.css
+++ resources/css/public.css
@@ -121,6 +121,19 @@
   display: inline;
 }
 
+div.comment {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+div.comment-header, div.comment-body {
+  padding-left: 0.5em;
+  padding-right: 0.5em;
+  font-size: smaller;
+  overflow: hidden;
+}
+
+
 /* The following CSS is for the divs within the sidebar. 
    If it's needed to have different settings for different 
    boxes then the unique class bames that each div has can 
Index: admin.rtl.css
===================================================================
RCS file: /var/spool/cvs/mkd/resources/css/admin.rtl.css,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lresources/css/admin.rtl.css -Lresources/css/admin.rtl.css -u -r1.4 -r1.5
--- resources/css/admin.rtl.css
+++ resources/css/admin.rtl.css
@@ -34,12 +34,12 @@
 }
 
 /* this is for text and html components */
-fieldset.html-component em.help, fieldset.text-component em.help {
+fieldset.html-component em.help, fieldset.text-component em.help, fieldset.comment-component em.help {
   float: left;
   width: 10%;
 }
 
-fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform {
+fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform, fieldset.comment-component textarea.adminform {
   float: right;
   width: 85%;
 }
Index: admin.ltr.css
===================================================================
RCS file: /var/spool/cvs/mkd/resources/css/admin.ltr.css,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lresources/css/admin.ltr.css -Lresources/css/admin.ltr.css -u -r1.6 -r1.7
--- resources/css/admin.ltr.css
+++ resources/css/admin.ltr.css
@@ -76,13 +76,13 @@
 }
 
 /* this is for text and html components */
-fieldset.html-component em.help, fieldset.text-component em.help {
+fieldset.html-component em.help, fieldset.text-component em.help, fieldset.comment-component em.help {
   float: right;
   width: 10%;
 }
 
 /* this is for text and html components */
-fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform {
+fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform, fieldset.comment-component textarea.adminform {
   float: left;
   width: 85%;
 }
--- /dev/null
+++ resources/templates/comment/en.html
@@ -0,0 +1,168 @@
+<!DOCTYPE html PUBLIC 
+  "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+>
+<!--?
+
+This template lets the user post a comment
+
+?-->
+<html
+  lang="en"
+  xml:lang="en"
+  dir="ltr"
+  petal:set="
+    uri                   self/uri;
+    title                 string:Comment on ${self/parent/title};
+    user                  self/user;
+    lang                  self/lang;
+    dir                   self/direction;
+    align                 self/align;
+    align_opposite        self/align_opposite;
+    sitemap               plugin: flo::plugin::Sitemap;
+    sitemap_uri           sitemap/uri;
+    search                plugin: flo::plugin::Search;
+    search_uri            search/uri;
+            "
+  petal:attributes="lang lang; xml:lang lang; dir dir;"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:petal="http://purl.org/petal/1.0/"
+  xmlns:xi="http://www.w3.org/2001/XInclude"
+>
+
+<!--? This is the <head> for public documents ?-->
+<?include file="/fragments/head_public/"?>
+
+  <body 
+    lang="en"
+    xml:lang="en"
+    dir="ltr"
+    petal:attributes="lang lang; xml:lang lang; dir dir;"
+  >
+
+<!--? This is the header it contains the navigational elements at the top of the page. ?-->
+<?include file="/fragments/header/"?>
+
+    <div class="content">
+
+      <h1 
+        lang="en"
+        xml:lang="en"
+        dir="ltr"
+        align="left"
+        petal:attributes="align align"
+      >
+        <a
+          id="page_content"
+          name="page_content"
+          petal:content="title"
+        >
+         Title of this page
+        </a>
+      </h1>
+
+      <xi:include href="/error/" />
+
+          <p
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            align="left"
+            petal:attributes="align align"
+          >
+          
+            The editors of this site are encouraged to trim or remove duplicate
+            and off-topic material, so anything you contribute to this document
+            may be edited to improve readability.  Your name and the date (but
+            <em>not</em> your email address) will appear alongside.
+            
+          </p>
+
+          <form 
+            action="#"
+            method="post" 
+            accept-charset="UTF-8"
+            enctype="application/x-www-form-urlencoded"
+            petal:attributes="action uri"
+          >
+          
+            <fieldset
+              class="login-details"
+            >
+              
+	      <legend
+                lang="en"
+                xml:lang="en"
+                dir="ltr"
+              >
+                <a 
+                  id="login-details"
+                  name="login-details"
+                >Your comment</a>
+              </legend>
+
+              <p
+                lang="en"
+                xml:lang="en"
+                dir="ltr"
+                align="left"
+                class="help"
+                petal:attributes="align align"
+              >
+
+                Use plain text, start a new paragraph with two carriage
+                returns.  Links like <em>http://example.com/</em> or
+                <em>mailto:info at example.com</em> will be made clickable.
+                </p>
+
+              <p
+                lang="en"
+                xml:lang="en"
+                dir="ltr"
+                align="left"
+                petal:attributes="align align"
+              >
+                <label
+                  for="comment"
+                >Type Comment</label>
+                <br />
+                <textarea
+                  name="comment"
+                  id="comment"
+                  rows="12"
+                  cols="45"
+                  title="Enter Comment here."
+                  class="adminform"
+                ></textarea>
+              </p>
+
+            </fieldset>
+ 
+            <p
+              lang="en"
+              xml:lang="en"
+              dir="ltr"
+              align="left"
+              petal:attributes="align align"
+            >
+              <input 
+                type="submit"
+                name="submit"
+                value="Add Comment"
+                class="input-submit"
+                title="Add this comment to this page"
+              />
+            </p>
+
+      </form>
+
+    </div>
+
+    <div class="sidebar">
+
+        <!--? This is the list of link components. ?-->
+        <?include file="/fragments/menu_quick_links/"?>
+
+    </div>
+  </body>
+</html>
--- /dev/null
+++ resources/templates/comment/email/en.xml
@@ -0,0 +1,30 @@
+<Message
+  xmlns="http://www.openhealth.org/xmtp#"
+  petal:define="root_user user_root:">
+
+  <Content-Type>text/plain; charset=utf-8; format=flowed</Content-Type>
+  <Content-Disposition>inline</Content-Disposition>
+  <Content-Transfer-Encoding>8bit</Content-Transfer-Encoding>
+  <Content-Language>en</Content-Language>
+  <MIME-Version>1.0</MIME-Version>
+
+  <From petal:content="string:${root_user/real_name} &lt;${root_user/email}&gt;">MKDoc &lt;info at mkdoc.com&gt;</From>
+  <To petal:content="string:${root_user/real_name} &lt;${root_user/email}&gt;">MKDoc &lt;info at mkdoc.com&gt;</To>
+  <Subject petal:content="string: ${object/root/title} : ${object/title} - comment added by ${self/user/real_name}">MKDoc : Feedback - comment added by Fred Flintstone</Subject>
+  <User-Agent>MKDoc Mailer v1.8</User-Agent>
+  <Organization petal:content="object/root/title">MKDoc</Organization>
+ 
+  <body xmlns="http://www.w3.org/1999/xhtml">
+<p>
+  <span petal:replace="self/user/real_name">Fred Flintstone</span> &lt;<span petal:replace="self/user/email">fred at example.com</span>&gt; has posted this comment to <span petal:replace="object/uri">http://www.example.com/feedback/</span>:
+</p>
+
+<pre petal:content="self/comment">
+   Blah blah, I am so clever.
+</pre>
+
+<pre>-- 
+Best Regards,
+<span petal:replace="root_user/real_name">MKDoc</span> &lt;<span petal:replace="root_user/email">example at example.com</span>&gt;</pre>
+  </body>
+</Message>
--- /dev/null
+++ resources/templates/component/comment/en.html
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--?
+
+This template is used for rendering the comment component in documents. 
+
+?-->
+
+<div
+  class="comment"
+  xmlns:petal="http://purl.org/petal/1.0/"
+>
+            <div class="comment-header">
+              <span
+                class="comment-poster"
+                petal:content="self/poster"
+              >John Milton</span>
+              <span
+                class="comment-date"
+                petal:content="self/date_posted"
+              >1652-05-05 17:37:21</span>
+            </div>
+            <div
+              class="comment-body"
+              petal:content="structure self/comment"
+            >
+              <p>This comment component is <strong>super cool</strong>.</p>
+            </div>
+          </div>
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/resources/templates/document/default/en.html,v
retrieving revision 1.41
retrieving revision 1.42
diff -Lresources/templates/document/default/en.html -Lresources/templates/document/default/en.html -u -r1.41 -r1.42
--- resources/templates/document/default/en.html
+++ resources/templates/document/default/en.html
@@ -490,6 +490,10 @@
             </div>
           </div>
         </div>
+        <div
+          metal:use-macro="/macros/comments/#comments"
+        >
+        </div>
       </div>
 
       <!--? Next and Previous Fragment ?-->
--- /dev/null
+++ resources/templates/editor/comment/en.html
@@ -0,0 +1,131 @@
+<!--?
+
+
+This template is used for the editor interface of a 
+comment component. 
+  
+?-->
+<fieldset
+  class="comment-component"
+  xmlns:petal="http://purl.org/petal/1.0/"
+  petal:define="align               self/align;
+                align_opposite      self/align_opposite;
+                dir                 self/direction;
+                name_delete         string:${self/block_name}_delete;
+                name_poster         string:${self/block_name}_poster;
+                name_login          string:${self/block_name}_login;
+                name_email          string:${self/block_name}_email;
+                name_date_posted    string:${self/block_name}_date_posted"
+>
+
+  <legend
+    xml:lang="en"
+    lang="en"
+    dir="ltr"
+  >Comment component</legend>
+
+  <?include file="/fragments/move_control/"?>
+
+    <p>
+      <a
+        petal:attributes="href string:mailto:${self/email}"
+        href="mailto:fred at example.com"
+      ><span petal:content="self/poster">Fred Flintstone</span></a>
+      (<span petal:content="self/login">fred</span>)
+      <span petal:content="self/date_posted">2005-08-02 12:23:45</span>
+    </p>
+    <p>
+      <em
+        class="help"
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+      >
+        You can enter plain text into this form, a blank line will result in a paragraph 
+        break. See also the  
+        <a href="http://www.mkdoc.org/docs/specs/structured-txt/">text formatting rules</a>. 
+        Please use link components for hyperlinks. 
+      </em>
+      <label
+        for="comment_id"
+        lang="en"
+        xml:lang="en"
+        dir="ltr"
+        petal:attributes="for self/block_name"
+      >Comment</label>
+      <br />
+      <textarea
+        name="comment"
+        id="comment"
+        rows="12"
+        cols="45"
+        title="Edit Comment here."
+        class="adminform"
+        petal:attributes="name self/block_name; id self/block_name"
+        petal:content="self/data" 
+      >Plain text.</textarea>
+
+  <input
+    type="hidden"
+    name="date_posted"
+    id="date_posted"
+    value="2005-08-05 12:34:56"
+    petal:attributes="name name_date_posted; id name_date_posted; value self/date_posted"
+  />
+  <input
+    type="hidden"
+    name="poster"
+    id="poster"
+    value="Fred Flintstone"
+    petal:attributes="name name_poster; id name_poster; value self/poster"
+  />
+  <input
+    type="hidden"
+    name="login"
+    id="login"
+    value="fred"
+    petal:attributes="name name_login; id name_login; value self/login"
+  />
+  <input
+    type="hidden"
+    name="email"
+    id="email"
+    value="fred at example.com"
+    petal:attributes="name name_email; id name_email; value self/email"
+  />
+
+    </p>
+    
+    <p>
+
+      <input
+        type="submit"
+        name="comment_delete"
+        id="comment_delete"
+        value="Delete Component"
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+        title="Delete this component."
+        petal:attributes="name name_delete; id name_delete"
+      />
+      |
+      <a 
+        href="#" 
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+        petal:attributes="href string:${self/mkdoc_uri},copy" 
+      >Copy to another document</a>
+      |
+      <a 
+        href="#" 
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+        petal:attributes="href string:${self/mkdoc_uri},move"
+      >Move to another document</a>
+    </p>
+
+</fieldset>
+
Index: www.conf
===================================================================
RCS file: /var/spool/cvs/mkd/conf/www.conf,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lconf/www.conf -Lconf/www.conf -u -r1.27 -r1.28
--- conf/www.conf
+++ conf/www.conf
@@ -14,6 +14,7 @@
 flo::plugin::Print
 flo::plugin::Poll
 flo::plugin::Photo
+flo::plugin::Comment
 
 # headlines
 flo::plugin::DC
--- /dev/null
+++ resources/templates/macros/comments/en.html
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC 
+  "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--?
+
+This template is used for rendering a list of comments in documents. 
+
+?-->
+<html>
+<head><title>Macros for displaying comment list</title></head>
+<body>
+
+<div
+  petal:condition="false: self/is_root"
+  petal:omit-tag=""
+  xmlns:petal="http://purl.org/petal/1.0/"
+  xmlns:metal="http://xml.zope.org/namespaces/metal"
+  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+  metal:define-macro="comments"
+  i18n:domain="mkdoc"
+  petal:define="
+    comment               plugin: flo::plugin::Comment;
+    comment_uri           comment/uri;
+    Comment_Loop          self/components_list --comment;
+              "
+>
+        <div
+          class="comments"
+          petal:condition="true: Comment_Loop"
+        >
+        <h2
+          xml:lang="en"
+          lang="en"
+          dir="ltr"
+          i18n:attributes="lang     two-letter-language-code;
+                           xml:lang two-letter-language-code;
+                           dir      text-direction;"
+          i18n:translate="comments"
+        >Comments</h2>
+        <div 
+          petal:repeat="component Comment_Loop"
+          petal:omit-tag=""
+        >
+          <div 
+            petal:replace="structure component/as_xhtml"
+          >
+            Comments Go Here
+          </div>
+        </div>
+        </div>
+        <p
+          class="add-a-comment"
+          petal:condition="true: comment/would_activate"
+        >You may <a petal:attributes="href comment/uri" href="../../comment/en.html">add a comment</a> to this document.</p>
+</div>
+
+</body>
+</html>


More information about the MKDoc-commit mailing list