<link id="calCss" type="text/css" href="<tpl> $site_url </tpl>/js/calendar/blue/blue.css" rel="Stylesheet" />
<script type="text/javascript" src="<tpl> $site_url </tpl>/js/calendar/Calendar.js"></script>
<link rel="stylesheet" href="<tpl> $site_url </tpl>/js/jquery/thickbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="<tpl> $site_url </tpl>/js/jquery/thickbox.js"></script>
<form action="../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=update" method="post" enctype="multipart/form-data" name="form_modi" id="form_modi">
<input type="hidden" name="ca_id" id="ca_id" value="<tpl> $act_row.ca_id </tpl>" />
    <table class="from_table">
		<tr>
			<th class="th3"><tpl> $langSysCATitle </tpl>:</th>
			<td width="530" class="td1">
				<input type="text" maxlength="100" name="ca_title" id="ca_title" value="<tpl> $act_row.ca_title </tpl>" />
			</td>
		</tr>
		<tr>
			<th class="th3"><tpl> $langSysCAEndTime </tpl>:</th>
			<td width="530" class="td1"><input type="text" name="ca_end_time" id="ca_end_time" value="<tpl> $act_row.ca_end_time </tpl>" style="border:solid 1px #B0DF82;cursor:pointer; width:100px; background:url(../js/calendar/blue/cal_btn.gif) no-repeat right; height:18px; padding-right:19px;" readonly="readonly" /></td>
		</tr>
		<tr>
			<th class="th3"><tpl> $langSysCAContent </tpl>:</th>
			<td width="530" class="td1">
			<tpl> php </tpl>
			include("../../classes/resource/fckeditor/fckeditor.php") ;
			$oFCKeditor = new FCKeditor('content') ;
			$oFCKeditor->BasePath	= '../classes/resource/fckeditor/' ;
			$oFCKeditor->ToolbarSet = 'Simple';
			$oFCKeditor->Width	= 510 ;
			$oFCKeditor->Height	= 300 ;
			$oFCKeditor->Value	= $this->_tpl_vars['act_row']['ca_content'];
			$oFCKeditor->Create() ;
			<tpl> /php </tpl>
			<input type="hidden" name="ca_content" id="ca_content" value="<tpl> $act_row.ca_content </tpl>" />
			</td>
		</tr>
		<tr>
			<th class="th3"><tpl> $langSysCAGoods </tpl>:</th>
			<td width="530" class="td1">
				<table width="100%" border="0" cellpadding="0" cellspacing="0" rules="none" class="tables_table">
					<tr>
						<td><tpl> $langSysCADelShort </tpl></td>
						<td><tpl> $langSysCAGoodsName </tpl></td>
						<td><tpl> $langSysCAGoodsNum </tpl></td>
						<td><tpl> $langSysCAGoodsCredits </tpl></td>
						<td><tpl> $langSysCAGoodsPic </tpl></td>
					</tr>
					<tbody id="act_pro">
						<tpl> section name=loop loop=$act_goods_list </tpl>
						<input type="hidden" name="cag_id[]" id="cag_id[]" value="<tpl> $act_goods_list[loop].cag_id </tpl>" />
						<tr>
							<td><input type="checkbox" name="del_cag_id[]" value="<tpl> $act_goods_list[loop].cag_id </tpl>" /></td>
							<td><input type='text' size='20' maxlength='100' name='product_name[]' value="<tpl> $act_goods_list[loop].cag_name </tpl>" /></td>
							<td><input type='text' size='5' maxlength='6' name='product_num[]' value="<tpl> $act_goods_list[loop].cag_num </tpl>" /></td>
							<td><input type='text' size='5' maxlength='6' name='product_credits[]' value="<tpl> $act_goods_list[loop].cag_credits </tpl>" /></td>
							<td>
								<a href="<tpl> $site_url </tpl>/<tpl> $act_goods_list[loop].cag_pic </tpl>" class="thickbox" target="_blank"><tpl> $langSysCAGoodsViewPic </tpl></a>
								<a href="javascript:;" onclick="$('#goods_pic_<tpl> $smarty.section.loop.index </tpl>').toggle();"><tpl> $langSysCAGoodsChangePic </tpl></a>
								<span style="display:none" id="goods_pic_<tpl> $smarty.section.loop.index </tpl>">
								<br />
								<input type='file' name='product_pic_<tpl> $smarty.section.loop.index </tpl>' />
								</span>
							</td>
						</tr>
						<tpl> /section </tpl>
					</tbody>
				</table>
			</td>
		</tr>
		<tr>
    		<td></td>
    	    <td width="530">
				<span class="btn_left"><input type="button" name="selectall" id="selectall" class="btn_submit" value="<tpl> $langSysCADelAll </tpl>" /></span>
				<span class="btn_left"><input type="submit" class="btn_submit" value="<tpl> $langSysCASave </tpl>" /></span>
				<span class="btn_left"><input type="button" name="add_button" id="add_button" class="btn_submit" value="<tpl> $langSysCAGoodsAdd </tpl>" /></span>
				<span class="btn_left"><input type="button" name="return_button" id="return_button" class="btn_submit" value="<tpl> $langSysCAReturnList </tpl>" /></span>
			</td>
		</tr>
  </table>
</form>
<script>
$(document).ready(function() {
	//增加一列
	$('#add_button').click(function(e){
		var num = $('#act_pro').children('tr').length;
		$('#act_pro').append("<tr>" + 
			"<td></td>" + 
			"<td><input type='text' size='20'  name='product_name[]' /></td>" + 
			"<td><input type='text' size='10' name='product_num[]' /></td>" + 
			"<td><input type='text' size='10' name='product_credits[]' /></td>" +
			"<td><input type='file' name='product_pic_"+num+"' /></td>"
			+"</tr>"
		);
	});
	
	$('#selectall').click(
		function(){
			$('#form_modi input[@type=checkbox]').each(function(){
				$(this).attr('checked',true)
			})
		}
	);
	
	$('#return_button').click(
		function(){
			ShowDiv	= 'result_content';
			getPageContent("../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=ajax_list&curpage=<tpl>$curpage</tpl>");
		}
	);
	
	//添加
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		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&curpage=<tpl>$curpage</tpl>");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	//对添加表单做的验证定义
	$("#form_modi").validate({
		errorClass: "wrong",
		rules: {
			ca_title:{required:true},
			ca_end_time:{required:true}
		},
		messages: {
			ca_title:{required:'<tpl> $errSysCATitleIsEmpty </tpl>'},
			ca_end_time:{required:'<tpl> $errSysCAEntTimeIsEmpty </tpl>'}
		},
		submitHandler: function() {
			var oEditor = FCKeditorAPI.GetInstance('content');
			$('#ca_content').val(oEditor.GetXHTML(true));
			$('#form_modi').ajaxSubmit(options);
		}
	});
});
//时间
$(function(){
   $("#ca_end_time").datepicker();
})
</script>