main.html
3.44 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<ul class="top_nav">
<li><a href="/">${SITE}</a></li>
<li><a href="${URL_ADMIN}">${ADMIN_PAGE}</a></li>
<li class="current">Мета-информация</li>
</ul>
<div style="padding:10px;padding-top:0px;">
<table class="data" width="100%" align="left" id="table">
<tr>
<td colspan="8" style="text-align:right"><b><a style="color:#F8A720;font-size:14px;" onclick="table.create()">Добавить</a></b></td>
</tr>
<tr>
<td colspan="8" style="padding:5px;">
<div style="font-size:10px;padding-left:10px;">
<select style="width:150px"
id="filter_module" onchange="table.where_module(this)" tal:content="structure module_list" />
<b>Фильтровать по модулю</b>
</div>
</td>
</tr>
<tr class="header">
<td width="3%">№</td>
<td width="30%">Текст</td>
<td width="15%">Тип</td>
<td width="10%">Страница</td>
<td width="10%">Ключ</td>
<td width="10%">Язык</td>
<td width="7%"></td>
</tr>
<tbody id="table_content">
<tal:block metal:use-macro="inc/tmpl_row.html/tmpl_row">подключаем шаблон из файла inc/tmpl_row.html</tal:block>
</tbody>
</table>
</div>
<script>/*<![CDATA[*/
/* клиентская часть, отвечает за аякс */
table = {
'server' :"${URL_ADMIN_META}",
'orderby_key' : false,
'orderby_value' : false,
'filter_module' : false,
}
// фильтр по модулю
table.where_module = function(box){
table.filter_module = box.options[box.selectedIndex].value;
table.page = 1;
table.reload(true);
}
table.lock = function(){
wnd.set_title('');
wnd.set_content('${WAIT}');
wnd.show();
}
table.unlock = function(){
wnd.close();
}
table.del = function(mid){
r = new request( table.server+'&act=ajax_delete' );
r.onrequest = function(){
table.lock();
};
r.onload = function(rst){
table.reload();
table.unlock();
};
r.error = function(e){
alert(e);
}
r.send( {'id':mid} )
}
table.editor = function(){
editor.create('p_content');
}
// форма редактирования
table.edit = function(fid){
HL.window.onload = table.editor
HL.window.open(table.server+'&act=ajax_edit&id='+fid);
}
// форма добавления
table.create = function(){
table.edit(0) ;
}
// функция сохранения изменений формы
table.save = function(){
r = new request( table.server+'&act=ajax_save' );
r.onrequest = function(){
o.msg.system('Идёт сохранение...');
}
r.onload = function(rst){
o.$('save_b').disabled = false;
o.msg.hidden()
table.reload();
wnd.close();
}
r.error = function(e){
o.$('save_b').disabled = false;
o.msg.error(e)
}
r.form( o.$('form_page') );
}
// перезагружаем таблицу страниц согласно соортировке и фильтрам
table.reload = function(){
r = new request( table.server+'&act=ajax_reload' );
r.onload = function(rst){
o.$('table_content').innerHTML =rst.content;
};
r.error = function(e){
alert(e);
}
r.send({'orderby_key':table.orderby_key, 'orderby_value':table.orderby_value,'filter_module':table.filter_module});
}
// перезагружаем таблицу страниц согласно соортировке и фильтрам
table.lang = function(id,lang){
HL.window.onload = table.editor
HL.window.open( table.server+'&act=ajax_lang_edit&id='+id+'&lang='+lang );
}
/*]]>*/</script>