1、进行数据认证
-您在数据中心发布了一条数据,若需对数据进行修改,则需要进行数据认证。
+数据汇交的流程
+您需要先新建元数据,然后根据对应的元数据上传数据,上传数据后即可提交审核,具体流程可参见下图。
+diff --git a/application/default/controllers/SubmitController.php b/application/default/controllers/SubmitController.php
index b56e733f..c8a1359f 100644
--- a/application/default/controllers/SubmitController.php
+++ b/application/default/controllers/SubmitController.php
@@ -3,44 +3,24 @@ class SubmitController extends Zend_Controller_Action
{
private $limit=10;
- //调试模式
- // 调试模式中将显示全部错误细节,电子邮件将发往调试邮箱
- // 1 为开启
- // 0 为关闭
- public $debug = 1;
-
- //调试模式邮箱地址
- public $debug_email = "la5c@qq.com";
-
-
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->db=Zend_Registry::get('db');
- $this->messenger=$this->_helper->getHelper('FlashMessenger');
- $this->view->messages = $this->messenger->getMessages();
}
+
function indexAction()
{
}
-
-
- /*
- * helpAction() 帮助文档
- *
- */
- function helpAction(){
- }//helpAction()帮助文档
-
- //新建元数据
- function newdataAction()
- {
- $ac = $this->_request->getParam('ac');
- $id = $this->_request->getParam('id');
- $this->wdb=Zend_Db::factory($this->view->config->geonetwork);
+ //新建元数据
+ function newdataAction()
+ {
+ $ac = $this->_request->getParam('ac');
+ $id = $this->_request->getParam('id');
+ $this->wdb=Zend_Db::factory($this->view->config->geonetwork);
- $auth = Zend_Auth::getInstance();
+ $auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
@@ -108,148 +88,164 @@ class SubmitController extends Zend_Controller_Action
$this->view->templates=$sth->fetchAll();
$this->_helper->viewRenderer('newdata-add');
}
-
- //提交数据
- else if($ac=="commit")
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $data = "";
- try{
- $id = $this->_request->getParam('id');
- if(empty($id) || !is_numeric($id))
- {
- $data = array("error"=>"参数错误");
- $this->jsonexit($data);
- return true;
- }
-
- $changelog = $this->_request->getParam('changelog');
- if(empty($changelog))
- {
- $data = array("error"=>$this->alertbox('warning','请输入变更信息'));
- $this->jsonexit($data);
- return true;
- }
-
- // 1. 权限认定:当前用户必须和其owner相同
- // 数据应当没有评审状态,没有作者信息
- $sql="select gn.id from geonetworkmetadata gn
- left join mdstatus s on gn.uuid=s.uuid
- left join mdauthor a on s.uuid=a.uuid
- where s.id is not null and a.id is not null and gn.id=?";
- $sth=$this->db->prepare($sql);
- $sth->execute(array($id));
- $row=$sth->fetch();
- if (!emtpy($row))
- {
- $data = array("error"=>'错误的入口');
- $this->jsonexit($data);
- return true;
- }
-
- $sql="select uuid from metadata where id=? and owner=?";
- $sth=$this->wdb->prepare($sql);
- $sth->execute(array($id,$u_id));
- $row=$sth->fetch();
- if (empty($row))
- {
- $data = array("error"=>'无权限修改数据');
- $this->jsonexit($data);
- return true;
- }
- // 保存数据作者信息
- $sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
- $sth=$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)";
- $this->db->query($sql,array($changelog,$u_id,$row['uuid']));
-
- // 3. 保存数据评审状态
- //导入元数据
- $iso=new ISO19115();
- $iso->saveDB($this->db,$row['xml']);
- //进入评审库
- $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?";
- $this->db->query($sql,array($u_id,$id));
-
- //email to admin
- $mail=new WestdcMailer($this->view->config->smtp);
- $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
- $mailtp=new EmailText($this->db,"metadata-new-admin",array(
- 'user' => $user->username,
- 'uuid' => $iso->uuid,
- 'email'=> $user->email,
- //元数据标题
- 'title'=> $iso->resTitle,
- ));
- $mail->setBodyText($mailtp->getBody());
- $mail->setSubject($mailtp->getSubject());
- if($this->debug==0)
- {
- $mail->addTo($this->view->config->service->email);
- }else{
- $mail->addTo($this->debug_email);
- }
- $mail->send();
-
- unset($mail);
- unset($mailtp);
- //email to author
- $mail=new WestdcMailer($this->view->config->smtp);
- $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
- $mailtp=new EmailText($this->db,"metadata-new-author",array(
- 'user' => $user->username,
- 'uuid' => $iso->uuid,
- 'email'=> $user->email,
- //元数据标题
- 'title'=> $iso->resTitle,
- ));
- $mail->setBodyText($mailtp->getBody());
- $mail->setSubject($mailtp->getSubject());
- if($this->debug==0)
- {
- $mail->addTo($user->email);
- $mail->addCc($this->view->config->service->email);
- }else{
- $mail->addTo($this->debug_email);
- }
- @$mail->send();
-
- $data = array("commited"=>1,"error"=>$this->alertbox('ok','该版本已经成功提交,请等待数据中心进一步处理!'));
- $this->jsonexit($data);
- return true;
- }catch(Exception $e) {
- $msg = "提交失败,请确认权限后重试";
- if($this->debug>0)
- {$msg .= $e->getMessage();}
- $data = array("error"=>$this->alertbox('error',$msg));
- $this->jsonexit($data);
- return true;
- }
- }
}
-
- function uploadAction(){
-
+
+ //未提交数据列表
+ function unsubmitAction()
+ {
+ $ac = $this->_request->getParam('ac');
+ $id = $this->_request->getParam('id');
+ $this->wdb=Zend_Db::factory($this->view->config->geonetwork);
+
+ $auth = Zend_Auth::getInstance();
+ if($auth->hasIdentity())
+ {
+ $user = $auth->getIdentity();
+ $u_id = $user->id;
+ }
+
+ //提交数据
+ if($ac=="commit")
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $data = "";
+ try{
+ $id = $this->_request->getParam('id');
+ if(empty($id) || !is_numeric($id))
+ {
+ $data = array("error"=>"参数错误");
+ $this->jsonexit($data);
+ return true;
+ }
+
+ $changelog = $this->_request->getParam('changelog');
+ if(empty($changelog))
+ {
+ $data = array("error"=>$this->alertbox('warning','请输入变更信息'));
+ $this->jsonexit($data);
+ return true;
+ }
+
+ // 1. 权限认定:当前用户必须和其owner相同
+ // 数据应当没有评审状态,没有作者信息
+ $sql="select gn.id from geonetworkmetadata gn
+ left join mdstatus s on gn.uuid=s.uuid
+ left join mdauthor a on s.uuid=a.uuid
+ where s.id is not null and a.id is not null and gn.id=?";
+ $sth=$this->db->prepare($sql);
+ $sth->execute(array($id));
+ $row=$sth->fetch();
+ if (!emtpy($row))
+ {
+ $data = array("error"=>'错误的入口');
+ $this->jsonexit($data);
+ return true;
+ }
+
+ $sql="select uuid from metadata where id=? and owner=?";
+ $sth=$this->wdb->prepare($sql);
+ $sth->execute(array($id,$u_id));
+ $row=$sth->fetch();
+ if (empty($row))
+ {
+ $data = array("error"=>'无权限修改数据');
+ $this->jsonexit($data);
+ return true;
+ }
+ // 保存数据作者信息
+ $sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
+ $sth=$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)";
+ $this->db->query($sql,array($changelog,$u_id,$row['uuid']));
+
+ // 3. 保存数据评审状态
+ //导入元数据
+ $iso=new ISO19115();
+ $iso->saveDB($this->db,$row['xml']);
+ //进入评审库
+ $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?";
+ $this->db->query($sql,array($u_id,$id));
+
+ //email to admin
+ $mail=new WestdcMailer($this->view->config->smtp);
+ $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
+ $mailtp=new EmailText($this->db,"metadata-new-admin",array(
+ 'user' => $user->username,
+ 'uuid' => $iso->uuid,
+ 'email'=> $user->email,
+ //元数据标题
+ 'title'=> $iso->resTitle,
+ ));
+ $mail->setBodyText($mailtp->getBody());
+ $mail->setSubject($mailtp->getSubject());
+ $mail->addTo($this->view->config->service->email);
+ $mail->send();
+
+ unset($mail);
+ unset($mailtp);
+ //email to author
+ $mail=new WestdcMailer($this->view->config->smtp);
+ $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
+ $mailtp=new EmailText($this->db,"metadata-new-author",array(
+ 'user' => $user->username,
+ 'uuid' => $iso->uuid,
+ 'email'=> $user->email,
+ //元数据标题
+ 'title'=> $iso->resTitle,
+ ));
+ $mail->setBodyText($mailtp->getBody());
+ $mail->setSubject($mailtp->getSubject());
+ $mail->addTo($user->email);
+ $mail->addCc($this->view->config->service->email);
+ @$mail->send();
+
+ $data = array("commited"=>1,"error"=>$this->alertbox('ok','该版本已经成功提交,请等待数据中心进一步处理!'));
+ $this->jsonexit($data);
+ return true;
+ }catch(Exception $e) {
+ $msg = "提交失败,请确认权限后重试";
+ if($this->debug>0)
+ {$msg .= $e->getMessage();}
+ $data = array("error"=>$this->alertbox('error',$msg));
+ $this->jsonexit($data);
+ return true;
+ }
+ }
+ else
+ {
+ $sql = "SELECT (regexp_matches(gn.data,'
数据中心采用ISO 19115元数据国际标准,您在创建元数据的时候,以下元数据要素应该明确:
+ 1. 标题、副标题 + 标题应唯一,并且能简洁准确表达该数据。 + 2. 摘要 + 元数据中的摘要应为长摘要,能详细的介绍该数据。应尽量充实、完整的描述以下方面: + 3. 关键词 + 元数据中的关键词有五大类,包括时间关键词、地点关键词、主题关键词、学科关键词、地层关键词。且应多填写。 +创建了元数据后,就可以根据对应的元数据上传数据,而且,一条数据局可以上传多个对应的数据。(点击这里查看未提交元数据列表)
++ 【在geonetwork里查看 + | 在geonetwork里修改 + | 删除此条数据 + | 上传数据 + | 管理数据 + | 提交评审发布 + 】
+您当前没有未提交的数据。
"; + endif; ?> +