diff --git a/product/ERP5Form/FormulatorPatch.py b/product/ERP5Form/FormulatorPatch.py index 0d4a9b7de793dc6eef3716252a91c0dc9e9b6bbe..fa95794d9f6cd6a04471c7408c23373f2faf433e 100644 --- a/product/ERP5Form/FormulatorPatch.py +++ b/product/ERP5Form/FormulatorPatch.py @@ -462,6 +462,13 @@ def Widget_render_css(self, field, REQUEST): pass Widget.render_css = Widget_render_css +def Widget_get_javascript_list(self, field, REQUEST): + """ + Return JS needed by the widget + """ + return [] +Widget.get_javascript_list = Widget_get_javascript_list + from Products.Formulator.Validator import LinesValidator def LinesValidator_validate(self, field, key, REQUEST): @@ -1262,7 +1269,7 @@ def Field_get_javascript_list(self, REQUEST=None): """ Returns list of javascript needed by the field """ - return [] + return self.widget.get_javascript_list(self, REQUEST) Field.get_javascript_list = Field_get_javascript_list diff --git a/product/ERP5Form/PlanningBox.py b/product/ERP5Form/PlanningBox.py index ead7b7298450150c73b84ae601d450022686cd21..6da80076f714fee250578731768ae72f564448f2 100644 --- a/product/ERP5Form/PlanningBox.py +++ b/product/ERP5Form/PlanningBox.py @@ -928,6 +928,19 @@ class PlanningBoxWidget(Widget.Widget): default=2, required=0) + def get_javascript_list(self, field, REQUEST=None): + """ + Returns list of javascript needed by the widget + """ + if field.get_value('js_enabled'): + context = getContext(field, REQUEST) + # XXX Instead of harcoding library name + # it should be better to call a python script, as + # it is done on type base method. + return ['%s/wz_dragdrop.js' % context.portal_url.getPortalPath()] + else: + return [] + def render_css(self, field, REQUEST): """ first method called for rendering by PageTemplate form_view @@ -3154,19 +3167,6 @@ class PlanningBox(ZMIField): def render_css(self, REQUEST=None): return self.widget.render_css(self, REQUEST) - def get_javascript_list(self, REQUEST=None): - """ - Returns list of javascript needed by the field - """ - if self.get_value('js_enabled'): - context = getContext(self, REQUEST) - # XXX Instead of harcoding library name - # it should be better to call a python script, as - # it is done on type base method. - return ['%s/wz_dragdrop.js' % context.portal_url.getPortalPath()] - else: - return [] - # XXX Copy paste from listbox def getContext(field, REQUEST): """ diff --git a/product/ERP5Form/ProxyField.py b/product/ERP5Form/ProxyField.py index 1df06e8cc21f89302e2561284fdd7d67f7f3aec2..f0f43e321c2619444b5958d9f636cc0e1ef49acb 100644 --- a/product/ERP5Form/ProxyField.py +++ b/product/ERP5Form/ProxyField.py @@ -126,6 +126,16 @@ class ProxyWidget(Widget.Widget): result = proxy_field.widget.render_css(field, REQUEST) return result + def get_javascript_list(self, field, REQUEST): + """ + Render proxy field + """ + result = [] + proxy_field = field.getRecursiveTemplateField() + if proxy_field is not None: + result = proxy_field.widget.get_javascript_list(field, REQUEST) + return result + class ProxyValidator(Validator.Validator): """ Validation of entered value through proxy field @@ -498,14 +508,3 @@ class ProxyField(ZMIField): else: result = ZMIField._get_user_input_value(self, key, REQUEST) return result - - def get_javascript_list(self, REQUEST=None): - """ - Returns list of javascript needed by the field - """ - proxy_field = self.getTemplateField() - if proxy_field is not None: - result = proxy_field.get_javascript_list(REQUEST) - else: - result = ZMIField.get_javascript_list(self, REQUEST) - return result