一、后台添加文章模板phpcms/modules/content/templates/content_add.tpl.php中94行增加”保存草稿“按钮:
<div class="button"><input value="<?php echo L('save_draft');?>" type="submit" name="dosubmit_draft" class="cu" style="width:100px;" onclick="refersh_window()"></div>
二、后台添加文章控制器phpcms/modules/content/content.php文件add操作方法中
$this->db->add_content($_POST['info']);代码上方改成:
if(isset($_POST['dosubmit_draft'])) {$_POST['info']['status'] = -2;}else{if($workflowid) {//如果用户是超级管理员,那么则根据自己的设置来发布$_POST['info']['status'] = $_SESSION['roleid']==1 ? intval($_POST['status']) : 1;} else {$_POST['info']['status'] = 99;}}
$this->db->add_content($_POST['info']);代码下方改成:
if(isset($_POST['dosubmit']) || isset($_POST['dosubmit_draft'])) {showmessage(L('add_success').L('2s_close'),'blank','','','function set_time() {$("#secondid").html(1);}setTimeout("set_time()", 500);setTimeout("window.close()", 1200);');} else {showmessage(L('add_success'),HTTP_REFERER);}
三、后台添加文章控制器phpcms/modules/content/content.php文件edit操作方法中
param::set_cookie('module', 'content');代码下方改成:
if(isset($_POST['dosubmit']) || isset($_POST['dosubmit_continue']) || isset($_POST['dosubmit_draft'])) {
$workflowid = $setting['workflowid'];代码下方改成:
if((isset($_POST['dosubmit']) || isset($_POST['dosubmit_continue'])) && ($_POST['info']['status']==-2)) {if($workflowid) {//如果用户是超级管理员,那么则根据自己的设置来发布$_POST['info']['status'] = $_SESSION['roleid']==1 ? 99 : 1;} else {$_POST['info']['status'] = 99;}}
$this->db->edit_content($_POST['info'],$id);代码下方改成:
if(isset($_POST['dosubmit']) || isset($_POST['dosubmit_draft'])) {
四、后台添加文章控制器phpcms/modules/content/content.php文件public_preview操作方法中
$steps = intval($_GET['steps']);代码下方改成:
$supermenu = ($_SESSION['roleid']==1 && $steps<>-2) ? "<a href=\'javascript:ajax_manage(1)\'>".L('passed_checked')."</a> | <a href=\'javascript:ajax_manage(2)\'>".L('reject')."</a> | <a href=\'javascript:ajax_manage(3)\'>".L('delete')."</a>" : "<a href=\'javascript:ajax_manage(3)\'>".L('delete')."</a>";
五、后台添加文章控制器phpcms/modules/content/content.php文件中添加“草稿箱”操作方法
/*** 草稿箱*/public function draft_list() {$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;$show_header = '';$admin_username = param::get_cookie('admin_username');$datas = array();$pagesize = 20;$sql = '';$status = -2;$sql = "`status` = '$status' AND `siteid`=$this->siteid";if($_SESSION['roleid']!=1){$sql .= " AND `username` = '$admin_username'";//WY ADD AT 2023 除超级管理员外,只显示自己发布的文章}$this->content_check_db = pc_base::load_model('content_check_model');$datas = $this->content_check_db->listinfo($sql,'inputtime DESC',$page);$pages = $this->content_check_db->pages;include $this->admin_tpl('draft_list');}
六、添加“草稿箱”控制器对应的模板文件,phpcms/modules/content/templates/draft_list.tpl.php
<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');?>
<div class="pad-10">
<div class="content-menu ib-a blue line-x">
<a href='?m=content&c=content&a=draft_list' class="on"><em><?php echo L('all_draft_list');?></em></a>
</div>
<form name="myform" id="myform" action="" method="post" >
<div class="table-list"><table width="100%"><thead><tr><th width="60">ID</th><th><?php echo L('title');?></th><th width="90"><?php echo L('belong_category');?></th><th width="118"><?php echo L('contribute_time');?></th><th width="180"><?php echo L('username');?></th><th width="72"><?php echo L('operations_manage');?></th></tr></thead>
<tbody><?php$model_cache = getcache('model','commons');foreach ($datas as $r) {$arr_checkid = explode('-',$r['checkid']);?><tr><td align='center' ><?php echo $arr_checkid[1];?></td><td align='center' ><a href="javascript:;" onclick='change_color(this);window.open("?m=content&c=content&a=public_preview&steps=<?php echo $r['status']?>&catid=<?php echo $r['catid'];?>&id=<?php echo $arr_checkid[1];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>","manage")'><?php echo $r['title'];?></a></td><td align='center' ><a href="?m=content&c=content&a=init&menuid=822&catid=<?php echo $r['catid'];?>"><?php echo $this->categorys[$r['catid']]['catname'];?></a></td><td align='center' ><?php echo format::date($r['inputtime'],1);?></td><td align='center'><?php echo $r['username'];?></td><td align='center' ><a href="javascript:;" onclick="javascript:openwinx('?m=content&c=content&a=edit&catid=<?php echo $r['catid'];?>&id=<?php echo $arr_checkid[1];?>','')"><?php echo L('edit');?></a> | <a href="javascript:;" onclick='change_color(this);window.open("?m=content&c=content&a=public_preview&steps=<?php echo $r['status']?>&catid=<?php echo $r['catid'];?>&id=<?php echo $arr_checkid[1];?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>","manage")'><?php echo "查看";?></a></td></tr><?php }?>
</tbody></table><div id="pages"><?php echo $pages?></div>
</div>
</form>
</div>
<script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>cookie.js"></script>
<script type="text/javascript">
<!--
window.top.$("#current_pos_attr").html('<?php echo L('checkall_content');?>');
function change_color(obj) {$(obj).css('color','red');
}
setcookie('refersh_time', 0);
function refersh_window() {var refersh_time = getcookie('refersh_time');if(refersh_time==1) {window.location.reload();}
}
setInterval("refersh_window()", 3000);
//-->
</script>
</body>
</html>
七、数据表v9_news和v9_content_check表中字段status的属性改为空(如果有其它模型,对应的表该字段也改为空)
八、语言文件phpcms/languages/zh-cn/content.lang.php中添加
$LANG['save_draft'] = '保存草稿';
$LANG['all_draft_list'] = '所有草稿';
九、后台添加管理菜单