Commit d855e4bc authored by Alexandre Boeglin's avatar Alexandre Boeglin

Added 'Jump Allowed' parameter that hides the jump clickable link and plane.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3228 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 75ba0c70
......@@ -162,7 +162,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
html_string += '&nbsp;<input type="image" src="%s/images/exec16.png" value="update..." name="%s/portal_selections/viewSearchRelatedDocumentDialog%s:method">' \
% (portal_url_string, portal_object.getPath(), field.aq_parent._v_relation_field_index)
if value_list not in ((), [], None, ['']) and value_list == field.get_value('default'):
if value_list not in ((), [], None, ['']) and value_list == field.get_value('default') and field.get_value('jump_allowed') == 1 :
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="%s/images/jump.png"></a>' \
% (field.get_value('jump_method'), field.id, field.aq_parent.id, REQUEST.get('selection_name'), REQUEST.get('selection_index'),portal_url_string)
......@@ -178,6 +178,9 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
"""
Render text field.
"""
if field.get_value('jump_allowed') == 0 :
return Widget.LinesTextAreaWidget.render_view(self, field, value)
REQUEST = get_request()
here = REQUEST['here']
......
......@@ -53,7 +53,7 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
"""
property_names = Widget.TextWidget.property_names + \
['update_method', 'jump_method', 'base_category', 'portal_type', 'catalog_index',
['update_method', 'jump_method', 'jump_allowed', 'base_category', 'portal_type', 'catalog_index',
'default_module', 'relation_setter_id', 'columns','sort','parameter_list','list_method',
'first_item', 'items', 'size', 'extra_item']
......@@ -72,6 +72,13 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
default="Base_jumpToRelatedDocument",
required=1)
jump_allowed = fields.CheckBoxField('jump_allowed',
title='Jump Allowed',
description=(
"Do we allow to jump to the relation ?"),
default=1,
required=0)
base_category = fields.StringField('base_category',
title='Base Category',
description=(
......@@ -182,7 +189,7 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
relation_field_index = getattr(field.aq_parent, '_v_relation_field_index', 0)
field.aq_parent._v_relation_field_index = relation_field_index + 1 # Increase index
if value not in ( None, '' ) and not REQUEST.has_key(relation_item_id) and value == field.get_value('default'):
if value not in ( None, '' ) and not REQUEST.has_key(relation_item_id) and value == field.get_value('default') and field.get_value('jump_allowed') == 1 :
if REQUEST.get('selection_name') is not None:
html_string += '&nbsp;&nbsp;<a href="%s/%s?field_id=%s&form_id=%s&selection_name=%s&selection_index=%s"><img src="%s/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'),portal_url_string)
......@@ -194,6 +201,8 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
def render_view(self, field, value):
"""Render text input field.
"""
if field.get_value('jump_allowed') == 0 :
return Widget.TextWidget.render_view(self, field, value)
REQUEST = get_request()
here = REQUEST['here']
html_string = Widget.TextWidget.render_view(self, field, value)
......
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