appy.gen: allow to define several layoutTypes (ie: ('edit', 'result')) as a tuple/list in 'show' attributes of fields.
This commit is contained in:
parent
431511026c
commit
7b0b7e147d
|
@ -571,8 +571,13 @@ class Type:
|
|||
res = self.callMethod(obj, self.show)
|
||||
else:
|
||||
res = self.show
|
||||
# Take into account possible values 'view', 'edit', 'search'...
|
||||
if res in ('view', 'edit', 'result'): return res == layoutType
|
||||
# Take into account possible values 'view', 'edit', 'result'...
|
||||
if type(res) in sequenceTypes:
|
||||
for r in res:
|
||||
if r == layoutType: return True
|
||||
return False
|
||||
elif res in ('view', 'edit', 'result'):
|
||||
return res == layoutType
|
||||
return bool(res)
|
||||
|
||||
def isClientVisible(self, obj):
|
||||
|
@ -1693,7 +1698,14 @@ class Ref(Type):
|
|||
back.isBack = True
|
||||
back.back = self
|
||||
back.backd = self.__dict__
|
||||
setattr(klass, back.attribute, back)
|
||||
# klass may be None in the case we are defining an auto-Ref to the
|
||||
# same class as the class where this field is defined. In this case,
|
||||
# when defining the field within the class, write
|
||||
# myField = Ref(None, ...)
|
||||
# and, at the end of the class definition (name it K), write:
|
||||
# K.myField.klass = K
|
||||
# setattr(K, K.myField.back.attribute, K.myField.back)
|
||||
if klass: setattr(klass, back.attribute, back)
|
||||
# When displaying a tabular list of referenced objects, must we show
|
||||
# the table headers?
|
||||
self.showHeaders = showHeaders
|
||||
|
|
|
@ -848,6 +848,10 @@ class ToolMixin(BaseMixin):
|
|||
cookieValue = urllib.quote(cookieValue)
|
||||
self.REQUEST.RESPONSE.setCookie('__ac', cookieValue, path='/')
|
||||
|
||||
def _encryptPassword(self, password):
|
||||
'''Returns the encrypted version of clear p_password.'''
|
||||
return self.acl_users._encryptPassword(password)
|
||||
|
||||
def performLogin(self):
|
||||
'''Logs the user in.'''
|
||||
rq = self.REQUEST
|
||||
|
|
|
@ -189,8 +189,8 @@ toolFieldPrefixes = ('defaultValue', 'podTemplate', 'formats', 'resultColumns',
|
|||
'enableAdvancedSearch', 'numberOfSearchColumns',
|
||||
'searchFields', 'optionalFields', 'showWorkflow',
|
||||
'showWorkflowCommentField', 'showAllStatesInPhase')
|
||||
defaultToolFields = ('users', 'groups', 'translations', 'enableNotifications',
|
||||
'unoEnabledPython', 'openOfficePort',
|
||||
defaultToolFields = ('title', 'users', 'groups', 'translations',
|
||||
'enableNotifications', 'unoEnabledPython','openOfficePort',
|
||||
'numberOfResultsPerPage', 'listBoxesMaximumWidth',
|
||||
'appyVersion', 'refreshSecurity')
|
||||
|
||||
|
@ -199,12 +199,13 @@ class Tool(ModelClass):
|
|||
_appy_attributes = list(defaultToolFields)
|
||||
|
||||
# Tool attributes
|
||||
title = gen.String(show=False, page=gen.Page('main', show=False))
|
||||
def validPythonWithUno(self, value): pass # Real method in the wrapper
|
||||
unoEnabledPython = gen.String(group="connectionToOpenOffice",
|
||||
validator=validPythonWithUno)
|
||||
openOfficePort = gen.Integer(default=2002, group="connectionToOpenOffice")
|
||||
numberOfResultsPerPage = gen.Integer(default=30, show=False)
|
||||
listBoxesMaximumWidth = gen.Integer(default=100, show=False)
|
||||
numberOfResultsPerPage = gen.Integer(default=30)
|
||||
listBoxesMaximumWidth = gen.Integer(default=100)
|
||||
appyVersion = gen.String(show=False, layouts='f')
|
||||
def refreshSecurity(self): pass # Real method in the wrapper
|
||||
refreshSecurity = gen.Action(action=refreshSecurity, confirm=True)
|
||||
|
|
|
@ -185,6 +185,7 @@
|
|||
hasHistory contextObj/hasHistory;
|
||||
historyMaxPerPage options/maxPerPage|python: 5;
|
||||
historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded';
|
||||
_ python: tool.translate;
|
||||
creator contextObj/Creator"
|
||||
tal:condition="not: contextObj/isTemporary">
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
<tal:field define="contextObj python:obj;
|
||||
layoutType python:'cell';
|
||||
innerRef python:True"
|
||||
condition="python: contextObj.showField(widget['name'], 'view')">
|
||||
condition="python: contextObj.showField(widget['name'], 'result')">
|
||||
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
|
||||
</tal:field>
|
||||
</td>
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
</a>
|
||||
<!-- Config -->
|
||||
<a tal:condition="python: user.has_role('Manager')"
|
||||
tal:attributes="href python: tool.getUrl(page='main', nav='');
|
||||
tal:attributes="href python: tool.getUrl(nav='');
|
||||
title python: _('%sTool' % appName)">
|
||||
<img tal:attributes="src string:$appUrl/ui/appyConfig.gif"/>
|
||||
</a>
|
||||
|
|
|
@ -26,17 +26,17 @@
|
|||
<tal:comment replace="nothing">Search macro for an Boolean.</tal:comment>
|
||||
<metal:search define-macro="search"
|
||||
tal:define="typedWidget python:'%s*bool' % widgetName">
|
||||
<label tal:attributes="for widgetName" tal:content="python: tool.translate(widget['labelId'])"></label><br>
|
||||
<label tal:attributes="for widgetName" tal:content="python: _(widget['labelId'])"></label><br>
|
||||
<tal:yes define="valueId python:'%s_yes' % name">
|
||||
<input type="radio" value="True" tal:attributes="name typedWidget; id valueId"/>
|
||||
<label tal:attributes="for valueId">Yes</label>
|
||||
<label tal:attributes="for valueId" tal:content="python: _('yes')"></label>
|
||||
</tal:yes>
|
||||
<tal:no define="valueId python:'%s_no' % name">
|
||||
<input type="radio" value="False" tal:attributes="name typedWidget; id valueId"/>
|
||||
<label tal:attributes="for valueId">No</label>
|
||||
<label tal:attributes="for valueId" tal:content="python: _('no')"></label>
|
||||
</tal:no>
|
||||
<tal:whatever define="valueId python:'%s_whatever' % name">
|
||||
<input type="radio" value="" tal:attributes="name typedWidget; id valueId" checked="checked"/>
|
||||
<label tal:attributes="for valueId" tal:content="python: tool.translate('whatever')"></label>
|
||||
<label tal:attributes="for valueId" tal:content="python: _('whatever')"></label>
|
||||
</tal:whatever><br/>
|
||||
</metal:search>
|
||||
|
|
|
@ -87,9 +87,10 @@ class UserWrapper(AbstractWrapper):
|
|||
# Update the password if the user has entered new ones.
|
||||
rq = self.request
|
||||
if rq.has_key('password1'):
|
||||
zopeUser.__ = aclUsers._encryptPassword(rq['password1'])
|
||||
tool = self.tool.o
|
||||
zopeUser.__ = tool._encryptPassword(rq['password1'])
|
||||
# Update the cookie value
|
||||
self.tool.o._updateCookie(login, rq['password1'])
|
||||
tool._updateCookie(login, rq['password1'])
|
||||
self.password1 = self.password2 = ''
|
||||
# "self" must be owned by its Zope user.
|
||||
if 'Owner' not in self.o.get_local_roles_for_userid(login):
|
||||
|
|
Loading…
Reference in a new issue