issue 1175 add sort parameter to getFiles method.

bug fix in getUploadedFiles method.
apply cache to getUploadedFiles method.


git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10206 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-02-27 05:47:25 +00:00
parent 68abdaf824
commit 010a8f3a87
2 changed files with 16 additions and 10 deletions

View file

@ -14,6 +14,7 @@
var $columnList = array(); var $columnList = array();
var $allowscriptaccessList = array(); var $allowscriptaccessList = array();
var $allowscriptaccessKey = 0; var $allowscriptaccessKey = 0;
var $uploadedFiles = array();
function documentItem($document_srl = 0, $load_extra_vars = true, $columnList = array()) { function documentItem($document_srl = 0, $load_extra_vars = true, $columnList = array()) {
$this->document_srl = $document_srl; $this->document_srl = $document_srl;
@ -725,16 +726,21 @@
return $this->get('uploaded_count')? true : false; return $this->get('uploaded_count')? true : false;
} }
function getUploadedFiles() { function getUploadedFiles($sortIndex = 'file_srl')
if(!$this->document_srl) return; {
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted()) return; if($this->isSecret() && !$this->isGranted()) return;
if(!$this->get('uploaded_count')) return; if(!$this->get('uploaded_count')) return;
$oFileModel = &getModel('file'); if(!$this->uploadedFiles[$sortIndex])
$file_list = $oFileModel->getFiles($this->document_srl, $is_admin); {
return $file_list; $oFileModel = &getModel('file');
} $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex);
}
return $this->uploadedFiles[$sortIndex];
}
/** /**
* @brief Return Editor html * @brief Return Editor html

View file

@ -156,9 +156,9 @@
/** /**
* @brief Return all files which belong to a specific document * @brief Return all files which belong to a specific document
**/ **/
function getFiles($upload_target_srl, $columnList = array()) { function getFiles($upload_target_srl, $columnList = array(), $sortIndex = 'file_srl') {
$args->upload_target_srl = $upload_target_srl; $args->upload_target_srl = $upload_target_srl;
$args->sort_index = 'file_srl'; $args->sort_index = $sortIndex;
$output = executeQuery('file.getFiles', $args, $columnList); $output = executeQuery('file.getFiles', $args, $columnList);
if(!$output->data) return; if(!$output->data) return;