[Zope3-checkins] CVS: zopeproducts/zwiki/browser - wikipage.py:1.11
Stephan Richter
srichter@cosmos.phy.tufts.edu
Thu, 31 Jul 2003 14:54:43 -0400
Update of /cvs-repository/zopeproducts/zwiki/browser
In directory cvs.zope.org:/tmp/cvs-serv19727/browser
Modified Files:
wikipage.py
Log Message:
Make use of the source type vocabulary.
=== zopeproducts/zwiki/browser/wikipage.py 1.10 => 1.11 ===
--- zopeproducts/zwiki/browser/wikipage.py:1.10 Thu Jul 31 14:00:52 2003
+++ zopeproducts/zwiki/browser/wikipage.py Thu Jul 31 14:54:39 2003
@@ -19,14 +19,14 @@
from urllib import quote, unquote
from datetime import datetime
-from zope.app.interfaces.dublincore import ICMFDublinCore
-
-from zope.component import getAdapter, getView, getService, createObject
-from zope.app.context import ContextWrapper
-from zope.app.browser.form.widget import ListWidget
from zope.app.browser.form.submit import Update
+from zope.app.browser.form.vocabularywidget import VocabularyFieldEditWidget
+from zope.app.browser.form.widget import ListWidget
+from zope.app.context import ContextWrapper
from zope.app.form.widget import CustomWidget
+from zope.app.interfaces.dublincore import ICMFDublinCore
from zope.app.traversing import getParent, getPath, getName
+from zope.component import getAdapter, getView, getService, createObject
from zopeproducts.zwiki.interfaces import \
IWikiPageHierarchy, IMailSubscriptions
@@ -93,44 +93,9 @@
return self.request.response.redirect('../@@toc.html')
-class SourceTypeWidget(ListWidget):
-
- size = 1
-
- def renderItems(self, value):
- name = self.name
- # get items
- types = getService(self.context, "SourceTypeRegistry")
- items = types.getAllTitles()
-
- # check if we want to select first item
- if (not value and getattr(self.context, 'firstItem', False)
- and len(items) > 0):
- value = items[0]
-
- cssClass = self.getValue('cssClass')
-
- rendered_items = []
- count = 0
- for item_value in items:
- item_text = self.textForValue(item_value)
-
- if item_value == value:
- rendered_item = self.renderSelectedItem(
- count, item_text, item_value, name, cssClass)
- else:
- rendered_item = self.renderItem(
- count, item_text, item_value, name, cssClass)
-
- rendered_items.append(rendered_item)
- count += 1
-
- return rendered_items
-
-
class AddWikiPage(object):
- type = CustomWidget(SourceTypeWidget)
+ type_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
def nextURL(self):
return '../'+self.context.contentName
@@ -138,7 +103,7 @@
class EditWikiPage(object):
- type = CustomWidget(SourceTypeWidget)
+ type_widget = CustomWidget(VocabularyFieldEditWidget, size=1)
def update(self):
status = super(EditWikiPage, self).update()