You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by gj...@apache.org on 2012/05/08 18:13:04 UTC

svn commit: r1335612 - in /incubator/bloodhound/trunk/bloodhound_theme/bhtheme: templates/bh_diff_options.html templates/bh_diff_view.html templates/bh_history_view.html templates/bh_wiki_diff.html theme.py

Author: gjm
Date: Tue May  8 16:13:04 2012
New Revision: 1335612

URL: http://svn.apache.org/viewvc?rev=1335612&view=rev
Log:
theme: wiki page diff and history - towards #58 (from olemis)

Added:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_options.html   (with props)
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_view.html   (with props)
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_history_view.html   (with props)
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_diff.html   (with props)
Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_options.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_options.html?rev=1335612&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_options.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_options.html Tue May  8 16:13:04 2012
@@ -0,0 +1,52 @@
+<!--! Add diff option fields (to be used inside a form)
+ 
+     `diff` the datastructure which contains diff options
+-->
+<div xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:i18n="http://genshi.edgewall.org/i18n"
+    py:strip="">
+  <label for="style">View differences</label>
+  <select id="style" name="style" class="input-medium">
+    <option selected="${diff.style == 'inline' or None}"
+            value="inline">inline</option>
+    <option selected="${diff.style == 'sidebyside' or None}"
+            value="sidebyside">side by side</option>
+  </select>
+  <div class="control-group">
+    <i18n:msg>
+      <input type="radio" name="contextall" value="0"
+                    checked="${not diff.options.contextall or None}"/>
+      <label>Show</label>
+      <input type="text" name="contextlines" size="2" class="input-mini"
+                    maxlength="3" value="${diff.options.contextlines &lt; 0 and 
+                                           'all' or diff.options.contextlines}"/>
+      <label> lines around each change</label>
+    </i18n:msg><br/>
+    <input type="radio" name="contextall" value="1"
+                  checked="${diff.options.contextall or None}"/>
+    <label>Show the changes in full context</label>
+  </div>
+  <fieldset id="ignore" py:with="options = diff.options" style="padding: 0px">
+    <legend>Ignore:</legend>
+    <div class="field">
+      <input type="checkbox" id="ignoreblanklines" name="ignoreblanklines"
+             checked="${options.ignoreblanklines or None}" />
+      <label for="ignoreblanklines">Blank lines</label>
+    </div>
+    <div class="field">
+      <input type="checkbox" id="ignorecase" name="ignorecase"
+             checked="${options.ignorecase or None}" />
+      <label for="ignorecase">Case changes</label>
+    </div>
+    <div class="field">
+      <input type="checkbox" id="ignorewhitespace" name="ignorewhitespace"
+             checked="${options.ignorewhitespace or None}" />
+      <label for="ignorewhitespace">White space changes</label>
+    </div>
+  </fieldset>
+  <div class="control-group">
+    <input class="btn btn-info" type="submit" name="update" value="${_('Update')}" />
+  </div>
+</div>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_options.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_options.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_view.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_view.html?rev=1335612&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_view.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_view.html Tue May  8 16:13:04 2012
@@ -0,0 +1,85 @@
+<!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://genshi.edgewall.org/"
+      xmlns:i18n="http://genshi.edgewall.org/i18n"
+      xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="layout.html" />
+  <head>
+    <title>$title</title>
+    <link rel="stylesheet" type="text/css" href="${chrome.htdocs_location}css/diff.css" />
+    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
+  </head>
+
+  <body>
+    <div id="content" class="${resource.realm} row">
+      <h1 py:choose="">
+        <py:when test="old_version"><i18n:msg params="old, new, name">Changes between
+          <a href="${old_url or url_of(resource, version=old_version)}">Version $old_version</a> and
+          <a href="${new_url or url_of(resource, version=new_version)}">Version $new_version</a> of
+          <a href="${url or url_of(resource)}">${name or name_of(resource)}</a>
+        </i18n:msg></py:when>
+        <py:when test="old_version == 0"><i18n:msg params="new, name">Changes between
+          <a href="${old_url or url_of(resource, version=0)}">Initial Version</a> and
+          <a href="${new_url or url_of(resource, version=new_version)}">Version $new_version</a> of
+          <a href="${url or url_of(resource)}">${name or name_of(resource)}</a>
+        </i18n:msg></py:when>
+        <py:otherwise><i18n:msg params="new, name">Changes from
+          <a href="${new_url or url_of(resource, version=new_version)}">Version $new_version</a> of
+          <a href="${url or url_of(resource)}">${name or name_of(resource)}</a>
+        </i18n:msg></py:otherwise>
+      </h1>
+      <div class="span9">
+        <dl py:with="multi = num_changes &gt; 1" class="dl-horizontal">
+          <dt class="property time">Timestamp:</dt>
+          <dd class="time" py:choose="">
+            <em py:when="multi" class="multi">(multiple changes)</em>
+            <py:when test="change.date">
+              <i18n:msg params="date, duration">${format_datetime(change.date)} (${dateinfo(change.date)} ago)</i18n:msg>
+            </py:when>
+            <py:otherwise>--</py:otherwise>
+          </dd>
+          <dt class="property author">Author:</dt>
+          <dd class="author" py:choose="">
+            <em py:when="multi" class="multi">(multiple changes)</em>
+            <py:otherwise>${authorinfo(change.author)}
+              <span py:if="show_ip_addresses and 'ipnr' in change" class="ipnr"><i18n:msg params="ipnr">(IP: $change.ipnr)</i18n:msg></span></py:otherwise>
+          </dd>
+          <dt class="property message">Comment:</dt>
+          <dd class="message" py:choose="" xml:space="preserve">
+            <em py:when="multi" class="multi">(multiple changes)</em>
+            <py:otherwise>${wiki_to_html(context.child(resource), change.comment)}</py:otherwise>
+          </dd>
+        </dl>
+        <div class="diff">
+          <div class="legend" id="diff-legend">
+            <h3>Legend:</h3>
+            <dl>
+              <dt class="unmod"></dt><dd>Unmodified</dd>
+              <dt class="add"></dt><dd>Added</dd>
+              <dt class="rem"></dt><dd>Removed</dd>
+              <dt class="mod"></dt><dd>Modified</dd>
+            </dl>
+          </div>
+  
+          <xi:include href="diff_div.html" py:with="no_id=False"/>
+  
+        </div>
+      </div>
+      <div class="span3">
+        <div class="well">
+          <form method="post" id="prefs" action="${diff_url or url_of(resource)}">
+            <input type="hidden" name="action" value="${diff_action or 'diff'}" />
+            <input py:for="k, v in diff_args or []" type="hidden" name="$k" value="$v"/>
+            <input type="hidden" name="version" value="$new_version" />
+            <input type="hidden" name="old_version" value="$old_version" />
+            <div>
+              <xi:include href="bh_diff_options.html" />
+            </div>
+          </form>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_view.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_diff_view.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_history_view.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_history_view.html?rev=1335612&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_history_view.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_history_view.html Tue May  8 16:13:04 2012
@@ -0,0 +1,64 @@
+<!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://genshi.edgewall.org/"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      xmlns:i18n="http://genshi.edgewall.org/i18n">
+  <xi:include href="layout.html" />
+  <head>
+    <title>$title</title>
+    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
+  </head>
+
+  <body>
+    <div id="content" class="ticket row">
+      <h1 i18n:msg="name">Change History for <a href="${url or url_of(resource)}">${name or name_of(resource)}</a></h1>
+      <br/>
+
+      <div class="span12">
+        <form py:if="history" class="printableform" method="get" action="">
+          <input type="hidden" name="action" value="${diff_action or 'diff'}" />
+          <input py:for="k, v in diff_args or []" type="hidden" name="$k" value="$v"/>
+          <div class="control-group">
+            <input class="btn btn-primary" type="submit" value="${_('View changes')}" />
+          </div>
+          <table id="fieldhist" class="table" summary="Change history">
+            <thead>
+              <tr>
+                <th class="diff"></th>
+                <th class="version">Version</th>
+                <th class="date">Date</th>
+                <th class="author">Author</th>
+                <th class="comment">Comment</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr py:for="idx, item in enumerate(history)" class="${'odd' if idx % 2 else 'even'}">
+                <td class="diff">
+                  <input type="radio" name="old_version" value="$item.version"
+                         checked="${idx == 1 or None}" />
+                  <input type="radio" name="version" value="$item.version"
+                         checked="${idx == 0 or None}" />
+                </td>
+                <td class="version">
+                  <a href="${item.url or url_of(resource, version=item.version)}" title="View this version">$item.version</a>
+                </td>
+                <td class="date">${pretty_dateinfo(item.date, dateonly=True)}</td>
+                <td class="author"
+                    title="${_('IP-Address: %(ipnr)s', ipnr=item.ipnr)
+                             if show_ip_addresses and item.ipnr else None}">${authorinfo(item.author)}</td>
+                <td class="comment">${wiki_to_oneliner(context.child(resource), item.comment, shorten=True)}</td>
+              </tr>
+            </tbody>
+          </table>
+          <py:if test="len(history) &gt; 10">
+            <div class="buttons">
+              <input type="submit" value="${_('View changes')}" />
+            </div>
+          </py:if>
+        </form>
+      </div>
+    </div>
+  </body>
+</html>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_history_view.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_history_view.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_diff.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_diff.html?rev=1335612&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_diff.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_diff.html Tue May  8 16:13:04 2012
@@ -0,0 +1,28 @@
+<!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://genshi.edgewall.org/"
+      xmlns:xi="http://www.w3.org/2001/XInclude" py:strip="">
+  <py:match path="div[@id='content']" once="true"><div py:attrs="select('@*')">
+    ${select('*|text()')}
+    <div class="span9 offset3">
+      <form py:if="'WIKI_DELETE' in perm(page.resource) and
+                   (not changes[0].diffs or new_version == latest_version)"
+          method="get" action="${href.wiki(page.name)}">
+        <input type="hidden" name="action" value="delete" />
+        <input type="hidden" name="version" value="$new_version" />
+        <input type="hidden" name="old_version" value="$old_version" />
+        <div class="control-group">
+          <py:choose>
+            <input py:when="new_version - old_version &gt; 1" type="submit" name="delete_version" value="${_('Delete version %(old_version)d to version %(version)d', old_version=(old_version + 1), version=new_version)}" class="btn btn-danger" />
+            <input py:otherwise="" type="submit" name="delete_version" value="${_('Delete version %(version)d', version=new_version)}" class="btn btn-danger" />
+          </py:choose>
+        </div>
+      </form>
+    </div>
+  </div></py:match>
+  <py:with vars="resource = page.resource">
+    <xi:include href="bh_diff_view.html" />
+  </py:with>
+</html>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_diff.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_diff.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1335612&r1=1335611&r2=1335612&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Tue May  8 16:13:04 2012
@@ -95,9 +95,13 @@ class BloodhoundTheme(ThemeBase):
 
         # Wiki
         'wiki_delete.html' : ('bh_wiki_delete.html', None),
+        'wiki_diff.html' : ('bh_wiki_diff.html', None),
         'wiki_edit.html' : ('bh_wiki_edit.html', None),
         'wiki_rename.html' : ('bh_wiki_rename.html', None),
         'wiki_view.html' : ('bh_wiki_view.html', '_modify_wiki_page_path'),
+
+        # General purpose
+        'history_view.html' : ('bh_history_view.html', None),
     }
 
     implements(IRequestFilter)