main.html 4.88 KB


<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;">
	  		<div style="font-size:10px;padding-left:10px;float:left;margin-right:30px;">
	  			<select style="width:150px" 
	  				id="filter_module"  tal:content="structure active_modules_ul"   />
	  				&nbsp; 
	  				<b>Фильтровать по модулю</b>
	  		</div>	
		</td>
	</tr>
	
	<tr class="header">
	  <td width="1%"><img onclick="table.orderby_id(this)" class="ASC"  /></td>
	  <td width="15%">
		<img onclick="table.orderby_title(this)" class="ASC"   />Название
	  </td>
	  <td width="10%">Шаблон</td>
	  <td width="4%" tal:condition="MAIN_MULTILANG">Язык</td>
	  <td width="4%"></td>
	  </tr>
	
	<tbody id="table_content">

		<tal:block metal:use-macro="inc/page_row.html/page_row">подключаем шаблон из файла inc/page_row.html</tal:block>
	
	</tbody>
	</table>
	
	
</div>


<script>/*<![CDATA[*/


t = new HL.controls.table("${MAIN_URL}/?p_name=admin_control_pages");

$('#filter_module').change( function(e){
	t.page = 1;
	t.setWhere('where_module',$(this).val() )
	t.execute('reload',new Array( ));
});




/*
table = {
	'server' :"${MAIN_URL}/?p_name=admin_control_pages",
	'orderby_key' : 0,
	'orderby_value'   : 0,
	'page'				:1,
	'filter_module' : 0,

}
//	фильтр по модулю
table.where_module = function(box){

	table.filter_module = box.options[box.selectedIndex].value;
	table.page = 1;
	table.reload(true);
}
table.lock = function(){
	wnd.onload = false;
	wnd.set_title('');
	wnd.set_content('${WAIT}');
	wnd.show();
}
table.unlock = function(){
	wnd.close();
}
	//	сортируем по имени страницы
table.orderby_title = function(img){
	if ( img.className == 'ASC' ){
		img.className='DESC';
	}else{
		img.className='ASC';
	}
	table.orderby_value = img.className
	table.orderby_key = 'orderby_fname';
	table.reload();
}

	//	сортируем по номеру страницы
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_fid';
	table.reload();
}


	//	удаляем модуль mid
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} )
}
  //  удаляем страницу id
table.del_page = function(id){
	r = new request(  table.server+'&act=ajax_delete_page' );
	r.onrequest = function(){ 
		table.lock();
	};
	r.onload = function(rst){ 
		table.reload();
		table.unlock();
	};
	r.error = function(e){
		alert(e);
	}
	r.send( {'id':id} )
}


table.pagenav = function(pn){
	table.lock();
	table.page = pn;
	table.reload();
	table.unlock();
}

	//	форма редактирования 
table.edit = function(fid){

	HL.window.onload = table.editor
	HL.window.open( table.server+'&act=ajax_edit&id='+fid );
}
table.add = function(){
	wnd.onload = 'table.editor';
	wnd.open(table.server+'&act=ajax_add');
}

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

	r = new request(  table.server+'&act=ajax_save' );
	r.onload = function(rst){
		o.$('error_page').innerHTML = rst.msg
		table.reload();
		wnd.close();
	}
	r.error = function(e){
		o.$('error_page').innerHTML =e; 
	}
	r.form( o.$('form_page') );
	
}

	//	обновляем модуль
table.update = function(mid){

	r = new request(  table.server+'&act=ajax_update' );
	r.onrequest = function(){ 
		table.lock();
	};
	r.onload = function(rst){ 
		table.reload();
		table.unlock();
	};
	r.error = function(e){
		table.unlock();
		alert(e);
	}
	r.send( {'id':mid} )
	
}

	//	перезагружаем таблицу страниц согласно соортировке и фильтрам
table.reload = function(){
	 $.ajax( {
      'dataType':'xml',
      'type'    : "POST",
      'url'     : table.server+'&act=ajax_reload', 
      'data'    : {'orderby_key':table.orderby_key, 'orderby_value':table.orderby_value,'page':table.page,'filter_module':table.filter_module}, 
      'success' : function(data){
       	$('#table_content').html( $(data).find('content').text() )
      },
      'error'   : function(event, jqXHR, ajaxSettings) { 
        alert(ajaxSettings ) ;
      },
  })
	
	
		
	
	

}
	//	перезагружаем таблицу страниц согласно соортировке и фильтрам
table.lang = function(id,lang){
  HL.window.onload = table.editor
	HL.window.open( table.server+'&act=ajax_lang_edit&id='+id+'&lang='+lang );
	
}*/

/*]]>*/</script>