{include file="pageheader.htm"}
{insert_scripts files='../js/quickView.js'}
<div class="BodyRight">
	<div class="RightDetill">
		<ul>
			<li class="Green"><a href="http://www.nitc.cc/About-nitc/488.html#_Toc239504366" target="_blank">查看演示文件</a></li>
			<li class="SkyBlue"><a href="help_document.php?action=download">下载演示文档</a></li>
			<li class="Black">操作帮助请详见演示文件!</li>
			<li style="float:right;margin:0px;padding-right:15px;padding-left:5px;"><a href="javascript:void(0);" onclick="javascript:searchBox()">高级搜索</a></li>
			<li class="DetillRigh">
			<form name="searchForm" method="get" action="product.php" onsubmit="return doSearchSubmit()">
			{if $searchText}
				<input type="text" value="{$searchText}" name="searchText" id="searchText" />	
			{else}
				<input type="text" name="searchText" id="searchText" onFocus="javascript:clearSearchText('searchText');" value="查找产品信息..." />	
			{/if}
			<input name="action" value="list" type="hidden" />
			<input name="language" id="language" value="{$default_language}" type="hidden" />
			<input type="submit" value="" class="bt_go" />
			</form>
			</li>
		</ul>
	</div>
	
	<div id="searchBox" class="close" style="padding-left:15px;padding-right:15px;border-bottom:1px solid #c8d6bd;background:#f9fef4">
		<form name="searchForm1" method="get" action="product.php" onsubmit="return doSearchSubmit()">
	<table width="100%" cellpadding="4" cellspacing="1" boder="0">
	  <tr>
		<td>&nbsp;
		
		</td>
		<td width="100"><select name="category_id" id="category_id">
			<option value="0" selected="selected">选择产品分类</option>
			{$category}
		</select></td>
		
		<td width="100" style="padding-left:5px;">
			{if $searchText}
				<input type="text" value="{$searchText}" name="searchText" id="searchText1"  />	
			{else}
				<input type="text" name="searchText" id="searchText1" onFocus="javascript:clearSearchText('searchText1');"  value="查找产品信息..." />	
			{/if}				
		</td>
	
		<td width="20" style="padding-left:5px;">
			<select name="featured_product">
				<option value="-1" selected="selected">推荐</option>
				<option value="1" {if $featured_product=='1'} selected="selected" {/if}> 是 </option>
				<option value="0" {if $featured_product=='0'} selected="selected" {/if}> 否 </option>
			</select>
		</td>
		
		<td width="20" style="padding-left:5px;">	
		<select name="new_product">
			<option value="-1" selected="selected">新产品</option>
			<option value="1" {if $new_product=='1'} selected="selected" {/if}> 是 </option>				
			<option value="0" {if $new_product=='0'} selected="selected" {/if}> 否 </option>
		</select>	</td>
		<td width="20" style="padding-left:5px;">	
		<select name="state_product">
			<option value="-1" selected="selected">状态</option>
			<option value="0" {if $state_product=='0'} selected="selected" {/if}>显示</option>
			<option value="1" {if $state_product=='1'} selected="selected" {/if}>隐藏</option>		
		</select>	
		</td>
		
		<td width="10" style="padding-left:5px;">
		  <input name="action" value="list" type="hidden" />
		  <input type="submit" value="" class="sbt_go" />
	    </td>
	  </tr>
	</table>
	</form>
	</div>
	
	<div class="PageContent">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		  {if $language|@count>1}
		  <tr>
			<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				{section name=loop loop=$language}
					{if $smarty.section.loop.index == 0}
						<td width="85" height="29" align="center" id="languagesel{$language[loop].language_id}" {if $language[loop].language_id==$default_language} class="Move" {else} class="Out" {/if}><a href="javascript:void(0);" onclick="javascript:languageselect('{$language[loop].language_id}')">{$language[loop].name}</a></td>
					{else}
						<td width="5" align="center"><img src="images/{$skin}/tiao.gif"></td>
						<td width="85" align="center" id="languagesel{$language[loop].language_id}" {if $language[loop].language_id==$default_language} class="Move" {else} class="Out" {/if}><a href="javascript:void(0);" onclick="javascript:languageselect('{$language[loop].language_id}')">{$language[loop].name}</a></td>	
					{/if}
				{/section}
				<td align="left" class="LineRight" style="padding-left:10px;">点击左侧语言选项,查找不同语言产品信息.</td>
			  </tr>
			  
			</table> </td>
		  </tr>
		  <tr>
			<td class="LineRightBlue">
			{else}
			<tr>
			<td class="LineRightBlue1">	  	
		{/if}
				<table width="95%" border="0" cellpadding="0" cellspacing="0" style="margin-left:20px;">
			  <tr>
				<td width="70%" height="24">产品管理 > 产品列表</td>
				<td width="30%" align="right" class="bt_add">{if $product_manage==true}<a href="product.php?action=add">添加</a>{/if}</td>
			  </tr>
			</table>
			</td>
		  </tr>
		  
		</table>
		<form name="theForm" method="post" action="" id="theForm">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:10px;">
		  <tr>
			<td height="36" class="BotNavBg">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td width="50" align="left" style="padding-left:13px;">
				<input type="checkbox" name="check_all_up" value="yes" onClick="return select_all_product('check_all_up','theForm');" /> 全选</td>
				<td style="padding-left:5px;">
				{if $product_setting==true}
				<select name="select" onChange="change(this)">
					<option value="">--选择操作--</option>
					<option value="sort">排序</option>
					<option value="del">删除</option>
					<option value="featured">推荐</option>
					<option value="unfeatured">取消推荐</option>
					<option value="new">新产品</option>
					<option value="unnew">取消新产品</option>
					<option value="move">转移产品</option>
					<option value="show">前台显示</option>
					<option value="hidden">前台隐藏</option>
				</select>
				{/if}
				   </td>
				<td align="right" style="padding-right:3px;">{$page}</td>
			  </tr>
			</table>
			</td>
		  </tr>
		</table>
        <div class="tablelisthead">
        <ul>
        <li class="li_5">选择</li>
        <li class="li_8 viewsort">
			<a href="product.php?action=list&ordertype=sort_order&order={$order}{$strpass1}">排序</a>
            {if $ordertype=='sort_order'}
				{if $order=='up'}
					<img src="images/down.gif" />
				{else}
					<img src="images/up.gif" />
				{/if}
			{/if}
			
            </li>
        <li class="li_27 viewsort">
			<a href="product.php?action=list&ordertype=name&order={$order}{$strpass1}">产品名</a>
			{if $ordertype=='name'}
				{if $order=='up'}
					<img src="images/down.gif" />
				{else}
					<img src="images/up.gif" />
				{/if}
			{/if}
			</li>
            <li class="li_20"><select name="category_id" id="category_id" style="width:85%;" onchange="javascript:window.location='product.php?action=list&category_id='+this.options[this.selectedIndex].value;">
					<option value="0" selected="selected">产品分类</option>
					{$category}
				</select></li>
        <li class="li_10">型号</li>
		<li class="li_5">显示</li>
        <li class="li_5">推荐</li>
        <li class="li_5">新品</li>
        <li class="li_15">{if $product_manage==true or $product_del==true}编辑{/if}</li>
        </ul>
        </div>
         {if $product_arr}
			 {section name=loop loop=$product_arr}
				 <div id="languageBox{$product_arr[loop].language_id}" {if $product_arr[loop].language_id == $default_language} class=""  {else} class="close"  {/if}>
        <div class="tablelist">
        {foreach from=$product_arr[loop].product item=product}
        <ul onmouseover="overbgcolor('product_{$product_arr[loop].language_id}_{$product.cnt}')" onmouseout="outbgcolor('product_{$product_arr[loop].language_id}_{$product.cnt}')">
        <li class="li_5">{if $smarty.section.loop.index == 0} 
                        <input type="checkbox" name="product[]" value="{$product.product_id}" id="product_{$product_arr[loop].language_id}_{$product.cnt}" onclick="clickCheckbox({$product.cnt},{$product_arr[loop].language_id})" class="listcheck"/>
                    {else}
                        <input type="checkbox" name="product{$product_arr[loop].language_id}[]" value="" id="product_{$product_arr[loop].language_id}_{$product.cnt}" onclick="clickCheckbox({$product.cnt},{$product_arr[loop].language_id})" class="listcheck"/>
                    {/if}</li>
        <li class="li_8"><input type="text" value="{$product.sort_order}" onblur="updatesort('{$product.product_id}','{$product_arr[loop].language_id}')" name="sortOrder[{$product.product_id}]" id="sort{$product.product_id}l{$product_arr[loop].language_id}" class="listinput" />
            </li>
        <li class="li_27">{if $product.small_image}
					<a href="{$product.product_url}" title="<img src='../upload/photo/{$product.small_image}'>" target="_blank">{$product.img} {$product.name}</a>
					{else}
					<a href="{$product.product_url} "target="_blank">{$product.img} {$product.name}</a>
					{/if}</li>
            <li class="li_20"><a href="product.php?action=list&category_id={$product.category_row.category_id}">{$product.category_row.name}</a></li>
        <li class="li_10" style="font-size:10px;">{$product.model}</li>
		<li class="li_5" style="text-indent:20px;">{$product.state}</li>
        <li class="li_5" style="text-indent:20px;">{$product.is_featured}&nbsp;</li>
        <li class="li_5" style="text-indent:20px;">{$product.is_new}&nbsp;</li>
        <li class="li_15 operation">{if $product_manage==true}
						<a href="product.php?action=edit&product_id={$product.product_id}{$strpass}" title="编辑" class="op_edit"></a>
					{else}
						<span class="op_edit_off"></span>
					{/if}
					{if $product_manage==true}
						<a href="product.php?action=copy&product_id={$product.product_id}{$strpass}" title="复制" class="op_copy"></a>
					{else}
						<span class="op_copy_off"></span>
					{/if}
					{if $product_del==true}
						<a href="product.php?action=del&product_id={$product.product_id}{$strpass}" onClick="return window.confirm('确定删除该产品?')" title="删除" class="op_del"></a>
					{else}
						<span class="op_del_off"></span>
					{/if}</li>
        </ul>
        {/foreach}
        </div>
		</div>
			{/section}
		   {else}
				{section name=loop loop=$language}
					 <div id="languageBox{$language[loop].language_id}" {if $language[loop].language_id == $default_language} class=""  {else} class="close"  {/if}>
					 
                     <div class="tablelist">
                 <ul onmouseover="this.style.background ='#FFFDD7'" onmouseout="this.style.background ='#FFFFFF'">
                 <li>您还没有添加产品!</li>
                 </ul>
                 </div>
					 </div>
				{/section}
		  {/if}
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td height="36" class="BotNavBg">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td width="50" align="left" style="padding-left:13px;"><input type="checkbox" name="check_all_bottom" value="yes" onClick="return select_all_product('check_all_bottom','theForm');" /> 全选</td>
				<td style="padding-left:5px;">
				{if $product_setting==true}
				<select name="select" onChange="change(this)">
					<option value="">--选择操作--</option>
					<option value="sort">排序</option>
					<option value="del">删除</option>
					<option value="featured">推荐</option>
					<option value="unfeatured">取消推荐</option>
					<option value="new">新产品</option>
					<option value="unnew">取消新产品</option>
					<option value="move">转移产品</option>
					<option value="show">前台显示</option>
					<option value="hidden">前台隐藏</option>
				</select>
				{/if}
				   </td>
				<td align="right" style="padding-right:3px;">{$page}</td>
			  </tr>
			</table>
			</td>
		  </tr>
		</table>
		</form>
	</div>
</div>
<script type="text/javascript">

var language=new Array();
{section name=loop loop=$language}
{literal}
	language[{/literal}{$smarty.section.loop.index}{literal}]={/literal}{$language[loop].language_id}{literal};
{/literal}
{/section}
{literal}

function clickCheckbox(cnt,language_id){
	for(i=0;i<language.length;i++){
		if(language_id!=language[i]){
			if(document.getElementById("product_"+language[i]+"_"+cnt).checked == true){
				document.getElementById("product_"+language[i]+"_"+cnt).checked=false;
				obj=document.getElementById("product_"+language[i]+"_"+cnt);
				if(obj.checked==false){
					var tr = obj.parentNode.parentNode;
					tr.style.backgroundColor ="#FFFFFF";
				}
			}else{
				document.getElementById("product_"+language[i]+"_"+cnt).checked=true;
				obj=document.getElementById("product_"+language[i]+"_"+cnt);
				if(obj.checked==true){
					var tr = obj.parentNode.parentNode;
					tr.style.backgroundColor ="#FFFDD7";
				}
			}
		}
	}
}

function select_all_product(chkName,frmName){
	var frm=document.forms[frmName];
	for(var i=0;i<frm.elements.length;i++){
		var e =frm.elements[i];
		if ((e.name != chkName) && (e.type=='checkbox')){
			if (chkName == 'check_all_bottom'){
				e.checked = frm.check_all_bottom.checked;
			}
			if (chkName == 'check_all_up'){
				e.checked = frm.check_all_up.checked;
			}			
			if ((e.name != 'check_all_bottom') && (e.name!='check_all_up')){
				tr_bgcolor(frm.elements[i]);
			}
		}	
	}
}

function overbgcolor(id){
	obj=document.getElementById(id);
	if(obj.checked==false){
		var tr = obj.parentNode.parentNode;
		tr.style.backgroundColor ="#FFFDD7";
	}		
}				

function outbgcolor(id){
	obj=document.getElementById(id);
	if(obj.checked==false){
		var tr = obj.parentNode.parentNode;
		tr.style.backgroundColor ="#FFFFFF";
	}		
}

function clearSearchText(searchText){
	if(document.getElementById(searchText).value=="查找产品信息..."){
		document.getElementById(searchText).value="";
	}
}
function doSearchSubmit(){
	if(document.getElementById("searchText").value=="查找产品信息..."){
		document.getElementById("searchText").value="";
	}
	if(document.getElementById("searchText1").value=="查找产品信息..."){
		document.getElementById("searchText1").value="";
	}	
}

function searchBox() {
	if (document.getElementById('searchBox').className=="close"){
		document.getElementById('searchBox').className ="exp";
	}else{
		document.getElementById('searchBox').className="close";
	}
}

function searchSubmit(){
	if(document.getElementById("searchText").value=="查找产品信息..."){
		document.getElementById("searchText").value="";
	}
	document.searchForm.action="product.php";
	document.searchForm.submit();
}

function languageselect(id){
	{/literal}
	{section name=loop loop=$language}
	{literal}
		document.getElementById('languageBox{/literal}{$language[loop].language_id}{literal}').className="close";
		document.getElementById('languagesel{/literal}{$language[loop].language_id}{literal}').className="Out";
	{/literal}
	{/section}
	{literal}
	document.getElementById('languagesel'+id).className="Move";
	document.getElementById('languageBox'+id).className="";
	document.getElementById('language').value=id;
	document.getElementById('language1').value=id;
}

function updatesort(product_id,language_id){
	{/literal}
	{section name=loop loop=$language}
	{literal}
		document.getElementById('sort'+product_id+'l{/literal}{$language[loop].language_id}{literal}').value=document.getElementById('sort'+product_id+'l'+language_id).value;
	{/literal}
	{/section}
	{literal}
}

function change(selObj){
	var value=selObj.options[selObj.selectedIndex].value;
	if(value=="sort"){
		document.theForm.action="product.php?action=order{/literal}{$strpass}{literal}";
		document.theForm.submit();
	}else if(value!=""){
		var num=0; 
		var product=document.getElementsByName("product[]")
		for(var i=0;i<product.length;i++){ 
			if(product[i].checked==true){   
			  num=num+1; 
			} 
		} 
		if(num==0){
			alert("没有选择产品");
			return;
		}
		if(num>0){
			if(value=="del"){
				if(confirm("确认删除选择的产品?")==true){
					document.theForm.action="product.php?action=del{/literal}{$strpass}{literal}";
					document.theForm.submit();
				}		
			}
			if(value=="featured"){
				if(confirm("确认推荐选择的产品?")==true){
					document.theForm.action="product.php?action=featured{/literal}{$strpass}{literal}";
					document.theForm.submit();
				}			
			}	
			if(value=="unfeatured"){
				if(confirm("确认取消选择的推荐产品?")==true){
					document.theForm.action="product.php?action=unfeatured{/literal}{$strpass}{literal}";
					document.theForm.submit();
				}			
			}	
			if(value=="new"){
				if(confirm("确认选择的产品设为新产品?")==true){
					document.theForm.action="product.php?action=new{/literal}{$strpass}{literal}";
					document.theForm.submit();
				}				
			}
			if(value=="unnew"){
				if(confirm("确认选择的产品取消新产品?")==true){
					document.theForm.action="product.php?action=unnew{/literal}{$strpass}{literal}";
					document.theForm.submit();
				}				
			}
			if(value=="move"){
				document.theForm.action="product.php?action=move{/literal}{$strpass}{literal}";
				document.theForm.submit();
			}			
			if(value=="show"){
				if(confirm("确认选择的产品为显示产品?")==true){
					document.theForm.action="product.php?action=show{/literal}{$strpass}{literal}";
					document.theForm.submit();
				}				
			}				
			if(value=="hidden"){
				if(confirm("确认选择的产品为隐藏产品?")==true){
					document.theForm.action="product.php?action=hidden{/literal}{$strpass}{literal}";
					document.theForm.submit();
				}				
			}				
		}		
	}
}
{/literal}
</script>
{include file="pagefooter.htm"}