<?php 
	require_once('_approot.php');	
	$ls_msg="添加产品大类操作";
	if(isset($_SESSION['savepcate'])) $_POST=$_SESSION['savepcate']; //saveproducts 变量
?>
<!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 rel="stylesheet" href="css/style2.css" />
<script type="text/javascript" src="scripts/jquery-core.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" />
    <link rel="stylesheet" href="css/style2.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();
		});
		
	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();
    });
		
	</script>
<style type="text/css">
<!--
.b1 {	color: #FFF;
}
-->
</style>
<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>';
}
}


//图片类型验证 ".jpg", 
function pictype(file)
{
   var fileTypes = [<?=$imagetypes2?>];
    var filePath = file.value;
    //当括号里面的值为0、空字符、false 、null 、undefined的时候就至关于false
    if(filePath){
        var isNext = false;
        var fileEnd = filePath.substring(filePath.indexOf("."));
        for (var i = 0; i < fileTypes.length; i++) {
            if (fileTypes[i] == fileEnd) {
                isNext = true;
                break;
            }
        }
        if (!isNext){
            alert('<?=$imagealert?>');
            file.value = "";
            return false;
        }
    }else {
        return false;
    }
}

//图片大小验证
function picsize(file) {
    var fileSize = 0;
    var fileMaxSize =<?=$PicSize/1000?>;// 1M
    var filePath = file.value;
    if(filePath){
        fileSize =file.files[0].size;
        var size = fileSize / 1024;
        if (size > fileMaxSize) {
            alert("<?=$imagealertsize?>");
            file.value = "";
            return false;
        }else if (size <= 0) {
            alert("图片大小不能为0！");
            file.value = "";
            return false;
        }
    }else{
        return false;
    }
}

</script>
</head>
<body>

<div class="maintitle">增加产品类别</div>
<div class="mainfield">
	<form name="addcate" enctype="multipart/form-data" method="post" action="savecate.php" onSubmit="return Checkaddcate()">
		<input type="hidden" value="insert" name="ls">
		
		<div class="editableoverall">
		  <table width="98%" border="0" cellpadding="" cellspacing="0" style="background-color: #f0f0ee;">
		    <tr>
		      <td width="4%" height="19" valign="top">&nbsp;</td>
		      <td width="44%" valign="top">提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
		      <td align="right" style="padding-right:40px;"><img src="images/shao.gif" />&nbsp;<a href="cate.php">返回</a></td>
	        </tr>
		    <tr style="padding-bottom:-10px;">
			    <td height="315" colspan="2" valign="top"><fieldset class="infofield" >
			      <table width="104%" border="0" cellspacing="8" cellpadding="">
			        <tr>
			          <td width="17%" height="112" align="right"><span class="gcatelabelnormal">大类名称 *</span></td>
			          <td width="83%"><span class="">
			            <textarea name="cateName" rows="5" class="gcateinputboxnoblank" onmouseover="ibov(this);" onmouseout="ibou(this);" onkeyup="addcate.cateFolders.value=addcate.cateTitle.value=addcate.cateKeywords.value=this.value;this.value=this.value.replace(/&/g, '');" onblur="addcate.cateTitle.value=this.value+' - <?=$config_row['companyNameCn']?>';"  width="100%" ><?php echo $_POST['cateName'];?></textarea>
			          </span><br /></td>
		            </tr>
			        <tr>
			          <td height="69" align="right"><span class="gcatelabelnormal">目录名</span><br /></td>
			          <td align="left"><span class="">
			            <textarea name="cateFolders" cols="30" class="gcateinputboxnoblank" onmouseover="ibov(this);" onmouseout="ibou(this);"  width="100%" ></textarea>
			          </span></td>
		            </tr>
			        <tr>
			          <td align="right" style="padding-right:18px;">&nbsp;</td>
			          <td align="left" style="padding-right:;"><?=$cate_tips?></td>
		            </tr>
		          </table>
			    </fieldset></td>
			    <td width="52%" valign="top"><fieldset class="infofield"  >
			     
			      <table width="94%" border="0" cellspacing="8" cellpadding="0" >
			        <tr>
			          <td align="right" ><br />
			            标题<br />
			            Keywords</td>
			          <td> 
			            <textarea name="cateTitle" class="inputareashortnoblank"  onmouseover="ibov(this);" onmouseout="ibou(this);"  width="100%" ><?php echo $_POST['cateTitle'];?></textarea>
			           </td>
		            </tr>
			        <tr>
			          <td width="21%" align="right" ><br />
			            关键字<br />
			            Keywords</td>
			          <td width="79%"><textarea name="cateKeywords" class="inputareashortnoblank" onmouseover="ibov(this);" onmouseout="ibou(this);"  width="100%" ><?php echo $_POST['cateKeywords'];?></textarea></td>
		            </tr>
			        <tr>
			          <td align="right">描述<br />
			            Description *</td>
			          <td>
		              <textarea name="cateDescription" class="inputareashortnoblank" onmouseover="ibov(this);" onmouseout="ibou(this);" onblur="addcate.cateBrief.value=(addcate.cateBrief.value.length==0) ? this.value : addcate.cateBrief.value"  width="100%"  ><?php echo $_POST['cateDescription'];?></textarea><br/><?=$promlv>1?$seo:""?>
			         </td>
		            </tr>
			        <tr>
			          <td height="37" colspan="2" align="right" style="padding-top:10px;" ><button name="submit2" type="submit" value="确定" class="ifsinglebutton"  >确定</button></td>
		            </tr>
		          </table>
		      </fieldset></td>
	        </tr>
		    <tr>
		      <td height="325" colspan="4"><table width="100%" border="0" cellspacing="8" style="padding-top:-10px;">
		        <tr>
		          <td width="9%" align="right"> 简介 </td>
		          <td colspan="2"><textarea name="cateBrief" rows="12" class="inputareabigbrief" onmouseover="ibov(this);" onmouseout="ibou(this);" onblur="addcate.cateDescription.value=(addcate.cateDescription.value.length==0) ? this.value : addcate.cateDescription.value" style="width:98%;"><?php echo $_POST['cateBrief'];?></textarea>
	              <?=$promlv>1?$brief_tips:""?></td>
	            </tr>
		        <tr>
		          <td height="436" align="right">
		          详细
		         </td>
		          <td colspan="2"><span class="lsgcateeditorarea" style="margin-top:10px; clear:both;"><span class="lsgcateeditorarea" style="margin-top:10px; clear:both;">
		            <textarea name="cateDetail" style="width:98%;height:400px;visibility:hidden;"><?php echo $_POST['cateDetail'];?></textarea>
		          </span><span class="gcateprompt2"><?=$catedetails_tips?>
		          <?=$promlv>1?$specification_tips:""?>
		          </span></span></td>
	            </tr>
		        <tr>
                 <?php file_exists("widget/ls_products_addandmodi_moreinfo.php")?include "widget/ls_products_addandmodi_moreinfo.php":"" ?>
		          <td colspan="3" align="right"><button name="submit2" type="submit" value="确定" class="ifsinglebutton">确定</button></td>
	            </tr>
		        <tr>
		          <td height="38%" align="right">附件文件</td>
		          <td><input type="file" name="attachedfile"    onmouseover="ibov(this);" onmouseout="ibou(this);" />
		            </span></td>
		          <td valign="bottom">&nbsp;</td>
	            </tr>
		        <tr>
		          <td height="38%" align="right"> 代表图 Icon</span></td>
		          <td width="22%"> 
		            <input type="file" name="cateIconPic" onchange="pictype(this);picsize(this);preview(this);" onblur="document.Iconpic.src=addcate.cateIconPic.value;"  onmouseover="ibov(this);" onmouseout="ibou(this);" />
		          </span></td>
		          <td width="69%" valign="bottom"><span class="gcatepicleft"><img src="images/picture.gif" alt="" name="Iconpic"   width="100%" border="1" id="Iconpic" /></span></td>
	            </tr>
		        <tr>
		          <td height="70" align="right">主题图 Banner</td>
		          <td><span  >
		            <input type="file" name="catePagePic" onchange="pictype(this);picsize(this);preview(this);" onblur="document.pic.src=addcate.catePagePic.value;"   onmouseover="ibov(this);" onmouseout="ibou(this);" />
		          </span></td>
		          <td><img src="images/picture.gif" alt="" name="pic" width="97%" height="106" border="1" id="pic" /><br/><?=$nmpic_tips?></td>
	            </tr>
		        <tr>
		          <td height="24">&nbsp;</td>
		          <td>&nbsp;</td>
		          <td>宽度
							<input type="text" class="ifinfoinputvshort" value="" name="width" onBlur="document.pic.width=document.addcate.width.value;" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
							px &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 高度
							<input type="text" class="ifinfoinputvshort" value="" name="height" onBlur="document.pic.height=document.addcate.height.value;" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
				  px </td>
	            </tr>
	          </table></td>
	        </tr>
		    <script> keypress2();</script>
			  <?php file_exists("widget/ls_language.php")?include '<tr><td colspan="4">'."widget/ls_language.php".'</td></tr>':"" ?>
		  </table>
		  
			
		  <legend></legend>
		  
		  </fieldset>
          <table width="100%" border="0" cellspacing="8">
            <tr>
              <td colspan="3" align="center"><button name="submit2" type="submit" value="确定" class="ifsinglebutton">确定</button></td>
            </tr>
          </table>
	  </div>
		<div class="tablefooter"> </div>
	</form>
</div>
</body>
</html>
