Back to index

plone3  3.1.7
standard_mappings.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
00004 # 
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 # 
00012 ##############################################################################
00013 """ ActionIcons tool:  standard CMF mappings.
00014 
00015 This module makes available a "starter set" of action -> icon mappings.
00016 It will be installed by default when the tool is set up, unless an alternate
00017 set is provided.
00018 
00019 $Id: standard_mappings.py 36457 2004-08-12 15:07:44Z jens $
00020 """
00021 
00022 OBJECT_ACTIONS = \
00023 ( { 'category'              : 'object'
00024   , 'action_id'             : 'view'
00025   , 'title'                 : 'View'
00026   , 'priority'              : 0
00027   , 'icon_expr'             : 'view_icon.png'
00028   }
00029 , { 'category'              : 'object'
00030   , 'action_id'             : 'preview'
00031   , 'title'                 : 'Preview'
00032   , 'priority'              : 1
00033   , 'icon_expr'             : 'preview_icon.png'
00034   }
00035 , { 'category'              : 'object'
00036   , 'action_id'             : 'edit'
00037   , 'title'                 : 'Edit'
00038   , 'priority'              : 2
00039   , 'icon_expr'             : 'edit_icon.png'
00040   }
00041 , { 'category'              : 'object'
00042   , 'action_id'             : 'metadata'
00043   , 'title'                 : 'Metadata'
00044   , 'priority'              : 3
00045   , 'icon_expr'             : 'metadata_icon.png'
00046   }
00047 )
00048 
00049 FOLDER_ACTIONS = \
00050 ( { 'category'              : 'folder'
00051   , 'action_id'             : 'folderContents'
00052   , 'title'                 : 'Folder Contents'
00053   , 'priority'              : 0
00054   , 'icon_expr'             : 'folder_icon.png'
00055   }
00056 , { 'category'              : 'folder'
00057   , 'action_id'             : 'localroles'
00058   , 'title'                 : 'Local Roles'
00059   , 'priority'              : 1
00060   , 'icon_expr'             : 'user_icon.png'
00061   }
00062 , { 'category'              : 'folder'
00063   , 'action_id'             : 'syndication'
00064   , 'title'                 : 'Syndication'
00065   , 'priority'              : 2
00066   , 'icon_expr'             : 'syndication_icon.png'
00067   }
00068 )
00069 
00070 WORKFLOW_ACTIONS = \
00071 ( { 'category'              : 'workflow'
00072   , 'action_id'             : 'submit'
00073   , 'title'                 : 'Submit'
00074   , 'priority'              : 0
00075   , 'icon_expr'             : 'submit_icon.png'
00076   }
00077 , { 'category'              : 'workflow'
00078   , 'action_id'             : 'history'
00079   , 'title'                 : 'History'
00080   , 'priority'              : 1
00081   , 'icon_expr'             : 'history_icon.png'
00082   }
00083 , { 'category'              : 'workflow'
00084   , 'action_id'             : 'retract'
00085   , 'title'                 : 'Retract'
00086   , 'priority'              : 2
00087   , 'icon_expr'             : 'retract_icon.png'
00088   }
00089 , { 'category'              : 'workflow'
00090   , 'action_id'             : 'publish'
00091   , 'title'                 : 'Publish'
00092   , 'priority'              : 3
00093   , 'icon_expr'             : 'approve_icon.png'
00094   }
00095 , { 'category'              : 'workflow'
00096   , 'action_id'             : 'reject'
00097   , 'title'                 : 'Reject'
00098   , 'priority'              : 4
00099   , 'icon_expr'             : 'reject_icon.png'
00100   }
00101 , { 'category'              : 'workflow'
00102   , 'action_id'             : 'expire'
00103   , 'title'                 : 'Expire'
00104   , 'priority'              : 5
00105   , 'icon_expr'             : 'expire_icon.png'
00106   }
00107 , { 'category'              : 'workflow'
00108   , 'action_id'             : 'yank'
00109   , 'title'                 : 'Yank'
00110   , 'priority'              : 6
00111   , 'icon_expr'             : 'yank_icon.png'
00112   }
00113 )
00114 
00115 GLOBAL_ACTIONS = \
00116 ( { 'category'              : 'global'
00117   , 'action_id'             : 'undo'
00118   , 'title'                 : 'Undo'
00119   , 'priority'              : 0
00120   , 'icon_expr'             : 'undo_icon.png'
00121   }
00122 , { 'category'              : 'global'
00123   , 'action_id'             : 'configPortal'
00124   , 'title'                 : 'Policies'
00125   , 'priority'              : 1
00126   , 'icon_expr'             : 'policies_icon.png'
00127   }
00128 , { 'category'              : 'global'
00129   , 'action_id'             : 'worklist'
00130   , 'title'                 : 'Worklist'
00131   , 'priority'              : 2
00132   , 'icon_expr'             : 'worklist_icon.png'
00133   }
00134 )
00135 
00136 DEFAULT_MAPPINGS = ( OBJECT_ACTIONS
00137                    + FOLDER_ACTIONS
00138                    + WORKFLOW_ACTIONS
00139                    + GLOBAL_ACTIONS
00140                    )
00141 
00142 def installActionIconMappings( tool, mappings=DEFAULT_MAPPINGS, clear_first=1 ):
00143 
00144     """ Add the specified mappings to the tool.
00145 
00146     o If 'clear_first', then zap existing mappings first.
00147     """
00148     if clear_first:
00149         tool.clearActionIcons()
00150 
00151     for mapping in mappings:
00152         tool.addActionIcon( category=mapping[ 'category' ]
00153                           , action_id=mapping[ 'action_id' ]
00154                           , icon_expr=mapping[ 'icon_expr' ]
00155                           , title=mapping[ 'title' ]
00156                           , priority=mapping[ 'priority' ]
00157                           )