{:tpl head}
<!--{:if $a != 'replace'}-->
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>文章管理</caption>
  <tr>
   <td>
    <strong>管理选项：</strong>
    <a href="?c=article&a=add&catid={:$catid}">文章添加</a>&nbsp;|&nbsp;
    <a href="?c=article&catid={:$catid}">已审核文章管理</a>&nbsp;|&nbsp;
	<a href="?c=article&catid={:$catid}&headline=1">头条文章管理</a>&nbsp;|&nbsp;
	<a href="?c=article&catid={:$catid}&elite=1">推荐文章管理</a>&nbsp;|&nbsp;
	<a href="?c=article&catid={:$catid}&ontop=1">置顶文章管理</a>&nbsp;|&nbsp;
    <a href="?c=article&catid={:$catid}&passed=0">未审核文章管理</a>&nbsp;|&nbsp;
    <a href="?c=article&recycle=1&catid={:$catid}">回收站</a>
   </td>
  </tr>
</table>
<!--{:/if}-->
<!--{:if $a == 'add' or $a == 'edit'}-->
<script type="text/javascript" src="../../statics/js/ajaxfileupload.js"></script>
<script language = 'javascript'>
function uselinkurljs(obj){
   if(obj.uselinkurl.checked==true){
      obj.linkurl.disabled=false;
      article.style.display='none';
   } else {
      obj.linkurl.disabled=true;
      article.style.display='';
   }
}
</script>
<form action="?c=article&a={:$a}" method="post" enctype="multipart/form-data" name="myform">
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>{:if $a == 'add'}添加{:else}修改{:/if}文章</caption>
 <input type="hidden" name="info[id]" value="{:$data['id']}" />
 <input type="hidden" name="forward" value="{:$referer}" />
 <tr>
  <td align="right" width="120"><span class="fred">*</span> 栏 目：</td>
  <td>
   <select name="info[catid]" id="catid" require="true" datatype="number" msg="您未选择栏目或选择的栏目不能发布">
    <option value="">请选择…</option>
    {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$data['catid'],$category,0,0,1)}
   </select>
  </td>
 </tr>
 <tr>
  <td align="right"><span class="fred">*</span> 标 题：</td>
  <td>
   <input name="info[title]" id="title" type="text" value="{:$data['title']}" size="40" require="true" datatype="require" msg="标题不能为空" />
   <select name='info[color]' onchange="set_background(this)">
    <option value="">颜色</option>
{:Tag::option('#000000|#FFFFFF|#008000|#800000|#808000|#000080|#800080|#808080|#FFFF00|#00FF00|#00FFFF|#FF00FF|#FF0000|#0000FF|#008080',$data['color'],'<option value=\"$id\" style=\"background-color:$id\"$selected></option>')}
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">关键词：</td>
  <td>
   <input name="info[keywords]" type="text" id="keywords" size="40" value="{:$data['keywords']}">&nbsp;多个用逗号“,”隔开&nbsp;
   <button type="button" onclick="get_tags('keywords', 'title', 'content')">提取</button>
  </td>
 </tr>
 <tr>
  <td align="right">转向链接：</td>
  <td>
   <input name="info[linkurl]" type="text" id="linkurl" value="{:$data['linkurl']}" size="50" maxlength="255"{:if $data['linkurl']==''} disabled{:/if}><input name="uselinkurl" type="checkbox" id="uselinkurl" value="1"{:Tag::checked($data['linkurl'],'notnull')} onclick="uselinkurljs(this.form)"><span class="fred">转向链接，不能用相对路径</span></td>
 </tr>
 <tbody style="display:{:if $data['linkurl']!=''} none{:/if}" id="article">
 <tr>
  <td align="right">来 源：</td>
  <td>
   <input name="info[copyfrom]" id="copyfrom" type="text" value="{:$data['copyfrom']}" size="30" maxlength="50"> 
   <span class="fblue">&lt;=[<a href="javascript:void(0);" onclick="set_value('copyfrom', '本站原创')" class="fgreen">本站原创</a>]</span>
  </td>
 </tr>
 <tr>
  <td align="right">作 者：</td>
  <td>
   <input name="info[author]" id="author" type="text" value="{:$data['author']}" size="30" maxlength="30"> 
   <span class="fblue">&lt;=[<a href="javascript:void(0);" onclick="set_value('author', '未知')" class="fgreen">未知</a>] [<a href="javascript:void(0);" onclick="set_value('author', '佚名')" class="fgreen">佚名</a>] [<a href="javascript:void(0);" onclick="set_value('author', 'admin')" class="fgreen">admin</a>]</span></td>
 </tr>
 <tr>
  <td align="right">作者email：</td>
  <td><input name="info[authoremail]" type="text" id="authoremail" value="{:$data['authoremail']}" size="40" maxlength="200">&nbsp;不愿公开的请不要写</td>
 </tr>
 <tr>
  <td align="right">内容摘要：</td>
  <td><textarea name="info[description]" cols="80" rows="5">{:$data['description']}</textarea></td>
 </tr>
 <tr>
  <td align="right"><span class="fred">*</span> 文章内容：</td>
  <td>
  {:Tag::editor('content', 'info[content]', $data['content'], 'article')}
  </td>
 </tr>
 <tr>
  <td align="right">标题图片：</td>
  <td><input type="text" value="{:$data['defaultpicurl']}" name="info[defaultpicurl]" id="defaultpicurl" size="35"><input name="makesmallpic" type="checkbox" value="1"> 生成缩略图(GD支持)&nbsp;<input name='pic1_default' type='checkbox' value='1'>内容中提取第1张图片</td>
 </tr>
 <tr>
  <td align="right">自定义文件名：</td>
  <td><input type="text" value="{:$data['filename']}" name="info[filename]" id="filename" size="48">&nbsp;<span class="fblue">仅设置文件名，不可加路径和后缀</span>&nbsp;<button type="button" onclick="makename('title','filename',1)">生成</button></td>
 </tr>
 <tr>
  <td align="right">附 件：</td>
  <td>
   <!--{:loop $attachments $k $v}-->
   <input type="text" value="{:$v['filepath']}" name="attachments[]" id="attachment{:$k}" class="attachments" size="33"><!--{:if $k%2 == 1}--><br /><!--{:/if}-->
   <!--{:/loop}-->
  </td>
 </tr>
 <tr>
  <td align="right">文章选项：</td>
  <td>
   <input name="info[ontop]" type="checkbox" value="1"{:Tag::checked($data['ontop'],1)}>置顶&nbsp;&nbsp;
   <input name='info[elite]' type="checkbox" value='1'{:Tag::checked($data['elite'],1)}>推荐&nbsp;&nbsp;
   <input name='info[adflag]' type="checkbox" value='1'{:Tag::checked($data['adflag'],1)}>免广告(内容中)&nbsp;&nbsp;
   <input name='info[uncmt]' type="checkbox" value='1'{:Tag::checked($data['uncmt'],1)}>不允许评论&nbsp;&nbsp;
   <input name='saveremote' type='checkbox' value='1'>远程上传
   {:if C('cutedeslen', 0, 'article')}&nbsp;&nbsp;<input name='cutedes' type='checkbox' value='1'{:Tag::checked($data['description'],'')}>提取内容摘要{:/if}
  </td>
 </tr>
 </tbody>
 <tr>
  <td colspan="2" height="30" align="center"><button type="submit" name="submit" value="submit">提交</button></td>
 </tr>
</table>
</form>
<script type="text/javascript" src="../../statics/js/validator.js"></script>
<script language="javascript" type="text/javascript">
$(function(){
	$('form').checkForm(1);
	$('#defaultpicurl').jxupload('article', 'image');
	$('.attachments').each(function(){$(this).jxupload('article', 'attach')});
})
</script>
<!--{:elseif $a == 'defaults'}-->
<!--{:if $recycle == 1}-->
<table cellpadding="0" cellspacing="1" width="100%" class="table_guide">
 <tr>
  <td height="20">当前位置：<a href="?c=article&catid={:$catid}&passed=1">文章管理</a> &gt;&gt; <!--{:loop Tag::position() $v}--><a href="{:$jmpurl}&catid={:$v['catid']}"}>{:$v['name']}</a>&gt;&gt; <!--{:/loop}-->回收站管理</td>
  <td align=right>
   <select name="jump" onchange="if(this.options[this.selectedIndex].value!=''){location='{:$jmpurl}&catid='+this.options[this.selectedIndex].value;}">
    <option value=''>跳转分类至…</option>
    {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$catid,$category)}
   </select>
  </td>
 </tr>
</table>
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>回收站文章管理</caption>
 <form name="myform" action="?c=article&catid={:$catid}&a={:$a}" method="post">
 <input type="hidden" value='' name="selids" />
 <tr>
  <th align="center" width="5%"><input name="checkbox" type="checkbox" onclick="checkorno(this,this.form.ids)" /></th>
  <th><a href="{:$orderurl}&field=title&order={:$order}">标题</a></th>
  <th width="5%"><a href="{:$orderurl}&field=id&order={:$order}">ID</a></th>
  <th width="10%"><a href="{:$orderurl}&field=catid&order={:$order}">分类</a></th>
  <th width="10%">录入</th>
  <th width="10%">编辑</th>
  <th width="10%"><a href="{:$orderurl}&field=addtime&order={:$order}">发表时间</a></th>
  <th width="5%"><a href="{:$orderurl}&field=hits&order={:$order}">点击</a></th>
  <th width="15%">管理操作</th>
 </tr>
 {:loop $data $v}
 <tr align="center">
  <td><input name="ids" type="checkbox" value="{:$v['id']}" /></td>
  <td align="left">{:$v['title']}{:if $v['defaultpicurl']}<span class="fred"> (图)</span>{:/if}</td>
  <td>{:$v['id']}</td>
  <td><a href="{:$jmpurl}&catid={:$v['catid']}">{:$category[$v['catid']]['name']}</a></td>
  <td>{:$v['username']}</td>
  <td>{:$v['checker']}</td>
  <td>{:Tag::date($v['addtime'],1)}</td>
  <td>{:$v['hits']}</td>
  <td><a href="?c=article&a=recycle&selids={:$v['id']}&val=0">恢复</a> | <a href="?c=article&a=del&selids={:$v['id']}" onclick="javascript:return confirm('确认删除吗？本操作不可恢复')">删除</a></td>
 </tr>
 {:/loop}
 <tr>
  <td height="20" colspan="9" align="center">
   <button name="select1" onclick="selAll(this.form.ids)" type="button">全选</button>
   <button name="select2" onclick="noSelAll(this.form.ids)" type="button">反选</button>
   <button name="submitsc" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=recycle&val=0','')">恢复</button>
   <button name="submitdel" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=del','确认删除吗？此操作不可恢复。')">删除</button>
   <button name="submitqk" type="button" onClick="subforms(this.form,'?c=article&a=del_recycle','确认清空吗？此操作不可恢复。')">清空</button>
  </td>
 </tr>
 </form>
</table>
{:if $pages}<div class="pages">{:$pages}</div>{:/if}
<!--{:else}-->
<table cellpadding="0" cellspacing="1" width="100%" class="table_guide">
 <tr>
  <td height="20">当前位置：<a href="?c=article&passed=1">文章管理</a> &gt;&gt; <!--{:loop Tag::position() $v}--><a href="{:$jmpurl}&catid={:$v['catid']}"}>{:$v['name']}</a>&gt;&gt; <!--{:/loop}-->所有{:if $headline}头条{:elseif $elite}推荐{:elseif $ontop}置顶{:elseif $passed}已审核{:else}未审核{:/if}文章</td>
  <td align=right>
   <select name="jump" onchange="if(this.options[this.selectedIndex].value!=''){location='{:$jmpurl}&catid='+this.options[this.selectedIndex].value;}">
    <option value=''>跳转分类至…</option>
    {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$catid,$category)}
   </select>
  </td>
 </tr>
</table>
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>{:if $headline}头条{:elseif $elite}推荐{:elseif $ontop}置顶{:elseif $passed}已审核{:else}未审核{:/if}文章管理</caption>
 <form name="myform" action="?c=article&catid={:$catid}&a={:$a}" method="post">
 <input type="hidden" value="" name="selids" />
 <input type="hidden" value="{:ROOT_URL}index.php?c=html&id={:$loginInfo['userid']}&hash={:$loginInfo['hash']}" id="update_html_action" />
 <tr>
  <th align="center" width="5%"><input name="checkbox" type="checkbox" onclick="checkorno(this,this.form.ids)" /></th>
  <th><a href="{:$orderurl}&field=title&order={:$order}">标题</a></th>
  <th width="5%"><a href="{:$orderurl}&field=id&order={:$order}">ID</a></th>
  <th width="10%"><a href="{:$orderurl}&field=catid&order={:$order}">分类</a></th>
  <th width="10%">录入</th>
  <th width="10%">编辑</th>
  <th width="10%"><a href="{:$orderurl}&field=addtime&order={:$order}">发表时间</a></th>
  <th width="5%"><a href="{:$orderurl}&field=hits&order={:$order}">点击</a></th>
  <th width="15%">管理操作</th>
 </tr>
 {:loop $data $v}
 <tr>
  <td align="center"><input name="ids" type="checkbox" value="{:$v['id']}" /></td>
  <td><a href="{:Url :: getContentUrl('article', $v['id'])}" target="_blank">{:$v['title']}</a>{:if $v['headline']}<span class="fred"> ★</span>{:/if}{:if $v['elite']}<span class="fred"> 荐</span>{:/if}{:if $v['ontop']}<span class="fblue"> 顶</span>{:/if}{:if $v['defaultpicurl']}<span class="fred"> 图</span>{:/if}</td>
  <td align="center">{:$v['id']}</td>
  <td align="center"><a href="{:$jmpurl}&catid={:$v['catid']}">{:$category[$v['catid']]['name']}</a></td>
  <td align="center">{:$v['username']}</td>
  <td align="center">{:$v['checker']}</td>
  <td align="center">{:Tag::date($v['addtime'],1)}</td>
  <td align="center">{:$v['hits']}</td>
  <td align="center">{:if $passed}<a href="javascript:;" onclick="update_html('article', {:$v['id']})">生成</a>{:else}<a href="?c=article&a=check&selids={:$v['id']}">审核</a>{:/if} | <a href="?c=article&a=edit&id={:$v['id']}">修改</a> | <a href="?c=article&a=recycle&selids={:$v['id']}&val=1">删除</a></td>
 </tr>
 {:/loop}
 <tr>
  <td height="20" colspan="9" align="center">
   <button name="select1" onclick="selAll(this.form.ids)" type="button">全选</button>
   <button name="select2" onclick="noSelAll(this.form.ids)" type="button">反选</button>
   <button name="submitsc" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=recycle&val=1','确认删除吗？此操作可以从回收站恢复。')">删除</button>
   {:if !$passed}<button name="submitsh" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=check','')">审核通过</button>{:else}
   头条<button name="submitttyes" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=headline&val=1','')">是</button> <button name="submittjyes" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=headline&val=0','')">否</button>
   推荐<button name="submittjyes" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=elite&val=1','')">是</button> <button name="submittjyes" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=elite&val=0','')">否</button>
   置顶<button name="submitzdyes" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=ontop&val=1','')">是</button> <button name="submitzdno" type="button" onClick="subform(this.form,this.form.ids,'?c=article&a=ontop&val=0','')">否</button>
   <button name="submitschtml" type="button" onClick="update_html('article','', this.form.ids)">生成HTML</button>
   {:/if}
   <button name="submityd" type="button" onClick="move(this.form,this.form.ids,targetcatid.options[targetcatid.selectedIndex].value,'?c=article&a=move')">移动→</button>
   <select name='targetcatid'>
    {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$catid,$category)}
   </select>
   <!--
   <button name="addspecial" type="button" onClick="addspecial(this.form,this.form.ids,specialid.options[specialid.selectedIndex].value,'?c=article&a=add&catid={:$catid}special&')">加入专题→</button>
   <select name='specialid'>
    <option value=''>请选择…</option>
   {#:loop tag_special() $v}
	<option value="{#:$v['specialid']}">{#:$v['title']}</option>
   {#:/loop}
   </select>
   //-->
  </td>
 </tr>
 </form>
</table>
{:if $pages}<div class="pages">{:$pages}</div>{:/if}
<table cellpadding="0" cellspacing="1" class="table_search">
 <form method="get" name="searchform">
 <input type="hidden" name="c" value="article" />
 <tr>
  <td align="center">
  	关键词：<input name="q" id="searchq" type="text" size="50" value="{:$q}">&nbsp;&nbsp;
    <select name='catid' id="searchcatid">
	<option value='0'>所有栏目</option>
	{:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$catid,$category)}
	</select>&nbsp;&nbsp;
	<button name="search" type="submit">文章搜索</button>
	<input type="checkbox" name="isreplace" id="isreplace" value="1" />替换
  </td>
 </tr>
 </form>
 <form action="?c=article&a=replace" method="post" name="replaceform" id="replaceform" target="_blank">
 <input type="hidden" name="info[q]" id="replaceq" value="" />
 <input type="hidden" name="info[catid]" id="replacecatid" value="" />
 <input type="hidden" name="info[work]" id="work" value="" />
 <tr id="replacebar" style="display:none">
  <td align="center">
   <span>
    原内容：<textarea name="info[old]" id="old" style="width:240px;height:50px"></textarea>&nbsp;
    替换为：<textarea name="info[new]" id="new" style="width:230px;height:50px"></textarea>
	<button name="test" id="test" type="button">测试</button>
	<button name="replace" id="replace" type="button">替换</button><br />
    <span class="blue">原内容支持通配符<a href="javascript:void(0);" onclick="AddOnPos(document.replaceform.old,'(*)');" title="插入通配符" class="fred">(*)</a>，设置关键词和栏目能提高替换效率和准确性，替换的原理是先根据关键词筛选出内容，然后进行正则替换</span>
   </span>
  </td>
 </tr>
 </form>
</table>
<script type="text/javascript">
$(function(){
	$('#isreplace').click(function(){
		$('#replacebar').toggle();
	});

	$('#test').click(function(){
		if($('#old').val() == ''){
			$.jxbox.tip('原内容不能为空',2 ,{ focus:'old' });
			return false;
		}
		$('#work').val('test');
		$('#replacecatid').val($('#searchcatid').val());
		$('#replaceq').val($('#searchq').val());
		$('#replaceform').submit();
	});

	$('#replace').click(function(){
		if($('#old').val() == ''){
			$.jxbox.tip('原内容不能为空',2 ,{ focus:'old' });
			return false;
		}
		$('#work').val('replace');
		$('#replacecatid').val($('#searchcatid').val());
		$('#replaceq').val($('#searchq').val());
		$('#replaceform').submit();
	});
});
</script>
<!--{:/if}-->
<!--{:elseif $a == 'replace'}-->
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>信息替换测试</caption>
 <tr><td height="20px" class="fred">替换前</td></tr>
 <tr><td>{:$content}</td></tr>
 <tr><td height="20px" class="fred">替换后</td></tr>
 <tr><td>{:$newcontent}</td></tr>
</table>
{:if $pages}<div class="pages">{:$pages}</div>{:/if}
<!--{:/if}-->
{:tpl foot}