add filelistAction and subfilelistAction

This commit is contained in:
wlx 2011-11-07 06:38:27 +00:00
parent 45cfd597aa
commit e59b33adab
1 changed files with 24 additions and 1 deletions

View File

@ -632,6 +632,29 @@ class ServiceController extends Zend_Controller_Action
echo Zend_Json::encode($msg);
exit();
}
}
}
function filelistAction()
{
$uuid=$this->_request->getParam('uuid');
$sql="select f.filename,f.id,s.uuid,f.depth 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";
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo Zend_Json::encode($files);
}
function subfilelistAction()
{
$uuid=$this->_request->getParam('uuid');
$subpath=(int)$this->_request->getParam('subpath');
$depth=(int)$this->_request->getParam('depth');
$depth++;
$sql="select f.filename,f.id,s.uuid,f.depth 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";
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo Zend_Json::encode($files);
}
}