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)
|
res = self.callMethod(obj, self.show)
|
||||||
else:
|
else:
|
||||||
res = self.show
|
res = self.show
|
||||||
# Take into account possible values 'view', 'edit', 'search'...
|
# Take into account possible values 'view', 'edit', 'result'...
|
||||||
if res in ('view', 'edit', 'result'): return res == layoutType
|
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)
|
return bool(res)
|
||||||
|
|
||||||
def isClientVisible(self, obj):
|
def isClientVisible(self, obj):
|
||||||
|
@ -1693,7 +1698,14 @@ class Ref(Type):
|
||||||
back.isBack = True
|
back.isBack = True
|
||||||
back.back = self
|
back.back = self
|
||||||
back.backd = self.__dict__
|
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
|
# When displaying a tabular list of referenced objects, must we show
|
||||||
# the table headers?
|
# the table headers?
|
||||||
self.showHeaders = showHeaders
|
self.showHeaders = showHeaders
|
||||||
|
|
|
@ -848,6 +848,10 @@ class ToolMixin(BaseMixin):
|
||||||
cookieValue = urllib.quote(cookieValue)
|
cookieValue = urllib.quote(cookieValue)
|
||||||
self.REQUEST.RESPONSE.setCookie('__ac', cookieValue, path='/')
|
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):
|
def performLogin(self):
|
||||||
'''Logs the user in.'''
|
'''Logs the user in.'''
|
||||||
rq = self.REQUEST
|
rq = self.REQUEST
|
||||||
|
|
|
@ -189,8 +189,8 @@ toolFieldPrefixes = ('defaultValue', 'podTemplate', 'formats', 'resultColumns',
|
||||||
'enableAdvancedSearch', 'numberOfSearchColumns',
|
'enableAdvancedSearch', 'numberOfSearchColumns',
|
||||||
'searchFields', 'optionalFields', 'showWorkflow',
|
'searchFields', 'optionalFields', 'showWorkflow',
|
||||||
'showWorkflowCommentField', 'showAllStatesInPhase')
|
'showWorkflowCommentField', 'showAllStatesInPhase')
|
||||||
defaultToolFields = ('users', 'groups', 'translations', 'enableNotifications',
|
defaultToolFields = ('title', 'users', 'groups', 'translations',
|
||||||
'unoEnabledPython', 'openOfficePort',
|
'enableNotifications', 'unoEnabledPython','openOfficePort',
|
||||||
'numberOfResultsPerPage', 'listBoxesMaximumWidth',
|
'numberOfResultsPerPage', 'listBoxesMaximumWidth',
|
||||||
'appyVersion', 'refreshSecurity')
|
'appyVersion', 'refreshSecurity')
|
||||||
|
|
||||||
|
@ -199,12 +199,13 @@ class Tool(ModelClass):
|
||||||
_appy_attributes = list(defaultToolFields)
|
_appy_attributes = list(defaultToolFields)
|
||||||
|
|
||||||
# Tool attributes
|
# Tool attributes
|
||||||
|
title = gen.String(show=False, page=gen.Page('main', show=False))
|
||||||
def validPythonWithUno(self, value): pass # Real method in the wrapper
|
def validPythonWithUno(self, value): pass # Real method in the wrapper
|
||||||
unoEnabledPython = gen.String(group="connectionToOpenOffice",
|
unoEnabledPython = gen.String(group="connectionToOpenOffice",
|
||||||
validator=validPythonWithUno)
|
validator=validPythonWithUno)
|
||||||
openOfficePort = gen.Integer(default=2002, group="connectionToOpenOffice")
|
openOfficePort = gen.Integer(default=2002, group="connectionToOpenOffice")
|
||||||
numberOfResultsPerPage = gen.Integer(default=30, show=False)
|
numberOfResultsPerPage = gen.Integer(default=30)
|
||||||
listBoxesMaximumWidth = gen.Integer(default=100, show=False)
|
listBoxesMaximumWidth = gen.Integer(default=100)
|
||||||
appyVersion = gen.String(show=False, layouts='f')
|
appyVersion = gen.String(show=False, layouts='f')
|
||||||
def refreshSecurity(self): pass # Real method in the wrapper
|
def refreshSecurity(self): pass # Real method in the wrapper
|
||||||
refreshSecurity = gen.Action(action=refreshSecurity, confirm=True)
|
refreshSecurity = gen.Action(action=refreshSecurity, confirm=True)
|
||||||
|
|
|
@ -185,6 +185,7 @@
|
||||||
hasHistory contextObj/hasHistory;
|
hasHistory contextObj/hasHistory;
|
||||||
historyMaxPerPage options/maxPerPage|python: 5;
|
historyMaxPerPage options/maxPerPage|python: 5;
|
||||||
historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded';
|
historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded';
|
||||||
|
_ python: tool.translate;
|
||||||
creator contextObj/Creator"
|
creator contextObj/Creator"
|
||||||
tal:condition="not: contextObj/isTemporary">
|
tal:condition="not: contextObj/isTemporary">
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
<tal:field define="contextObj python:obj;
|
<tal:field define="contextObj python:obj;
|
||||||
layoutType python:'cell';
|
layoutType python:'cell';
|
||||||
innerRef python:True"
|
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"/>
|
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
|
||||||
</tal:field>
|
</tal:field>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
</a>
|
</a>
|
||||||
<!-- Config -->
|
<!-- Config -->
|
||||||
<a tal:condition="python: user.has_role('Manager')"
|
<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)">
|
title python: _('%sTool' % appName)">
|
||||||
<img tal:attributes="src string:$appUrl/ui/appyConfig.gif"/>
|
<img tal:attributes="src string:$appUrl/ui/appyConfig.gif"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -26,17 +26,17 @@
|
||||||
<tal:comment replace="nothing">Search macro for an Boolean.</tal:comment>
|
<tal:comment replace="nothing">Search macro for an Boolean.</tal:comment>
|
||||||
<metal:search define-macro="search"
|
<metal:search define-macro="search"
|
||||||
tal:define="typedWidget python:'%s*bool' % widgetName">
|
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">
|
<tal:yes define="valueId python:'%s_yes' % name">
|
||||||
<input type="radio" value="True" tal:attributes="name typedWidget; id valueId"/>
|
<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:yes>
|
||||||
<tal:no define="valueId python:'%s_no' % name">
|
<tal:no define="valueId python:'%s_no' % name">
|
||||||
<input type="radio" value="False" tal:attributes="name typedWidget; id valueId"/>
|
<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:no>
|
||||||
<tal:whatever define="valueId python:'%s_whatever' % name">
|
<tal:whatever define="valueId python:'%s_whatever' % name">
|
||||||
<input type="radio" value="" tal:attributes="name typedWidget; id valueId" checked="checked"/>
|
<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/>
|
</tal:whatever><br/>
|
||||||
</metal:search>
|
</metal:search>
|
||||||
|
|
|
@ -87,9 +87,10 @@ class UserWrapper(AbstractWrapper):
|
||||||
# Update the password if the user has entered new ones.
|
# Update the password if the user has entered new ones.
|
||||||
rq = self.request
|
rq = self.request
|
||||||
if rq.has_key('password1'):
|
if rq.has_key('password1'):
|
||||||
zopeUser.__ = aclUsers._encryptPassword(rq['password1'])
|
tool = self.tool.o
|
||||||
|
zopeUser.__ = tool._encryptPassword(rq['password1'])
|
||||||
# Update the cookie value
|
# Update the cookie value
|
||||||
self.tool.o._updateCookie(login, rq['password1'])
|
tool._updateCookie(login, rq['password1'])
|
||||||
self.password1 = self.password2 = ''
|
self.password1 = self.password2 = ''
|
||||||
# "self" must be owned by its Zope user.
|
# "self" must be owned by its Zope user.
|
||||||
if 'Owner' not in self.o.get_local_roles_for_userid(login):
|
if 'Owner' not in self.o.get_local_roles_for_userid(login):
|
||||||
|
|
Loading…
Reference in a new issue