<!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="application/vnd.ms-excel; charset=utf-8">
<title>{echo: lp{m_u_center};/}</title>
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/modules.css">
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/layout.css">
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/style.css">
<script type="text/javascript" src="skin/{echo: $SYSINFO['templates'];/}/js/changeStyle.js"></script>
<script type="text/javascript" src="skin/{echo: $SYSINFO['templates'];/}/js/userchangeStyle.js"></script>

<style type="text/css">
th{background:#EFEFEF}
.red { color:red; }
.edit span{background:#efefef;}
.search {margin:5px;}
.search input {color:#444;}
.clear {clear:both;}

#bgdiv { background-color:#333; position:absolute; left:0px; top:0px; opacity:0.4; filter:alpha(opacity=40); width:100%; height:1000px; z-index:960}
#category_select { width:800px; z-index:961; position:absolute; filter:alpha(opacity=95); left:100px; top:160px; background-color:#fff; height:270px}
.category_title_1 {background:#F6A248; color:#fff; padding-left:10px; line-height:25px; font-weight:bold; font-size:14px;}
.category_title_1 span {float:right; padding-right:5px; cursor:pointer;}
.ulselect {width:198px; height:210px; overflow-x:hidden; overflow-y:scroll; border:1px solid #efefef; float:left;}
.ulselect li {line-height:21px; padding-left:5px; cursor:pointer; }
.ulselect li:hover {background:#F6A248; color:#fff;}
.ulselect li.select {background:#F6A248; color:#fff;}
.category_com {height:30px; line-height:30px; text-align:center;}
.attr_class { background:#F8F8F8; }
.attr_class div.div {border:2px solid #fff; padding:3px;}
.attr_class div span.left{display:block; width:150px; float:left; margin-left:10px; text-align:right; _line-height:24px;}
.attr_class div span.right{display:block; width:350px; float:left; margin-left:5px; text-align:left;}
.attr_class div span.right input {margin-left:5px;}

#picspan {width:82px; height:82px; padding:1px; border:1px solid #efefef; line-height:80px; text-align:center; display:inline-block; overflow:hidden; float:right;}
</style>
</head>
<body onload="menu_style_change('goods_list');changeMenu();">
	{inc: require("shop/index_header.php");/}
	<div class="site_map">
	  {echo:lp{m_current_position};/}<A href="index.php">{echo:$SYSINFO['sys_name'];/}</A>/<a href="modules.php">{echo:lp{m_u_center};/}</a>/&nbsp;&nbsp;{echo:lp{m_csv_export};/}
	</div>
    <div class="clear"></div>
    <div class="apart">
    	{inc: require("modules/left_menu.php");/}
        <div class="main_right">
        	<div class="right_top"></div>
            <div class="cont">
                <div class="cont_title">{echo:lp{m_csv_export};/}</div>
                <hr />
			<form action="do.php?act=csv_export" method="post" id="cvsform" name='cvsform' onsubmit="return checkform(this)">
				<input type="hidden" name="shop_id" value="{echo:$shop_id;/}" />
					<table width="100%" style="border:0" cellspacing="0">
						<tr>
							<td width="120" align="right">{echo:lp{m_csv_name};/}:</td><td width="180"><input type="text" name="filename" value="" /></td><td>{echo:lp{m_no_csv_name};/}</td>
						</tr>
						<tr>
							<td valign="top" align="right">{echo:lp{m_no_chose_goods};/}:</td>
							<td align="left" colspan="2">
							<div style="height:155px; overflow-y:auto; overflow-x:hidden;">
							{sta:foreach($goods_list as $value)[loop]}
								<input type="checkbox" name="goods_id[]"  value="{echo:$value['goods_id'];/}" checked />{echo:$value['goods_name'];/}<br />
							{end:foreach/}
							</div>
								<input type="checkbox" name="allgoods" checked value="1" onclick="chose()" />{echo:lp{m_all_goods};/}
							</td>
						</tr>
						<tr>
							<td align="right">{echo:lp{m_export_code};/}:</td>
							<td align="left" colspan="2">
									<select name="chast" id="chast" onchange="check();">
									<option value="gbk" selected>GBK</option>
									<option value="gb2312">GB2312</option>
									<option value="utf-8">UTF-8</option>
								</select>
							</td>
						</tr>
						<tr><td></td>
							<td colspan="2">
								<input class="submit" type="submit" name="submit" value="{echo:lp{m_csv_export};/}" />
							</td>
						</tr>
					</table>
			</form>
			</div>
		</div>
    <div class="clear"></div>
    {inc: require("shop/index_footer.php");/}
</body>
</html>
<script language="JavaScript" type="text/javascript">
	function chose(){
		var formobj = document.forms['cvsform'];
		var goodsobj = document.getElementsByName('goods_id[]');
		if(!formobj.allgoods.checked){
			formobj.allgoods.checked=false;
			for(i=0;i<goodsobj.length;i++){
				document.getElementsByName('goods_id[]')[i].checked=false;
			}
		}else{
			formobj.allgoods.checked=true;
			for(i=0;i<goodsobj.length;i++){
				document.getElementsByName('goods_id[]')[i].checked=true;
			}
		}
	}
	function checkform(obj){
		var goodsobj = document.getElementsByName('goods_id[]');
		var checkednum=0;
		for(i=0;i<goodsobj.length;i++){
			if(document.getElementsByName('goods_id[]')[i].checked){
				checkednum+=1;
			}
		}
		if(obj.filename.value.length<1){
			alert("{echo:lp{m_no_csv_name};/}");
			return false;
		}
		if(checkednum<1){
			alert("{echo:lp{m_no_chose_goods};/}");
			return false;
		}
	}
	function check(){
		var asd=document.getElementById('chast').value;
		if(asd=="utf-8"){
			alert("选择该编码，打开文件会出现乱码，建议选择GBK编码");
			}
		}
</script>