[gen] Minor improvements.
This commit is contained in:
parent
636def8d24
commit
9cccdebe24
|
@ -1422,4 +1422,16 @@ class ToolMixin(BaseMixin):
|
||||||
if version < self.ieMin:
|
if version < self.ieMin:
|
||||||
mapping = {'version': version, 'min': self.ieMin}
|
mapping = {'version': version, 'min': self.ieMin}
|
||||||
return self.translate('wrong_browser', mapping=mapping)
|
return self.translate('wrong_browser', mapping=mapping)
|
||||||
|
|
||||||
|
def executeAjaxAction(self, action, obj, field):
|
||||||
|
'''When PX "pxAjax" is called to get some chunk of XHTML via an Ajax
|
||||||
|
request, a server action can be executed before rendering the XHTML
|
||||||
|
chunk. This method executes this action.'''
|
||||||
|
if action.startswith(':'):
|
||||||
|
# The action corresponds to a method on Appy p_obj.
|
||||||
|
getattr(obj, action[1:])()
|
||||||
|
else:
|
||||||
|
# The action must be executed on p_field if present, on obj.o else.
|
||||||
|
if field: getattr(field, action)(obj.o)
|
||||||
|
else: getattr(obj.o, action)()
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -803,6 +803,7 @@ function askConfirm(actionType, action, msg, showComment) {
|
||||||
var confirmForm = document.getElementById('confirmActionForm');
|
var confirmForm = document.getElementById('confirmActionForm');
|
||||||
confirmForm.actionType.value = actionType;
|
confirmForm.actionType.value = actionType;
|
||||||
confirmForm.action.value = action;
|
confirmForm.action.value = action;
|
||||||
|
if (!msg) msg = action_confirm;
|
||||||
var commentArea = document.getElementById('commentArea');
|
var commentArea = document.getElementById('commentArea');
|
||||||
if (showComment) commentArea.style.display = 'block';
|
if (showComment) commentArea.style.display = 'block';
|
||||||
else commentArea.style.display = 'none';
|
else commentArea.style.display = 'none';
|
||||||
|
|
|
@ -505,13 +505,13 @@ class ToolWrapper(AbstractWrapper):
|
||||||
</x>
|
</x>
|
||||||
</p>
|
</p>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr valign="top">
|
||||||
<!-- Search description -->
|
<!-- Search description -->
|
||||||
<td if="uiSearch.translatedDescr">
|
<td if="uiSearch.translatedDescr">
|
||||||
<span class="discreet">:uiSearch.translatedDescr</span><br/>
|
<span class="discreet">:uiSearch.translatedDescr</span><br/>
|
||||||
</td>
|
</td>
|
||||||
<!-- (Top) navigation -->
|
<!-- (Top) navigation -->
|
||||||
<td align=":dright" width="25%"><x>:tool.pxNavigate</x></td>
|
<td align=":dright" width="150px"><x>:tool.pxNavigate</x></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class AbstractWrapper(object):
|
||||||
|
|
||||||
pxNavigationStrip = Px('''
|
pxNavigationStrip = Px('''
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr valign="top">
|
||||||
<!-- Breadcrumb -->
|
<!-- Breadcrumb -->
|
||||||
<td var="sup=zobj.getSupBreadCrumb();
|
<td var="sup=zobj.getSupBreadCrumb();
|
||||||
breadcrumb=zobj.getBreadCrumb(inPopup=inPopup);
|
breadcrumb=zobj.getBreadCrumb(inPopup=inPopup);
|
||||||
|
@ -65,7 +65,7 @@ class AbstractWrapper(object):
|
||||||
<x if="sub">::sub</x>
|
<x if="sub">::sub</x>
|
||||||
</td>
|
</td>
|
||||||
<!-- Object navigation -->
|
<!-- Object navigation -->
|
||||||
<td align=":dright">:obj.pxNavigateSiblings</td>
|
<td align=":dright" width="150px">:obj.pxNavigateSiblings</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<!-- Object phases and pages -->
|
<!-- Object phases and pages -->
|
||||||
|
@ -631,8 +631,7 @@ class AbstractWrapper(object):
|
||||||
req=ztool.REQUEST; resp=req.RESPONSE;
|
req=ztool.REQUEST; resp=req.RESPONSE;
|
||||||
dummy=setattr(req, 'pxContext', _ctx_);
|
dummy=setattr(req, 'pxContext', _ctx_);
|
||||||
lang=ztool.getUserLanguage(); q=ztool.quote;
|
lang=ztool.getUserLanguage(); q=ztool.quote;
|
||||||
action=req.get('action', None);
|
action=req.get('action', '');
|
||||||
actionObj=(action and action.startswith(':')) and obj or zobj;
|
|
||||||
px=req['px'].split(':');
|
px=req['px'].split(':');
|
||||||
inPopup=req.get('popup') == '1';
|
inPopup=req.get('popup') == '1';
|
||||||
className=(len(px) == 3) and px[0] or None;
|
className=(len(px) == 3) and px[0] or None;
|
||||||
|
@ -647,8 +646,7 @@ class AbstractWrapper(object):
|
||||||
x=resp.setHeader('CacheControl', 'no-cache')">
|
x=resp.setHeader('CacheControl', 'no-cache')">
|
||||||
|
|
||||||
<!-- If an action is defined, execute it on p_zobj or on p_field. -->
|
<!-- If an action is defined, execute it on p_zobj or on p_field. -->
|
||||||
<x if="action and not field" var2="x=getattr(actionObj, action)()"></x>
|
<x if="action" var2="x=ztool.executeAjaxAction(action, obj, field)"></x>
|
||||||
<x if="action and field" var2="x=getattr(field, action)(actionObj)"></x>
|
|
||||||
|
|
||||||
<!-- Then, call the PX on p_obj or on p_field. -->
|
<!-- Then, call the PX on p_obj or on p_field. -->
|
||||||
<x if="not field">:getattr(obj, px[0])</x>
|
<x if="not field">:getattr(obj, px[0])</x>
|
||||||
|
@ -1134,4 +1132,6 @@ class AbstractWrapper(object):
|
||||||
localRoles = PersistentMapping({ self.o.creator: ['Owner'] })
|
localRoles = PersistentMapping({ self.o.creator: ['Owner'] })
|
||||||
self.o.__ac_local_roles__ = localRoles
|
self.o.__ac_local_roles__ = localRoles
|
||||||
return localRoles
|
return localRoles
|
||||||
|
|
||||||
|
def raiseUnauthorized(self, msg=None): return self.o.raiseUnauthorized(msg)
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue