<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/



 if(!defined('IN_SITETEAM')) {exit('Access Denied');}?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SiteTeam Administrator's Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<link rel="stylesheet" href="admin/images/admincp.css" type="text/css" media="all" />
<link rel="stylesheet" href="admin/images/form.css" type="text/css" media="all" />
<script src="admin/js/common.js" type="text/javascript"></script>
</head>
<body>
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='开始&nbsp;&raquo;&nbsp;<?=$site_product_name?><?php if(!empty($category)){?>&nbsp;&raquo;&nbsp;<?=$product_category[$category]['name']?><?php }?>';</script>
<script language="javascript" type="text/javascript">
var product_category = new Array();
<?php foreach ($product_category as $k => $v) {?>
product_category['<?=$k?>'] = '<?=$v['name']?>';
<?php }?>

function select_operation(f) {
	document.postform.new_category_id.length = 0; //初始化下拉列表 清空下拉数据
	document.postform.new_category_id.style.display = 'none';
	document.postform.keywords.style.display = 'none';
	if (f.options[f.selectedIndex].value == 'del') {
		//删除处理
	}
	if (f.options[f.selectedIndex].value == 'move') {
		document.postform.new_category_id.style.display = '';
		for (var i in product_category) {
			//alert(group_list[f.options[f.selectedIndex].value][i]);
			document.postform.new_category_id.options[document.postform.new_category_id.length] = new Option(product_category[i], i);
		}
	}
	//搜索
	if (f.options[f.selectedIndex].value == 'search') {
		document.postform.keywords.style.display = '';
		
	}
}
</script>
<div class="container" id="cpcontainer">
  <div class="itemtitle">
    <h3><?=$site_product_name?>列表</h3>
    <?php if(!empty($category)){?>
	<ul class="tab1">
      <li><a href="admin.php?action=product&operation=edit&category=<?=$category?>"><span>添加<?=$site_product_name?></span></a></li>
	  <li><a onClick="return confirm('此操作需要几分钟或更长时间，确定要进行吗？')" href="admin.php?action=product&operation=update_index&category=<?=$category?>"><span>更新该栏索引</span></a></li>
    </ul>
	<?php } else {?>
	<ul class="tab1">
      <li><a>请先从左边导航选择栏目，然后添加产品</a></li>
      <li><a onClick="return confirm('此操作需要几分钟或更长时间，确定要进行吗？')" href="admin.php?action=product&operation=update_all_index"><span>更新该栏索引</span></a></li>
    </ul>
	<?php }?>
  </div>
  <form id="postform" name="postform" method="post" action="admin.php?action=product&operation=batch">
	<table width="700" class="tb tb2 ">
	  <tr>
		<? if(!empty($category)){?><td><label><input class="checkbox" type="checkbox" id="chkall" name="chkall" onClick="checkall(this.form);" /></label></td><?php }?>
		<td><h4>标题</h4></td>
	    <td width="100"><h4>时间</h4></td>
		<td width="50"><h4>审核</h4></td>
		<td width="60"><h4>调到首页</h4></td>
		<td width="50"><h4>编辑</h4></td>
		<td width="50"><h4>删除</h4></td>
	  </tr>
	  <?php if (is_array($list) && count($list) > 0) foreach ($list as $k => $v) {?>
	  <tr>
	    <? if(!empty($category)){?><td> <label><input name="product_key[]" class="checkbox" type="checkbox" value="<?=$v['key']?>" /></label></td><?php }?>
		<td><?php if(empty($category)){?>[<?=$product_category[$v['category']]['name']?>]<?php }?> <a target="_blank" href="http://<?=$site_url?><?=SITE_PATH?>/?<?=$site_product_url?>/<?=$v['category']?>/<?=$v['key']?>.html"><?=str_sub($v['name'], 30, "…")?></a></td>
	    <td><?=date("Y-m-d", $v['key'])?></td>
		<td><?php if(empty($v['pass']) || $v['pass'] == 4){?><a href="admin.php?action=product&operation=pass&category=<?=$v['category']?>&key=<?=$v['key']?>&pass=1&page=<?=$page?>"><strong>开启</strong></a><?php } else {?><a href="admin.php?action=product&operation=pass&category=<?=$v['category']?>&key=<?=$v['key']?>&pass=4&page=<?=$page?>">关闭</a><?php }?></td>
		<td><?php if(empty($v['status']) || $v['status'] == 1){?><a href="admin.php?action=product&operation=headtopic&category=<?=$v['category']?>&key=<?=$v['key']?>&status=8&page=<?=$page?>"><strong>首页展示</strong></a><?php } else {?><a href="admin.php?action=product&operation=headtopic&category=<?=$v['category']?>&key=<?=$v['key']?>&status=1&page=<?=$page?>">取消展示</a><?php }?></td>
		<td><a href="admin.php?action=product&operation=edit&category=<?=$v['category']?>&key=<?=$v['key']?>&page=<?=$page?>">编辑</a></td>
		<td><a onClick="return confirm('确定删除？');" href="admin.php?action=product&operation=del&category=<?=$v['category']?>&key=<?=$v['key']?>&page=<?=$page?>">删除</a></td>
	  </tr>
	  <?php  }?>
  </table>
  <? if(!empty($category)){?>
  管理动作：
    <label>
    <select name="batch_action" id="batch_action" onChange="select_operation(this);">
      <option value="0">----</option>
      <option value="del">删除</option>
      <option value="move">移动</option>
      <option value="search">搜索</option>
    </select>
    </label>
	<label><select name="new_category_id" id="new_category_id" style="display:none"></select></label>
	<label><input name='keywords' class='txt' type='text' id='keywords' style="display:none" value='请输入关键词' />
	<input name="category" type="hidden" value="<?=$category?>">
	<input name="page" type="hidden" value="<?=$page?>">
     <label><input type="submit" name="Submit" class="btn" value="提交" /></label>
	<?php }?>
</form>


<?php $m = $multipage;?>
<?php if($m['total_row'] > $limit) {?>
<div class="pages_btns">
	<div class="pages" style="margin-left: 5px;margin-top: 5px;">
		<em>&nbsp;<?=$m['total_row']?>&nbsp;</em>
		<a href="admin.php?action=product&operation=list&category=<?=$category?>&page=1" class="first">1 ...</a>
		<a href="admin.php?action=product&operation=list&category=<?=$category?>&page=<?=$m['up_page']?>" class="prev">&lsaquo;&lsaquo;</a>
		<?php if(count($m['link']))foreach($m['link'] as $k => $n) {?>
			<?php if ($n != $m['current_page']){?>
				<a href="admin.php?action=product&operation=list&category=<?=$category?>&page=<?=$n?>"> <?=$n?> </a>
			<?php }else{ ?>
				<strong> <?=$n?> </strong>
			<?php } ?>
		<?php } ?>
		<a href="admin.php?action=product&operation=list&category=<?=$category?>&page=<?=$m['next_page']?>" class="next">&rsaquo;&rsaquo;</a>
		<a href="admin.php?action=product&operation=list&category=<?=$category?>&page=<?=$m['total_page']?>" class="last">... <?=$m['total_page']?></a>
		<kbd>
  			<input type="text" name="custompage" size="3" onKeyDown="if(event.keyCode==13) {window.location='admin.php?action=product&operation=list&category=<?=$category?>&page='+this.value; return false;}" />
  		</kbd>
	</div>
</div>
<?php } ?>
</div>

</body>
</html>
