diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index d9a7b4e2..3e5afca5 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -1622,8 +1622,8 @@ class AuthorController extends Zend_Controller_Action if (!empty($uuid) && empty($ac)) { //view the versions of the data - $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM mdversion v - LEFT JOIN metadata md ON md.uuid=v.uuid + $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM en.mdversion v + LEFT JOIN en.metadata md ON md.uuid=v.uuid LEFT JOIN mdauthor a ON md.uuid=a.uuid left join users u on v.userid=u.id WHERE md.title IS NOT NULL AND a.userid=? and v.uuid=? AND a.status=1 @@ -1645,8 +1645,8 @@ class AuthorController extends Zend_Controller_Action //查看所有版本列表 else if((empty($ac) && empty($uuid))|| $ac=='list') { - $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM mdversion v - LEFT JOIN metadata md ON md.uuid=v.uuid + $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM en.mdversion v + LEFT JOIN en.metadata md ON md.uuid=v.uuid LEFT JOIN mdauthor a ON md.uuid=a.uuid left join users u on v.userid=u.id WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1 @@ -1671,8 +1671,8 @@ class AuthorController extends Zend_Controller_Action $keywords = $this->_request->getParam('q'); if(!empty($keywords)) $this->view->q = $keywords; - $sql = "SELECT md.title,md.uuid,count(v.id) as c FROM mdversion v - LEFT JOIN metadata md ON md.uuid=v.uuid + $sql = "SELECT md.title,md.uuid,count(v.id) as c FROM en.mdversion v + LEFT JOIN en.metadata md ON md.uuid=v.uuid LEFT JOIN mdauthor a ON md.uuid=a.uuid WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1"; if(!empty($keywords)) @@ -1715,7 +1715,7 @@ class AuthorController extends Zend_Controller_Action return true; } - $sql = "DELETE FROM mdversion v + $sql = "DELETE FROM en.mdversion v USING mdauthor a WHERE v.uuid=a.uuid and v.id=? AND a.userid=? AND a.status=1"; $sth = $this->db->prepare($sql); @@ -1758,7 +1758,7 @@ class AuthorController extends Zend_Controller_Action } $this->wdb=Zend_Db::factory($this->view->config->geonetwork); - $sql = "SELECT v.xml,v.uuid FROM mdversion v + $sql = "SELECT v.xml,v.uuid FROM en.mdversion v LEFT JOIN mdauthor a ON a.uuid=v.uuid WHERE v.id=? AND a.userid=? AND a.status=1"; $sth = $this->db->prepare($sql); @@ -1826,7 +1826,7 @@ class AuthorController extends Zend_Controller_Action } // 1. 权限认定 - $sql="select a.* from mdauthor a left join mdversion v on a.uuid=v.uuid + $sql="select a.* from mdauthor a left join en.mdversion v on a.uuid=v.uuid where a.status=1 and a.userid=? and v.id=?"; $sth=$this->db->prepare($sql); $sth->execute(array($u_id,$id)); @@ -1838,11 +1838,11 @@ class AuthorController extends Zend_Controller_Action return true; } // 2. 保存变化记录 save changelog & userid - $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id=?"; + $sql = "UPDATE en.mdversion SET changelog=?,userid=? WHERE id=?"; $this->db->query($sql,array($changelog,$u_id,$id)); // 3. 获取数据评审状态 - $sql = "SELECT s.*,v.xml,m.title FROM mdstatus s left join mdversion v on s.uuid=v.uuid + $sql = "SELECT s.*,v.xml,m.title FROM en.mdstatus s left join mdversion v on s.uuid=v.uuid left join metadata m on s.uuid=m.uuid WHERE v.id=?"; $sth = $this->db->prepare($sql); $sth->execute(array($id)); @@ -1852,7 +1852,7 @@ class AuthorController extends Zend_Controller_Action $search=new Search(); //create search view in xunsearch //$sql="select m.uuid,m.title,m.description,x.data,array_to_string(ARRAY( SELECT keyword.keyword FROM keyword WHERE keyword.id = m.id), ', '::text) AS keyword from normalmetadata m left join xml x on m.id=x.id where m.uuid=?"; - $sql="select * from xunsearch where uuid=?"; + $sql="select * from en.xunsearch where uuid=?"; $sth = $this->db->prepare($sql); $sth->execute(array($row['uuid'])); $data = $sth->fetch(); @@ -1860,7 +1860,7 @@ class AuthorController extends Zend_Controller_Action if (empty($row)) //无对应记录 { - $sql="select m.id from metadata m left join mdversion v on m.uuid=v.uuid where v.id=?"; + $sql="select m.id from en.metadata m left join en.mdversion v on m.uuid=v.uuid where v.id=?"; $sth=$this->db->prepare($sql); $sth->execute(array($id)); $mrow=$sth->fetch(); @@ -1877,13 +1877,13 @@ class AuthorController extends Zend_Controller_Action } @$iso->saveDB($this->db); //进入评审库 - $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?"; + $sql="insert into en.mdstatus (uuid,status,userid) select uuid,0,? from en.mdversion where id=?"; $this->db->query($sql,array($u_id,$id)); //email to admin $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); - $mailtp=new EmailText($this->db,"metadata-new-admin",array( + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); + $mailtp=new EmailText($this->db,"metadata-new-admin-en",array( 'user' => $user->username, 'uuid' => $iso->uuid, 'email'=> $user->email, @@ -1905,7 +1905,7 @@ class AuthorController extends Zend_Controller_Action //email to author $mail=new WestdcMailer($this->view->config->smtp); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); - $mailtp=new EmailText($this->db,"metadata-new-author",array( + $mailtp=new EmailText($this->db,"metadata-new-author-en",array( 'user' => $user->username, 'uuid' => $iso->uuid, 'email'=> $user->email, @@ -1939,15 +1939,15 @@ class AuthorController extends Zend_Controller_Action @$iso->saveDB($this->db); //移除中间版本 - $sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; + $sql="delete from en.mdversion where uuid in (select uuid from en.mdversion where id=?) and changelog is null"; $this->db->query($sql,array($id)); //修改评审状态为发布,且由其提交的用户进行管理 - $sql="insert into mdstatus (uuid,status,userid) select uuid,6,? from mdversion where id=?"; + $sql="insert into en.mdstatus (uuid,status,userid) select uuid,6,? from en.mdversion where id=?"; $this->db->query($sql,array($u_id,$id)); //email to admin & author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); $mailtp=new EmailText($this->db,"metadata-release",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -1987,7 +1987,7 @@ class AuthorController extends Zend_Controller_Action //email to admin $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); $mailtp=new EmailText($this->db,"version-commit-admin",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2010,7 +2010,7 @@ class AuthorController extends Zend_Controller_Action unset($mailtp); //email to author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); $mailtp=new EmailText($this->db,"version-commit-author",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2040,7 +2040,7 @@ class AuthorController extends Zend_Controller_Action @$iso->loadXML($row['xml']); //email to admin $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); $mailtp=new EmailText($this->db,"version-commit-admin",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2063,7 +2063,7 @@ class AuthorController extends Zend_Controller_Action unset($mailtp); //email to author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); $mailtp=new EmailText($this->db,"version-commit-author",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2091,7 +2091,7 @@ class AuthorController extends Zend_Controller_Action unset($mail); unset($mailtp); $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); $mailtp=new EmailText($this->db,"version-commit-expert",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2132,12 +2132,12 @@ class AuthorController extends Zend_Controller_Action @$iso->saveDB($this->db); //移除中间版本 - $sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; + $sql="delete from en.mdversion where uuid in (select uuid from en.mdversion where id=?) and changelog is null"; $this->db->query($sql,array($id)); //email to admin & author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); $mailtp=new EmailText($this->db,"metadata-release",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2183,16 +2183,16 @@ class AuthorController extends Zend_Controller_Action return true; } - $sql = "SELECT v.uuid,md.title FROM mdversion v + $sql = "SELECT v.uuid,md.title FROM en.mdversion v LEFT JOIN mdauthor a ON a.uuid=v.uuid - LEFT JOIN metadata md ON v.uuid=md.uuid + LEFT JOIN en.metadata md ON v.uuid=md.uuid WHERE v.id=? AND a.userid=? AND a.status=1"; $sth = $this->db->prepare($sql); $sth -> execute(array($id,$u_id)); $row = $sth->fetch(); - $sql = "SELECT v.* FROM mdversion v + $sql = "SELECT v.* FROM en.mdversion v WHERE v.uuid=? AND v.id<=? ORDER BY v.ts_created DESC LIMIT ?"; @@ -2722,10 +2722,126 @@ class AuthorController extends Zend_Controller_Action return true; } } - - //添加文献信息 - else if($ac == "add") - { + + //查看单条文献的所有数据 + if (!empty($id) && empty($ac)) + { + $sql = "SELECT md.title,md.uuid,r.id,r.reference,r.link,(a.userid-?) as isauthor FROM mdref mr + LEFT JOIN en.metadata md ON md.uuid=mr.uuid + LEFT JOIN mdauthor a ON md.uuid=a.uuid + left join reference r on mr.refid=r.id + WHERE md.title IS NOT NULL AND mr.refid=? AND a.status=1 + order by md.ts_created desc + "; + $sth = $this->db->prepare($sql); + $sth->execute(array($u_id,$id)); + $rows = $sth->fetchAll(); + @$this->view->mdtitle=$rows[0]['reference']; + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(15); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + $this->_helper->viewRenderer('literature-viewliter'); + } + + //查看所有文献列表 + else if((empty($ac) && empty($uuid)) && empty($id)) + { + $keywords = $this->_request->getParam('q'); + $sql = "SELECT md.title,md.uuid,r.reference,r.id,mr.id as mrid FROM mdref mr + LEFT JOIN en.metadata md ON md.uuid=mr.uuid + LEFT JOIN mdauthor a ON md.uuid=a.uuid + left join reference r on mr.refid=r.id + WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1"; + if(!empty($keywords)) + $this->view->q = $keywords; + if(!empty($keywords)) + { + $search=new SimpleSearch($keywords); + $where=$search->sql_expr(array("r.reference","md.title","md.description")); + $sql.=' and '.$where; + } + $sql.=" order by md.ts_created desc"; + $sth = $this->db->prepare($sql); + $sth->execute(array($u_id)); + $rows = $sth->fetchAll(); + + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(15); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + + //按文献浏览 + else if($ac=="byliter") + { + $keywords = $this->_request->getParam('q'); + if(!empty($keywords)) + $this->view->q = $keywords; + $sql = "SELECT count(md.uuid) as c,r.reference,r.id FROM reference r + left join mdref mr on r.id=mr.refid + LEFT JOIN en.metadata md ON md.uuid=mr.uuid + LEFT JOIN mdauthor a ON md.uuid=a.uuid + + WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1"; + if(!empty($keywords)) + { + $search=new SimpleSearch($keywords); + $where=$search->sql_expr(array("r.reference")); + $sql.=' and '.$where; + } + $sql.=" group by r.reference,r.id"; + + $sth = $this->db->prepare($sql); + $sth->execute(array($u_id)); + $rows = $sth->fetchAll(); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + + $this->_helper->viewRenderer('literature-byliter'); + } + + //单条文献的信息 + else if ($ac == "get") + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $id = $this->_getParam('id'); + $data = $author->Literature->getOne($id); + $this->jsonexit($data); + return true; + } + + //按数据浏览 + else if($ac=="bydata") + { + $keywords = $this->_request->getParam('q'); + if(!empty($keywords)) + { + $lit = $author->Literature->bydata($keywords); + $this->view->q = $keywords; + }else{ + $lit = $author->Literature->bydata(); + } + + view::addPaginator($lit,$this->view,$this->_request); + $this->_helper->viewRenderer('literature-bydata'); + } + + //添加文献信息 + else if($ac == "add") + { $submit = $this->_request->getParam('submit'); if(!empty($submit)) { diff --git a/application/default/views/scripts/author/accept.phtml b/application/default/views/scripts/author/accept.phtml index 5b4caed3..bc9fa8e7 100644 --- a/application/default/views/scripts/author/accept.phtml +++ b/application/default/views/scripts/author/accept.phtml @@ -4,9 +4,9 @@ $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('Home'); +$this->breadcrumb('Author'); +$this->breadcrumb('My datasets'); $this->breadcrumb()->setSeparator(' > '); ?>
@@ -14,12 +14,10 @@ $this->breadcrumb()->setSeparator(' > '); partial('author/navi.phtml'); ?>
- -

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

- - + +
@@ -32,26 +30,13 @@ $this->breadcrumb()->setSeparator(' > ');
  • - 【操作: - 申请管理 | - 反馈 | - 文档 | - 文献 | - 添加文献 | - 修改元数据 | - 版本 | - QA | - 新闻 | - 所有作者 - - | 委托 - - | 取消委托 - | - 邮件通知 | - 支持项目 | - DOI - 】 + [ + Edit metadata | + Literatures | + Add new literature | + + Versions + ] diff --git a/application/default/views/scripts/author/navi.phtml b/application/default/views/scripts/author/navi.phtml index 6a630ae1..05e99fad 100644 --- a/application/default/views/scripts/author/navi.phtml +++ b/application/default/views/scripts/author/navi.phtml @@ -3,20 +3,7 @@
  • - - - - - - + +
    \ No newline at end of file diff --git a/application/models/data/Author.php b/application/models/data/Author.php index ec8c818b..312cba98 100644 --- a/application/models/data/Author.php +++ b/application/models/data/Author.php @@ -5,7 +5,7 @@ class Author extends Zend_Controller_Plugin_Abstract private $auth = NULL; //Zend_Auth 对象 //使用到的公共变量 - public $tbl_metadata = "metadata"; //元数据 + public $tbl_metadata = "en.metadata"; //元数据 public $tbl_author = "mdauthor"; //数据作者表 public $tbl_user = "users"; @@ -86,7 +86,7 @@ class Literature extends Author include_once("helper/view.php"); $uid = view::User('id'); $sql = "SELECT md.title,md.uuid,r.id,r.reference,r.link,mr.place,mr.id as mrid FROM mdref mr - LEFT JOIN metadata md ON md.uuid=mr.uuid + LEFT JOIN en.metadata md ON md.uuid=mr.uuid LEFT JOIN mdauthor a ON md.uuid=a.uuid left join reference r on mr.refid=r.id WHERE md.title IS NOT NULL AND a.userid=? and mr.uuid=? AND a.status=1 @@ -149,7 +149,7 @@ class Literature extends Author return false; } - $sql = "SELECT md.title,md.uuid,count(mr.id) as c FROM metadata md + $sql = "SELECT md.title,md.uuid,count(mr.id) as c FROM en.metadata md LEFT JOIN mdref mr ON md.uuid=mr.uuid LEFT JOIN mdauthor a ON md.uuid=a.uuid left join reference r on mr.refid=r.id