<?php
	session_start();
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');
	
	$ls=$_GET['ls'];
	
	
?>
<!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">
<script language="JavaScript" src="js/ls.js"></script>
<title>无标题文档</title>
</head>
<body>
<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
	<tr>
		<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>模板管理</strong></font></div></td>
	</tr>
	<tr>
		<td height="213" valign="top" bgcolor="#dee7ff"><br>
			<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
				<?php
					switch($ls)	
					{
							case "normal":
				?>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b><font color="#0000FF">整站生成</font></b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
				  <td  style="padding-left:40px;" ><input type="button" value="生成整站" style="cursor:hand;color:#FF0000;" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok';" />				    
				      &lt;&lt; 含产品页  </td>
			  </tr>
				<tr bgcolor="#F4F4F4">
				  <td  style="padding-left:40px;" ><input type="button" value="生成整站" style="cursor:hand;color:#FF0000;" onclick="JavaScript:location='temp_index.php?ls=all';" />
				      &lt;&lt;   不含产品页，产品很多时（&gt;600个）避免超时。 </td>
			  </tr>
				<tr bgcolor="#F4F4F4">
				  <td  style="padding-left:40px;" > 
				    <input  type="button" style="cursor:hand;color:#0000FF;" value="生成全部产品页" onclick="JavaScript:location='temp_index.php?ls=products&amp;productsall=ok'" />
				     </td>
			  </tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>首页(Home)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成首页(Home)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=index';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>关于我们(About Us)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成关于我们(About Us)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=aboutus';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>反馈(Feedbadk)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成反馈(Feedbadk)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=feedback';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>联系我们(Contact Us)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成联系我们(Contact Us)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=contactus';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<?
							 $allcreatedfiles=" ";
							foreach($generalCreateFiles as $createdfile ) {
   								$allcreatedfiles.= ($createdfile.",");
							}

							?>
					<td style="padding-left:20px;" ><li><b>非主菜单页面模板设置<? echo $allcreatedfiles ?></b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成主菜单外其他页面"  style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=nomenufiles';"></td>
				</tr>
				<?php
							break;
							case "products"	:
						?>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>产品管理(Products)模板设置</b></li>
						<input  type="button" style="cursor:hand;color:#0000FF;" value="生成全部产品页" onClick="JavaScript:location='temp_index.php?ls=products&productsall=ok'"></td>
				</tr>
				<tr>
					<td><table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
							<?php
							$cate_sql="select * from ls_products where  midcateName is null and  midcateID is null and  subcateName is null and subcateFolders is null and subcateBrief 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 enable=1 order by Num asc";
							$cate_query=$opendb->query($cate_sql);
							$i=0;	//start replace 鼠标悬停菜单
							while($cate_rows=mysql_fetch_assoc($cate_query))
							 {
							   $midcate_sql="select * from ls_products where cateName is null and subcateName is null and subcateFolders is null and subcateBrief 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']." and  enable=1 order by Num asc";
							   $midcate_query=$opendb->query($midcate_sql);
							   $midcate_num=mysql_num_rows($midcate_query);
							   if($midcate_num!=0)	// cate has midcate
							   {
							   		$i++;
									$menuListscateid=$i;
							   }
							   else{$menuListscateid=0;}
							   	echo "<tr bgcolor='#A4B6D7'";
								echo "onMouseOver=";
									echo " 	this.style.backgroundColor='#CCFFCC' \n";
									echo "onMouseOut=\n";
									echo " 	this.style.backgroundColor='#A4B6D7' ";
									echo ">\n";
								  echo "	<td>\n";
								  echo "		<img src='images/tree_cate.gif'>\n";
								  echo 			$cate_rows['cateName'];
								  echo "	</td>\n";
								  echo "	<td>\n";
								  echo "		<input type=\"button\" style=\"cursor:hand;color:#0000FF;\" value=\"生成大类".str_replace("\"","``",str_replace("\'","`",$cate_rows['cateName']))."下所有产品\" onclick=\"JavaScript:location='temp_index.php?ls=products&cateid=".$cate_rows['ID']."&cateFolders=".urlencode($cate_rows['cateFolders'])."&menuListscateid=".$menuListscateid."';\">\n";
								  echo "	</td>\n";
									echo "</tr>\n";
								
								
							   while($midcate_rows=mysql_fetch_assoc($midcate_query))
							  {

									echo "<tr bgcolor='#f4f4f4'\n";
									echo "onMouseOver=";
									echo " 	this.style.backgroundColor='#CCFFCC' \n";
									echo "onMouseOut=\n";
									echo " 	this.style.backgroundColor='#f4f4f4' ";
									echo ">\n";
									echo "	<td style='padding-left:15px;'>\n";
									echo "		<img src='images/tree_midcate.gif'>\n";
									echo 			$midcate_rows['midcateName'];
									echo "	</td>\n";
									echo "	<td>\n";
									echo "		<input type=\"button\" style=\"cursor:hand;color:#0000FF;\" value=\"生成中类".str_replace("\"","``",str_replace("\'","`",$midcate_rows['midcateName']))."下所有产品\" onclick=\"JavaScript:location='temp_index.php?ls=products&midcateid=".$midcate_rows['ID']."&midcateFolders=".urlencode($midcate_rows['midcateFolders'])."&cateid=".$cate_rows['ID']."&cateFolders=".urlencode($cate_rows['cateFolders'])."&menuListscateid=".$menuListscateid."';\">\n";
									echo "	</td>\n";
									echo "</tr>\n";
									
							 	 	$subcate_sql="select * from ls_products where cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief 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']." and enable=1 order by Num asc\n";
									$subcate_query=$opendb->query($subcate_sql);
									$myrows=mysql_num_rows($subcate_query);
									$mynum=mysql_num_rows($subcate_query);

									while($subcate_rows=mysql_fetch_assoc($subcate_query))
									{					
										echo "<tr bgcolor='#f4f4f4'\n";
										echo "onMouseOver=";
										echo " 	this.style.backgroundColor='#CCFFCC' \n";
										echo "onMouseOut=\n";
										echo " 	this.style.backgroundColor='#f4f4f4' ";
										echo ">\n";
										echo "	<td style='padding-left:15px;'>\n";
										echo "&nbsp;&nbsp;		<img src='images/tree_subcate.gif'>&nbsp;\n";
										echo 			$subcate_rows['subcateName'];
										echo "	</td>\n";
										echo "	<td>\n";
										echo "		<input type=\"button\" style=\"cursor:hand;color:#0000FF;\" value=\"生成小类".str_replace("\"","``",str_replace("\'","`",$subcate_rows['subcateName']))."下所有产品\" onclick=\"JavaScript:location='temp_index.php?ls=products&subcateid=".$subcate_rows['ID']."&subcateFolders=".urlencode($subcate_rows['subcateFolders'])."&midcateid=".$midcate_rows['ID']."&midcateFolders=".urlencode($midcate_rows['midcateFolders'])."&cateid=".$cate_rows['ID']."&cateFolders=".urlencode($cate_rows['cateFolders'])."&menuListscateid=".$menuListscateid."';\">\n";
										echo "	</td>\n";
										echo "</tr>\n";
									  }

								  }
						}
						?>
						</table></td>
				</tr>
				<?php
								break;
							 case "other":
								
						?>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>新闻(News)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成新闻(News)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=news';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>下载(Download)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成下载(Download)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=download';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>管理团队(Management)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成管理团队(Management)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=management';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>车间图片(Workshop)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成车间图片(Workshop)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=workshop';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>质量控制(Quality Control)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成质量控制(Quality Control)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=qualitycontrol';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>研发(R&D)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成研发(R&D)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=rd';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>证书(Certificate)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成证书(Certificate)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=certificate';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>包装(Packing)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成包装(Packing)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=packing';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>品牌(Brand)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成品牌(Brand)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=brand';"></td>
				</tr>
				<?php
							break;
							}
						?>
			</table>
	  <br></td>
	</tr>
</table>
</body>
</html>