<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
set_magic_quotes_runtime(0);
include("include/dbcommon.php");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); 

include("include/##@TABLE.strShortTableName s##_variables.php");


$gsqlHead="select ##@BUILDER.strUserNameField ws## ";
$gsqlFrom="from ##@BUILDER.strLoginTable ts##";
$gsqlWhereExpr="";
$gsqlTail="";
// $gstrSQL = "##@TABLE.strSQL ls##";
$gstrSQL = gSQLWhere("");


##if @BUILDER.bCreateLoginPage##
if(!@$_SESSION["UserID"])
{ 
	$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];
	header("Location: login.php?message=expired"); 
	return;
}
if(!$_SESSION["IsAdmin"])
{
	echo "<p>".##message NO_PERMISSIONS##." <a href=\"login.php\">".##message BACK_TO_LOGIN##."</a></p>";
	return;
}
##endif##


include('include/xtempl.php');
$xt = new Xtempl();






//	process reqest data, fill session variables

if(!count($_POST) && !count($_GET))
{
	$sess_unset = array();
	foreach($_SESSION as $key=>$value)
		if(substr($key,0,strlen($strTableName)+1)==$strTableName."_" &&
			strpos(substr($key,strlen($strTableName)+1),"_")===false)
			$sess_unset[] = $key;
	foreach($sess_unset as $key)
		unset($_SESSION[$key]);
}

//	Before Process event
if(function_exists("BeforeProcessList"))
	BeforeProcessList($conn);


##if @BUILDER.arrLanguages.len>1##
if(@$_REQUEST["language"])
	$_SESSION["language"]=@$_REQUEST["language"];

$var=GoodFieldName(mlang_getcurrentlang())."_langattrs";
$xt->assign($var,"selected");
$xt->assign("langselector_attrs","name=lang onchange=\"javascript: window.location='##@TABLE.strShortTableName hs##_list.##@ext##?language='+this.options[this.selectedIndex].value\"");
$xt->assign("languages_block",true);
##endif##

if(@$_REQUEST["orderby"])
	$_SESSION[$strTableName."_orderby"]=@$_REQUEST["orderby"];

if(@$_REQUEST["pagesize"])
{
	$_SESSION[$strTableName."_pagesize"]=@$_REQUEST["pagesize"];
	$_SESSION[$strTableName."_pagenumber"]=1;
}

if(@$_REQUEST["goto"])
	$_SESSION[$strTableName."_pagenumber"]=@$_REQUEST["goto"];


//	process reqest data - end

$includes="";

$includes.="<script type=\"text/javascript\" src=\"include/jquery.js\"></script>\r\n";
$includes.="<script language=\"JavaScript\" src=\"include/customlabels.js\"></script>\r\n";
$includes.="<script language=\"JavaScript\" src=\"include/jsfunctions.js\"></script>\r\n";

//	process session variables
//	order by
$strOrderBy="";
$order_ind=-1;


if(!$strOrderBy)
	$strOrderBy=$gstrOrderBy;


//	get tables list

$rights=array();
$tables=array();
##foreach @BUILDER.Tables as @t filter !IsAdminTable(@t)##
//$tables[] = array("##@t.strDataSourceTable s##","##@t.strCaption s##");
$tables[] = array("##@t.strDataSourceTable s##",##caption @t.strDataSourceTable##);
$rights["##@t.strDataSourceTable s##"]=array();
##endfor##

DPOrderTables($tables);

//	select groups list
$groups=array();
$groups[]=array(-1,"<Admin>");
$groups[]=array(-2,"<Default>");
$groups[]=array(-3,"<Guest>");
$groupfullchecked=array();
$groupfullchecked[]=true;

$smartygroups=array();

$trs = db_query("select GroupID,Label from ##@BUILDER.strUGGroups ts## order by Label",$conn);
while($tdata = db_fetch_numarray($trs))
{
	$groups[]=array($tdata[0],$tdata[1]);
}

$xt->assign("grouplist_attrs","size=".count($groups)." onchange=\"fillboxes(this.options[this.selectedIndex].value);\" name=\"group\" id=\"group\"");


foreach($groups as $g)
{
	$sg=array();
	$sg["group_attrs"] = "value=\"".$g[0]."\"";
	$sg["groupname"]=htmlspecialchars($g[1]);
	if($g[0]==@$_POST["group"])
		$sg["group_attrs"].=" selected";
	$smartygroups[]=$sg;
	foreach($tables as $t)
		$rights[$t[0]][$g[0]]="";
}
$xt->assign_loopsection("groups",$smartygroups);
//	select permissions
$xt->assign("changepwd_link",$_SESSION["AccessLevel"] != ACCESS_LEVEL_GUEST);
$xt->assign("changepwdlink_attrs","onclick=\"window.location.href='changepwd.##@ext##';return false;\"");

if(postvalue("a")=="save")
{
	foreach(postvalue("table") as $table)
	{
//	delete records which are not needed
		$gtable=GoodFieldName($table);
		$sql="delete from ##@BUILDER.strUGRights ts## where TableName='".db_addslashes($table)."'";
		db_exec($sql,$conn);
		foreach($groups as $grp)
		{
			$mask="";
			if(@$_POST["cbadd_".$gtable."_".$grp[0]])
			$mask.="A";
			if(@$_POST["cbedt_".$gtable."_".$grp[0]])
			$mask.="E";
			if(@$_POST["cbdel_".$gtable."_".$grp[0]])
			$mask.="D";
			if(@$_POST["cblst_".$gtable."_".$grp[0]])
			$mask.="S";
			if(@$_POST["cbexp_".$gtable."_".$grp[0]])
			$mask.="P";
			if(@$_POST["cbimp_".$gtable."_".$grp[0]])
			$mask.="I";
			if(@$_POST["cbadm_".$gtable."_".$grp[0]])
			$mask.="M";
			if($mask)
				db_exec("insert into ##@BUILDER.strUGRights ts## (TableName,GroupID,AccessMask) values ('".db_addslashes($table)."',".$grp[0].",'".$mask."')",$conn);
		}
	}
}


$trs = db_query("select GroupID,TableName,AccessMask from ##@BUILDER.strUGRights ts## order by GroupID",$conn);
while($tdata = db_fetch_numarray($trs))
{
	if(!array_key_exists($tdata[1],$rights))
		continue;
	if(!array_key_exists((int)$tdata[0],$rights[$tdata[1]]))
		continue;
	$rights[$tdata[1]][$tdata[0]]=$tdata[2];
}

//	fill permissions array
$includes.="<script>
var tables=Array();
var groups=Array();";
$tindex=0;

$gindex=0;
foreach($groups as $grp)
{
	$includes.="groups[".$gindex."]=".jsreplace($grp[0]).";\r\n";
	$gindex++;
}

foreach($tables as $tbl)
{
	$includes.="tables[".$tindex."]='".GoodFieldName($tbl[0])."';\r\n";
	$tindex++;
}
$includes.="</script>";

$linkdata="<script>
var TEXT_AA_ADD_NEW_GROUP = \"".##message AA_ADD_NEW_GROUP##."\";
var TEXT_AA_RENAMEGROUP = \"".##message AA_RENAMEGROUP##."\";
var renameidx=-1;
function fillboxes(group)
{
	var add_uncheck=false;
	var edt_uncheck=false;
	var del_uncheck=false;
	var lst_uncheck=false;
	var exp_uncheck=false;
	var imp_uncheck=false;
	var adm_uncheck=false;
	for(g=0;g<groups.length;g++)
	{
		for(t=0;t<tables.length;t++)
		{
			var disp='none';
			if(groups[g]==group)
			{
				var tbl_uncheck=false;
				disp='';
				if((!tbl_uncheck || !add_uncheck) && !document.getElementById('cbadd_'+tables[t]+'_'+groups[g]).checked)
				{
					tbl_uncheck=true;
					add_uncheck=true;
				}
				if((!tbl_uncheck || !edt_uncheck) && !document.getElementById('cbedt_'+tables[t]+'_'+groups[g]).checked)
				{
					tbl_uncheck=true;
					edt_uncheck=true;
				}
				if((!tbl_uncheck || !del_uncheck) && !document.getElementById('cbdel_'+tables[t]+'_'+groups[g]).checked)
				{
					tbl_uncheck=true;
					del_uncheck=true;
				}
				if((!tbl_uncheck || !lst_uncheck) && !document.getElementById('cblst_'+tables[t]+'_'+groups[g]).checked)
				{
					tbl_uncheck=true;
					lst_uncheck=true;
				}
				if((!tbl_uncheck || !exp_uncheck) && !document.getElementById('cbexp_'+tables[t]+'_'+groups[g]).checked)
				{
					tbl_uncheck=true;
					exp_uncheck=true;
				}
				if((!tbl_uncheck || !imp_uncheck) && !document.getElementById('cbimp_'+tables[t]+'_'+groups[g]).checked)
				{
					tbl_uncheck=true;
					imp_uncheck=true;
				}
				if((!tbl_uncheck || !adm_uncheck) && !document.getElementById('cbadm_'+tables[t]+'_'+groups[g]).checked)
				{
					tbl_uncheck=true;
					adm_uncheck=true;
				}
				document.getElementById(tables[t]).checked=!tbl_uncheck;
			}
			document.getElementById('cbadd_'+tables[t]+'_'+groups[g]).style.display=disp;
			document.getElementById('cbedt_'+tables[t]+'_'+groups[g]).style.display=disp;
			document.getElementById('cbdel_'+tables[t]+'_'+groups[g]).style.display=disp;
			document.getElementById('cblst_'+tables[t]+'_'+groups[g]).style.display=disp;
			document.getElementById('cbexp_'+tables[t]+'_'+groups[g]).style.display=disp;
			document.getElementById('cbimp_'+tables[t]+'_'+groups[g]).style.display=disp;
			document.getElementById('cbadm_'+tables[t]+'_'+groups[g]).style.display=disp;
		}
	}
	document.getElementById('add').checked=!add_uncheck;
	document.getElementById('edt').checked=!edt_uncheck;
	document.getElementById('del').checked=!del_uncheck;
	document.getElementById('lst').checked=!lst_uncheck;
	document.getElementById('exp').checked=!exp_uncheck;
	document.getElementById('imp').checked=!imp_uncheck;
	document.getElementById('adm').checked=!adm_uncheck;
	if(group<0)
	{
		document.getElementById('delgroup').disabled=true;
		document.getElementById('delgroup').className='button_dis button';
		document.getElementById('rengroup').disabled=true;
		document.getElementById('rengroup').className='button_dis button';
	}
	else
	{
		document.getElementById('delgroup').disabled=false;
		document.getElementById('delgroup').className='button';
		document.getElementById('rengroup').disabled=false;
		document.getElementById('rengroup').className='button';
		var gr=document.getElementById('group'); 
		renameidx=gr.selectedIndex;
		$('#groupname').val(gr.options[gr.selectedIndex].text);
	}
}
var gsel=document.getElementById('group');
if(gsel.selectedIndex<0)
	gsel.selectedIndex=0;
fillboxes(gsel.options[gsel.selectedIndex].value);
function deletegroup()
{
	var gr=document.getElementById('group'); 
	var disp = gr.options[gr.selectedIndex].text;
	var idx=gr.selectedIndex;
	var id = gr.options[idx].value;
	if(!confirm('".jsreplace(##message AA_DELETEGROUP##)." \\''+disp+'\\'?')) 
		return;
	$.get('ug_group.##@ext##',
		{	
			rndval: Math.random(),
			id: id,
			a: 'del'
		},
		function(ret){	
			if(ret!='ok')
			{
			  alert('Error deleting record!');
			  return;
			}
			for(i=0;i<groups.length;i++)
				if(groups[i]==id)
					groups.splice(i,1);
			gr.selectedIndex--;
			gr.onchange();
			$('input[@type=checkbox][@id$=_'+id+']').each(function(){this.parentNode.removeChild(this);});
			gr.remove(idx);
			gr.size=gr.size-1;
		}
	);
}
function makename(group)
{
  var n=1;
  var i;
  tgroup=group;
  var gr=document.getElementById('group'); 
  while(1)
  {
	  for(i=0;i<gr.options.length;i++)
	  {
		if(tgroup==gr.options[i].text)
  		  break;
	  }	
	  if(i==groups.length)
	  {
	    return tgroup;
	}
	tgroup=group+n;
	n++;
  }
}
//Save name group
function save(name)
{
 if(renameidx==-1)
 {
  $.get('ug_group.##@ext##',
  {	
   rndval: Math.random(),
   name: name,
   a: 'add'
  },
  function(ret)
  {	
   if(ret.substring(0,2)!='ok')
   {
    alert('Error adding group!');
    return;
   }
   var id=ret.substring(2);
   var gr=document.getElementById('group'); 
   $('#addarea').hide();
//	append checkboxes
   $('input[@type=checkbox][@id$=_-1]').each( 
   function() 
   {
	var cbid = $(this)[0].id;
	$(this.parentNode).append(\"<input type=checkbox  id=\\\"\"+cbid.substring(0,cbid.length-2)+id+\"\\\" name=\\\"\"+cbid.substring(0,cbid.length-2)+id+\"\\\">\");
   });
   groups[groups.length]=id;
   gr.options[gr.options.length]=new Option(name,id);
   gr.selectedIndex=gr.options.length-1;
   gr.onchange();
   gr.size=gr.size+1;
   $('#groupname').val('');
  		});
		}
		else
		{
			var idx=renameidx;
			renameidx=-1;
			var gr=document.getElementById('group'); 
		$.get('ug_group.##@ext##',
		{	
			rndval: Math.random(),
			id: gr.options[idx].value,
			name: name,
			a: 'rename'
		},
		function(ret){	
			if(ret.substring(0,2)!='ok')
			{
			  alert('Error renaming group!');
			  return;
			}
			$('#addarea').hide();
			gr.options[idx].text=name;
			$('#groupname').val('');
		});
		}
}
</script>";

//	fill $rowinfo array
	$rowinfo = array();
	$shade=false;
	$recno=1;
	$editlink="";
	$copylink="";

	foreach($tables as $tbl)
	{
		$row=array();
		$row["begin"]="<input type=hidden name=\"table[]\" value=\"".htmlspecialchars($tbl[0])."\">";
		if($tbl[0]==$tbl[1])
			$row["tablename"]=htmlspecialchars($tbl[0]);
		else
			$row["tablename"]=htmlspecialchars($tbl[1])."&nbsp;(".htmlspecialchars($tbl[0]).")";
			
		$row["tablecheckbox_attrs"]="id=\"".GoodFieldName($tbl[0])."\" onclick=\"
		var chk=this.checked;
		$('input[@id^=cbadd_'+this.id+'_]').each( function() {if(this.style.display=='') this.checked=chk;});
		$('input[@id^=cbedt_'+this.id+'_]').each( function() {if(this.style.display=='') this.checked=chk;});
		$('input[@id^=cbdel_'+this.id+'_]').each( function() {if(this.style.display=='') this.checked=chk;});
		$('input[@id^=cblst_'+this.id+'_]').each( function() {if(this.style.display=='') this.checked=chk;});
		$('input[@id^=cbexp_'+this.id+'_]').each( function() {if(this.style.display=='') this.checked=chk;});
		$('input[@id^=cbimp_'+this.id+'_]').each( function() {if(this.style.display=='') this.checked=chk;});
		$('input[@id^=cbadm_'+this.id+'_]').each( function() {if(this.style.display=='') this.checked=chk;});
		\"";
			
			
##if @TABLE.bRowHighlite##
		if(!$shade)
		{
			$row["rowattrs"]="class=shade onmouseover=\"this.className = 'rowselected';\" onmouseout=\"this.className = 'shade';\"";
			$shade=true;
		}
		else
		{
			$row["rowattrs"]="onmouseover=\"this.className = 'rowselected';\" onmouseout=\"this.className = '';\"";
			$shade=false;
		}
##endif##
			
			
		$sgroups=array();
		foreach($groups as $g)
		{
			$group = array();
			$mask = $rights[$tbl[0]][$g[0]];
			$checked=((strpos($mask,"A")!==FALSE))?" checked":"";
			$group["add_checkbox"]=" id=\"cbadd_".GoodFieldName($tbl[0])."_".$g[0]."\"".$checked." name=\"cbadd_".GoodFieldName($tbl[0])."_".$g[0]."\"";
			$checked=((strpos($mask,"E")!==FALSE))?" checked":"";
			$group["edt_checkbox"]=" id=\"cbedt_".GoodFieldName($tbl[0])."_".$g[0]."\"".$checked." name=\"cbedt_".GoodFieldName($tbl[0])."_".$g[0]."\"";
			$checked=((strpos($mask,"D")!==FALSE))?" checked":"";
			$group["del_checkbox"]=" id=\"cbdel_".GoodFieldName($tbl[0])."_".$g[0]."\"".$checked." name=\"cbdel_".GoodFieldName($tbl[0])."_".$g[0]."\"";
			$checked=((strpos($mask,"S")!==FALSE))?" checked":"";
			$group["lst_checkbox"]=" id=\"cblst_".GoodFieldName($tbl[0])."_".$g[0]."\"".$checked." name=\"cblst_".GoodFieldName($tbl[0])."_".$g[0]."\"";
			$checked=((strpos($mask,"P")!==FALSE))?" checked":"";
			$group["exp_checkbox"]=" id=\"cbexp_".GoodFieldName($tbl[0])."_".$g[0]."\"".$checked." name=\"cbexp_".GoodFieldName($tbl[0])."_".$g[0]."\"";
			$checked=((strpos($mask,"I")!==FALSE))?" checked":"";
			$group["imp_checkbox"]=" id=\"cbimp_".GoodFieldName($tbl[0])."_".$g[0]."\"".$checked." name=\"cbimp_".GoodFieldName($tbl[0])."_".$g[0]."\"";
			$checked=((strpos($mask,"M")!==FALSE))?" checked":"";
			$group["adm_checkbox"]=" id=\"cbadm_".GoodFieldName($tbl[0])."_".$g[0]."\"".$checked." name=\"cbadm_".GoodFieldName($tbl[0])."_".$g[0]."\"";
			$sgroups[]=$group;
		}
		$row["add_groupboxes"]=array("data"=>$sgroups);
		$row["edt_groupboxes"]=&$row["add_groupboxes"];
		$row["del_groupboxes"]=&$row["add_groupboxes"];
		$row["lst_groupboxes"]=&$row["add_groupboxes"];
		$row["exp_groupboxes"]=&$row["add_groupboxes"];
		$row["imp_groupboxes"]=&$row["add_groupboxes"];
		$row["adm_groupboxes"]=&$row["add_groupboxes"];
		$rowinfo[]=$row;
	}


	$xt->assign_loopsection("grid_row",$rowinfo);
	
$xt->assign("add_headcheckbox","id=\"add\" onclick=\"var chk=this.checked; $('input[@id^=cbadd_]').each(function() {if(this.style.display=='') this.checked=chk;});\"");
$xt->assign("edt_headcheckbox","id=\"edt\" onclick=\"var chk=this.checked; $('input[@id^=cbedt_]').each(function() {if(this.style.display=='') this.checked=chk;});\"");
$xt->assign("del_headcheckbox","id=\"del\" onclick=\"var chk=this.checked; $('input[@id^=cbdel_]').each(function() {if(this.style.display=='') this.checked=chk;});\"");
$xt->assign("lst_headcheckbox","id=\"lst\" onclick=\"var chk=this.checked; $('input[@id^=cblst_]').each(function() {if(this.style.display=='') this.checked=chk;});\"");
$xt->assign("exp_headcheckbox","id=\"exp\" onclick=\"var chk=this.checked; $('input[@id^=cbexp_]').each(function() {if(this.style.display=='') this.checked=chk;});\"");
$xt->assign("imp_headcheckbox","id=\"imp\" onclick=\"var chk=this.checked; $('input[@id^=cbimp_]').each(function() {if(this.style.display=='') this.checked=chk;});\"");
$xt->assign("adm_headcheckbox","id=\"adm\" onclick=\"var chk=this.checked; $('input[@id^=cbadm_]').each(function() {if(this.style.display=='') this.checked=chk;});\"");


##if @BUILDER.bCreateLoginPage##
$xt->assign("userid",htmlspecialchars($_SESSION["UserID"]));
$xt->assign("username",htmlspecialchars($_SESSION["UserID"]));
##endif##

$defaulturl="";
##if CreateMenu##
		$defaulturl="menu.php";
##else##
	##foreach @BUILDER.Tables as @t filter @t.bMenuItem order @t.nMenuOrder##
		##if @first##
		##if @t.bList##
		$defaulturl="##@t.strShortTableName##_list.php";
		##elseif @t.nType==titREPORT##
		$defaulturl="##@t.strShortTableName##_report.php";
		##elseif @t.nType==titCHART##
		$defaulturl="##@t.strShortTableName##_chart.php";
		##else##
		$defaulturl="##@t.strShortTableName##_add.php";
		##endif##
		##endif##
	##endfor##
##endif##			
##if !@BUILDER.Tables[bMenuItem].len##
	##if @BUILDER.Tables.bList##
		$defaulturl="##@BUILDER.Tables.strShortTableName##_list.php";
	##elseif @t.nType==titREPORT##
		$defaulturl="##@BUILDER.Tables.strShortTableName##_report.php";
	##elseif @t.nType==titCHART##
		$defaulturl="##@BUILDER.Tables.strShortTableName##_chart.php";
	##else##
		$defaulturl="##@BUILDER.Tables.strShortTableName##_add.php";
	##endif##
##endif##

$xt->assign("url",$defaulturl);

$xt->assign("addgroup_attrs","onclick=\"\$('#addarea').show();\$('#groupname')[0].focus(); \$('#groupname').val(makename('newgroup'));\$('#gmessage').html(TEXT_AA_ADD_NEW_GROUP);renameidx=-1;\"");
$xt->assign("delgroup_attrs","id=\"delgroup\" onclick=\"deletegroup();\"");
$xt->assign("rengroup_attrs","onclick=\"\$('#addarea').show();\$('#groupname')[0].focus();var gr=document.getElementById('group'); \$('#groupname').val(gr.options[gr.selectedIndex].text);\$('#gmessage').html(TEXT_AA_RENAMEGROUP);renameidx=gr.selectedIndex;\"");
$xt->assign("groupname_attrs","onblur=\"if(renameidx<0) this.value=makename(this.value);\" onkeydown=\"e=event; if(!e) e = window.event; if (e.keyCode != 13) return true; e.cancel = true; save(\$('#groupname').val()); return false;\"");
$xt->assign("savegroup_attrs","onclick=\"save(\$('#groupname').val());\"");
$xt->assign("cancelgroup_attrs","onclick=\"\$('#addarea').hide(); if(renameidx>=0) \$('#groupname').val('');\"");

$xt->assign("recordcontrols_block",true);
$xt->assign("savebuttons_block",true);
$xt->assign("savebutton_attrs","onclick=\"document.forms.frmAdmin.submit();\"");
$xt->assign("resetbutton_attrs","onclick=\"document.forms.frmAdmin.reset();\"");

$xt->assign("logoutlink_attrs","onClick=\"window.location.href='login.##@ext##?a=logout';return false;\"");
$xt->assign("exitaalink_attrs","href=\"".$defaulturl."\" onclick=\"window.location.href='".$defaulturl."';return false;\"");
$xt->assign("exitaalink_href","href=\"".$defaulturl."\"");
$xt->assign("exitadminarea_link",true);

$xt->assign("admin_rights_tablelink",true);
$xt->assign("admin_rights_tablelink_attrs","href=\"admin_rights_list.php\"");
$xt->assign("admin_members_tablelink",true);
$xt->assign("admin_members_tablelink_attrs","href=\"admin_members_list.php\"");
$xt->assign("admin_users_tablelink",true);
$xt->assign("admin_users_tablelink_attrs","href=\"admin_users_list.php\"");
$xt->assign("admin_rights_optionattrs","value=\"admin_rights_list.php\"");
$xt->assign("admin_members_optionattrs","value=\"admin_members_list.php\"");
$xt->assign("admin_users_optionattrs","value=\"admin_users_list.php\"");
$xt->assign("quickjump_attrs","onchange=\"window.location.href=this.options[this.selectedIndex].value;\"");

##if CreateMenu##
$xt->assign("quickjump_attrs","onchange=\"window.location.href=this.options[this.selectedIndex].value;\"");
##endif##



$templatefile = "admin_rights_list.htm";

$body=array();
$body["begin"]=&$includes;
$body["end"]=&$linkdata;
$body["begin"].="<style>INPUT.button_dis{
                  background: gainsboro;
				  color: ffffff;
				 }</style>";
$xt->assignbyref("body",$body);
$xt->assign("style_block",true);
$xt->assign("iestyle_block",true);

$xt->assign_section("rights_block",
	"<form method=\"POST\" action=\"admin_rights_list.php\" name=\"frmAdmin\" id=\"frmAdmin\">
	<input type=\"hidden\" id=\"a\" name=\"a\" value=\"save\">",
	"</form>");

$xt->assign("grid_block",true);
$xt->assign("toplinks_block",true);
$xt->assign("menu_block",true);
$xt->assign("search_records_block",true);
$xt->assign("username",htmlspecialchars($_SESSION["UserID"]));
$xt->assign("shiftstyle_block",true);
$xt->assign("security_block",true);
$xt->assign("left_block",true);

$xt->display($templatefile);


