<form action="" method="get" name="search" id="search"  onsubmit="return ajax_list();" >
<input type="hidden" name="action" id="action" value="ajax_list" />
<input type="hidden" name="class_id" id="class_id" />
<table  class="from_table">
	<tr>
		<th width="77"><tpl> $langSupplyKeyword </tpl></th>
		<td width="274"><input type="text" name="keyword" id="keyword"  class="txtinput_short" /></td>    
		<th width="130"><tpl> $langSupplyUsername </tpl></th>
		<td width="198"><input type="text" name="username" id="username"  class="txtinput_short" /></td>
	</tr>
	<tr>
		<th><tpl> $langSupplyType </tpl>:</th>
		<td>
			<input type="radio" name="type" value="" checked="checked" /><tpl> $langSupplyAll </tpl>
			<input type="radio" name="type" value="2" /><tpl> $langSupplyTypeGone </tpl>
			<input type="radio" name="type" value="1" /><tpl> $langSupplyTypeQiu </tpl>
		</td>
		<th><tpl> $langSupplyQuality </tpl>:</th>
		<td>
			<input type="radio" name="quality" value="" checked="checked" /><tpl> $langSupplyAll </tpl>
			<input type="radio" name="quality" value="1" /><tpl> $langSupplyQualityOne </tpl>
			<input type="radio" name="quality" value="2" /><tpl> $langSupplyQualityTwo </tpl>
		</td>
	</tr>
	<tr>
		<th><tpl> $langSupplyAntmuseState </tpl>:</th>
		<td>
			<input type="radio" name="anymous" value="" checked="checked" /><tpl> $langSupplyAll </tpl>
			<input type="radio" name="anymous" value="2" /><tpl> $langCYes </tpl>
			<input type="radio" name="anymous" value="1" /><tpl> $langCNo </tpl>
		</td>
		</tr>
		<tr>
		<th><tpl> $langSupplySelClass </tpl>:</th>
		<td colspan="3">
			<select name="c1" id="c1" style="WIDTH: 110px">
			<option value=""></option>
			<tpl>foreach item = parent from = $ProductCateArray</tpl>
			<option value="<tpl>$parent.id</tpl>||<tpl>$parent[5]</tpl>"><tpl>$parent.name</tpl></option>
			<tpl>/foreach</tpl>
			</select>
			<select name="c2" id="c2" style="WIDTH: 110px" disabled="disabled">
			</select>
			<select name="c3" id="c3" style="WIDTH: 110px" disabled="disabled">
			</select>
			<select name="c4" id="c4" style="WIDTH: 110px" disabled="disabled">
			</select> 
		</td>
	</tr>


</table>
<div class="table-5-bottom"><div class="p-left-2"><span class="btn_left"><input type="submit" name="submit"  class="btn_submit" value="<tpl> $langSysSearch </tpl>" /></span>
			<span class="btn_left"><input type="reset" name="reset"  class="btn_submit" value="<tpl> $langSupplyReset </tpl>" /></span></div></div>
</form>
<tpl> if $supply_array[0].s_id neq '' </tpl>
<form action="javascript:void(null);" id="supplylist" name="supplylist" method="post">
	<table class="from_table2_one top-1">
		<tr class="area_ajax_list_title">
			<th class="pd-left" width="40" align="left" style="text-align:left"><tpl> $langSupplySel </tpl></th>
			<th width="130" align="left" style="text-align:left"><tpl> $langSupplyType </tpl></th>
			<th width="100" align="left" style="text-align:left"><tpl> $langSupplyQuality </tpl></th>
			<th width="210" align="left" style="text-align:left"><tpl> $langSupplyTitle </tpl></th>
			<th width="110" align="left" style="text-align:left"><tpl> $langSupplyTime </tpl></th>
			<th width="100" align="left" style="text-align:left"><tpl> $langCOperation </tpl></th>
		</tr>
		<div id="liststylealignleft">
		<tpl> section name=i loop=$supply_array </tpl>
		<tr>
		  <td class="pd-left" width="40" ><input type="checkbox" name="s_id[]" value="<tpl> $supply_array[i].s_id </tpl>" /></td>
			<td class="supplylist" width="130">
				<tpl> if $supply_array[i].s_state eq 1 </tpl><font color="#934873" > <tpl> $langSupplyStateNormal </tpl> </font><tpl> /if </tpl>
				<tpl> if $supply_array[i].s_state eq 2 </tpl><font color="#934873" > <tpl> $langSupplyStateClose </tpl> </font><tpl> /if </tpl>
				<tpl> if $supply_array[i].s_recommend eq 1 </tpl>
					<a href="javascript:;" onclick="ajax_recommend('action=recommend&supply_id=<tpl> $supply_array[i].s_id </tpl>&recommend_id=<tpl> $supply_array[i].s_recommend </tpl><tpl>if $supply_array|@count neq 1</tpl>&curpage=<tpl> $curpage </tpl><tpl>/if</tpl>');"><font color="#FF0000" > [<tpl> $langSupplyTypeJian </tpl>] </font></a>
				<tpl> else </tpl>
					<a href="javascript:;" onclick="ajax_recommend('action=recommend&supply_id=<tpl> $supply_array[i].s_id </tpl>&recommend_id=<tpl> $supply_array[i].s_recommend </tpl><tpl>if $supply_array|@count neq 1</tpl>&curpage=<tpl> $curpage </tpl><tpl>/if</tpl>');"><font color="#999999" > [<tpl> $langSupplyTypeJian </tpl>] </font></a>
				<tpl> /if </tpl>
				<tpl> if $supply_array[i].s_type eq 1 </tpl> <tpl> $langSupplyTypeQiu </tpl> <tpl> /if </tpl>
				<tpl> if $supply_array[i].s_type eq 2 </tpl> <tpl> $langSupplyTypeGone </tpl> <tpl> /if </tpl>
				<tpl> if $supply_array[i].s_anonymous eq 2 </tpl>
					<font color="#FF0000" > [<tpl> $langSupplyAntmuseShort </tpl>] </font>
				<tpl> /if </tpl>
		  </td>
		  <td width="100" class="supplylist">
				<tpl> if $supply_array[i].s_quality eq 1 </tpl>
					<tpl> $langSupplyQualityOne </tpl>
				<tpl> /if </tpl>
				<tpl> if $supply_array[i].s_quality eq 2 </tpl>
					<tpl> $langSupplyQualityTwo </tpl>
				<tpl> /if </tpl>
		  </td>
		  <td class="supplylist" width="210">
				<a target="_blank" href="<tpl> $site_url </tpl>/app/<tpl> $app_module.app_module_sign </tpl>/index.php?action=view&sid=<tpl> $supply_array[i].s_id </tpl>"><tpl> $supply_array[i].s_title </tpl></a>
		  </td>
			<td class="supplylist"><tpl> $supply_array[i].s_time </tpl></td>
			<td width="100" class="supplylist">
				<a href="javascript:void(null);" onclick="ajax_modi('action=modi&s_id=<tpl> $supply_array[i].s_id </tpl>&keyword=<tpl> $condition.keyword </tpl>&type=<tpl> $condition.type </tpl>&quality=<tpl> $condition.quality </tpl>&class_id=<tpl> $condition.class_id </tpl>&username=<tpl> $condition.username </tpl>&anymous=<tpl> $condition.anymous </tpl><tpl>if $supply_array|@count neq 1</tpl>&curpage=<tpl> $curpage </tpl><tpl>/if</tpl>');"><tpl> $langSysCEdit </tpl></a>
				<a href="javascript:void(null);" onclick="ajax_replay('action=replay&s_id=<tpl> $supply_array[i].s_id </tpl>&keyword=<tpl> $condition.keyword </tpl>&type=<tpl> $condition.type </tpl>&quality=<tpl> $condition.quality </tpl>&class_id=<tpl> $condition.class_id </tpl>&username=<tpl> $condition.username </tpl>&anymous=<tpl> $condition.anymous </tpl><tpl>if $supply_array|@count neq 1</tpl>&curpage=<tpl> $curpage </tpl><tpl>/if</tpl>');"><tpl> $langSupplyManageRe </tpl></a>
			</td>
		</tr>
		<tpl> /section </tpl>
		</div>
		
  </table>
  <div class="table-5-bottom">
  <div class="p-left"><span class="btn_left"><input type="button" value="<tpl> $langSupplyControlSel </tpl>" id="control_seclect" name="control_seclect" class="btn_submit" /> </span>
					<span class="btn_left"> <input type="button" value="<tpl> $langSupplyStateClose </tpl>" id="supply_stop" name="supply_stop" class="btn_submit" />	</span>
					<span class="btn_left"> <input type="button" value="<tpl> $langSupplyPutOut </tpl>" id="supply_start" name="supply_start" class="btn_submit" />	</span>
				<span class="btn_left"> <input type="button" value="<tpl> $errSupplyDel </tpl>" id="supply_del" name="supply_del"  class="btn_submit" /></span>
				<div style="float:right;"><tpl> $page_list </tpl></div></div>
  </div>
</form>
<tpl> else </tpl>
  <tpl> $langSysCNoThing </tpl>
<tpl> /if </tpl>
<div id="question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langCConfirmDelete </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
		<input type="hidden" id="del_value" />
</div> 
<script language="javascript">
//设置供求信息为发布状态
var question = $('#question')[0];
$(document).ready(function() {
	//
	tonext('#c1');
	//控制选择
	$('#control_seclect').click(
		function(){
			$('#supplylist input[@type=checkbox]').each(function(){
				$(this).attr('checked',!$(this).attr('checked'))
			})
		}
	)
	$('#supply_start').click(function() {
		$('#supplylist').attr("action", "../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=change_state&state=1");
		$('#supplylist').ajaxSubmit(options);
		return false;
	});
	
	$('#supply_stop').click(function() {
		$('#supplylist').attr("action", "../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=change_state&state=2");
		$('#supplylist').ajaxSubmit(options);
		return false;
	});
	
	var options = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
						hideLoading();
						showMessage(msg.message,msg.type);
						if(msg.type == '1'){
							ShowDiv = "result_content";
							getPageContent("../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=ajax_list&keyword=<tpl> $condition.keyword </tpl>&type=<tpl> $condition.type </tpl>&quality=<tpl> $condition.quality </tpl>&class_id=<tpl> $condition.class_id </tpl>&username=<tpl> $condition.username </tpl>&anymous=<tpl> $condition.anymous </tpl><tpl>if $supply_array|@count neq 1</tpl>&curpage=<tpl> $curpage</tpl><tpl>/if</tpl>");
						}
					},
		type:      'post',
		dataType:  'json'
	};
	$("#supply_del").click(function(){
		$.blockUI(question, { width: '275px' });
	});
	
	$('#yes').click(function() {
		$.unblockUI();
		$('#supplylist').attr("action", "../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=del");
		$('#supplylist').ajaxSubmit(options);
	});
	$('#no').click($.unblockUI);
});

//搜索
function ajax_list(){
	/*取表单参数*/
	var queryString=$("#search").formSerialize();
	$.ajax({
		url: "../app/<tpl> $app_module.app_module_sign </tpl>/system.php",
		data: queryString,
		type:'get',
		dataType:"html",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideMessage();
			$("#result_content").html(msg);
			hideLoading();
		}
	});
	return false;
}

//更改推荐状态
function ajax_recommend(str){
	$.ajax({
		url: "../app/<tpl> $app_module.app_module_sign </tpl>/system.php",
		data: str,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			//showMessage(msg.message);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent("../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=ajax_list&keyword=<tpl> $condition.keyword </tpl>&type=<tpl> $condition.type </tpl>&quality=<tpl> $condition.quality </tpl>&class_id=<tpl> $condition.class_id </tpl>&username=<tpl> $condition.username </tpl>&anymous=<tpl> $condition.anymous </tpl><tpl>if $supply_array|@count neq 1</tpl>&curpage=<tpl> $curpage</tpl><tpl>/if</tpl>");
			}
		}
	});
	return false;
}
//编辑
function ajax_modi(str){
	$.ajax({
		url: "../app/<tpl> $app_module.app_module_sign </tpl>/system.php",
		data: str,
		type:'post',
		dataType:"html",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			$('#result_content').html(msg);
		}
	});
	return false;
}

//管理回复
function ajax_replay(str){
	$.ajax({
		url: "../app/<tpl> $app_module.app_module_sign </tpl>/system.php",
		data: str,
		type:'get',
		dataType:"html",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			$('#result_content').html(msg);
		}
	});
	return false;
}

function tonext(whos) {
	$(whos).change(
	function(){
		var valarray=$(this).val().split('||');
		$('#class_id').val(valarray[0]);
		if (valarray[1]=='1') {
			$(this).next().attr('disabled','true').html('<option value="" selected="selected"><tpl> $langCDataToLoading </tpl></option>');
			$.get('../member/own_productcate.php',{action:'list',id:valarray[0]},function(data){
				DataArray = data.split("|||");var a='';for (var i = 0; i<DataArray.length-1; i++) {att=DataArray[i].split("||");id=att[0];cla=att[2];a+='<option value="'+id+'||'+cla+'">'+att[1]+((cla=='1')?' ->':'')+'</option>';};
				$(whos).next().removeAttr('disabled').html('<option value="" selected="selected"></option>'+a).nextAll().html('');
				tonext($(whos).next());
			})} else {$(whos).nextAll().html('').attr('disabled','true');
			};
	})
};
</script>