<?php 
	session_start(); 

	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/seotips.php');
	
	require_once('inc/admin.class.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');
	
	$id=$_GET['id'];
	$cateid=$_GET['cateid'];
	$midcateid=$_GET['midcateid'];
	$subcateid=$_GET['subcateid'];
	$page=$_GET['page'];
	$ls_msg="修改产品".$id;
	
	$lan = array();
	if($lang != "en"){
		$lan = $lang_cn;
	}else{
		$lan = $lang_en;
	}
	$admininfo = $admin->getInfo();
	//评论
	$comment_id=$_GET['comment_id'];
	$ls=$_GET['ls'];
	
	switch ($ls){
		case "pubpic":
			$pubpic=htmlspecialchars($_POST['pubpic'], ENT_QUOTES); 
			$title_sql = "update ls_config set email4='".$pubpic."' ";
			$title_query = $opendb->query($title_sql);
			$ls_msg="已更新公共信息图片。";
			break;
		
	 	case "unenable":
			$unenable_sql="update ls_comments set enable=0 where id=".$comment_id." ";
			//echo $unenable_sql;
			$unenable_query=$opendb->query($unenable_sql);
			$ls_msg="不显示操作成功！";
			break;
		case "enable":
			$enable_sql="update ls_comments set enable=1 where id=".$comment_id." ";
			//echo $enable_sql;
			$enable_query=$opendb->query($enable_sql);
			$ls_msg="显示操作成功！";
			break;
		case "del":
			$del_sql="delete from ls_comments where ID=".$comment_id."";
	   		//echo $del_sql;
	   		$del_query=$opendb->query($del_sql);
			break;
	}
	//评论结束
	
	$products_sql="select * from ls_products where ID=".$id." ";
	$products_query=$opendb->query($products_sql);
	$products_rows=mysql_fetch_assoc($products_query);
	

	
	//获取文件目录
	$subcate_sql="select productID from ls_products where ID=".$id." "; 
	$subcate_sql="select * from ls_products where ID=(".$subcate_sql.")";
	$subcate_query=$opendb->query($subcate_sql);
	$subcate_myrows=mysql_fetch_assoc($subcate_query);
	if($subcate_myrows['subcateFolders']!="")
	{
		$pathFoldersProducts=$subcate_myrows['subcateFolders'];

		$midcate_sql="select productID from ls_products where ID=".$id." "; 
		$midcate_sql="select subcateID from ls_products where ID=(".$midcate_sql.") "; 
		$midcate_sql="select * from ls_products where ID=(".$midcate_sql.")";
		$midcate_query=$opendb->query($midcate_sql);
		$midcate_myrows=mysql_fetch_assoc($midcate_query);
		
		if($midcate_myrows['midcateFolders']!="")
		{
			$pathFoldersProducts=$midcate_myrows['midcateFolders']."/".$pathFoldersProducts;
			
			$cate_sql="select productID from ls_products where ID=".$id." "; 
			$cate_sql="select subcateID from ls_products where ID=(".$cate_sql.")";
			$cate_sql="select midcateID from ls_products where ID=(".$cate_sql.") "; 
			$cate_sql="select * from ls_products where ID=(".$cate_sql.")";
			$cate_query=$opendb->query($cate_sql);
			$cate_myrows=mysql_fetch_assoc($cate_query);
			
			$pathFoldersProducts="../".$cate_myrows['cateFolders']."/".$pathFoldersProducts;
		}			
	}
	else //又大类和中类，没有小类
	{
		$midcate_sql="select productID from ls_products where ID=".$id." "; 
		$midcate_sql="select * from ls_products where ID=(".$midcate_sql.")";
		$midcate_query=$opendb->query($midcate_sql);
		$midcate_myrows=mysql_fetch_assoc($midcate_query);
		
		if($midcate_myrows['midcateFolders']!="")
		{
			$pathFoldersProducts=$midcate_myrows['midcateFolders'];
		
			$cate_sql="select * from ls_products where ID=".$midcate_myrows['midcateID']." "; 
			$cate_query=$opendb->query($cate_sql);
			$cate_myrows=mysql_fetch_assoc($cate_query);
		
			$pathFoldersProducts="../".$cate_myrows['cateFolders']."/".$pathFoldersProducts;
		}
		else //只有大类
		{
			$cate_sql="select productID from ls_products where ID=".$id." "; 
			$cate_sql="select * from ls_products where ID=(".$cate_sql.")";
			$cate_query=$opendb->query($cate_sql);
			$cate_myrows=mysql_fetch_assoc($cate_query);
			
			$pathFoldersProducts="../".$cate_myrows['cateFolders'];
			
		}
	
	}
	
	//获取文件目录
	$picsrc=$pathFoldersProducts."/".$SmallFoldersProducts."/".$products_rows['productPic']; 
	//echo $picsrc."<br>";
	$picsrcnopath=$products_rows['productPic'];
	
	$title_sql = "select * from ls_config";
	$title_query = $opendb->query($title_sql);
	$title_value = mysql_fetch_assoc($title_query);
?>
<!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">
<title>Modify Products</title>
<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>
<link rel="stylesheet" href="css/style2.css" />
<link rel="stylesheet" href="kindeditor-4.1.10/themes/default/default.css" />
<link rel="stylesheet" href="kindeditor-4.1.10/plugins/code/prettify.css" />
<script charset="utf-8" src="kindeditor-4.1.10/kindeditor.js"></script>
<script charset="utf-8" src="kindeditor-4.1.10/lang/zh_CN.js"></script>
<script charset="utf-8" src="kindeditor-4.1.10/plugins/code/prettify.js"></script>
<script>
    KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="productSpecification"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });
	
	KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="characteristics"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });
	
	KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="advantages"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });
	
	KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="parameters"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });
	   
	   		KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="canshu"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });

	KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="basicInfo"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });

	KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="additionalInfo"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });
	KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="pubpic"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });	
</script>
</head>
<body>
<table width="98%" 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="213" valign="top"><br>
			<form name="myform" enctype="multipart/form-data" method="post" action="saveproducts.php?cateid=<? echo $cateid?>&midcateid=<? echo $midcateid?>&subcateid=<? echo $subcateid?>&page=<? echo $page ?>" onSubmit="return Checkaddproducts()">
				<input type="hidden" value="update" name="ls">
				<input type="hidden" value="<?php echo $id;?>" name="id">
				<input type="hidden" value="<?php echo $products_rows['productPic'];?>" name="Pic">
				<input type="hidden" name="ChangecatePagePic" value="no">
			  <table border="0" width="96%" align="center">
					<tr>
						<td width="56%">提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
						<td width="30%" align="right">&nbsp;</td>
						<td width="14%" align="right"><img src="images/shao.gif" />&nbsp;<a href="products.php?cateid=<? echo $cateid?>&midcateid=<? echo $midcateid?>&subcateid=<? echo $subcateid?>&page=<? echo $page ?>"><u>返回</u></a></td>
					</tr>
				</table>
				<table width="96%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#f0f0ee">
				  <tr>
						<td height="20" colspan="3"></td>
				  </tr>
					<tr bgcolor="#f4f4f4">
						<td style="padding-left:15px;" width="8%">类别：</td>
						<td colspan="2"  style="padding-left:3em;" ><?php
									//cate change
									$midcate_sql="select * from ls_products where subcateName is null and cateName is null and cateFolders 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 enable=1 order by Num";
									$midcate_query=$opendb->query($midcate_sql);
									echo "<script language = 'JavaScript'>" ;
									echo " var onecount; " ;
									echo " midcat = new Array(); " ;
									$count=0;
									while($midcate_rows=mysql_fetch_assoc($midcate_query))
									{
										echo " midcat[".$count."] = new Array(\"" ;
										echo 			trim($midcate_rows['midcateName'])."\",\"" ;
										echo 			trim($midcate_rows['midcateID'])."\",\"" ;
										echo 			trim($midcate_rows['ID'])."\"); " ;
										$count++	;
									}
									echo "onecount=".$count.";"	;

									
									
									$subcate_sql="select * from ls_products where cateName is null and cateFolders is null and cateBrief 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 enable=1 order by Num";
									$subcate_query=$opendb->query($subcate_sql);
									
									echo " var onecount2; " ;
									echo " subcat = new Array(); " ;
									$count2=0;
									while($subcate_rows=mysql_fetch_assoc($subcate_query))
									{
										echo " subcat[".$count2."] = new Array(\"" ;
										echo 			trim($subcate_rows['subcateName'])."\",\"" ;
										echo 			trim($subcate_rows['subcateID'])."\",\"" ;
										echo 			trim($subcate_rows['ID'])."\"); " ;
											
										$count2++	;
									}
									echo "onecount2=".$count2.";"	;
								 	
									
									echo "function changelocation_big(locationid) "	;
								  echo "  {"	;
								  echo "  document.myform.MiddleClassName.length = 0; ";
								  echo "  var locationid=locationid;";
								  echo "  var i;";
								  echo "  var j=1;";
								  echo "  for (i=0;i < onecount; i++)";
								  echo "	  {";
								  echo "		  if (midcat[i][1] == locationid)";
								  echo "		  { ";
								  echo "			  document.myform.MiddleClassName.options[document.myform.MiddleClassName.length] = new Option(midcat[i][0], midcat[i][2]);";
								  echo "		  	  if (j == 1)";
								  echo "		  	  	{";
								  echo "		  	  	changelocation_middle(midcat[i][2]);";
								  echo "		  	  	j++;";
								  echo "		  	  	}";
								  echo "		  } ";	   
								  echo "	   	  if (j == 1)";
								  echo "	   	  {";
								  echo " 	 	  	changelocation_middle(-1);";//clear smallclass select
								  echo "	   	  }";
								  echo "	  }";
								  echo "  }"; 
								   
								   //midcate change
									echo "function changelocation_middle(locationid) "	;
								  echo "  {"	;
								  echo "  document.myform.SmallClassName.length = 0; ";
								  echo "  var locationid=locationid;";
								  echo "  var i;";
								  echo "  for (i=0;i < onecount2; i++)";
								  echo "	  {";
								  echo "		  if (subcat[i][1] == locationid)";
								  echo "		  { ";
								  echo "			  document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);";
								  echo "		  } ";	   
								  echo "	  }";
								  echo "  }"; 
								  echo "</script>";   
								  								   
								  $cate_bigclass_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 ";
									$cate_bigclass_query=$opendb->query($cate_bigclass_sql);
									$cate_bigclass_num=mysql_num_rows($cate_bigclass_query); 
									if($cate_bigclass_num==0)
									{
										echo "请先添加大类!";
									}
									else
									{
									echo "大类: <select name='BigClassName' onChange='changelocation_big(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)' size='1'>" ;
									$i=1;
									while($cate_bigclass_rows=mysql_fetch_assoc($cate_bigclass_query))
									 {
									 	 if($i==1)
									 	 {
									 	 	
									 	 	echo " <option ";
									 	 	if($cate_myrows['ID']==$cate_bigclass_rows['ID'] || $_POST['BigClassName']==$cate_bigclass_rows['ID'])
									 	 	{
									 	 		echo "selected";
									 	 	}
									 	 	echo " value=".trim($cate_bigclass_rows['ID']).">".trim($cate_bigclass_rows['cateName'])."</option>";
									 	 }
									 	 else
									 	 {
									 	  echo "	<option ";
									 	  if($cate_myrows['ID']==$cate_bigclass_rows['ID'] || $_POST['BigClassName']==$cate_bigclass_rows['ID'])
									 	 	{
									 	 		echo "selected";
									 	 	}
									 	  echo " value=".trim($cate_bigclass_rows['ID']).">".trim($cate_bigclass_rows['cateName'])."</option>";
									 	 }
									 	  $i++;
									 }
									echo "</select>";
								  
								 	if($midcate_myrows['ID']==""&&$_POST['MiddleClassName']==""||$midcate_myrows['midcateName']==""&&$_POST['MiddleClassName']=="")
								  	{
								  		$midcate_middleclass_sql="select * from ls_products where cateName is null and cateFolders is null and cateBrief is null and subcateName 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 and midcateID='' order by Num";
									}
									else
									{
										if($midcate_myrows['ID']!="")
										{
											$midcate_middleclass_sql="select * from ls_products where cateName is null and cateFolders is null and cateBrief is null and subcateName 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 and midcateID=".$cate_myrows['ID']." order by Num";
										}
										else
										{
											$midcate_middleclass_sql="select * from ls_products where cateName is null and cateFolders is null and cateBrief is null and subcateName 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 and midcateID=".$_POST['bigClassName']." order by Num";
										}
									}
									$midcate_middleclass_query=$opendb->query($midcate_middleclass_sql);
									$midcate_middleclass_num=mysql_num_rows($midcate_middleclass_query);
									
									
									echo " 中类: <select name='MiddleClassName'onChange='changelocation_middle(document.myform.MiddleClassName.options[document.myform.MiddleClassName.selectedIndex].value)' size='1'>" ;
									
								  	while($midcate_middleclass_rows=mysql_fetch_assoc($midcate_middleclass_query))
								  	{
								  		echo "<option ";
								  		if($midcate_myrows['ID']==$midcate_middleclass_rows['ID']||$_POST['MiddleClassName']==$midcate_middleclass_rows['ID'])
								  		{
												echo "selected";
										}
								  		echo " value=".$midcate_middleclass_rows['ID'].">".$midcate_middleclass_rows['midcateName']."</option>";
									}
									echo "</select>";
									
									

									echo " 小类: <select name='SmallClassName'>";
										if($_POST['SmallClassName']==""&&$subcate_myrows['ID']==""||$_POST['SmallClassName']==""&&$subcate_myrows['subcateName']=="")
										{
									  		$subcate_smallclass_sql="select * from ls_products where cateName is null and cateFolders is null and cateBrief 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 enable=1 and subcateID=''";
										}
										else
										{
											if($subcate_myrows['ID']!="")
											{
												echo $subcate_myrows['ID'];
												$subcate_smallclass_sql="select * from ls_products where cateName is null and cateFolders is null and cateBrief 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 enable=1 and subcateID=".$midcate_myrows['ID']."";
											}
											else
											{
												$subcate_smallclass_sql="select * from ls_products where cateName is null and cateFolders is null and cateBrief 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 enable=1 and subcateID=".$_POST['MiddleClassName']."";
											}
										}
										$subcate_smallclass_query=$opendb->query($subcate_smallclass_sql);
										$subcate_smallclass_num=mysql_num_rows($subcate_smallclass_query);

									  	while($subcate_smallclass_rows=mysql_fetch_assoc($subcate_smallclass_query))
									  	{
									  		echo "<option ";
									  		if($_POST['SmallClassName']==$subcate_smallclass_rows['ID']||$subcate_myrows['ID']==$subcate_smallclass_rows['ID'])
									  		{
												echo "selected";
											}
									  		echo " value=".$subcate_smallclass_rows['ID'].">".$subcate_smallclass_rows['subcateName']."</option>";
										}
									
								echo "</select>";
							}//if($cate_bigclass_num==0)
							
								?></td>
					</tr>
					<tr bgcolor="#f4f4f4">
						<td style="padding-left:15px;" >货号：</td>
						<td style="padding-left:3em;" ><input name="productItemNo" type="text" value="<?php echo htmlspecialchars_decode($products_rows['productItemNo'],ENT_QUOTES);?>" size="36">
                        
                        </td>
						<td style="padding-left:3em;" >产品页文件名 ：</span>						  <input name="filename" type="text" value="<?php echo $products_rows['filename'];?>" size="30" />
						  除非必须勿改</td>
                        
					</tr>
					<tr bgcolor="#f4f4f4">
						<td style="padding-left:15px;" >名称：</td>
						<td   style="padding-left:3em;" ><input name="productName" type="text" value="<?php  echo htmlspecialchars_decode($products_rows['productName'],ENT_QUOTES);?>" size="36" onblur="
document.myform.matealt.value=this.value;"></td>
						<td   style="padding-left:3em;"><? 
						if(intval($products_rows['AdditionalAttributes'])&1){ ?>
						  <input id="showonhome" name="showonhome" type="checkbox" value="0" checked />
							 <label for="showonhome" style="margin-right:10px;">首页热点，位置
						       <input type="text" size="3" name="No" value="<?=$products_rows[No]?>" /></label>
						<? }else{ ?>
						  <input id="showonhome" name="showonhome" type="checkbox" value="0" />
						  <label for="showonhome" style="margin-right:10px;">首页热点，显示位置
						    <input type="text" size="3" name="No" value="<?=$products_rows[No]?>" /></label>
						<? }
						if($ls_classproType == "selectPic"){
							if(intval($products_rows['AdditionalAttributesClassPro'])&1){ ?>
							  <input id="classproduct" name="classproduct" type="checkbox" value="0" checked />
								 <label for="classproduct" style="margin-right:10px;">产品类，位置
								   <input type="text" size="3" name="NoClassPro" value="<?=$products_rows[NoClassPro]?>" /></label>
							<? }else{ ?>
							  <input id="classproduct" name="classproduct" type="checkbox" value="0" />
							  <label for="classproduct" style="margin-right:10px;">产品类，位置
								<input type="text" size="3" name="NoClassPro" value="<?=$products_rows[NoClassPro]?>" /></label>
							<? }
						}
						if(intval($products_rows['AdditionalAttributes'])&2)
						{ ?>
						  <input id="hotproduct" name="hotproduct" type="checkbox" value="1" checked />
						  <label for="hotproduct" style="margin-right:10px;">推荐产品</label>
						<? }
						else
						{ ?>
						  <input id="hotproduct" name="hotproduct" type="checkbox" value="1" />
						  <label for="hotproduct" style="margin-right:10px;">推荐产品</label>
					 	<? 	}
						if(intval($products_rows['AdditionalAttributes'])&4)
						{ ?>
						  <input id="newproduct" name="newproduct" type="checkbox" value="2" checked /><label for="newproduct" style="margin-right:10px;">新产品</label>
						<? }
						else
						{ ?>
						  <input id="newproduct" name="newproduct" type="checkbox" value="2" /><label for="newproduct" style="margin-right:10px;">新产品</label>
					  <? 	}
						?></td>
					</tr>
                    <tr bgcolor="#f4f4f4">
                    	<td style="padding-left:15px;">添加到：</td>
                    	<td colspan="2" style="padding-left:3em;" >
                        	
								<select style="color:#F09;FONT-SIZE:14px;" name='isbranch'>
                            	<option value="0" <?php if($products_rows['isbranch']==0){echo "selected='selected'";} ?>>
                                	普通产品
                                </option>
                                <option value="1" <?php if($products_rows['isbranch']!=0){echo "selected='selected'";} ?>>
                                	只有本部门会员可见
                                </option>
                            </select>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;产品所属部门：&nbsp;&nbsp;
                   <?  
				   $admininfo = $admin->getInfo();
				   if($admininfo['branchID']==0){
				   
				   			echo "
						<select name='branchID'>
							<option value='0'>无</option>
						";
							
							$list = $admin->getAllBranch("ls_branch");
							foreach($list as $v){
								if($v['ID']==$products_rows['branchID']){
								echo "<option value='".$v['ID']."' selected='selected' >".$v['branchName']."</option>";
								}else{
									echo "<option value='".$v['ID']."'  >".$v['branchName']."</option>";
									}
							}
						echo "</select>";  
				   }?>
                        </td>
                    </tr>
                   <?php file_exists("widget/ls_products_canshu.php")?include "widget/ls_products_canshu.php":"" ?>

                    <?
					$select_sql2="select * from ls_prospec where productID = ".$id;
					$select_query2=$opendb->query($select_sql2);
					$select_rows2=mysql_num_rows($select_query2); //总产品数
					$i=0;
					$gotSpecNames=array();
					$specificationName=explode(',',$specNames);
               	    $specificationValue=explode(',',$specValue);

					while($prospec_row=mysql_fetch_assoc($select_query2))  //循环处理变量处理 变量名
					{	
						if($specificationName[0]!="")
						{
							if(in_array($prospec_row['specName'],$specificationName))  //原有的参数代码则修改
							{
								$gotSpecNames[]=$prospec_row['specName'];

					?>
					<tr bgcolor="#f4f4f4">
					  <td style="padding-left:10px; " >参数：</td>
					  <td colspan="2" style="padding-left:3em;" ><input name="specificationName[<?=$i?>]" type="text" value="<?php echo $prospec_row['specName'];?>:" size="13"  id="specificationName<?=$i?>"     readonly="readonly" style="border:none"/>					    
                      <input name="specificationValue[<?=$i?>]" type="text" value="<?php echo $prospec_row['specValue'];?>" size="16" id="specificationValue<?=$i?>"   /></td>
				  </tr>
                  <?
						}
				
					}
				  $i++;
                  }
				
				 
					for($j=$i;$j<(count($specificationName));$j++)  //在原来基础上 增加的 代码参数 进行增加操作
					{	
						if(!in_array($specificationName[$j],$gotSpecNames))
						{
					?>
					<tr bgcolor="#f4f4f4">
					  <td style="padding-left:12px;" >参数：</td>
					  <td colspan="2" style="padding-left:3em;" ><input name="specificationName[<?=$j?>]" type="text" value="<?php echo $specificationName[$j];?>:" size="13"  id="specificationName<?=$j?>"     readonly="readonly" style="border:none"/>					    
                      <input name="specificationValue[<?=$j?>]" type="text" value="<?php echo $specificationValue[$j];?>" size="16" id="specificationValue<?=$j?>" onfocus="this.value=((this.value=='<?php echo $specificationValue[$j];?>')?'':(this.value));"  onblur="this.value=((this.value=='')?('<?php echo $specificationValue[$j];?>'):this.value); "  style="color:#999" onchange="document.getElementById('specificationValue<?=$j?>').style.color ='black';"/></td>
				  </tr>
                  <?
                 		 }
                 	 }
				  ?>
					<tr bgcolor="#f4f4f4">
						<td rowspan="3" style="padding-left:12px;" >图片：</td>
						<td style="padding-left:3em;" >
						<div id="preview">
						<? if($picsrcnopath=="")
						{?>
							<img src="<?php echo $_SESSION['dda'].$picsrc."?i=".rand();?>" width="<?php echo $SmallPicW  ?>"   border="1" name="pic" style="float:left;">
							<? }else{  // 动画 gif
							if($products_rows['automationGif']==1){
							?>
							<img src="<?php echo $_SESSION['dda'].$picsrc."?i=".rand();?>"  width="<?php echo $SmallPicW ?>"  border="1" name="pic" id="showproductpic" style="float:left;">
							<? }
							else  //不是 动画 gif
							{?>
							<img src="<?php echo $_SESSION['dda'].$picsrc."?i=".rand();?>"   name="pic" id="showproductpic" width="<?php echo $SmallPicW ?>"   border="1" style="float:left;">
							<? } }?>
							<br>
							<br>
							<br>
							<br></div>
<script type="text/javascript">  
function preview(file)
{
var prevDiv = document.getElementById('preview');
if (file.files && file.files[0])
{
var reader = new FileReader();
reader.onload = function(evt){
prevDiv.innerHTML = '<img src="' + evt.target.result + '" width="<?php echo $SmallPicW ?>"   border="1" name="pic" style="float:left;" />';
}  
reader.readAsDataURL(file.files[0]);
}
else  
{
prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
}
}
</script>
                      </td>
						<td style="padding-left:1em;" >
						<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);" style="padding-left:1em; width:90%;">
						<legend>SEO参数</legend>
						<table width="96%" border="0">
						  <tr>
						    <td width="72" bgcolor="#f4f4f4" >本页标题 Title</td>
						    <td width="508"><textarea name="productTitle" cols="70" rows="3" id="productTitle"><?php echo $products_rows['productTitle'];?></textarea></td>
					      </tr>
						  <tr>
						    <td bgcolor="#f4f4f4" >本页关键字 Keywords</td>
						    <td><textarea name="productKeywords" cols="70" rows="3" id="productKeywords"><?php echo $products_rows['productKeywords'];?></textarea></td>
					      </tr>
						  <tr>
						    <td bgcolor="#f4f4f4"  >本页描述 Description</td>
						    <td><textarea name="productDescription" cols="70" rows="5" id="productDescription"><?php echo $products_rows['productDescription'];?></textarea></td>
                                                
					      </tr>
					    </table><div style="padding:0 5% 0 0%" align="left"><?=$promlv>1?$seo:""?></div>
						</fieldset>
						</td>
					</tr>
					<tr bgcolor="#f4f4f4">
					  <td colspan="2" style="padding-left:3em;" >
			            <input type="file" name="productPic" style="width:160px;"  onchange="myform.ChangecatePagePic.value='yes';document.pic.src=myform.productPic.value;preview(this);" />
					    <input id="automationGif" name="automationGif" type="checkbox" value="1"  <?=($products_rows['automationGif']==1)?'checked':''?>/>
					    动画透明
						  GIF PNG
                          <span style="padding-left:60px; "> 图片alt </span>
			             <span style="padding-left:20px;">  <input name="matealt" type="text" value="<?php echo $products_rows['matealt']==""?$products_rows['productName']:$products_rows['matealt'];?>" size="64"    /> </span>
                          <br />
				        <?=$propic_tips?></td>
				  </tr>
                  <tr bgcolor="#f4f4f4">
				    <td colspan="2" style="padding-left:3em;" ><input name="productPicName" type="text" value="<?php echo $products_rows['productPic'];?>" size="80" /><input name="productPicName_old" type="hidden" value="<?php echo $products_rows['productPic'];?>"  /></td>
				  </tr>
                  
                  <?  if($ifmutipic) include("widget/_modiproducts_muti.php"); //  ?>
                 
                  <tr>
                    <td style="padding-left:12px;" >&nbsp;</td>
                    <td style="padding-left:3em;" >&nbsp;</td>
                    <td style="padding-left:1em;">&nbsp;</td>
                  </tr>
                  <tr>
                    <td style="padding-left:12px;" >视频：</td>
                    <td style="padding-left:3em;" ><div id="preview2">
                      <video width="<?php echo $SmallPicW  ?>"   id="vdo" style="float:left;" border="1" poster="<?=$products_rows['productVideo']==""?"":$_SESSION['dda'].$picsrc?>"  preload="metadata" controls="controls">
                        <source src="<?=$_SESSION['dda'].$pathFoldersProducts."/".$products_rows['productVideo']?>" />
                      </video>
                    </div>
                      <br />
                      <br />
                      <script type="text/javascript">  
function preview2(file)
{
var prevDiv = document.getElementById('preview2');
if (file.files && file.files[0])
{
var reader = new FileReader();
reader.onload = function(evt){
prevDiv.innerHTML = '<img src="' + evt.target.result + '" width="<?php echo $SmallPicW ?>"   border="1" name="vdo" style="float:left;" />';
}  
reader.readAsDataURL(file.files[1]);
}
else  
{
prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
}
}
                      </script>
                      <br />
                      <br /></td>
                    <td style="padding-left:1em;"><span style="padding-left:3em;">
                      <input type="file" name="productVideo" style="width:300px;" onchange="preview2(this)" /><? if($products_rows['productVideo']!=""){ ?><button type="submit" name="deletevideo" id="buttondel" value="deletevideo" />删除视频</button><? }?>
                      <br />
                      <span style="padding-left:48px;"> <?=$promlv>1?$video_tips:""?> </span></td>
                  </tr>
					<tr bgcolor="#f4f4f4">
					  <td colspan="3" style="padding-left:10px;padding-right:20px;"><div align="right">
					    <button name="submit3" type="submit" value="确定" onClick="
                        if($('#productDescription').val().length <= 0){
                        	$('#productDescription').val(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].text+'<?=$lan['seoFrefix1']?><?=$lan['seoSufix2']?>'+', '+document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].text+'<?=$lan['seoFrefix2']?><?=$lan['seoSufix2']?>');
                        }"/>确定</button>
					    </div></td>
				  </tr>
					<tr bgcolor="#f4f4f4">
						<td style="padding-left:15px;" >说明 ：</td>
						<td colspan="2" style="padding-left:3em;padding-right:3em;">
                        <textarea name="productSpecification" id="productSpecification" style="width:100%;height:400px;visibility:hidden;"><?php echo htmlspecialchars($products_rows['productSpecification']); ?></textarea><div style="padding:0 0% 0 0%" align="right"><?=$promlv>1?$specification_tips:""?> </div>
						</td>
					</tr>
					<!--<?php file_exists("widget/ls_products_addandmodi_moreinfo.php")?include "widget/ls_products_addandmodi_moreinfo.php":"" ?>
					<?php file_exists("widget/ls_comment.php")?include "widget/ls_comment.php":"" ?>-->
					<tr bgcolor="#f0f0ee">
						<td height="47" colspan="3" align="center"> <button name="submit3" type="submit" value="确定" onClick="
                        if($('#productDescription').val().length <= 0){
                        	$('#productDescription').val(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].text+'<?=$lan['seoFrefix1']?><?=$lan['seoSufix2']?>'+', '+document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].text+'<?=$lan['seoFrefix2']?><?=$lan['seoSufix2']?>');
                        }"/> 确定</button>
						<button type="reset" name="button" id="button" value="重置" />重置</button>
			          </td>
					</tr>
			  </table>
			</form></td>
	</tr>
</table>

<?
if( $_GET['pp']=="1" && $promlv>1 ){?>
<form name="myform2" enctype="multipart/form-data" method="post" action="?id=<? echo $products_rows['ID']?>&ls=pubpic&pp=1"  >
  <br />
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6" >
		<tr bgcolor="#B9DAFF">
						<td height="25" colspan="3" align="center">
                       <? include "widget/modiproducts_pubpic.php";//isfirstpro( $id)
						
						?>
                      
                         </td>
					</tr>
                    
            </table>
<p align="center">
  <button name="submit4" type="submit" value="确定"  /> 确定</button>
  <label>
     <button type="reset" name="button" id="button" value="重置" />重置</button>
  </label>
</p>
</form>   
<? }
 if($_SESSION["refreshModi"]){?>
<script> document.execCommand('Refresh') ;</script>
<? 
$_SESSION["refreshModi"]=false;
}?>
</body>
</html>