[CMF-checkins] CVS: CMF/CMFCore - TypesTool.py:1.55.2.4
Yvo Schubbe
schubbe@web.de
Sat, 28 Jun 2003 10:35:32 -0400
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv4984/CMFCore
Modified Files:
Tag: yuppie-ti_aliases-branch
TypesTool.py
Log Message:
- added Aliases tab to TypeInfos
- added 'mkdir' migration
=== CMF/CMFCore/TypesTool.py 1.55.2.3 => 1.55.2.4 ===
--- CMF/CMFCore/TypesTool.py:1.55.2.3 Wed Jun 25 05:28:38 2003
+++ CMF/CMFCore/TypesTool.py Sat Jun 28 10:35:01 2003
@@ -55,11 +55,12 @@
_isTypeInformation = 1
manage_options = ( SimpleItemWithProperties.manage_options[:1]
+ + ( {'label':'Aliases',
+ 'action':'manage_aliases'}, )
+ ActionProviderBase.manage_options
+ SimpleItemWithProperties.manage_options[1:]
)
-
security = ClassSecurityInfo()
security.declareProtected(ManagePortal, 'manage_editProperties')
@@ -153,6 +154,29 @@
else:
self.setMethodAliases(aliases)
+ #
+ # ZMI methods
+ #
+ security.declareProtected(ManagePortal, 'manage_aliases')
+ manage_aliases = PageTemplateFile( 'typeinfoAliases.zpt', _wwwdir )
+
+ security.declareProtected(ManagePortal, 'manage_setMethodAliases')
+ def manage_setMethodAliases(self, REQUEST):
+ """ Config method aliases.
+ """
+ form = REQUEST.form
+ aliases = {}
+ for k, v in form['aliases'].items():
+ v = v.strip()
+ if v:
+ aliases[k] = v
+
+ dict = {}
+ for k, v in form['methods'].items():
+ if aliases.has_key(k):
+ dict[ aliases[k] ] = v
+ self.setMethodAliases(dict)
+ REQUEST.RESPONSE.redirect('%s/manage_aliases' % self.absolute_url())
#
# Accessors
@@ -374,10 +398,17 @@
context = getActionContext(self)
actions = self.listActions()
ordered = []
- viewmethod = ''
+ dict = {}
+
+ # order actions and search 'mkdir' action
for action in actions:
if action.getId() == 'view':
ordered.insert(0, action)
+ elif action.getId() == 'mkdir':
+ mkdirmethod = action.action(context).strip()
+ if mkdirmethod.startswith('/'):
+ mkdirmethod = mkdirmethod[1:]
+ dict['mkdir'] = mkdirmethod
else:
ordered.append(action)
@@ -393,6 +424,7 @@
break
else:
viewmethod = '(Default)'
+ dict['view'] = viewmethod
# search default action
for action in ordered:
@@ -402,9 +434,9 @@
if not defmethod:
break
else:
- defmethod = viewmethod
+ dict['(Default)'] = viewmethod
- self.setMethodAliases( {'(Default)':defmethod, 'view':viewmethod} )
+ self.setMethodAliases(dict)
return 1
InitializeClass( TypeInformation )