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'],
'doi'=>$metadata['doi'],
'url'=>"http://" . $_SERVER['HTTP_HOST'].'/data/'.$uuid,
'publisher'=>view::User('realname'),
'publisher'=>'寒区旱区科学数据中心',
'title_en'=>$metadata['title_en'],
'publisher_en'=>view::User('realname'),
'publisher_en'=>'Cold and Arid Regions Science Data Center at Lanzhou',
);
}else{
$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>
</div>
<table id="report" class="stylized full" style="width:650px;">
<table id="report" class="stylized full">
<thead>
<tr>
<th width="50%">新闻标题</th>

File diff suppressed because it is too large Load Diff

View File

@ -70,8 +70,8 @@ class IndexController extends Zend_Controller_Action
$this->view->news = $rows;
$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 ";
//$time = date("Y-m-d H:i:s",time());
$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);
$rows = $sth->fetchAll(PDO::FETCH_BOTH);

View File

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

View File

@ -1,133 +1,150 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
//$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('DOI');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css');
?>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li><a href="/author/doi">浏览所有</a></li>
<?php if(!empty($this->uuid)) {?>
<li class="active"><a href="javascript:void(0);">编辑DOI</a></li>
<?php }?>
</ul>
</div>
<div class="">
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="doi">doi</label>
<div class="controls">
<input type="text" id="doi" name="doi" readonly="readonly" value="<?= (isset($this->data['doi'])&&!empty($this->data['doi'])) ? $this->data['doi']:"doi:10.3972/westdc.x.2013.db" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="uuid">uuid</label>
<div class="controls">
<input type="text" id="uuid" name="uuid" readonly="readonly" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="publisher">发布者</label>
<div class="controls">
<input type="text" id="publisher" name="publisher" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="url">url</label>
<div class="controls">
<input type="text" id="url" name="url" readonly="readonly" value="<?= isset($this->data['url']) ? $this->data['url']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="title">title</label>
<div class="controls">
<input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
</div>
</div>
<?php if(empty($this->data['info']) || !is_array($this->data['info'])) {?>
<div class="control-group infocontrol" id="info1">
<label class="control-label" for="">info</label>
<div class="controls">
<input type="text" name="info[1][author]" value="" placeholder="作者" />
<input type="text" name="info[1][organization]" value="" placeholder="单位" />
<input type="text" name="info[1][order]" value="" placeholder="排序" />
</div>
</div>
<?php }else{ ?>
<?php
$index = 0;
foreach($this->data['info'] as $k=>$v){
$index ++;
?>
<div class="control-group infocontrol">
<label class="control-label">info</label>
<div class="controls">
<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 ?>][order]" value="<?= $v['order'] ?>" placeholder="排序" />
<?php if($index>0){ ?>
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
<?php }?>
</div>
</div>
<?php } ?>
<?php } ?>
<div class="control-group">
<div class="controls">
<a href="javascript:void(0);" onclick="addinput()">+添加一条</a>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="submit" value="1" />
<?php if(!empty($this->id)) { ?>
<input type="hidden" name="id" value=" <?=$this->id?> " />
<?php } ?>
<?php if(!empty($this->uuid)) { ?>
<input type="hidden" name="uuid" value=" <?=$this->uuid?>" />
<?php } ?>
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
<script>
function addinput(){
var now_index = $('.infocontrol').length;
var index = now_index + 1;
html = '<div class="control-group infocontrol"><div class="controls">'
+ '<input type="text" name="info[' + index + '][author]" placeholder="作者" /> '
+ '<input type="text" name="info[' + index + '][organization]" placeholder="单位" /> '
+ '<input type="text" name="info[' + index + '][order]" placeholder="排序" /> '
+ '<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+ '</div></div>';
now_index = null;
index = null;
$('.infocontrol').last().after(html);
}
function RmInput(e){
$e = $(e);
$e.parent('div').parent('div.infocontrol').remove();
}
</script>
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('DOI');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css');
?>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li><a href="/author/doi">浏览所有</a></li>
<?php if(!empty($this->uuid)) {?>
<li class="active"><a href="javascript:void(0);">编辑DOI</a></li>
<?php }?>
</ul>
</div>
<div class="">
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="doi">doi</label>
<div class="controls">
<input type="text" id="doi" name="doi" readonly="readonly" value="<?= (isset($this->data['doi'])&&!empty($this->data['doi'])) ? $this->data['doi']:"doi:10.3972/westdc.x.2013.db" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="uuid">uuid</label>
<div class="controls">
<input type="text" id="uuid" name="uuid" readonly="readonly" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="publisher">发布者</label>
<div class="controls">
<input type="text" id="publisher" name="publisher" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="url">url</label>
<div class="controls">
<input type="text" id="url" name="url" readonly="readonly" value="<?= isset($this->data['url']) ? $this->data['url']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="title">标题</label>
<div class="controls">
<input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
</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'])) {?>
<div class="control-group infocontrol" id="info1">
<label class="control-label" for="">info</label>
<div class="controls">
<input type="text" name="info[1][author]" 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="排序" />
</div>
</div>
<?php }else{ ?>
<?php
$index = 0;
foreach($this->data['info'] as $k=>$v){
$index ++;
?>
<div class="control-group infocontrol">
<label class="control-label">info</label>
<div class="controls">
<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 ?>][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="排序" />
<?php if($index>1){ ?>
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
<?php }?>
</div>
</div>
<?php } ?>
<?php } ?>
<div class="control-group">
<div class="controls">
<a href="javascript:void(0);" onclick="addinput()">+添加一条</a>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="submit" value="1" />
<?php if(!empty($this->id)) { ?>
<input type="hidden" name="id" value=" <?=$this->id?> " />
<?php } ?>
<?php if(!empty($this->uuid)) { ?>
<input type="hidden" name="uuid" value=" <?=$this->uuid?>" />
<?php } ?>
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
<script>
function addinput(){
var now_index = $('.infocontrol').length;
var index = now_index + 1;
html = '<div class="control-group infocontrol"><div class="controls">'
+ '<input type="text" name="info[' + index + '][author]" 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="排序" /> '
+ '<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+ '</div></div>';
now_index = null;
index = null;
$('.infocontrol').last().after(html);
}
function RmInput(e){
$e = $(e);
$e.parent('div').parent('div.infocontrol').remove();
}
</script>
<!-- //页面内容 -->

View File

@ -3,6 +3,7 @@ $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendModel($this,"author-literature");
$this->headLink()->appendStylesheet('/css/author.css');
$this->headScript()->appendFile('/static/js/uploadify/swfobject.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):
$autoindex++;?>
<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 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>
</p>
</li>
@ -45,8 +49,6 @@ $this->breadcrumb()->setSeparator(' > ');
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div>
<script>

View File

@ -49,7 +49,7 @@ $this->breadcrumb()->setSeparator(' > ');
<p><?php echo $item['reference'];?>
<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>
</li>
<?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
//加载页面中的JS
function AppendModel($render,$model)
{
$model = trim($model);
$render->headScript()->appendFile("/js/lib/custom/models/".$model.".js");
}//
}

View File

@ -1,44 +1,122 @@
<?php
class Author extends Zend_Controller_Plugin_Abstract
{
private $db; //传入PDO对象.
private $auth = NULL; //Zend_Auth 对象
//使用到的公共变量
public $tbl_metadata = "metadata"; //元数据
public $tbl_author = "mdauthor"; //数据作者表
function __construct($db)
{
$this->db = $db;
}
//检查前台用户对某条数据的权限
function checkAuthor($uuid,$uid=0)
{
if(empty($uid))
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uid = $user->id;
}
}
if(!empty($uid))
{
$sql = "SELECT * FROM ".$this->tbl_author." WHERE uuid='$uuid' AND userid=$uid";
}else{
return false;
}
$rs = $this->db->query($sql);
$row = $rs->fetch(PDO::FETCH_BOTH);
if($row['status']>0)
{
return true;
}else{
return false;
}
}
}
<?php
class Author extends Zend_Controller_Plugin_Abstract
{
public $db; //传入PDO对象.
private $auth = NULL; //Zend_Auth 对象
//使用到的公共变量
public $tbl_metadata = "metadata"; //元数据
public $tbl_author = "mdauthor"; //数据作者表
function __construct($db)
{
$this->db = $db;
}
//检查前台用户对某条数据的权限
function checkAuthor($uuid,$uid=0)
{
if(empty($uid))
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uid = $user->id;
}
}
if(!empty($uid))
{
$sql = "SELECT * FROM ".$this->tbl_author." WHERE uuid='$uuid' AND userid=$uid";
}else{
return false;
}
$rs = $this->db->query($sql);
$row = $rs->fetch(PDO::FETCH_BOTH);
if($row['status']>0)
{
return true;
}else{
return false;
}
}
}
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

@ -1,83 +1,100 @@
<?php
class view extends Zend_Controller_Plugin_Abstract
{
private $db; //传入PDO对象.
private $product = 0; //产品环境
function __construct($db='')
{
$this->db = $db;
}
static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
{
$page = $request->getParam('page');
$paginator = Zend_Paginator::factory($data);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage(12);
$paginator->setView($ctl);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$ctl->paginator = $paginator;
}
static function Msg($type,$content,$url=''){
$html = '<div class="alert '.$type.'">'."\r\n";
$html.= '<a data-dismiss="alert" class="close">×</a>'."\r\n";
$html.= $content."\r\n";
$html.= '</div>'."\r\n";
if(!empty($url))
{
if($url == -1){
$html.= '<script language="javascript">setTimeout("window.history.back(-1);",3000);</script>'."\r\n";
}else{
$html.= '<script language="javascript">setTimeout("self.location=\''.$url.'\'",3000);</script>'."\r\n";
}
}
return $html;
}
static function Error($type,$content,$url=''){
if(empty($type))
{
$AlertType = "alert-error";
}else{
$AlertType = $type;
}
$html = '<div class="alert alert-block fade in '.$AlertType.'" id="Alert-error-box">'."\r\n";
$html.= '<a class="close" data-dismiss="alert" href="#">×</a>'."\r\n";
if(!is_array($content)) {
$html.= '<h4 class="alert-heading">'.$content.'</h4>'."\r\n";
}else{
$html.= '<ul>'."\r\n";
foreach($content as $v) {
$html.='<li>'.$v.'</li>'."\r\n";
}
$html.= '</ul>'."\r\n";
}
$html.= '</div>'."\r\n";
return $html;
}
static function User($param){
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
return $user->$param;
}else{
return false;
}
}
static function Dump($data,$exit = true){
echo "<pre>";
var_dump($data);
echo "</pre>";
if($exit)
{
exit();
}
}
<?php
class view extends Zend_Controller_Plugin_Abstract
{
private $db; //传入PDO对象.
private $product = 0; //产品环境
function __construct($db='')
{
$this->db = $db;
}
static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
{
$page = $request->getParam('page');
$paginator = Zend_Paginator::factory($data);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage(12);
$paginator->setView($ctl);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$ctl->paginator = $paginator;
}
static function Msg($type,$content,$url=''){
$html = '<div class="alert '.$type.'">'."\r\n";
$html.= '<a data-dismiss="alert" class="close">×</a>'."\r\n";
$html.= $content."\r\n";
$html.= '</div>'."\r\n";
if(!empty($url))
{
if($url == -1){
$html.= '<script language="javascript">setTimeout("window.history.back(-1);",3000);</script>'."\r\n";
}else{
$html.= '<script language="javascript">setTimeout("self.location=\''.$url.'\'",3000);</script>'."\r\n";
}
}
return $html;
}
static function Error($type,$content,$url=''){
if(empty($type))
{
$AlertType = "alert-error";
}else{
$AlertType = $type;
}
$html = '<div class="alert alert-block fade in '.$AlertType.'" id="Alert-error-box">'."\r\n";
$html.= '<a class="close" data-dismiss="alert" href="#">×</a>'."\r\n";
if(!is_array($content)) {
$html.= '<h4 class="alert-heading">'.$content.'</h4>'."\r\n";
}else{
$html.= '<ul>'."\r\n";
foreach($content as $v) {
$html.='<li>'.$v.'</li>'."\r\n";
}
$html.= '</ul>'."\r\n";
}
$html.= '</div>'."\r\n";
return $html;
}
static function User($param){
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
return $user->$param;
}else{
return false;
}
}
static function Dump($data,$exit = true){
echo "<pre>";
var_dump($data);
echo "</pre>";
if($exit)
{
exit();
}
}
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
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(false);
$frontController->throwExceptions(true);
//$frontController->setControllerDirectory('../application/controllers');
$frontController->setControllerDirectory(array(
'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 );