修改新闻中心、评审管理

This commit is contained in:
Li Jianxuan 2011-10-09 10:15:50 +00:00
parent cf732de1c1
commit 2470ae7e7b
3 changed files with 192 additions and 30 deletions

View File

@ -99,15 +99,99 @@ class Admin_NewsController extends Zend_Controller_Action
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$this->view->types=$types;
}//newsadd 新闻添加
function archivesaddAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$datavar = array(
'title','writer','source','image','body','typeid','pub','pubtimer','pubtime','description','keyword'
);
foreach($_POST as $k=>$v)
{
if(in_array($k,$datavar))
{
$$k=$v;
}
}
$msg=array();
if(empty($title)) $msg[]="标题不能为空";
if(strlen($title)>40) $msg[]="标题长度不能超过40个字符";
if(strlen($writer)>50) $msg[]="作者长度不能超过50个字符";
if(strlen($keyword)>200) $msg[] = "关键词长度不能超过200个字符现在输入了".strlen($keyword)."个字符";
if(strlen($description)>200) $msg[] = "内容描述不能超过200个字符现在输入了".strlen($description)."个字符";
if(empty($body)) $msg[]="请填写内容";
if($typeid==0) $msg[]="请选择栏目";
if(count($msg)>0)
{
echo '<div class="box box-error">发布失败:</div>
<div class="box box-error-msg">
<ol>';
foreach ($msg as $v)
{
echo '<li>'.$v.'</li>';
}
echo'</ol>
</div>
';
}
else
{
if(!empty($pubtimer))
{
$pubtime = strtotime("2011-10-09 19:03");
}
$date=array(
'title' => $title,
'writer' => $writer,
'keyword' => $keyword,
'description'=> $description,
'image' => $image,
'writetime' => time(),
'pubtime' => $pubtime,
'source' => $source,
'typeid' => $typeid,
'pub' => $pub
);
echo '<div class="box box-success">发布成功:</div>
<div class="box box-error-msg">
<ol>';
foreach($date as $k=>$v)
{
if(in_array($k,$datavar))
{
echo '<li>'.$k.'='.$v.'</li>';
}
}
echo'</ol>
</div>
';
}
/*
<div class="box box-info">Info box sample</div>
<div class="box box-warning">Warning box sample</div>
<div class="box box-error">Error box sample</div>
<div class="box box-error-msg">
<ol>
<li>Credit card number entered is invalid</li>
<li>Credit card verification number must be a valid number</li>
</ol>
</div>
<div class="box box-success">Success box sample</div>
*/
}
}

View File

@ -174,6 +174,10 @@ class Admin_ReviewController extends Zend_Controller_Action
if($show>0)
{
$this->_helper->viewRenderer('inreviewshow');
}//查看详细
else
{

View File

@ -8,17 +8,21 @@
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
?>
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uname=$user->username;
$realname = $user->realname;
}
?>
<script type="text/javascript">
/* sample tags */
var tags=[
{tag:"js",freq:30},{tag:"jquery",freq:25}, {tag:"pojo",freq:10},{tag:"agile",freq:4},
{tag:"blog",freq:3},{tag:"canvas",freq:8}, {tag:"dialog",freq:3},{tag:"excel",freq:4},
{tag:"engine",freq:5},{tag:"flex",freq:18}, {tag:"firefox",freq:23},{tag:"javascript",freq:40},
{tag:"graph",freq:15},{tag:"grid",freq:20}, {tag:"hibernate",freq:13},{tag:"ical",freq:4},
{tag:"ldap",freq:9},{tag:"load",freq:20}, {tag:"security",freq:13},{tag:"XSS",freq:21},
{tag:"CSRF",freq:19},{tag:"html",freq:22}, {tag:"xml",freq:13},{tag:"tools",freq:21}
{tag:"冻土",freq:30},{tag:"寒旱所",freq:25}, {tag:"大气",freq:10},{tag:"高原",freq:4},
{tag:"西部",freq:3},{tag:"地理",freq:8}, {tag:"环境",freq:3},{tag:"地质",freq:20}
];
$(document).ready(function(){
@ -27,16 +31,16 @@ $(document).ready(function(){
Administry.setup();
KindEditor.ready(function(K) {
K.create('textarea[name="content"]', {
editor=K.create('textarea[name="body"]', {
cssPath : '/static/js/plugins/code/prettify.css',
uploadJson : '/plugins/upload_json.php',
fileManagerJson : '/plugins/file_manager_json.php',
allowFileManager : true
});
});
/* tag input field */
$("#tags").tagInput({
$("#keyword").tagInput({
tags:tags,
//jsonUrl:"tags.json",
sortBy:"frequency",
@ -47,8 +51,6 @@ $(document).ready(function(){
//suggestedTagsPlaceHolder:$("#suggested"),
boldify:true
});
});
</script>
<!-- Page title -->
@ -75,7 +77,7 @@ $(document).ready(function(){
</header>
<section>
输入Tag标签多个用半角逗号 “ , ”隔开每个Tag标签长度小于6个汉字
<p><textarea id="tags" class="small full" name="tags"></textarea></p>
<p><textarea id="keyword" class="small full" name="keyword"></textarea></p>
</section>
</div>
</aside>
@ -86,7 +88,7 @@ $(document).ready(function(){
<h3>发布新闻</h3>
<form name="form" method="post" action="#">
<form name="form" id="archivesadd" method="post" action="#">
<fieldset>
<legend>新闻信息</legend>
@ -95,21 +97,45 @@ $(document).ready(function(){
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half title" value="" name="title"/>
</p>
<p>
<label class="required" for="writer">作者</label><br/>
<input type="text" id="writer" class="half title" value="<?php echo $realname;?>" name="writer"/>
</p>
<p>
<label for="source" class="required">来源</label><br/>
<input type="text" id="source" class="half title" value="中国西部环境与生态科学数据中心" name="source"/>
</p>
<p>
<label for="image">缩略图</label><br/>
<input type="file" class="half title" value=""/>
<input type="hidden" id="image" class="half title" value="" name="image"/>
</p>
<p>
<label for="description">内容简介(描述)</label><br/>
<textarea id="description" class="small half" name="description"></textarea>
</p>
<p>
<label for="content">新闻内容</label><br/>
<textarea id="content" class="large full" name="content"></textarea>
<label for="body">新闻内容</label><br/>
<textarea id="body" class="large full" name="body"></textarea>
</p>
<div class="clearfix leading">
<div class="column width3 first">
<p>
<label for="productcat" class="required">新闻栏目</label><br/>
<select id="productcat" class="full" name="productcat">
<label for="type" class="required">新闻栏目</label><br/>
<select id="type" class="full" name="typeid">
<option value="0">请选择栏目</option>
<?php
foreach($this->types as $v)
{
echo '<option value="'.$v['id'].'" selected>'.$v['title'].'</option>';
echo '<option value="'.$v['id'].'">'.$v['title'].'</option>';
}
?>
@ -117,21 +143,32 @@ $(document).ready(function(){
<small>e.g. 研究成果</small>
</p>
<p><a href="/admin/news/catlog/add/1" target="_blank">+ 添加新栏目</a></p>
<p>
<select id="pub" class="full" name="pub">
<option value="1">立即发布</option>
<option value="0">存草稿</option>
<option value="-1">不发布</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);?>" disabled="disabled" />
<small>e.g. 2011-10-28 9:35 or 2011-10-28 21:35</small>
</p>
</div>
</div>
<p class="box"><input type="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
<div id="return"></div>
<p class="box"><input type="button" onclick="addon();" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
</section>
<!-- End of Left column/section -->
@ -141,6 +178,43 @@ $(document).ready(function(){
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript">
$('#nav_news').addClass("current");
<script type="text/javascript">
$(function(){
$('#nav_news').addClass("current");
$("#pubtimeturn").click( function () {
if($(this).is(":checked"))
{
$('#pubtimelable').html('定时发布时间');
$('#pubtime').removeAttr('disabled');
}
else
{
$('#pubtimelable').html('定时发布?');
$('#pubtime').attr("disabled","disabled");
}
});
});
function addon(){
editor.sync();
var url = "/admin/news/archivesadd";
var data = $("#archivesadd").serialize()+'&keyword='+$('#keyword').val();
$.ajax({
type: "POST",
url: url,
data: data,
success: function(html){
$('#return').html(html);
},
beforeSend:function(){
$('#submit').val('正在提交...');
$('#submit').attr("disabled","disabled");
},
complete:function(){
$('#submit').val('提交');
$('#submit').removeAttr('disabled');
}
});
}
</script>