[gen] Ref.select can now hold a Search instance; began implementation of Ref.link == 'popup'.
This commit is contained in:
parent
a466513fb3
commit
b2a2aa5210
7 changed files with 102 additions and 37 deletions
|
@ -431,9 +431,9 @@ class ToolWrapper(AbstractWrapper):
|
|||
batchSize=queryResult.batchSize;
|
||||
batchNumber=len(zobjects);
|
||||
ajaxHookId='queryResult';
|
||||
navBaseCall='askQueryResult(%s,%s,%s,%s,**v**)' % \
|
||||
navBaseCall='askQueryResult(%s,%s,%s,%s,%s,**v**)' % \
|
||||
(q(ajaxHookId), q(ztool.absolute_url()), q(className), \
|
||||
q(searchName));
|
||||
q(searchName),int(inPopup));
|
||||
showNewSearch=showNewSearch|True;
|
||||
enableLinks=enableLinks|True;
|
||||
newSearchUrl='%s/search?className=%s%s' % \
|
||||
|
@ -446,7 +446,7 @@ class ToolWrapper(AbstractWrapper):
|
|||
<!-- Display here POD templates if required. -->
|
||||
<table var="fields=ztool.getResultPodFields(className);
|
||||
layoutType='view'"
|
||||
if="zobjects and fields" align=":dright">
|
||||
if="not inPopup and zobjects and fields" align=":dright">
|
||||
<tr>
|
||||
<td var="zobj=zobjects[0]; obj=zobj.appy()"
|
||||
for="field in fields"
|
||||
|
@ -455,7 +455,7 @@ class ToolWrapper(AbstractWrapper):
|
|||
</table>
|
||||
|
||||
<!-- The title of the search -->
|
||||
<p>
|
||||
<p if="not inPopup">
|
||||
<x>::uiSearch.translated</x> (<span class="discreet">:totalNumber</span>)
|
||||
<x if="showNewSearch and (searchName == 'customSearch')"> —
|
||||
<i><a href=":newSearchUrl">:_('search_new')</a></i>
|
||||
|
|
|
@ -6,6 +6,7 @@ from appy.gen import utils as gutils
|
|||
# ------------------------------------------------------------------------------
|
||||
class UserWrapper(AbstractWrapper):
|
||||
workflow = WorkflowOwner
|
||||
specialUsers = ('system', 'anon', 'admin')
|
||||
|
||||
def showLogin(self):
|
||||
'''When must we show the login field?'''
|
||||
|
@ -42,7 +43,7 @@ class UserWrapper(AbstractWrapper):
|
|||
if not self.login or (login != self.login):
|
||||
# A new p_login is requested. Check if it is valid and free.
|
||||
# Some logins are not allowed.
|
||||
if login in ('admin', 'anon', 'system'):
|
||||
if login in self.specialUsers:
|
||||
return self.translate('login_reserved')
|
||||
# Check that no user or group already uses this login.
|
||||
if self.count('User', noSecurity=True, login=login) or \
|
||||
|
@ -219,7 +220,7 @@ class UserWrapper(AbstractWrapper):
|
|||
|
||||
def mayEdit(self):
|
||||
'''No one can edit users "system" and "anon".'''
|
||||
if self.o.id in ('system', 'anon'): return
|
||||
if self.o.id in ('anon', 'system'): return
|
||||
# Call custom "mayEdit" when present.
|
||||
custom = self._getCustomMethod('mayEdit')
|
||||
if custom: return self._callCustom('mayEdit')
|
||||
|
@ -227,7 +228,7 @@ class UserWrapper(AbstractWrapper):
|
|||
|
||||
def mayDelete(self):
|
||||
'''No one can delete users "system", "anon" and "admin".'''
|
||||
if self.o.id in ('system', 'anon', 'admin'): return
|
||||
if self.o.id in self.specialUsers: return
|
||||
# Call custom "mayDelete" when present.
|
||||
custom = self._getCustomMethod('mayDelete')
|
||||
if custom: return self._callCustom('mayDelete')
|
||||
|
|
|
@ -75,16 +75,16 @@ class AbstractWrapper(object):
|
|||
# The template PX for all pages.
|
||||
pxTemplate = Px('''
|
||||
<html var="ztool=tool.o; user=tool.user;
|
||||
obj=obj or ztool.getHomeObject();
|
||||
req=ztool.REQUEST; resp=req.RESPONSE;
|
||||
inPopup=req.get('popup') == '1';
|
||||
obj=obj or ztool.getHomeObject(inPopup);
|
||||
zobj=obj and obj.o or None;
|
||||
isAnon=user.login=='anon'; app=ztool.getApp();
|
||||
appFolder=app.data; url = ztool.getIncludeUrl;
|
||||
appName=ztool.getAppName(); _=ztool.translate;
|
||||
req=ztool.REQUEST; resp=req.RESPONSE;
|
||||
dummy=setattr(req, 'pxContext', _ctx_);
|
||||
lang=ztool.getUserLanguage(); q=ztool.quote;
|
||||
layoutType=ztool.getLayoutType();
|
||||
inPopup=req.get('popup') == '1';
|
||||
showPortlet=not inPopup and ztool.showPortlet(obj, layoutType);
|
||||
dir=ztool.getLanguageDirection(lang);
|
||||
cfg=ztool.getProductConfig(True);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue