{?if $allowpost==1?}
<div class="toptips">
1、  栏目、标题、内容为必写项，不能为空；<br>
2、  非本人作品请填写文章原作者，来源和来源链接；<br>
3、  保持良好的文章格式：段落之间空一行，每段开头不空两个字，所有标点都是中文标点。
</div>
<form method="post" name="formAdd" id="formAdd">
<input type="hidden" name="timeline" value="{?$saxue_time?}">
<input type="hidden" name="dosubmit" value="1" />
<input type="hidden" name="cid" id="cid" value="{?$row.cid?}">
{?if $row.aid>0?}<input type="hidden" name="aid" value="{?$row.aid?}">{?/if?}
<div class="m-sec">
	<div class="sub">栏目分类:</div>
	<div class="main main-2">
		<div class="inner"><p class="inpradio">{?section name=i loop=$catepos?}{?if $i['order']>1?}&nbsp;>&nbsp;{?/if?}<a href="{?$catepos[i].curl?}" target="_blank">{?$catepos[i].cname?}</a>{?/section?}</p></div>
	</div>
</div>
<div class="m-sec">
	<div class="sub">文章标题:</div>
	<div class="main main-2">
		<div class="inner">
			<input name="title" id="title" type="text" value="{?$row.title?}" size="80" class="inptxt" maxlength="100" />
		</div>
	</div>
</div>
<div class="m-sec">
	<div class="sub">文章内容:</div>
	<div class="main main-2">
		<div class="inner">
			{?function saxue_geteditor:'content':600:380:'user':$saxue_time?}<textarea name="content" id="content">{?$row.content?}</textarea>
			<p class="intro">
				<label><input name="auto_intro" type="checkbox" value="1" checked />&nbsp;截取内容</label><input name="intro_length" type="text" size="2" value="200" class="inptxt"/>字符至简介&nbsp;&nbsp;
				<label><input name="auto_thumb" type="checkbox" value="1" checked />&nbsp;设置内容第</label><input name="thumb_no" type="text" size="1" value="1" class="inptxt"/>张图片为标题图&nbsp;
			</p>
		</div>
	</div>
</div>
<div class="m-sec">
	<div class="sub">文章简介:</div>
	<div class="main main-2">
		<div class="inner">
			<textarea name="intro" id="intro" rows="2" style="width:600px;height:60px;" class="inptxt txt" maxlength="200">{?$row.intro?}</textarea>
		</div>
	</div>
</div>
<div class="m-sec">
	<div class="sub">标题图片:</div>
	<div class="main">
		<div class="inner">
			<input name="thumb" id="thumb" type="text" size="60" value="{?$row.thumb?}" class="inptxt readonly" readonly>&nbsp;
			<input type="button" class="button" id="imagethumb" value="选择图片" />
		</div>
	</div>
</div>
<div class="m-sec">
	<div class="sub">文章TAG:</div>
	<div class="main">
		<div class="inner">
			<input name="tagids" id="tagids" type="hidden" value="{?$row.tagids?}">
			<input name="tags" id="tags" type="text" size="60" value="{?$row.tags?}" class="inptxt readonly" readonly>&nbsp;
			<input type="button" class="button" id="autotag" value="自动获取TAG" />&nbsp;
			<input type="button" class="button" id="changetag" value="选择TAG" />
		</div>
	</div>
</div>
{?if $isexpand==1?}{?include file = "/data/userform/$row.cid"?}{?/if?}
<div class="m-sec">
	<div class="sub">文章作者:</div>
	<div class="main">
		<div class="inner">
			<input type="text" class="inptxt" size="20" name="author" id="author" value="{?$row.author?}" maxlength="30" />
		</div>
	</div>
</div>
<div class="m-sec">
	<div class="sub">文章来源:</div>
	<div class="main">
		<div class="inner">
			<input type="text" class="inptxt" size="20" name="copyfrom" id="copyfrom" value="{?$row.copyfrom?}" maxlength="30" />
		</div>
	</div>
</div>
<div class="m-sec">
	<div class="sub">来源链接:</div>
	<div class="main">
		<div class="inner">
			<input type="text" class="inptxt" size="60" name="fromurl" id="fromurl" value="{?$row.fromurl?}" maxlength="100" />
		</div>
	</div>
</div>
<div class="m-sec">
	<div class="sub"></div>
	<div class="main">
		<div class="inner">
			<input type="submit" value="投 稿" class="post_submit">
		</div>
	</div>
</div>
</form>
<link rel="stylesheet" type="text/css" media="all" href="{?$saxue_skin_server?}/dialog/dialog.css" />
<script type="text/javascript" src="{?$saxue_skin_server?}/dialog/dialog.js"></script>
<script>
KindEditor.ready(function(K) {
	var editor = K.editor({
		langType : 'zh_CN',
		urlType  : 'domain',
		uploadJson : '{?$saxue_url?}/api/upload_json.php?timeline={?$saxue_time?}',
		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(){
	$('#changetag').click(function() {
		doDialog('{?$saxue_url?}/tag/admin/changetag.php?cid={?$row.cid?}','选择TAG','700','500');
	});
	$('#autotag').click(function() {
		if($('#tags').length>0 && $('#tagids').length>0) {
			var title = $("#title").val();
			var content = e_content.text();
			content = content.substr(0, 500);
			content = content.replace(/&/ig, '', content);
			$.post("/api/autotag.php", { "title":title, "content":content, "cid":{?$row.cid?} }, function(data){
				if(data.flag==1){
					$('#tags').val(data.tags);
					$('#tagids').val(data.tagids);
				}
			}, "json");
		}
	});
	$("#formAdd").ajaxForm({
		beforeSubmit : function(){
			if ($("#cid").val()==0) {
				doTip('请选择分类');
				$("#cid").focus();
				return false;
			} 
			if ($("#title").val()=='') {
				doTip('请填写文章标题');
				$("#title").focus();
				return false;
			} 
			if(e_content.isEmpty()) {
				doTip('请输入文章内容');
				return false;
			}
		},
        dataType: "json",
        success : function(data){
			if(data.flag == 0){
				doTip(data.msg);
			}else if(data.flag == 1){
				window.location.href = 'my.php?view=pending&menuid=13';
			}else{
				window.location.href = 'my.php?view=publish&menuid=13';
			}
        }
    });
})
</script>
{?else?}
<div class="toptips">
网站已关闭投稿功能
</div>
{?/if?}