mò .á¸Ec@sÏdZdklZdkZdklZdklZdklZdk l Z dk l Z dk lZd klZd klZd klZd klZd klZd efd„ƒYZeeƒdS(s] Order support for 'Object Manager'. $Id: OrderSupport.py 40409 2005-11-29 15:43:35Z efge $ (s StringTypeN(sClassSecurityInfo(saccess_contents_information(smanage_properties(saq_base(ssort(sInitializeClass(s implements(snotifyContainerModified(sIOrderedContainer(s ObjectManagert OrderSupportcBstZdZeZeeƒeƒZdZ dZ dZ hdd<dd<dd+ Move specified sub-objects up by delta in container. s%d item%s moved up.itsts Error: %ssError: No items were specified!tskeyRtmanage_tabs_messaget update_menuN( tidstselft moveObjectsUptdeltatattempttmessaget ValueErrorterrmsgRtREQUEST(RRRRRRR((t//data/zmath/zope/lib/python/OFS/OrderSupport.pyR?s(tmanage_move_objects_downc Cs|o`y:|i||ƒ}d||djodpdf}Wqmtj o}d|}qmXnd}|i||ddd |d dƒS( s@ Move specified sub-objects down by delta in container. s%d item%s moved down.iR R s Error: %ssError: No items were specified!R RR R N( RRtmoveObjectsDownRRRRRRR(RRRRRRR((RROs(tmanage_move_objects_to_topc CsŒ|o]y7|i|ƒ}d||djodpdf}Wqjtj o}d|}qjXnd}|i||ddd |d dƒS( s9 Move specified sub-objects to top of container. s%d item%s moved to top.iR R s Error: %ssError: No items were specified!R RR R N( RRtmoveObjectsToTopRRRRRR(RRRRRR((RR_s(tmanage_move_objects_to_bottomc CsŒ|o]y7|i|ƒ}d||djodpdf}Wqjtj o}d|}qjXnd}|i||ddd |d dƒS( s< Move specified sub-objects to bottom of container. s%d item%s moved to bottom.iR R s Error: %ssError: No items were specified!R RR R N( RRtmoveObjectsToBottomRRRRRR(RRRRRR((RRos(tmanage_set_default_sortingcCs&|i||ƒ|i||ddƒS(s0 Set default sorting key and direction. R iN(RtsetDefaultSortingtkeytreverseRR(RRR R!((RRstmoveObjectsByDeltacCs9t|ƒtjo |f}nd} t|iƒ}|djo)g} |D]} | | dqM~ }n t|ƒ}|djo$t|ƒ}|i ƒ|i ƒnd} x‰|D]}|i|ƒ}t|t|ƒ| ƒ}|| jo| d7} n||jp+|i|ƒ|i||ƒ| d7} qµqµW| djoÙ|djo|i ƒnh}x|D]} | || d Move specified sub-objects up by delta in container. N(RR"RRR*(RRRR*((RR¿sRcCs|i|||ƒS(s@ Move specified sub-objects down by delta in container. N(RR"RRR*(RRRR*((RRÅsRcCs|i|t|iƒ |ƒS(s9 Move specified sub-objects to top of container. N(RR"RR9R(R*(RRR*((RRËsRcCs|i|t|iƒ|ƒS(s< Move specified sub-objects to bottom of container. N(RR"RR9R(R*(RRR*((RRÑst orderObjectscCsqg}t|iƒ|ddffƒD]\}}||q&~}|o|iƒn|i |t |i ƒ ƒS(s1 Order sub-objects by key and direction. tcmptascN( R,tsortRt objectItemsR R#R-RR!R"R9R((RR R!R-RR,R#((RR?×s /tgetObjectPositioncCs>|iƒ}||jo|i|ƒSntd|ƒ‚dS(s2 Get the position of an object by its id. s+The object with the id "%s" does not exist.N(Rt objectIdsRR#R/R(RR#R((RRDâs   tmoveObjectToPositioncCs)||i|ƒ}|i||d|ƒS(s5 Move specified object to absolute position. R=N(RRRDR#RR"R=(RR#RR=R((RRFës tgetDefaultSortingcCs|i|ifS(s0 Get default sorting key and direction. N(Rt_default_sort_keyt_default_sort_reverse(R((RRGósRcCs$||_|odpd|_dS(s0 Set default sorting key and direction. iiN(R RRHR!RI(RR R!((RRùs cCs‹|i|ƒ}tt|ƒi|||ƒ}y|i ||dt ƒWn=t j o1|i ||ƒt id|iitƒnX|S(sG Rename a particular sub-object without changing its position. R=s_%s.moveObjectToPosition without suppress_events is deprecated and will be removed in Zope 2.11.N(RRDR#R0tsuperRtmanage_renameObjecttnew_idRtresultRFtTruet TypeErrortwarningstwarnt __class__t__name__tDeprecationWarning(RR#RLRR0RM((RRKs   cCs g}tt|ƒdƒoŒ|i}yt|ƒ}Wntj onXt|dƒo|iƒnx°|D]0}t||ƒo|i |i |ƒƒqpqpWnug}|i ƒD]$}t|dtƒo ||q¹q¹~}t||iddffƒ}|io|iƒn|S(Nttree_idsRBtisPrincipiaFolderishR@RA(trthasattrtaq_baseRRUR'RORBR#tappendt_getObR,t objectValuesR-tgetattrtFalseRHRIR!(RR-RUR,RWR#((RttpValuess$ "> (RsOrderSupport_Contents.stx(#RSt __module__t__doc__tz2IOrderedContainert__implements__t implementstz3IOrderedContainertClassSecurityInfotsecuritythas_order_supportRHRItmanage_optionstdeclareProtectedtmanage_propertiesR+RRRRRR^R"RRRRR?taccess_contents_informationRDRFRGRRKR_(((RR"sR   $    3       (RattypesR%RPt AccessControlRftAccessControl.PermissionsRlRkt AcquisitionRYtDocumentTemplate.sequenceRBtGlobalstInitializeClasstzope.interfaceRdtzope.app.container.containedR>t interfacestIOrderedContainerRet IOrderSupportRbt ObjectManagertobjectR(RBR%RYRyRPReRRfRsRbR>RdRlRk((Rt?s              ÿ