diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index ec1cf681..b39f76c2 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -6,6 +6,7 @@ @license http:// @link http:// */ +include_once("data/Author.php"); class AuthorController extends Zend_Controller_Action { private $limit=10; @@ -709,8 +710,8 @@ class AuthorController extends Zend_Controller_Action */ function applyAction() { - $ac = $this->_request->getParam('ac'); - include_once('helper/view.php'); + $ac = $this->_request->getParam('ac'); + include_once('helper/view.php'); $this->view->id=view::User('id'); if($ac == "mydata") @@ -719,7 +720,7 @@ class AuthorController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(); $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 @@ -2763,41 +2764,40 @@ class AuthorController extends Zend_Controller_Action //添加文献信息 else if($ac == "add") { - $submit = $this->_request->getParam('submit'); - if(!empty($submit)) - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $data = ""; - try{ - $uuid = $this->_request->getParam('uuid'); - $ref=$this->_request->getParam('ref'); - $reftype=$this->_request->getParam('reftype'); - $url = $this->_request->getParam('url'); - if(empty($uuid) || empty($ref) || !is_numeric($reftype)) - { + $submit = $this->_request->getParam('submit'); + if(!empty($submit)) + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $data = ""; + try{ + $uuid = $this->_request->getParam('uuid'); + $ref=$this->_request->getParam('ref'); + $reftype=$this->_request->getParam('reftype'); + $url = $this->_request->getParam('url'); + + if(empty($uuid) || empty($ref) || !is_numeric($reftype)) + { $data = array("error"=>"参数错误"); $this->jsonexit($data); return true; - } + } - $sql="select * from mdauthor where userid=? and uuid=? and status=1"; - $sth = $this->db->prepare($sql); - $sth->execute(array($u_id,$uuid)); - $row = $sth->fetch(); - if (empty($row)) - { + $author = new Author($this->db); + if(!$author->checkAuthor($uuid)) + { $data = array("error"=>$this->alertbox('warning','您不是该数据作者,无法添加对应文献信息。')); $this->jsonexit($data); return true; - } + } $sql="select id from reference where reference=?"; $sth = $this->db->prepare($sql); $sth->execute(array($ref)); - $row = $sth->fetch(); - if (!$row) + $row = $sth->fetch(); + + if(empty($row['id'])) { $sql="insert into reference (reference,link) values(?,?)"; $sth = $this->db->prepare($sql); @@ -2811,7 +2811,7 @@ class AuthorController extends Zend_Controller_Action $sth = $this->db->prepare($sql); $ex=$sth->execute(array($uuid,$row['id'],$reftype)); - if($ex) + if($ex) { $data = array("commited"=>1,"error"=>$this->alertbox('ok','成功添加文献!')); $this->jsonexit($data); @@ -2821,8 +2821,9 @@ class AuthorController extends Zend_Controller_Action $this->jsonexit($data); return true; } - }catch(Exception $e) { - $msg = "提交失败,请确认权限后重试"; + + }catch(Exception $e) { + $msg = "提交失败,您提交的数据可能已经存在"; if($this->debug>0) {$msg .= $e->getMessage();} $data = array("error"=>$this->alertbox('error',$msg)); diff --git a/application/default/views/scripts/author/accept.phtml b/application/default/views/scripts/author/accept.phtml index bfca1b85..5b4caed3 100644 --- a/application/default/views/scripts/author/accept.phtml +++ b/application/default/views/scripts/author/accept.phtml @@ -1,75 +1,79 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->author); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/author.css'); -$this->breadcrumb('首页'); -$this->breadcrumb('数据作者'); -$this->breadcrumb('我的数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
请输入元数据标题关键字进行搜索
-400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?>
-- 您已经申请该数据(如果长时间没有收到回应请联系数据中心)'; - } - ?> - -
-请输入元数据标题关键字进行搜索
+400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?>
++ 您已经申请该数据(如果长时间没有收到回应请联系数据中心)'; + } + ?> + +
+