tpl_4ef0a6fb_blocks__r8oJeNvfRw9lHArCyB6RGQ.php
5.36 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
function tpl_4ef0a6fb_blocks__r8oJeNvfRw9lHArCyB6RGQ($tpl, $ctx) {
$_thistpl = $tpl ;
$_translator = $tpl->getTranslator() ;
?>
<ul class="top_nav">
<li><a href="/">Сайт</a></li>
<li><a href="/?p_name=admin_main">Админка</a></li>
<li><a href="/?p_name=admin_tmpl">Шаблоны</a></li>
<li class="current">Блоки отображаемые на странице</li>
</ul>
<div style="padding:10px;padding-top:0px;">
<form id="blocks_form" method="post" enctype="multipart/form-data" onsubmit="return false">
<table class="data" width="100%" align="left">
<tr class="header">
<td width="2%"><img onclick="table.orderby_id(this)" class="ASC"/>№</td>
<td width="15%"><img onclick="table.orderby_name(this)" class="ASC"/>Название</td>
<td width="5%">Область</td>
<td width="5%"><img onclick="table.orderby_parser_name(this)" class="ASC"/>Переменная</td>
<td width="4%"><img onclick="table.orderby_sort(this)" class="ASC"/>Порядок</td>
<td width="3%" colspan="2">Действие</td>
</tr>
<tr>
<td colspan="7" style="padding:5px;text-align:right;">
<strong>
<a style="color:#F8A720;font-size:14px;" onclick="table.add_to_page()">Добавить новый блок</a>
</strong>
</td>
</tr>
<tbody id="table_content">
<?php
$ctx->pushSlots() ;
$tpl->_executeMacroOfTemplate('inc/block_row.html/block_row', $_thistpl) ;
$ctx->popSlots() ;
?>
</tbody>
<tr>
<td colspan="7" style="padding:5px;text-align:right;" class="form">
<input type="button" value="Сортировать" onclick="table.order()"/>
</td>
</tr>
</table>
</form>
</div>
<script>/*<![CDATA[*/
/* клиентская часть, отвечает за аякс */
table = {
'server' :"<?php echo strtr(phptal_tostring($ctx->MAIN_URL) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>/?p_name=admin_tmpl",
'fid':<?php echo strtr(phptal_tostring($ctx->fid) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>,
'orderby_key' : false,
'orderby_value' : false,
}
table.lock = function(){
wnd.onload = false;
wnd.set_title('');
wnd.set_content('<?php echo strtr(phptal_tostring($ctx->WAIT) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>');
wnd.show();
}
table.unlock = function(){
wnd.close();
}
// сортируем по id связи блока со страницей
table.orderby_id = function(img){
if ( img.className == 'ASC' ){
img.className='DESC';
}else{
img.className='ASC';
}
table.orderby_value = img.className
table.orderby_key = 'orderby_id';
table.reload();
}
table.orderby_name = function(img){
if ( img.className == 'ASC' ){
img.className='DESC';
}else{
img.className='ASC';
}
table.orderby_value = img.className
table.orderby_key = 'orderby_name';
table.reload();
}
table.orderby_parser_name = function(img){
if ( img.className == 'ASC' ){
img.className='DESC';
}else{
img.className='ASC';
}
table.orderby_value = img.className
table.orderby_key = 'orderby_parser_name';
table.reload();
}
table.orderby_sort = function(img){
if ( img.className == 'ASC' ){
img.className='DESC';
}else{
img.className='ASC';
}
table.orderby_value = img.className
table.orderby_key = 'orderby_sort';
table.reload();
}
// форма добавления блока на страницу
table.add_to_page = function(fid){
wnd.open(table.server+'&act=ajax_blocks_to_page_form&id='+table.fid);
}
table.edit= function(fid){
wnd.open(table.server+'&act=ajax_blocks_edit&id='+fid);
}
// сохранение блока на странице
table.blocks_save = function(){
r = new request( table.server+'&act=ajax_blocks_save&id='+table.fid );
r.onload = function(rst){
table.reload();
wnd.close();
}
r.error = function(e){
alert(e);
//o.$('error').innerHTML =e;
}
r.form( o.$('edit_block') );
}
table.blocks_to_page_save = function(){
r = new request( table.server+'&act=ajax_blocks_to_page_save&id='+table.fid );
r.onload = function(rst){
table.reload();
wnd.close();
}
r.error = function(e){
o.$('error').innerHTML =e;
}
r.form( o.$('add_blocks_to_page') );
}
// удаление блока со страницы
table.del = function(id){
r = new request( table.server+'&act=ajax_blocks_to_page_del&id='+table.fid );
r.onrequest = function(){
table.lock();
};
r.onload = function(rst){
table.reload();
table.unlock();
};
r.error = function(e){
alert(e);
}
r.send( {'b_id':id} )
}
// сохранение сортировки для блоков на странице
table.order = function(){
r = new request( table.server+'&act=ajax_sort_blocks_to_page&id='+table.fid );
r.onload = function(rst){
table.reload();
}
r.error = function(e){
alert(e);
}
r.form( o.$('blocks_form') );
}
// перезагружаем таблицу страниц согласно соортировке и фильтрам
table.reload = function(){
r = new request( table.server+'&act=ajax_block_reload&id='+table.fid );
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} )
}
/*]]>*/</script><?php
/* end */ ;
}
?><?php /*
*** DO NOT EDIT THIS FILE ***
Generated by PHPTAL from /home/shasha/www/pr25_autocatalog/source/modules/admin/tmpl/control_tmpl/blocks.html (edit that file instead) */; ?>