修复sql中的错误,以及视图中的逻辑错误

This commit is contained in:
wlx 2013-06-09 04:26:41 +00:00
parent c93a382588
commit f30ac08f4f
2 changed files with 8 additions and 6 deletions

View File

@ -709,22 +709,24 @@ class AuthorController extends Zend_Controller_Action
*/ */
function applyAction() function applyAction()
{ {
$ac = $this->_request->getParam('ac'); $ac = $this->_request->getParam('ac');
include_once('helper/view.php');
$this->view->id=view::User('id');
if($ac == "mydata") if($ac == "mydata")
{ {
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
include_once('helper/view.php');
$email = view::User('email'); $email = view::User('email');
$realname=view::User('realname'); $realname=view::User('realname');
$sql = "SELECT distinct m.uuid,m.title,m.description,a.status,a.userid FROM normalmetadata m $sql = "SELECT distinct m.uuid,m.title,m.description,a.status,a.userid FROM normalmetadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid LEFT JOIN mdauthor a ON m.uuid=a.uuid
LEFT JOIN role r ON r.uuid=m.uuid LEFT JOIN role r ON r.uuid=m.uuid
LEFT JOIN responsible re ON r.resid = re.id LEFT JOIN responsible re ON r.resid = re.id
WHERE re.email LIKE '%$email%' or re.realname='$realname'"; WHERE r.role in ('originator','resourceProvider','pointOfContact','owner') and (re.email LIKE '%$email%' or re.individual='$realname')";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$this->jsonexit($rs->fetchAll()); $this->jsonexit($rs->fetchAll());

View File

@ -77,8 +77,8 @@ function datareceive(data){
var result = new Array(); var result = new Array();
for(i=0;i<data.length;i++) for(i=0;i<data.length;i++)
{ {
if(data[i].status==1) var ct='<img src="/images/list_links.gif" />您是此元数据的作者'; if(data[i].status==1 && data[i].userid==<?php echo $this->id; ?>) var ct='<img src="/images/list_links.gif" />您是此元数据的作者';
else if (data[i].status==0) var ct='<img src="/images/list_extensions.gif" />您已经申请成为该元数据作者,请前往 <a href="/author/accept">我的数据</a> 查看<span id="data_'+data[i].uuid+'"></span>'; else if (data[i].status==0 && data[i].userid==<?php echo $this->id; ?>) var ct='<img src="/images/list_extensions.gif" />您已经申请成为该元数据作者,请前往 <a href="/author/accept">我的数据</a> 查看<span id="data_'+data[i].uuid+'"></span>';
else var ct='<a href="javascript:;" onclick="apply(\'' +data[i].uuid+ '\')"><img src="/images/list_keys.gif" />申请成为此数据的作者</a><span id="data_'+data[i].uuid+'"></span>'; else var ct='<a href="javascript:;" onclick="apply(\'' +data[i].uuid+ '\')"><img src="/images/list_keys.gif" />申请成为此数据的作者</a><span id="data_'+data[i].uuid+'"></span>';
result.push('<li class="well"><h4><a href="/data/'+data[i].uuid+'" target="_blank" class="title">'+data[i].title+'</a></h4><p>'+data[i].description+'</p><p>'+ct+'</p></li>'); result.push('<li class="well"><h4><a href="/data/'+data[i].uuid+'" target="_blank" class="title">'+data[i].title+'</a></h4><p>'+data[i].description+'</p><p>'+ct+'</p></li>');
} }