合并metadata-en分支news相关部分的工作,即后台从r1391-r1953, 前台从r1896-r1952.

This commit is contained in:
wlx 2012-03-27 07:02:36 +00:00
parent e9589968f8
commit 9214537af7
14 changed files with 1192 additions and 558 deletions

View File

@ -7,7 +7,6 @@ class Admin_NewsController extends Zend_Controller_Action
$this->view->config = Zend_Registry::get('config'); $this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger'); $this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages(); $this->view->messages = $this->messenger->getMessages();
$this->_helper->layout->setLayout('administry');//新UI
} }
function postDispatch() function postDispatch()
{ {
@ -15,13 +14,34 @@ class Admin_NewsController extends Zend_Controller_Action
} }
function indexAction() function indexAction()
{ {
$sql = "select n.*,c.title as catlog from news_archives n left join news_catlog c on n.typeid=c.id order by n.ts_created desc limit 10";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$this->view->news = $rows;
$sql = "SELECT count(id) as c FROM news_archives";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$this->view->totle = $row;
$sql = "SELECT count(id) as c FROM news_catlog";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$this->view->typec = $row;
}//indexAction 首页 }//indexAction 首页
function newslistAction(){ function newslistAction(){
$sql = "select n.*,c.title as catlog from news_archives n left join news_catlog c on n.typeid=c.id"; $type = $this->_request->getParam('type');
if(!empty($type))
{
$sql = "select n.*,c.title as catlog,c.url from news_archives n left join news_catlog c on n.typeid=c.id WHERE n.typeid='$type' order by n.ts_created desc";
}else
{
$sql = "select n.*,c.title as catlog,c.url from news_archives n left join news_catlog c on n.typeid=c.id order by n.ts_created desc";
}
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$rows = $rs->fetchAll(); $rows = $rs->fetchAll();
@ -32,6 +52,12 @@ class Admin_NewsController extends Zend_Controller_Action
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$sql="select * from news_catlog order by displayorder desc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$this->view->type = $type;
}//newslistAction 新闻列表 }//newslistAction 新闻列表
function catlogAction() function catlogAction()
@ -49,10 +75,11 @@ class Admin_NewsController extends Zend_Controller_Action
$this->_helper->viewRenderer('catlogadd'); $this->_helper->viewRenderer('catlogadd');
else{ else{
$title = $this->_request->getParam('ctitle'); $title = $this->_request->getParam('ctitle');
$url = $this->_request->getParam('url');
$keyword = $this->_request->getParam('keyword'); $keyword = $this->_request->getParam('keyword');
$description = $this->_request->getParam('description'); $description = $this->_request->getParam('description');
$sql="insert into news_catlog (title,keyword,description) values ('$title','$keyword','$description')"; $sql="insert into news_catlog (title,keyword,description,url) values ('$title','$keyword','$description','$url')";
if($this->db->exec($sql) > 0) if($this->db->exec($sql) > 0)
{ {
$this->messenger->addMessage('提示信息:栏目添加成功!'); $this->messenger->addMessage('提示信息:栏目添加成功!');
@ -75,11 +102,12 @@ class Admin_NewsController extends Zend_Controller_Action
if($edit>0) if($edit>0)
{ {
$title = $this->_request->getParam('ctitle'); $title = $this->_request->getParam('ctitle');
$url = $this->_request->getParam('url');
$keyword = $this->_request->getParam('keyword'); $keyword = $this->_request->getParam('keyword');
$description = $this->_request->getParam('description'); $description = $this->_request->getParam('description');
$displayorder = $this->_request->getParam('displayorder'); $displayorder = $this->_request->getParam('displayorder');
$sql="update news_catlog set title='$title',keyword='$keyword',description='$description',displayorder='$displayorder' where id='$edit'"; $sql="update news_catlog set title='$title',keyword='$keyword',description='$description',displayorder='$displayorder',url='$url' where id='$edit'";
if($this->db->exec($sql)>0) if($this->db->exec($sql)>0)
{ {
$this->messenger->addMessage('提示信息:栏目编辑成功!'); $this->messenger->addMessage('提示信息:栏目编辑成功!');
@ -89,7 +117,7 @@ class Admin_NewsController extends Zend_Controller_Action
else else
{ {
$sql="select * from news_catlog order by displayorder desc"; $sql="select * from news_catlog order by displayorder asc";
$re=$this->db->query($sql); $re=$this->db->query($sql);
$catlogs=$re->fetchAll(); $catlogs=$re->fetchAll();
@ -106,13 +134,15 @@ class Admin_NewsController extends Zend_Controller_Action
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
if($id>0) if($id>0)
{ {
$sql = "select id,title,pubtime,typeid from news_archives where id=$id"; $sql = "SELECT arc.id,arc.title,arc.ts_published,arc.typeid,cat.url,cat.id as typeid from news_archives arc
LEFT JOIN news_catlog cat ON arc.typeid=cat.id
WHERE arc.id=$id";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$rows = $rs->fetch(); $rows = $rs->fetch();
if($rows['pubtime']>time()) if($rows['ts_published']>time())
{ {
$title = "{$rows['title']}》将在".date('Y-m-d H:i',$rows['pubtime'])."发布"; $title = "{$rows['title']}》将在".date('Y-m-d H:i',$rows['ts_published'])."发布";
} }
else else
{ {
@ -132,6 +162,12 @@ class Admin_NewsController extends Zend_Controller_Action
}//newsadd 新闻添加 }//newsadd 新闻添加
function replacehtml($html)
{
$newString = htmlentities($html, ENT_QUOTES, "UTF-8");
return $newString;
}
function archivesaddAction() function archivesaddAction()
{ {
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
@ -150,10 +186,10 @@ class Admin_NewsController extends Zend_Controller_Action
$msg=array(); $msg=array();
if(empty($title)) $msg[]="标题不能为空"; if(empty($title)) $msg[]="标题不能为空";
if(strlen($title)>40) $msg[]="标题长度不能超过40个字符"; if(strlen($title)>200) $msg[]="标题长度不能超过200个字符";
if(strlen($writer)>50) $msg[]="作者长度不能超过50个字符"; if(strlen($writer)>50) $msg[]="作者长度不能超过50个字符";
if(strlen($keyword)>200) $msg[] = "关键词长度不能超过200个字符现在输入了".strlen($keyword)."个字符"; if(strlen($keyword)>200) $msg[] = "关键词长度不能超过200个字符现在输入了".strlen($keyword)."个字符";
if(strlen($description)>200) $msg[] = "内容描述不能超过200个字符现在输入了".strlen($description)."个字符"; if(strlen($description)>500) $msg[] = "内容描述不能超过200个字符现在输入了".strlen($description)."个字符";
if(empty($body)) $msg[]="请填写内容"; if(empty($body)) $msg[]="请填写内容";
if($typeid==0) $msg[]="请选择栏目"; if($typeid==0) $msg[]="请选择栏目";
@ -174,36 +210,35 @@ class Admin_NewsController extends Zend_Controller_Action
{ {
if(!empty($pubtimer)) if(!empty($pubtimer))
{ {
$pubtime = strtotime($pubtime); $pubtime = date("Y-m-d H:i:s",strtotime($pubtime));
} }
else else
{ {
$pubtime = time(); $pubtime = date("Y-m-d H:i:s",time());
} }
$date=array( $date=array(
'title' => $title, 'title' => $this->db->quote($this->replacehtml($title)),
'writer' => $writer, 'writer' => $this->db->quote($this->replacehtml($writer)),
'keyword' => $keyword, 'keyword' => $this->db->quote($this->replacehtml($keyword)),
'description'=> $description, 'description'=> $this->db->quote($this->replacehtml($description)),
'image' => $image, 'image' => $image,
'writetime' => time(),
'pubtime' => $pubtime, 'pubtime' => $pubtime,
'source' => $source, 'source' => $source,
'typeid' => $typeid, 'typeid' => $typeid,
'pub' => $pub, 'pub' => $pub,
'body' => $body 'body' => $this->db->quote($body)
); );
$sql = "INSERT INTO news_archives (title,writer,keyword,description,image,writetime,pubtime,source,typeid,pub) $sql = "INSERT INTO news_archives (title,author,keyword,description,image,ts_published,source,typeid,pub)
VALUES ('{$date['title']}', VALUES (
'{$date['writer']}', ".$date['title'].",
'{$date['keyword']}', ".$date['writer'].",
'{$date['description']}', ".$date['keyword'].",
".$date['description'].",
'{$date['image']}', '{$date['image']}',
'{$date['writetime']}',
'{$date['pubtime']}', '{$date['pubtime']}',
'{$date['source']}', '{$date['source']}',
'{$date['typeid']}', '{$date['typeid']}',
@ -216,7 +251,7 @@ class Admin_NewsController extends Zend_Controller_Action
if($sth->execute()) if($sth->execute())
{ {
$temp = $sth->fetch(PDO::FETCH_ASSOC); $temp = $sth->fetch(PDO::FETCH_ASSOC);
$sql = "INSERT INTO news_archivesaddon (id,body) values ('{$temp['id']}','{$date['body']}')"; $sql = "INSERT INTO news_archivesaddon (id,body) values ('{$temp['id']}',{$date['body']})";
if($this->db->exec($sql)>0) if($this->db->exec($sql)>0)
{ {
echo '<div class="box box-success">发布成功!</div><script> echo '<div class="box box-success">发布成功!</div><script>
@ -239,30 +274,158 @@ class Admin_NewsController extends Zend_Controller_Action
</ol> </ol>
</div>'; </div>';
} }
} }
/* }// 文章发布
<div class="box box-info">Info box sample</div> function newseditAction()
<div class="box box-warning">Warning box sample</div> {
<div class="box box-error">Error box sample</div>
$id = $this->_request->getParam('id');
$sql = "select * from news_archives arc
left join news_archivesaddon addon on addon.id=arc.id
where arc.id=$id
";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$this->view->ev = $row;
$sql="select * from news_catlog order by displayorder desc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
}
function archiveseditAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_request->getParam('id');
if(empty($id))
{
echo '<div class="box box-error">发布失败:</div>
<div class="box box-error-msg">
<ol>';
echo '<li>参数错误</li>'.
'</ol>
</div>
';
}
$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)>200) $msg[]="标题长度不能超过200个字符";
if(strlen($writer)>50) $msg[]="作者长度不能超过50个字符";
if(strlen($keyword)>200) $msg[] = "关键词长度不能超过200个字符现在输入了".strlen($keyword)."个字符";
if(strlen($description)>500) $msg[] = "内容描述不能超过500个字符现在输入了".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
{
$pubtime = date("Y-m-d H:i:s",strtotime($pubtime));
$date=array(
'title' => $this->replacehtml($title),
'writer' => $this->replacehtml($writer),
'keyword' => $this->replacehtml($keyword),
'description'=> $this->replacehtml($description),
'image' => $image,
'pubtime' => $pubtime,
'source' => $this->replacehtml($source),
'typeid' => $typeid,
'pub' => $pub,
'body' => $this->db->quote($body)
);
$sql = "UPDATE news_archives SET
title='{$date['title']}',
author='{$date['writer']}',
keyword='{$date['keyword']}',
description='{$date['description']}',
image='{$date['image']}',
ts_published='{$date['pubtime']}',
source='{$date['source']}',
typeid='{$date['typeid']}',
pub='{$date['pub']}'
WHERE id='$id'
";
try{
$sth = $this->db->prepare($sql);
if($sth->execute())
{
$sql = "UPDATE news_archivesaddon SET body=".$date['body']." WHERE id='$id'";
if($this->db->exec($sql)>0)
{
echo '<div class="box box-success">发布成功!</div><script>
setTimeout("self.location=\'/admin/news/newsadd/id/'.$id.'\'",500);
</script>';
}
else
{
$sql = "delete from news_archives where id='$id'";
$this->db->exec($sql);
echo '<div class="box box-success">发布失败!写入附加表出错,请联系管理员</div>';
}
}
}catch(Exception $e){
echo '<div class="box box-error">文章发布失败:</div>
<div class="box box-error-msg"> <div class="box box-error-msg">
<ol> <ol>
<li>Credit card number entered is invalid</li> <li>'.$e->getMessage().'</li>
<li>Credit card verification number must be a valid number</li>
</ol> </ol>
</div> </div>';
<div class="box box-success">Success box sample</div> }
}
}// 文章编辑
*/ function deleteAction(){
} $id = $this->_request->getParam('id');
$sql = "DELETE FROM news_archives WHERE id='$id'";
$sql2 = "DELETE FROM news_archivesaddon WHERE id='$id'";
if($this->db->exec($sql))
$this->db->exec($sql2);
$this->messenger->addMessage('提示信息:文章删除成功!');
$this->_redirect('/admin/news/newslist');
}//文章删除
} }

View File

@ -2,73 +2,53 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.dataTables.min.js'); $this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('栏目管理');
?> ?>
<style>
.listingDetails{position:absolute;width:650px;}
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;}
</style>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<!-- Page title --> <table id="report" class="stylized full" style="width:650px;">
<div id="pagetitle"> <thead>
<div class="wrapper"> <tr>
<h1>新闻中心</h1> <th width="60%">栏目名称</th>
<!-- Quick search box --> <th width="40%" style="vertical-align:top;">栏目管理</th>
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form> </tr>
</div> </thead>
</div> <tbody>
<!-- End of Page title --> <?php
if(is_array($this->catlogs))
<!-- Page content --> {
<div id="page"> foreach($this->catlogs as $k=>$v)
<!-- Wrapper --> {
<div class="wrapper"> echo '
<tr>
<!-- Right column/section --> <td>
<aside class="column width2 first"> <div id="paddiv'.$v['id'].'">
<?= $this->partial('news/left.phtml'); ?> <a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
</aside> <div class="listingDetails">
<!-- End of Right column/section --> <div class="pad">
<b>编辑栏目</b> <a href="javascript:;" class="closepad" style="float:right">关闭</a>
<!-- Left column/section --> <form id="editform'.$v['id'].'" method="post" action="#">
<section class="column width6"> <fieldset>
<h3>栏目管理</h3>
<hr/>
<?php if ($this->msg or $this->messages) :?>
<div class="box box-info">
<?php if ($this->msg) : ?>
<?php echo $this->msg; ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php echo $msg; ?>
<?php endforeach;endif; ?>
<script language="javascript">
setTimeout('$(".box-info").remove()',5000);
</script>
</div>
<?php endif; ?>
<table id="report" class="stylized full" style="">
<thead>
<tr>
<th width="50%">栏目名称</th>
<th width="50%">栏目管理</th>
</tr>
</thead>
<tbody>
<?php
if(is_array($this->catlogs))
{
foreach($this->catlogs as $k=>$v)
{
echo '
<tr>
<td class="title">
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>编辑栏目</b>
<form id="editform'.$v['id'].'" method="post" action="#">
<fieldset>
<legend>栏目信息</legend> <legend>栏目信息</legend>
<p> <p>
@ -76,6 +56,12 @@
<input type="text" id="ctitle" class="half" value="'.$v['title'].'" name="ctitle"/> <input type="text" id="ctitle" class="half" value="'.$v['title'].'" name="ctitle"/>
</p> </p>
<p>
<label class="required" for="ctitle">栏目URL:</label><br/>
<input type="text" id="url" class="half" value="'.$v['url'].'" name="url"/>(仅小写英文字母与数字)
<small>如填写: technology 则前台访问地址为: http://westdc.westgis.ac.cn/news/technology </small>
</p>
<p> <p>
<label class="required" for="keyword">关键字:</label><br/> <label class="required" for="keyword">关键字:</label><br/>
<input type="text" id="keyword" class="half" value="'.$v['keyword'].'" name="keyword"/> <input type="text" id="keyword" class="half" value="'.$v['keyword'].'" name="keyword"/>
@ -105,6 +91,8 @@
</div></div> </div></div>
</td> </td>
<td> <td>
<a href="/news/'.$v['url'].'" target="_blank">浏览</a>
<a href="/admin/news/newslist/type/'.$v['id'].'">文档</a>
<a href="javascript:showpad('.$v['id'].');"><b>编辑</b></a> <a href="javascript:showpad('.$v['id'].');"><b>编辑</b></a>
<a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td> <a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
</tr> </tr>
@ -119,29 +107,19 @@
} }
?> ?>
</tbody> </tbody>
</table> </table>
<hr/> </div>
<a href="/admin/news/catlog/add/1" class="btn"><span class="icon icon-add">&nbsp;</span>添加新栏目</a>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript"> <script type="text/javascript">
$('#nav_news').addClass("current");
$(document).ready(function(){ $(document).ready(function(){
/* setup navigation, content boxes, etc... */ $('.title').bind('click', function() {
Administry.setup(); $('.pad').css('display','none');
/* expandable rows */ $(this).next('.listingDetails').children('.pad').show();
Administry.expandableRows(); });
$('.closepad').bind('click', function() {
$('.pad').css('display','none');
});
}); });
function showpad(id){ function showpad(id){
$('#titlebtn'+id).click(); $('#titlebtn'+id).click();

View File

@ -2,77 +2,59 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js'); $this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/static/js/jquery.wysiwyg.min.js'); $this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('栏目添加');
?> ?>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<h3>添加栏目</h3>
<form id="sampleform" method="post" action="#">
<!-- Page title --> <fieldset>
<div id="pagetitle"> <legend>栏目信息</legend>
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content --> <p>
<div id="page"> <label class="required" for="ctitle">栏目标题:</label><br/>
<!-- Wrapper --> <input type="text" id="ctitle" class="half" value="" name="ctitle"/>
<div class="wrapper"> </p>
<!-- Right column/section --> <p>
<aside class="column width2 first"> <label class="required" for="ctitle">栏目URL:</label><br/>
<?= $this->partial('news/left.phtml'); ?> <input type="text" id="url" class="half" value="" name="url"/>(仅小写英文字母与数字)
</aside> <small>如填写: technology 则前台访问地址为: http://westdc.westgis.ac.cn/news/technology </small>
<!-- End of Right column/section --> </p>
<!-- Left column/section --> <p>
<section class="column width6"> <label class="required" for="keyword">关键字:</label><br/>
<input type="text" id="keyword" class="half" value="" name="keyword"/>
<small>e.g. 高程,气象,地理</small>
</p>
<h3>添加栏目</h3> <p>
<form id="sampleform" method="post" action="#"> <label class="required" for="discript">描述:</label><br/>
<textarea id="discript" class="medium half" name="discript"></textarea>
<small>80个汉字以内不能使用折行</small>
</p>
<fieldset> <input type="hidden" name="submit" value="1" />
<legend>栏目信息</legend>
<p> <p class="box"><input type="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
<label class="required" for="ctitle">栏目标题:</label><br/>
<input type="text" id="ctitle" class="half" value="" name="ctitle"/>
</p>
<p> </fieldset>
<label class="required" for="keyword">关键字:</label><br/>
<input type="text" id="keyword" class="half" value="" name="keyword"/>
<small>e.g. 高程,气象,地理</small>
</p>
<p> </form>
<label class="required" for="discript">描述:</label><br/> </div>
<textarea id="discript" class="medium half" name="discript"></textarea>
<small>80个汉字以内不能使用折行</small>
</p>
<input type="hidden" name="submit" value="1" />
<p class="box"><input type="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
<hr/>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript">
$('#nav_news').addClass("current");
</script>

View File

@ -2,82 +2,100 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
?> ?>
<!-- Page title --> <style>
<div id="pagetitle"> .listingDetails{position:absolute;width:650px; z-index:999;}
<div class="wrapper"> .pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;}
<h1>新闻中心</h1> </style>
<!-- Quick search box --> <div id="leftPanel">
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form> <?= $this->partial('news/left.phtml'); ?>
</div> </div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<h3>最新发布的新闻</h3>
<hr/>
<table id="report" class="stylized full" style="">
<thead>
<tr>
<th width="50%">新闻标题</th>
<th width="25%">所属栏目</th>
<th width="25%">新闻管理</th>
</tr>
</thead>
<tbody>
<?php
if(count($this->news))
{
foreach ($this->news as $v)
{
echo '
<tr>
<td>
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>详细信息</b> <a href="javascript:;" class="closepad" style="float:right">关闭</a>
<p>作者:'.$v['author'].'</p>
<p>关键词:'.$v['keyword'].'</p>
<p>描述:'.$v['description'].'</p>
<p>添加时间:'.date("Y-m-d H:i",strtotime($v['ts_created'])).'</p>
<p>发布时间:'.date("Y-m-d H:i",strtotime($v['ts_published'])).'</p>
<p>来源:'.$v['source'].'</p>
<p>点击:'.$v['click'].'</p>
</div>
</div></div>
</td>
<td>'.$v['catlog'].'</td>
<td>
<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>
';
}
}
else
{
echo '
<tr><td>暂无数据</td><td></td></tr>
';
}
?>
</tbody>
</table>
<h3>统计</h3>
<hr/>
<ul>
<li><?php echo $this->totle['c'];?> 条档案</li>
<li>栏目 <?php echo $this->typec['c'];?></li>
</ul>
</div> </div>
<!-- End of Page title --> <script type="text/javascript">
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<h3>最新发布的新闻</h3>
<hr/>
<div class="clear">&nbsp;</div>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<img src="http://designerz-crew.info/start/callb.png">
<script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$('.title').bind('click', function() {
/* setup navigation, content boxes, etc... */ $('.pad').css('display','none');
Administry.setup(); $(this).next('.listingDetails').children('.pad').show();
});
/* progress bar animations - setting initial values */ $('.closepad').bind('click', function() {
Administry.progress("#progress1", 1, 5); $('.pad').css('display','none');
Administry.progress("#progress2", 2, 5); });
Administry.progress("#progress3", 2, 5);
/* flot graphs */
var sales = [{
label: 'Total Paid',
data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,900],[8,0],[9,0],[10,0],[11,0],[12,0]]
},{
label: 'Total Due',
data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,422.10],[7,0],[8,0],[9,0],[10,0],[11,0],[12,0]]
}
];
var plot = $.plot($("#placeholder"), sales, {
bars: { show: true, lineWidth: 1 },
legend: { position: "nw" },
xaxis: { ticks: [[1, "Jan"], [2, "Feb"], [3, "Mar"], [4, "Apr"], [5, "May"], [6, "Jun"], [7, "Jul"], [8, "Aug"], [9, "Sep"], [10, "Oct"], [11, "Nov"], [12, "Dec"]] },
yaxis: { min: 0, max: 1000 },
grid: { color: "#666" },
colors: ["#0a0", "#f00"]
});
}); });
$('#nav_news').addClass("current"); function showpad(id){
$('#titlebtn'+id).click();
}
</script> </script>

View File

@ -1,32 +1,8 @@
<div id="rightmenu"> <ul>
<header> <li class="title">新闻中心</li>
<h3>新闻中心管理</h3> <li><a href="/admin/news">新闻中心首页</a></li>
</header> <li><a href="/admin/news/catlog">栏目管理</a></li>
<dl class="first"> <li><a href="/admin/news/catlog/add/1">栏目添加</a></li>
<li><a href="/admin/news/newslist">新闻管理</a></li>
<dt><img width="16" height="16" alt="" SRC="/static/img/90.png"></dt> <li><a href="/admin/news/newsadd">新闻发布</a></li>
<dd><a href="/admin/news/catlog">栏目管理</a></dd> </ul>
<dd class="last">创建、编辑、删除栏目</dd>
<dt><img width="16" height="16" alt="" SRC="/static/img/27.png"></dt>
<dd><a href="/admin/news/newslist">新闻管理</a></dd>
<dd class="last">查看、编辑、搜索、删除新闻</dd>
<dt><img width="16" height="16" alt="" SRC="/static/img/21.png"></dt>
<dd><a href="/admin/news/newsadd">发布新闻</a></dd>
<dd class="last">为网站发布一篇新闻</dd>
</dl>
</div>
<div class="content-box">
<header>
<h3>Tips</h3>
</header>
<section>
<dl>
<dt>在栏目编辑中,再次点击“编辑”按钮可以关闭栏目编辑窗口</dt>
<dd><a href="/admin/news/catlog">去试试</a></dd>
<dt>新闻添加中可以直接上传图片</dt>
<dd><a href="/admin/news/newsadd">去试试</a></dd>
</dl>
</section>
</div>

View File

@ -2,10 +2,15 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js'); $this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
$this->headScript()->appendFile('/static/js/kindeditor-min.js'); $this->headScript()->appendFile('/static/js/kindeditor-min.js');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js'); $this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css'); $this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('新闻添加');
?> ?>
<?php <?php
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
@ -16,6 +21,20 @@
$realname = $user->realname; $realname = $user->realname;
} }
?> ?>
<style>
.tagInput {}
.tagInputDiv {display:none;background-color:white;position:absolute;overflow:auto;border:1px solid lightgray;margin-top:-1px;}
.tagInputLine {color:black;font-weight:normal;padding:4px;}
.tagInputSel {background-color:gray;color:white;}
.tagInputLineTag {min-width:150px;display:inline-block;}
.tagInputLineFreq {min-width:50px;text-align:right;display:inline-block;float:right;}
.tagInputSuggestedTags {font-size: 11px;}
.tagInputSuggestedTags .label{display:block;background:0 none;color:#666;padding:0;margin-top:4px;}
.tagInputSuggestedTagList{}
.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;}
</style>
<script type="text/javascript"> <script type="text/javascript">
/* sample tags */ /* sample tags */
var tags=[ var tags=[
@ -24,10 +43,6 @@ var tags=[
]; ];
$(document).ready(function(){ $(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
KindEditor.ready(function(K) { KindEditor.ready(function(K) {
editor=K.create('textarea[name="body"]', { editor=K.create('textarea[name="body"]', {
cssPath : '/static/js/plugins/code/prettify.css', cssPath : '/static/js/plugins/code/prettify.css',
@ -51,41 +66,12 @@ $(document).ready(function(){
}); });
}); });
</script> </script>
<!-- Page title --> <div id="leftPanel">
<div id="pagetitle"> <?= $this->partial('news/left.phtml'); ?>
<div class="wrapper"> </div>
<h1>新闻中心</h1> <div id="rightPanel">
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
<div class="content-box">
<header>
<h3>新闻标签</h3>
</header>
<section>
输入Tag标签多个用半角逗号 “ , ”隔开每个Tag标签长度小于6个汉字
<p><textarea id="keyword" class="small full" name="keyword"></textarea></p>
</section>
</div>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6"> <section class="column width6">
<h3>发布新闻</h3>
<form name="form" id="archivesadd" method="post" action="#"> <form name="form" id="archivesadd" method="post" action="#">
<fieldset> <fieldset>
@ -109,6 +95,7 @@ $(document).ready(function(){
<p> <p>
<label for="description">内容简介(描述)</label><br/> <label for="description">内容简介(描述)</label><br/>
<textarea id="description" class="small half" name="description"></textarea> <textarea id="description" class="small half" name="description"></textarea>
<small id="enablelen"></small>
</p> </p>
<p> <p>
@ -161,15 +148,18 @@ $(document).ready(function(){
</fieldset> </fieldset>
</form> </form>
<div class="content-box">
<header>
<h3>新闻标签</h3>
</header>
<section>
输入Tag标签多个用半角逗号 " , "隔开每个Tag标签长度小于6个汉字
<p><textarea id="keyword" class="small full" name="keyword"></textarea></p>
</section>
</div>
</section> </section>
<!-- End of Left column/section --> <!-- End of Left column/section -->
</div>
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#nav_news').addClass("current"); $('#nav_news').addClass("current");
@ -208,4 +198,31 @@ function addon(){
} }
}); });
} }
$('#description').val('');
var limitNum = 200;
var pattern = '还可以输入' + limitNum + '字';
$('#enablelen').html(pattern);
$('#description').keyup(
function() {
var remain = getByteLen($(this).val());
if (remain > limitNum) {
var result = remain -limitNum;
pattern = '字数超过限制,请适当删除部分内容(超出了'+result+'字)';
}else{
var result = limitNum - remain;
pattern = '还可以输入' + result + '字';
}
$('#enablelen').html(pattern);
}
);
function getByteLen(val) {
var len = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null) //全角
len += 2;
else
len += 1;
}
return len;
}
</script> </script>

View File

@ -2,101 +2,25 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js'); $this->breadcrumb('<a href="/admin">后台首页</a>');
$this->headScript()->appendFile('/static/js/kindeditor-min.js'); $this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js'); $this->breadcrumb('新闻发布');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css'); $this->headScript()->appendFile('/js/jquery-1.7.min.js');
?> $this->headLink()->appendStylesheet('/css/admin.css');
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uname=$user->username;
$realname = $user->realname;
}
?> ?>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<h3><?php echo $this->title;?></h3>
<ul>
<li><a href="/news/<?php echo $this->infos['url']; ?>/archive-<?php echo $this->infos['id']; ?>.html" target="_blank">查看文章</a></li>
<li><a href="/admin/news/newslist">返回文章列表</a></li>
<li><a href="/admin/news/newsedit/id/<?php echo $this->infos['id']; ?>">更改文章</a></li>
<li><a href="/admin/news/newsadd">发表新文章</a></li>
<li>页面将自动跳转至文章列表页</li>
</ul>
<script type="text/javascript"> <script type="text/javascript">
/* sample tags */ setTimeout("self.location='/admin/news/newslist/typeid/<?php echo $this->infos['typeid'];?>'",5000);
var tags=[
{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(){
/* setup navigation, content boxes, etc... */
Administry.setup();
KindEditor.ready(function(K) {
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 */
$("#keyword").tagInput({
tags:tags,
//jsonUrl:"tags.json",
sortBy:"frequency",
suggestedTags:["冻土", "寒旱所", "大气", "高原", "西部", "环境"],
tagSeparator:",",
autoFilter:true,
autoStart:false,
//suggestedTagsPlaceHolder:$("#suggested"),
boldify:true
});
});
</script>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<h3><?php echo $this->title;?></h3>
<ul>
<li><a href="">查看文章</a></li>
<li><a href="">返回文章列表</a></li>
<li><a href="">更改文章</a></li>
<li><a href="">发表新文章</a></li>
<li>页面将自动跳转至文章列表页</li>
</ul>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript">
$(function(){
$('#nav_news').addClass("current");
});
setTimeout("self.location='/admin/news/list/typeid/<?php echo $this->view->typeid;?>'",500);
</script> </script>
</li>

View File

@ -0,0 +1,228 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
$this->headScript()->appendFile('/static/js/kindeditor-min.js');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('新闻编辑');
?>
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uname=$user->username;
$realname = $user->realname;
}
?>
<style>
.tagInput {}
.tagInputDiv {display:none;background-color:white;position:absolute;overflow:auto;border:1px solid lightgray;margin-top:-1px;}
.tagInputLine {color:black;font-weight:normal;padding:4px;}
.tagInputSel {background-color:gray;color:white;}
.tagInputLineTag {min-width:150px;display:inline-block;}
.tagInputLineFreq {min-width:50px;text-align:right;display:inline-block;float:right;}
.tagInputSuggestedTags {font-size: 11px;}
.tagInputSuggestedTags .label{display:block;background:0 none;color:#666;padding:0;margin-top:4px;}
.tagInputSuggestedTagList{}
.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;}
</style>
<script type="text/javascript">
/* sample tags */
var tags=[
{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(){
KindEditor.ready(function(K) {
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 */
$("#keyword").tagInput({
tags:tags,
//jsonUrl:"tags.json",
sortBy:"frequency",
suggestedTags:["冻土","寒旱所","大气","高原","西部","环境"],
tagSeparator:",",
autoFilter:true,
autoStart:false,
//suggestedTagsPlaceHolder:$("#suggested"),
boldify:true
});
});
</script>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<section class="column width6">
<h3>发布新闻</h3>
<form name="form" id="archivesadd" method="post" action="#">
<fieldset>
<legend>新闻信息</legend>
<input type="hidden" id="image" class="half title" value="" name="image"/>
<p>
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half title" value="<?php echo $this->ev['title']; ?>" name="title"/>
</p>
<p>
<label class="required" for="writer">作者</label><br/>
<input type="text" id="writer" class="half title" value="<?php echo $this->ev['author']; ?>" name="writer"/>
</p>
<p>
<label for="source" class="required">来源</label><br/>
<input type="text" id="source" class="half title" value="<?php echo $this->ev['source']; ?>" name="source"/>
</p>
<p>
<label for="description">内容简介(描述)</label><br/>
<textarea id="description" class="small half" name="description"><?php echo $this->ev['description']; ?></textarea>
<small id="enablelen"></small>
</p>
<p>
<label for="body">新闻内容</label><br/>
<textarea id="body" class="large full" name="body"><?php echo $this->ev['body']; ?></textarea>
</p>
<div class="clearfix leading">
<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($this->ev['typeid']==$v['id'])
echo '<option value="'.$v['id'].'" selected="selected">'.$v['title'].'</option>';
else
echo '<option value="'.$v['id'].'">'.$v['title'].'</option>';
}
?>
</select>
<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" <?php if($this->ev['pub']>=1) echo 'selected="selected"'; ?>>立即发布</option>
<option value="0" <?php if($this->ev['pub']==0) echo 'selected="selected"'; ?>>存草稿</option>
<option value="-1" <?php if($this->ev['pub']<0) echo 'selected="selected"'; ?>>不发布</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",strtotime($this->ev['ts_published']));?>" readonly="readonly" />
<small>e.g. 2011-10-28 9:35 or 2011-10-28 21:35</small>
</p>
</div>
</div>
<div class="content-box">
<header>
<h3>新闻标签</h3>
</header>
<section>
输入Tag标签多个用半角逗号 " , "隔开每个Tag标签长度小于6个汉字
<p><textarea id="keyword" class="small full" name="keyword"><?php echo $this->ev['keyword']; ?></textarea></p>
</section>
</div>
<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>
</div>
<script type="text/javascript">
$(function(){
$("#pubtimeturn").click( function () {
if($(this).is(":checked"))
{
$('#pubtimelable').html('定时发布时间');
$('#pubtime').removeAttr('readonly');
}
else
{
$('#pubtimelable').html('定时发布?');
$('#pubtime').attr("readonly","readonly");
}
});
});
function addon(){
editor.sync();
var url = "/admin/news/archivesedit/id/<?php echo $this->ev['id']; ?>";
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');
}
});
}
var limitNum = 200;
var pattern = '还可以输入' + (limitNum-getByteLen($('#description').val())) + '字';
$('#enablelen').html(pattern);
$('#description').keyup(
function() {
var remain = getByteLen($(this).val());
if (remain > limitNum) {
var result = remain -limitNum;
pattern = '字数超过限制,请适当删除部分内容(超出了'+result+'字)';
}else{
var result = limitNum - remain;
pattern = '还可以输入' + result + '字';
}
$('#enablelen').html(pattern);
}
);
function getByteLen(val) {
var len = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null) //全角
len += 2;
else
len += 1;
}
return len;
}
</script>

View File

@ -2,124 +2,131 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.dataTables.min.js'); $this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('新闻列表');
?> ?>
<style>
.listingDetails{position:absolute;width:650px;}
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;}
</style>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div>
<select>
<option>按栏目查看</option>
<?php
if(count($this->types))
{
foreach($this->types as $v)
{
if($this->type == $v['id'])
echo '<option onclick="self.location=\'/admin/news/newslist/type/'.$v['id'].'\'" selected="selected">'.$v['title'].'</option>';
else
echo '<option onclick="self.location=\'/admin/news/newslist/type/'.$v['id'].'\'">'.$v['title'].'</option>';
}
}
?>
</select>
&nbsp;
<a href="/admin/news/newslist">所有新闻列表</a>
</div>
<table id="report" class="stylized full" style="width:650px;">
<thead>
<tr>
<th width="50%">新闻标题</th>
<th width="15%">所属栏目</th>
<th width="15%">状态</th>
<th width="20%">新闻管理</th>
</tr>
</thead>
<tbody>
<?php
if(count($this->paginator))
{
$list = "";
foreach ($this->paginator as $v)
{
$list .= '
<tr>
<td>
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>详细信息</b> <a href="javascript:;" class="closepad" style="float:right">关闭</a>
<p>作者:'.$v['author'].'</p>
<p>关键词:'.$v['keyword'].'</p>
<p>描述:'.$v['description'].'</p>
<p>添加时间:'.date("Y-m-d H:i",strtotime($v['ts_created'])).'</p>
<p>发布时间:'.date("Y-m-d H:i",strtotime($v['ts_published'])).'</p>
<p>来源:'.$v['source'].'</p>
<p>点击:'.$v['click'].'</p>
</div>
</div></div>
</td>
<td><a href="/admin/news/newslist/type/'.$v['typeid'].'">'.$v['catlog'].'</a></td>
<td>';
if($v['ts_published']<time() and $v['pub']>0)
{
$list.="已发布";
}
if($v['ts_published']>time() and $v['pub']>0)
{
$list.= date('Y-m-d H:i',$v['ts_published']) . '发布';
}
if($v['pub']==0)
{
$list.="草稿";
}
if($v['pub']<0)
{
$list.="未发布";
}
$list .= '</td>
<td>
<a href="/news/'.$v['url'].'/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>
';
}
echo $list;
}
else
{
echo '
<tr><td>暂无数据</td><td></td></tr>
';
}
?>
<!-- Page title --> </tbody>
<div id="pagetitle"> </table>
<div class="wrapper"> <div class="pagenavi"><?= $this->paginator; ?></div>
<h1>新闻中心</h1> </div>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<h3>新闻列表</h3>
<hr/>
<div>
<a href="/admin/news/newslist">新闻列表</a>
</div>
<?php if ($this->msg or $this->messages) :?>
<div class="box box-info">
<?php if ($this->msg) : ?>
<?php echo $this->msg; ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php echo $msg; ?>
<?php endforeach;endif; ?>
<script language="javascript">
setTimeout('$(".box-info").remove()',5000);
</script>
</div>
<?php endif; ?>
<table id="report" class="stylized full" style="">
<thead>
<tr>
<th width="50%">新闻标题</th>
<th width="25%">所属栏目</th>
<th width="25%">新闻管理</th>
</tr>
</thead>
<tbody>
<?php
if(count($this->paginator))
{
foreach ($this->paginator as $v)
{
echo '
<tr>
<td class="title">
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>详细信息</b>
<p>作者:'.$v['writer'].'</p>
<p>关键词:'.$v['keyword'].'</p>
<p>描述:'.$v['description'].'</p>
<p>添加时间:'.date("Y-m-d H:i",$v['writetime']).'</p>
<p>发布时间:'.date("Y-m-d H:i",$v['pubtime']).'</p>
<p>来源:'.$v['source'].'</p>
<p>点击:'.$v['click'].'</p>
</div>
</div></div>
</td>
<td>'.$v['catlog'].'</td>
<td>
<a href="javascript:showpad('.$v['id'].');"><b>编辑</b></a>
<a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
</tr>
';
}
}
else
{
echo '
<tr><td>暂无数据</td><td></td></tr>
';
}
?>
</tbody>
</table>
<hr/>
<div class="pagenavi"><?= $this->paginator; ?></div>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript"> <script type="text/javascript">
$('#nav_news').addClass("current");
$(document).ready(function(){ $(document).ready(function(){
/* setup navigation, content boxes, etc... */ $('.title').bind('click', function() {
Administry.setup(); $('.pad').css('display','none');
/* expandable rows */ $(this).next('.listingDetails').children('.pad').show();
Administry.expandableRows(); });
$('.closepad').bind('click', function() {
$('.pad').css('display','none');
});
}); });
function showpad(id){ function showpad(id){
$('#titlebtn'+id).click(); $('#titlebtn'+id).click();

View File

@ -0,0 +1,139 @@
<?php
class NewsController extends Zend_Controller_Action
{
private $limit=10;
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->db=Zend_Registry::get('db');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
}
function indexAction()
{
$sql="select * from news_catlog order by displayorder asc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$time = date("Y-m-d H:i:s",time());
$sql = "SELECT arc.*,t.title as typetitle,t.url FROM news_archives arc
LEFT JOIN news_catlog t ON arc.typeid=t.id
WHERE arc.ts_published<'$time' AND pub>=1 ORDER BY ts_published DESC";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$page = $this->_request->getParam('page');
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
function listAction()
{
$type = strtolower($this->_request->getParam('type'));
$page = $this->_request->getParam('page');
if(preg_match("/archive\-(\d+)\.html/",$page,$matches))
{
$this->_forward('archive', 'news', null, array('archive' => $matches['1'] , 'type'=> $type));
}
else
{
if(preg_match("/[^a-z0-9]/",$type) || preg_match("/[^0-9]/",$page))
{
$this->_forward('error', 'error', null, null);
}
$sql = "SELECT id,url,title FROM news_catlog WHERE url='$type' ";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row['id']))
{
$this->_forward('error', 'error', null, null);
}
else{
$this->view->url = $row['url'];
$this->view->title = $row['title'];
$sql="select * from news_catlog order by displayorder asc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$time = date("Y-m-d H:i:s",time());
$sql = "SELECT arc.*,c.url FROM news_archives arc
left join news_catlog c ON arc.typeid=c.id
WHERE arc.typeid='{$row['id']}' AND arc.ts_published<'".$time."' AND arc.pub>=1
ORDER BY arc.ts_published DESC";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
}
}
function archiveAction()
{
$type = $this->_request->getParam('type');
$archive = $this->_request->getParam('archive');
$this->view->type = $type;
if(preg_match("/[^a-z0-9]/",$type) || preg_match("/[^0-9]/",$archive))
{
$this->_forward('error', 'error', null, null);
}
$sql="select * from news_catlog order by displayorder asc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$time = date("Y-m-d H:i:s",time());
$sql = "SELECT arc.*,addon.* FROM news_archives arc";
$sql .= " LEFT JOIN news_catlog type ON arc.typeid=type.id";
$sql .= " LEFT JOIN news_archivesaddon addon ON arc.id=addon.id";
$sql .= " WHERE arc.pub>0 AND ts_published<'$time' AND arc.id=$archive";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row['id']))
{
$this->_forward('error', 'error', null, null);
}
$this->view->infos = $row;
}
function searchAction()
{
}
}

View File

@ -0,0 +1,54 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($this->infos['title']);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">Home</a>');
$this->breadcrumb('<a href="/news">News</a>');
$this->breadcrumb('<a href="/news/'.$this->type.'">'.$this->type.'</a>');
$this->breadcrumb($this->infos['title']);
$this->breadcrumb()->setSeparator(' > ');
if(!empty($this->infos['keyword'])) $keyword = $this->infos['keyword']; else $keyword = $this->infos['title'];
$this->headMeta()->appendName('keywords', $keyword);
$this->headMeta()->appendName('description', mb_substr($this->infos['description'],0,180,'utf-8'));
?>
<div class="full center clear" id="body">
<div class="w300 Lfloat clear">
<div class="tbox">
<div class="title">Navigation</div>
<div class="content navmenu">
<ul>
<?php
if(count($this->types))
{
foreach($this->types as $k=>$v)
{
echo '<li><a href="/news/'.$v['url'].'">'.$v['title'].'</a></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="Rfloat clear archive_body" id="archive_body">
<div class="title"><?php echo $this->infos['title'];?></div>
<div class="info">time&nbsp;:&nbsp;<?php echo date("Y-m-d H:i",strtotime($this->infos['ts_published']));?>&nbsp;&nbsp;writer&nbsp;:&nbsp;<?php echo $this->infos['author'];?>&nbsp;&nbsp;source&nbsp;:&nbsp;<?php echo $this->infos['source'];?></div>
<div class="archive_content">
<table width="100%">
<tr>
<td>
<?php echo $this->infos['body'];?>
</td>
</tr>
</table>
</div>
</div>
</div>
<script>
$('#archive_body').width($('#body').width()-320);
$('#archive_body .archive_content img').css("max-width",$('#archive_body').width());
</script>

View File

@ -0,0 +1,68 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle('News');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">Home</a>');
$this->breadcrumb('News');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="full center clear" id="body">
<div class="w300 Lfloat clear">
<div class="tbox">
<div class="title">Navigation</div>
<div class="content navmenu">
<ul>
<?php
if(count($this->types))
{
foreach($this->types as $k=>$v)
{
echo '<li><a href="/news/'.$v['url'].'">'.$v['title'].'</a></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="Rfloat clear" id="archives_list">
<div class="archives_list">
<ul>
<?php
if(count($this->paginator))
{
foreach ($this->paginator as $v)
{
$description = "";
if(empty($v['description']))
{
$description = "No description";
}else if (mb_strlen($v['description'])>160)
{
$description = mb_substr($v['description'],0,160,'utf-8').'...<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="more">(more)</a>';
}else{
$description = $v['description'];
}
echo '<li>
[<a href="/news/'.$v['url'].'/" class="type">'.$v['typetitle'].'</a>]&nbsp;<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="title">'.$v['title'].'</a><br />
<small>TIME&nbsp;:&nbsp;'.date("Y-m-d H:i",strtotime($v['ts_published'])).'</small>
<p>'.$description.'</p>
</li>';
}
}
else
{
echo '暂无数据';
}
?>
</ul>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<script>
$('#archives_list').width($('#body').width()-320);
</script>

View File

@ -0,0 +1,69 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle('News');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">Home</a>');
$this->breadcrumb('<a href="/news">News</a>');
$this->breadcrumb($this->title);
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="full center clear" id="body">
<div class="w300 Lfloat clear">
<div class="tbox">
<div class="title">Navigation</div>
<div class="content navmenu">
<ul>
<?php
if(count($this->types))
{
foreach($this->types as $k=>$v)
{
echo '<li><a href="/news/'.$v['url'].'">'.$v['title'].'</a></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="Rfloat clear" id="archives_list">
<div class="archives_list">
<ul>
<?php
if(count($this->paginator))
{
foreach ($this->paginator as $v)
{
$description = "";
if(empty($v['description']))
{
$description = "No description";
}else if (mb_strlen($v['description'])>160)
{
$description = mb_substr($v['description'],0,160,'utf-8').'...<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="more">(more)</a>';
}else{
$description = $v['description'];
}
echo '<li>
<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="title">'.$v['title'].'</a><br />
<small>TIME&nbsp;:&nbsp;'.date("Y-m-d H:i",strtotime( $v['ts_published'] )).'</small>
<p>'.$description.'</p>
</li>';
}
}
else
{
echo '暂无数据';
}
?>
</ul>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<script>
$('#archives_list').width($('#body').width()-320);
</script>

View File

@ -0,0 +1,11 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($config->title->review);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">Home</a>');
$this->breadcrumb('News');
$this->breadcrumb()->setSeparator(' > ');
?>