[Python-checkins] r88867 - in tracker/instances/python-dev: extensions/pydevutils.py html/file.item.html html/issue.item.html html/msg.item.html
ezio.melotti
python-checkins at python.org
Sat Jul 23 00:34:53 CEST 2011
Author: ezio.melotti
Date: Sat Jul 23 00:34:53 2011
New Revision: 88867
Log:
#267: remove the remove button from the issue page, move it to the msg/file page, and add a button to add back removed messages/files.
Modified:
tracker/instances/python-dev/extensions/pydevutils.py
tracker/instances/python-dev/html/file.item.html
tracker/instances/python-dev/html/issue.item.html
tracker/instances/python-dev/html/msg.item.html
Modified: tracker/instances/python-dev/extensions/pydevutils.py
==============================================================================
--- tracker/instances/python-dev/extensions/pydevutils.py (original)
+++ tracker/instances/python-dev/extensions/pydevutils.py Sat Jul 23 00:34:53 2011
@@ -14,6 +14,29 @@
db = request.client.db
return 'Coordinator' in db.user.get(user, 'roles')
+
+def issueid_and_action_from_class(cls):
+ """
+ Return the id of the issue where the msg/file is/was linked
+ and if the last "linking action" was 'link' or 'unlink'.
+ """
+ last_action = ''
+ for entry in cls._klass.history(cls._nodeid):
+ if 'unlink' in entry:
+ last_unlink = entry
+ last_action = 'unlink'
+ elif 'link' in entry:
+ last_entry = entry
+ last_action = 'link'
+ if last_action in ('link', 'unlink'):
+ # the msg has been unlinked and not linked back
+ # the link looks like: ('16', <Date 2011-07-22.05:14:12.342>, '4',
+ # 'link', ('issue', '1', 'messages'))
+ return last_entry[4][1], last_action
+ return None, None
+
def init(instance):
instance.registerUtil('is_history_ok', is_history_ok)
instance.registerUtil('is_coordinator', is_coordinator)
+ instance.registerUtil('issueid_and_action_from_class',
+ issueid_and_action_from_class)
Modified: tracker/instances/python-dev/html/file.item.html
==============================================================================
--- tracker/instances/python-dev/html/file.item.html (original)
+++ tracker/instances/python-dev/html/file.item.html Sat Jul 23 00:34:53 2011
@@ -81,6 +81,27 @@
<input type="submit" name="trainham" value="Mark as HAM (not SPAM)" i18n:attributes="value">
</form>
+
+<form tal:define="u_hasRole python:request.user.hasRole;
+ issueid_action python:utils.issueid_and_action_from_class(context);
+ issueid python:'issue%s' % issueid_action[0];
+ action python:issueid_action[1]"
+ tal:condition="python:issueid and context.is_edit_ok()"
+ tal:attributes="action issueid" method="post">
+ <input type="hidden" name="@action" value="edit" />
+ <tal:block tal:condition="python: action == 'link'">
+ <input type="hidden" name="@remove at files" tal:attributes="value context/id" />
+ <p>This file is linked to <a tal:attributes="href issueid" tal:content="issueid" />:
+ <input type="submit" value="Unlink" i18n:attributes="value"/></p>
+ </tal:block>
+ <tal:block tal:condition="python: action == 'unlink'">
+ <input type="hidden" name="@add at files" tal:attributes="value context/id" />
+ <p>This file has been unlinked from <a tal:attributes="href issueid" tal:content="issueid" />:
+ <input type="submit" value="Restore" i18n:attributes="value"/></p>
+ </tal:block>
+</form>
+
+
<tal:block tal:condition="context/id" tal:replace="structure context/history" />
</td>
Modified: tracker/instances/python-dev/html/issue.item.html
==============================================================================
--- tracker/instances/python-dev/html/issue.item.html (original)
+++ tracker/instances/python-dev/html/issue.item.html Sat Jul 23 00:34:53 2011
@@ -240,7 +240,6 @@
<th i18n:translate="">Uploaded</th>
<th i18n:translate="">Description</th>
<th i18n:translate="">Edit</th>
- <th i18n:translate="">Remove</th>
</tr>
<tr tal:repeat="file python:context.files.sorted('creation')">
<td>
@@ -258,14 +257,6 @@
<a tal:condition="rvlink" tal:attributes="href rvlink">review</a>
</tal:block>
</td>
- <td>
- <form style="padding:0" method="post" tal:condition="file/is_edit_ok"
- tal:attributes="action string:issue${context/id}">
- <input type="hidden" name="@remove at files" tal:attributes="value file/id">
- <input type="hidden" name="@action" value="edit">
- <input type="submit" value="remove" i18n:attributes="value">
- </form>
- </td>
</tr>
</table>
@@ -321,14 +312,6 @@
</th>
<th i18n:translate="">Date: <tal:x replace="python:msg.date.pretty('%Y-%m-%d %H:%M')"
i18n:name="date" /></th>
- <th>
- <form style="padding:0" method="post" tal:condition="msg/is_edit_ok"
- tal:attributes="action string:issue${context/id}">
- <input type="hidden" name="@remove at messages" tal:attributes="value msg/id">
- <input type="hidden" name="@action" value="edit">
- <input type="submit" value="remove" i18n:attributes="value">
- </form>
- </th>
</tr>
<tr>
<td colspan="4" class="content">
Modified: tracker/instances/python-dev/html/msg.item.html
==============================================================================
--- tracker/instances/python-dev/html/msg.item.html (original)
+++ tracker/instances/python-dev/html/msg.item.html Sat Jul 23 00:34:53 2011
@@ -124,6 +124,27 @@
</tr>
</table>
+
+<form tal:define="u_hasRole python:request.user.hasRole;
+ issueid_action python:utils.issueid_and_action_from_class(context);
+ issueid python:'issue%s' % issueid_action[0];
+ action python:issueid_action[1]"
+ tal:condition="python:issueid and context.is_edit_ok()"
+ tal:attributes="action issueid" method="post">
+ <input type="hidden" name="@action" value="edit" />
+ <tal:block tal:condition="python: action == 'link'">
+ <input type="hidden" name="@remove at messages" tal:attributes="value context/id" />
+ <p>This message is linked to <a tal:attributes="href issueid" tal:content="issueid" />:
+ <input type="submit" value="Unlink" i18n:attributes="value"/></p>
+ </tal:block>
+ <tal:block tal:condition="python: action == 'unlink'">
+ <input type="hidden" name="@add at messages" tal:attributes="value context/id" />
+ <p>This message has been unlinked from <a tal:attributes="href issueid" tal:content="issueid" />:
+ <input type="submit" value="Restore" i18n:attributes="value"/></p>
+ </tal:block>
+</form>
+
+
<tal:block tal:replace="structure context/history" />
</div>
More information about the Python-checkins
mailing list