<?php
	require_once('_approot.php');	
 
	$lan = array();
	
	if($lang != "en"){
		$lan = $lang_cn;
	}else{
		$lan = $lang_en;
	}
	
$openpath=$_GET['openpath'];//源图片文件目录
$productname=urldecode($_GET['name']);//产品名称，默认取用上级分类目录名
$itemnoprefix=trim($productname);//货号前缀，默认取用上级分类目录名
$id=$_GET['id']

?>
<!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>批量导入</title>
<link href="css/admin.css" rel="stylesheet" type="text/css">
<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,
			afterBlur: function(){
				this.sync();
			},
            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>
<script type="text/javascript">
	var e=2;
	var maxPics=50;
function addFile()
{
 if(e<maxPics)
 {
  var str = '<div style="font-family: Simsun;" id="tempobj'+e+'"><BR> '+e+'. &nbsp; <input type="file" name="userfile[]" onclick="addFile()" size="60"/>  </div>';
  
  document.getElementById("myfile").insertAdjacentHTML("beforeEnd",str);
  e++;
 }
 else
 {
  alert("您一次最多只能上传 "+maxPics+" 张图片！")
 }
}
</script>
</head>
<body  bgcolor="#f4f4f4">  <table width="100%" align="center" cellpadding="10" cellspacing="0"  bgcolor="#FFFFFF">
<form id="batchadd" name="batchadd" method="post" action="savebatchadd.php" enctype="multipart/form-data">

  <input type="hidden" name="id" value="<?php echo $id ?>" />

  <tr bgcolor="#f4f4f4">
    <td colspan="3" style="padding-left:12px;" ><div align="center"><font color="#3c8dbc" style="font-size:16px;" >批量导入图片</font></div></td>
    </tr>
  <tr bgcolor="#f4f4f4">
	<td width="8%" style="padding-left:12px;" >说明模板：</td>
	<td colspan="2" style="padding-left:3.0em;" ><p>图片大小：宽度
		<input type="text" value="<?php echo $BigPicW ?>" name="thisBigPicW" style="width:50px;" onblur="document.productpic.width=document.batchadd.width.value;" />
		px &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 高度
		<input type="text" value="<?php echo $BigPicH ?>" name="thisBigPicH" style="width:50px;" onblur="document.productpic.height=document.batchadd.height.value;" />
	  px  ，格式为jpg，大小不要超过<?php echo $PicSize/1000; ?>KB，最宽<?php echo $BigPicW ?>点、最高<?php echo $BigPicW ?>点（示例见最下）。<br />
	    <br />
	    产品名称：
	    <input name="productname" type="text" style="width:200px;" value="<?php echo $productname ?>" size="30"  />	  
	    &nbsp;考虑到优化效果，请在批量添加完以后，修改每个产品名称</p>
	  <p>编号前缀：
	    <input name="itemnoprefix" type="text" style="width:200px;" value="<?php echo $itemnoprefix ?>" size="30" />
	    后顺序添加数字编号<br />
	    <br />
	    <textarea name="productSpecification" id="productSpecification" style="width:98%;height:400px;visibility:hidden;"><?php echo $_POST['productSpecification'];?></textarea>
	    <br />
      产品规格：考虑到优化效果，请在批量添加完以后，修改每个产品的规格	  </p></td>
  </tr>
  <tr bgcolor="#f4f4f4">
    <td height="45" style="padding-left:10px;" >选择文件夹： </td>
    <td valign="middle" id="myfile2" style="padding-left:3.2em;"><div style="font-family: Simsun;" id="tempobj2">&nbsp;&nbsp;&nbsp;
    <?php $thisfolder=strtolower(trim( $productname)); ?>
      <input name="folder" type="text" onclick="" size="88" value="../../1batchimages<?= $thisfolder==""?"":"/".$thisfolder ?>"/>
    </div></td >
    <td align="right" valign="middle" id="myfile2" style="padding-left:3.2em;"><input type="submit" name="button" id="button" value="确定" />
      <input type="reset" name="button5" id="button5" value="重置" /></td >
  </tr>
  <tr bgcolor="#f4f4f4">
	<td height="45" style="padding-left:10px;" ><strong>或</strong>多个文件： </td>
	<td colspan="2" valign="middle" bgcolor="#f4f4f4" id="myfile" style="padding-left:3.2em;">
	<div style="font-family: Simsun;" id="tempobj1">1.&nbsp;&nbsp;<input name="userfile[]" type="file" onclick="addFile()" size="60" /></div>

	</td >
  </tr>
<tr bgcolor="#f4f4f4">
  <td rowspan="2" style="padding-left:12px;" >图片示例：</td>
  <td  height="500" colspan="2" style="padding-left:3.0em;" ><img src="images/picture.gif" alt="" name="productpic" width="<?php echo $BigPicW ?>" height="<?php echo $BigPicH?>" border="1" id="productpic" style="float:left;" /></td>
</tr>
<tr bgcolor="#f4f4f4">
  <td width="66%" style="padding-left:3.2em;">大图格式为jpg，大小不要超过<?php echo $PicSize/1000; ?>KB，图片宽度一般最宽<?php echo $BigPicW ?>点、高度最高<?php echo $BigPicW ?>点。</td>
  <td width="26%" align="right" style="padding-left:3.2em;"><span style="padding-left:10px;">
  <input type="submit" name="button3" id="button3" value="确定" />
  </span>
    <label>
      <input type="reset" name="button4" id="button4" value="重置" />
    </label></td>
</tr>
</form>  
</table>
</body>
</html>
