changeset 46:db11c846cc7d

convert About template to Markup
author mgood
date Tue, 04 Jul 2006 02:10:37 +0000
parents 021515aacc17
children 04bb078c6234
files examples/trac/templates/about.html examples/trac/trac/About.py
diffstat 2 files changed, 136 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/examples/trac/templates/about.html
@@ -0,0 +1,125 @@
+<!DOCTYPE html
+    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:py="http://purl.org/kid/ns#"
+      xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="layout.html"><xi:fallback/></xi:include>
+  <head>
+    <title>About Trac</title>
+  </head>
+
+  <body>
+    <div id="ctxtnav" class="nav">
+      <h2>About Navigation</h2>
+      <ul>
+        <li class="first last">
+          <a href="${href.about()}">Overview</a>
+        </li>
+        <li py:if="'CONFIG_VIEW' in perm">
+          <a href="${href.about('config')}">Configuration</a>
+        </li>
+        <li class="last" py:if="'CONFIG_VIEW' in perm">
+          <a href="${href.about('plugins')}">Plugins</a>
+        </li>
+      </ul>
+    </div>
+    <div id="content" class="${about.page and 'about_%s' % about.page or 'about'}"
+         py:choose="about.page">
+
+      <div py:when="'config'" py:strip="">
+        <h1>Configuration</h1>
+        <table>
+          <thead>
+            <tr>
+              <th class="section">Section</th>
+              <th class="name">Name</th>
+              <th class="value">Value</th>
+            </tr>
+          </thead>
+          <tbody>
+            <div py:for="section in about.config" py:strip="">
+            <tr py:for="idx,option in enumerate(section.options)">
+              <th py:if="idx == 0" class="section"
+                  rowspan="${str(len(section.options))}">
+                  ${section.name}</th>
+              <td class="name">${option.name}</td>
+              <td class="${option.valueclass}">${option.value}</td>
+            </tr>
+            </div>
+          </tbody>
+        </table>
+        <div id="help">
+         See <a href="${href.wiki('TracIni')}">TracIni</a> for information about
+         the configuration.
+        </div>
+      </div>
+
+      <div py:when="'plugins'" py:strip="">
+        <h1>Plugins</h1>
+        <dl id="plugins">
+          <div py:for="plugin in about.plugins" py:strip="">
+          <h2 id="${plugin.module}.${plugin.name}">${plugin.name}</h2>
+          <table>
+            <tr>
+              <th class="module" scope="row">Module</th>
+              <td class="module">${plugin.module}<br />
+              <span class="path">${plugin.path}</span></td>
+            </tr>
+            <tr py:if="plugin.description">
+              <th class="description" scope="row">Description</th>
+              <td class="description">${HTML(plugin.description)}</td>
+            </tr>
+            <tr py:for="idx,extension_point in enumerate(plugin.extension_points)">
+              <th py:if="idx == 0" class="xtnpts"
+                  rowspan="${str(len(plugin.extension_points))}">
+                Extension points:
+              </th>
+              <td class="xtnpts">        
+                <code>${extension_point.module}.${extension_point.interface}</code>
+                <div py:if="extension_point.extensions" py:strip="">
+                (${len(extension_point.extensions)} extensions)
+                <ul>
+                  <li py:for="extension in extension_point.extensions">
+                    <a href="#${extension.module}.${extension.name}">${extension.name}</a>
+                  </li>
+                </ul>
+                </div>
+                <div class="description">${HTML(extension_point.description)}</div>
+              </td>
+            </tr>
+          </table>
+          </div>
+        </dl>
+      </div>
+
+      <div py:otherwise="" py:strip="">
+        <a href="http://trac.edgewall.com"
+           style="border: none; float: right; margin-left: 2em">
+          <img style="display: block" src="${href.chrome('common/trac_banner.png')}"
+               alt="Trac: Integrated SCM &amp; Project Management"/>
+        </a>
+        <h1>About Trac ${trac.version}</h1>
+        <p>Trac is a web-based software project management and bug/issue
+        tracking system emphasizing ease of use and low ceremony. 
+        It provides an interface to the Subversion revision control systems,
+        integrated Wiki and convenient report facilities. 
+        </p>
+        <p>Trac is distributed under the modified BSD License.<br />
+        The complete text of the license can be found in the COPYING file
+        included in the distribution.</p>
+        <p>Please visit the Trac open source project: 
+        <a href="http://projects.edgewall.com/trac/">http://projects.edgewall.com/trac/</a></p>
+        <p>Trac is a product of <a href="http://www.edgewall.com/">Edgewall
+        Software</a>, provider of professional Linux and software development
+        services.</p>
+        <p>Copyright &copy; 2003-2006 <a href="http://www.edgewall.com/">Edgewall
+        Software</a></p>
+        <a href="http://www.edgewall.com/">
+          <img style="display: block; margin: 30px"
+               src="${href.chrome('common/edgewall.png')}"
+               alt="Edgewall Software"/></a>
+      </div>
+    </div>
+  </body>
+</html>
--- a/examples/trac/trac/About.py
+++ b/examples/trac/trac/About.py
@@ -56,25 +56,22 @@
 
     def process_request(self, req):
         page = req.args.get('page', 'default')
-        req.hdf['title'] = 'About Trac'
-        if req.perm.has_permission('CONFIG_VIEW'):
-            req.hdf['about.config_href'] = req.href.about('config')
-            req.hdf['about.plugins_href'] = req.href.about('plugins')
         if page == 'config':
-            self._render_config(req)
+            data = self._render_config(req)
         elif page == 'plugins':
-            self._render_plugins(req)
+            data = self._render_plugins(req)
+        else:
+            data = {}
 
         add_stylesheet(req, 'common/css/about.css')
-        return 'about.cs', None
+        return 'about.html', {'about': data}, None
 
     # Internal methods
 
     def _render_config(self, req):
         req.perm.assert_permission('CONFIG_VIEW')
-        req.hdf['about.page'] = 'config'
+        data = {'page': 'config'}
         
-        # Export the config table to hdf
         sections = []
         for section in self.config.sections():
             options = []
@@ -88,7 +85,8 @@
             options.sort(lambda x,y: cmp(x['name'], y['name']))
             sections.append({'name': section, 'options': options})
         sections.sort(lambda x,y: cmp(x['name'], y['name']))
-        req.hdf['about.config'] = sections
+        data['config'] = sections
+        return data
         # TODO:
         # We should probably export more info here like:
         # permissions, components...
@@ -104,8 +102,8 @@
                 return obj.__doc__
         req.perm.assert_permission('CONFIG_VIEW')
         import sys
-        req.hdf['about.page'] = 'plugins'
         from trac.core import ComponentMeta
+        data = {'page': 'plugins'}
         plugins = []
         for component in ComponentMeta._components:
             if not self.env.is_component_enabled(component):
@@ -149,4 +147,5 @@
             return c
         plugins.sort(plugincmp)
 
-        req.hdf['about.plugins'] = plugins
+        data['plugins'] = plugins
+        return data
Copyright (C) 2012-2017 Edgewall Software