Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Commit

Permalink
added api help for OrderSupport and OrderedFolder
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Dec 11, 2003
1 parent 6c45707 commit 7cc6137
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
106 changes: 106 additions & 0 deletions help/OrderSupport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################


class OrderSupport:
""" Ordered container mixin class.
This is an extension to the regular ObjectManager. It saves the objects in
order and lets you change the order of the contained objects. This is
particular helpful, if the order does not depend on object attributes, but
is totally user-specific.
"""

def moveObjectsByDelta(ids, delta):
""" Move specified sub-objects by delta.
If delta is higher than the possible maximum, objects will be moved to
the bottom. If delta is lower than the possible minimum, objects will
be moved to the top.
The order of the objects specified by ids will always be preserved. So
if you don't want to change their original order, make sure the order
of ids corresponds to their original order.
If an object with id doesn't exist an error will be raised.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""

def moveObjectsUp(ids, delta=1):
""" Move specified sub-objects up by delta in container.
If no delta is specified, delta is 1. See moveObjectsByDelta for more
details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""

def moveObjectsDown(ids, delta=1):
""" Move specified sub-objects down by delta in container.
If no delta is specified, delta is 1. See moveObjectsByDelta for more
details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""

def moveObjectsToTop(ids):
""" Move specified sub-objects to top of container.
See moveObjectsByDelta for more details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""

def moveObjectsToBottom(ids):
""" Move specified sub-objects to bottom of container.
See moveObjectsByDelta for more details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""

def orderObjects(key, reverse=None):
""" Order sub-objects by key and direction.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""

def getObjectPosition(id):
""" Get the position of an object by its id.
Permission -- Access contents information
Returns -- Position
"""

def moveObjectToPosition(id, position):
""" Move specified object to absolute position.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
31 changes: 31 additions & 0 deletions help/OrderedFolder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################


def manage_addOrderedFolder(id, title='', createPublic=0, createUserF=0,
REQUEST=None):
""" Add a new ordered Folder object with id *id*.
If the 'createPublic' and 'createUserF' parameters are set to any true
value, an 'index_html' and a 'UserFolder' objects are created respectively
in the new folder.
"""


class OrderedFolder:
""" Extends the default Folder by order support.
"""

__extends__ = ('OFSP.OrderSupport.OrderSupport', 'OFSP.Folder.Folder')

__constructor__ = manage_addOrderedFolder

0 comments on commit 7cc6137

Please sign in to comment.