mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1138 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e5701c611e
commit
45d551a776
5 changed files with 77 additions and 22 deletions
|
|
@ -74,7 +74,6 @@
|
|||
$attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);
|
||||
if($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size');
|
||||
}
|
||||
return new Object(-1, 'msg_exceeds_limit_size');
|
||||
|
||||
// 이미지인지 기타 파일인지 체크하여 upload path 지정
|
||||
if(eregi("\.(jpg|jpeg|gif|png|wmv|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info['name'])) {
|
||||
|
|
@ -249,22 +248,43 @@
|
|||
$oFileModel = &getModel('file');
|
||||
|
||||
// 첨부파일 목록을 구함
|
||||
$file_list = $oFileModel->getFiles($upload_target_srl);
|
||||
$file_count = count($file_list);
|
||||
$tmp_file_list = $oFileModel->getFiles($upload_target_srl);
|
||||
$file_count = count($tmp_file_list);
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin == 'Y') {
|
||||
$file_config->allowed_filesize = 1024;
|
||||
$file_config->allowed_attach_size = 1024;
|
||||
$file_config->allowed_filetypes = '*.*';
|
||||
} else {
|
||||
$file_config = $oFileModel->getFileConfig();
|
||||
}
|
||||
|
||||
// 루프를 돌면서 $buff 변수에 java script 코드를 생성
|
||||
$buff = "";
|
||||
for($i=0;$i<$file_count;$i++) {
|
||||
$file_info = $file_list[$i];
|
||||
$file_info = $tmp_file_list[$i];
|
||||
if(!$file_info->file_srl) continue;
|
||||
|
||||
$uploaded_filename = sprintf('%s%s', Context::getRequestUri(), str_replace('./', '', $file_info->uploaded_filename));
|
||||
|
||||
$buff .= sprintf("parent.editor_insert_uploaded_file(\"%d\", \"%d\",\"%s\", \"%d\", \"%s\", \"%s\", \"%s\");\n", $upload_target_srl, $file_info->file_srl, $file_info->source_filename, $file_info->file_size, FileHandler::filesize($file_info->file_size), $file_info->direct_download=='Y'?$uploaded_filename:'', $file_info->sid);
|
||||
if($file_info->direct_download == 'Y') $file_info->uploaded_filename = sprintf('%s%s', Context::getRequestUri(), str_replace('./', '', $file_info->uploaded_filename));
|
||||
$file_list[] = $file_info;
|
||||
$attached_size += $file_info->file_size;
|
||||
}
|
||||
|
||||
// 업로드 상태 표시 작성
|
||||
$upload_status = sprintf(
|
||||
'<span class="title">- %s : </span><span class="desc_attached">%s</span><span class="desc">/ %s</span><span class="title">- %s : </span><span class="desc">%s</span><span class="title">- %s : </span><span class="desc">%s</span>',
|
||||
Context::getLang('allowed_attach_size'),
|
||||
FileHandler::filesize($attached_size),
|
||||
FileHandler::filesize($file_config->allowed_attach_size*1024*1024),
|
||||
Context::getLang('allowed_filesize'),
|
||||
FileHandler::filesize($file_config->allowed_filesize*1024*1024),
|
||||
Context::getLang('allowed_filetypes'),
|
||||
$file_config->allowed_filetypes
|
||||
);
|
||||
|
||||
Context::set('upload_target_srl', $upload_target_srl);
|
||||
Context::set('buff', $buff);
|
||||
Context::set('file_list', $file_list);
|
||||
Context::set('upload_status', $upload_status);
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('print_uploaded_file_list');
|
||||
|
|
|
|||
11
modules/file/queries/getAttachedFileSize.xml
Normal file
11
modules/file/queries/getAttachedFileSize.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="getAttachedFileSize" action="select">
|
||||
<tables>
|
||||
<table name="files" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="sum(file_size)" alias="attached_size" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
<script type="text/javascript">
|
||||
|
||||
parent.editor_upload_clear_list("{$upload_target_srl}");
|
||||
|
||||
{$buff}
|
||||
<!--@foreach($file_list as $key => $file_info)-->
|
||||
parent.editor_insert_uploaded_file({$upload_target_srl}, {$file_info->file_srl}, "{$file_info->source_filename}", "{$file_info->file_size}", "{FileHandler::filesize($file_info->file_size)}", "{$file_info->uploaded_filename}", "{$file_info->sid}");
|
||||
<!--@end-->
|
||||
|
||||
parent.xInnerHtml("uploader_status_{$upload_target_srl}", '{$upload_status}');
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue