tpl_4ef0a6fb_main__uHSezosaqdcH8ZAunZ7spw.php 4.45 KB
<?php 
function tpl_4ef0a6fb_main__uHSezosaqdcH8ZAunZ7spw($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 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="padding:5px;">
	  		<table border="0" style="border:0px;float:left">
	  		<tr>
	  			<td style="text-align:right;border:0px;">
	  				
	  			</td>
	  			<td width="100%"></td>
	  			<td style="text-align:right;border:0px;">
	  				
	  					<a style="color:#F8A720;font-size:14px;" onclick="table.edit()">Создать&nbsp;новый&nbsp;шаблон</a>
	  			</td>
	  		</tr>	
	  		</table>

	  	</td>
	</tr>
	<tr class="header">
	  <td width="1%"><img onclick="table.orderby_tid(this)" class="ASC"/></td>
	  <td width="15%">
		<img onclick="table.orderby_tname(this)" class="ASC"/>Название
	  </td>
	  <td width="10%">Описание</td>
	  <td width="1%">Блоки</td>
	  <td width="7%"></td>
	  </tr>
	
	<tbody id="table_content">
		<?php 
$ctx->pushSlots() ;
$tpl->_executeMacroOfTemplate('inc/tmpl_row.html/tmpl_row', $_thistpl) ;
$ctx->popSlots() ;
?>

	</tbody>
	</table>
</div>



<script>/*<![CDATA[*/
	/*	клиентская часть, отвечает за аякс	*/
table = {
	'server' :"<?php echo strtr(phptal_tostring($ctx->MAIN_URL) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>/?p_name=admin_tmpl",
	'orderby_key' : false,
	'orderby_value'   : false,
	
}
table.lock = function(){
	wnd.set_title('');
	wnd.set_content('<?php echo strtr(phptal_tostring($ctx->WAIT) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>');
	wnd.show();
}
table.unlock = function(){
	wnd.close();
}
	//	сортируем по имени страницы
table.orderby_tname = function(img){
	if ( img.className == 'ASC' ){
		img.className='DESC';
	}else{
		img.className='ASC';
	}
	table.orderby_value = img.className
	table.orderby_key = 'orderby_tname';
	table.reload();
}

	//	сортируем по номеру страницы
table.orderby_tid = function(img){
	if ( img.className == 'ASC' ){
		img.className='DESC';
	}else{
		img.className='ASC';
	}
	table.orderby_value = img.className
	table.orderby_key = 'orderby_tid';
	table.reload();
}


	//	удаляем  шаблон
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} )
	
}


	//	форма редактирования  шаблона fid
table.clone = function(fid){
	wnd.open(table.server+'&act=ajax_clone_form&id='+fid);	
}

	//	функция сохранения изменений формы
table.clone_save = function(){

	r = new request(  table.server+'&act=ajax_clone_save' );
	r.onload = function(rst){
	  if ( rst.msg ){
	  o.msg.system(rst.msg);
	  }
		table.reload();
		wnd.close();
	}
	r.error = function(e){
	   o.msg.error(e)
	}
	r.form( o.$('form_clone') );
}

table.editor = function(){
	editor.create('t_content');
}

	//	форма редактирования  шаблона fid
table.edit = function(fid){
  wnd.onload = function(){table.editor()};
	wnd.open(table.server+'&act=ajax_edit&id='+fid);	
}
	//	функция сохранения изменений формы
table.save_page = function(){

	r = new request(  table.server+'&act=ajax_update' );
	r.onload = function(rst){
	  o.msg.system(rst.msg);
		//o.$('error_page').innerHTML = rst.msg
		table.reload();
		//wnd.close()
	}
	r.error = function(e){
	    	o.msg.error(e)
		//o.$('error_page').innerHTML =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});	
	
}
/*]]>*/</script>
<div><?php echo phptal_tostring($ctx->editor); ?>
</div><?php 
/* end */ ;

}

?><?php /* 
*** DO NOT EDIT THIS FILE ***

Generated by PHPTAL from /home/shasha/www/pr25_autocatalog/source/modules/admin/tmpl/control_tmpl/main.html (edit that file instead) */; ?>