<?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>
                <tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成所有单页页面"  style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=singlepage';"></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'">
						<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?>';" /></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); 
							$b=1;
							$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; } 
							   ?>
							   	<tr bgcolor='#A4B6D7'
								onMouseOver=
									 	this.style.backgroundColor='#CCFFCC' 
									onMouseOut=
									 	this.style.backgroundColor='#A4B6D7' 
									>
							   	  <td width="7%" style='padding-left:15px;'><?= "B-". $b ?></td>
								  	<td width="30%">
								  		<img src='images/tree_cate.gif'>
							  		  <?=			$cate_rows['cateName']?>
								  	</td>
								  	<td width="63%"><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?>';">
</td>
					  </tr>
								
								<?php
								$m=1;

							   while($midcate_rows=mysql_fetch_assoc($midcate_query))
							  { ?>

									<tr bgcolor='#f4f4f4'
									onMouseOver=
									 	this.style.backgroundColor='#CCFFCC' 
									onMouseOut=
									 	this.style.backgroundColor='#f4f4f4' 
									>
									  <td style='padding-left:15px;'><?=	 "M-".$b."-".$m?></td>
										<td style='padding-left:15px;'>
											&nbsp; &nbsp;<img src='images/tree_midcate.gif'>
										  <?=			$midcate_rows['midcateName']?>
										</td>
										<td>
											<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?>';">
										</td>
									</tr>
									<?php
									
									$s=1;

							 	 	$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";
									$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))
									{ ?>					
										<tr bgcolor='#f4f4f4'
										onMouseOver=
										 	this.style.backgroundColor='#CCFFCC' 
										onMouseOut=
										 	this.style.backgroundColor='#f4f4f4' 
										>
										  <td style='padding-left:15px;'><?="S-".$b."-".$m."-".$s?></td>
											<td style='padding-left:15px;'>
										&nbsp; &nbsp;&nbsp; &nbsp; 		<img src='images/tree_subcate.gif'>&nbsp;
										<?=			$subcate_rows['subcateName']?>
											</td>
											<td>
												<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?>';">
											</td>
										</tr>
								<?php		$s++;   } 

								$m++;   } 
					$b++;	 } 
						?>
						</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>常见问题(FAQ)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成常见问题(FAQ)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=faq';"></td>
				</tr>
              <tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>博客(Blog)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成博客(Blog)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=blog';"></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>视频(Vidio)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成视频 (Vidio)" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=video';"></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>项目(Projects)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成项目(Projects)" 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>-->
                <tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>认证证书和质量控制(C&Q Control)模板设置</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="认证证书和质量控制(C&Q Control)" 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>生成.htaccess文件</b></li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td  style="padding-left:40px;" ><input type="button" value="生成.htaccess" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=htaccess';"></td>
				</tr>-->
				<?php
							break;
							case "mobile":
				?>
				<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_m';"></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_m';"></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_m';"></td>
				</tr>
				<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_m';"></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="生成终端联系我们" style="cursor:hand;color:#0000FF;" onClick="JavaScript:location='temp_index.php?ls=contact_m';"></td>
				</tr>
                <tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>终端产品页面 (Products) 模板设置</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=products_m';"></td>
				</tr>
				<tr bgcolor="#B9DAFF">
					<?
							 $m_allcreatedfiles=" ";
							foreach($m_generalCreateFiles as $m_createdfile ) {
   								$m_allcreatedfiles.= ($m_createdfile.",");
							}

							?>
					<td style="padding-left:20px;" ><li><b>移动端非主菜单页面模板设置<? echo $m_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_m';" /></td>
				</tr>
				<? 
						break;
						}
				?>
			</table>
	  <br></td>
	</tr>
</table>
</body>
</html>