From 4e1b6e82413de2d1fadf5a65dd51a0d363cc97f8 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 24 Jun 2013 08:58:21 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=96=87=E7=8C=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/AuthorController.php | 61 +++---- .../default/views/scripts/author/accept.phtml | 154 +++++++++--------- 2 files changed, 110 insertions(+), 105 deletions(-) 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(' > '); -?> -
-
- partial('author/navi.phtml'); ?> -
-
- -

请输入元数据标题关键字进行搜索

-
-
- - -
-
-
- paginator)): - echo '
- -
-
\ No newline at end of file +headTitle($this->config->title->site); +$this->headTitle($this->config->title->author); +$this->headTitle()->setSeparator(' - '); +$this->theme->AppendPlus($this,'colorbox'); +$this->headLink()->appendStylesheet('/css/author.css'); +$this->breadcrumb('首页'); +$this->breadcrumb('数据作者'); +$this->breadcrumb('我的数据'); +$this->breadcrumb()->setSeparator(' > '); +?> +
+
+ partial('author/navi.phtml'); ?> +
+
+ +

请输入元数据标题关键字进行搜索

+
+
+ + +
+
+
+ paginator)): + echo '
+ +
+
+ \ No newline at end of file