X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/de068d5b8a1fd46a70f75f4e20e581ee846f866d..06261d4b9b1c430f52d16d789583212919aa2e96:/skins/photo_theme/folder_contents.py diff --git a/skins/photo_theme/folder_contents.py b/skins/photo_theme/folder_contents.py index e0bc4d8..b63159f 100755 --- a/skins/photo_theme/folder_contents.py +++ b/skins/photo_theme/folder_contents.py @@ -15,6 +15,7 @@ from Products.CMFDefault.utils import html_marshal mtool = getToolByName(script, 'portal_membership') checkPermission = mtool.checkPermission +isAnon = mtool.isAnonymousUser() utool = getToolByName(script, 'portal_url') portal_url = utool() @@ -94,11 +95,7 @@ elif (key, reverse) == context.getDefaultSorting(): else: is_default = 0 -columns = ( {'key': 'Lock', - 'title': '', - 'width': '16', - 'colspan': None} - , {'key': 'Type', +columns = ( {'key': 'Type', 'title': 'Type', 'width': None, 'colspan': '2'} @@ -110,10 +107,6 @@ columns = ( {'key': 'Lock', 'title': 'Last Modified', 'width': None, 'colspan': None} - , {'key': 'position', - 'title': 'Position', - 'width': None, - 'colspan': None } ) for column in columns: @@ -161,31 +154,23 @@ sortFunc = key in ['Type'] and 'nocase' or 'cmp' items = sequence.sort( items, ((key, sortFunc, sort_dir),) ) batch_obj = Batch(items, context.default_batch_size, b_start, orphan=0, quantumleap=1) items = [] -i = 1 -display_delete_button = True # TODO : à revoirs +display_delete_button = not isAnon # TODO : à revoir for item in batch_obj: item_icon = item.getIcon item_id = item.getId - item_position = key == 'position' and str(b_start + i) or '...' - i += 1 item_url = item.getURL() - #try : item_delete_allowed = context.objectIdCanBeDeleted(item_id) - #except : item_delete_allowed = checkPermission(DeleteObjects, context) # std zope perm - #if not display_delete_button : - # display_delete_button = item_delete_allowed items.append( - {'lock' : False, - 'checkbox': True, + {'checkbox': not isAnon, 'icon': item_icon and ( '%s/%s' % (portal_url, item_icon) ) or '', 'id': item_id, 'modified': item.modified.strftime(locale_date_fmt), - 'position': item_position, '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 } @@ -218,7 +203,8 @@ options['form'] = { 'action': target, 'listHiddenVarInfos': tuple(hidden_vars), 'listButtonInfos': tuple(buttons), 'is_orderable': is_orderable, - 'is_sortable': is_sortable } + '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) @@ -229,4 +215,3 @@ if template and macro : return context.use_macro(**options) else : return context.folder_contents_template(**options) -