<?php
/*
	[Phpup.Net!] (C)2009-2011 Phpup.net.
	This is NOT a freeware, use is subject to license terms

	$Id: admin.class.php 2010-08-24 10:42 $
*/

if(!defined('IN_PHPUP')) {
	exit('Access Denied');
}
?>
<?php include ROOT_PATH.'/views/admin/header.php';?>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--

function addsitecate()
{
	url=site_root+"/index.php?con="+adminpath+"&act=sitecatemodify";
	$.get(url,{},
	function(data){
		$('#dialog').html(data);
	});
	$('#blurdiv').show();
	$('#blurdiv').height($(document).height());
	$('#dialog').dialog('open');
	$('#dialog').dialog({
		title:'添加分类',
		width: 400,
		height:250,
		buttons: {},
		close:function(){$('#blurdiv').hide();$('#dialog').html('');}
	});
}
function modifysitecate(id)
{
	url=site_root+"/index.php?con="+adminpath+"&act=sitecatemodify&updateid="+id;
	$.get(url,{},
	function(data){
		$('#dialog').html(data);
	});
	$('#blurdiv').show();
	$('#blurdiv').height($(document).height());
	$('#dialog').dialog('open');
	$('#dialog').dialog({
		title:'修改分类',
		width: 400,
		height:250,
		buttons: {},
		close:function(){$('#blurdiv').hide();$('#dialog').html('');}
	});
}
function parseMysitecateData(data)
{
	var objdata=data;
	if(objdata.dotype=='add')
	{
		$('#sitecate0').append('<TR class="tr1" id="sitecate'+objdata.id+'"><TD id="sitecatename-'+objdata.id+'">'+objdata.sitecatename+'</TD><TD  id="sortorder-'+objdata.id+'">'+objdata.sortorder+'</TD><td align="center"><A HREF="javascript:modifysitecate('+objdata.id+')">修改</A>&nbsp;&nbsp;<A HREF="javascript:deleteVal(\'sitecate\',\''+objdata.id+'\',\'sitecate'+objdata.id+'\')">删除</A></td></TR>');
	}
	else
	{
		$('#sitecatename-'+objdata.id).html(objdata.sitecatename);
		$('#sortorder-'+objdata.id).html(objdata.sortorder);
	}
	Dialog_close();
}

function othercate2othercate()
{

	var boo = confirm('同步数据，会将本地的数据覆盖，您确定这样做吗？')

	if(boo)
	{
		var  url="index.php?con="+adminpath+"&act=othercate2othercate"; 
		$.get(url,function(data){
		
			if(data == "true")
			{
					alert("同步成功,请新缓存！");
					location.reload();
			}else{
					alert("同步失败！");
			}
		});

	}
}
//-->
</SCRIPT>
<div class="subnav">
	<div class="content-menu ib-a blue line-x">
	<a href="javascript:addsitecate();" class="add fb"><em>添加分类</em></a>
	<a href="javascript:othercate2othercate();" class="add fb"><em>服务器同步</em></a>
	</div>
</div>
<div class="table-list">
<TABLE cellpadding="1" cellspacing="1" style="width:600px;">
<thead>
<TR>
	<TH>类别</TH>
	<TH>排序</TH>
	<TH>操作</TH>
</TR>
</thead>
<tbody id="sitecate0">
<?php foreach($GLOBALS['sitecate'] as $key=>$val){?>
<TR class="tr1" id="sitecate<?php echo $key;?>">
	<TD id="sitecatename-<?php echo $key;?>">
	<?php echo $val['sitecatename'];?>
	</TD>
	<TD id="sortorder-<?php echo $key;?>">
	<?php echo $val['sortorder'];?>
	</TD>
	<td width="160px" align="center">
	<A HREF="javascript:modifysitecate('<?php echo $key;?>')">修改</A>
	<A HREF="javascript:deleteVal('sitecate','<?php echo $key;?>','sitecate<?php echo $key;?>')">删除</A>&nbsp;&nbsp;&nbsp;&nbsp;
	</td>
</TR>
<?php }?>
</tbody>
</TABLE>
</div>
<div id="dialog" style="display:none;"><IMG SRC="<?php echo STATIC_ROOT;?>/views/js/i/032.gif" WIDTH="32" HEIGHT="32" BORDER="0" ALT=""></div>
<div style="z-index: 1000; background-color: rgb(0, 0, 0); visibility: visible; display: none; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; width:100%;filter:alpha(opacity=50); opacity: 0.5; -moz-opacity:0.5;" id="blurdiv"></div>
</body>
</html>
