--- a/web/form.py Wed Mar 11 11:15:08 2009 +0100
+++ b/web/form.py Wed Mar 11 11:15:59 2009 +0100
@@ -21,6 +21,7 @@
from cubicweb.utils import ustrftime
from cubicweb.selectors import yes, match_form_params, non_final_entity
from cubicweb.view import NOINDEX, NOFOLLOW, View, EntityView, AnyRsetView
+from cubicweb.schema import FormatConstraint
from cubicweb.common.registerers import accepts_registerer
from cubicweb.common.uilib import toggle_action
from cubicweb.web import stdmsgs
@@ -544,11 +545,15 @@
# if fckeditor is used and format field isn't explicitly
# deactivated, we want an hidden field for the format
widget = HiddenInput()
+ choices = None
else:
# else we want a format selector
# XXX compute vocabulary
widget = Select
- field = StringField(name=self.name + '_format', widget=widget)
+ req = form.req
+ choices = [(req._(format), format) for format in FormatConstraint().vocabulary(req=req)]
+ field = StringField(name=self.name + '_format', widget=widget,
+ choices=choices)
form.req.data[self] = field
return field