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

View file

@ -156,9 +156,9 @@
/**
* @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->sort_index = 'file_srl';
$args->sort_index = $sortIndex;
$output = executeQuery('file.getFiles', $args, $columnList);
if(!$output->data) return;