From 8ccac05878059fb4c249e3832bd2437feccc5413 Mon Sep 17 00:00:00 2001 From: wlx Date: Tue, 26 Jun 2012 07:42:30 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=89=88=E6=9C=AC=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=B8=AD=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/AuthorController.php | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index d224383e..313e892f 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -250,8 +250,8 @@ class AuthorController extends Zend_Controller_Action if(preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) { $sql = "select md.title,d.id as doid,d.uuid,d.authorpermitted,d.status - ,offa.id as offa_id,offa.username as offa_name,offa.unit as offa_unit,offa.email as offa_email,offa.project as offa_project - ,ona.id as ona_id,ona.username as ona_name,ona.unit as ona_unit,ona.email as ona_email,ona.project as ona_project + ,offa.id as offa_id,offa.username as offa_name,offa.unit as offa_unit,offa.email as offa_email,offa.project as offa_project,date(offa.ts_created) as offa_tscreated + ,ona.id as ona_id,ona.username as ona_name,ona.unit as ona_unit,ona.email as ona_email,ona.project as ona_project,date(ona.ts_created) as ona_tscreated from dataorder d left join metadata md on md.uuid=d.uuid left join mdauthor a on a.uuid=d.uuid @@ -383,9 +383,10 @@ class AuthorController extends Zend_Controller_Action //列表 if(empty($ac) || $ac=='list' || $ac=='search'){ - $sql = "SELECT a.*,m.title,m.description,g.id as gid FROM normalmetadata m + $sql = "SELECT a.*,m.title,m.description,g.id as gid,mds.status as mdstatus FROM normalmetadata m LEFT JOIN mdauthor a ON m.uuid=a.uuid - left join geonetworkmetadata g on m.uuid=g.uuid + left join geonetworkmetadata g on m.uuid=g.uuid + left join mdstatus mds on m.uuid=mds.uuid WHERE a.userid=? AND status>=0"; if ($ac=='search') { @@ -395,7 +396,7 @@ class AuthorController extends Zend_Controller_Action $where=$search->sql_expr(array("m.title","m.description")); $sql.=' and '.$where; } - $sql.="ORDER BY status DESC,a.id DESC"; + $sql.="ORDER BY a.status DESC,a.id DESC"; $sth = $this->db->prepare($sql); $sth->execute(array($u_id)); @@ -1784,10 +1785,10 @@ class AuthorController extends Zend_Controller_Action $iso=new ISO19115(); $iso->saveDB($this->db,$row['xml']); //移除中间版本 - $sql="delete from mdversion where uuid in (select uuid from mdversion where v.id=?) and char_length(changelog)<3"; + $sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; $this->db->query($sql,array($id)); //修改评审状态为发布 - $sql="insert into mdstatus (uuid,status,userid) select uuid,5,? from mdversion where id=?"; + $sql="insert into mdstatus (uuid,status,userid) select uuid,6,? from mdversion where id=?"; $this->db->query($sql,array($u_id,$id)); //email to admin & author @@ -1817,7 +1818,7 @@ class AuthorController extends Zend_Controller_Action return true; } } - else if ($row['id']==-1 || $row['id']==0 || $row['id']==1) //取消发布的数据,初始状态,已接收 + else if ($row['status']==-1 || $row['status']==0 || $row['status']==1) //取消发布的数据,初始状态,已接收 { //同步元数据 $iso=new ISO19115(); @@ -1870,7 +1871,7 @@ class AuthorController extends Zend_Controller_Action $this->jsonexit($data); return true; } - else if ($row['id']==2 || $row['id']==3 || $row['id']==4)//已发送过外审邮件,需由编辑告知变化信息 + else if ($row['status']==2 || $row['status']==3 || $row['status']==4)//已发送过外审邮件,需由编辑告知变化信息 { //email to admin $mail=new WestdcMailer($this->view->config->smtp); @@ -1946,13 +1947,13 @@ class AuthorController extends Zend_Controller_Action $this->jsonexit($data); return true; } - else if ($row['id']==5)//数据已经发布,再次修改后将只通知管理员,保留发布状态 + else if ($row['status']>=5)//数据已经发布,再次修改后将只通知管理员,保留发布状态 { //同步元数据 $iso=new ISO19115(); $iso->saveDB($this->db,$row['xml']); //移除中间版本 - $sql="delete from mdversion where uuid in (select uuid from mdversion where v.id=?) and char_length(changelog)<3"; + $sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; $this->db->query($sql,array($id)); //email to admin & author @@ -2153,7 +2154,7 @@ class AuthorController extends Zend_Controller_Action return true; } - $sql="select uuid from metadata where id=? and owner=?"; + $sql="select uuid,data from metadata where id=? and owner=?"; $sth=$this->wdb->prepare($sql); $sth->execute(array($id,$u_id)); $row=$sth->fetch(); @@ -2165,7 +2166,7 @@ class AuthorController extends Zend_Controller_Action } // 保存数据作者信息 $sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)"; - $sth=$this->db->query($sql,array($row['uuid'],$u_id)); + $this->db->query($sql,array($row['uuid'],$u_id)); // 2. 保存变化记录 save changelog & userid for the latest version $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)"; @@ -2174,9 +2175,9 @@ class AuthorController extends Zend_Controller_Action // 3. 保存数据评审状态 //导入元数据 $iso=new ISO19115(); - $iso->saveDB($this->db,$row['xml']); + @$iso->saveDB($this->db,$row['xml']); //进入评审库 - $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?"; + $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?"; $this->db->query($sql,array($u_id,$id)); //email to admin