添加单个文档选择多个栏目的功能
This commit is contained in:
parent
c6426e0c3e
commit
3802a793be
|
@ -42,14 +42,19 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
left join ".$News->tbl_catalog." ct on ct.aid=n.id
|
||||
left join ".$News->tbl_categorys." c on c.id = ct.cid
|
||||
LEFT JOIN users u ON n.userid=u.id
|
||||
WHERE c.id='$type' order by n.ts_created desc";
|
||||
WHERE c.id='$type' AND n.title IS NOT NULL order by n.ts_created desc";
|
||||
}else
|
||||
{
|
||||
$sql = "select n.*,c.id as typeid,c.title as catlog,c.code from ".$News->tbl_archives." n
|
||||
$sql = "select
|
||||
n.id,n.title,n.userid,n.ts_published,n.is_pub
|
||||
from ".$News->tbl_archives." n
|
||||
left join ".$News->tbl_catalog." ct on ct.aid=n.id
|
||||
left join ".$News->tbl_categorys." c on c.id = ct.cid
|
||||
LEFT JOIN users u ON n.userid=u.id
|
||||
order by n.ts_created desc";
|
||||
WHERE n.title IS NOT NULL
|
||||
GROUP BY n.id
|
||||
ORDER BY n.ts_created desc
|
||||
";
|
||||
}
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
|
@ -277,7 +282,17 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
$News = new news($this->db);
|
||||
|
||||
$id = $this->_request->getParam('id');
|
||||
$this->view->typeid = $id;
|
||||
|
||||
$sql = "SELECT * FROM ar_catalog WHERE aid=$id";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$types = array();
|
||||
foreach($rows as $k=>$v)
|
||||
{
|
||||
$types[$v['id']] = $v['cid'];
|
||||
}
|
||||
$this->view->typeid = $types;
|
||||
|
||||
$sql = "select arc.*,ct.cid as typeid from ".$News->tbl_archives." arc
|
||||
LEFT JOIN ".$News->tbl_catalog." ct ON arc.id=ct.aid
|
||||
|
@ -345,7 +360,11 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
if(mb_strlen($keyword)>200) $msg[] = "关键词长度不能超过200个字符,现在输入了".strlen($keyword)."个字符";
|
||||
if(mb_strlen($description)>400) $msg[] = "内容描述不能超过200个字符,现在输入了".strlen($description)."个字符";
|
||||
if(empty($body)) $msg[]="请填写内容";
|
||||
if($typeid==0) $msg[]="请选择栏目";
|
||||
if(empty($typeid)) $msg[]="请选择栏目";
|
||||
if(!is_array($typeid) || count($typeid)<1)
|
||||
{
|
||||
$msg[]="请选择栏目";
|
||||
}
|
||||
|
||||
if(count($msg)>0)
|
||||
{
|
||||
|
@ -399,9 +418,12 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
WHERE id=$update";
|
||||
if($this->db->exec($sql))
|
||||
{
|
||||
if(!empty($keyword))
|
||||
{
|
||||
$News->DeleteTags($update);
|
||||
$News->MakeTags($update,$keyword);
|
||||
}
|
||||
$News->ChangeCatalog($update,$typeid);
|
||||
$News->DeleteTags($update);
|
||||
$News->MakeTags($update,$keyword);
|
||||
echo '<div class="box box-success">修改成功!</div><script>
|
||||
setTimeout("self.location=\'/admin/news/newslist\'",500);
|
||||
</script>';
|
||||
|
@ -430,8 +452,19 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
if($sth->execute())
|
||||
{
|
||||
$temp = $sth->fetch(PDO::FETCH_ASSOC);
|
||||
$News->ToCatalog($temp['id'],$typeid);
|
||||
$News->MakeTags($temp['id'],$keyword);
|
||||
if(is_array($typeid))
|
||||
{
|
||||
foreach($typeid as $v)
|
||||
{
|
||||
$News->ToCatalog($temp['id'],$v);
|
||||
}
|
||||
}else{
|
||||
$News->ToCatalog($temp['id'],$typeid);
|
||||
}
|
||||
if(!empty($keyword))
|
||||
{
|
||||
$News->MakeTags($temp['id'],$keyword);
|
||||
}
|
||||
echo '<div class="box box-success">发布成功!</div><script>
|
||||
setTimeout("self.location=\'/admin/news/newslist\'",500);
|
||||
</script>';
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
.tagInputSuggestedTagList .tag{ padding:1px 4px;cursor:pointer;display:inline-block;margin:2px 1px;border:1px solid #bbb;}
|
||||
.tagInputSuggestedTagList span.tag:hover{background-color:#bbb;color:#fff;}
|
||||
.tagInputSuggestedTagList .tagUsed{border:1px solid #999;background-color:#999;color:#fff;}
|
||||
.width3{width:40%;}
|
||||
.first{float:left;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
/* sample tags */
|
||||
|
@ -65,7 +67,7 @@ $(document).ready(function(){
|
|||
<?= $this->partial('news/left.phtml'); ?>
|
||||
</div>
|
||||
<div id="rightPanel">
|
||||
<section class="column width6">
|
||||
<section class="column">
|
||||
|
||||
<form name="form" id="archivesadd" method="post" action="#">
|
||||
|
||||
|
@ -103,35 +105,33 @@ $(document).ready(function(){
|
|||
|
||||
|
||||
|
||||
<div class="clearfix leading">
|
||||
<div class="clearfix leading" style="overflow:hidden;">
|
||||
<div class="column width3 first">
|
||||
<p>
|
||||
<label for="type" class="required">新闻栏目</label><br/>
|
||||
<select id="type" class="full" name="typeid">
|
||||
<option value="0">请选择栏目</option>
|
||||
|
||||
<?php
|
||||
foreach($this->types as $v)
|
||||
{
|
||||
if(!empty($v[$this->deepField])) {$haed = str_repeat('-',$v[$this->deepField]);}
|
||||
echo '<option value="'.$v['id'].'">'.$haed.$v['title'].'</option>';
|
||||
$haed = "";
|
||||
$head = "";
|
||||
if(!empty($v[$this->deepField])) {$head = str_repeat('-',$v[$this->deepField]);}
|
||||
echo '<input type="checkbox" name="typeid[]" value="'.$v['id'].'" />'.$head.$v['title'].'<br />';
|
||||
$head = "";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
|
||||
<small>e.g. 研究成果</small>
|
||||
</p>
|
||||
<p><a href="/admin/news/catlog/add/1" target="_blank">+ 添加新栏目</a></p>
|
||||
|
||||
<p><a href="/admin/news/catlog/add/1" target="_blank">+ 添加新栏目</a></p>
|
||||
</div>
|
||||
|
||||
<div class="column width3 first">
|
||||
<p>
|
||||
<select id="pub" class="full" name="pub">
|
||||
<option value="true">立即发布</option>
|
||||
<option value="false">存草稿</option>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="column width3">
|
||||
<p>
|
||||
<input type="checkbox" id="pubtimeturn" name="pubtimer" value="1" /><label id="pubtimelable" for="productcat">定时发布?</label><br/>
|
||||
<input type="text" name="pubtime" id="pubtime" value="<?php echo date("Y-m-d H:i",time()+3600*24);?>" readonly="readonly" />
|
||||
|
|
|
@ -125,24 +125,24 @@ $(document).ready(function(){
|
|||
<div class="column width3 first">
|
||||
<p>
|
||||
<label for="type" class="required">新闻栏目</label><br/>
|
||||
<select id="type" class="full" name="typeid">
|
||||
<option value="0">请选择栏目</option>
|
||||
<?php
|
||||
foreach($this->types as $v)
|
||||
{
|
||||
$haed = "";
|
||||
if(!empty($v[$this->deepField])) {$haed = str_repeat('-',$v[$this->deepField]);}
|
||||
|
||||
if($this->ev['typeid']==$v['id'])
|
||||
echo '<option value="'.$v['id'].'" selected="selected">'.$haed.$v['title'].'</option>';
|
||||
else
|
||||
echo '<option value="'.$v['id'].'">'.$haed.$v['title'].'</option>';
|
||||
|
||||
$haed = "";
|
||||
}
|
||||
|
||||
$check = "";
|
||||
foreach($this->typeid as $k=>$cid)
|
||||
{
|
||||
if($cid == $v['id'])
|
||||
{
|
||||
$check = 'checked="checked"';
|
||||
$ctid = $k;
|
||||
}
|
||||
}
|
||||
$head = "";
|
||||
if(!empty($v[$this->deepField])) {$head = str_repeat('-',$v[$this->deepField]);}
|
||||
echo '<input type="checkbox" name="typeid[]" '.$check.' value="'.$v['id'].'"/>'.$head.$v['title'].'<br />';
|
||||
$head = "";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<small>e.g. 研究成果</small>
|
||||
</p>
|
||||
<p><a href="/admin/news/catlog/add/1" target="_blank">+ 添加新栏目</a></p>
|
||||
|
|
|
@ -57,8 +57,7 @@ $('#divFooter').css('position','absolute');
|
|||
<table id="report" class="stylized full" style="width:650px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="50%">新闻标题</th>
|
||||
<th width="15%">所属栏目</th>
|
||||
<th width="70%">新闻标题</th>
|
||||
<th width="15%">状态</th>
|
||||
<th width="20%">新闻管理</th>
|
||||
</tr>
|
||||
|
@ -75,7 +74,6 @@ $('#divFooter').css('position','absolute');
|
|||
<td>
|
||||
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
|
||||
</td>
|
||||
<td><a href="/admin/news/newslist/type/'.$v['typeid'].'">'.$v['catlog'].'</a></td>
|
||||
<td>';
|
||||
if($v['ts_published']<time() and $v['is_pub']>0)
|
||||
{
|
||||
|
@ -95,7 +93,6 @@ $('#divFooter').css('position','absolute');
|
|||
}
|
||||
$list .= '</td>
|
||||
<td>
|
||||
<a href="/news/'.$v['code'].'/archive-'.$v['id'].'.html" target="_blank"><b>预览</b></a>
|
||||
<a href="/admin/news/newsedit/id/'.$v['id'].'"><b>编辑</b></a>
|
||||
<a href="/admin/news/delete/id/'.$v['id'].'" onclick="return confirm(\'是否确定删除该文章\')">删除</a></td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue