items.html 4.1 KB


<ul class="top_nav">
		<li><a href="/">${SITE}</a></li>
		<li><a href="${URL_ADMIN}">${ADMIN_PAGE}</a></li>
		<li><a href="${URL_MENU_CONTROL_MENU}">Меню</a></li>
		<li class="current">Меню "${c_name}"</li>
</ul>

<div style="padding:10px;padding-top:0px;">
	
	<table  class="data" width="100%" align="left" id="table">
	<tr>
		<td colspan="10" style="text-align:right"><b><a style="color:#F8A720;font-size:14px;" act="edit_item" hl_type="window" hl_act="edit_item" >Добавить пункт</a></b></td>
	</tr>
	<tr class="header">
	  <td width="1%"></td>
	  <td width="15%">Название</td>
	  <td width="15%">Ссылка</td>
	  <td width="1%">Сортировать</td>
	 <td width="5%" tal:condition="MAIN_MULTILANG">Язык</td>
	  <td width="6%" colspan="3">Действия</td>
	  </tr>
	
	<tbody id="table_content">
		<tal:block metal:use-macro="inc/tmpl_row_items.html/tmpl_row_items">подключаем шаблон из файла inc/tmpl_row_items.html</tal:block>
	</tbody>
	</table>
</div>



<script>/*<![CDATA[*/
t = new HL.controls.table("${URL_MENU_CONTROL_MENU}&menu_id=${menu_id}");
t.setAction('edit_item', function(t,obj){
	HL.window.lock();

  $.ajax( {
      'dataType':'xml',
      'type'    : "POST",
      'url'     : t.server+'&act=edit_item', 
      'data'    : {'id':obj.attr('row_id')}, 
      'success' : function(xml){ t.resultFunc(xml);  },
      'error'   : function(event, jqXHR, ajaxSettings) { t.error(ajaxSettings); HL.window.close() },
  })
})
t.setAction('save_item', function(t){


})
t.setAction('delete_item', function(t,obj){
	HL.window.lock();
  $.ajax( {
      'dataType':'xml',
      'type'    : "POST",
      'url'     : t.server+'&act=delete_item', 
      'data'    : {'id':obj.attr('row_id')}, 
      'success' : function(xml){ t.resultFunc(xml); ; HL.window.close() },
      'error'   : function(event, jqXHR, ajaxSettings) { t.error(ajaxSettings); HL.window.close() },
  })
})
/*

table = {
	'server' :"${URL_MENU_CONTROL_MENU}",
	'menu_id' :${menu_id},
}
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){
	wnd.open(table.server+'&act=ajax_edit_item&menu_id='+table.menu_id+'&id='+fid);	
}


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

	r = new request(  table.server+'&act=ajax_save_item' );
	r.onrequest = function(){ 
	  o.msg.system('Идёт сохранение...')
	
	}
	r.onload = function(rst){
	  o.msg.system(rst.msg)
		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_item' );
	r.onload = function(rst){ 
		o.$('table_content').innerHTML =rst.content;	
	};
	r.error = function(e){
		alert(e);
	}
	r.send({'menu_id':table.menu_id});	
	
}

table.up = function(key){
	r = new request( table.server+'&act=ajax_up&id='+key);
	r.onrequest = function(){ 
		table.lock();
	}
	r.onload = function(r)
	{
		table.reload(false);
		table.unlock();
	}
	r.send({});	
}

table.down = function(key){
	r = new request( table.server+'&act=ajax_down&id='+key+'');
	r.onrequest = function(){ 
		table.lock();
	}
	r.onload = function(r)
	{
		table.reload(false);
		table.unlock();
	}
	r.send({});	
}

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

/*]]>*/</script>