1. 处理 #319, 自动添加版本初始记录

2. 在版本显示中,可以显示版本发布人姓名信息
3. 成为作者后,自动成为geonetwork中元数据的所有者
This commit is contained in:
wlx 2012-03-27 03:53:13 +00:00
parent 608f19e2d6
commit 7e8c251960
2 changed files with 36 additions and 11 deletions

View File

@ -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));
}
}

View File

@ -38,15 +38,15 @@ $this->breadcrumb()->setSeparator(' > ');
<a href="/author/version/uuid/<?php echo $item['uuid']; ?>">查看此数据所有版本</a></p>
<p>版本创建时间: <?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?>
<?php if ($item['userid']) :
echo "发布人: ".$item['username'];
echo "发布人: ".(empty($item['realname'])?$item['username']:$item['realname'])." 【";
else :
?>
<a href="/author/version/ac/delete/id/<?php echo $item['id'];?>" class="more">删除</a>
<a href="/author/version/ac/delete/id/<?php echo $item['id'];?>" class="more">删除</a>
<?php endif; ?>
<a href="/author/version/ac/restore/id/<?php echo $item['id'];?>" class="more">恢复到geonetwork</a>
<a href="/author/version/ac/diff/id/<?php echo $item['id'];?>" class="more">与前一版对比</a>
<a href="/author/version/ac/commit/id/<?php echo $item['id'];?>" class="more">提交评审发布</a>
</p>
</p>
<?php if ($item['changelog']) : ?>
<p><?php echo $item['changelog']; ?></p>
<?php endif; ?>