实现多语言数据版本的后台支持、前台支持
This commit is contained in:
parent
c427f43f02
commit
dcf46ff865
|
@ -503,7 +503,7 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
LEFT JOIN mdstat s ON md.uuid=s.uuid
|
||||
LEFT JOIN geonetworkmetadata g ON g.uuid=md.uuid
|
||||
LEFT JOIN mdstatus st ON md.uuid=st.uuid
|
||||
LEFT JOIN dataset ds ON md.uuid=ds.uuid
|
||||
LEFT JOIN dataset ds ON md.uuid=ds.uuid and ds.lang in ('','cn')
|
||||
left join en.geonetworkmetadata gen on gen.uuid=md.uuid
|
||||
left join (select count(uuid) as stid,uuid from dataspatial group by uuid) as spatial on spatial.uuid=md.uuid
|
||||
ORDER BY md.id DESC";
|
||||
|
@ -537,7 +537,7 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$this->_helper->viewRenderer('md-dataset');
|
||||
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
$sql = "SELECT * FROM dataset WHERE uuid=?";
|
||||
$sql = "SELECT * FROM dataset WHERE uuid=? and lang in ('','cn')";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth ->execute(array($uuid));
|
||||
$row = $sth->fetch();
|
||||
|
@ -554,16 +554,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)
|
||||
|
@ -586,10 +587,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']))
|
||||
{
|
||||
|
@ -598,15 +600,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)
|
||||
|
@ -626,18 +628,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 ('','cn')";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth ->execute(array($uuid));
|
||||
$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 '<h1>数据目录成功导入!</h1>';
|
||||
} 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 '<h1>数据目录成功导入!</h1>';
|
||||
} else {
|
||||
echo '<h1>数据目录未导入!</h1>';
|
||||
|
|
|
@ -24,10 +24,16 @@
|
|||
{?>
|
||||
<p>主机:<br /><input type="text" id="host" name="host" value="<?= $this->dataset['host']?>" class="full" /></p>
|
||||
<p>路径:<br /><input type="text" id="path" name="path" value="<?= $this->dataset['path']?>" class="full" /></p>
|
||||
<p>语言:<br /><input type="radio" name="lang" value="" <?php if ($this->dataset['lang']=='') echo 'checked="checked"'; ?> /> 不限制语言
|
||||
<input type="radio" name="lang" value="cn" <?php if ($this->dataset['lang']=='cn') echo 'checked="checked"'; ?> /> 中文
|
||||
<input type="radio" name="lang" value="en" <?php if ($this->dataset['lang']=='en') echo 'checked="checked"'; ?> /> 英文 </p>
|
||||
<p><button type="button" class="btn btn-green" onclick="updateDataSet()">修改</button></p>
|
||||
<?php }else{ ?>
|
||||
<p>主机:<br /><input type="text" id="host" name="host" value="" class="full" /></p>
|
||||
<p>路径:<br /><input type="text" id="path" name="path" value="" class="full" /></p>
|
||||
<p>语言:<br /><input type="radio" name="lang" value="" /> 不限制语言
|
||||
<input type="radio" name="lang" value="cn" /> 中文
|
||||
<input type="radio" name="lang" value="en" /> 英文 </p>
|
||||
<p><button type="button" class="btn btn-green" onclick="addDataSet()">添加</button></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
|
|
@ -867,7 +867,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 ('','cn') 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)
|
||||
|
@ -898,7 +898,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 ('','cn') 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)
|
||||
|
|
Loading…
Reference in New Issue