[Zope-CVS] SVN: zversioning/trunk/src/versioning/browser/ view logic

Tobias Ahlers tobias.ahlers at web.de
Thu Oct 14 09:45:47 EDT 2004


Log message for revision 28179:
  view logic

Changed:
  A   zversioning/trunk/src/versioning/browser/
  A   zversioning/trunk/src/versioning/browser/__init__.py
  A   zversioning/trunk/src/versioning/browser/configure.zcml
  A   zversioning/trunk/src/versioning/browser/defaultVersionControl.py
  A   zversioning/trunk/src/versioning/browser/versionControlInfo.pt

-=-
Added: zversioning/trunk/src/versioning/browser/__init__.py
===================================================================


Property changes on: zversioning/trunk/src/versioning/browser/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zversioning/trunk/src/versioning/browser/configure.zcml
===================================================================
--- zversioning/trunk/src/versioning/browser/configure.zcml	2004-10-14 13:43:02 UTC (rev 28178)
+++ zversioning/trunk/src/versioning/browser/configure.zcml	2004-10-14 13:45:46 UTC (rev 28179)
@@ -0,0 +1,26 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    i18n_domain="versioning"
+    >
+    
+    
+  <browser:pages
+      for="..interfaces.IVersioned"
+      permission="zope.View"
+      class=".defaultVersionControl.VersionControlView"
+      >
+    <browser:page
+        name="VersionControlInfo.html"
+        menu="zmi_views" 
+        title="VersionControl"
+        template="versionControlInfo.pt"
+        />
+    <browser:page
+        name="saveVersion.html"
+        attribute="saveVersion"
+        />        
+  </browser:pages>
+
+    
+</configure>    
\ No newline at end of file


Property changes on: zversioning/trunk/src/versioning/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zversioning/trunk/src/versioning/browser/defaultVersionControl.py
===================================================================
--- zversioning/trunk/src/versioning/browser/defaultVersionControl.py	2004-10-14 13:43:02 UTC (rev 28178)
+++ zversioning/trunk/src/versioning/browser/defaultVersionControl.py	2004-10-14 13:45:46 UTC (rev 28179)
@@ -0,0 +1,53 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""default VersionControl view classes
+
+$Id$
+"""
+
+from versioning import interfaces
+
+from zope.app import zapi
+from zope.security.proxy import removeSecurityProxy
+
+
+
+class VersionControlView(object):
+    """displays version data of an object"""
+
+    __used_for__ = interfaces.IVersioned
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+        history = zapi.getUtility(interfaces.IHistoryStorage)
+        self.rep = interfaces.ICopyModifyMergeRepository(history)
+        
+    def listVersions(self):
+        #import pdb; pdb.set_trace()
+        versions = self.rep.listVersions(removeSecurityProxy(self.context))
+        return [x for x in versions]
+    
+    def saveVersion(self):
+        self.rep.saveAsVersion(removeSecurityProxy(self.context))
+        self.request.response.redirect("VersionControlInfo.html")
+
+        
+    
+
+
+
+
+
+


Property changes on: zversioning/trunk/src/versioning/browser/defaultVersionControl.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zversioning/trunk/src/versioning/browser/versionControlInfo.pt
===================================================================
--- zversioning/trunk/src/versioning/browser/versionControlInfo.pt	2004-10-14 13:43:02 UTC (rev 28178)
+++ zversioning/trunk/src/versioning/browser/versionControlInfo.pt	2004-10-14 13:45:46 UTC (rev 28179)
@@ -0,0 +1,90 @@
+<html metal:use-macro="context/@@standard_macros/view"
+      i18n:domain="versioncontrol">
+<body><div metal:fill-slot="body">
+
+  <h1 i18n:translate="">Versioning informations</h1>
+  <form action="saveVersion.html" method="post">
+    <input type="submit" name="submit" value="save Version" />
+  </form>
+  <table class="listing">
+    <caption i18n:translate="">Version list</caption>
+    <tr>
+      <th i18n:translate="">name</th>
+      <th i18n:translate="">timestamp</th>
+      <th i18n:translate="">principal</th>
+      <th i18n:translate="">comment</th>
+      <th i18n:translate="">Revert</th>
+    </tr>
+    <tr tal:repeat="version view/listVersions">
+      <td tal:content="version/name">Version id</td>
+      <td tal:content="version/timestamp">Timestamp</td>
+      <td tal:content="version/principal">Label</td>
+      <td tal:content="version/comment">User Id</td>
+      <td>
+        <form action="revert.html" method="post">
+          <input type="hidden" name="labelselector" 
+                 tal:attributes="value version/label"/>
+          <input type="submit" name="submit" value="Revert" />
+        </form>
+    </tr>
+  </table>  
+ 
+  <!--form tal:condition="not:view/isCheckedOut" action="checkout.html" method="post">
+    <input type="submit" name="submit" value="checkout" />
+  </form>
+  <form tal:condition="view/isCheckedOut" action="checkin.html" method="post">
+    <input type="submit" name="submit" value="checkin" />
+  </form>
+  <form tal:condition="view/isCheckedOut" action="uncheckout.html" method="post">
+    <input type="submit" name="submit" value="uncheckout" />
+  </form>
+  <table tal:define="thisInfo view/getVersionInfo">
+    <caption i18n:translate="">Current version info</caption>
+    <tr>
+      <th i18n:translate="">version</th><td tal:content="thisInfo/version_id">version id</td>
+    </tr>
+    <tr>
+      <th i18n:translate="">status</th><td tal:content="thisInfo/status">version status</td>
+    </tr>
+    <tr>
+      <th i18n:translate="">user</th><td tal:content="thisInfo/user_id">user status</td>
+    </tr>
+    <tr>
+      <th i18n:translate="">changed</th><td tal:content="thisInfo/changed">version changed</td>
+    </tr>    
+  </table>
+  <table class="listing">
+    <caption i18n:translate="">Version list</caption>
+    <tr>
+      <th i18n:translate="">Version id</th>
+      <th i18n:translate="">Timestamp</th>
+      <th i18n:translate="">Message</th>
+      <th i18n:translate="">User Id</th>
+      <th i18n:translate="">Revert</th>
+    </tr>
+    <tr tal:repeat="versionList view/versionList">
+      <td tal:content="versionList/version_id">Version id</td>
+      <td tal:content="versionList/timestamp">Timestamp</td>
+      <td tal:content="versionList/message">Label</td>
+      <td tal:content="versionList/user_id">User Id</td>
+      <td>
+        <form action="revert.html" method="post">
+          <input type="hidden" name="id" tal:attributes="value versionList/version_id"/>
+          <input type="submit" name="submit" value="Revert" />
+        </form>
+    </tr>
+  </table>
+  <table class="listing">
+    <caption i18n:translate="">Version history</caption>
+    <tr>
+        <th>Id</th><th>Action</th><th>Timestamp</th><th>Message</th><th>Path</th><th>User Id</th>
+    <tr tal:repeat="versinfo view/getLogEntries">
+        <td tal:content="versinfo/version_id"/>
+        <td tal:content="versinfo/action"/>
+        <td tal:content="versinfo/timestamp"/>
+        <td tal:content="versinfo/message"/>
+        <td tal:content="versinfo/path"/>
+        <td tal:content="versinfo/user_id"/>
+    </tr>
+  </table-->
+</div></body></html>


Property changes on: zversioning/trunk/src/versioning/browser/versionControlInfo.pt
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Zope-CVS mailing list