#318 修改了提交评审的流程(增加了输入变更日志)

This commit is contained in:
Li Jianxuan 2012-03-28 08:29:07 +00:00
parent 9b6155333e
commit a7fdacbd48
2 changed files with 55 additions and 22 deletions

View File

@ -1065,7 +1065,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT md.title,md.uuid,count(c.id) as c FROM comments c $sql = "SELECT md.title,md.uuid,count(c.id) as c FROM comments c
LEFT JOIN metadata md ON md.uuid=c.uuid LEFT JOIN metadata md ON md.uuid=c.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid LEFT JOIN mdauthor a ON md.uuid=a.uuid
WHERE md.title IS NOT NULL AND a.userid=? WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1
GROUP BY md.title,md.uuid GROUP BY md.title,md.uuid
"; ";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -1091,7 +1091,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT c.author,c.email,c.url,c.ts_created,c.content,m.title FROM comments c $sql = "SELECT c.author,c.email,c.url,c.ts_created,c.content,m.title FROM comments c
LEFT JOIN mdauthor a ON a.uuid=c.uuid LEFT JOIN mdauthor a ON a.uuid=c.uuid
left join metadata m on m.uuid=c.uuid left join metadata m on m.uuid=c.uuid
WHERE c.uuid=? AND a.userid=? WHERE c.uuid=? AND a.userid=? AND a.status=1
ORDER BY ts_created DESC"; ORDER BY ts_created DESC";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -1115,7 +1115,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT md.title,c.author,c.email,c.url,c.ts_created,c.content FROM comments c $sql = "SELECT md.title,c.author,c.email,c.url,c.ts_created,c.content FROM comments c
LEFT JOIN mdauthor a ON a.uuid=c.uuid LEFT JOIN mdauthor a ON a.uuid=c.uuid
LEFT JOIN normalmetadata md ON md.uuid=c.uuid LEFT JOIN normalmetadata md ON md.uuid=c.uuid
WHERE a.userid=? WHERE a.userid=? AND a.status=1
ORDER BY ts_created DESC"; ORDER BY ts_created DESC";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -1232,7 +1232,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT md.title,md.uuid FROM metadata md $sql = "SELECT md.title,md.uuid FROM metadata md
LEFT JOIN mdauthor a ON a.uuid = md.uuid LEFT JOIN mdauthor a ON a.uuid = md.uuid
WHERE a.userid=? WHERE a.userid=? AND a.status=1
"; ";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($u_id)); $sth->execute(array($u_id));
@ -1457,7 +1457,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT u.realname,u.unit,u.email,m.title,m.description FROM normalmetadata m $sql = "SELECT u.realname,u.unit,u.email,m.title,m.description FROM normalmetadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid LEFT JOIN mdauthor a ON m.uuid=a.uuid
LEFT JOIN users u ON u.id=a.userid LEFT JOIN users u ON u.id=a.userid
WHERE status>=0 AND m.uuid=? WHERE status>=0 AND m.uuid=? AND a.status=1
ORDER BY status DESC,a.id DESC"; ORDER BY status DESC,a.id DESC";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -1495,7 +1495,7 @@ class AuthorController extends Zend_Controller_Action
LEFT JOIN metadata md ON md.uuid=v.uuid 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 left join users u on v.userid=u.id
WHERE md.title IS NOT NULL AND a.userid=? and v.uuid=? WHERE md.title IS NOT NULL AND a.userid=? and v.uuid=? AND a.status=1
order by v.ts_created desc order by v.ts_created desc
"; ";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -1518,7 +1518,7 @@ class AuthorController extends Zend_Controller_Action
LEFT JOIN metadata md ON md.uuid=v.uuid 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 left join users u on v.userid=u.id
WHERE md.title IS NOT NULL AND a.userid=? WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1
order by v.ts_created desc order by v.ts_created desc
"; ";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -1543,7 +1543,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT md.title,md.uuid,count(v.id) as c FROM mdversion v $sql = "SELECT md.title,md.uuid,count(v.id) as c FROM mdversion v
LEFT JOIN metadata md ON md.uuid=v.uuid 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
WHERE md.title IS NOT NULL AND a.userid=?"; WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords)) if(!empty($keywords))
{ {
$search=new Search($keywords); $search=new Search($keywords);
@ -1586,7 +1586,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "DELETE FROM mdversion v $sql = "DELETE FROM mdversion v
USING mdauthor a USING mdauthor a
WHERE v.id=? AND a.userid=?"; WHERE v.id=? AND a.userid=? AND a.status=1";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$ex = $sth -> execute(array($id,$u_id)); $ex = $sth -> execute(array($id,$u_id));
@ -1629,14 +1629,14 @@ class AuthorController extends Zend_Controller_Action
$db = Zend_Db::factory('Pdo_Pgsql', array( $db = Zend_Db::factory('Pdo_Pgsql', array(
'host' => 'localhost', 'host' => 'localhost',
'username' => 'postgres', 'username' => 'postgres',
'password' => '.yy3228899', 'password' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'dbname' => 'geonetwork', 'dbname' => 'geonetwork',
'persistent' => true 'persistent' => true
)); ));
$sql = "SELECT v.xml,v.uuid FROM mdversion v $sql = "SELECT v.xml,v.uuid FROM mdversion v
LEFT JOIN mdauthor a ON a.uuid=v.uuid LEFT JOIN mdauthor a ON a.uuid=v.uuid
WHERE v.id=? AND a.userid=?"; WHERE v.id=? AND a.userid=? AND a.status=1";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth ->execute(array($id,$u_id)); $sth ->execute(array($id,$u_id));
@ -1697,7 +1697,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT * FROM mdstatus s $sql = "SELECT * FROM mdstatus s
LEFT JOIN mdversion v ON v.uuid=s.uuid LEFT JOIN mdversion v ON v.uuid=s.uuid
LEFT JOIN mdauthor a ON a.uuid=v.uuid LEFT JOIN mdauthor a ON a.uuid=v.uuid
WHERE v.id=? AND a.userid=?"; WHERE v.id=? AND a.userid=? AND a.status=1";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($id,$u_id)); $sth->execute(array($id,$u_id));
@ -1710,9 +1710,22 @@ class AuthorController extends Zend_Controller_Action
return true; return true;
} }
$changelog = $this->_request->getParam('changelog');
if(empty($changelog))
{
$data = array("error"=>$this->alertbox('warning','请输入变更信息'));
$this->jsonexit($data);
return true;
}
$sql = "UPDATE mdversion SET changelog=? WHERE id=?";
$sth = $this->db->prepare($sql);
$ex_changelog = $sth->execute(array($changelog,$id));
if($ex_changelog){
$sql = "SELECT v.uuid FROM mdversion v $sql = "SELECT v.uuid FROM mdversion v
LEFT JOIN mdauthor a ON a.uuid=v.uuid LEFT JOIN mdauthor a ON a.uuid=v.uuid
WHERE v.id=? AND a.userid=?"; WHERE v.id=? AND a.userid=? AND a.status=1";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($id,$u_id)); $sth->execute(array($id,$u_id));
$row = $sth->fetch(); $row = $sth->fetch();
@ -1723,7 +1736,7 @@ class AuthorController extends Zend_Controller_Action
if($ex) if($ex)
{ {
$data = array("error"=>$this->alertbox('ok','提交成功!')); $data = array("commited"=>1,"error"=>$this->alertbox('ok','提交成功!'));
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
}else{ }else{
@ -1731,6 +1744,11 @@ class AuthorController extends Zend_Controller_Action
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
}else{
$data = array("error"=>$this->alertbox('error','提交失败,刷新后重试'));
$this->jsonexit($data);
return true;
}
}catch(Exception $e) { }catch(Exception $e) {
$msg = "提交失败,请确认权限后重试"; $msg = "提交失败,请确认权限后重试";
@ -1756,18 +1774,18 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT v.uuid,md.title FROM mdversion v $sql = "SELECT v.uuid,md.title FROM mdversion v
LEFT JOIN mdauthor a ON a.uuid=v.uuid LEFT JOIN mdauthor a ON a.uuid=v.uuid
LEFT JOIN metadata md ON v.uuid=md.uuid LEFT JOIN metadata md ON v.uuid=md.uuid
WHERE v.id=? AND a.userid=?"; WHERE v.id=? AND a.userid=? AND a.status=1";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth -> execute(array($id,$u_id)); $sth -> execute(array($id,$u_id));
$row = $sth->fetch(); $row = $sth->fetch();
$sql = "SELECT v.* FROM mdversion v $sql = "SELECT v.* FROM mdversion v
WHERE v.uuid=? WHERE v.uuid=? AND v.id<=?
ORDER BY v.ts_created DESC ORDER BY v.ts_created DESC
LIMIT ?"; LIMIT ?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth -> execute(array($row['uuid'],2)); $sth -> execute(array($row['uuid'],$id,2));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();

View File

@ -47,7 +47,7 @@ $this->breadcrumb()->setSeparator(' > ');
<?php endif; ?> <?php endif; ?>
<a onclick="return confirm('是否确定将这个版本恢复到geonetwork');" href="javascript:action('restore','<?php echo $item['id'];?>');" class="more">恢复到geonetwork</a> <a onclick="return confirm('是否确定将这个版本恢复到geonetwork');" href="javascript:action('restore','<?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/diff/id/<?php echo $item['id'];?>" class="more">与前一版对比</a>
<a onclick="return confirm('是否确定将该版本提交至评审发布?');" href="javascript:action('commit','<?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> </p>
<?php if ($item['changelog']) : ?> <?php if ($item['changelog']) : ?>
<p><?php echo $item['changelog']; ?></p> <p><?php echo $item['changelog']; ?></p>
@ -74,11 +74,12 @@ function action(ac,id){
{$.colorbox({'innerWidth':'50%','html':data.error});} {$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined') if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});} {$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined')
{$('#changelog').val('');$('#commit_submit').attr('onclick','');}
} }
else{ else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'}); $.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
} }
//$('#data_'+uuid).html('');
}, },
'timeout': 30000, 'timeout': 30000,
'error': function(){ 'error': function(){
@ -86,8 +87,22 @@ function action(ac,id){
} }
}); });
} }
$(".inline").colorbox({inline:true, width:"50%"});
function commit(id){
action('commit&changelog='+$('#changelog').val(),id);
}
</script> </script>
<div class="colorbox" style="display:none;"> <div class="colorbox" style="display:none;">
<div id="commitform">
<form>
<p>
<label>版本改动:</label><br />
<textarea class="full" style="resize:none;height:200px;" id="changelog"></textarea>
<br /><small>请输入此版本与之前版本的差别</small>
</p>
<input type="button" onclick="" id="commit_submit" class="btn btn-green big" value="提交"/>
</form>
</div>
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div> <div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div> <div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div> <div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>