From 89849648d72fc3cbb084b8dd7334c7c944f1fbaa Mon Sep 17 00:00:00 2001 From: wlx Date: Wed, 2 Mar 2011 13:16:05 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=95=B0=E6=8D=AE=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=BF=A1=E6=81=AF=E5=A4=84=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DataController.php | 51 +++++++++++++++++++ .../views/scripts/data/datafileimport.phtml | 32 ++++++++++++ .../admin/views/scripts/data/left.phtml | 1 + 3 files changed, 84 insertions(+) create mode 100644 application/admin/views/scripts/data/datafileimport.phtml 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元数据
  • 特色数据集管理
  • 数据中心通讯管理