<?php
	require_once('_approot.php');	
	
	if ($_GET['ls_msg']==""){
		$ls_msg="产品类别管理操作";
	}else{
		$ls_msg=$_GET['ls_msg'];	
	}

	$ls=$_GET['ls'];
	$id=$_GET['id'];
	$submit=$_POST['submit'];
	$nownum=$_GET['Num'];
	$whichcate=$_GET['whichcate'];

	$searchproductName=($_POST['searchproductName']==""?$_GET['searchproductName']:$_POST['searchproductName']);
	if($searchproductName!="") $ls_msg="包含 $searchproductName 的分类 ";
	if($_POST['gopage']!=""){$gopage =(ctype_digit($_POST['gopage'])?$_POST['gopage']:1);}
	if($gopage!="") $ls_msg="第 $gopage 页的分类 ";

	if ($submit=="保存")
	{
		$skype3=str_replace("'","''",$_POST['skype3']);
		$config_update="update ls_config set skype3= '$skype3' ";
		$config_query=$opendb->query($config_update);
		writelog($_SERVER['PHP_SELF'],"Product Brief: <br/>".$skype3,"ID: ".$id);
		
	}

	$config_sql="select * from ls_config ";
	$config_query=$opendb->query($config_sql);
	$config_row=mysqli_fetch_assoc($config_query);

	
	
	$opendb=new mydb();
	
	
	/**************** 更新添加连接的状态 ****************/
	switch($_GET['ls']){
		case 'addProLink':
			$id = $_GET['id'];
			$add_prolink_sql = 'UPDATE `ls_products` SET `addProLink`=NULL where 1';
			if($opendb->query($add_prolink_sql)){
				$add_prolink_sql = 'UPDATE `ls_products` SET `addProLink`=1 WHERE `ID`='.$id;
				if($opendb->query($add_prolink_sql)){//exit;
				}
			}
			break;
		case 'delProLink':
			$del_prolink_sql = 'UPDATE `ls_products` SET `addProLink`=NULL';
			if($opendb->query($del_prolink_sql)){//exit;
			}
			break;
		case 'addNewProLink':
			$id = $_GET['id'];
			$add_prolink_sql = 'UPDATE `ls_products` SET `addNewProLink`=NULL';
			if($opendb->query($add_prolink_sql)){
				$add_prolink_sql = 'UPDATE `ls_products` SET `addNewProLink`=1 WHERE `ID`='.$id;
				if($opendb->query($add_prolink_sql)){//exit;
				}
			}
			break;
		case 'delNewProLink':
			$del_newprolink_sql = 'UPDATE `ls_products` SET `addNewProLink`=NULL';
			if($opendb->query($del_newprolink_sql)){//exit;
			}
			break;
	}
	/************************************************************************/
	switch ($ls)
	{
		case  "sort":
			$operationId=$_GET['opid'];
			$targetId=$_GET['tgid'];
			
			$operationSql="select ID,Num from ls_products where ID=".$operationId;
			$targetSql="select ID,Num from ls_products where ID=".$targetId;
			$operationQuery=$opendb->query($operationSql);
			$targetQuery=$opendb->query($targetSql);
			$operationArray=mysqli_fetch_assoc($operationQuery);
			$targetArray=mysqli_fetch_assoc($targetQuery);
			$operationNum=$targetArray['Num'];
			$targetNum=$operationArray['Num'];
			$operationUpdateSql="update ls_products set Num=".$operationNum." where ID=".$operationId;
			$targetUpdateSql="update ls_products set Num=".$targetNum." where ID=".$targetId;
			$updateQuery=$opendb->query($operationUpdateSql);
			$updateQuery=$opendb->query($targetUpdateSql);
			
			$ls_msg="排序操作成功！";
			break;
	 	case "unenable":
			$unenable_sql="update ls_products set enable=0 where id=".$id." ";
			//echo $unenable_sql;
			$unenable_query=$opendb->query($unenable_sql);
			$ls_msg="不显示操作成功！";
			break;
		case "enable":
			$enable_sql="update ls_products set enable=1 where id=".$id." ";
			//echo $enable_sql;
			$enable_query=$opendb->query($enable_sql);
			$ls_msg="显示操作成功！";
			break;
		case 'scan':
			scancates();
			$ls_msg="扫描与修复完成！";
			break;
	}
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/admin.css" rel="stylesheet" type="text/css">
<?php
	/**************** 创建添加连接脚本用到的JS变量 ****************/
	$add_prolink_sql = 'SELECT `ID` FROM `ls_products` WHERE `addProLink`=1';
	$add_prolink=$opendb->query($add_prolink_sql);
	if(mysqli_num_rows($add_prolink)>0){
		if($add_prolink=mysqli_fetch_array($add_prolink)){
			echo '<script type="text/javascript">';
			echo 'var add_prolink_ID='.$add_prolink['ID'];
			echo '</script>';
		}
	}
	$add_newprolink_sql = 'SELECT `ID` FROM `ls_products` WHERE `addNewProLink`=1';
	$add_newprolink=$opendb->query($add_newprolink_sql);
	if(mysqli_num_rows($add_newprolink)>0){
		if($add_newprolink=mysqli_fetch_array($add_newprolink)){
			echo '<script type="text/javascript">';
			echo 'var add_newprolink_ID='.$add_newprolink['ID'];
			echo '</script>';
		}
	}
	/************************************************************************/
?>
<script type="text/javascript" src="scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/ls.js"></script>
<!--<script type="text/javascript" src="js/add_prolink.js"></script>
--><title>无标题文档</title>
<link rel="stylesheet" href="css/style2.css" />
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" >
	<tr>
<td height="18" style="border-bottom:2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">产品类别管理</font></div></td>
	</tr>
	<tr>
		<td height="" valign="top"><br>
		  <table border="0" width="100%" align="center" style="padding-bottom:6px;">
				<tr>
					<td width="32%">提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
					<td align="right" width="30%"><a href="cate.php?ls=scan&page=<?=$page?>&searchproductName=<?=$searchproductName?>">重新排序</a></td>
					<td align="right" width="16%"><img src="images/shao.gif">&nbsp;<a href="addcate.php?page=<?=$page?>&searchproductName=<?=$searchproductName?>">添加大类</a></td>
					<td align="right" width="22%"><button  type="button" style="cursor:hand;color:#fff;" value="产品页生成" onclick="location='temp_index.php?ls=products&productsall=ok'">产品页生成</button> <button  type="button" style="cursor:hand;color:#fff;" value="产品页生成" onclick="location='autobatchadd.php'">导入类别</button></td>
				</tr>
			</table>
			<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1"  bgcolor="#f0f0ee" >
				<tr height="37">
					<td align="center" height="20" width="4%">ID</td>
					<td align="center" width="4%">菜单</td>
					<td align="center" width="4%">新品</td>
					<td align="center" width="4%">类级</td>
					<td align="center" height="20" width="31%">类别名称</td>
					<td align="center"  width="31%" >Title / Description</td>
					<td align="center"  width="8%" >日期</td>
					<td align="center" colspan="2" width="4%">排序</td>
					<td align="center" colspan="3" width="4%">操作</td>
					<td align="center" width="5%">批量导</td>
					<td align="center" width="6%">显</td
						>
				</tr>
				<?php
					if($searchproductName!="") $searhprostr=" and (cateName like '%".$searchproductName."%' or midcateName like '%".$searchproductName."%' or subcateName like '%".$searchproductName."%'   ) "; 
				
					$i=1;
					$cate_sql="select * from ls_products where subcateName is null and subcateFolders is null and subcateID is null and productPic is null and productItemNo is null and productName is null and midcateName is null and productSpecification is null and productID is null ". $searhprostr." order by Num asc";
							$cate_query=$opendb->query($cate_sql);
							$cate_myrows=mysqli_num_rows($cate_query); 
							
							//缓存一个用于指示排序参数的数组
							if($cate_myrows!=0){
								$topSign=0;
								$cateNumArray=array();
								while($cateArray=mysqli_fetch_assoc($cate_query)){
									if($topSign==0){
										$prevNumId=$cateArray['ID'];
										$topSign++;
										continue;
									}
									$cateNumArray[$prevNumId]['down']=$cateArray['ID'];
									$cateNumArray[$cateArray['ID']]['up']=$prevNumId;
									$prevNumId=$cateArray['ID'];
									$topSign++;
								}
								mysqli_data_seek($cate_query,0);		//缓存结束，重置指针
							}
							
							while($cate_rows=mysqli_fetch_assoc($cate_query))
							 { ?>
							 <tr bgcolor='#f9f9f9' height='37'
							onMouseOver=
								 	this.style.backgroundColor='#e5e5e5' 
								onMouseOut=
								 	this.style.backgroundColor='#f9f9f9' 
								>
							  	<td  align=center title="<?=$cate_rows['ID']?>"><?=$cate_rows['ID']?></td>
							  	<td align="center" rel="<?=$cate_rows['ID']?>"><?php   if($cate_rows['addProLink']==1)
									{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=delProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='解绑 Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                  <?php 	}
								  if($cate_rows['addProLink']==0)
								  	{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=addProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='本类绑定 Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                <?php 	}   ?></td>
							  	<td align="center" rel="<?=$cate_rows['ID']?>"><?php   if($cate_rows['addNewProLink']==1)
									{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=delNewProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='解绑 New Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                  <?php 	}
								  if($cate_rows['addNewProLink']==0)
								  	{   ?>
                                  <a href='?id=<?=$cate_rows['ID']?>&ls=addNewProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='本类绑定 New Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                <?php 	}   ?></td>
							  	<td align="center" rel="<?=$cate_rows['ID']?>"  ><?= "B-".$cate_rows['Num']; ?></td>
						  	   <td rel="<?=$cate_rows['ID']?>"  >
							  		<img src='images/tree_cate.gif'>
						   <?php  $cateName = str_replace("''","'",$cate_rows['cateName']);
							  echo 			$cateName; ?></td>
						  	   <td  align=left><a  href='javascript:void(0);' title='<?=$cate_rows['cateTitle']?>' ><span title="<?=strip_tags($cate_rows['cateTitle'])?>" style="color: #666; font-size:10px;">.  <?=$cate_rows['cateTitle'] ?></span></a>
						  	     <br />						  	     
						  	    <a  href='javascript:void(0);' title='<?=$cate_rows['cateDescription']?>' ><span title="<?=strip_tags($cate_rows['cateDescription'])?>" style="color:#666;font-size:10px;"> .	  <?=substr($cate_rows['cateDescription'],0,240) ?></span></a></td>
							   	<td  align=center>
							 
							  	</td>
							   	<td width="34" align='center'> 
							   	  <?php  if($i!=1)
							  { ?>
							   	  <a href='?ls=sort&opid=<?=$cate_rows['ID']?>&tgid=<?=$cateNumArray[$cate_rows['ID']]['up']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='向上移动'><img src='images/up.gif' border='0'></a>
							   	  <?php } ?>						   	    </td>
							  	<td width="29" align='center'> 
							<?php if($i!=$cate_myrows)
							  { ?>
								  <a href='?ls=sort&opid=<?=$cate_rows['ID']?>&tgid=<?=$cateNumArray[$cate_rows['ID']]['down']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='向下移动'><img src='images/down.gif' border='0'></a>
							<?php } 
								
								$i++; ?>
							   </td>
									<td width="37" align='center'> 
							<?php $mid_sql = "select * from ls_products where productID=".$cate_rows['ID'];
								$mid_query = $opendb->query($mid_sql);
								$mid_myrows = mysqli_num_rows($mid_query);
								if($cate_rows['enable']==0 || $mid_myrows != 0)
								{ ?>
										<img src='images/b_unadd.gif' border='0'>
							<?php }else if($cate_rows['enable']==1)
								{ ?>
										<a href='addmidcate.php?id=<?=$cate_rows['ID']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='添加产品中类'><img src='images/b_add.gif' border='0'></a>
							<?php } ?>
								  </td>
									<td width="30" align='center'> 
										<a href='modicate.php?id=<?=$cate_rows['ID']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='编辑'><img src='images/b_edit.png' border='0'></a>
								  </td>
									<td width="41" align='center'> 
								
							<?php $midcate_sql="select * from ls_products where cateName is null and cateFolders is null and subcateName is null and subcateFolders is null and subcateID is null and productPic is null and productItemNo is null  and productName is null and productSpecification is null and productID is null and midcateID=".$cate_rows['ID']." ". $searhprostr." order by Num asc";
								$midcate_query=$opendb->query($midcate_sql);
								$midcate_myrows=mysqli_num_rows($midcate_query); 
								if($midcate_myrows==0)
								{
									$midcate2_sql="select * from ls_products where productID=".$cate_rows['ID']." order by Num desc";
									$midcate2_query=$opendb->query($midcate2_sql);
									$midcate2_myrows2=mysqli_num_rows($midcate2_query);
									if($midcate2_myrows2==0)
									{ ?>
											<a href='savecate.php?id=<?=$cate_rows['ID']?>&ls=del&page=<?=$page?>&searchproductName=<?=$searchproductName?>' onclick='return ConfirmDelCate();' title='删除'><img src='images/b_drop.png' border='0'></a>
							 <?php 	}
									else
									{ ?>
											<img src='images/b_undrop.png' border='0' alt='大类下面有产品。&#10请先删除产品。'>
							<?php 	}
								}
								else
								{  ?>
										<img src='images/b_undrop.png' border='0' alt='大类下面还有中类。&#10请先删除中类。'>
							<?php }  ?>
								
								  </td>
									<td align='center'>
						  
							<?php   if($midcate_myrows==0)
									{  ?>
										 <a href='batchadd.php?id=<?=$cate_rows['ID']?>&name=<?=urlencode($cate_rows['cateName'])?>&ls=batchadd&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='导入'><=</a>
							<?php 	}   ?>
															
									</td>
									<td align='center'>
						  
							<?php   if($cate_rows['enable']==1)
									{   ?>
										<a href='?id=<?=$cate_rows['ID']?>&ls=unenable&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='显示'><img src='images/enable.gif' border='0'></a>
							<?php 	}
								  if($cate_rows['enable']==0)
								  	{   ?>
										<a href='?id=<?=$cate_rows['ID']?>&ls=enable&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='不显示'><img src='images/unenable.gif' border='0'></a>
							<?php 	}   ?>
															
									</td>
			  </tr>
							  
							  
							<?php  if($cate_rows['enable']==1)
									{
													$j=1;
													
													//缓存一个中类的用于指示排序参数的数组
													if($midcate_myrows!=0){
														$topSignMid=0;
														$midCateNumArray=array();
														while($midCateArray=mysqli_fetch_assoc($midcate_query)){
															if($topSignMid==0){
																$prevNumIdMid=$midCateArray['ID'];
																$topSignMid++;
																continue;
															}
															$midCateNumArray[$prevNumIdMid]['down']=$midCateArray['ID'];
															$midCateNumArray[$midCateArray['ID']]['up']=$prevNumIdMid;
															$prevNumIdMid=$midCateArray['ID'];
															$topSignMid++;
														}
														mysqli_data_seek($midcate_query,0);		//缓存结束，重置指针
													}
									
										  			while($midcate_rows=mysqli_fetch_assoc($midcate_query))
													  {  ?>
															  <tr bgcolor='#f4f4f4'
															onMouseOver=
																 	this.style.backgroundColor='#e5e5e5' 
																onMouseOut=
																 	this.style.backgroundColor='#f4f4f4' 
																>
							 										<td  align=center><?=$cate_rows['ID']?></td>
							 										<td align="center"   rel="<?=$midcate_rows['ID']?>"><?php   if($midcate_rows['addProLink']==1)
																{  ?>
                                                                      <a href='?id=<?=$midcate_rows['id']?>&ls=delProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='解绑 Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                      <?php 	}   
															  if($midcate_rows['addProLink']==0)
															  	{	?>
                                                                      <a href='?id=<?=$midcate_rows['id']?>&ls=addProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='本类绑定 Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                    <?php } ?></td>
							 										<td align="center"   rel="<?=$midcate_rows['ID']?>"><?php   if($midcate_rows['addNewProLink']==1)
																{  ?>
                                                                      <a href='?id=<?=$midcate_rows['id=']?>&ls=delNewProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='解绑 New Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                      <?php 	}   
															  if($midcate_rows['addNewProLink']==0)
															  	{	?>
                                                                      <a href='?id=<?=$midcate_rows['id=']?>&ls=addNewProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='本类绑定 New Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                    <?php } ?></td>
							 										<td align="center" style='' rel="<?=$midcate_rows['ID']?>"><?=" M-".$midcate_rows['Num']?></td>
															  	<td style='padding-left:25px;' rel="<?=$midcate_rows['ID']?>">
															  		<img src='images/tree_cate.gif'>
															<?php  $midcateName = str_replace("''","'",$midcate_rows['midcateName']);
															  echo 			$midcateName; ?>
															  	</td>
															  	<td  align=center>&nbsp;</td>
															   	<td  align=center>
															  <?=substr( $midcate_rows['date'],2,8); ?>
															  	</td>
															   	<td align='center'> 
															   	  <?php   if($j!=1)
															  {  ?>
															   	  <a href='?ls=sort&opid=<?=$midcate_rows['ID']?>&tgid=<?=$midCateNumArray[$midcate_rows['ID']]['up']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='向上移动'><img src='images/up.gif' border='0'></a>
															   	  <?php }  ?>														   	    </td>
															  	<td align='center'> 
														<?php if($j!=$midcate_myrows)
															  {  ?>
																  <a href='?ls=sort&opid=<?=$midcate_rows['ID']?>&tgid=<?=$midCateNumArray[$midcate_rows['ID']]['down']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='向下移动'><img src='images/down.gif' border='0'></a>
														<?php 	}
																$j++;  ?>

																  </td>
																	<td align='center'> 
															<?php 
															if($ifsubcate){ 
																$sub_sql = "select * from ls_products where productID=".$midcate_rows['ID'];
																$sub_query = $opendb->query($sub_sql);
																$sub_myrows = mysqli_num_rows($sub_query);
																if($sub_myrows != 0){  ?>
																	<img src='images/b_unadd.gif' border='0'>
															<?php }else{   ?>
																			<a href='addsubcate.php?id=<?=$midcate_rows['ID']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='添加产品小类'><img src='images/b_add.gif' border='0'></a>
															<?php }  } //ifsubcate?>
																  </td>
																	<td align='center'> 
																		<a href='modimidcate.php?id=<?=$midcate_rows['ID']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='编辑'><img src='images/b_edit.png' border='0'></a>
																  </td>
																	<td align='center'> 
																
														<?php 	$subcate_sql="select * from ls_products where cateName is null and cateFolders is null and midcateName is null and midcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and subcateID=".$midcate_rows['ID']." ". $searhprostr."  order by Num asc";
																$subcate_query=$opendb->query($subcate_sql);
																$subcate_myrows=mysqli_num_rows($subcate_query); 
																 
																
						
																if($subcate_myrows==0)
																{
																	$subcate2_sql="select * from ls_products where productID=".$midcate_rows['ID']." order by Num desc";
																	$subcate2_query=$opendb->query($subcate2_sql);
																	$subcate_myrows2=mysqli_num_rows($subcate2_query);
																	if($subcate_myrows2==0)
																	{  ?>
																			<a href='savemidcate.php?id=<?=$midcate_rows['ID']?>&ls=del&page=<?=$page?>&searchproductName=<?=$searchproductName?>' onclick='return ConfirmDelCate();' title='删除'><img src='images/b_drop.png' border='0'></a>
															<?php 	}
																	else
																	{  ?>
																			<img src='images/b_undrop.png' border='0' alt='中类下面有产品。&#10请先删除产品。'>
															<?php 	}
																}
																else
																{  ?>
																		<img src='images/b_undrop.png' border='0' alt='中类下面还有小类。&#10请先删除小类。'>
															<?php }  ?>

																  </td>
									<td align='center'>
						  
							<?php   if($subcate_myrows==0)
									{	?>
										<a href='batchadd.php?id=<?=$midcate_rows['ID']?>&name=<?=urlencode($midcate_rows['midcateName'])?>&ls=batchadd&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='导入'><=</a>
							<?php 	}   ?>
															
									</td>
																	<td align='center'>

														<?php   if($midcate_rows['enable']==1)
																{  ?>
																<a href='?id=<?=$midcate_rows['ID']?>&ls=unenable&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='显示'><img src='images/enable.gif' border='0'></a>
														<?php 	}   
															  if($midcate_rows['enable']==0)
															  	{	?>
																<a href='?id=<?=$midcate_rows['ID']?>&ls=enable&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='不显示'><img src='images/unenable.gif' border='0'></a>
															<?php } ?>
															
																	</td>
																  </tr>
								
															  

															<?php if($cate_rows['enable']==1)
																{
																	$k=1;
																	
																	//缓存一个小类的用于指示排序参数的数组
																	
																	if($subcate_myrows!=0){
																		$topSignSub=0;
																		$subCateNumArray=array();
																		while($subCateArray=mysqli_fetch_assoc($subcate_query)){
																			if($topSignSub==0){
																			   $prevNumIdSub=$subCateArray['ID'];
																			   $topSignSub++;
																			   continue;
																			}
																			
																			$subCateNumArray[$prevNumIdSub]['down']=$subCateArray['ID'];
																			$subCateNumArray[$subCateArray['ID']]['up']=$prevNumIdSub;
																			$prevNumIdSub=$subCateArray['ID'];
																			$topSignSub++;
																		}
																		mysqli_data_seek($subcate_query,0);		//缓存结束，重置指针
																	}
																	
														  			while($subcate_rows=mysqli_fetch_assoc($subcate_query))
																	  {	?>
																		  <tr bgcolor='#f4f4f4'
																		onMouseOver=
																		 	this.style.backgroundColor='#e5e5e5' 
																		onMouseOut=
																		 	this.style.backgroundColor='#f4f4f4' 
																		>
							  												<td  align=center>&nbsp;</td>
							  												<td align="center"   rel="<?=$subcate_rows['ID']?>"><?php   if($subcate_rows['addProLink']==1)
																			{	?>
                                                                              <a href='?id=<?=$subcate_rows['id=']?>&ls=delProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='解绑 Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                              <?php }	
																		  if($subcate_rows['addProLink']==0)
																		  	{	?>
                                                                              <a href="?id=<?=$subcate_rows['ID']?>&ls=addProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>" title='本类绑定 Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                            <?php } ?></td>
							  												<td align="center"   rel="<?=$subcate_rows['ID']?>"><?php   if($subcate_rows['addNewProLink']==1)
																			{	?>
                                                                              <a href='?id=<?=$subcate_rows['ID']?>&ls=delNewProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='解绑 New Product 菜单'><img src='images/enable.gif' border='0' /></a>
                                                                              <?php }	
																		  if($subcate_rows['addNewProLink']==0)
																		  	{	?>
                                                                              <a href="?id=<?=$subcate_rows['ID']?>&amp;ls=addNewProLink&page=<?=$page?>&searchproductName=<?=$searchproductName?>" title='本类绑定 New Product 菜单'><img src='images/unenable.gif' border='0' /></a>
                                                                            <?php } ?></td>
							  												<td align="center" style='' rel="<?=$subcate_rows['ID']?>"><?=	"S-".$subcate_rows['Num'];?></td>
																		  	<td style='padding-left:35px;' rel="<?=$subcate_rows['ID']?>">
																		  		&nbsp; <img src='images/tree_cate.gif'>
																		<?php  $subcateName = str_replace("''","'",$subcate_rows['subcateName']);
																		  echo 			$subcateName; ?>
																		  	</td>
																		  	<td  align=center>&nbsp;</td>
																		   	<td  align=center>
							  												<?= substr( $subcate_rows['date'],2,8);?>
																		  	</td>
																		   	<td align='center'> 
																		   	  <?php   if($k!=1)
															 				 {  ?>
																		   	  <a href='?ls=sort&opid=<?=$subcate_rows['ID']?>&tgid=<?=$subCateNumArray[$subcate_rows['ID']]['up']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='向上移动'><img src='images/up.gif' border='0'></a>
																		   	  <?php }	?>																	   	    </td>
																		  	<td align='center'> 
																		<?php if($k!=$subcate_myrows)
															 				 {	?>
																			  <a href='?ls=sort&opid=<?=$subcate_rows['ID']?>&tgid=<?=$subCateNumArray[$subcate_rows['ID']]['down']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='向下移动'><img src='images/down.gif' border='0'></a>
																		<?php }
																			
																			$k++;  ?>
																			  </td>
																				<td align='center'> 
																			
																			  </td>
																				<td align='center'> 
																					<a href='modisubcate.php?id=<?=$subcate_rows['ID']?>&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='编辑'><img src='images/b_edit.png' border='0'></a>
																			  </td>
																				<td align='center'> 
																
																	
																	<?php 	$products_sql="select * from ls_products where cateName is null and cateFolders is null and subcateName is null and subcateFolders is null and subcateID is null and midcateName is null and midcateID is null and productID=".$subcate_rows['ID']." order by Num desc ";													
																			$products_query=$opendb->query($products_sql);
																			$products_num=mysqli_num_rows($products_query);
																			if($products_num!=0)
																			{	?>
																						<img src='images/b_undrop.png' border='0' alt='小类下面还有产品。&#10请先删除产品。'>
																		<?php }
																			else
																			{
																			  ?>		 <a href='savesubcate.php?id=<?=$subcate_rows['ID']?>&ls=del&page=<?=$page?>&searchproductName=<?=$searchproductName?>' onclick='return ConfirmDelSubCate();' title='删除'><img src='images/b_drop.png' border='0'></a>
																		<?php } ?>
																			  </td>
									<td align='center'>
										<a href=batchadd.php?id=<?=urlencode($subcate_rows['ID'])?>&ls=batchadd title='导入'><=</a>
									</td>
																				<td align='center'>
																		<?php   if($subcate_rows['enable']==1)
																			{	?>
																			<a href='?id=<?=$subcate_rows['ID']?>&ls=unenable&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='显示'><img src='images/enable.gif' border='0'></a>
																		<?php }	
																		  if($subcate_rows['enable']==0)
																		  	{	?>
																			<a href='?id=<?=$subcate_rows['ID']?>&ls=enable&page=<?=$page?>&searchproductName=<?=$searchproductName?>' title='不显示'><img src='images/unenable.gif' border='0'></a>
																		<?php } ?>
																				</td>
																		  </tr>
															  
											<?php 	}
						
						
						
									}
															  
															  
															  
							}
			}
							
							  
							  
} ?>
			</table></td>
	</tr>
</table> <table align="center"  cellpadding="4px;" style="width:100%;background-color:#f0f0ee"><tr>
						<td width="100%" height="41" align="right">
  <form name="searcharticle" method="Post" action="?selectcate=<?=$selectcate?>&selectfunctionName=<?=$selectfunctionName?>" style=" padding-top:6px;">
				  <div align="right" style=" width:98%"><span style="padding-left:6px;">
			      <input type="text" name="searchproductName" size="16" maxlength="50"  value="" />
			      <input type='submit'    value="查询" style="height:24px;"    />			      <input type='button'    value="全部" style="height:24px;"  onclick="this.form.searchproductName.value='';this.form.submit();"   />

			      </span>  
			      </div>
				</form> </td>
						<td width="2%" align="right">&nbsp;</td>
						</tr>
			      </table>

                       <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
                       <tr>
                        <td colspan="2" height="24" align="center">&nbsp;</td>
                      </tr>
                       </table>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1"  style="background-color: #f0f0ee;">
  <tr bgcolor="#f0f0ee">
    <td height="37" align="center" ><form name="fmconfig" method="post" enctype="multipart/form-data"  action="?page=<?=$page?>&searchproductName=<?=$searchproductName?>">
<fieldset class="lsconeditorsfield"  >
							<legend>产品综述</legend><div class="lsconeditorarea">
							<div  align="center" style="padding-left:30px;">  
							  <p>
							    <textarea name="skype3"  rows="5"   style=" width:96%;"><?php echo $config_row['skype3'];?></textarea>
						        <br />
						        <?=$promlv>1?$brief_tips:""?>
							  </p>
							  <p><button name="submit" type="submit" value="保存" class="submitbuttonsf4">保存</button></p>
</div>
						</fieldset>
                        </form>
                        </td>
  </tr>
	<tr>
		<td valign="top"> <br>
			<table border="0" width="100%" align="center">
				<tr>
					<td><ul>
							<li> <img src="images/b_add.gif"> 添加小类 <img src="images/b_unadd.gif"> 不能添加小类 </li>
							<li> <img src="images/b_edit.png"> 修改/编辑 </li>
							<li> <img src="images/b_drop.png"> 删除 <img src="images/b_undrop.png"> 不能删除 </li>
							<li> &lt;=  &nbsp;批量导入产品图 </li>
							<li> <img src="images/enable.gif"> 显示<br>
								<img src="images/unenable.gif"> 不显示 大类不显示后，大类下小类及产品都不显示。 </li>
							<li> 扫描并纠正错误将重置类别顺序。可以在扫描完成后重新调整顺序。 </li>
						</ul></td>
				</tr>
			</table>
			<br></td>
	</tr>
</table>
</body>
</html>