mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Allow filtering file list by upload target type
This commit is contained in:
parent
c0ddc46f46
commit
ef0ef45303
4 changed files with 23 additions and 6 deletions
|
|
@ -262,7 +262,7 @@ class EditorModel extends Editor
|
|||
$file_config->allowed_chunk_size = 0;
|
||||
}
|
||||
|
||||
Context::set('file_config',$file_config);
|
||||
Context::set('file_config', $file_config);
|
||||
|
||||
// Configure upload status such as file size
|
||||
$upload_status = FileModel::getUploadStatus();
|
||||
|
|
@ -293,7 +293,7 @@ class EditorModel extends Editor
|
|||
// Check if the file already exists
|
||||
if ($upload_target_srl)
|
||||
{
|
||||
$files_count = FileModel::getFilesCount($upload_target_srl);
|
||||
$files_count = FileModel::getFilesCount($upload_target_srl, $option->upload_target_type ?? null);
|
||||
}
|
||||
}
|
||||
Context::set('files_count', (int)$files_count);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ class FileModel extends File
|
|||
}
|
||||
|
||||
// Set file list
|
||||
foreach(self::getFiles($upload_target_srl) as $file_info)
|
||||
$filter_type = $_SESSION['upload_info'][$editor_sequence]->upload_target_type ?? null;
|
||||
$files = self::getFiles($upload_target_srl, [], 'file_srl', false, $filter_type);
|
||||
foreach ($files as $file_info)
|
||||
{
|
||||
$obj = new stdClass;
|
||||
$obj->file_srl = $file_info->file_srl;
|
||||
|
|
@ -288,12 +290,17 @@ class FileModel extends File
|
|||
* Return number of attachments which belongs to a specific document
|
||||
*
|
||||
* @param int $upload_target_srl The sequence to get a number of files
|
||||
* @param ?string $upload_target_type
|
||||
* @return int Returns a number of files
|
||||
*/
|
||||
public static function getFilesCount($upload_target_srl)
|
||||
public static function getFilesCount($upload_target_srl, $upload_target_type = null)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
if ($upload_target_type)
|
||||
{
|
||||
$args->upload_target_type = $upload_target_type;
|
||||
}
|
||||
$output = executeQuery('file.getFilesCount', $args);
|
||||
return (int)$output->data->count;
|
||||
}
|
||||
|
|
@ -430,12 +437,20 @@ class FileModel extends File
|
|||
* @param string $sortIndex The column that used as sort index
|
||||
* @return array Returns array of object that contains file information. If no result returns null.
|
||||
*/
|
||||
public static function getFiles($upload_target_srl, $columnList = array(), $sortIndex = 'file_srl', $ckValid = false)
|
||||
public static function getFiles($upload_target_srl, $columnList = array(), $sortIndex = 'file_srl', $valid_files_only = false, $upload_target_type = null)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$args->sort_index = $sortIndex;
|
||||
if($ckValid) $args->isvalid = 'Y';
|
||||
if ($valid_files_only)
|
||||
{
|
||||
$args->isvalid = 'Y';
|
||||
}
|
||||
if ($upload_target_type)
|
||||
{
|
||||
$args->upload_target_type = $upload_target_type;
|
||||
}
|
||||
|
||||
$output = executeQueryArray('file.getFiles', $args, $columnList);
|
||||
if(!$output->data)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="upload_target_type" var="upload_target_type" pipe="and" />
|
||||
<condition operation="equal" column="isvalid" var="isvalid" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" />
|
||||
<condition operation="equal" column="upload_target_type" var="upload_target_type" pipe="and" />
|
||||
<condition operation="like_prefix" column="regdate" var="regDate" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue