<form id="formAdd" method="post">
<input type="hidden" name="dosubmit" value="1">
{?if $row.topicid>0?}<input type="hidden" name="topicid" value="{?$row.topicid?}">{?/if?}
<table width="100%" class="grid">
	<tr>
		<td class="tdleft" width="80"><span class="red">*</span>专题分类：</td>
		<td>
			<select name="cid" id="cid">
				<option value="0">选择分类</option>{?section name=i loop=$cates?}<option value="{?$i['key']?}"{?if $row.cid==$i['key']?} selected{?/if?}>{?$cates[i].cname?}</option>{?/section?}
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdleft"><span class="red">*</span>专题名称：</td>
		<td><input name="title" id="title" type="text" value="{?$row.title?}" size="80" class="text" maxlength="50" /></td>
	</tr>
	<tr>
		<td class="tdleft">英文名称：</td>
		<td><input name="alias" id="alias" type="text" value="{?$row.alias?}" size="50" class="text" maxlength="30" />&nbsp;<span class="gray">可用于生成专题URL</span></td>
	</tr>
	<tr>
		<td class="tdleft">专题模版：</td>
		<td><input name="temp" id="temp" type="text" value="{?$row.temp?}" size="50" class="text" maxlength="20" />&nbsp;<span class="gray">专题模版，留空使用默认模版</span></td>
	</tr>
	<tr>
		<td class="tdleft">每页文章：</td>
		<td><input name="pnum" id="pnum" type="text" value="{?$row.pnum?}" size="50" class="text" maxlength="4" />&nbsp;<span class="gray">0或留空不分页</span></td>
	</tr>
	<tr>
		<td class="tdleft">专题简介：</td>
		<td><textarea name="intro" id="intro" class="textarea" style="width:480px;height:100px;">{?$row.intro?}</textarea></td>
	</tr>
	<tr>
		<td class="tdleft">专题图片：</td>
		<td><input name="thumb" id="thumb" type="text" size="80" value="{?$row.thumb?}" class="text readonly" readonly>&nbsp;<input type="button" class="button" id="imagethumb" value="选择图片" /></td>
	</tr>
	<tr>
		<td class="tdleft">浏览次数：</td>
		<td><input type="text" class="text" name="views" id="views" size="10" value="{?$row.views?}" /></td>
	</tr>
	<tr>
		<td class="tdleft">状态：</td>
		<td>
			<select name="status" id="status">
				<option value="0"{?if '0'==$row.status?} selected{?/if?}>隐藏</option>
				<option value="1"{?if '1'==$row.status || ''==$row.status?} selected{?/if?}>显示</option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdleft"></td>
		<td><input type="submit" name="submit" id="submit" class="button" value="提 交"/></td>
	</tr>
</table>
</form>
<br><br>
<script charset="utf-8" src="{?$saxue_skin_server?}/editor/kindeditor-min.js"></script>
<script charset="utf-8" src="{?$saxue_skin_server?}/editor/lang/zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="{?$saxue_skin_server?}/editor/themes/default/default.css" />
<script type="text/javascript">
KindEditor.ready(function(K) {
	var editor = K.editor({
		langType : 'zh_CN',
		urlType  : 'domain',
		uploadJson : '{?$saxue_url?}/api/upload_json.php',
		fileManagerJson : '{?$saxue_url?}/api/file_manager_json.php',
		allowFileManager : true
	});
	K('#imagethumb').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				imageUrl : K('#thumb').val(),
				clickFn : function(url, title, width, height, border, align) {
					K('#thumb').val(url);
					editor.hideDialog();
				}
			});
		});
	});
});
$(function(){
	$("#formAdd").ajaxForm({
		beforeSubmit : function(){
			if ($("#cid").val()==0) {
				doTip('请选择专题分类');
				$("#cid").focus();
				return false;
			} 
			if ($("#title").val()=='') {
				doTip('请输入专题标题');
				$("#title").focus();
				return false;
			} 
		},
        dataType: "json",
        success : function(data){
			if(data.flag == 0){
				doTip(data.msg);
			}else{
				doTip('{?if $row.topicid>0?}修改{?else?}添加{?/if?}专题成功');
				location.href='topic.php';
			}
        }
    });
})
</script>