From 8f40b26abe44b2589a48b70865a1d4260f041ed4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Tue, 4 Mar 2014 14:34:28 +0100 Subject: [PATCH] tabs2spaces. --- skins/custom_generic/folder_contents.py | 266 ++++++++++++------------ 1 file changed, 133 insertions(+), 133 deletions(-) diff --git a/skins/custom_generic/folder_contents.py b/skins/custom_generic/folder_contents.py index b63159f..2be413b 100755 --- a/skins/custom_generic/folder_contents.py +++ b/skins/custom_generic/folder_contents.py @@ -24,60 +24,60 @@ form = context.REQUEST.form default_target = 'object/folderContents' default_kw = {'b_start': b_start, 'key': key, 'reverse': reverse, 'ajax' : ajax} if items_copy : - if ajax : default_kw['syncFragments']=['rightCell'] - if context.validateItemIds(**form) and \ - context.folder_copy_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return + if ajax : default_kw['syncFragments']=['rightCell'] + if context.validateItemIds(**form) and \ + context.folder_copy_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return elif items_cut : - if ajax : default_kw['syncFragments']=['rightCell'] - if context.validateItemIds(**form) and \ - context.folder_cut_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return + if ajax : default_kw['syncFragments']=['rightCell'] + if context.validateItemIds(**form) and \ + context.folder_cut_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return elif items_delete and \ - context.validateItemIds(**form) and \ - context.folder_delete_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return + context.validateItemIds(**form) and \ + context.folder_delete_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return elif items_new and \ - context.setRedirect(context, 'object/new', **default_kw): - return + context.setRedirect(context, 'object/new', **default_kw): + return elif items_paste : - if ajax : default_kw['syncFragments']=['rightCell'] - if context.folder_paste_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return + if ajax : default_kw['syncFragments']=['rightCell'] + if context.folder_paste_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return elif items_rename and \ - context.validateItemIds(**form) and \ - context.setRedirect(context, 'object/rename_items', ids=ids, - **default_kw): - return + context.validateItemIds(**form) and \ + context.setRedirect(context, 'object/rename_items', ids=ids, + **default_kw): + return elif items_sort and \ - context.folder_sort_control(**form) and \ - context.setRedirect(context, default_target, b_start=b_start): - return + context.folder_sort_control(**form) and \ + context.setRedirect(context, default_target, b_start=b_start): + return elif items_up and \ - context.validateItemIds(**form) and \ - context.folder_up_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return + context.validateItemIds(**form) and \ + context.folder_up_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return elif items_down and \ - context.validateItemIds(**form) and \ - context.folder_down_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return + context.validateItemIds(**form) and \ + context.folder_down_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return elif items_top and \ - context.validateItemIds(**form) and \ - context.folder_top_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return + context.validateItemIds(**form) and \ + context.folder_top_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return elif items_bottom and \ - context.validateItemIds(**form) and \ - context.folder_bottom_control(**form) and \ - context.setRedirect(context, default_target, **default_kw): - return - + context.validateItemIds(**form) and \ + context.folder_bottom_control(**form) and \ + context.setRedirect(context, default_target, **default_kw): + return + options = {} @@ -88,62 +88,62 @@ manage_props_allowed = checkPermission(ManageProperties, context) target = context.getActionInfo(default_target)['url'] if not key: - (key, reverse) = context.getDefaultSorting() - is_default = 1 + (key, reverse) = context.getDefaultSorting() + is_default = 1 elif (key, reverse) == context.getDefaultSorting(): - is_default = 1 + is_default = 1 else: - is_default = 0 + is_default = 0 columns = ( {'key': 'Type', - 'title': 'Type', - 'width': None, - 'colspan': '2'} - , {'key': 'id', - 'title': 'Name', - 'width': None, - 'colspan': None} - , {'key': 'modified', - 'title': 'Last Modified', - 'width': None, - 'colspan': None} - ) + 'title': 'Type', + 'width': None, + 'colspan': '2'} + , {'key': 'id', + 'title': 'Name', + 'width': None, + 'colspan': None} + , {'key': 'modified', + 'title': 'Last Modified', + 'width': None, + 'colspan': None} + ) -for column in columns: - images = [] - if key == column['key'] : - if not is_default and manage_props_allowed : - images.append( {'src' : getattr(context, 'set_default_sorting.gif').absolute_url(), - 'alt' : 'Set Sorting as Default', - 'id' : 'SetSortingAsDefault', - 'href': '%s?%s' % (target, make_query(items_sort=True, - key=key, - reverse= (key != 'position' and [reverse] or [False])[0] ) - ) - } - ) +for column in columns: + images = [] + if key == column['key'] : + if not is_default and manage_props_allowed : + images.append( {'src' : getattr(context, 'set_default_sorting.gif').absolute_url(), + 'alt' : 'Set Sorting as Default', + 'id' : 'SetSortingAsDefault', + 'href': '%s?%s' % (target, make_query(items_sort=True, + key=key, + reverse= (key != 'position' and [reverse] or [False])[0] ) + ) + } + ) - if key != 'position' : - if reverse : - toggleImg = getattr(context, 'arrowDown.gif') - alt = 'descending sort' - else : - toggleImg = getattr(context, 'arrowUp.gif') - alt = 'ascending sort' - query = make_query(key=column['key'], reverse = not reverse) - else : - toggleImg = getattr(context, 'arrowUp.gif') - alt = 'ascending sort' - query = make_query(key=column['key']) - images.append( {'src' : toggleImg.absolute_url(), 'alt' : alt} ) - else : - if key != 'position' : - query = make_query(key=column['key'], reverse = reverse) - else : - query = make_query(key=column['key']) - - column['url'] = '%s?%s' % (target, query) - column['images'] = images + if key != 'position' : + if reverse : + toggleImg = getattr(context, 'arrowDown.gif') + alt = 'descending sort' + else : + toggleImg = getattr(context, 'arrowUp.gif') + alt = 'ascending sort' + query = make_query(key=column['key'], reverse = not reverse) + else : + toggleImg = getattr(context, 'arrowUp.gif') + alt = 'ascending sort' + query = make_query(key=column['key']) + images.append( {'src' : toggleImg.absolute_url(), 'alt' : alt} ) + else : + if key != 'position' : + query = make_query(key=column['key'], reverse = reverse) + else : + query = make_query(key=column['key']) + + column['url'] = '%s?%s' % (target, query) + column['images'] = images context.filterCookie() folderfilter = context.REQUEST.get('folderfilter', '') @@ -156,62 +156,62 @@ batch_obj = Batch(items, context.default_batch_size, b_start, orphan=0, quantuml items = [] display_delete_button = not isAnon # TODO : à revoir for item in batch_obj: - item_icon = item.getIcon - item_id = item.getId - item_url = item.getURL() - items.append( - {'checkbox': not isAnon, - 'icon': item_icon and ( '%s/%s' % (portal_url, item_icon) ) or '', - 'id': item_id, - 'modified': item.modified.strftime(locale_date_fmt), - 'title_or_id': item.Title or item_id, - 'type': item.Type or None, - 'url': item_url } ) + item_icon = item.getIcon + item_id = item.getId + item_url = item.getURL() + items.append( + {'checkbox': not isAnon, + 'icon': item_icon and ( '%s/%s' % (portal_url, item_icon) ) or '', + 'id': item_id, + 'modified': item.modified.strftime(locale_date_fmt), + 'title_or_id': item.Title or item_id, + 'type': item.Type or None, + 'url': item_url } ) options['batch'] = { 'listColumnInfos': tuple(columns), - 'listItemInfos': tuple(items), - 'firstItemPos' : b_start + 1, - 'sort_key' : key, - 'sort_dir' : sort_dir, - 'batch_obj': batch_obj } + 'listItemInfos': tuple(items), + 'firstItemPos' : b_start + 1, + 'sort_key' : key, + 'sort_dir' : sort_dir, + 'batch_obj': batch_obj } hidden_vars = [] for name, value in html_marshal(**default_kw): - hidden_vars.append( {'name': name, 'value': value} ) - + hidden_vars.append( {'name': name, 'value': value} ) + # buttons buttons = [] if items_add_allowed and context.allowedContentTypes(): - buttons.append( {'name': 'items_new', 'value': 'New...'} ) - if items: - buttons.append( {'name': 'items_rename', 'value': 'Rename'} ) - + buttons.append( {'name': 'items_new', 'value': 'New...'} ) + if items: + buttons.append( {'name': 'items_rename', 'value': 'Rename'} ) + if checkPermission(ViewManagementScreens, context) and items: - buttons.append( {'name': 'items_cut', 'value': 'Cut'} ) - buttons.append( {'name': 'items_copy', 'value': 'Copy'} ) - + buttons.append( {'name': 'items_cut', 'value': 'Cut'} ) + buttons.append( {'name': 'items_copy', 'value': 'Copy'} ) + if items_add_allowed and context.cb_dataValid(): - buttons.append( {'name': 'items_paste', 'value': 'Paste'} ) - + buttons.append( {'name': 'items_paste', 'value': 'Paste'} ) + if display_delete_button and items: - buttons.append( {'name': 'items_delete', 'value': 'Delete'} ) + buttons.append( {'name': 'items_delete', 'value': 'Delete'} ) length = batch_obj.sequence_length is_orderable = manage_props_allowed and (key == 'position') and length > 1 is_sortable = manage_props_allowed and not is_default options['form'] = { 'action': target, - 'listHiddenVarInfos': tuple(hidden_vars), - 'listButtonInfos': tuple(buttons), - 'is_orderable': is_orderable, - 'is_sortable': is_sortable, - 'items_add_allowed': items_add_allowed } + 'listHiddenVarInfos': tuple(hidden_vars), + 'listButtonInfos': tuple(buttons), + 'is_orderable': is_orderable, + 'is_sortable': is_sortable, + 'items_add_allowed': items_add_allowed } if not ajax and is_orderable : - deltas = range( 1, min(5, length) ) + range(5, length, 5) - options['form']['listDeltas'] = tuple(deltas) + deltas = range( 1, min(5, length) ) + range(5, length, 5) + options['form']['listDeltas'] = tuple(deltas) if template and macro : - options['template'] = template - options['macro'] = macro - return context.use_macro(**options) + options['template'] = template + options['macro'] = macro + return context.use_macro(**options) else : - return context.folder_contents_template(**options) + return context.folder_contents_template(**options) -- 2.20.1