<?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_msg="修改产品大类";
	$id=$_GET['id'];
	
	$cate_sql="select * from ls_products where ID=".$id." ";
	$cate_query=$opendb->query($cate_sql);
	$cate_rows=mysql_fetch_assoc($cate_query);
	if($cate_rows['catePic']==null){
		$classPath="images/picture.gif";
	}else{
		$classPath="../".$cate_rows['cateFolders']."/".$cate_rows['catePic'];
	}
?>
<!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">
	<link href="css/newui.css" rel="stylesheet" type="text/css">
    <link href="css/style2.css" rel="stylesheet"  type="text/css"/>
	<script type="text/javascript" src="scripts/jquery-1.4.2.min.js"></script>
	<script language="JavaScript" src="js/ls.js"></script>
	<script type="text/javascript" src="js/newui.js"></script>
	<title>修改产品大类</title>
    <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="cateBrief"]', {
				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="cateDetail"]', {
				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>

<div class="maintitle">
	<strong>修改产品大类</strong>
</div>
<div class="mainfield">
	<form name="addcate" enctype="multipart/form-data" method="post" action="savecate.php" onSubmit="return Checkaddcate()">
	<input type="hidden" value="modi" name="ls">
	<input type="hidden" value="<?php echo $cate_rows['ID'];?>" name="id">
	<input type="hidden" name="ChangecatePagePic" value="no">
	<input type="hidden" name="ChangecateIconPic" value="no">
    <input type="hidden" value="<?php echo $cate_rows['catePic'];?>" name="PicOld">
	<div class="messagebox">
		提示：<font color="#FF0000"><?php echo $ls_msg; ?></font>
	</div>
	<div class="returnicon">
		<img src="images/shao.gif">&nbsp;<a href="cate.php"><u>返回</u></a>
	</div>
	<div class="tabletitle">
	</div>
	<div class="editableoverall">
		<div class="parellelleft">
			<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
			<legend>类别信息</legend>
			<div class="gcatelabelnormal">大类名称：</div>
			<div class="gcateinputnormal"><input type="text" name="cateName" class="gcateinputboxnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);"  value="<?php echo $cate_rows['cateName'];?>"></div>
			 
			<p>&nbsp;</p>
			<p>&nbsp;</p>
			<div class="gcatelabelnormal">目录名：</div>
			<div class="gcateinputnormal"><input name="cateFolders" type="text" class="gcateinputboxnoblank" value="<?php echo $cate_rows['cateFolders'];?>" <?=($folderchange==1?"":"readonly") ?> ></div>
			<div class="gcateprompt1">目录名不能修改。橙色框必填，简介不超过<? echo $CateLength; ?>个字符，超过部分无法显示。</div>
			</fieldset>
		</div>
	  <div class="parellelright">
			<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
			<legend>SEO优化</legend>
			<div class="infolabel">标题 Title：<br />
			</div><div class="infoinput"><textarea name="cateTitle" class="inputareashortnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $cate_rows['cateTitle'];?></textarea></div>
			<div class="infolabel">关键字 Keywords：<br />
			</div><div class="infoinput"><textarea name="cateKeywords" class="inputareashortnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $cate_rows['cateKeywords'];?></textarea></div>
			 <div class="infolabel">描述 Description：<br />
			 </div><div class="infoinput"><textarea name="cateDescription" class="inputareashortnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $cate_rows['cateDescription'];?></textarea></div>
			</fieldset>
		</div>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<div class="gcateinputnormalbrief">
		  <textarea name="cateBrief" rows="6" class="inputareabigbrief" onmouseover="ibov(this);" onmouseout="ibou(this);"><?php echo str_replace("<br />","\n",htmlspecialchars_decode($cate_rows['cateBrief'],ENT_QUOTES));?></textarea>
	  </div>
		<div class="gcatelabelnormal">简介：</div>
		<p>&nbsp;</p>
		<div class="ifsingleframe">
			<div class="ifsingleoverbutton" onMouseOver="ibov(this);" onMouseOut="ibou(this);" style="float:right">
            <button name="submit2" type="submit" value="确定" class="ifsinglebutton">确定</button></div>
		</div>
        <fieldset class="lsconeditorsfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
				<legend>大类代表图</legend>
				<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
					<tr bgcolor="#f4f4f4">
						<td width="18%" style="padding-left:12px;" >代表图：</td>
						<td style="padding-left:3em;" ><div id="preview"><img src="<?php echo $classPath ?>" width="<?=(isset($thisPicW)?$thisPicW:$SmallPicW)?>" height="<?=(isset($thisPicH)?$thisPicH:$SmallPicH)?>" border="1" name="pic" style="float:left;"></div><br>
<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 ?>" height="<?php echo $SmallPicH?>" 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>
							<br>
							<br>
							<br></td>
					</tr>
					<tr bgcolor="#f4f4f4">
						<td style="padding-left:15px;" >选择文件：</td>
						<td style="padding-left:3em;" ><input type="file" name="productPic" style="width:300px;" onchange="addcate.ChangecatePagePic.value='yes';preview(this)">
						  <br />
					    图片宽度应在200-600点、高度在200-600点，格式为jpg/gif，大小不要超过<?php echo $PicSize/1000; ?>KB</td>
					</tr>
				</table>
			</fieldset>
        <div class="ifsingleframe">
              <div class="ifsingleoverbutton" onmouseover="ibov(this);" onmouseout="ibou(this);" style="float:right">
                <button name="submit" type="submit" value="确定" class="ifsinglebutton" />确定</button>
              </div>
      </div>
<fieldset class="lsconeditorsfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
		<legend>大类详细信息</legend>
		<div class="gcateprompt2">大类详细如超过<? echo $minCateDetailLength; ?>个字符，,将生成大类详细页，不生成本类下产品页，“简介”也不显示。</div>
		<div class="lsgcateeditorarea" style="margin-top:10px; clear:both;">
        <textarea name="cateDetail" style="width:100%;height:400px;visibility:hidden;"><?php echo htmlspecialchars($cate_rows['cateDetail']); ?></textarea>
		</div>
		</fieldset>
		<div class="ifsingleframe">
              <div class="ifsingleoverbutton" onmouseover="ibov(this);" onmouseout="ibou(this);" style="float:right">
                <button name="submit" type="submit" value="确定" class="ifsinglebutton" />确定</button>
              </div>
      </div>

		<fieldset class="lsconeditorsfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
		<legend>大类图片设置</legend>
		<div class="gcatepicoverall">
			<div class="gcateiconfield">
				<div class="gcatepiclabel">Icon（图标）：</div>
				<div class="gcatepicfilefield"><input type="file" name="cateIconPic" onBlur="document.Iconpic.src=addcate.cateIconPic.value;" class="gcatepicfilebox" onMouseOver="ibov(this);" onMouseOut="ibou(this);"></div>
			</div>
			<div class="gcateiconfield">
				<div  > &nbsp; </div>
				<div class="gcatepiclabel">Banner（主体图）：</div>
				<div class="gcatepicsetxy"> 宽度 
			  <input type="text" class="ifinfoinputvshort"   name="width" onBlur="document.pic.width=document.addcate.width.value;" onMouseOver="ibov(this);" onMouseOut="ibou(this);" value="<?php echo $cate_rows['catePagePicWidth']; ?>">
			  px &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 高度 
			  <input type="text" class="ifinfoinputvshort"   name="height" onBlur="document.pic.height=document.addcate.height.value;" onMouseOver="ibov(this);" onMouseOut="ibou(this);" value="<?php echo $cate_rows['catePagePicHeight'];?>">
			  px 
				</div>
				<div class="gcatepicfilefield"><input type="file" name="catePagePic" onBlur="document.pic.src=addcate.catePagePic.value;" class="gcatepicfilebox" onMouseOver="ibov(this);" onMouseOut="ibou(this);"></div>
			</div>
			<div class="gcateiconfield">
			<?php if(file_exists("../".$cate_rows['cateFolders']."/".$cate_rows['cateIconPic'])&&$cate_rows['cateIconPic']!=""){?>
				<div class="gcatepiclabelnofloat">图片预览</div>
				<div class="gcatepicleft"><img src="images/picture.gif" width="<?php echo $cateIconPicW ?>" height="<?php echo $cateIconPicH ?>" border="1" name="Iconpic"></div>
				<div class="gcatepicright"><img src="<?php echo "../".$cate_rows['cateFolders']."/".$cate_rows['catePagePic'];?>" width="450" height="46" border="1" name="pic"></div>
			<? } ?>
			</div>
		</div>
		</fieldset>
	</div>
	<div class="tablefooter">
	</div>
	</form>
</div>

</body>
</html>

