merge heihedata branch from r3436 to r3451.

This commit is contained in:
wlx 2013-05-07 01:41:39 +00:00
commit 9fb00529c2
15 changed files with 4837 additions and 4455 deletions

View File

@ -3582,9 +3582,9 @@ class Admin_DataController extends Zend_Controller_Action
'title'=>$metadata['title'], 'title'=>$metadata['title'],
'doi'=>$metadata['doi'], 'doi'=>$metadata['doi'],
'url'=>"http://" . $_SERVER['HTTP_HOST'].'/data/'.$uuid, 'url'=>"http://" . $_SERVER['HTTP_HOST'].'/data/'.$uuid,
'publisher'=>view::User('realname'), 'publisher'=>'寒区旱区科学数据中心',
'title_en'=>$metadata['title_en'], 'title_en'=>$metadata['title_en'],
'publisher_en'=>view::User('realname'), 'publisher_en'=>'Cold and Arid Regions Science Data Center at Lanzhou',
); );
}else{ }else{
$this->view->data['info'] = $doi->data_process_out($this->view->data); $this->view->data['info'] = $doi->data_process_out($this->view->data);

View File

@ -54,7 +54,7 @@ $('#divFooter').css('position','absolute');
   
<a href="/admin/news/newslist">所有新闻列表</a> <a href="/admin/news/newslist">所有新闻列表</a>
</div> </div>
<table id="report" class="stylized full" style="width:650px;"> <table id="report" class="stylized full">
<thead> <thead>
<tr> <tr>
<th width="50%">新闻标题</th> <th width="50%">新闻标题</th>

View File

@ -2585,30 +2585,86 @@ class AuthorController extends Zend_Controller_Action
$u_id = $user->id; $u_id = $user->id;
} }
include_once("helper/view.php");
include_once("data/Author.php");
$author = new Author($this->db);
$author->Literature = new Literature($this->db);
//查看单条数据的所有文献 //查看单条数据的所有文献
if (!empty($uuid) && empty($ac)) if (!empty($uuid) && empty($ac))
{ {
$sql = "SELECT md.title,md.uuid,r.id,r.reference,r.link FROM mdref mr $rows = $author->Literature->byuuid($uuid);
LEFT JOIN metadata md ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND a.userid=? and mr.uuid=? AND a.status=1
order by md.ts_created desc
";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id,$uuid));
$rows = $sth->fetchAll();
@$this->view->mdtitle=$rows[0]['title']; @$this->view->mdtitle=$rows[0]['title'];
view::addPaginator($rows,$this->view,$this->_request);
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('literature-viewdata'); $this->_helper->viewRenderer('literature-viewdata');
} }
//编辑单条文献
if($ac == "edit")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
$content = $this->_getParam('content');
if(empty($id))
{
$this->jsonexit(array('error'=>'参数错误'));
return true;
}
if(empty($content))
{
$this->jsonexit(array('error'=>'请输入内容'));
return true;
}
$s = $author->Literature->edit($id,$content);
if($s !== true)
{
$this->jsonexit(array('error'=>'出现错误'));
return true;
}else{
$this->jsonexit(array('success'=>'修改成功!'));
return true;
}
}
//修改排序
if($ac == "order")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
$order = (int)$this->_getParam('order');
if(empty($id))
{
$this->jsonexit(array('error'=>'参数错误'));
return true;
}
if(empty($order))
{
$this->jsonexit(array('error'=>'请输入排序数字除0以外'));
return true;
}
$s = $author->Literature->order($id,$order);
if($s !== true)
{
$this->jsonexit(array('error'=>'出现错误'));
return true;
}else{
$this->jsonexit(array('success'=>'修改成功!'));
return true;
}
}
//查看单条文献的所有数据 //查看单条文献的所有数据
if (!empty($id) && empty($ac)) if (!empty($id) && empty($ac))
{ {
@ -2702,32 +2758,15 @@ class AuthorController extends Zend_Controller_Action
else if($ac=="bydata") else if($ac=="bydata")
{ {
$keywords = $this->_request->getParam('q'); $keywords = $this->_request->getParam('q');
if(!empty($keywords))
$this->view->q = $keywords;
$sql = "SELECT md.title,md.uuid,count(mr.id) as c FROM metadata md
LEFT JOIN mdref mr ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords)) if(!empty($keywords))
{ {
$search=new SimpleSearch($keywords); $lit = $author->Literature->bydata($keywords);
$where=$search->sql_expr(array("md.title","md.description")); $this->view->q = $keywords;
$sql.=' and '.$where; }else{
$lit = $author->Literature->bydata();
} }
$sql.=" group by md.uuid,md.title";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
view::addPaginator($lit,$this->view,$this->_request);
$this->_helper->viewRenderer('literature-bydata'); $this->_helper->viewRenderer('literature-bydata');
} }
@ -4005,7 +4044,9 @@ class AuthorController extends Zend_Controller_Action
'title'=>$metadata['title'], 'title'=>$metadata['title'],
'doi'=>$metadata['doi'], 'doi'=>$metadata['doi'],
'url'=>"http://" . $_SERVER['HTTP_HOST'].'/data/'.$uuid, 'url'=>"http://" . $_SERVER['HTTP_HOST'].'/data/'.$uuid,
'publisher'=>view::User('realname'), 'publisher'=>'寒区旱区科学数据中心',
'title_en'=>$metadata['title_en'],
'publisher_en'=>'Cold and Arid Regions Science Data Center at Lanzhou',
); );
}else{ }else{
$this->view->data['info'] = $doi->data_process_out($this->view->data); $this->view->data['info'] = $doi->data_process_out($this->view->data);

View File

@ -70,8 +70,8 @@ class IndexController extends Zend_Controller_Action
$this->view->news = $rows; $this->view->news = $rows;
$time = date("Y-m-d H:i:s",time()); //$time = date("Y-m-d H:i:s",time());
$sql = "SELECT * FROM archive WHERE is_pub=true AND ts_published<'$time' order by ts_published desc LIMIT 12 "; $sql = "SELECT * FROM archive WHERE is_pub=true AND ts_published<now() and id in (select ar_catalog.aid from ar_catalog left join ar_category on ar_catalog.cid=ar_category.id where ar_category.ptype='news') order by ts_published desc LIMIT 12 ";
$sth = $this->db->query($sql); $sth = $this->db->query($sql);
$rows = $sth->fetchAll(PDO::FETCH_BOTH); $rows = $sth->fetchAll(PDO::FETCH_BOTH);

View File

@ -705,7 +705,6 @@ class ReviewController extends Zend_Controller_Action
}// downattAction 下载附件 }// downattAction 下载附件
/* /*
* denyinviteAction() 专家拒绝邀请 * denyinviteAction() 专家拒绝邀请
* *
@ -719,13 +718,14 @@ class ReviewController extends Zend_Controller_Action
*/ */
function denyinviteAction() function denyinviteAction()
{ {
include_once("helper/view.php");
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
$uuid = $this->_request->getParam('uuid'); $uuid = $this->_request->getParam('uuid');
if(empty($id) || empty($uuid) || !is_numeric($id) ||!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) if(empty($id) || empty($uuid) || !is_numeric($id) ||!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{ {
$this->view->message = "参数错误"; view::Post($this,array('pageTitle'=>'提示信息','content'=>'参数错误','url'=>'/'));
return true;
}else{ }else{
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
@ -739,9 +739,15 @@ class ReviewController extends Zend_Controller_Action
try{ try{
$sql = "update mdexpertreview set status=-1 where id='$id' and uuid='$uuid'"; $sql = "update mdexpertreview set status=-1 where id='$id' and uuid='$uuid'";
if($this->db->exec($sql)) if($this->db->exec($sql))
$this->view->message = "您已经拒绝该元数据的评审邀请"; {
view::Post($this,array('pageTitle'=>'提示信息','content'=>'您已经拒绝该元数据的评审邀请','url'=>'/'));
return true;
}
else else
$this->view->message = "您无权限进行此操作"; {
view::Post($this,array('pageTitle'=>'提示信息','content'=>'您无权执行此操作','url'=>'/'));
return true;
}
}catch(Exception $e){ }catch(Exception $e){
$this->view->message = $e->getMessage(); $this->view->message = $e->getMessage();
} }
@ -749,13 +755,15 @@ class ReviewController extends Zend_Controller_Action
}//end if }//end if
else else
{ {
$this->view->message = "您无权使用此通知"; view::Post($this,array('pageTitle'=>'提示信息','content'=>'您无权使用此通知','url'=>'/'));
return true;
}//非本人操作,或尝试删除他人信息 }//非本人操作,或尝试删除他人信息
}//end if }//end if
else else
{ {
$this->view->message = '请登录后再执行此操作,请<a href="/account/login/?href=/review/denyinvite/id/'.$id.'/uuid/'.$uuid.'">点击此处登录</a>'; view::Post($this,array('pageTitle'=>'提示信息','content'=>'请登录后再执行此操作','url'=>'/account/login/?href=/review/allowinvite/id/'.$id.'/uuid/'.$uuid));
return true;
}//未登录 }//未登录
} }
@ -764,46 +772,32 @@ class ReviewController extends Zend_Controller_Action
//parameters are same as denyinviteAction //parameters are same as denyinviteAction
function inviteokAction() function inviteokAction()
{ {
include_once("helper/view.php");
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
$uuid = $this->_request->getParam('uuid'); $uuid = $this->_request->getParam('uuid');
if(empty($id) || empty($uuid) || !is_numeric($id) ||!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{
$this->view->message = "参数错误";
}else{
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
if($auth->hasIdentity()) if($auth->hasIdentity())
{ {
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$userid = $user->id; $userid = $user->id;
if($id==$userid) include_once("data/Review.php");
$review = new Review($this->db);
$s = $review->invite($id,$uuid,$userid,1);
if($s == true)
{ {
try{ view::Post($this,array('content'=>'您已经接受邀请','url'=>'/review/review/uuid/'.$uuid));
$sql = "update mdexpertreview set status=1 where id='$id' and uuid='$uuid'"; return true;
if($this->db->exec($sql)) }else{
$this->view->message = "感谢您同意对该数据的评审邀请,如遇到任何问题,请联系数据中心服务人员。"; view::Post($this,array('content'=>$s));
else return true;
$this->view->message = "您无权限进行此操作";
}catch(Exception $e){
$this->view->message = $e->getMessage();
} }
}else{
}//end if view::Post($this,array('content'=>'请登录后再执行此操作','url'=>'/account/login/?href=/review/allowinvite/id/'.$id.'/uuid/'.$uuid));
else return true;
{
$this->view->message = "您无权使用此通知";
}//非本人操作,或尝试删除他人信息
}//end if
else
{
$this->view->message = '请登录后再执行此操作,请<a href="/account/login/?href=/review/inviteok/id/'.$id.'/uuid/'.$uuid.'">点击此处登录</a>';
}//未登录 }//未登录
} }//allowinviteAction()
}// denyinviteAction() 专家拒绝邀请
} }

View File

@ -2,9 +2,8 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author); $this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
//$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>'); $this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('DOI'); $this->breadcrumb('DOI');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
@ -56,17 +55,31 @@ $this->headLink()->appendStylesheet('/css/author.css');
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label" for="title">title</label> <label class="control-label" for="title">标题</label>
<div class="controls"> <div class="controls">
<input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" /> <input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label" for="title_en">英文标题</label>
<div class="controls">
<input type="text" id="title_en" name="title_en" value="<?= isset($this->data['title_en']) ? $this->data['title_en']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="publisher_en">发布者英文</label>
<div class="controls">
<input type="text" id="publisher_en" name="publisher_en" value="<?= isset($this->data['publisher_en']) ? $this->data['publisher_en']:"" ?>" />
</div>
</div>
<?php if(empty($this->data['info']) || !is_array($this->data['info'])) {?> <?php if(empty($this->data['info']) || !is_array($this->data['info'])) {?>
<div class="control-group infocontrol" id="info1"> <div class="control-group infocontrol" id="info1">
<label class="control-label" for="">info</label> <label class="control-label" for="">info</label>
<div class="controls"> <div class="controls">
<input type="text" name="info[1][author]" value="" placeholder="作者" /> <input type="text" name="info[1][author]" value="" placeholder="作者" />
<input type="text" name="info[1][organization]" value="" placeholder="单位" /> <input type="text" name="info[1][organization]" value="" placeholder="单位" />
<input type="text" name="info[1][author_en]" value="" placeholder="作者英文" />
<input type="text" name="info[1][organization_en]" value="" placeholder="单位英文" />
<input type="text" name="info[1][order]" value="" placeholder="排序" /> <input type="text" name="info[1][order]" value="" placeholder="排序" />
</div> </div>
</div> </div>
@ -81,8 +94,10 @@ $this->headLink()->appendStylesheet('/css/author.css');
<div class="controls"> <div class="controls">
<input type="text" name="info[<?= $k ?>][author]" value="<?= $v['author'] ?>" placeholder="作者" /> <input type="text" name="info[<?= $k ?>][author]" value="<?= $v['author'] ?>" placeholder="作者" />
<input type="text" name="info[<?= $k ?>][organization]" value="<?= $v['organization'] ?>" placeholder="单位" /> <input type="text" name="info[<?= $k ?>][organization]" value="<?= $v['organization'] ?>" placeholder="单位" />
<input type="text" name="info[<?= $k ?>][author_en]" value="<?= $v['author_en'] ?>" placeholder="作者英文" />
<input type="text" name="info[<?= $k ?>][organization_en]" value="<?= $v['organization_en'] ?>" placeholder="单位英文" />
<input type="text" name="info[<?= $k ?>][order]" value="<?= $v['order'] ?>" placeholder="排序" /> <input type="text" name="info[<?= $k ?>][order]" value="<?= $v['order'] ?>" placeholder="排序" />
<?php if($index>0){ ?> <?php if($index>1){ ?>
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a> <a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
<?php }?> <?php }?>
</div> </div>
@ -118,6 +133,8 @@ function addinput(){
html = '<div class="control-group infocontrol"><div class="controls">' html = '<div class="control-group infocontrol"><div class="controls">'
+ '<input type="text" name="info[' + index + '][author]" placeholder="作者" /> ' + '<input type="text" name="info[' + index + '][author]" placeholder="作者" /> '
+ '<input type="text" name="info[' + index + '][organization]" placeholder="单位" /> ' + '<input type="text" name="info[' + index + '][organization]" placeholder="单位" /> '
+ '<input type="text" name="info[' + index + '][author_en]" placeholder="作者英文" /> '
+ '<input type="text" name="info[' + index + '][organization_en]" placeholder="单位英文" /> '
+ '<input type="text" name="info[' + index + '][order]" placeholder="排序" /> ' + '<input type="text" name="info[' + index + '][order]" placeholder="排序" /> '
+ '<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>' + '<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+ '</div></div>'; + '</div></div>';

View File

@ -3,6 +3,7 @@ $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author); $this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendModel($this,"author-literature");
$this->headLink()->appendStylesheet('/css/author.css'); $this->headLink()->appendStylesheet('/css/author.css');
$this->headScript()->appendFile('/static/js/uploadify/swfobject.js'); $this->headScript()->appendFile('/static/js/uploadify/swfobject.js');
$this->headScript()->appendFile('/static/js/uploadify/jquery.uploadify.v2.1.4.min.js'); $this->headScript()->appendFile('/static/js/uploadify/jquery.uploadify.v2.1.4.min.js');
@ -34,9 +35,12 @@ $this->breadcrumb()->setSeparator(' > ');
foreach ($this->paginator as $item): foreach ($this->paginator as $item):
$autoindex++;?> $autoindex++;?>
<li class="well" id="list_<?php echo $item['id'].$item['uuid'];?>"> <li class="well" id="list_<?php echo $item['id'].$item['uuid'];?>">
<p><?php echo $item['reference'];?> <p><?php echo $item['reference'];?></p>
<p>
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a> <a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a>
| <a onclick="return confirm('是否确定删除该版本?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a> | <a href="javascript:void(0);" class="edit" rel="<?= $item['id'];?>">编辑</a>
| <a href="javascript:void(0);" class="order" rel="<?= $item['id'];?>" rev="<?= $item['place']?>">排序</a>
| <a onclick="return confirm('是否确定删除该文献?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a>
| <a href="/author/literature/ac/add/uuid/<?php echo $item['uuid'];?>" class="more iframe">添加文献</a> | <a href="/author/literature/ac/add/uuid/<?php echo $item['uuid'];?>" class="more iframe">添加文献</a>
</p> </p>
</li> </li>
@ -45,8 +49,6 @@ $this->breadcrumb()->setSeparator(' > ');
endif; ?> endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div> <div class="pagenavi"><?= $this->paginator; ?></div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>

View File

@ -49,7 +49,7 @@ $this->breadcrumb()->setSeparator(' > ');
<p><?php echo $item['reference'];?> <p><?php echo $item['reference'];?>
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a> <a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a>
| |
<a onclick="return confirm('是否确定删除该版本');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a> <a onclick="return confirm('是否确定删除该文献');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a>
</p> </p>
</li> </li>
<?php endforeach; <?php endforeach;

View File

@ -0,0 +1,17 @@
<?php
$this->headTitle('寒区旱区科学数据中心');
if(!empty($this->pageTitle))
{
$this->headTitle()->setSeparator(' - ');
$this->headTitle($this->pageTitle);
}
?>
<div class="row-fluit">
<div class="hero-unit">
<h2><?= $this->content ?><?php if(!empty($this->url)) echo ",系统正在为您跳转..."?></h2>
<?php if(!empty($this->url)) {?>
<a href="<?= $this->url ?>">如果没有跳转请点击这样</a>
<script language="javascript">setTimeout("self.location='<?= $this->url?>'",3000);</script>
<?php } ?>
</div>
</div>

View File

@ -158,5 +158,13 @@ class Theme
}// AppendPlus }// AppendPlus
//加载页面中的JS
function AppendModel($render,$model)
{
$model = trim($model);
$render->headScript()->appendFile("/js/lib/custom/models/".$model.".js");
}//
} }

View File

@ -1,7 +1,7 @@
<?php <?php
class Author extends Zend_Controller_Plugin_Abstract class Author extends Zend_Controller_Plugin_Abstract
{ {
private $db; //传入PDO对象. public $db; //传入PDO对象.
private $auth = NULL; //Zend_Auth 对象 private $auth = NULL; //Zend_Auth 对象
//使用到的公共变量 //使用到的公共变量
@ -42,3 +42,81 @@ class Author extends Zend_Controller_Plugin_Abstract
} }
} }
} }
class Literature extends Author
{
public function __construct($db)
{
$this->db = $db;
}
function byuuid($uuid){
include_once("helper/view.php");
$uid = view::User('id');
$sql = "SELECT md.title,md.uuid,r.id,r.reference,r.link,mr.place FROM mdref mr
LEFT JOIN metadata md ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND a.userid=? and mr.uuid=? AND a.status=1
order by mr.place ASC,r.id DESC,md.ts_created desc
";
$sth = $this->db->prepare($sql);
$sth->execute(array($uid,$uuid));
$rows = $sth->fetchAll();
return $rows;
}
function edit($id,$content){
include_once("helper/dbh.php");
$dbh = new dbh($this->db);
$data = array(
'reference' => $content
);
$s = $dbh->update("reference",$data," id=$id ",false);
return $s;
}
function order($id,$order){
include_once("helper/dbh.php");
$dbh = new dbh($this->db);
$data = array(
'place' => $order
);
$s = $dbh->update("mdref",$data," refid=$id ",false);
return $s;
}
function bydata($keywords=""){
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uid = $user->id;
}else{
return false;
}
$sql = "SELECT md.title,md.uuid,count(mr.id) as c FROM metadata md
LEFT JOIN mdref mr ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND a.userid=$uid AND a.status=1";
if(!empty($keywords))
{
include_once('SimpleSearch.php');
$search=new SimpleSearch($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
}
$sql.=" group by md.uuid,md.title";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll();
return $rows;
}
}

View File

@ -0,0 +1,41 @@
<?php
class Review extends Zend_Controller_Plugin_Abstract
{
private $db; //传入PDO对象.
private $auth = NULL; //Zend_Auth 对象
//使用到的公共变量
public $tbl_review = "mdexpertreview";
function __construct($db)
{
$this->db = $db;
}
//接受或者拒绝评审
function invite($id,$uuid,$uid,$status)
{
if(empty($id) || empty($uuid) || !is_numeric($id) ||!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{
return"参数错误";
}
if($id != $uid)
{
return "您无权使用此通知";
}//非本人操作
try{
$sql = "update ".$this->tbl_review." set status=$status where id='$id' and uuid='$uuid'";
if($this->db->exec($sql))
{
return true;
}else{
return "您无权限进行此操作";
}
}catch(Exception $e){
return "处理中出现错误";
}
}
}

View File

@ -80,4 +80,21 @@ class view extends Zend_Controller_Plugin_Abstract
} }
} }
static function Post(Zend_Controller_Action $ctl,$msg){
if(empty($msg))
{
return false;
}
if(!array($msg))
{
$msg = array('content'=>$msg);
}
$helper = new Zend_Controller_Action_HelperBroker($ctl);
$helper->viewRenderer->setNoRender();
echo $ctl->view->partial('post-message.phtml', $msg);
return true;
}
} }

View File

@ -33,7 +33,7 @@ $registry->set('db',$db);
// setup controller // setup controller
$frontController = Zend_Controller_Front::getInstance(); $frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(false); $frontController->throwExceptions(true);
//$frontController->setControllerDirectory('../application/controllers'); //$frontController->setControllerDirectory('../application/controllers');
$frontController->setControllerDirectory(array( $frontController->setControllerDirectory(array(
'default' => '../application/default/controllers', 'default' => '../application/default/controllers',

View File

@ -0,0 +1,167 @@
$(document).ready(function(e) {
$('.edit').click(function(e) {
$(this).litedit({'id':$(this).attr('rel')});
});
$('.order').click(function(e) {
$(this).litorder({'id':$(this).attr('rel')});
});
});
// JavaScript Document
(function( $ ){
$.fn.litedit = function( options ) {
var settings = $.extend( {
id:'',
content : '',
}, options);
var methods = {
edit : function(id)
{
methods.creatWindow(id);
},
creatWindow : function(id){
$.colorbox({
initialHeight: '0',
initialWidth: '0',
html: methods.dialog,
opacity: '0.3',
onComplete: function(){
$('.confirm_yes').click(function(e){
e.preventDefault();
methods.submited(id);
$.colorbox.close();
});
$('.confirm_no').click(function(e){
e.preventDefault();
$.colorbox.close();
});
}
});
},
submited : function(id){
$.ajax({
'type':"POST",
'url':'/author/literature/',
'data':'ac=edit&id='+id+'&content='+$('#content_input_area').val(),
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{alert(data.error);}
if(typeof(data.success)!='undefined')
{
window.location.reload();
}
}
else{
alert('出现错误,请稍候再试');
}
},
'timeout': 30000,
'error': function(){
alert('出现错误,请刷新后重试');
}
});
},
dialog : function(content){
HTML = '<div class=""><div class="modal-header"><h3>修改文献</h3></div>'
+ '<div class="modal-body"><textarea class="span8" id="content_input_area">'+settings.content+'</textarea></div>'
+ '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes">是</a><a href="javascript:void(0);" class="btn confirm_no">否</a></div></div>';
return HTML;
}
}
this.each(function() {
if( settings.id == '')
{
alert('参数错误');
}
settings.content = $(this).parent('p').prev('p').html();
methods.edit(settings.id);
});
};
})( jQuery );
(function( $ ){
$.fn.litorder = function( options ) {
var settings = $.extend( {
id:'',
order : '',
}, options);
var methods = {
edit : function(id)
{
methods.creatWindow(id);
},
creatWindow : function(id){
$.colorbox({
initialHeight: '0',
initialWidth: '0',
html: methods.dialog,
opacity: '0.3',
onComplete: function(){
$('.confirm_yes').click(function(e){
e.preventDefault();
methods.submited(id);
$.colorbox.close();
});
$('.confirm_no').click(function(e){
e.preventDefault();
$.colorbox.close();
});
}
});
},
submited : function(id){
$.ajax({
'type':"POST",
'url':'/author/literature/',
'data':'ac=order&id='+id+'&order='+$('#order_input').val(),
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{alert(data.error);}
if(typeof(data.success)!='undefined')
{
window.location.reload();
}
}
else{
alert('出现错误,请稍候再试');
}
},
'timeout': 30000,
'error': function(){
alert('出现错误,请刷新后重试');
}
});
},
dialog : function(content){
HTML = '<div class=""><div class="modal-header"><h3>修改排序</h3></div>'
+ '<div class="modal-body">数字越小排序越靠前<br />'
+ '请输入排序数字<input type="text" id="order_input" value="'+settings.order+'"/></div>'
+ '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes">是</a><a href="javascript:void(0);" class="btn confirm_no">否</a></div></div>';
return HTML;
}
}
this.each(function() {
if( settings.id == '')
{
alert('参数错误');
}
settings.order = $(this).attr('rev');
methods.edit(settings.id);
});
};
})( jQuery );