调整版本对比sql,加入大版本比较功能

This commit is contained in:
wlx 2013-05-16 01:38:54 +00:00
parent 2a877badb9
commit 00168e0317
2 changed files with 16 additions and 6 deletions

View File

@ -2495,7 +2495,7 @@ class Admin_DataController extends Zend_Controller_Action
}//发布到评审
//与前一个版本对比
else if($ac == "diff")
else if($ac == "diff" || $ac=="diff1")
{
$this->_helper->viewRenderer('version-diff');
$id = $this->_request->getParam('id');
@ -2512,13 +2512,22 @@ class Admin_DataController extends Zend_Controller_Action
$sth -> execute(array($id));
$row = $sth->fetch();
$sql = "SELECT v.* FROM mdversion v
WHERE v.uuid=? AND v.id<=?
if ($ac=='diff')
{
$sql = "SELECT v.* FROM mdversion v
WHERE v.uuid=? and v.ts_created<=(select ts_created from mdversion where id=?)
ORDER BY v.ts_created DESC
LIMIT ?";
$sth = $this->db->prepare($sql);
$sth -> execute(array($row['uuid'],$id,2));
$sth = $this->db->prepare($sql);
$sth -> execute(array($row['uuid'],$id,2));
} else {
$sql = "SELECT v.* FROM mdversion v
WHERE v.uuid=? and (v.id=? or v.ts_created<(select ts_created from mdversion where changelog is not null and id=?))
ORDER BY v.ts_created DESC
LIMIT ?";
$sth = $this->db->prepare($sql);
$sth -> execute(array($row['uuid'],$id,$id,2));
}
$rows = $sth->fetchAll();

View File

@ -54,6 +54,7 @@ $this->breadcrumb()->setSeparator(' > ');
<a onclick="return confirm('是否确定删除该版本?');" href="javascript:action('delete','<?php echo $item['id'];?>');" class="more">删除</a>
<a onclick="return confirm('是否确定将这个版本恢复到geonetwork');" href="javascript:action('restore','<?php echo $item['id'];?>');" class="more">恢复到geonetwork</a>
<a href="/admin/data/version/ac/diff/id/<?php echo $item['id'];?>" class="more">与前一版对比</a>
<a href="/admin/data/version/ac/diff1/id/<?php echo $item['id'];?>" class="more">与前一发布或提交版对比</a>
<a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['id'];?>\');');" href="#commitform" class="more inline">提交评审发布</a>
</p>
<?php if ($item['changelog']) : ?>