diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index f6af2f42..6494f615 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -417,7 +417,7 @@ class AuthorController extends Zend_Controller_Action $this->view->v = $vdcode; try{ - $sql = "SELECT a.id,a.activation,a.ts_created,a.ts_activated,md.title,a.uuid,u.realname,u.email FROM mdauthor a + $sql = "SELECT a.id,a.activation,a.ts_created,a.ts_activated,md.title,a.uuid,u.id as userid,u.realname,u.email FROM mdauthor a LEFT JOIN metadata md ON a.uuid=md.uuid LEFT JOIN users u ON a.userid=u.id WHERE a.activation=?"; @@ -439,7 +439,8 @@ class AuthorController extends Zend_Controller_Action if($ex) { - include_once("EmailText.php"); + include_once("EmailText.php"); + $this->author_first($row['uuid'],$row['userid']); $mail=new WestdcMailer($this->view->config->smtp); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mailtp=new EmailText($this->db,"author-new",array( @@ -875,7 +876,8 @@ class AuthorController extends Zend_Controller_Action $ex = $sth->execute(array($uuid,$u_id,'','now()',1)); if($ex) { - $data = array("error"=>"您的身份符合申请条件,已经自动成为该元数据作者"); + $data = array("error"=>"您的身份符合申请条件,已经自动成为该元数据作者"); + $this->author_first($uuid,$u_id); include_once("EmailText.php"); $mail=new WestdcMailer($this->view->config->smtp); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); @@ -1488,9 +1490,10 @@ 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 FROM mdversion v + $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 - LEFT JOIN mdauthor a ON md.uuid=a.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=? order by v.ts_created desc "; @@ -1508,9 +1511,10 @@ 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 FROM mdversion v + $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 - LEFT JOIN mdauthor a ON md.uuid=a.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=? order by v.ts_created desc "; @@ -1556,6 +1560,27 @@ class AuthorController extends Zend_Controller_Action $this->_helper->viewRenderer('version-bydata'); } - }// versionAction() 数据版本管理 + }// versionAction() 数据版本管理 + + //成为作者后的后继处理工作 + private function author_first($uuid,$author) + { + $sql="insert into mdversion (xml,ts_created,uuid,changelog,userid) + select x.data,m.ts_created,?,?,? from metadata m left join xml x on m.id=x.id + left join mdversion v on m.uuid=v.uuid + where m.uuid=? and v.changelog is null"; + $sth=$this->db->prepare($sql); + try + { + $sth->execute(array($uuid,'初始版本 version 1.0',$author,$uuid)); + } catch(Exception $e){ + // do nothing here. + // 说明之前已经有对应数据 + } + $this->wdb=Zend_Db::factory($this->view->config->geonetwork); + $sql="update metadata set owner=? where uuid=?"; + $sth=$this->wdb->prepare($sql); + $sth->execute(array($author,$uuid)); + } } diff --git a/application/default/views/scripts/author/version.phtml b/application/default/views/scripts/author/version.phtml index 805dbd14..1a66af2a 100644 --- a/application/default/views/scripts/author/version.phtml +++ b/application/default/views/scripts/author/version.phtml @@ -38,15 +38,15 @@ $this->breadcrumb()->setSeparator(' > '); 【查看此数据所有版本

版本创建时间: - 删除 + 【删除 恢复到geonetwork 与前一版对比 提交评审发布 -

+ 】