<?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/jquery.js"></script>
<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="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
				<?php
				switch($ls)	
				{
					case "translate":
					?>
				<tr bgcolor="#B9DAFF">
					<td style="padding-left:20px;" ><li><b>多语种生成</b>
					<?php
					$ls=$_POST['ls'];
					  
					if ($ls=="modi"){
						$languages = "";
						$language = $_POST['language'];  //获取的多选框的值，为一个数组，通过下面的foreach对数据进行操作
						$urlTranslate = $_POST['urlTranslate'];  //获取提交的URL前缀值
						if(substr($urlTranslate, -1) != '/'){
							$urlTranslate2 = $urlTranslate."/";
						}else{
							$urlTranslate2 = $urlTranslate;
						}
						$languages .= count($language);
						writeconstant("mutiLangDomianFlag", $urlTranslate2, "str");
						if($language != null){
							foreach($language as $employee_id) {
								$languages .= $employee_id;
							}
						}
						$modi_sql=sprintf("update ls_config set language=%s",
							GetSQLValueString($languages, "text")
						);
						$modi_query=$opendb->query($modi_sql);
					}
					  
					$config_sql="select * from ls_config ";
					$config_query=$opendb->query($config_sql);
					$config_rows=mysql_fetch_assoc($config_query);
					?>
					</li></td>
				</tr>
				<tr bgcolor="#F4F4F4">
					<td>
                    <form id="fmconfig" name="fmconfig" method="post" enctype="multipart/form-data"  action="<?php echo $PHP_SELF;?>">
                      <table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
                        <script>
								function plan01(){
									var str = '';
								   $(".plan01").each(function(){
										if($(this).is(':checked')){
											str += $(this).val();
										}
									});
								   return str;
								};
								
								function checkPlan01(){
									$(".plan01").each(function(){
										if($(".checkPlan01").is(':checked')){
											$(this).attr("checked",true);
										}else{
											$(this).attr("checked",false);
										}
									});
								}
								
								function unCheck01(){
									if($(".checkPlan01").is(':checked')){
										$(".checkPlan01").attr("checked",false);
									}
								}
								</script>
                        <tr bgcolor='#eee'>
                          <td><input type="hidden" name="ls" value="modi" /></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td  bgcolor='#eee' style='padding-left:5px;'><input type="button" value="生成第1套" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate='+plan01();" /></td>
                          <td  bgcolor='#eee' style='padding-left:15px;'><?php 
								$lan = $config_rows['language'];
							?>
                            <input class="plan01" id="lan1" name="language[]" type="checkbox" value="fr" <? if(strpos($lan,"fr")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();" />
                            <img src="img/gq/france.jpg" alt="" height="16" />
                            <input id="french" type="button" value="法语" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=fr';" />
                            <input id="french" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=fr';" />
                            <input class="plan01" id="lan2" name="language[]" type="checkbox" value="de" <? if(strpos($lan,"de")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/germany.jpg" alt="" height="16" />
                            <input id="german" type="button" value="德语" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=de';" />
                            <input id="french2" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=de';" />
                            <input class="plan01" id="lan3" name="language[]" type="checkbox" value="ru" <? if(strpos($lan,"ru")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/russia.jpg" alt="" height="16" />
                            <input type="button" value="俄语" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=ru';" />
                            <input type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=ru';" />
                            <input class="plan01" id="lan4" name="language[]" type="checkbox" value="it" <? if(strpos($lan,"it")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/italy.jpg" alt="" height="16" />
                            <input type="button" value="意大利" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=it';" />
                            <input type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=it';" />
                            <input class="plan01" id="lan5" name="language[]" type="checkbox" value="pt" <? if(strpos($lan,"pt")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/portuguese.jpg" alt="" height="16" />
                            <input type="button" value="葡萄牙" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=pt';" />
                            <input id="french3" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=pt';" />
                            <input class="plan01" id="lan6" name="language[]" type="checkbox" value="es" <? if(strpos($lan,"es")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/spain.jpg" alt="" height="16" />
                            <input type="button" value="西班牙" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=es';" />
                            <input id="french4" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=es';" />
                            <input class="plan01" id="lan7" name="language[]" type="checkbox" value="ja" <? if(strpos($lan,"jp")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/japan.jpg" alt="" height="16" />
                            <input type="button" value="日语" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=jp';" />
                            <input id="french5" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=jp';" />
                            <input class="plan01" id="lan8" name="language[]" type="checkbox" value="ko" <? if(strpos($lan,"ko")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/korea.jpg" alt="" height="16" />
                            <input type="button" value="韩语" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=ko';" />
                            <input id="french6" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=ko';" />
                            <input class="plan01" id="lan9" name="language[]" type="checkbox" value="ar" <? if(strpos($lan,"ar")) echo "checked=\"checked\""; ?> onclick="unCheck01();$('#fmconfig').submit();"/>
                            <img src="img/gq/united Arab Emirates.jpg" alt="" height="16" />
                            <input type="button" value="阿拉伯" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=ar';" />
                            <input type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=ar';" />
                            <label>
                              <input class="checkPlan01" name="language[]" type="checkbox" value="checkPlan01" <? if(strpos($lan,"checkPlan01")) echo "checked=\"checked\""; ?>  onclick="checkPlan01();$('#fmconfig').submit();"/>
                              全选</label></td>
                        </tr>
                        <tr bgcolor='#eee'>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <script>
								function plan02(){
									var str2 = '';
								   $(".plan02").each(function(){
										if($(this).is(':checked')){
											str2 += $(this).val();
										}
									});
								   return str2;
								};
								function checkPlan02(){
									$(".plan02").each(function(){
										if($(".checkPlan02").is(':checked')){
											$(this).attr("checked",true);
										}else{
											$(this).attr("checked",false);
										}
									});
								}
								function unCheck02(){
									if($(".checkPlan02").is(':checked')){
										$(".checkPlan02").attr("checked",false);
									}
								}
								</script>
                        <tr bgcolor='#F0F0F0'
                                onmouseover=
                                    "this.style.backgroundColor='#CCFFCC'" 
                                onmouseout=
                                    "this.style.backgroundColor='#F0F0F0'" 
                                >
                          <td style='padding-left:5px;'><input type="button" value="生成第2套" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate='+plan02();" /></td>
                          <td style='padding-left:15px;'><input class="plan02" id="lan10" name="language[]" type="checkbox" value="nl" <? if(strpos($lan,"nl")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/netherlands.jpg" alt="" height="16" />
                            <input type="button" value="荷兰" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=nl';" />
                            <input id="french7" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=nl';" />
                            <input class="plan02" id="lan11" name="language[]" type="checkbox" value="sv" <? if(strpos($lan,"sv")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/sweden.jpg" alt="" height="16" />
                            <input type="button" value="瑞典" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=sv';" />
                            <input id="french8" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=sv';" />
                            <input class="plan02" id="lan12" name="language[]" type="checkbox" value="no" <? if(strpos($lan,"no")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/norway.jpg" alt="" height="16" />
                            <input type="button" value="挪威" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=no';" />
                            <input id="french9" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=no';" />
                            <input class="plan02" id="lan13" name="language[]" type="checkbox" value="pl" <? if(strpos($lan,"pl")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/poland.jpg" alt="" height="16" />
                            <input type="button" value="波兰" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=pl';" />
                            <input id="french10" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=pl';" />
                            <input class="plan02" id="lan14" name="language[]" type="checkbox" value="cs" <? if(strpos($lan,"cs")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/czech.jpg" alt="" height="16" />
                            <input type="button" value="捷克" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=cs';" />
                            <input id="french11" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=cs';" />
                            <input class="plan02" id="lan15" name="language[]" type="checkbox" value="hu" <? if(strpos($lan,"hu")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/hungary.jpg" alt="" height="16" />
                            <input type="button" value="匈牙利" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=hu';" />
                            <input id="french12" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=hu';" />
                            <input class="plan02" id="lan16" name="language[]" type="checkbox" value="uk" <? if(strpos($lan,"uk")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/ukraine.jpg" alt="" height="16" />
                            <input type="button" value="乌克兰" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=uk';" />
                            <input id="french13" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=uk';" />
                            <input class="plan02" id="lan17" name="language[]" type="checkbox" value="vi" <? if(strpos($lan,"vi")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/vietnam.jpg" alt="" height="16" />
                            <input type="button" value="越南" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=vi';" />
                            <input id="french14" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=vi';" />
                            <input class="plan02" id="lan18" name="language[]" type="checkbox" value="ms" <? if(strpos($lan,"ms")) echo "checked=\"checked\""; ?> onclick="unCheck02();$('#fmconfig').submit();"/>
                            <img src="img/gq/malaysia.jpg" alt="" height="16" />
                            <input type="button" value="马来西亚" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=ms';" />
                            <label>
                              <input id="french15" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=ms';" />
                              <input class="checkPlan02" name="language[]" type="checkbox" value="checkPlan02" <? if(strpos($lan,"checkPlan02")) echo "checked=\"checked\""; ?>  onclick="checkPlan02();$('#fmconfig').submit();"/>
                              全选</label></td>
                        </tr>
                        <tr bgcolor='#eee'>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <script>
								function plan03(){
									var str3 = '';
								   $(".plan02").each(function(){
										if($(this).is(':checked')){
											str3 += $(this).val();
										}
									});
								   return str3;
								};
								function checkPlan03(){
									$(".plan03").each(function(){
										if($(".checkPlan03").is(':checked')){
											$(this).attr("checked",true);
										}else{
											$(this).attr("checked",false);
										}
									});
								}
								function unCheck03(){
									if($(".checkPlan03").is(':checked')){
										$(".checkPlan03").attr("checked",false);
									}
								}
								</script>
                        <tr bgcolor='#F0F0F0'
                                    onmouseover=
                                        "this.style.backgroundColor='#CCFFCC'" 
                                    onmouseout=
                                        "this.style.backgroundColor='#F0F0F0'" 
                                    >
                          <td style='padding-left:5px;'><input type="button" value="生成第3套" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate='+plan03();" /></td>
                          <td style='padding-left:15px;'><input class="plan03" id="lan19" name="language[]" type="checkbox" value="da" <? if(strpos($lan,"da")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/denmark.jpg" alt="" height="16" />
                            <input type="button" value="丹麦" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=da';" />
                            <input id="french16" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=da';" />
                            <input class="plan03" id="lan20" name="language[]" type="checkbox" value="fi" <? if(strpos($lan,"fi")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/finland.jpg" alt="" height="16" />
                            <input type="button" value="芬兰" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=fi';" />
                            <input id="french17" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=fi';" />
                            <input class="plan03" id="lan21" name="language[]" type="checkbox" value="el" <? if(strpos($lan,"el")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/greece.jpg" alt="" height="16" />
                            <input type="button" value="希腊" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=el';" />
                            <input id="french18" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=el';" />
                            <input class="plan03" id="lan22" name="language[]" type="checkbox" value="tr" <? if(strpos($lan,"tr")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/turkey.jpg" alt="" height="16" />
                            <input type="button" value="土耳其" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=tr';" />
                            <input id="french19" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=tr';" />
                            <input class="plan03" id="lan23" name="language[]" type="checkbox" value="ro" <? if(strpos($lan,"ro")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/romania.jpg" alt="" height="16" />
                            <input type="button" value="罗马尼亚" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=ro';" />
                            <input id="french20" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=ro';" />
                            <input class="plan03" id="lan24" name="language[]" type="checkbox" value="bg" <? if(strpos($lan,"bg")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/bulgaria.jpg" alt="" height="16" />
                            <input type="button" value="保加利亚" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=bg';" />
                            <input id="french21" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=bg';" />
                            <input class="plan03" id="lan25" name="language[]" type="checkbox" value="hr" <? if(strpos($lan,"hr")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/croatia.jpg" alt="" height="16" />
                            <input type="button" value="克罗地亚" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=hr';" />
                            <input id="french22" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=hr';" />
                            <input class="plan03" id="lan26" name="language[]" type="checkbox" value="id" <? if(strpos($lan,"id")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/indonesia.jpg" alt="" height="16" />
                            <input type="button" value="印尼" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=id';" />
                            <input id="french23" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=id';" />
                            <input class="plan03" id="lan27" name="language[]" type="checkbox" value="th" <? if(strpos($lan,"th")) echo "checked=\"checked\""; ?> onclick="unCheck03();$('#fmconfig').submit();"/>
                            <img src="img/gq/thailand.jpg" alt="" height="16" />
                            <input type="button" value="泰语" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate=th';" />
                            <input id="french24" type="button" value="p" onclick="JavaScript:location='temp_index.php?ls=all&amp;translate=th';" />
                            <label>
                              <input class="checkPlan03" name="language[]" type="checkbox" value="checkPlan03" <? if(strpos($lan,"checkPlan03")) echo "checked=\"checked\""; ?>  onclick="checkPlan03();$('#fmconfig').submit();"/>
                              全选</label></td>
                        </tr>
                        <tr bgcolor='#eee'>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr bgcolor='#eee'>
                          <td align="center">URL前缀：</td>
                          <td style="padding-left:15px;"><input type="text" value="<?php if($_POST['urlTranslate'] != ''){ echo $urlTranslate2;}else{ echo $mutiLangDomianFlag;} ?>" name="urlTranslate" class="ifinfoinputshort" style="width:90%" onblur="$('#fmconfig').submit();" /></td>
                        </tr>
                        <tr bgcolor='#eee'>
                          <td>&nbsp;</td>
                          <td style="padding-left:15px;">如：http://en.lanscned.com/</td>
                        </tr>
                        <script>
									function planAll(){
										var strAll = '';
										for(var i=1; i<=27; i++){
											if($("#lan"+i).is(':checked')){
												strAll += $("#lan"+i).val();
											}
										}
									   return strAll;
									};
									</script>
                        <tr bgcolor="#B9DAFF">
                          <td colspan="2" align="center"><input type="button" value="生成选中的整套" onclick="JavaScript:location='temp_index.php?ls=all_products&amp;productsall=ok&amp;translate='+planAll();" /></td>
                        </tr>
                      </table>
                    </form>
                    </td>
				</tr>
				<?php
							break;
						}
				?>
			</table>
	  <br></td>
	</tr>
</table>
</body>
</html>