fix #463, 实现数据目录的重新导入,以及在新建数据路径时实现目录导入

This commit is contained in:
wlx 2013-05-08 02:02:34 +00:00
parent 1d6c27d93c
commit 82a862d8fc
2 changed files with 34 additions and 6 deletions

View File

@ -509,7 +509,7 @@ class Admin_DataController extends Zend_Controller_Action
/*
* datasetAction()
* 数据存档
* 数据路径:即数据的物理主目录
*
*/
function datasetAction()
@ -532,7 +532,7 @@ class Admin_DataController extends Zend_Controller_Action
$this->view->uuid = $uuid;
}
if($ac == "update")
else if($ac == "update")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
@ -544,6 +544,10 @@ class Admin_DataController extends Zend_Controller_Action
$sql = "UPDATE dataset SET host=?,path=? WHERE uuid=?";
$sth = $this->db->prepare($sql);
$ds = $sth ->execute(array($host,$path,$uuid));
if ($host=='ftp1.westgis.ac.cn')
{
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1");
}
if($ds)
{
@ -557,7 +561,7 @@ class Admin_DataController extends Zend_Controller_Action
}
}
if($ac == "add")
else if($ac == "add")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
@ -580,6 +584,10 @@ class Admin_DataController extends Zend_Controller_Action
$sql = "INSERT INTO dataset (uuid,host,path) VALUES (?,?,?)";
$sth = $this->db->prepare($sql);
$ds = $sth ->execute(array($uuid,$host,$path));
if ($host=='ftp1.westgis.ac.cn')
{
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$uuid."&filelist=1");
}
if($ds)
{
@ -592,6 +600,25 @@ class Admin_DataController extends Zend_Controller_Action
return true;
}
}
else if ($ac=="import")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->_request->getParam('uuid');
$sql = "SELECT * FROM dataset WHERE uuid=?";
$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");
echo '<h1>数据目录成功导入!</h1>';
} else {
echo '<h1>数据目录未导入!</h1>';
}
}
}//datasetAction存档管理

View File

@ -59,10 +59,11 @@
<?php endif; ?>
<a href="/admin/data/source/do/datasource/uuid/<?php echo $item['uuid'];?>">编辑数据来源</a> |
<?php if(!empty($item['datasetid'])):?>
<a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">存档</a> |
<a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">数据路径</a> |
<a href="/admin/data/dataset/ac/import/uuid/<?php echo $item['uuid'];?>" class="iframe">重新导入数据目录</a> |
<?php else: ?>
<a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">添加存档</a> |
<?php endif;?>
<a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">设置数据路径</a> |
<?php endif;?>
<a href="/admin/down/sendmail/uuid/<?php echo $item['uuid'];?>" title="向数据下载者发送通知邮件">邮件通知</a> |
<a href="/admin/data/fund/uuid/<?php echo $item['uuid'];?>">支持项目</a> |
<a href="/admin/data/doi/uuid/<?php echo $item['uuid'];?>">DOI</a>