From 7e8c2519608564b05806a91a66fe10487f71122a Mon Sep 17 00:00:00 2001
From: wlx
Date: Tue, 27 Mar 2012 03:53:13 +0000
Subject: [PATCH] =?UTF-8?q?1.=20=E5=A4=84=E7=90=86=20#319,=20=E8=87=AA?=
=?UTF-8?q?=E5=8A=A8=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC=E5=88=9D=E5=A7=8B?=
=?UTF-8?q?=E8=AE=B0=E5=BD=95=202.=20=E5=9C=A8=E7=89=88=E6=9C=AC=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E4=B8=AD=EF=BC=8C=E5=8F=AF=E4=BB=A5=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=91=E5=B8=83=E4=BA=BA=E5=A7=93=E5=90=8D?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=203.=20=E6=88=90=E4=B8=BA=E4=BD=9C=E8=80=85?=
=?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=87=AA=E5=8A=A8=E6=88=90=E4=B8=BAgeonetwor?=
=?UTF-8?q?k=E4=B8=AD=E5=85=83=E6=95=B0=E6=8D=AE=E7=9A=84=E6=89=80?=
=?UTF-8?q?=E6=9C=89=E8=80=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../default/controllers/AuthorController.php | 41 +++++++++++++++----
.../views/scripts/author/version.phtml | 6 +--
2 files changed, 36 insertions(+), 11 deletions(-)
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
与前一版对比
提交评审发布
-
+ 】