appy.pod: bugfix while including a PDF file into a document; ease the inclusion of Plone images from a Plone/Zope DB through 'do text from document' statements; appy.gen: added obj.mayAct method that allows to display conditionnally the column 'Actions' when an object is shown in a list (query or ref); improved navigation from sub-objects to parent objects; improved layout.

This commit is contained in:
Gaetan Delannay 2012-02-23 15:58:06 +01:00
parent 9c5f92337b
commit 13f3400577
9 changed files with 90 additions and 62 deletions

View file

@ -923,6 +923,15 @@ class BaseMixin:
if hasattr(appyObj, 'mayNavigate'): return appyObj.mayNavigate()
return True
def mayAct(self):
'''May the currently logged user see column "actions" for this
object? This can be used for hiding the "edit" icon, for example:
when a user may edit only a restricted set of fields on an object,
we may avoid showing him the global "edit" icon.'''
appyObj = self.appy()
if hasattr(appyObj, 'mayAct'): return appyObj.mayAct()
return True
def mayDelete(self):
'''May the currently logged user delete this object? This condition
comes as an addition/refinement to the corresponding workflow
@ -1291,6 +1300,13 @@ class BaseMixin:
'''Returns a reference to the config module.'''
return self.__class__.config
def getParent(self):
'''If this object is stored within another one, this method returns it.
Else (if the object is stored directly within the tool or the root
data folder) it returns None.'''
parent = self.getParentNode()
if parent.meta_type != 'Folder': return parent
def index_html(self):
'''Redirects to /ui.'''
return self.REQUEST.RESPONSE.redirect(self.getUrl())