添加了委托功能
This commit is contained in:
parent
a88377116e
commit
7e8a7d0f82
|
@ -375,10 +375,11 @@ class AuthorController extends Zend_Controller_Action
|
|||
//列表
|
||||
if(empty($ac) || $ac=='list' || $ac=='search'){
|
||||
|
||||
$sql = "SELECT a.*,m.title,m.description,g.id as gid FROM normalmetadata m
|
||||
$sql = "SELECT a.*,m.title,m.description,g.id as gid,mds.status as mdstatus FROM normalmetadata m
|
||||
LEFT JOIN mdauthor a ON m.uuid=a.uuid
|
||||
left join geonetworkmetadata g on m.uuid=g.uuid
|
||||
WHERE a.userid=? AND status>=0";
|
||||
LEFT JOIN geonetworkmetadata g on m.uuid=g.uuid
|
||||
LEFT JOIN mdstatus mds ON m.uuid=mds.uuid
|
||||
WHERE a.userid=? AND a.status>=0";
|
||||
if ($ac=='search')
|
||||
{
|
||||
$key = trim($this->_request->getParam('q'));
|
||||
|
@ -387,7 +388,7 @@ class AuthorController extends Zend_Controller_Action
|
|||
$where=$search->sql_expr(array("m.title","m.description"));
|
||||
$sql.=' and '.$where;
|
||||
}
|
||||
$sql.="ORDER BY status DESC,a.id DESC";
|
||||
$sql.="ORDER BY a.status DESC,a.id DESC";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($u_id));
|
||||
|
@ -1468,6 +1469,11 @@ class AuthorController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* versionAction() 版本控制
|
||||
*
|
||||
*
|
||||
*/
|
||||
function versionAction()
|
||||
{
|
||||
$ac = $this->_request->getParam('ac');
|
||||
|
@ -2244,6 +2250,7 @@ class AuthorController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
//新建元数据
|
||||
|
||||
//文献管理
|
||||
function literatureAction()
|
||||
|
@ -2754,6 +2761,120 @@ class AuthorController extends Zend_Controller_Action
|
|||
|
||||
}//文档管理
|
||||
|
||||
/*
|
||||
* delegateAction() 委托
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function delegateAction(){
|
||||
|
||||
$ac = $this->_request->getParam('ac');
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
|
||||
if($ac == '' && !empty($uuid))
|
||||
{
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$uid = $user->id;
|
||||
}
|
||||
|
||||
if(!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->info = "参数错误";
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM metadata WHERE uuid=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth ->execute(array($uuid));
|
||||
$row = $sth->fetch();
|
||||
|
||||
$this->view->metadata = $row;
|
||||
|
||||
//确认一下用户有权限,如果直接使用update语句无法得到已更改过的状态
|
||||
|
||||
$sql = "SELECT * FROM mdstatus
|
||||
WHERE uuid=? AND userid=? AND (status=? OR status=?)";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($uuid,$uid,5,6));
|
||||
$mds = $sth->fetch();
|
||||
|
||||
if(!empty($mds['id']))
|
||||
{
|
||||
$sql = "UPDATE mdstatus SET status=7,ts_changed='now()' WHERE uuid='$uuid' AND userid=$uid";
|
||||
if($this->db->exec($sql))
|
||||
{
|
||||
$this->view->info = "委托成功!";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view->info = "委托失败!";
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
$this->view->info = "该数据无法委托,请确定数据状态已经可以进行委托,或数据尚未进行委托";
|
||||
}
|
||||
}
|
||||
|
||||
if($ac == 'cancel')
|
||||
{
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$uid = $user->id;
|
||||
}
|
||||
|
||||
if(!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->info = "参数错误";
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM metadata WHERE uuid=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth ->execute(array($uuid));
|
||||
$row = $sth->fetch();
|
||||
|
||||
$this->view->metadata = $row;
|
||||
|
||||
$sql = "SELECT * FROM mdstatus
|
||||
WHERE uuid=? AND userid=? AND status=?";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($uuid,$uid,7));
|
||||
$mds = $sth->fetch();
|
||||
|
||||
if(!empty($mds['id']))
|
||||
{
|
||||
$sql = "UPDATE mdstatus SET status=6,ts_changed='now()' WHERE uuid='$uuid' AND userid=$uid";
|
||||
if($this->db->exec($sql))
|
||||
{
|
||||
$this->view->info = "取消委托成功!";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view->info = "取消委托失败!";
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
$this->view->info = "操作失败!该数据尚未进行委托";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}//委托
|
||||
|
||||
|
||||
public function getFileinfo($id){
|
||||
$sql = "select * from attachments where id='$id'";
|
||||
$re= $this->db->query($sql);
|
||||
|
|
|
@ -43,7 +43,13 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<a href="/author/version/uuid/<?php echo $item['uuid']; ?>">版本</a> |
|
||||
<a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> |
|
||||
<a href="/author/news/uuid/<?php echo $item['uuid']; ?>">新闻</a> |
|
||||
<a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a> 】</span>
|
||||
<a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a>
|
||||
<?php if($item['mdstatus']==5 || $item['mdstatus']==6) {?>
|
||||
| <a href="/author/delegate/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定将该数据委托至数据中心?');">委托</a>
|
||||
<?php } if($item['mdstatus']==7){ ?>
|
||||
| <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a>
|
||||
<?php }?>
|
||||
】</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><?php echo mb_strlen($item['description'])>400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?></p>
|
||||
|
@ -66,30 +72,4 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<!-- //页面内容 -->
|
||||
<script>
|
||||
$('#wapper').width($('body').width()-300);
|
||||
function apply(uuid){
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/author/apply',
|
||||
'data':'ac=apply&m=send&uuid='+uuid,
|
||||
'success':function(data){
|
||||
if (isObject(data))
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{alert(data.error);}
|
||||
else{alert('请重试');}
|
||||
}
|
||||
else{ alert('出现错误,请稍候');}
|
||||
$('#data_'+uuid).html('');
|
||||
},
|
||||
'beforeSend':function(){
|
||||
$('#data_'+uuid).html('<img src="/images/ajax-load-small.gif" />正在处理...');
|
||||
},
|
||||
'timeout': 30000,
|
||||
'error': function(){
|
||||
alert('处理中出现问题,请重试');
|
||||
$('#data_'+uuid).html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
function isObject(obj){if(typeof(obj)=='object'){return true;}else if(typeof(obj)!='object'){return false;}else{return false;}}
|
||||
</script>
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->author);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->headLink()->appendStylesheet('/css/author.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/author">数据作者</a>');
|
||||
$this->breadcrumb('<a href="/author/accept">我的数据</a>');
|
||||
$this->breadcrumb('数据委托');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
||||
<!-- 左侧导航 -->
|
||||
<div id='sidebar'>
|
||||
<div id='leftnavi'>
|
||||
<?= $this->partial('author/navi.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //左侧导航 -->
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<div id="wapper">
|
||||
<?php
|
||||
if(!empty($this->metadata['uuid']))
|
||||
{
|
||||
echo "元数据《<a href=\"/data/".$this->metadata['uuid']."\">".$this->metadata['title']."</a>》";
|
||||
}
|
||||
|
||||
?>
|
||||
<br />
|
||||
<?php echo $this->info; ?>
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
$('#wapper').width($('body').width()-300);
|
||||
</script>
|
Loading…
Reference in New Issue