Back to index

plone3  3.1.7
autosort.py
Go to the documentation of this file.
00001 #  ATContentTypes http://plone.org/products/atcontenttypes/
00002 #  Archetypes reimplementation of the CMF core types
00003 #  Copyright (c) 2003-2006 AT Content Types development team
00004 #
00005 #  This program is free software; you can redistribute it and/or modify
00006 #  it under the terms of the GNU General Public License as published by
00007 #  the Free Software Foundation; either version 2 of the License, or
00008 #  (at your option) any later version.
00009 #
00010 #  This program is distributed in the hope that it will be useful,
00011 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 #  GNU General Public License for more details.
00014 #
00015 #  You should have received a copy of the GNU General Public License
00016 #  along with this program; if not, write to the Free Software
00017 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 #
00019 
00020 from zope.interface import Interface
00021 from zope.interface import Attribute
00022 from zope.app.container.interfaces import IOrderedContainer
00023 _marker = object()
00024 
00025 class IAutoSortSupport(Interface):
00026     """Interface for auto sorting
00027     """
00028 
00029     _default_sort_key = Attribute('Sort key, default: Title')
00030     _default_sort_reverse = Attribute('Reverse, default: False')
00031     _default_sort_folderish_first = Attribute('Sort folderish first, default: True')
00032     # auto sort flag is required to make tpValues happy
00033     _default_sort_auto = Attribute('Enable auto, default: True')
00034 
00035     def setDefaultSorting(key, reverse=_marker):
00036         """Set default sorting key and direction.
00037         """
00038 
00039     def getDefaultSorting():
00040         """Get default sorting key and direction.
00041 
00042         Return sort_on attribute, reverse
00043         sort_on attribute is either an attribute or method name
00044         """
00045 
00046     def setSortFolderishFirst(value):
00047         """Set the value for sorting folderish objects before ordinary items
00048         """
00049 
00050     def getSortFolderishFirst():
00051         """Get the value for sorting folderish objects before ordinary items
00052         """
00053 
00054     def setSortReverse(value):
00055         """Set reverse sort setting
00056         """
00057 
00058     def getSortReverse():
00059         """Get reverse sort setting
00060         """
00061 
00062     def setSortAuto(value):
00063        """Set auto sort setting
00064        """
00065 
00066     def getSortAuto():
00067         """Get auto sort setting
00068         """
00069 
00070 class IAutoOrderSupport(IAutoSortSupport, IOrderedContainer):
00071     """Interface for auto sorting and auto ordering
00072     """
00073 
00074     def autoOrderItems():
00075         """Auto order all containing items according to the settings
00076         """
00077 
00078     def moveObjectsByDelta(ids, delta, subset_ids=None, disable_auto_sort=True):
00079         """Move specified sub-objects by delta.
00080 
00081         Overwritten to disable auto sort
00082         """
00083 
00084     def manage_renameObject(id, new_id, REQUEST=None):
00085         """Rename a particular sub-object without changing its position.
00086 
00087         Overwritten to keep auto sort
00088         """
00089 
00090     def manage_afterAdd(item, container):
00091         """after add hook
00092 
00093         Overwritten to auto sort items
00094         """
00095