修改了文献添加部分的操作

This commit is contained in:
Li Jianxuan 2013-06-24 08:58:21 +00:00
parent 065d5988cf
commit 4e1b6e8241
2 changed files with 110 additions and 105 deletions

View File

@ -6,6 +6,7 @@
@license http:// @license http://
@link http:// @link http://
*/ */
include_once("data/Author.php");
class AuthorController extends Zend_Controller_Action class AuthorController extends Zend_Controller_Action
{ {
private $limit=10; private $limit=10;
@ -709,8 +710,8 @@ 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'); include_once('helper/view.php');
$this->view->id=view::User('id'); $this->view->id=view::User('id');
if($ac == "mydata") if($ac == "mydata")
@ -719,7 +720,7 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$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
@ -2763,41 +2764,40 @@ class AuthorController extends Zend_Controller_Action
//添加文献信息 //添加文献信息
else if($ac == "add") else if($ac == "add")
{ {
$submit = $this->_request->getParam('submit'); $submit = $this->_request->getParam('submit');
if(!empty($submit)) if(!empty($submit))
{ {
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$data = ""; $data = "";
try{ try{
$uuid = $this->_request->getParam('uuid'); $uuid = $this->_request->getParam('uuid');
$ref=$this->_request->getParam('ref'); $ref=$this->_request->getParam('ref');
$reftype=$this->_request->getParam('reftype'); $reftype=$this->_request->getParam('reftype');
$url = $this->_request->getParam('url'); $url = $this->_request->getParam('url');
if(empty($uuid) || empty($ref) || !is_numeric($reftype))
{ if(empty($uuid) || empty($ref) || !is_numeric($reftype))
{
$data = array("error"=>"参数错误"); $data = array("error"=>"参数错误");
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
$sql="select * from mdauthor where userid=? and uuid=? and status=1"; $author = new Author($this->db);
$sth = $this->db->prepare($sql); if(!$author->checkAuthor($uuid))
$sth->execute(array($u_id,$uuid)); {
$row = $sth->fetch();
if (empty($row))
{
$data = array("error"=>$this->alertbox('warning','您不是该数据作者,无法添加对应文献信息。')); $data = array("error"=>$this->alertbox('warning','您不是该数据作者,无法添加对应文献信息。'));
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
$sql="select id from reference where reference=?"; $sql="select id from reference where reference=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($ref)); $sth->execute(array($ref));
$row = $sth->fetch(); $row = $sth->fetch();
if (!$row)
if(empty($row['id']))
{ {
$sql="insert into reference (reference,link) values(?,?)"; $sql="insert into reference (reference,link) values(?,?)";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -2811,7 +2811,7 @@ class AuthorController extends Zend_Controller_Action
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$ex=$sth->execute(array($uuid,$row['id'],$reftype)); $ex=$sth->execute(array($uuid,$row['id'],$reftype));
if($ex) if($ex)
{ {
$data = array("commited"=>1,"error"=>$this->alertbox('ok','成功添加文献!')); $data = array("commited"=>1,"error"=>$this->alertbox('ok','成功添加文献!'));
$this->jsonexit($data); $this->jsonexit($data);
@ -2821,8 +2821,9 @@ class AuthorController extends Zend_Controller_Action
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
}catch(Exception $e) {
$msg = "提交失败,请确认权限后重试"; }catch(Exception $e) {
$msg = "提交失败,您提交的数据可能已经存在";
if($this->debug>0) if($this->debug>0)
{$msg .= $e->getMessage();} {$msg .= $e->getMessage();}
$data = array("error"=>$this->alertbox('error',$msg)); $data = array("error"=>$this->alertbox('error',$msg));

View File

@ -1,75 +1,79 @@
<?php <?php
$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/author.css'); $this->theme->AppendPlus($this,'colorbox');
$this->breadcrumb('<a href="/">首页</a>'); $this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/author">数据作者</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('我的数据'); $this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb('我的数据');
?> $this->breadcrumb()->setSeparator(' > ');
<div class="row"> ?>
<div class="span3"> <div class="row">
<?= $this->partial('author/navi.phtml'); ?> <div class="span3">
</div> <?= $this->partial('author/navi.phtml'); ?>
<div class="span9"> </div>
<div class="span9">
<p>请输入元数据标题关键字进行搜索</p>
<div class="input-append"> <p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/accept/ac/search"> <div class="input-append">
<input class="span2" type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>"> <form id="datasearch" class="search_form" action="/author/accept/ac/search">
<button class="btn" type="submit">搜索</button> <input class="span2" type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>">
</form> <button class="btn" type="submit">搜索</button>
</div> </form>
<div> </div>
<?php <div>
if (count($this->paginator)): <?php
echo '<ul class="unstyled">'; if (count($this->paginator)):
$autoindex=0; echo '<ul class="unstyled">';
foreach ($this->paginator as $item): $autoindex=0;
$autoindex++;?> foreach ($this->paginator as $item):
<li class="well"> $autoindex++;?>
<h4><a href="/data/<?php echo $item['uuid'];?>" target="_blank" class="title"><?php echo $item['title'];?></a></h4> <li class="well">
<?php if($item['status']==1) : ?> <h4><a href="/data/<?php echo $item['uuid'];?>" target="_blank" class="title"><?php echo $item['title'];?></a></h4>
<span class="dtctrlplan">【操作: <?php if($item['status']==1) : ?>
<a href="/author/inauthor/ac/datalist/uuid/<?php echo $item['uuid']; ?>">申请管理</a> | <span class="dtctrlplan">【操作:
<a href="/author/comment/ac/view/uuid/<?php echo $item['uuid']; ?>">反馈</a> | <a href="/author/inauthor/ac/datalist/uuid/<?php echo $item['uuid']; ?>">申请管理</a> |
<a href="/author/document/uuid/<?php echo $item['uuid']; ?>">文档</a> | <a href="/author/comment/ac/view/uuid/<?php echo $item['uuid']; ?>">反馈</a> |
<a href="/author/literature/uuid/<?php echo $item['uuid']; ?>">文献</a> | <a href="/author/document/uuid/<?php echo $item['uuid']; ?>">文档</a> |
<a href="/author/literature/ac/add/uuid/<?php echo $item['uuid']; ?>">添加文献</a> | <a href="/author/literature/uuid/<?php echo $item['uuid']; ?>">文献</a> |
<a href="/service/geonetwork?url=metadata.edit?id=<?php echo $item['gid']; ?>" target="_blank">修改元数据</a> | <a href="/author/literature/ac/add/uuid/<?php echo $item['uuid']; ?>" class="more iframe">添加文献</a> |
<a href="/author/version/uuid/<?php echo $item['uuid']; ?>">版本</a> | <a href="/service/geonetwork?url=metadata.edit?id=<?php echo $item['gid']; ?>" target="_blank">修改元数据</a> |
<a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> | <a href="/author/version/uuid/<?php echo $item['uuid']; ?>">版本</a> |
<a href="/author/news/uuid/<?php echo $item['uuid']; ?>">新闻</a> | <a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> |
<a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a> <a href="/author/news/uuid/<?php echo $item['uuid']; ?>">新闻</a> |
<?php if($item['mdstatus']==6) {?> <a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a>
| <a href="/author/delegate/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定将该数据委托至数据中心?');">委托</a> <?php if($item['mdstatus']==6) {?>
<?php } if($item['mdstatus']==7){ ?> | <a href="/author/delegate/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定将该数据委托至数据中心?');">委托</a>
| <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a> <?php } if($item['mdstatus']==7){ ?>
<?php }?> | | <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a>
<a href="/author/sendmail/uuid/<?php echo $item['uuid']; ?>">邮件通知</a> | <?php }?> |
<a href="/author/fund/uuid/<?php echo $item['uuid']; ?>">支持项目</a> | <a href="/author/sendmail/uuid/<?php echo $item['uuid']; ?>">邮件通知</a> |
<a href="/author/doi/ac/edit/uuid/<?php echo $item['uuid']; ?>">DOI</a> <a href="/author/fund/uuid/<?php echo $item['uuid']; ?>">支持项目</a> |
<a href="/author/doi/ac/edit/uuid/<?php echo $item['uuid']; ?>">DOI</a>
</span>
<?php endif; ?> </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>
<p> <p><?php echo mb_strlen($item['description'])>400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?></p>
<?php <p>
if ($item['status']==0) <?php
{ if ($item['status']==0)
echo '<img src="/images/list_extensions.gif" />您已经申请该数据(如果长时间没有收到回应请联系数据中心)'; {
} echo '<img src="/images/list_extensions.gif" />您已经申请该数据(如果长时间没有收到回应请联系数据中心)';
?> }
<span id="data_<?php echo $item['uuid'];?>"></span> ?>
</p> <span id="data_<?php echo $item['uuid'];?>"></span>
</li> </p>
<?php endforeach; </li>
echo "</ul>"; <?php endforeach;
endif; ?> echo "</ul>";
<div class="pagenavi"><?= $this->paginator; ?></div> endif; ?>
</div> <div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div> </div>
</div>
<script>
$(".iframe").colorbox({iframe:true, width:"60%", height:"80%"});
</script>