From a7fdacbd48e9697f77aa02b2833066eac5875721 Mon Sep 17 00:00:00 2001
From: Li Jianxuan
Date: Wed, 28 Mar 2012 08:29:07 +0000
Subject: [PATCH] =?UTF-8?q?#318=20=E4=BF=AE=E6=94=B9=E4=BA=86=E6=8F=90?=
=?UTF-8?q?=E4=BA=A4=E8=AF=84=E5=AE=A1=E7=9A=84=E6=B5=81=E7=A8=8B(?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=BE=93=E5=85=A5=E5=8F=98=E6=9B=B4?=
=?UTF-8?q?=E6=97=A5=E5=BF=97)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../default/controllers/AuthorController.php | 56 ++++++++++++-------
.../views/scripts/author/version.phtml | 21 ++++++-
2 files changed, 55 insertions(+), 22 deletions(-)
diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php
index 8fedecc2..5b3b78c5 100644
--- a/application/default/controllers/AuthorController.php
+++ b/application/default/controllers/AuthorController.php
@@ -76,7 +76,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT o.id,o.userid,o.unit,o.username,o.ts_created,o.project,m.title,m.uuid FROM onlineapp as o
LEFT JOIN metadata as m ON o.uuid=m.uuid
LEFT JOIN mdauthor as a ON a.uuid=o.uuid
- WHERE (o.id in (SELECT distinct(onlineappid) from dataorder where status>=0)) AND a.userid = ? AND a.status=1 ";
+ WHERE (o.id in (SELECT distinct(onlineappid) from dataorder where status>=0)) AND a.userid = ? AND a.status=1";
if ($ac=="searchonline")
{
$keywords = $this->_request->getParam('q');
@@ -1065,7 +1065,7 @@ class AuthorController extends Zend_Controller_Action
$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 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
";
$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
LEFT JOIN mdauthor a ON a.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";
$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
LEFT JOIN mdauthor a ON a.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";
$sth = $this->db->prepare($sql);
@@ -1232,7 +1232,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT md.title,md.uuid FROM metadata md
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->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
LEFT JOIN mdauthor a ON m.uuid=a.uuid
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";
$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 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=?
+ WHERE md.title IS NOT NULL AND a.userid=? and v.uuid=? AND a.status=1
order by v.ts_created desc
";
$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 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=?
+ WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1
order by v.ts_created desc
";
$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
LEFT JOIN metadata md ON md.uuid=v.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))
{
$search=new Search($keywords);
@@ -1586,7 +1586,7 @@ class AuthorController extends Zend_Controller_Action
$sql = "DELETE FROM mdversion v
USING mdauthor a
- WHERE v.id=? AND a.userid=?";
+ WHERE v.id=? AND a.userid=? AND a.status=1";
$sth = $this->db->prepare($sql);
$ex = $sth -> execute(array($id,$u_id));
@@ -1629,14 +1629,14 @@ class AuthorController extends Zend_Controller_Action
$db = Zend_Db::factory('Pdo_Pgsql', array(
'host' => 'localhost',
'username' => 'postgres',
- 'password' => '.yy3228899',
+ 'password' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'dbname' => 'geonetwork',
'persistent' => true
));
$sql = "SELECT v.xml,v.uuid FROM mdversion v
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 ->execute(array($id,$u_id));
@@ -1693,11 +1693,11 @@ class AuthorController extends Zend_Controller_Action
$this->jsonexit($data);
return true;
}
-
+
$sql = "SELECT * FROM mdstatus s
LEFT JOIN mdversion v ON v.uuid=s.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->execute(array($id,$u_id));
@@ -1710,9 +1710,22 @@ class AuthorController extends Zend_Controller_Action
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
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->execute(array($id,$u_id));
$row = $sth->fetch();
@@ -1723,7 +1736,7 @@ class AuthorController extends Zend_Controller_Action
if($ex)
{
- $data = array("error"=>$this->alertbox('ok','提交成功!'));
+ $data = array("commited"=>1,"error"=>$this->alertbox('ok','提交成功!'));
$this->jsonexit($data);
return true;
}else{
@@ -1731,6 +1744,11 @@ class AuthorController extends Zend_Controller_Action
$this->jsonexit($data);
return true;
}
+ }else{
+ $data = array("error"=>$this->alertbox('error','提交失败,刷新后重试'));
+ $this->jsonexit($data);
+ return true;
+ }
}catch(Exception $e) {
$msg = "提交失败,请确认权限后重试";
@@ -1756,18 +1774,18 @@ class AuthorController extends Zend_Controller_Action
$sql = "SELECT v.uuid,md.title FROM mdversion v
LEFT JOIN mdauthor a ON a.uuid=v.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 -> execute(array($id,$u_id));
$row = $sth->fetch();
$sql = "SELECT v.* FROM mdversion v
- WHERE v.uuid=?
+ WHERE v.uuid=? AND v.id<=?
ORDER BY v.ts_created DESC
LIMIT ?";
$sth = $this->db->prepare($sql);
- $sth -> execute(array($row['uuid'],2));
+ $sth -> execute(array($row['uuid'],$id,2));
$rows = $sth->fetchAll();
diff --git a/application/default/views/scripts/author/version.phtml b/application/default/views/scripts/author/version.phtml
index ba7698f1..38fbcb5a 100644
--- a/application/default/views/scripts/author/version.phtml
+++ b/application/default/views/scripts/author/version.phtml
@@ -47,7 +47,7 @@ $this->breadcrumb()->setSeparator(' > ');
恢复到geonetwork
与前一版对比
- 提交评审发布
+ 提交评审发布
】
@@ -74,11 +74,12 @@ function action(ac,id){
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
+ if(typeof(data.commited)!='undefined')
+ {$('#changelog').val('');$('#commit_submit').attr('onclick','');}
}
else{
$.colorbox({'innerWidth':'50%','html':'出现错误,请稍候再试
'});
}
- //$('#data_'+uuid).html('');
},
'timeout': 30000,
'error': function(){
@@ -86,9 +87,23 @@ function action(ac,id){
}
});
}
+$(".inline").colorbox({inline:true, width:"50%"});
+function commit(id){
+ action('commit&changelog='+$('#changelog').val(),id);
+}
\ No newline at end of file
+