<?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');
	
	$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);
	$ls_msg="添加产品小类操作";
?>
<!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="styles/uploadify.css" rel="stylesheet" type="text/css">
	<link href="styles/uploadify.jGrowl.css" rel="stylesheet" type="text/css">
	<link href="css/admin.css" rel="stylesheet" type="text/css">
	<link href="css/newui.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/jquery-1.4.2.minjs"></script>
	<script type="text/javascript" src="scripts/plugin/jquery.jgrowl.js"></script>
	<script type="text/javascript" src="scripts/plugin/jquery.uploadifylt.js"></script>
	<script language="JavaScript" src="js/ls.js"></script>
	<script type="text/javascript" src="js/newui.js"></script>
	<title>无标题文档</title>
	<script type="text/javascript">
	$(function(){
			   $("#fileUploadgrowl").fileUpload({
						'uploader': 'scripts/uploader.swf',
						'cancelImg': '../images/cancel.png',
						'script': 'scripts/upload.php',
						'folder': '../uploadfiles',
						'fileDesc': 'Image Files',
						'fileExt': '*.jpg;*.jpeg;*.png;*.gif',
						'multi': true,
						'queueSizeLimit': 10,
						'simUploadLimit': 3,
						'sizeLimit': 1048576,
						'buttonText': 'Add Files',
						onError: function (event, queueID ,fileObj, errorObj) {
							var msg;
							if (errorObj.status == 404) {
								alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
								msg = 'Could not find upload script.';
							} else if (errorObj.type === "HTTP")
								msg = errorObj.type+": "+errorObj.status;
							else if (errorObj.type ==="File Size")
								msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1024)+'KB';
							else
								msg = errorObj.type+": "+errorObj.text;
							$.jGrowl('<p></p>'+msg, {
								theme: 	'error',
								header: 'ERROR',
								sticky: true
							});			
							$("#fileUploadgrowl" + queueID).fadeOut(250, function() { $("#fileUploadgrowl" + queueID).remove()});
							return false;
						},
						onCancel: function (a, b, c, d) {
							var msg = "Cancelled uploading: "+c.name;
							$.jGrowl('<p></p>'+msg, {
								theme: 	'warning',
								header: 'Cancelled Upload',
								life:	4000,
								sticky: false
							});
						},
						onClearQueue: function (a, b) {
							var msg = "Cleared "+b.fileCount+" files from queue";
							$.jGrowl('<p></p>'+msg, {
								theme: 	'warning',
								header: 'Cleared Queue',
								life:	4000,
								sticky: false
							});
						},
						onComplete: function (a, b ,c, d, e) {
							var size = Math.round(c.size/1024);
							$('#filenamecache').append('uploadfiles/'+c.name+'<br />');
							$.jGrowl('<p></p>'+c.name+' - '+size+'KB', {
								theme: 	'success',
								header: 'Upload Complete',
								life:	4000,
								sticky: false
							});
						}
					});
			   });
	</script>
    <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="subcateDetail"]', {
				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="addsubcate" enctype="multipart/form-data" method="post" action="savesubcate.php" onSubmit="return Checksubaddcate()"  >
	<input type="hidden" value="insert" name="ls">
	<input type="hidden" value="<?php echo $id ;?>" name="subcateID">
	<input type="hidden" name="ChangecatePagePic" value="no">
	<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="midcateName" value="<?php echo $cate_rows['midcateName']?>" readonly class="gcateinputboxro"></div>
			<div class="gcatelabelnormal">小类名称</div>
			<div class="gcateinputnormal"><input type="text" name="subcateName" class="gcateinputboxnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);" onKeyUp="addsubcate.subcateFolders.value=addsubcate.cateTitle.value=addsubcate.cateKeywords.value=addsubcate.cateDescription.value=this.value;" ></div>
			<div class="gcatelabelnormal">目录名称</div>
			<div class="gcateinputnormal"><input name="subcateFolders" type="text" size="20"  onclick="this.value=subcateName.value" class="gcateinputboxnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);" ></div>
			<div class="gcatelabelnormal">简介</div>
			<div class="gcateinputnormal"><textarea name="subcateBrief" class="minputareabig" onMouseOver="ibov(this);" onMouseOut="ibou(this);"></textarea></div>
			<div class="gcateprompt1">橙色框部分为必须输入。目录名须用英文。简介不要超过<? echo $CateLength; ?>个字符，超过部分将无法显示。<input type="hidden" name="midcate_id" value="<?php echo $cate_rows['ID']?>" /></div>
			</fieldset>
		</div>
		<div class="parellelright">
			<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
			<legend>SEO优化</legend>
			<div class="infolabel">网站标题：</div><div class="infoinput"><textarea name="cateTitle" class="inputareashortnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);"></textarea></div>
			<div class="infolabel">网站关键字：</div><div class="infoinput"><textarea name="cateKeywords" class="inputareashortnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);"></textarea></div>
			 <div class="infolabel">网站描述：</div><div class="infoinput"><textarea name="cateDescription" class="inputareashortnoblank" onMouseOver="ibov(this);" onMouseOut="ibou(this);"></textarea></div>
			</fieldset>
		</div>
		<div class="ifsingleframe">
			<div class="ifsingleoverbutton" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><input name="submit2" type="submit" value="添加小类" class="ifsinglebutton"></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;" ><img src="images/picture.gif" width="<?php echo $SmallPicW ?>" height="<?php echo $SmallPicH?>" border="1" name="pic" style="float:left;"><br>
						<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="addsubcate.ChangecatePagePic.value='yes';">
					  <br />
					图片宽度应在200-600点、高度在200-600点，格式为jpg/gif，大小不要超过<?php echo $PicSize/1000; ?>KB</td>
				</tr>
			</table>
		</fieldset>
		<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="subcateDetail" style="width:100%;height:400px;visibility:hidden;"></textarea>
		</div>
		</fieldset>
		
		<fieldset class="lsconeditorsfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
		<legend>详细信息编辑器用图片上传</legend>
		<div class="gcatepicoverall">
			<div class="gcateiconfield">
				<div class="gcateprompt2" style="margin-bottom:20px;">请在此处上传上面编辑器中所需要的图片，每次可以同时排队10个文件，每个文件大小不超过1MB。<br />图片的链接地址为：<font style="text-decoration:underline; color:#00F;">http://您的域名/uploadfiles/您上传的文件名</font>。<br />其中上传后的文件名与您上传时用的文件名（您硬盘中的文件名）相同，您可以将此链接直接粘贴入编辑器的图片编辑功能中的源文件一栏中来插入图片，同时，请注意链接地址的大小写。</div>
				<div style="float:left;">
					<div style="float:left; padding:0 2px 0 0;">
						<input type="button" onClick="javascript:$('#fileUploadgrowl').fileUploadStart()" value="Start Upload" style="background:url(../images/buttona.jpg) no-repeat; cursor:hand; width:110px; height:30px; color:#fff; font-weight:bold; border:none;" />
						<input type="button" onClick="javascript:$('#fileUploadgrowl').fileUploadClearQueue()" value="Clear Queue" style="background:url(../images/buttona.jpg) no-repeat; cursor:hand; width:110px; height:30px; color:#fff; font-weight:bold; border:none;" />
					</div>
					<div id="fileUploadgrowl"></div>
				</div>
				<div id="filenamecache" style="float:right; width:360px; border:1px solid #aaa; height:187px; overflow:scroll;">
				<font style="font-size:12px; font-weight:bold;">已上传文件：</font><br />
				</div>
			</div>
		</div>
		</fieldset>
	</div>
	<div class="tablefooter">
	</div>
	</form>
</div>

</body>
</html>