<?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>
	function opencity(id,sitename)
	{
		url=site_root+"/index.php?con="+adminpath+"&act=sitecity&updateid="+id;
		$.get(url,{},
		function(data){
			$('#dialog').html(data);
		});
		$('#blurdiv').show();
		$('#blurdiv').height($(document).height());
		$('#dialog').dialog('open');
		$('#dialog').dialog({
			title:'添加'+sitename+'开通城市',
			width: 500,
			height:500,
			buttons: {},
			close:function(){$('#blurdiv').hide();$('#dialog').html('');}
		});
	}
	function site2site()
	{

		var boo = confirm('同步数据，不会对本地数据造成影响，请放心使用')

		if(boo)
		{

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

				}else{
						alert("同步失败！");
				}

			});

		}
	}



	function get_rtansnum()
	{
		$.get("index.php?con=admin&act=getnewsite", function(date){
				
				$('#transnum').html(date);

		});
	}

	get_rtansnum();

</script>


<div class="subnav">
			<div class="content-menu ib-a blue line-x">
				<div style="float:left;"><a href="index.php?con=<?php echo $GLOBALS['setting']['adminpath'];?>&act=sitemodify" class="add fb"><em>添加网站</em></a>
				<a href="javascript:site2site();"  class="add fb"><em>服务器同步</em></a></div>
				<div  style="height:30px;width:260px;padding-left:50px;line-height:30px;background:url('./views/admin/images/admin_img/ts_tu.gif') no-repeat scroll 0 0 transparent;float:left;"; >
					有<span id="transnum" style="color:red;" >loding..</span>个网站未同步
				</div>
				<div style="clear:both;"></div>
			</div>
			
</div>
<FORM METHOD="GET" ACTION="index.php">
<TABLE width="100%" cellspacing="0" class="search-form">
<tbody>
<tr>
<td>
<div class="explain-col"><INPUT TYPE="hidden" NAME="con" value="<?php echo $GLOBALS['setting']['adminpath'];?>"><INPUT TYPE="hidden" NAME="act" value="site">
网站名：<INPUT TYPE="text" class="input-text" NAME="keyword"  value="<?php  echo $_REQUEST['keyword']; ?>"  >　
首字母：<INPUT TYPE="text" class="input-text" NAME="pinyin"   value="<?php  echo $_REQUEST['pinyin']; ?>"  > 
分类：<SELECT NAME="sitetype">
	  <OPTION VALUE="-2">不限</option><OPTION VALUE="0">未分类</option>
	  <?php foreach($GLOBALS['sitecate'] as $k=>$v){?>
		<OPTION VALUE="<?php echo $k;?>"  <?php if($k == $_REQUEST['sitetype']){ ?> selected   <?php  } ?>   ><?php echo $v['sitecatename'];?></option>
	  <?php }?>
	 </SELECT>&nbsp;&nbsp;
	 <INPUT TYPE="submit" class='button' value='搜索'>
</div>
</TD>
</TR></tbody>
</TABLE>
</FORM>
<FORM METHOD=POST ACTION="index.php?con=admin&act=sitedo">
<div class="table-list">
<TABLE cellpadding="1" cellspacing="1" id="sitearea" width="100%" >
<thead>
<TR>
	<TH style="width:20px;text-align:center;"><INPUT TYPE="checkbox" NAME="" onclick="checkallgroup(this)"></TH>
	<TH>名称</TH>
	<TH>保持同步</TH>
	<TH>权重</TH>
	<TH>推荐</TH>
	<TH>可采集</TH>
	<TH>排序</TH>
	<TH>商品顺序</TH>
	<TH>操作</TH>
</TR>
</thead>
<tbody>
<?php foreach($sitelist['data'] as $key=>$val){?>
<TR class="tr1" id="site<?php echo $val['id'];?>">
	<td style="width:20px;text-align:center;">
	<input type="checkbox" value="<?php echo $val['id'];?>" name="gid[]" class="nocheck"/>
	</td>
	<TD  align="center"><?php if(!empty($val['breaksuff']) && strpos($val['breaksuff'],'p.lhaitun.net')){?><span style="color:#ff0000">返&nbsp;</span><?php }?><span style="<?php echo $val['css'];?>"><?php echo $val['sitename'];?></SPAN></TD>	
	</TD>

	<TD  align="center"><?php if($val['transkey']){  echo "是"; }else{ echo "否";  }   ;?>
	</TD>

	<TD align="center"><div id="level-<?php echo $val['id'];?>" onmouseover="this.style.backgroundColor='#ff8800';" onmouseout="this.style.backgroundColor='';" onclick="modifyValue('levelinput-<?php echo $val['id'];?>');"><?php echo $GLOBALS['level'][$val['level']];?>
	</div>
	
	<select class="hideinput" id="levelinput-<?php echo $val['id'];?>" onchange="confirmValue('site',this.value,'levelinput-<?php echo $val['id'];?>','id');">
	<?php foreach($GLOBALS['level'] as $k=>$v){?>
	<option value="<?php echo $k;?>"><?php echo $v;?></option>
	<?php }?>
	</select>
	
	</TD>
	<td align="center">
	<div id="recommend-<?php echo $val['id'];?>" onmouseover="this.style.backgroundColor='#ff0000';" onmouseout="this.style.backgroundColor='';" onclick="updateVal('site','recommendinput-<?php echo $val['id'];?>','id','',['推荐','不推荐']);">
	<?php echo $val['recommend']?'推荐':'不推荐';?>
	</div>
	<INPUT TYPE="text" class="hideinput" id="recommendinput-<?php echo $val['id'];?>" value="<?php echo intval(!$val['recommend']);?>" title='nochange'>
	</td>
	<td align="center">
	<div id="isallowed-<?php echo $val['id'];?>" onmouseover="this.style.backgroundColor='#ff0000';" onmouseout="this.style.backgroundColor='';" onclick="updateVal('site','isallowedinput-<?php echo $val['id'];?>','id','',['允许','禁止']);">
	<?php echo $val['isallowed']?'允许':'禁止';?>
	</div>
	<INPUT TYPE="text" class="hideinput" id="isallowedinput-<?php echo $val['id'];?>" value="<?php echo intval(!$val['isallowed']);?>" title='nochange'>
	</td>

	<TD  align="center"><?php echo $val['sort'];?>
	</TD>

	<TD  align="center"><?php echo $val['goodorder'];?>
	</TD>

	<td width="250px" align="center">
	<A HREF="javascript:deleteVal('site','<?php echo $val['id'];?>','site<?php echo $val['id'];?>')">删除</A> <A HREF="index.php?con=<?php echo $GLOBALS['setting']['adminpath'];?>&act=sitemodify&updateid=<?php echo $val['id'];?>">修改</A> <A HREF="javascript:opencity('<?php echo $val['id'];?>','<?php echo $val['sitename'];?>');">开通城市</A>
	</td>
</TR>
<?php }?>
</tbody>
</TABLE>

</div>

<div class="btn">
<SELECT NAME="confirmbutton">
	<OPTION VALUE="multi_del">批量删除
	<OPTION VALUE="multi_re">批量推荐
	<OPTION VALUE="multi_cancel">批量取消推荐
	<OPTION VALUE="multi_allow">批量允许
	<OPTION VALUE="multi_noallow">批量禁止
</SELECT>
<input type="submit" class="button" value="操作"/>
</div>
</FORM>
<div class="pages" style="padding:10px;"><?php echo $sitelist['pageinfo'];?></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>
