修改新闻中心、评审管理

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

@ -101,13 +101,97 @@ class Admin_NewsController extends Zend_Controller_Action
$this->view->types=$types; $this->view->types=$types;
}//newsadd 新闻添加 }//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) if($show>0)
{ {
$this->_helper->viewRenderer('inreviewshow');
}//查看详细 }//查看详细
else else
{ {

View File

@ -8,17 +8,21 @@
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css'); $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"> <script type="text/javascript">
/* sample tags */ /* sample tags */
var tags=[ var tags=[
{tag:"js",freq:30},{tag:"jquery",freq:25}, {tag:"pojo",freq:10},{tag:"agile",freq:4}, {tag:"冻土",freq:30},{tag:"寒旱所",freq:25}, {tag:"大气",freq:10},{tag:"高原",freq:4},
{tag:"blog",freq:3},{tag:"canvas",freq:8}, {tag:"dialog",freq:3},{tag:"excel",freq:4}, {tag:"西部",freq:3},{tag:"地理",freq:8}, {tag:"环境",freq:3},{tag:"地质",freq:20}
{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}
]; ];
$(document).ready(function(){ $(document).ready(function(){
@ -27,7 +31,7 @@ $(document).ready(function(){
Administry.setup(); Administry.setup();
KindEditor.ready(function(K) { KindEditor.ready(function(K) {
K.create('textarea[name="content"]', { editor=K.create('textarea[name="body"]', {
cssPath : '/static/js/plugins/code/prettify.css', cssPath : '/static/js/plugins/code/prettify.css',
uploadJson : '/plugins/upload_json.php', uploadJson : '/plugins/upload_json.php',
fileManagerJson : '/plugins/file_manager_json.php', fileManagerJson : '/plugins/file_manager_json.php',
@ -36,7 +40,7 @@ $(document).ready(function(){
}); });
/* tag input field */ /* tag input field */
$("#tags").tagInput({ $("#keyword").tagInput({
tags:tags, tags:tags,
//jsonUrl:"tags.json", //jsonUrl:"tags.json",
sortBy:"frequency", sortBy:"frequency",
@ -47,8 +51,6 @@ $(document).ready(function(){
//suggestedTagsPlaceHolder:$("#suggested"), //suggestedTagsPlaceHolder:$("#suggested"),
boldify:true boldify:true
}); });
}); });
</script> </script>
<!-- Page title --> <!-- Page title -->
@ -75,7 +77,7 @@ $(document).ready(function(){
</header> </header>
<section> <section>
输入Tag标签多个用半角逗号 “ , ”隔开每个Tag标签长度小于6个汉字 输入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> </section>
</div> </div>
</aside> </aside>
@ -86,7 +88,7 @@ $(document).ready(function(){
<h3>发布新闻</h3> <h3>发布新闻</h3>
<form name="form" method="post" action="#"> <form name="form" id="archivesadd" method="post" action="#">
<fieldset> <fieldset>
<legend>新闻信息</legend> <legend>新闻信息</legend>
@ -96,20 +98,44 @@ $(document).ready(function(){
<input type="text" id="producttitle" class="half title" value="" name="title"/> <input type="text" id="producttitle" class="half title" value="" name="title"/>
</p> </p>
<p> <p>
<label for="content">新闻内容</label><br/> <label class="required" for="writer">作者</label><br/>
<textarea id="content" class="large full" name="content"></textarea> <input type="text" id="writer" class="half title" value="<?php echo $realname;?>" name="writer"/>
</p> </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="body">新闻内容</label><br/>
<textarea id="body" class="large full" name="body"></textarea>
</p>
<div class="clearfix leading"> <div class="clearfix leading">
<div class="column width3 first"> <div class="column width3 first">
<p> <p>
<label for="productcat" class="required">新闻栏目</label><br/> <label for="type" class="required">新闻栏目</label><br/>
<select id="productcat" class="full" name="productcat"> <select id="type" class="full" name="typeid">
<option value="0">请选择栏目</option>
<?php <?php
foreach($this->types as $v) 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> <small>e.g. 研究成果</small>
</p> </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>
<p>
<select id="pub" class="full" name="pub">
<option value="1">立即发布</option>
<option value="0">存草稿</option>
<option value="-1">不发布</option>
</select>
</p>
</div> </div>
<div class="column width3"> <div class="column width3">
<p> <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> </p>
</div> </div>
</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> </fieldset>
</form> </form>
</section> </section>
<!-- End of Left column/section --> <!-- End of Left column/section -->
@ -141,6 +178,43 @@ $(document).ready(function(){
<!-- End of Wrapper --> <!-- End of Wrapper -->
</div> </div>
<!-- End of Page content --> <!-- End of Page content -->
<script type="text/javascript"> <script type="text/javascript">
$('#nav_news').addClass("current"); $(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> </script>