添加元数据错误检查功能
This commit is contained in:
parent
64504bb861
commit
7e87fc1768
|
@ -1813,8 +1813,15 @@ class AuthorController extends Zend_Controller_Action
|
||||||
if (empty($mrow)) //说明是新数据
|
if (empty($mrow)) //说明是新数据
|
||||||
{
|
{
|
||||||
//导入元数据
|
//导入元数据
|
||||||
$iso=new ISO19115();
|
$iso=new ISO19115();
|
||||||
@$iso->saveDB($this->db,$row['xml']);
|
@$iso->loadXML($row['xml']);
|
||||||
|
if ($iso->validate())
|
||||||
|
{
|
||||||
|
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||||
|
$this->jsonexit($data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@$iso->saveDB($this->db);
|
||||||
//进入评审库
|
//进入评审库
|
||||||
$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 mdversion where id=?";
|
||||||
$this->db->query($sql,array($u_id,$id));
|
$this->db->query($sql,array($u_id,$id));
|
||||||
|
@ -1867,8 +1874,16 @@ class AuthorController extends Zend_Controller_Action
|
||||||
return true;
|
return true;
|
||||||
} else { //说明是已发布的数据且数据不存在评审信息
|
} else { //说明是已发布的数据且数据不存在评审信息
|
||||||
//同步元数据
|
//同步元数据
|
||||||
$iso=new ISO19115();
|
$iso=new ISO19115();
|
||||||
@$iso->saveDB($this->db,$row['xml']);
|
@$iso->loadXML($row['xml']);
|
||||||
|
if ($iso->validate())
|
||||||
|
{
|
||||||
|
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||||
|
$this->jsonexit($data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@$iso->saveDB($this->db);
|
||||||
|
|
||||||
//移除中间版本
|
//移除中间版本
|
||||||
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null";
|
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null";
|
||||||
$this->db->query($sql,array($id));
|
$this->db->query($sql,array($id));
|
||||||
|
@ -1906,8 +1921,16 @@ class AuthorController extends Zend_Controller_Action
|
||||||
else if ($row['status']==-1 || $row['status']==0 || $row['status']==1) //取消发布的数据,初始状态,已接收
|
else if ($row['status']==-1 || $row['status']==0 || $row['status']==1) //取消发布的数据,初始状态,已接收
|
||||||
{
|
{
|
||||||
//同步元数据
|
//同步元数据
|
||||||
$iso=new ISO19115();
|
$iso=new ISO19115();
|
||||||
@$iso->saveDB($this->db,$row['xml']);
|
@$iso->loadXML($row['xml']);
|
||||||
|
if ($iso->validate())
|
||||||
|
{
|
||||||
|
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||||
|
$this->jsonexit($data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@$iso->saveDB($this->db);
|
||||||
|
|
||||||
//email to admin
|
//email to admin
|
||||||
$mail=new WestdcMailer($this->view->config->smtp);
|
$mail=new WestdcMailer($this->view->config->smtp);
|
||||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||||
|
@ -2035,8 +2058,16 @@ class AuthorController extends Zend_Controller_Action
|
||||||
else if ($row['status']>=5)//数据已经发布,再次修改后将只通知管理员,保留发布状态
|
else if ($row['status']>=5)//数据已经发布,再次修改后将只通知管理员,保留发布状态
|
||||||
{
|
{
|
||||||
//同步元数据
|
//同步元数据
|
||||||
$iso=new ISO19115();
|
$iso=new ISO19115();
|
||||||
@$iso->saveDB($this->db,$row['xml']);
|
@$iso->loadXML($row['xml']);
|
||||||
|
if ($iso->validate())
|
||||||
|
{
|
||||||
|
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||||
|
$this->jsonexit($data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@$iso->saveDB($this->db);
|
||||||
|
|
||||||
//移除中间版本
|
//移除中间版本
|
||||||
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null";
|
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null";
|
||||||
$this->db->query($sql,array($id));
|
$this->db->query($sql,array($id));
|
||||||
|
@ -2218,7 +2249,7 @@ class AuthorController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
//提交数据
|
//提交数据
|
||||||
else if($ac=="commit")
|
else if($ac=="commit")
|
||||||
{
|
{
|
||||||
$this->_helper->layout->disableLayout();
|
$this->_helper->layout->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender();
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
|
|
||||||
|
@ -2265,7 +2296,17 @@ class AuthorController extends Zend_Controller_Action
|
||||||
$data = array("error"=>'无权限修改数据');
|
$data = array("error"=>'无权限修改数据');
|
||||||
$this->jsonexit($data);
|
$this->jsonexit($data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//首先检查元数据错误
|
||||||
|
$iso=new ISO19115();
|
||||||
|
@$iso->loadXML($row['data']);
|
||||||
|
if ($iso->validate())
|
||||||
|
{
|
||||||
|
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||||
|
$this->jsonexit($data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 保存数据作者信息
|
// 保存数据作者信息
|
||||||
$sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
|
$sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
|
||||||
$this->db->query($sql,array($row['uuid'],$u_id));
|
$this->db->query($sql,array($row['uuid'],$u_id));
|
||||||
|
@ -2276,8 +2317,7 @@ class AuthorController extends Zend_Controller_Action
|
||||||
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid='".$row['uuid']."'&filelist=1");
|
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid='".$row['uuid']."'&filelist=1");
|
||||||
// 3. 保存数据评审状态
|
// 3. 保存数据评审状态
|
||||||
//导入元数据
|
//导入元数据
|
||||||
$iso=new ISO19115();
|
@$iso->saveDB($this->db);
|
||||||
@$iso->saveDB($this->db,$row['data']);
|
|
||||||
//进入评审库
|
//进入评审库
|
||||||
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?";
|
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?";
|
||||||
$this->db->query($sql,array($u_id,$id));
|
$this->db->query($sql,array($u_id,$id));
|
||||||
|
|
Loading…
Reference in New Issue