Commit 621a0d42 authored by Sebastien Robin's avatar Sebastien Robin

more clever jumping


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@532 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2495bb50
......@@ -31,6 +31,8 @@ from Products.Formulator.Field import ZMIField
from Products.Formulator.DummyField import fields
from Products.ERP5Type.Utils import convertToUpperCase
from zLOG import LOG
class RelationStringFieldWidget(Widget.TextWidget):
"""
RelationStringField widget
......@@ -91,6 +93,7 @@ class RelationStringFieldWidget(Widget.TextWidget):
def render(self, field, key, value, REQUEST):
"""Render text input field.
"""
here = REQUEST['here']
html_string = Widget.TextWidget.render(self, field, key, value, REQUEST)
# We used to add a button which has a path reference to a base category...
# but it really created too many problems
......@@ -100,11 +103,11 @@ class RelationStringFieldWidget(Widget.TextWidget):
% field.get_value('update_method')
if value not in ('', None):
if REQUEST.get('selection_name') is not None:
html_string += '&nbsp;&nbsp;<a href="%s?field_id=%s&form_id=%s&selection_name=%s&selection_index=%s"><img src="/images/pro/images/jump.png"></a>' \
% (field.get_value('jump_method'), field.id, field.aq_parent.id, REQUEST.get('selection_name'), REQUEST.get('selection_index'))
html_string += '&nbsp;&nbsp;<a href="%s/%s?field_id=%s&form_id=%s&selection_name=%s&selection_index=%s"><img src="/images/pro/images/jump.png"></a>' \
% (here.absolute_url(), field.get_value('jump_method'), field.id, field.aq_parent.id, REQUEST.get('selection_name'), REQUEST.get('selection_index'))
else:
html_string += '&nbsp;&nbsp;<a href="%s?field_id=%s&form_id=%s"><img src="/images/pro/images/jump.png"></a>' \
% (field.get_value('jump_method'), field.id, field.aq_parent.id)
html_string += '&nbsp;&nbsp;<a href="%s/%s?field_id=%s&form_id=%s"><img src="/images/pro/images/jump.png"></a>' \
% (here.absolute_url(), field.get_value('jump_method'), field.id, field.aq_parent.id)
return html_string
def render_view(self, field, value):
......@@ -112,8 +115,8 @@ class RelationStringFieldWidget(Widget.TextWidget):
"""
html_string = Widget.TextWidget.render_view(self, field, value)
if value not in ('', None):
html_string += '&nbsp;&nbsp;<a href="%s?field_id=%s&form_id=%s"><img src="/images/pro/images/jump.png"></a>' \
% (field.get_value('jump_method'), field.id, field.aq_parent.id)
html_string += '&nbsp;&nbsp;<a href="%s/%s?field_id=%s&form_id=%s"><img src="/images/pro/images/jump.png"></a>' \
% (here.absolute_url(), field.get_value('jump_method'), field.id, field.aq_parent.id)
return html_string
RelationStringFieldWidgetInstance = RelationStringFieldWidget()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment