Commit be8f6ab4 authored by Jean-Paul Smets's avatar Jean-Paul Smets

First complete implementation of parent virtual base category in report mode...

First complete implementation of parent virtual base category in report mode of Listbox. Various display optimisations


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2437 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f17f875e
...@@ -185,30 +185,38 @@ def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfol ...@@ -185,30 +185,38 @@ def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfol
if root is None: return tree_list if root is None: return tree_list
if base_category == 'parent': if base_category == 'parent':
for zo in root.searchFolder(sort_index=(('int_index', ''),('title', ''), ('id', ''))): if hasattr(aq_base(root), 'objectValues'):
# If this is a folder, try to browse the hierarchy
for zo in root.searchFolder(sort_order=(('int_index', 'ASC'),('title', 'ASC'), ('id', 'ASC'))):
o = zo.getObject() o = zo.getObject()
if o is not None:
new_root_dict = root_dict.copy() new_root_dict = root_dict.copy()
new_root_dict[None] = new_root_dict[base_category] = o new_root_dict[None] = new_root_dict[base_category] = o
selection_domain = DomainSelection(domain_dict = new_root_dict) selection_domain = DomainSelection(domain_dict = new_root_dict)
if (report_depth is not None and depth <= (report_depth - 1)) or o.getRelativeUrl() in unfolded_list: if (report_depth is not None and depth <= (report_depth - 1)) or o.getRelativeUrl() in unfolded_list:
tree_list += [(o, 1, depth, 1, selection_domain)] # Summary (open) exception_uid_list = [] # Object we do not want to display
for sub_zo in o.searchFolder(sort_order=(('int_index', 'ASC'),('title', 'ASC'), ('id', 'ASC'))):
sub_o = sub_zo.getObject()
if sub_o is not None and hasattr(aq_base(root), 'objectValues'):
exception_uid_list.append(sub_o.getUid())
tree_list += [(o, 1, depth, 1, selection_domain, exception_uid_list)] # Summary (open)
if is_report_opened : if is_report_opened :
tree_list += [(o, 0, depth, 0, _parent_domain_mark)] # List (contents, closed, must be strict selection) tree_list += [(o, 0, depth, 0, selection_domain, exception_uid_list)] # List (contents, closed, must be strict selection)
tree_list += makeTreeList(here, form, new_root_dict, report_path, base_category, depth + 1, unfolded_list, form_id, selection_name, report_depth, is_report_opened=is_report_opened) tree_list += makeTreeList(here, form, new_root_dict, report_path, base_category, depth + 1, unfolded_list, form_id, selection_name, report_depth, is_report_opened=is_report_opened)
else: else:
tree_list += [(o, 1, depth, 0, selection_domain)] # Summary (closed) tree_list += [(o, 1, depth, 0, selection_domain, ())] # Summary (closed)
else: else:
for o in root.objectValues(): for o in root.objectValues():
new_root_dict = root_dict.copy() new_root_dict = root_dict.copy()
new_root_dict[None] = new_root_dict[base_category] = o new_root_dict[None] = new_root_dict[base_category] = o
selection_domain = DomainSelection(domain_dict = new_root_dict) selection_domain = DomainSelection(domain_dict = new_root_dict)
if (report_depth is not None and depth <= (report_depth - 1)) or o.getRelativeUrl() in unfolded_list: if (report_depth is not None and depth <= (report_depth - 1)) or o.getRelativeUrl() in unfolded_list:
tree_list += [(o, 1, depth, 1, selection_domain)] # Summary (open) tree_list += [(o, 1, depth, 1, selection_domain, None)] # Summary (open)
if is_report_opened : if is_report_opened :
tree_list += [(o, 0, depth, 0, selection_domain)] # List (contents, closed, must be strict selection) tree_list += [(o, 0, depth, 0, selection_domain, None)] # List (contents, closed, must be strict selection)
tree_list += makeTreeList(here, form, new_root_dict, report_path, base_category, depth + 1, unfolded_list, form_id, selection_name, report_depth, is_report_opened=is_report_opened) tree_list += makeTreeList(here, form, new_root_dict, report_path, base_category, depth + 1, unfolded_list, form_id, selection_name, report_depth, is_report_opened=is_report_opened)
else: else:
tree_list += [(o, 1, depth, 0, selection_domain)] # Summary (closed) tree_list += [(o, 1, depth, 0, selection_domain, None)] # Summary (closed)
return tree_list return tree_list
...@@ -590,11 +598,21 @@ class ListBoxWidget(Widget.Widget): ...@@ -590,11 +598,21 @@ class ListBoxWidget(Widget.Widget):
domain_tree = 0 domain_tree = 0
report_tree = 0 report_tree = 0
elif selection.domain_tree_mode == 1: elif selection.domain_tree_mode == 1:
# Only display domain if domain is defined
if len(domain_root_list):
domain_tree = 1 domain_tree = 1
report_tree = 0 report_tree = 0
else:
domain_tree = 0
report_tree = 0
elif selection.report_tree_mode == 1: elif selection.report_tree_mode == 1:
# Only display report if report is defined
if len(report_root_list):
domain_tree = 0 domain_tree = 0
report_tree = 1 report_tree = 1
else:
domain_tree = 0
report_tree = 0
# In report tree mode, we want to remember if the items have to be displayed # In report tree mode, we want to remember if the items have to be displayed
is_report_opened = REQUEST.get('is_report_opened', selection.isReportOpened()) is_report_opened = REQUEST.get('is_report_opened', selection.isReportOpened())
...@@ -748,6 +766,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -748,6 +766,7 @@ class ListBoxWidget(Widget.Widget):
elif stat_method.method_name == 'portal_catalog': elif stat_method.method_name == 'portal_catalog':
# We use the catalog count results # We use the catalog count results
stat_method = here.portal_catalog.countResults stat_method = here.portal_catalog.countResults
show_stat = 1
else: else:
# Try to get the method through acquisition # Try to get the method through acquisition
try: try:
...@@ -757,7 +776,9 @@ class ListBoxWidget(Widget.Widget): ...@@ -757,7 +776,9 @@ class ListBoxWidget(Widget.Widget):
show_stat = 0 show_stat = 0
pass pass
else: else:
stat_method = here.portal_catalog.countResults # No stat method defined means no statistics displayed
stat_method = None
show_stat = 0
#LOG('ListBox', 0, 'domain_tree = %s, selection.getDomainPath() = %s, selection.getDomainList() = %s' % (repr(domain_tree), repr(selection.getDomainPath()), repr(selection.getDomainList()))) #LOG('ListBox', 0, 'domain_tree = %s, selection.getDomainPath() = %s, selection.getDomainList() = %s' % (repr(domain_tree), repr(selection.getDomainPath()), repr(selection.getDomainList())))
if domain_tree: if domain_tree:
...@@ -829,7 +850,13 @@ class ListBoxWidget(Widget.Widget): ...@@ -829,7 +850,13 @@ class ListBoxWidget(Widget.Widget):
# #
############################################################### ###############################################################
if report_tree: if report_tree:
selection_report_path = selection.getReportPath() default_selection_report_path = report_root_list[0][0].split('/')[0]
if default_selection_report_path in portal_categories.objectIds() or \
(portal_domains is not None and default_selection_report_path in portal_domains.objectIds()):
pass
else:
default_selection_report_path = report_root_list[0][0]
selection_report_path = selection.getReportPath(default = (default_selection_report_path,))
if report_depth is not None: if report_depth is not None:
selection_report_current = () selection_report_current = ()
else: else:
...@@ -846,7 +873,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -846,7 +873,7 @@ class ListBoxWidget(Widget.Widget):
#LOG("Report Tree",0,str(report_tree_list)) #LOG("Report Tree",0,str(report_tree_list))
for s in report_tree_list: for s in report_tree_list:
# Prepare query by defining selection report object # Prepare query by defining selection report object
if s[4] is not _parent_domain_mark: #if s[4] is not _parent_domain_mark:
selection.edit(report = s[4]) selection.edit(report = s[4])
if s[1]: if s[1]:
# Push new select_expression # Push new select_expression
...@@ -861,8 +888,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -861,8 +888,7 @@ class ListBoxWidget(Widget.Widget):
else: else:
kw['select_expression'] = original_select_expression kw['select_expression'] = original_select_expression
if s[1] and show_stat:
# stat_result is a list # stat_result is a list
# we want now to make it a dictionnary # we want now to make it a dictionnary
# Is this a report line # Is this a report line
...@@ -880,24 +906,53 @@ class ListBoxWidget(Widget.Widget): ...@@ -880,24 +906,53 @@ class ListBoxWidget(Widget.Widget):
stat_context = s[0].asContext(**stat_result) stat_context = s[0].asContext(**stat_result)
stat_context.absolute_url = lambda x: s[0].absolute_url() stat_context.absolute_url = lambda x: s[0].absolute_url()
stat_context.domain_url = s[0].getRelativeUrl() stat_context.domain_url = s[0].getRelativeUrl()
report_sections += [(s[0].id, 1, s[2], [stat_context], 1, s[3], s[4])] report_sections += [(s[0].id, 1, s[2], [stat_context], 1, s[3], s[4], stat_context, 0)]
# report id, is_summary, depth, object_list, object_list_len, XX, XX, report_object, start, stop
else: else:
# Prepare query # Prepare query
selection.edit( params = kw ) selection.edit( params = kw )
if list_method not in (None, ''): if list_method not in (None, ''):
if s[4] is not _parent_domain_mark: #if s[4] is not _parent_domain_mark:
object_list = selection(method = list_method, context=here, REQUEST=REQUEST) object_list = selection(method = list_method, context=here, REQUEST=REQUEST)
else: #else:
object_list = [s[0]] # object_list = [s[0]]
else: else:
# If list_method is None, use already selected values. # If list_method is None, use already selected values.
if s[4] is not _parent_domain_mark: #if s[4] is not _parent_domain_mark:
object_list = here.portal_selections.getSelectionValueList(selection_name, object_list = here.portal_selections.getSelectionValueList(selection_name,
context=here, REQUEST=REQUEST) context=here, REQUEST=REQUEST)
else: #else:
object_list = [s[0]] # object_list = [s[0]]
# # PERFORMANCE ? is len(object_list) fast enough ? # # PERFORMANCE ? is len(object_list) fast enough ?
report_sections += [ (None, 0, s[2], object_list, len(object_list), s[3], s[4]) ] exception_uid_list = s[5]
if exception_uid_list is not None:
# Filter folders if this is a parent tree
new_object_list = []
for o in object_list:
#LOG('exception_uid_list', 0, '%s %s' % (o.getUid(), exception_uid_list))
if o.getUid() not in exception_uid_list:
new_object_list.append(o)
object_list = new_object_list
object_list_len = len(object_list)
if not s[1]:
if show_stat:
report_sections += [ (None, 0, s[2], object_list, object_list_len, s[3], s[4], None, 0) ]
else:
stat_context = s[0].asContext()
stat_context.absolute_url = lambda x: s[0].absolute_url()
stat_context.domain_url = s[0].getRelativeUrl()
if object_list_len and s[3]:
# Display object data at same level as category selector
# If this domain is open
report_sections += [ (s[0].id, 0, s[2], [object_list[0]], 1, s[3], s[4], stat_context, 0) ]
report_sections += [ (None, 0, s[2], object_list, object_list_len - 1, s[3], s[4], None, 1) ]
else:
if exception_uid_list is not None:
# Display current parent domain
report_sections += [ (s[0].id, 0, s[2], [s[0]], 1, s[3], s[4], stat_context, 0) ]
else:
# No data to display
report_sections += [ (s[0].id, 0, s[2], [None], 1, s[3], s[4], stat_context, 0) ]
# Reset original value # Reset original value
selection.edit(report = None) selection.edit(report = None)
...@@ -910,7 +965,8 @@ class ListBoxWidget(Widget.Widget): ...@@ -910,7 +965,8 @@ class ListBoxWidget(Widget.Widget):
# If list_method is None, use already selected values. # If list_method is None, use already selected values.
object_list = here.portal_selections.getSelectionValueList(selection_name, context=here, REQUEST=REQUEST) object_list = here.portal_selections.getSelectionValueList(selection_name, context=here, REQUEST=REQUEST)
# PERFORMANCE PROBLEM ? is len(object_list) fast enough ? # PERFORMANCE PROBLEM ? is len(object_list) fast enough ?
report_sections = ( (None, 0, 0, object_list, len(object_list), 0), ) object_list_len = len(object_list)
report_sections = ( (None, 0, 0, object_list, object_list_len, 0, None, None, 0), )
############################################################### ###############################################################
...@@ -1089,13 +1145,24 @@ class ListBoxWidget(Widget.Widget): ...@@ -1089,13 +1145,24 @@ class ListBoxWidget(Widget.Widget):
alt="spacer"/> alt="spacer"/>
</td> </td>
<td valign="middle" nowrap> <td valign="middle" nowrap>
""" % format_dict
if len(report_root_list) or len(domain_root_list):
header += """
<input type="image" src="%(portal_url_string)s/images/text_block.png" id="flat_list" <input type="image" src="%(portal_url_string)s/images/text_block.png" id="flat_list"
title="%(flat_list_title)s" name="portal_selections/setFlatListMode:method" value="1" border="0" alt="img"/"> title="%(flat_list_title)s" name="portal_selections/setFlatListMode:method" value="1" border="0" alt="img"/">
<input type="image" src="%(portal_url_string)s/images/view_tree.png" id="flat_list" """ % format_dict
if len(report_root_list):
header += """
<input type="image" src="%(portal_url_string)s/images/view_tree.png" id="report_list"
title="%(report_tree_title)s" name="portal_selections/setReportTreeMode:method" value="1" border="0" alt="img"/"> title="%(report_tree_title)s" name="portal_selections/setReportTreeMode:method" value="1" border="0" alt="img"/">
<input type="image" src="%(portal_url_string)s/images/view_choose.png" id="flat_list" """ % format_dict
title="%(domain_tree_title)s" name="portal_selections/setDomainTreeMode:method" value="1" border="0" alt="img"/"></td> if len(domain_root_list):
header += """
<input type="image" src="%(portal_url_string)s/images/view_choose.png" id="domain_list"
title="%(domain_tree_title)s" name="portal_selections/setDomainTreeMode:method" value="1" border="0" alt="img"/">
""" % format_dict
header += """
</td>
<td width="100%%" valign="middle">&nbsp; <a href="%(list_action)s">%(field_title)s</a>: <td width="100%%" valign="middle">&nbsp; <a href="%(list_action)s">%(field_title)s</a>:
%(record_number)s - %(item_number)s %(record_number)s - %(item_number)s
</td> </td>
...@@ -1140,7 +1207,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -1140,7 +1207,7 @@ class ListBoxWidget(Widget.Widget):
onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
%s</select>""" % (here.getUrl(),report_tree_options) %s</select>""" % (here.getUrl(),report_tree_options)
report_popup = """ report_popup = """
<td class="Data" width="50" align="center" valign="middle"> <td class="Data" width="50" align="left" valign="middle">
%s %s
</td> </td>
""" % report_popup """ % report_popup
...@@ -1194,9 +1261,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1194,9 +1261,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
list_header += ("<td class=\"Data\">%s</td>\n" % translate('ui', cname[1], default = cname[1])) list_header += ("<td class=\"Data\">%s</td>\n" % translate('ui', cname[1], default = cname[1]))
list_header = list_header + "</tr>" list_header = list_header + "</tr>"
# Create the search row of the table with the name of the columns # Create report depth_selector
if search:
# Add empty column for report
if report_tree: if report_tree:
depth_selector = '' depth_selector = ''
for i in range(0,6): for i in range(0,6):
...@@ -1206,6 +1271,11 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1206,6 +1271,11 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
# In report mode, we may want to hide items, and only display stat lines. # In report mode, we may want to hide items, and only display stat lines.
depth_selector += """&nbsp;-&nbsp;<a href="%s/%s?selection_name=%s&selection_index=%s&is_report_opened:int=%s">%s</a>""" % \ depth_selector += """&nbsp;-&nbsp;<a href="%s/%s?selection_name=%s&selection_index=%s&is_report_opened:int=%s">%s</a>""" % \
(here.absolute_url(), form.id, current_selection_name, current_selection_index , 1 - is_report_opened, is_report_opened and 'Hide' or 'Show') (here.absolute_url(), form.id, current_selection_name, current_selection_index , 1 - is_report_opened, is_report_opened and 'Hide' or 'Show')
# Create the search row of the table with the name of the columns
if search:
if report_tree:
# Add empty column for report
report_search = """<td class="Data" width="50" align="left" valign="middle">%s</td>""" % depth_selector report_search = """<td class="Data" width="50" align="left" valign="middle">%s</td>""" % depth_selector
else: else:
report_search = "" report_search = ""
...@@ -1250,6 +1320,10 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1250,6 +1320,10 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
"<td class=\"DataB\"></td> ") "<td class=\"DataB\"></td> ")
list_search = list_search + "</tr>" list_search = list_search + "</tr>"
else:
if report_tree:
list_search = """<td class="Data" width="50" align="left" valign="middle" colspan="%s">%s</td>""" % \
(len(extended_columns) + select + 1, depth_selector)
else: else:
list_search = '' list_search = ''
...@@ -1271,7 +1345,6 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1271,7 +1345,6 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
# Build Lines # Build Lines
list_body = '' list_body = ''
if render_format == 'list': if render_format == 'list':
# initialize the title line # initialize the title line
title_listboxline = ListBoxLine() title_listboxline = ListBoxLine()
...@@ -1291,6 +1364,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1291,6 +1364,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
if current_section is not None: if current_section is not None:
current_section_size = current_section[4] current_section_size = current_section[4]
object_list = current_section[3] object_list = current_section[3]
stat_context = current_section[7]
index_shift = current_section[8]
#if current_section is not None: #if current_section is not None:
for i in range(start,end): for i in range(start,end):
...@@ -1310,11 +1385,14 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1310,11 +1385,14 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
current_section = report_sections[section_index] current_section = report_sections[section_index]
current_section_size = current_section[4] current_section_size = current_section[4]
object_list = current_section[3] object_list = current_section[3]
stat_context = current_section[7]
index_shift = current_section[8]
is_summary = current_section[1] # Update summary type is_summary = current_section[1] # Update summary type
list_body = list_body + '<tr>' list_body = list_body + '<tr>'
o = object_list[i - current_section_base_index] # FASTER PERFORMANCE o = object_list[i - current_section_base_index + index_shift] # FASTER PERFORMANCE
real_o = None real_o = None
# Define the CSS # Define the CSS
...@@ -1329,7 +1407,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1329,7 +1407,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
section_char = '' section_char = ''
if report_tree: if report_tree:
if is_summary: if is_summary or current_section[0] is not None:
# This is a summary # This is a summary
section_name = current_section[0] section_name = current_section[0]
else: else:
...@@ -1340,7 +1418,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1340,7 +1418,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
section_char = '-' section_char = '-'
list_body = list_body + \ list_body = list_body + \
"""<td class="%s" align="left" valign="middle"><a href="portal_selections/foldReport?report_url=%s&form_id=%s&list_selection_name=%s">%s%s%s</a></td> """<td class="%s" align="left" valign="middle"><a href="portal_selections/foldReport?report_url=%s&form_id=%s&list_selection_name=%s">%s%s%s</a></td>
""" % (td_css, getattr(current_section[3][0],'domain_url',''), form.id, selection_name, '&nbsp;&nbsp;' * current_section[2], section_char, section_name) """ % (td_css, getattr(stat_context,'domain_url',''), form.id, selection_name, '&nbsp;&nbsp;' * current_section[2], section_char, section_name)
if render_format == 'list': if render_format == 'list':
...@@ -1359,7 +1437,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1359,7 +1437,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
section_char = '+' section_char = '+'
list_body = list_body + \ list_body = list_body + \
"""<td class="%s" align="left" valign="middle"><a href="portal_selections/unfoldReport?report_url=%s&form_id=%s&list_selection_name=%s">%s%s%s</a></td> """<td class="%s" align="left" valign="middle"><a href="portal_selections/unfoldReport?report_url=%s&form_id=%s&list_selection_name=%s">%s%s%s</a></td>
""" % (td_css, getattr(current_section[3][0],'domain_url',''), form.id, selection_name, '&nbsp;&nbsp;' * current_section[2], section_char, section_name) """ % (td_css, getattr(stat_context,'domain_url',''), form.id, selection_name, '&nbsp;&nbsp;' * current_section[2], section_char, section_name)
if render_format == 'list': if render_format == 'list':
...@@ -1374,11 +1452,12 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1374,11 +1452,12 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
current_listboxline.setSectionFolded( 1 ) current_listboxline.setSectionFolded( 1 )
if select: if select:
if o is not None:
if o.uid in checked_uids: if o.uid in checked_uids:
selected = 'checked' selected = 'checked'
else: else:
selected = '' selected = ''
if section_char != '': if is_summary:
list_body = list_body + \ list_body = list_body + \
"""<td class="%s" width="50" align="center" valign="middle">&nbsp;</td> """<td class="%s" width="50" align="center" valign="middle">&nbsp;</td>
""" % (td_css, ) """ % (td_css, )
...@@ -1387,10 +1466,16 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1387,10 +1466,16 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
"""<td class="%s" width="50" align="center" valign="middle">&nbsp; """<td class="%s" width="50" align="center" valign="middle">&nbsp;
<input type="checkbox" %s value="%s" id="cb_%s" name="uids:list"/></td> <input type="checkbox" %s value="%s" id="cb_%s" name="uids:list"/></td>
""" % (td_css, selected, o.uid , o.uid) """ % (td_css, selected, o.uid , o.uid)
else:
list_body = list_body + \
"""<td class="%s" width="50" align="center" valign="middle">&nbsp;</td>
""" % td_css
error_list = [] error_list = []
if render_format == 'list': if render_format == 'list':
if o is not None:
if selected == '': if selected == '':
current_listboxline.setObjectUid( o.uid ) current_listboxline.setObjectUid( o.uid )
current_listboxline.checkLine( 0 ) current_listboxline.checkLine( 0 )
...@@ -1398,6 +1483,10 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1398,6 +1483,10 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
current_listboxline.setObjectUid( o.uid ) current_listboxline.setObjectUid( o.uid )
current_listboxline.checkLine( 1 ) current_listboxline.checkLine( 1 )
if o is None:
# This line is an empty line used by reports without statistics
list_body += ('<td class=\"%s\">&nbsp;</td>' % td_css) * len(extended_columns)
else:
for cname in extended_columns: for cname in extended_columns:
# add attribute_original_value, because I need to know the type of the attribute # add attribute_original_value, because I need to know the type of the attribute
attribute_original_value = None attribute_original_value = None
...@@ -1555,12 +1644,12 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1555,12 +1644,12 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
# Add item to list_result_item for list render format # Add item to list_result_item for list render format
# if render_format == 'list': # if render_format == 'list':
# column_value = my_field._get_default(my_field.generate_field_key(), attribute_original_value, o) # column_value = my_field._get_default(my_field.generate_field_key(), attribute_original_value, o)
# if type(column_value) is type(u''): # if type(column_value) is type(u''):
# #column_value = unicode(column_value, 'utf-8') # #column_value = unicode(column_value, 'utf-8')
# column_value = column_value.encode('utf-8') # column_value = column_value.encode('utf-8')
# current_listboxline.addColumn(property_id , column_value) # current_listboxline.addColumn(property_id , column_value)
if render_format == 'list': if render_format == 'list':
# Make sure that attribute value is UTF-8 # Make sure that attribute value is UTF-8
attribute_value_tmp = attribute_original_value attribute_value_tmp = attribute_original_value
......
...@@ -273,9 +273,12 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -273,9 +273,12 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
return self.checked_uids return self.checked_uids
security.declarePublic('getDomainPath') security.declarePublic('getDomainPath')
def getDomainPath(self): def getDomainPath(self, default=None):
if self.domain_path is None: if self.domain_path is None:
if default is None:
self.domain_path = self.getDomainList()[0] self.domain_path = self.getDomainList()[0]
else:
self.domain_path = default
return self.domain_path return self.domain_path
security.declarePublic('getDomainList') security.declarePublic('getDomainList')
...@@ -285,9 +288,12 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -285,9 +288,12 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
return self.domain_list return self.domain_list
security.declarePublic('getReportPath') security.declarePublic('getReportPath')
def getReportPath(self): def getReportPath(self, default=None):
if self.report_path is None: if self.report_path is None:
self.report_path = ('portal_categories') if default is None:
self.report_path = self.getReportList()[0]
else:
self.report_path = default
return self.report_path return self.report_path
security.declarePublic('getReportList') security.declarePublic('getReportList')
......
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