[Zope3-checkins] CVS: Products3/bugtracker/browser - bug_add.pt:1.1 bug.py:1.3 configure.zcml:1.4
Stephan Richter
srichter@cosmos.phy.tufts.edu
Sat, 26 Jul 2003 12:59:20 -0400
Update of /cvs-repository/Products3/bugtracker/browser
In directory cvs.zope.org:/tmp/cvs-serv14074/browser
Modified Files:
bug.py configure.zcml
Added Files:
bug_add.pt
Log Message:
Added custom add form template for the bug. The old one was just too
annoying, since I to scroll in order to submit the screen. Also, made the
description text area only 10 rows heigh, but 100% in width.
=== Added File Products3/bugtracker/browser/bug_add.pt ===
<html metal:use-macro="context/@@standard_macros/dialog">
<body>
<div metal:fill-slot="body">
<div metal:define-macro="body">
<form action="." tal:attributes="action request/URL" method="post"
enctype="multipart/form-data"
>
<div metal:define-macro="formbody">
<h3 tal:condition="view/label"
tal:content="view/label"
metal:define-slot="heading"
>Edit something</h3>
<p tal:define="status view/update"
tal:condition="status"
tal:content="status" />
<p tal:condition="view/errors">
<span i18n:translate="">There are</span>
<strong tal:content="python:len(view.errors)">6</strong>
<span i18n:translate="">input errors.</span>
</p>
<div metal:define-slot="extra_info" tal:replace="nothing">
</div>
<div class="row" metal:define-slot="extra_top" tal:replace="nothing">
<div class="label">Extra top</div>
<div class="label"><input type="text" style="width:100%" /></div>
</div>
<div>
<div class="row">
<div class="label">Title:</div>
<div class="field" tal:content="structure view/title_widget"></div>
</div>
<div class="row">
<div class="label md_label">Type:</div>
<div class="field md_field"
tal:content="structure view/type_widget" />
<div class="label md_label">Status:</div>
<div class="field md_field"
tal:content="structure view/status_widget" />
</div>
<div class="row">
<div class="label md_label">Priority:</div>
<div class="field md_field"
tal:content="structure view/priority_widget" />
<div class="label md_label">Release Target:</div>
<div class="field md_field"
tal:content="structure view/release_widget" />
</div>
<div class="row">
<div class="label">Owners:</div>
<div class="field"
tal:content="structure view/owners_widget" />
</div>
</div>
<h4>Description</h4>
<div tal:content="structure view/description_widget" />
<div class="row"
metal:define-slot="extra_bottom" tal:replace="nothing">
<div class="label">Extra bottom</div>
<div class="field"><input type="text" style="width:100%" /></div>
</div>
</div>
<div class="row">
<div class="controls">
<input type="submit" value="Refresh"
i18n:attributes="value refresh-button" />
<input type="submit" name="UPDATE_SUBMIT" value="Submit"
i18n:attributes="value submit-button"/>
</div>
</div>
</form>
</div>
</div>
</body>
</html>
=== Products3/bugtracker/browser/bug.py 1.2 => 1.3 ===
--- Products3/bugtracker/browser/bug.py:1.2 Thu Jul 24 17:39:10 2003
+++ Products3/bugtracker/browser/bug.py Sat Jul 26 12:59:14 2003
@@ -23,7 +23,7 @@
from zope.proxy import removeAllProxies
from zope.schema.vocabulary import getVocabularyRegistry
from zope.app.browser.form.vocabularywidget import VocabularyFieldEditWidget
-from zope.app.browser.form.widget import TextWidget
+from zope.app.browser.form.widget import TextWidget, TextAreaWidget
from zope.app.context import ContextWrapper
from zope.app.form.widget import CustomWidget
from zope.app.security.grants.principalrole import principalRoleManager
@@ -115,45 +115,30 @@
return map(lambda owner: users.getTerm(owner), self.context.owners)
-class AddBug(object):
-
- def nextURL(self):
- return '../'+self.context.contentName
-
+class BugForm(object):
+
+ type_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
-class CustomVocabularyWidget:
- implements(IViewFactory)
+ status_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
- def __init__(self, *args, **kw):
- self._widget_factory = args[0]
- if len(args) > 1:
- self.args = args[1:]
- else:
- self.args = ()
- self.kw = kw
+ priority_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
- def __call__(self, context, request):
- field = context
- context = field.vocabulary
- args = (context, request) + self.args
- instance = self._widget_factory(*args)
- instance.setField(field)
- for item in self.kw.items():
- setattr(instance, item[0], item[1])
- return instance
+ release_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
+ title_widget = CustomWidget(TextWidget, size=40)
-class EditBug(BugBaseView):
+ description_widget = CustomWidget(TextAreaWidget, height=10,
+ style="width: 100%")
- type_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
- status_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
+class AddBug(BugForm):
- priority_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
+ def nextURL(self):
+ return '../'+self.context.contentName
- release_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
- title_widget = CustomWidget(TextWidget, size=40)
+class EditBug(BugBaseView, BugForm):
+ pass
class Overview(BugBaseView):
=== Products3/bugtracker/browser/configure.zcml 1.3 => 1.4 ===
--- Products3/bugtracker/browser/configure.zcml:1.3 Sat Jul 26 09:40:47 2003
+++ Products3/bugtracker/browser/configure.zcml Sat Jul 26 12:59:14 2003
@@ -112,9 +112,9 @@
content_factory="zopeproducts.bugtracker.bug.Bug"
permission="bugtracker.AddBug"
fields="title description type owners status priority release"
+ template="bug_add.pt"
class=".bug.AddBug"
- menu="add_bugtracker"
- title="Bug"/>
+ menu="add_bugtracker" title="Bug"/>
<browser:editform
schema="zopeproducts.bugtracker.interfaces.IBug"