[gen] New ajax system: more bugfixes.

This commit is contained in:
Gaetan Delannay 2015-02-05 14:05:29 +01:00
parent d23b9be5e5
commit 40e3612682
7 changed files with 48 additions and 35 deletions

View file

@ -176,7 +176,7 @@ class Ref(Field):
<a target="appyIFrame"
var="tiedClassName=tiedClassName|ztool.getPortalType(field.klass);
className=ztool.getPortalType(obj.klass)"
href=":'%s/query?className=%s&amp;search=%s:%s:%s&amp;popup=1' % \
href=":'%s/query?className=%s&amp;search=%s*%s*%s&amp;popup=1' % \
(ztool.absolute_url(), tiedClassName, obj.uid, field.name, \
popupMode)">
<input type="button"
@ -287,13 +287,13 @@ class Ref(Field):
<!-- Loop on every (tied or selectable) object -->
<x for="tied in objects"
var2="@currentNumber=currentNumber + 1;
rowCss=loop.tied.odd and 'even' or 'odd'">:obj.pxViewAsTied</x>
rowCss=loop.tied.odd and 'even' or 'odd'">:tied.pxViewAsTied</x>
</table>
<!-- Global actions -->
<x if="mayEdit and checkboxes">:field.pxGlobalActions</x>
<!-- (Bottom) navigation -->
<x>:tool.pxNavigate</x>
<!-- Init checkboxes if present. -->
<!-- Init checkboxes if present -->
<script if="checkboxes">:'initCbs(%s)' % q(ajaxHookId)</script>
</div>''')
@ -437,8 +437,8 @@ class Ref(Field):
collapse=field.getCollapseInfo(obj, False);
showSubTitles=req.get('showSubTitles', 'true') == 'true'">
<!-- JS tables storing checkbox statuses if checkboxes are enabled -->
<script if="checkboxesEnabled and renderAll and (render == 'list')"
type="text/javascript">:field.getCbJsInit(zobj)</script>
<script if="checkboxesEnabled and renderAll \
and (render == 'list')">:field.getCbJsInit(zobj)</script>
<x if="linkList and renderAll and mayEdit"
var2="ajaxHookId='%s_%s_poss' % \
(zobj.id, field.name)">:field.pxViewPickList</x>
@ -1265,7 +1265,7 @@ class Ref(Field):
code = "\nnode['_appy_%%s_cbs']={};\nnode['_appy_%%s_sem']='%s';" % \
default
poss = (self.link == 'list') and (code % ('poss', 'poss')) or ''
return "var node=document.getElementById('%s_%s');%s%s" % \
return "var node=findNode(this, '%s_%s');%s%s" % \
(obj.id, self.name, code % ('objs', 'objs'), poss)
def getAjaxData(self, hook, zobj, **params):

View file

@ -202,8 +202,8 @@ class UiSearch:
<td colspan=":len(columns)+1">:_('query_no_result')</td>
</tr>
<x for="zobj in zobjects"
var2="@currentNumber=currentNumber + 1;
rowCss=loop.zobj.odd and 'even' or 'odd'">:obj.pxViewAsResult</x>
var2="rowCss=loop.zobj.odd and 'even' or 'odd';
@currentNumber=currentNumber + 1">:zobj.appy().pxViewAsResult</x>
</table>
<!-- The button for selecting objects and closing the popup -->
<div if="inPopup and cbShown" align=":dleft">
@ -241,7 +241,7 @@ class UiSearch:
<div var="ajaxHookId='queryResult';
className=req['className'];
searchName=req.get('search', '');
uiSearch=uiSearch|ztool.getSearch(className,searchName,ui=True);
uiSearch=field|ztool.getSearch(className, searchName, ui=True);
rootHookId=uiSearch.getRootHookId();
refInfo=ztool.getRefInfo();
refObject=refInfo[0];
@ -389,7 +389,7 @@ class UiSearch:
'''Returns the code that creates JS data structures for storing the
status of checkboxes for every result of this search.'''
default = self.search.checkboxesDefault and 'unchecked' or 'checked'
return '''var node=document.getElementById('%s');
return '''var node=findNode(this, '%s');
node['_appy_objs_cbs'] = {};
node['_appy_objs_sem'] = '%s';''' % (hookId, default)