diff -r 3d01229d9f6a -r a4eb20f86cb0 web/widgets.py --- a/web/widgets.py Wed Apr 08 20:37:55 2009 +0200 +++ b/web/widgets.py Wed Apr 08 20:38:34 2009 +0200 @@ -828,59 +828,6 @@ aurl = html_escape(entity.build_url('embed', url=url)) return u'%s' % (aurl, url) - - -class PropertyKeyWidget(ComboBoxWidget): - """specific widget for EProperty.pkey field to set the value widget according to - the selected key - """ - - def _edit_render(self, entity): - entity.req.add_js( ('cubicweb.ajax.js', 'cubicweb.edition.js') ) - vtabindex = self.attrs.get('tabindex', 0) + 1 - self.attrs['onchange'] = "javascript:setPropValueWidget('%s', %s)" % ( - entity.eid, vtabindex) - # limit size - if not entity.has_eid(): - self.attrs['size'] = 10 - else: - self.attrs['size'] = 1 - return super(PropertyKeyWidget, self)._edit_render(entity) - - def vocabulary(self, entity): - _ = entity.req._ - if entity.has_eid(): - return [(_(entity.pkey), entity.pkey)] - # key beginning with 'system.' should usually not be edited by hand - choices = entity.vreg.user_property_keys() - return sorted(zip((_(v) for v in choices), choices)) - - -class PropertyValueWidget(Widget): - """specific widget for EProperty.value field which will be different according to - the selected key type and vocabulary information - """ - - def render_help(self, entity): - return u'' - - def render(self, entity): - assert entity.has_eid() - w = self.vreg.property_value_widget(entity.pkey, req=entity.req, **self.attrs) - return w.render(entity) - - def _edit_render(self, entity): - if not entity.has_eid(): - # no key set yet, just include an empty div which will be filled - # on key selection - # empty span as well else html validation fail (label is refering to this id) - return u'
' % (self.rname, self.attrs.get('id')) - w = self.vreg.property_value_widget(entity.pkey, req=entity.req, **self.attrs) - if entity.pkey.startswith('system.'): - value = '%s' % (self.attrs.get('id'), w.render(entity)) - msg = entity.req._('value associated to this key is not editable manually') - return value + '
%s
' % msg - return w.edit_render(entity, self.attrs.get('tabindex'), includehelp=True) def widget_factory(vreg, subjschema, rschema, objschema, role='subject',