Commit ee754ce6 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Remove disable_link. Instead, extend url_columns.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4353 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3ed89570
...@@ -274,7 +274,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -274,7 +274,7 @@ class ListBoxWidget(Widget.Widget):
property_names = Widget.Widget.property_names +\ property_names = Widget.Widget.property_names +\
['lines', 'columns', 'all_columns', 'search_columns', 'sort_columns', 'sort', ['lines', 'columns', 'all_columns', 'search_columns', 'sort_columns', 'sort',
'editable_columns', 'all_editable_columns', 'editable_columns', 'all_editable_columns',
'stat_columns', 'disable_link', 'url_columns', 'global_attributes', 'stat_columns', 'url_columns', 'global_attributes',
'list_method', 'count_method', 'stat_method', 'selection_name', 'list_method', 'count_method', 'stat_method', 'selection_name',
'meta_types', 'portal_types', 'default_params', 'meta_types', 'portal_types', 'default_params',
'search', 'select', 'search', 'select',
...@@ -413,12 +413,6 @@ class ListBoxWidget(Widget.Widget): ...@@ -413,12 +413,6 @@ class ListBoxWidget(Widget.Widget):
default=[], default=[],
required=0) required=0)
disable_link = fields.CheckBoxField('disable_link',
title='Disable Link',
description=('Disable URL'),
default='',
required=0)
url_columns = fields.ListTextAreaField('url_columns', url_columns = fields.ListTextAreaField('url_columns',
title="URL Columns", title="URL Columns",
description=( description=(
...@@ -521,7 +515,6 @@ class ListBoxWidget(Widget.Widget): ...@@ -521,7 +515,6 @@ class ListBoxWidget(Widget.Widget):
editable_columns = field.get_value('editable_columns') editable_columns = field.get_value('editable_columns')
all_editable_columns = field.get_value('all_editable_columns') all_editable_columns = field.get_value('all_editable_columns')
stat_columns = field.get_value('stat_columns') stat_columns = field.get_value('stat_columns')
disable_link = field.get_value('disable_link')
url_columns = field.get_value('url_columns') url_columns = field.get_value('url_columns')
search_columns = field.get_value('search_columns') search_columns = field.get_value('search_columns')
sort_columns = field.get_value('sort_columns') sort_columns = field.get_value('sort_columns')
...@@ -1767,43 +1760,42 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1767,43 +1760,42 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
######################################################################### #########################################################################
object_url = None object_url = None
# Try to get a link # Try to get a link
if not disable_link: # Check if url_columns defines a method
# Check if url_columns defines a method # to retrieve the URL.
# to retrieve the URL. url_method = None
url_method = None for column in url_columns:
for column in url_columns: if sql == column[0]:
if sql == column[0]: url_method = getattr(o, column[1], '')
url_method = getattr(o, column[1], '') break
break if url_method:
if url_method is not None: # Call the requested method
# Call the requested method try:
object_url = url_method(brain=o, selection=selection)
except ConflictError:
raise
except:
# XXX FIXME: except without Error name
LOG('ListBox', 0,
'Could not evaluate url_method %s' % \
column[1], error=sys.exc_info())
pass
elif url_method is None:
# Check if this object provides a specific URL method
url_method = getattr(o, 'getListItemUrl', None)
if url_method is None:
try: try:
object_url = url_method(brain=o, selection=selection) object_url = o.absolute_url() + \
'/view?selection_index=%s&selection_name=%s&reset=1' % (i, selection_name)
except AttributeError:
pass
else:
try:
object_url = url_method(alias, i, selection_name)
except ConflictError: except ConflictError:
raise raise
except: except:
# XXX FIXME: except without Error name # XXX FIXME: except without Error name
LOG('ListBox', 0,
'Could not evaluate url_method %s' % \
column[1], error=sys.exc_info())
pass pass
else:
# Check if this object provides a specific URL method
url_method = getattr(o, 'getListItemUrl', None)
if url_method is None:
try:
object_url = o.absolute_url() + \
'/view?selection_index=%s&selection_name=%s&reset=1' % (i, selection_name)
except AttributeError:
pass
else:
try:
object_url = url_method(alias, i, selection_name)
except ConflictError:
raise
except:
# XXX FIXME: except without Error name
pass
# Generate appropriate HTML # Generate appropriate HTML
if object_url is None: if object_url is None:
list_body = list_body + \ list_body = list_body + \
...@@ -1924,8 +1916,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1924,8 +1916,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
if render_format == 'list': if render_format == 'list':
#listboxline_list.append(current_listboxline) #listboxline_list.append(current_listboxline)
LOG('ListBox', 0, 'listboxline_list: %s' % str(listboxline_list) ) #LOG('ListBox', 0, 'listboxline_list: %s' % str(listboxline_list) )
return listboxline_list return listboxline_list
......
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