From e59b33adabb4f026c743d908543f725baf3b8627 Mon Sep 17 00:00:00 2001 From: wlx Date: Mon, 7 Nov 2011 06:38:27 +0000 Subject: [PATCH] add filelistAction and subfilelistAction --- .../default/controllers/ServiceController.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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); + } }