From ce36f846487142c60b4bf37d259bb5fd18a59b3c Mon Sep 17 00:00:00 2001 From: wlx Date: Mon, 14 Sep 2015 16:01:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8CARD=E5=90=8E=E5=8F=B0=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=95=B0=E6=8D=AE=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E6=94=AF=E6=8C=81=EF=BC=9B=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=89=8D=E5=8F=B0=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DataController.php | 30 ++++++++++--------- .../admin/views/scripts/data/md-dataset.phtml | 6 ++++ .../default/controllers/ServiceController.php | 4 +-- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index fb2a4c0c..544e9c01 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -553,16 +553,17 @@ class Admin_DataController extends Zend_Controller_Action $uuid = $this->_request->getParam('uuid'); $host = $this->_getParam('host'); $path = $this->_getParam('path'); + $lang = $this->_getParam('lang'); - $sql = "UPDATE dataset SET host=?,path=? WHERE uuid=?"; + $sql = "UPDATE dataset SET host=?,path=?,lang=? WHERE uuid=?"; $sth = $this->db->prepare($sql); - $ds = $sth ->execute(array($host,$path,$uuid)); + $ds = $sth ->execute(array($host,$path,$lang,$uuid)); if ($host=='ftp1.westgis.ac.cn') { - file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1"); + file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1&lang=".$lang); } else if ($host=='ftp2.westgis.ac.cn') { - file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1"); + file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1&lang=".$lang); } if($ds) @@ -585,10 +586,11 @@ class Admin_DataController extends Zend_Controller_Action $uuid = $this->_request->getParam('uuid'); $host = $this->_getParam('host'); $path = $this->_getParam('path'); + $lang = $this->_getParam('lang'); - $sql = "SELECT * FROM dataset WHERE uuid=?"; + $sql = "SELECT * FROM dataset WHERE uuid=? and lang=?"; $sth = $this->db->prepare($sql); - $sth ->execute(array($uuid)); + $sth ->execute(array($uuid,$lang)); $row = $sth->fetch(); if(!empty($row['id'])) { @@ -597,15 +599,15 @@ class Admin_DataController extends Zend_Controller_Action return true; } - $sql = "INSERT INTO dataset (uuid,host,path) VALUES (?,?,?)"; + $sql = "INSERT INTO dataset (uuid,host,path,lang) VALUES (?,?,?,?)"; $sth = $this->db->prepare($sql); - $ds = $sth ->execute(array($uuid,$host,$path)); + $ds = $sth ->execute(array($uuid,$host,$path,$lang)); if ($host=='ftp1.westgis.ac.cn') { - file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1"); + file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1&lang=".$lang); } else if ($host=='ftp2.westgis.ac.cn') { - file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1"); + file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1&lang=".$lang); } if($ds) @@ -625,18 +627,18 @@ class Admin_DataController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(); $uuid = $this->_request->getParam('uuid'); - $sql = "SELECT * FROM dataset WHERE uuid=?"; + $sql = "SELECT * FROM dataset WHERE uuid=? and lang in ('','en')"; $sth = $this->db->prepare($sql); - $sth ->execute(array($uuid)); + $sth ->execute(array($uuid,$lang)); $row = $sth->fetch(); if ($row['host']=='ftp1.westgis.ac.cn') { - file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1"); + file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1&lang=".$row['lang']); echo '

数据目录成功导入!

'; } else if ($row['host']=='ftp2.westgis.ac.cn') { - file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1"); + file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1&lang=".$row['lang']); echo '

数据目录成功导入!

'; } else { echo '

数据目录未导入!

'; diff --git a/application/admin/views/scripts/data/md-dataset.phtml b/application/admin/views/scripts/data/md-dataset.phtml index 067affe0..bab943bf 100644 --- a/application/admin/views/scripts/data/md-dataset.phtml +++ b/application/admin/views/scripts/data/md-dataset.phtml @@ -24,10 +24,16 @@ {?>

主机:

路径:

+

语言:
dataset['lang']=='') echo 'checked="checked"'; ?> /> 不限制语言 + dataset['lang']=='cn') echo 'checked="checked"'; ?> /> 中文 + dataset['lang']=='en') echo 'checked="checked"'; ?> /> 英文

主机:

路径:

+

语言:
不限制语言 + 中文 + 英文

diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 0416fa17..c1ed3998 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -873,7 +873,7 @@ class ServiceController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(); $uuid=$this->_request->getParam('uuid'); - $sql="select f.filename,f.id,s.uuid,f.depth,f.filesize as filesize,f.ts_created from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename"; + $sql="select f.filename,f.id,s.uuid,f.depth,f.filesize as filesize,f.ts_created from datafile f,dataset s where s.id=f.dsid and s.lang in ('','en') and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename"; $files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid)); //文件大小处理 foreach($files as $k=>$v) @@ -904,7 +904,7 @@ class ServiceController extends Zend_Controller_Action $subpath=(int)$this->_request->getParam('subpath'); $depth=(int)$this->_request->getParam('depth'); $depth++; - $sql="select f.*,s.uuid from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename"; + $sql="select f.*,s.uuid from datafile f,dataset s where s.id=f.dsid and s.lang in ('','en') and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename"; $files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid)); foreach($files as $k=>$v)