[gen] Field.indexed, instead of being a Boolean, can be a str, to represent the name of a Zope Index. This way, it is possible to bypass the standard Appy choice for index types, ie for Computed fields whose content may produce any type of value; added missing translation labels in the macro displaying object's history; added default fields Tool.dateFormat and Tool.hourFormat that give application-wide default formats for dates with/without hour; added a table in Config->Users that shows the connected users and the date/time of their last access to the app; added the missing search macro for a Computed field.
This commit is contained in:
parent
21ffa7b46d
commit
699cc8346b
8 changed files with 95 additions and 21 deletions
|
@ -1,8 +1,9 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
import os.path
|
||||
import os.path, time
|
||||
import appy
|
||||
from appy.shared.utils import executeCommand
|
||||
from appy.gen.wrappers import AbstractWrapper
|
||||
from appy.gen.installer import loggedUsers
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
_PY = 'Please specify a file corresponding to a Python interpreter ' \
|
||||
|
@ -38,6 +39,20 @@ class ToolWrapper(AbstractWrapper):
|
|||
'''Some pages on the tool can only be accessed by God, also in edit.'''
|
||||
if self.user.has_role('Manager'): return True
|
||||
|
||||
def computeConnectedUsers(self):
|
||||
'''Computes a table showing users that are currently connected.'''
|
||||
res = '<table cellpadding="0" cellspacing="0" class="list"><tr>' \
|
||||
'<th></th><th>%s</th></tr>' % self.translate('last_user_access')
|
||||
rows = []
|
||||
for userId, lastAccess in loggedUsers.items():
|
||||
user = self.search1('User', noSecurity=True, login=userId)
|
||||
if not user: continue # Could have been deleted in the meanwhile
|
||||
fmt = '%s (%s)' % (self.dateFormat, self.hourFormat)
|
||||
access = time.strftime(fmt, time.localtime(lastAccess))
|
||||
rows.append('<tr><td><a href="%s">%s</a></td><td>%s</td></tr>' % \
|
||||
(user.o.absolute_url(), user.title,access))
|
||||
return res + '\n'.join(rows) + '</table>'
|
||||
|
||||
podOutputFormats = ('odt', 'pdf', 'doc', 'rtf')
|
||||
def getPodOutputFormats(self):
|
||||
'''Gets the available output formats for POD documents.'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue