diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index dc4a6ad2..ca8f599f 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -645,6 +645,57 @@ class Admin_DataController extends Zend_Controller_Action $this->_redirect('/data'); } } + function datafileimportAction() + { + if ($this->_request->isPost()) { + $dir = $this->_request->getPost('directory'); + if (file_exists($dir.'/dataset.txt')) + { + $fp=fopen($dir.'/dataset.txt','rb'); + $ds=fread($fp,filesize($dir.'/dataset.txt')); + fclose($fp); + $ds1=explode("\n",$ds); + for($i=0;$idb->query($sql); + $sql="insert into dataset (path,uuid) values('".$dpath."','".$duuid."')"; + $this->db->query($sql); + $sql="select id from dataset where uuid='".$duuid."'"; + $rs=$this->db->fetchRow($sql); + $dsid=$rs["id"]; + $fp=fopen($dir.'/'.$duuid.'.txt','rb'); + $filep=fread($fp,filesize($dir.'/'.$duuid.'.txt')); + fclose($fp); + $filep1=explode("\n",$filep); + //print $duuid."
"; + //print $dpath." ".count($dpatch)."
"; + for($j=0;$j"; + $sql="insert into datafile (dsid,filename,filesize,isdir,depth) values(".$dsid.",'".$fpath."',".$fsize.",".$fdir.",".$fdepth.")"; + $this->db->query($sql); + } + } + } + } + } + $this->view->msg='已成功处理数据目录信息!'; + } + } /* * 保存XML数据到数据库 */ diff --git a/application/admin/views/scripts/data/datafileimport.phtml b/application/admin/views/scripts/data/datafileimport.phtml new file mode 100644 index 00000000..3460c3fb --- /dev/null +++ b/application/admin/views/scripts/data/datafileimport.phtml @@ -0,0 +1,32 @@ +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台首页'); + $this->breadcrumb('数据管理'); + $this->breadcrumb('导入数据目录文件'); + $this->breadcrumb()->setSeparator(' > '); +?> +
+partial('data/left.phtml'); ?> +
+
+msg or $this->messages) :?> +
+msg) : ?> +

msg; ?>

+messages): foreach($this->messages as $msg): ?> +

+ +
+ + +
+

数据目录文件通过在数据服务器所在目录进行信息提取后生成的一系列文本文件,上传到本服务器上再进行处理。具体包括dataset和以UUID为名称的文本文件。

+

数据目录文件:

+ +
+ +
diff --git a/application/admin/views/scripts/data/left.phtml b/application/admin/views/scripts/data/left.phtml index a079bfca..d46b2d03 100644 --- a/application/admin/views/scripts/data/left.phtml +++ b/application/admin/views/scripts/data/left.phtml @@ -4,6 +4,7 @@
  • 数据文献关联管理
  • 上传元数据文件
  • 导入服务器元数据目录
  • +
  • 导入数据目录
  • 同步GeoNetwork元数据
  • 特色数据集管理
  • 数据中心通讯管理