[Python-checkins] r53077 - in tracker/instances/python-dev: html/issue.index.html html/issue.item.html html/issue.search.html html/keyword.index.html html/keyword.item.html html/page.html schema.py

erik.forsberg python-checkins at python.org
Tue Dec 19 21:09:00 CET 2006


Author: erik.forsberg
Date: Tue Dec 19 21:08:59 2006
New Revision: 53077

Added:
   tracker/instances/python-dev/html/keyword.index.html
Modified:
   tracker/instances/python-dev/html/issue.index.html
   tracker/instances/python-dev/html/issue.item.html
   tracker/instances/python-dev/html/issue.search.html
   tracker/instances/python-dev/html/keyword.item.html
   tracker/instances/python-dev/html/page.html
   tracker/instances/python-dev/schema.py
Log:

Added keyword to schema and templates.


Modified: tracker/instances/python-dev/html/issue.index.html
==============================================================================
--- tracker/instances/python-dev/html/issue.index.html	(original)
+++ tracker/instances/python-dev/html/issue.index.html	Tue Dec 19 21:08:59 2006
@@ -35,6 +35,7 @@
    <th tal:condition="request/show/resolution" i18n:translate="">Resolution</th>
    <th tal:condition="request/show/creator" i18n:translate="">Creator</th>
    <th tal:condition="request/show/assignee" i18n:translate="">Assigned&nbsp;To</th>
+   <th tal:condition="request/show/keywords" i18n:translate="">Keywords</th>
   </tr>
  <tal:block tal:repeat="i batch" condition=true>
   <tr tal:define="group python:[r[1] for r in request.group]"
@@ -72,6 +73,8 @@
        tal:content="python:i.creator.plain() or default">&nbsp;</td>
    <td tal:condition="request/show/assignee"
        tal:content="python:i.assignee.plain() or default">&nbsp;</td>
+   <td tal:condition="request/show/keywords"
+       tal:content="python:i.keywords.plain() or default">&nbsp;</td>
   </tr>
 
  </tal:block>

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	Tue Dec 19 21:08:59 2006
@@ -140,7 +140,10 @@
    <span tal:replace="structure python:db.priority.classhelp('id,name,description',label='Priority')" />:
  </th>
  <td tal:content="structure context/priority/menu">priority</td>
- <td></td><td></td>
+ <th i18n:translate="">Keywords:</th>
+ <td tal:content="structure context/keywords/menu">keywords</td>
+
+
 </tr>
 <tr tal:condition="context/is_edit_ok">
  <th><tal:block i18n:translate="">Change Note</tal:block>:</th>

Modified: tracker/instances/python-dev/html/issue.search.html
==============================================================================
--- tracker/instances/python-dev/html/issue.search.html	(original)
+++ tracker/instances/python-dev/html/issue.search.html	Tue Dec 19 21:08:59 2006
@@ -182,6 +182,19 @@
   <td metal:use-macro="group_input"></td>
 </tr>
 
+<tr tal:define="name string:keywords;
+                db_klass string:keyword;
+                db_content string:name;">
+  <th i18n:translate="">Keyword:</th>
+  <td metal:use-macro="search_select_translated">
+    <option metal:fill-slot="extra_options" value="-1" i18n:translate=""
+            tal:attributes="selected python:value == '-1'">not set</option>
+  </td>
+  <td metal:use-macro="column_input"></td>
+  <td metal:use-macro="sort_input"></td>
+  <td metal:use-macro="group_input"></td>
+</tr>
+
 <tr tal:define="name string:priority;
                 db_klass string:priority;
                 db_content string:name;">

Added: tracker/instances/python-dev/html/keyword.index.html
==============================================================================
--- (empty file)
+++ tracker/instances/python-dev/html/keyword.index.html	Tue Dec 19 21:08:59 2006
@@ -0,0 +1,46 @@
+<tal:block metal:use-macro="templates/page/macros/icing">
+<title metal:fill-slot="head_title" >
+  <span tal:omit-tag="true" i18n:translate="" >List of keywords</span>
+  <span tal:condition="request/dispname"
+   tal:replace="python:' - %s '%request.dispname"
+  /> - <span tal:replace="config/TRACKER_NAME" />
+</title>
+<span metal:fill-slot="body_title" tal:omit-tag="true">
+  <span tal:omit-tag="true" i18n:translate="" >List of keywords</span>
+  <span tal:condition="request/dispname"
+   tal:replace="python:' - %s' % request.dispname" />
+</span>
+<tal:block metal:fill-slot="content">
+
+<p tal:condition="python:not (context.is_view_ok()
+ or request.user.hasRole('Anonymous'))" i18n:translate="">
+ You are not allowed to view this page.</p>
+
+<p tal:condition="python:not context.is_view_ok()
+ and request.user.hasRole('Anonymous')" i18n:translate="">
+ Please login with your username and password.</p>
+
+<table width="100%" tal:condition="context/is_view_ok" class="list">
+<tr>
+ <th i18n:translate="">Keyword</th>
+ <th i18n:translate="">Description</th>
+</tr>
+
+<tal:block repeat="keyword context/list">
+<tr tal:attributes="class python:['normal', 'alt'][repeat['keyword'].index%6/3]">
+ <td>
+  <a tal:attributes="href string:keyword${keyword/id}"
+     tal:content="keyword/name">keyword name</a>
+ </td>
+ <td tal:content="python:keyword.description.plain() or
+     default">&nbsp;</td>
+</tr>
+</tal:block>
+
+<tr tal:condition="context/is_edit_ok">
+   <td colspan="2"><a href="keyword?@template=item">New Keyword</a></td>
+</tr>
+</table>
+
+</tal:block>
+</tal:block>
\ No newline at end of file

Modified: tracker/instances/python-dev/html/keyword.item.html
==============================================================================
--- tracker/instances/python-dev/html/keyword.item.html	(original)
+++ tracker/instances/python-dev/html/keyword.item.html	Tue Dec 19 21:08:59 2006
@@ -1,54 +1,78 @@
-<tal:block metal:use-macro="templates/page/macros/icing">
-<title metal:fill-slot="head_title" i18n:translate="">Keyword editing - <span
- i18n:name="tracker" tal:replace="config/TRACKER_NAME" /></title>
-<span metal:fill-slot="body_title" tal:omit-tag="python:1"
- i18n:translate="">Keyword editing</span>
+<tal:doc metal:use-macro="templates/page/macros/icing"
+define="edit_ok context/is_edit_ok"
+>
+<title metal:fill-slot="head_title">
+<tal:if condition="context/id" i18n:translate=""
+ >Keyword <span tal:replace="context/id" i18n:name="id"
+ />: <span tal:replace="context/name" i18n:name="title"
+ /> - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
+/></tal:if>
+<tal:if condition="not:context/id" i18n:translate=""
+ >New Keyword - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
+/></tal:if>
+</title>
+<metal:slot fill-slot="more-javascript">
+<script type="text/javascript" src="@@file/help_controls.js"></script>
+</metal:slot>
+<tal:block metal:fill-slot="body_title"
+  define="edit_ok context/is_edit_ok">
+ <span tal:condition="python: not (context.id or edit_ok)"
+  tal:omit-tag="python:1" i18n:translate="">New Keyword</span>
+ <span tal:condition="python: not context.id and edit_ok"
+  tal:omit-tag="python:1" i18n:translate="">New Keyword Editing</span>
+ <span tal:condition="python: context.id and not edit_ok"
+  tal:omit-tag="python:1" i18n:translate="">Keyword<tal:x
+  replace="context/id" i18n:name="id" /></span>
+ <span tal:condition="python: context.id and edit_ok"
+  tal:omit-tag="python:1" i18n:translate="">Keyword<tal:x
+  replace="context/id" i18n:name="id" /> Editing</span>
+</tal:block>
+
 <td class="content" metal:fill-slot="content">
 
-<table class="otherinfo" tal:define="keywords db/keyword/list"
-       tal:condition="keywords">
- <tr><th colspan="4" class="header" i18n:translate="">Existing Keywords</th></tr>
- <tr tal:repeat="start python:range(0, len(keywords), 4)">
-  <td width="25%" tal:define="batch python:utils.Batch(keywords, 4, start)"
-      tal:repeat="keyword batch">
-    <a tal:attributes="href string:keyword${keyword/id}"
-       tal:content="keyword/name">keyword here</a>
-  </td>
- </tr>
- <tr>
-  <td colspan="4" style="border-top: 1px solid gray" i18n:translate="">
-   To edit an existing keyword (for spelling or typing errors),
-   click on its entry above.
-  </td>
- </tr>
-</table>
+<p tal:condition="python:not (context.is_view_ok()
+ or request.user.hasRole('Anonymous'))" i18n:translate="">
+ You are not allowed to view this page.</p>
+
+<p tal:condition="python:not context.is_view_ok()
+ and request.user.hasRole('Anonymous')" i18n:translate="">
+ Please login with your username and password.</p>
 
-<p class="help" tal:condition="not:context/id" i18n:translate="">
- To create a new keyword, enter it below and click "Submit New Entry".
-</p>
+<div tal:condition="context/is_view_ok">
 
-<form method="POST" onSubmit="return submit_once()"
+<form method="POST"
+      tal:define="required python:'name description'.split()"
       enctype="multipart/form-data"
-      tal:attributes="action context/designator">
+      tal:attributes="action context/designator;">
+
+<table class="form">
 
- <table class="form">
-  <tr>
-   <th i18n:translate="">Keyword</th>
-   <td tal:content="structure context/name/field">name</td>
-  </tr>
-
-  <tr>
-   <td>
-    &nbsp;
-    <input type="hidden" name="@required" value="name">
-    <input type="hidden" name="@template" value="item">
-   </td>
-   <td colspan=3 tal:content="structure context/submit">
-    submit button will go here
-   </td>
-  </tr>
- </table>
+<tr>
+ <th class="required" i18n:translate="">Keyword:</th>
+ <td tal:content="structure
+ python:context.name.field(size=60)">title</td>
+</tr>
+
+<tr>
+ <th class="required" i18n:translate="">Description:</th>
+ <td tal:content="structure python:context.description.field(size=60)">description</td>
+
+</tr>
+
+ <tr tal:condition="context/is_edit_ok">
+  <td>
+   &nbsp;
+   <input type="hidden" name="@template" value="item">
+   <input type="hidden" name="@required" value="name,description"
+          tal:attributes="value python:','.join(required)">
+  </td>
+  <td><input type="submit" value="save" tal:replace="structure context/submit"><!--submit button here-->
+    <input type="reset">
+  </td>
+ </tr>
+
+</table>
 </form>
+</div>
 </td>
-
-</tal:block>
+</tal:doc>

Modified: tracker/instances/python-dev/html/page.html
==============================================================================
--- tracker/instances/python-dev/html/page.html	(original)
+++ tracker/instances/python-dev/html/page.html	Tue Dec 19 21:08:59 2006
@@ -160,6 +160,9 @@
    </li>
    <li tal:condition="python:request.user.hasPermission('Create', 'user')"><a href="user?@template=item" i18n:translate="">Add User</a>
    </li>
+   <li tal:condition="python:request.user.hasPermission('Edit',
+ 'keyword')"><a href="keyword" i18n:translate="">Edit Keywords</a>
+   </li>
    </ul>
      </li>
      <li class="">

Modified: tracker/instances/python-dev/schema.py
==============================================================================
--- tracker/instances/python-dev/schema.py	(original)
+++ tracker/instances/python-dev/schema.py	Tue Dec 19 21:08:59 2006
@@ -58,6 +58,13 @@
                    order=Number())
 resolution.setkey('name')
 
+# Keyword
+keyword = Class(db, "keyword",
+                name=String(),
+                description=String())
+keyword.setkey("name")
+                
+
 # User-defined saved searches
 query = Class(db, "query",
               klass=String(),
@@ -111,7 +118,8 @@
                    assignee=Link('user'),
                    status=Link('status'),
                    resolution=Link('resolution'),
-                   superseder=Link('issue'))
+                   superseder=Link('issue'),
+                   keywords=Multilink("keyword"))
 
 #
 # TRACKER SECURITY SETTINGS
@@ -134,7 +142,8 @@
 # User permissions
 ##########################
 for cl in ('issue_type', 'severity', 'component',
-           'version', 'priority', 'status', 'resolution', 'issue', 'file', 'msg'):
+           'version', 'priority', 'status', 'resolution',
+           'issue', 'file', 'msg', 'keyword'):
     db.security.addPermissionToRole('User', 'View', cl)
 
 for cl in 'file', 'msg':
@@ -161,10 +170,11 @@
 # Developer permissions
 ##########################
 for cl in ('issue_type', 'severity', 'component',
-           'version', 'priority', 'status', 'resolution', 'issue', 'file', 'msg'):
+           'version', 'priority', 'status', 'resolution',
+           'issue', 'file', 'msg', 'keyword'):
     db.security.addPermissionToRole('Developer', 'View', cl)
 
-for cl in ('issue', 'file', 'msg'):
+for cl in ('issue', 'file', 'msg', 'keyword'):
     db.security.addPermissionToRole('Developer', 'Edit', cl)
     db.security.addPermissionToRole('Developer', 'Create', cl)
 


More information about the Python-checkins mailing list