diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 21e1b5c3..9c959c4a 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -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); + } }