[MKDoc-commit] Headlines component split into three seperate templates to make it a bit

chris at mkdoc.demon.co.uk chris at mkdoc.demon.co.uk
Tue Mar 1 15:20:58 GMT 2005


Log Message:
-----------
Headlines component split into three seperate templates to make it a bit
simpler to follow.

Tags:
----
mkdoc-1-6

Modified Files:
--------------
    mkd/templates/component/headlines:
        en.html

Added Files:
-----------
    mkd/templates/component/headlines/anon:
        en.html
    mkd/templates/component/headlines/user:
        en.html
    mkd/templates/component/headlines/user_personalized:
        en.html

-------------- next part --------------
--- /dev/null
+++ templates/component/headlines/anon/en.html
@@ -0,0 +1,124 @@
+<!--?
+
+
+This template is used for rendering the headlines component in documents
+for anon users. 
+
+?-->
+<div
+  class="headlines"
+  xmlns:petal="http://purl.org/petal/1.0/"
+  xmlns:metal="http://xml.zope.org/namespaces/metal"
+  petal:condition="false: self/is_user_logged_in"
+>
+  <h2 
+    xml:lang="en"
+    lang="en"
+    dir="ltr"
+    petal:condition="true: self/title"
+    petal:attributes="xml:lang lang; lang lang; dir dir;"
+    petal:content="self/title"
+  >Headlines Title</h2>
+
+    <dl>
+
+      <!--? Generate upcoming events style headlines -->
+      <div 
+        petal:condition="true: self/mode_is_upcoming"
+        petal:repeat="row self/default_headlines" 
+        petal:omit-tag=""
+      >
+        <dt 
+          class="event"
+          petal:define="headline row/document; timerange row/timerange;"
+        >
+          <a
+              href="#"
+              hreflang="en"
+              lang="en"
+              xml:lang="en"
+              dir="ltr"
+              petal:attributes="href headline/uri; 
+                                hreflang headline/lang; 
+                                lang headline/lang; 
+                                xml:lang headline/lang; 
+                                dir headline/direction;"
+              petal:content="headline/title"
+            >Title of the document</a>
+        </dt>
+        <dd
+          class="event"
+        > 
+          <span
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            petal:attributes="lang headline/lang; 
+                              xml:lang headline/lang; 
+                              dir headline/direction;"
+            petal:content="timerange/title"
+          >
+            A description of the event.
+          </span>
+        </dd>
+        <dd
+          class="event"
+        >
+          <span
+            metal:use-macro="/macros/timerange/#simple"
+            class="mkdoc-date"
+          >
+            10:11am to 5:10pm Monday December 18 2005
+          </span>
+        </dd>
+      </div>
+
+
+      <!--? Generate newest documents style headlines -->
+      <div 
+        petal:condition="true: self/mode_is_newest"
+        petal:repeat="headline self/default_headlines" 
+        petal:omit-tag=""
+      >
+        <dt
+          class="document"
+        >
+          <a
+              href="#"
+              hreflang="en"
+              lang="en"
+              xml:lang="en"
+              dir="ltr"
+              petal:attributes="href headline/uri; 
+                                hreflang headline/lang; 
+                                lang headline/lang; 
+                                xml:lang headline/lang; 
+                                dir headline/direction;"
+              petal:content="headline/title"
+            >Title of the document</a>
+        </dt>
+        <dd
+          class="document"
+        > 
+          <span
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            petal:attributes="lang headline/lang; 
+                              xml:lang headline/lang; 
+                              dir headline/direction;"
+            petal:content="headline/description"
+          >
+            A description of the document.
+          </span>
+            <br />
+            <small petal:content="headline/date_created"> 
+              01-03-2005 
+            </small>
+        </dd>
+      </div>
+
+    </dl>
+
+  </div>
+</div>
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/component/headlines/Attic/en.html,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -Ltemplates/component/headlines/en.html -Ltemplates/component/headlines/en.html -u -r1.1.2.27 -r1.1.2.28
--- templates/component/headlines/en.html
+++ templates/component/headlines/en.html
@@ -5,295 +5,29 @@
 
 ?-->
 <div
-  class="headlines"
-  petal:define="
-    title                 self/title;
-    lang                  self/lang;
-    dir                   self/direction;
-    align                 self/align;
-    align_opposite        self/align_opposite;
-               "
   xmlns:petal="http://purl.org/petal/1.0/"
   xmlns:metal="http://xml.zope.org/namespaces/metal"
+  petal:omit-tag=""
 >
-  <h2 
-    xml:lang="en"
-    lang="en"
-    dir="ltr"
-    align="left"
-    petal:condition="true: title"
-    petal:attributes="xml:lang lang; lang lang; dir dir; align align"
-    petal:content="self/title"
-  >Demain, on rase gratis!</h2>
-
-  <!--? The following error messages are for editors 
-        However they don't work...
-
-  <div
-    petal:condition="true: self/user/is_admin"
-  >
-    <p
-      xml:lang="en"
-      lang="en"
-      dir="ltr"
-      align="left"
-      petal:attributes="align align"
-    >
-      You seem to have specified a base headlines path that doesn't exist,
-      are you sure you want to do this?
-    </p>
-    <p
-      xml:lang="en"
-      lang="en"
-      dir="ltr"
-      align="left"
-      petal:attributes="align align"
-    >
-      You seem to have specified a base headlines path for a document 
-      without children are you sure you want to do this?                    
-    </p>
-  </div ?-->
-
-  <!--? The following is for people accessing the site with a username ?-->
+  <!--? Access with a username ?-->
   <div 
     petal:condition="true: self/is_user_logged_in"
+    petal:omit-tag=""
   >
-    <!--? The following is for people accessing the site with a username
-          and with a match between their preferences and the documents ?-->
+    <!--? Personalized headlines - there is a match between their preferences and the documents ?-->
     <div 
-      class="custom-headlines" 
       petal:condition="true: self/personalized_headlines"
+      petal:omit-tag=""
     >
-      <p
-        xml:lang="en"
-        lang="en"
-        dir="ltr"
-        align="left"
-        petal:attributes="align align"
-      >
-        The following list of documents has been personalised for you based on
-        <a 
-          petal:define="preferences_p plugin: flo::plugin::Account::Preferences"
-          petal:attributes="href preferences_p/uri"
-          href="./.account.preferences"
-        >your preferences</a>:
-      </p>
-      <dl>
-        <!--? Generate upcoming events style headlines -->
-        <div 
-          petal:condition="true: self/mode_is_upcoming"
-          petal:repeat="row self/personalized_headlines" 
-          petal:omit-tag="string:1"
-        >
-          <dt 
-            class="event"
-            petal:define="headline row/document; timerange row/timerange;"
-          >
-            <a
-                href="#"
-                hreflang="en"
-                lang="en"
-                xml:lang="en"
-                dir="ltr"
-                petal:attributes="href headline/uri; 
-                                  hreflang headline/lang; 
-                                  lang headline/lang; 
-                                  xml:lang headline/lang; 
-                                  dir headline/direction;"
-                petal:content="headline/title"
-              >Title of the document</a>
-          </dt>
-          <dd
-            class="event"
-          > 
-            <span
-              lang="en"
-              xml:lang="en"
-              dir="ltr"
-              petal:attributes="lang headline/lang; 
-                                xml:lang headline/lang; 
-                                dir headline/direction;"
-              petal:content="timerange/title"
-            >
-              A description of the event.
-            </span>
-          </dd>
-          <dd
-            class="event"
-          >
-            <span
-              metal:use-macro="/macros/timerange/#simple"
-              class="mkdoc-date"
-            >
-              10:11am to 5:10pm Monday December 18 2005
-            </span>
-          </dd>
-        </div>
-
-
-        <!--? Generate newest documents style headlines -->
-        <div 
-          petal:condition="true: self/mode_is_newest"
-          petal:repeat="headline self/personalized_headlines" 
-          petal:omit-tag="string:1"
-        >
-          <dt
-            class="document"
-          >
-            <a
-                href="#"
-                hreflang="en"
-                lang="en"
-                xml:lang="en"
-                dir="ltr"
-                petal:attributes="href headline/uri; 
-                                  hreflang headline/lang; 
-                                  lang headline/lang; 
-                                  xml:lang headline/lang; 
-                                  dir headline/direction;"
-                petal:content="headline/title"
-              >Title of the document</a>
-          </dt>
-          <dd
-            class="document"
-          > 
-            <span
-              lang="en"
-              xml:lang="en"
-              dir="ltr"
-              petal:attributes="lang headline/lang; 
-                                xml:lang headline/lang; 
-                                dir headline/direction;"
-              petal:content="headline/description"
-            >
-              A description of the document.
-            </span>
-            <br />
-            <small petal:content="headline/date_created"> 
-             DATE
-            </small>
-          </dd>
-        </div>
-      </dl>
+      <?include file="./user_personalized/"?>
     </div>
 
-    <!--? The following is for people accessing the site with a username
-          but with no match between their preferences and the documents ?-->
+    <!--? Default headlines - no match between their preferences and the documents ?-->
     <div 
       petal:condition="false: self/personalized_headlines"
+      petal:omit-tag=""
     >
-      <p
-        lang="en"
-        xml:lang="en"
-        dir="ltr"
-        align="left"
-        petal:attributes="align align"
-      >
-        This list of documents has not been personalized because you didn't set
-        <a 
-          petal:define="preferences_p plugin: flo::plugin::Account::Preferences"
-          petal:attributes="href preferences_p/uri"
-          href="./.account.preferences"
-        >your preferences</a>
-        or because none of the documents in the list matched them.
-      </p>
-      <dl>
-        <!--? Generate upcoming events style headlines -->
-        <div 
-          petal:condition="true: self/mode_is_upcoming"
-          petal:repeat="row self/default_headlines" 
-          petal:omit-tag="string:1"
-        >
-          <dt
-            class="event" 
-            petal:define="headline row/document; timerange row/timerange;"
-          >
-            <a
-                href="#"
-                hreflang="en"
-                lang="en"
-                xml:lang="en"
-                dir="ltr"
-                petal:attributes="href headline/uri; 
-                                  hreflang headline/lang; 
-                                  lang headline/lang; 
-                                  xml:lang headline/lang; 
-                                  dir headline/direction;"
-                petal:content="headline/title"
-              >Title of the document</a>
-          </dt>
-          <dd
-            class="event" 
-          > 
-            <span
-              lang="en"
-              xml:lang="en"
-              dir="ltr"
-              petal:attributes="lang headline/lang; 
-                                xml:lang headline/lang; 
-                                dir headline/direction;"
-              petal:content="timerange/title"
-            >
-              A description of the event.
-            </span>
-          </dd>
-          <dd
-            class="event" 
-          >
-            <span
-              metal:use-macro="/macros/timerange/#simple"
-              class="mkdoc-date"
-            >
-              10:11am to 5:10pm Monday December 18 2005
-            </span>
-          </dd>
-        </div>
-
-
-        <!--? Generate newest documents style headlines -->
-        <div 
-          petal:condition="true: self/mode_is_newest"
-          petal:repeat="headline self/default_headlines" 
-          petal:omit-tag="string:1"
-        >
-          <dt
-            class="document"
-          >
-            <a
-                href="#"
-                hreflang="en"
-                lang="en"
-                xml:lang="en"
-                dir="ltr"
-                petal:attributes="href headline/uri; 
-                                  hreflang headline/lang; 
-                                  lang headline/lang; 
-                                  xml:lang headline/lang; 
-                                  dir headline/direction;"
-                petal:content="headline/title"
-              >Title of the document</a>
-          </dt>
-          <dd
-            class="document"
-          >
-            <span
-              lang="en"
-              xml:lang="en"
-              dir="ltr"
-              petal:attributes="lang headline/lang; 
-                                xml:lang headline/lang; 
-                                dir headline/direction;"
-              petal:content="headline/description"
-            >
-              A description of the document.
-            </span>
-            <br />
-            <small petal:content="headline/date_created"> 
-             DATE
-            </small>
-          </dd>
-        </div>
-      </dl>
+      <?include file="./user/"?>
     </div>
   </div>
 
@@ -301,105 +35,6 @@
   <div 
     petal:condition="false: self/is_user_logged_in"
   >
-    <dl>
-
-      <!--? Generate upcoming events style headlines -->
-      <div 
-        petal:condition="true: self/mode_is_upcoming"
-        petal:repeat="row self/default_headlines" 
-        petal:omit-tag="string:1"
-      >
-        <dt 
-          class="event"
-          petal:define="headline row/document; timerange row/timerange;"
-        >
-          <a
-              href="#"
-              hreflang="en"
-              lang="en"
-              xml:lang="en"
-              dir="ltr"
-              petal:attributes="href headline/uri; 
-                                hreflang headline/lang; 
-                                lang headline/lang; 
-                                xml:lang headline/lang; 
-                                dir headline/direction;"
-              petal:content="headline/title"
-            >Title of the document</a>
-        </dt>
-        <dd
-          class="event"
-        > 
-          <span
-            lang="en"
-            xml:lang="en"
-            dir="ltr"
-            petal:attributes="lang headline/lang; 
-                              xml:lang headline/lang; 
-                              dir headline/direction;"
-            petal:content="timerange/title"
-          >
-            A description of the event.
-          </span>
-        </dd>
-        <dd
-          class="event"
-        >
-          <span
-            metal:use-macro="/macros/timerange/#simple"
-            class="mkdoc-date"
-          >
-            10:11am to 5:10pm Monday December 18 2005
-          </span>
-        </dd>
-      </div>
-
-
-      <!--? Generate newest documents style headlines -->
-      <div 
-        petal:condition="true: self/mode_is_newest"
-        petal:repeat="headline self/default_headlines" 
-        petal:omit-tag="string:1"
-      >
-        <dt
-          class="document"
-        >
-          <a
-              href="#"
-              hreflang="en"
-              lang="en"
-              xml:lang="en"
-              dir="ltr"
-              petal:attributes="href headline/uri; 
-                                hreflang headline/lang; 
-                                lang headline/lang; 
-                                xml:lang headline/lang; 
-                                dir headline/direction;"
-              petal:content="headline/title"
-            >Title of the document</a>
-        </dt>
-        <dd
-          class="document"
-        > 
-          <span
-            lang="en"
-            xml:lang="en"
-            dir="ltr"
-            petal:attributes="lang headline/lang; 
-                              xml:lang headline/lang; 
-                              dir headline/direction;"
-            petal:content="headline/description"
-          >
-            A description of the document.
-          </span>
-            <br />
-            <small petal:content="headline/date_created"> 
-             DATE
-            </small>
-        </dd>
-      </div>
-
-    </dl>
-
+    <?include file="./anon/"?>
   </div>
 </div>
--- /dev/null
+++ templates/component/headlines/user/en.html
@@ -0,0 +1,140 @@
+<!--?
+
+
+This template is used for rendering the headlines component in documents
+for logged in users who don't get personalized headlines either because 
+nothing matches their preferences or because they haven't set their 
+preferences. 
+
+?-->
+<div
+  class="headlines"
+  xmlns:petal="http://purl.org/petal/1.0/"
+  xmlns:metal="http://xml.zope.org/namespaces/metal"
+  petal:condition="true: self/is_user_logged_in; 
+                   false: self/personalized_headlines"
+>
+  <h2 
+    xml:lang="en"
+    lang="en"
+    dir="ltr"
+    petal:condition="true: self/title"
+    petal:attributes="xml:lang lang; lang lang; dir dir;"
+    petal:content="self/title"
+  >Headlines Title</h2>
+
+  <p
+    lang="en"
+    xml:lang="en"
+    dir="ltr"
+  >
+    This list of documents has not been personalized because you didn't set
+    <a 
+      petal:define="preferences_p plugin: flo::plugin::Account::Preferences"
+      petal:attributes="href preferences_p/uri"
+      href="./.account.preferences"
+    >your preferences</a>
+    or because none of the documents in the list matched them.
+  </p>
+
+  <dl>
+
+    <!--? Generate upcoming events style headlines -->
+    <div 
+      petal:condition="true: self/mode_is_upcoming"
+      petal:repeat="row self/default_headlines" 
+      petal:omit-tag=""
+    >
+      <dt
+        class="event" 
+        petal:define="headline row/document; timerange row/timerange;"
+      >
+        <a
+            href="#"
+            hreflang="en"
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            petal:attributes="href headline/uri; 
+                              hreflang headline/lang; 
+                              lang headline/lang; 
+                              xml:lang headline/lang; 
+                              dir headline/direction;"
+            petal:content="headline/title"
+          >Title of the document</a>
+      </dt>
+      <dd
+        class="event" 
+      > 
+        <span
+          lang="en"
+          xml:lang="en"
+          dir="ltr"
+          petal:attributes="lang headline/lang; 
+                            xml:lang headline/lang; 
+                            dir headline/direction;"
+          petal:content="timerange/title"
+        >
+          A description of the event.
+        </span>
+      </dd>
+      <dd
+        class="event" 
+      >
+        <span
+          metal:use-macro="/macros/timerange/#simple"
+          class="mkdoc-date"
+        >
+          10:11am to 5:10pm Monday December 18 2005
+        </span>
+      </dd>
+    </div>
+
+    <!--? Generate newest documents style headlines -->
+    <div 
+      petal:condition="true: self/mode_is_newest"
+      petal:repeat="headline self/default_headlines" 
+      petal:omit-tag=""
+    >
+      <dt
+        class="document"
+      >
+        <a
+            href="#"
+            hreflang="en"
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            petal:attributes="href headline/uri; 
+                              hreflang headline/lang; 
+                              lang headline/lang; 
+                              xml:lang headline/lang; 
+                              dir headline/direction;"
+            petal:content="headline/title"
+          >Title of the document</a>
+      </dt>
+      <dd
+        class="document"
+      >
+        <span
+          lang="en"
+          xml:lang="en"
+          dir="ltr"
+          petal:attributes="lang headline/lang; 
+                            xml:lang headline/lang; 
+                            dir headline/direction;"
+          petal:content="headline/description"
+        >
+          A description of the document.
+        </span>
+        <br />
+        <small petal:content="headline/date_created"> 
+          01-03-2005
+        </small>
+      </dd>
+    </div>
+
+  </dl>
+
+</div>
+
--- /dev/null
+++ templates/component/headlines/user_personalized/en.html
@@ -0,0 +1,136 @@
+<!--?
+
+
+This template is used for rendering the headlines component in documents
+for users whos preference have been matched. 
+
+?-->
+<div
+  class="headlines"
+  xmlns:petal="http://purl.org/petal/1.0/"
+  xmlns:metal="http://xml.zope.org/namespaces/metal"
+  petal:condition="true: self/is_user_logged_in; 
+                   true: self/personalized_headlines"
+>
+  <h2 
+    xml:lang="en"
+    lang="en"
+    dir="ltr"
+    petal:condition="true: self/title"
+    petal:attributes="xml:lang lang; lang lang; dir dir;"
+    petal:content="self/title"
+  >Headlines Title</h2>
+
+  <p
+    xml:lang="en"
+    lang="en"
+    dir="ltr"
+  >
+    The following list of documents has been personalised for you based on
+    <a 
+      petal:define="preferences_p plugin: flo::plugin::Account::Preferences"
+      petal:attributes="href preferences_p/uri"
+      href="./.account.preferences"
+    >your preferences</a>:
+  </p>
+
+  <dl>
+
+    <!--? Generate upcoming events style headlines -->
+    <div 
+      petal:condition="true: self/mode_is_upcoming"
+      petal:repeat="row self/personalized_headlines" 
+      petal:omit-tag=""
+    >
+      <dt 
+        class="event"
+        petal:define="headline row/document; timerange row/timerange;"
+      >
+        <a
+            href="#"
+            hreflang="en"
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            petal:attributes="href headline/uri; 
+                              hreflang headline/lang; 
+                              lang headline/lang; 
+                              xml:lang headline/lang; 
+                              dir headline/direction;"
+            petal:content="headline/title"
+          >Title of the document</a>
+      </dt>
+      <dd
+        class="event"
+      > 
+        <span
+          lang="en"
+          xml:lang="en"
+          dir="ltr"
+          petal:attributes="lang headline/lang; 
+                            xml:lang headline/lang; 
+                            dir headline/direction;"
+          petal:content="timerange/title"
+        >
+          A description of the event.
+        </span>
+      </dd>
+      <dd
+        class="event"
+      >
+        <span
+          metal:use-macro="/macros/timerange/#simple"
+          class="mkdoc-date"
+        >
+          10:11am to 5:10pm Monday December 18 2005
+        </span>
+      </dd>
+    </div>
+
+
+    <!--? Generate newest documents style headlines -->
+    <div 
+      petal:condition="true: self/mode_is_newest"
+      petal:repeat="headline self/personalized_headlines" 
+      petal:omit-tag=""
+    >
+      <dt
+        class="document"
+      >
+        <a
+            href="#"
+            hreflang="en"
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            petal:attributes="href headline/uri; 
+                              hreflang headline/lang; 
+                              lang headline/lang; 
+                              xml:lang headline/lang; 
+                              dir headline/direction;"
+            petal:content="headline/title"
+          >Title of the document</a>
+      </dt>
+      <dd
+        class="document"
+      > 
+        <span
+          lang="en"
+          xml:lang="en"
+          dir="ltr"
+          petal:attributes="lang headline/lang; 
+                            xml:lang headline/lang; 
+                            dir headline/direction;"
+          petal:content="headline/description"
+        >
+          A description of the document.
+        </span>
+        <br />
+        <small petal:content="headline/date_created"> 
+          01-03-2005
+        </small>
+      </dd>
+    </div>
+  </dl>
+
+</div>


More information about the MKDoc-commit mailing list