assign var table value act- table capture name aname tname act- name c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{assign var=table value=$act->table}
{capture name=aname}{$tname}_{$act->name}{/capture}
function act_{$smarty.capture.aname}({$act->getParametersList()}){ldelim}
{if is_a($act,'ActionEditItem')}
{capture name=dname}dlg_{$smarty.capture.aname}{/capture}
{capture name=storename}store_{$tname}[id]{/capture}
{assign var=controls value=$table->getFormControlInits($smarty.capture.storename)}
{foreach from=$controls item=cont}{$cont->init}{/foreach}
var dlg=dijit.byId('{$smarty.capture.dname}');
dlg.setValues({ldelim}{foreach from=$controls key=cname item=cont}
{$cname}:{$cont->val|default:$cont},{/foreach}
id:id
{rdelim});
dlg.show();
{rdelim}
{capture name=dtitle}Edit {$tname}{/capture}
{include file='dojo/modules/table/editDlg.tpl' name=$smarty.capture.dname title=$smarty.capture.dtitle tname=$tname act=$act table=$table params=$params}
{elseif is_a($act,'ActionAddItem')}
{capture name=dname}dlg_{$smarty.capture.aname}{/capture}
{capture name=storename}store_{$tname}[0]{/capture}
{assign var=controls value=$table->getFormControlInits($smarty.capture.storename)}
{foreach from=$controls item=cont}{$cont->init}{/foreach}
var dlg=dijit.byId('{$smarty.capture.dname}');
dlg.setValues({ldelim}{foreach from=$controls key=cname item=cont}
{$cname}:{$cont->val|default:$cont},{/foreach}
id:0
{rdelim});
dlg.show();
{rdelim}
{capture name=dtitle}Add {$tname}{/capture}
{include file='dojo/modules/table/editDlg.tpl' name=$smarty.capture.dname title=$smarty.capture.dtitle tname=$tname act=$act table=$table params=$params}
{elseif is_a($act,'ActionDeleteItem')}
if(confirm('Sure to delete it?'))dojo.xhrPost({ldelim}
url:'{$act->getHandlerURL()}',
load:delOk,
handleAs:'json',
content:{ldelim}act:'del',table:'{$tname}',id:id{rdelim}
{rdelim});
{rdelim}
{literal}
function delOk(data){
//alert('Deleted '+data.table+' item: '+data);
//for(i in data.ids)dojo.query('#row'+data.ids[i],dojo.byId('tab'+data.table)).orphan();
document.location.reload();
}
{/literal}
{else}{rdelim}{/if}