incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1440867 - in /incubator/public/trunk: build.xml content/ content/style/style.css voter/status.py voter/utility.py
Date Thu, 31 Jan 2013 07:36:25 GMT
Author: brane
Date: Thu Jan 31 07:36:23 2013
New Revision: 1440867

URL: http://svn.apache.org/viewvc?rev=1440867&view=rev
Log:
Integrate voter into the incubator site.

* build.xml: Add stand-alone target "votestats" that regenerates
   target/site/votes.html from content/votes.xml.
* content/: Ignore generated votes.xml.
* content/style/style.css: Additional styles for vote status page.
* voter/status.py: Generate content/votes.xml in addition to the
   stand-alone page voter/votes.html.
* voter/utility.py: Update site structure.

Modified:
    incubator/public/trunk/build.xml
    incubator/public/trunk/content/   (props changed)
    incubator/public/trunk/content/style/style.css
    incubator/public/trunk/voter/status.py
    incubator/public/trunk/voter/utility.py

Modified: incubator/public/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/public/trunk/build.xml?rev=1440867&r1=1440866&r2=1440867&view=diff
==============================================================================
--- incubator/public/trunk/build.xml (original)
+++ incubator/public/trunk/build.xml Thu Jan 31 07:36:23 2013
@@ -35,6 +35,21 @@
         </echo>
     </target>
 
+    <target name="votestats" depends="prepare-error"
+            if="AnakiaTask.present"
+            description="Build embedded vote page">
+      <taskdef name="anakia" classname="org.apache.anakia.AnakiaTask">
+        <classpath refid="classpath"/>
+      </taskdef>
+      <anakia basedir="${docs.src}" destdir="${docs.dest}/"
+              extension=".html" style="./site.vsl"
+              projectFile="stylesheets/project.xml"
+              includes="votes.xml"
+              lastModifiedCheck="false"
+              templatePath="${docs.src}/stylesheets"
+              velocityPropertiesFile="build.props"/>
+    </target>
+
     <target name="docs" depends="prepare-error,generate-site-map,generate-menu,generate-index,report-groups,report-next-month,history"
         if="AnakiaTask.present"
         description="Build all the documents">

Propchange: incubator/public/trunk/content/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jan 31 07:36:23 2013
@@ -1 +1,2 @@
 sitemap.xml
+votes.xml

Modified: incubator/public/trunk/content/style/style.css
URL: http://svn.apache.org/viewvc/incubator/public/trunk/content/style/style.css?rev=1440867&r1=1440866&r2=1440867&view=diff
==============================================================================
--- incubator/public/trunk/content/style/style.css (original)
+++ incubator/public/trunk/content/style/style.css Thu Jan 31 07:36:23 2013
@@ -56,9 +56,20 @@ a:visited {color: #00438a;}
     border: 2px solid #bbbbbb;
     white-space: pre;
 }
-#clutch th {
+table#votero, table#voterc, table#votere, {
+  white-space: pre;
+}
+
+#clutch th, #votero th, #voterc th, #votere th {
   background-color: #cccccc;
 }
+#votero th, #voterc th, #votere th, #votero td, #voterc td, #votere td {
+  padding: 0.2em 0.5em;
+}
+#votero td, #voterc td, #votere td {
+  background-color: inherit;
+}
+#votero tr.normal, #voterc tr.normal, #votere tr.normal {}
 #clutch td {
   padding: 0.2em;
 }
@@ -66,18 +77,18 @@ a:visited {color: #00438a;}
   border: 2px solid #d55e00;
 }
 #clutch td.number {
-  text-align: right; 
+  text-align: right;
 }
-#clutch td.issue {
+#clutch td.issue, #votero tr.yell, #voterc tr.yell, #votere tr.yell {
   background-color: #d55e00;
 }
-#clutch td.care {
+#clutch td.care, #votero tr.nag, #voterc tr.nag, #votere tr.nag {
   background-color: #e69f00;
 }
 #clutch td.cool1 {
   background-color: #009e73;
 }
-#clutch td.cool2 {
+#clutch td.cool2, #votero tr.nudge, #voterc tr.nudge, #votere tr.nudge {
   background-color: #f0e442;
 }
 #clutch td.cool3 {

Modified: incubator/public/trunk/voter/status.py
URL: http://svn.apache.org/viewvc/incubator/public/trunk/voter/status.py?rev=1440867&r1=1440866&r2=1440867&view=diff
==============================================================================
--- incubator/public/trunk/voter/status.py (original)
+++ incubator/public/trunk/voter/status.py Thu Jan 31 07:36:23 2013
@@ -33,7 +33,22 @@ from utility import SiteStructure, UTC
 from voter import VoteDatabase
 
 
-__page_template = """\
+class __Template(object):
+    def __init__(self, page,
+                 current_table, current_row,
+                 closed_table, closed_row,
+                 issues_table, issues_row):
+        self.page = page
+        self.current_table = current_table
+        self.current_row = current_row
+        self.closed_table = closed_table
+        self.closed_row = closed_row
+        self.issues_table = issues_table
+        self.issues_row = issues_row
+
+
+__standalone = __Template(
+    page = """\
 <!DOCTYPE html>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
@@ -78,15 +93,14 @@ __page_template = """\
 </head>
 <body>
   <h1>Apache Incubator Voting Status</h1>
-  <p>Last recorded change: %s</p>
-%s
-%s
-%s
+  <p>Last recorded change: %(lastchange)s</p>
+%(current)s
+%(closed)s
+%(issues)s
 </body>
 </html>
-"""
-
-__current_table = """\
+""",
+    current_table = """\
   <h2>Current Votes</h2>
   <table>
     <tr>
@@ -96,17 +110,15 @@ __current_table = """\
      <th>Age</th>
     </tr>
 %s
-  </table>"""
-
-__current_row = """\
+  </table>""",
+    current_row = """\
     <tr class="%(klass)s">
       <td>%(subject)s</td>
       <td>%(updated)s</td>
       <td>%(noticed)s</td>
       <td>%(duration)s</td>
-    </tr>"""
-
-__closed_table = """\
+    </tr>""",
+    closed_table = """\
   <h2>Recently Closed Votes</h2>
   <table>
     <tr>
@@ -116,17 +128,15 @@ __closed_table = """\
      <th>Closed</th>
     </tr>
 %s
-  </table>"""
-
-__closed_row = """\
+  </table>""",
+    closed_row = """\
     <tr class="%(klass)s">
       <td>%(status)s</td>
       <td>%(subject)s</td>
       <td>%(noticed)s</td>
       <td>%(closed)s</td>
-    </tr>"""
-
-__issues_table = """\
+    </tr>""",
+    issues_table = """\
   <h2>Problems Found</h2>
   <table>
     <tr>
@@ -134,18 +144,99 @@ __issues_table = """\
       <th>Description</th>
     </tr>
 %s
-  </table>"""
-
-__issue_row = """\
+  </table>""",
+    issues_row = """\
   <tr class="%(klass)s">
     <td>%(kind)s</td>
     <td>%(message)s</td>
-  </tr>"""
+  </tr>""")
+
+__embedded = __Template(
+    page = """\
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document
+[
+<!ENTITY ndash  "&#8211;">
+<!ENTITY nbsp    "&#160;">
+]>
+<document>
+  <properties>
+    <title>Apache Incubator Voting Status</title>
+    <link href="http://purl.org/DC/elements/1.0/" rel="schema.DC"/>
+  </properties>
+  <body>
+    <section id="Apache+Incubator+Voting+Status">
+      <title>Apache Incubator Voting Status</title>
+      <p>Last recorded change: %(lastchange)s</p>
+%(current)s
+%(closed)s
+%(issues)s
+    </section>
+  </body>
+</document>
+""",
+    current_table = """\
+      <section id="Current+Votes">
+        <title>Current Votes</title>
+        <table id="votero">
+          <tr>
+           <th>Subject</th>
+           <th>Activity</th>
+           <th>Started</th>
+           <th>Age</th>
+          </tr>
+%s
+        </table>
+      </section>""",
+    current_row = """\
+          <tr class="%(klass)s">
+            <td>%(subject)s</td>
+            <td>%(updated)s</td>
+            <td>%(noticed)s</td>
+            <td>%(duration)s</td>
+          </tr>""",
+    closed_table = """\
+      <section id="Recently+Closed+Votes">
+        <title>Recently Closed Votes</title>
+        <table id="voterc">
+          <tr>
+           <th>Status</th>
+           <th>Subject</th>
+           <th>Started</th>
+           <th>Closed</th>
+          </tr>
+%s
+        </table>
+      </section>""",
+    closed_row = """\
+          <tr class="%(klass)s">
+            <td>%(status)s</td>
+            <td>%(subject)s</td>
+            <td>%(noticed)s</td>
+            <td>%(closed)s</td>
+          </tr>""",
+    issues_table = """\
+      <section id="Problems+Found">
+        <title>Problems Found</title>
+        <table id="votere">
+          <tr>
+            <th>Severity</th>
+            <th>Description</th>
+          </tr>
+%s
+        </table>
+      </section>""",
+    issues_row = """\
+        <tr class="%(klass)s">
+          <td>%(kind)s</td>
+          <td>%(message)s</td>
+        </tr>""")
+
 
 def escape_date(dateobject):
   return cgi.escape(UTC.timedate(dateobject)).replace('-', '&ndash;')
 
-def refresh_page(target, database):
+def refresh_page(template, target, database):
     current = []
     now = datetime.datetime.utcnow()
     for vote in database.list_open_votes():
@@ -170,14 +261,14 @@ def refresh_page(target, database):
            duration = '%d days' % days
 
 
-        current.append(__current_row
+        current.append(template.current_row
                        % dict(klass = klass,
                               duration = duration,
                               subject = cgi.escape(vote.subject),
                               updated = escape_date(vote.updated),
                               noticed = escape_date(vote.noticed)))
     if current:
-        current = __current_table % '\n'.join(current)
+        current = template.current_table % '\n'.join(current)
     else:
         current = ''
 
@@ -185,14 +276,14 @@ def refresh_page(target, database):
     for vote in database.list_resolved_votes():
         klass = vote.cancelled and 'nudge' or 'normal'
         status = vote.cancelled and 'Cancelled' or 'Resolved'
-        resolved.append(__closed_row
+        resolved.append(template.closed_row
                         % dict(klass = klass,
                                status = status,
                                subject = cgi.escape(vote.subject),
                                noticed = escape_date(vote.noticed),
                                closed = escape_date(vote.closed)))
     if resolved:
-        resolved = __closed_table % '\n'.join(resolved)
+        resolved = template.closed_table % '\n'.join(resolved)
     else:
         resolved = ''
 
@@ -205,25 +296,31 @@ def refresh_page(target, database):
         klass = 'nudge'
       else:
         klass = 'yell'
-      issues.append(__issue_row % dict(klass = klass,
-                                       kind = kind,
-                                       message = cgi.escape(message)))
+      issues.append(template.issues_row
+                    % dict(klass = klass,
+                           kind = kind,
+                           message = cgi.escape(message)))
     if issues:
-      issues = __issues_table % '\n'.join(issues)
+      issues = template.issues_table % '\n'.join(issues)
     else:
       issues = ''
 
     updated = cgi.escape(UTC.timestring(database.updated)).replace('-', '&ndash;')
     temp = target + '.temp'
     with open(temp, 'wt') as page:
-        page.write(__page_template % (updated, current, resolved, issues))
+        page.write(template.page % dict(lastchange = updated,
+                                        current = current,
+                                        closed = resolved,
+                                        issues = issues))
     os.rename(temp, target)
 
 
 def main():
     votes_path = SiteStructure.votes_database()
-    status_page = SiteStructure.status_page()
-    refresh_page(status_page, VoteDatabase(votes_path))
+    status_page = SiteStructure.standalone_status_page()
+    status_template = SiteStructure.status_page_template()
+    refresh_page(__standalone, status_page, VoteDatabase(votes_path))
+    refresh_page(__embedded, status_template, VoteDatabase(votes_path))
 
 if __name__ == '__main__':
     main()

Modified: incubator/public/trunk/voter/utility.py
URL: http://svn.apache.org/viewvc/incubator/public/trunk/voter/utility.py?rev=1440867&r1=1440866&r2=1440867&view=diff
==============================================================================
--- incubator/public/trunk/voter/utility.py (original)
+++ incubator/public/trunk/voter/utility.py Thu Jan 31 07:36:23 2013
@@ -92,10 +92,14 @@ class SiteStructure(object):
         return cls.incuvoter_path('votes.sqlite')
 
     @classmethod
-    def status_page(cls):
+    def standalone_status_page(cls):
         return cls.incuvoter_path('votes.html')
 
     @classmethod
+    def status_page_template(cls):
+        return cls.content_path('votes.xml')
+
+    @classmethod
     def podlings(cls):
         return cls.content_path('podlings.xml')
 



---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message