mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-12 13:32:16 +09:00
IE에서 첨부파일 미리 보기 안되는 기능 및 Context에서 request arguments에 대해 filtering을 하는 기능 보완
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4702 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aaff38633c
commit
b59ac03deb
5 changed files with 97 additions and 93 deletions
|
|
@ -550,18 +550,7 @@
|
||||||
|
|
||||||
foreach($_REQUEST as $key => $val) {
|
foreach($_REQUEST as $key => $val) {
|
||||||
if($val === "") continue;
|
if($val === "") continue;
|
||||||
if($key == "page" || $key == "cpage" || substr($key,-3)=="srl") $val = (int)$val;
|
$val = $this->_filterRequestVar($key, $val);
|
||||||
else if(is_array($val) && count($val) ) {
|
|
||||||
foreach($val as $k => $v) {
|
|
||||||
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $v = stripslashes($v);
|
|
||||||
$v = trim($v);
|
|
||||||
$val[$k] = $v;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $val = stripslashes($val);
|
|
||||||
$val = trim($val);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->_getRequestMethod()=='GET'&&$_GET[$key]) $set_to_vars = true;
|
if($this->_getRequestMethod()=='GET'&&$_GET[$key]) $set_to_vars = true;
|
||||||
elseif($this->_getRequestMethod()=='POST'&&$_POST[$key]) $set_to_vars = true;
|
elseif($this->_getRequestMethod()=='POST'&&$_POST[$key]) $set_to_vars = true;
|
||||||
else $set_to_vars = false;
|
else $set_to_vars = false;
|
||||||
|
|
@ -584,11 +573,30 @@
|
||||||
if(!count($params)) return;
|
if(!count($params)) return;
|
||||||
|
|
||||||
foreach($params as $key => $obj) {
|
foreach($params as $key => $obj) {
|
||||||
$val = trim($obj->body);
|
$val = $this->_filterRequestVar($key, $obj->body);
|
||||||
$this->_set($key, $val, true);
|
$this->_set($key, $val, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 변수명에 따라서 필터링 처리
|
||||||
|
* _srl, page, cpage등의 변수는 integer로 형변환
|
||||||
|
**/
|
||||||
|
function _filterRequestVar($key, $val) {
|
||||||
|
if($key == "page" || $key == "cpage" || substr($key,-3)=="srl") return (int)$val;
|
||||||
|
if(is_array($val) && count($val) ) {
|
||||||
|
foreach($val as $k => $v) {
|
||||||
|
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $v = stripslashes($v);
|
||||||
|
$v = trim($v);
|
||||||
|
$val[$k] = $v;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $val = stripslashes($val);
|
||||||
|
$val = trim($val);
|
||||||
|
}
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업로드 되었을 경우 return true
|
* @brief 업로드 되었을 경우 return true
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,13 @@ var show_waiting_message = true;
|
||||||
function exec_xml(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj) {
|
function exec_xml(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj) {
|
||||||
var oXml = new xml_handler();
|
var oXml = new xml_handler();
|
||||||
oXml.reset();
|
oXml.reset();
|
||||||
|
if(typeof(params)!='undefined') {
|
||||||
for(var key in params) {
|
for(var key in params) {
|
||||||
if(!params.hasOwnProperty(key)) continue;
|
if(!params.hasOwnProperty(key)) continue;
|
||||||
var val = params[key];
|
var val = params[key];
|
||||||
oXml.addParam(key, val);
|
oXml.addParam(key, val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
oXml.addParam("module", module);
|
oXml.addParam("module", module);
|
||||||
oXml.addParam("act", act);
|
oXml.addParam("act", act);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ function completeReloadFileList(ret_obj, response_tags, settings) {
|
||||||
var previewObj = xGetElementById(settings["previewAreaID"]);
|
var previewObj = xGetElementById(settings["previewAreaID"]);
|
||||||
if(previewObj) xInnerHtml(previewObj,"");
|
if(previewObj) xInnerHtml(previewObj,"");
|
||||||
|
|
||||||
if(files) {
|
if(files && typeof(files['item'])!='undefined') {
|
||||||
var item = files['item'];
|
var item = files['item'];
|
||||||
if(item.length<1) item = new Array(item);
|
if(item.length<1) item = new Array(item);
|
||||||
if(item.length) {
|
if(item.length) {
|
||||||
|
|
@ -249,14 +249,20 @@ function completeReloadFileList(ret_obj, response_tags, settings) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listObj.selectedIndex = listObj.options.length-1;
|
//listObj.selectedIndex = listObj.options.length-1;
|
||||||
xAddEventListener(listObj,'click',previewFiles);
|
xAddEventListener(listObj,'click',previewFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
function previewFiles(evt) {
|
function previewFiles(evt) {
|
||||||
var e = new xEvent(evt);
|
var e = new xEvent(evt);
|
||||||
var obj = e.target;
|
var obj = e.target;
|
||||||
if(obj.nodeName!="OPTION") return;
|
var selObj = null;
|
||||||
|
if(obj.nodeName=="OPTION") selObj = obj.parentNode;
|
||||||
|
else selObj = obj;
|
||||||
|
if(selObj.nodeName != "SELECT") return;
|
||||||
|
if(selObj.selectedIndex<0) return;
|
||||||
|
obj = selObj.options[selObj.selectedIndex];
|
||||||
|
|
||||||
var file_srl = obj.value;
|
var file_srl = obj.value;
|
||||||
if(!file_srl || typeof(uploadedFiles[file_srl])=="undefined") return;
|
if(!file_srl || typeof(uploadedFiles[file_srl])=="undefined") return;
|
||||||
var file_info = uploadedFiles[file_srl];
|
var file_info = uploadedFiles[file_srl];
|
||||||
|
|
@ -297,12 +303,18 @@ function removeUploadedFile(editorSequence) {
|
||||||
|
|
||||||
if(fileListObj.selectedIndex<0) return;
|
if(fileListObj.selectedIndex<0) return;
|
||||||
|
|
||||||
var file_srl = fileListObj.options[fileListObj.selectedIndex].value;
|
var file_srls = new Array();
|
||||||
|
for(var i=0;i<fileListObj.options.length;i++) {
|
||||||
|
if(!fileListObj.options[i].selected) continue;
|
||||||
|
var file_srl = fileListObj.options[i].value;
|
||||||
|
if(!file_srl) continue;
|
||||||
|
file_srls[file_srls.length] = file_srl;
|
||||||
|
}
|
||||||
|
|
||||||
if(!file_srl) return;
|
if(file_srls.length<1) return;
|
||||||
|
|
||||||
var params = new Array();
|
var params = new Array();
|
||||||
params["file_srl"] = file_srl;
|
params["file_srl"] = file_srls.join(',');
|
||||||
params["editor_sequence"] = editorSequence;
|
params["editor_sequence"] = editorSequence;
|
||||||
var response_tags = new Array("error","message");
|
var response_tags = new Array("error","message");
|
||||||
exec_xml("file","procFileDelete", params, function() { reloadFileList(settings); } );
|
exec_xml("file","procFileDelete", params, function() { reloadFileList(settings); } );
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);
|
if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);
|
||||||
|
|
||||||
// 첨부파일의 목록을 java script로 출력
|
// 첨부파일의 목록을 java script로 출력
|
||||||
$this->printUploadedFileList($editor_sequence, $upload_target_srl);
|
// $this->printUploadedFileList($editor_sequence, $upload_target_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -333,12 +333,20 @@
|
||||||
function deleteFile($file_srl) {
|
function deleteFile($file_srl) {
|
||||||
if(!$file_srl) return;
|
if(!$file_srl) return;
|
||||||
|
|
||||||
// 파일 정보를 가져옴
|
$srls = explode(',',$file_srl);
|
||||||
$args->file_srl = $file_srl;
|
if(!count($srls)) return;
|
||||||
|
|
||||||
|
for($i=0;$i<count($srls);$i++) {
|
||||||
|
$srl = (int)$srls[$i];
|
||||||
|
if(!$srl) continue;
|
||||||
|
|
||||||
|
$args = null;
|
||||||
|
$args->file_srl = $srl;
|
||||||
$output = executeQuery('file.getFile', $args);
|
$output = executeQuery('file.getFile', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) continue;
|
||||||
|
|
||||||
$file_info = $output->data;
|
$file_info = $output->data;
|
||||||
if(!$file_info) return new Object(-1, 'file_not_founded');
|
if(!$file_info) continue;
|
||||||
|
|
||||||
$source_filename = $output->data->source_filename;
|
$source_filename = $output->data->source_filename;
|
||||||
$uploaded_filename = $output->data->uploaded_filename;
|
$uploaded_filename = $output->data->uploaded_filename;
|
||||||
|
|
@ -358,6 +366,7 @@
|
||||||
|
|
||||||
// 삭제 성공하면 파일 삭제
|
// 삭제 성공하면 파일 삭제
|
||||||
FileHandler::removeFile($uploaded_filename);
|
FileHandler::removeFile($uploaded_filename);
|
||||||
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -446,38 +455,7 @@
|
||||||
* @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
|
* @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
|
||||||
**/
|
**/
|
||||||
function printUploadedFileList($editor_sequence, $upload_target_srl) {
|
function printUploadedFileList($editor_sequence, $upload_target_srl) {
|
||||||
$oFileModel = &getModel('file');
|
return;
|
||||||
|
|
||||||
if($upload_target_srl) {
|
|
||||||
// file의 Model객체 생성
|
|
||||||
|
|
||||||
// 첨부파일 목록을 구함
|
|
||||||
$tmp_file_list = $oFileModel->getFiles($upload_target_srl);
|
|
||||||
$file_count = count($tmp_file_list);
|
|
||||||
|
|
||||||
// 루프를 돌면서 $buff 변수에 java script 코드를 생성
|
|
||||||
$buff = "";
|
|
||||||
for($i=0;$i<$file_count;$i++) {
|
|
||||||
$file_info = $tmp_file_list[$i];
|
|
||||||
if(!$file_info->file_srl) continue;
|
|
||||||
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 = $oFileModel->getUploadStatus($attached_size);
|
|
||||||
|
|
||||||
// 필요한 정보들 세팅
|
|
||||||
Context::set('upload_target_srl', $upload_target_srl);
|
|
||||||
Context::set('file_list', $file_list);
|
|
||||||
Context::set('upload_status', $upload_status);
|
|
||||||
|
|
||||||
// 업로드 현황을 브라우저로 알리기 위한 javascript 코드 출력하는 템플릿 호출
|
|
||||||
Context::set('layout','none');
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
|
||||||
$this->setTemplateFile('print_uploaded_file_list');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@
|
||||||
function getFileList() {
|
function getFileList() {
|
||||||
$editor_sequence = Context::get("editor_sequence");
|
$editor_sequence = Context::get("editor_sequence");
|
||||||
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||||
if(!$upload_target_srl) exit();
|
if($upload_target_srl) {
|
||||||
|
|
||||||
$tmp_files = $this->getFiles($upload_target_srl);
|
$tmp_files = $this->getFiles($upload_target_srl);
|
||||||
$file_count = count($tmp_files);
|
$file_count = count($tmp_files);
|
||||||
|
|
||||||
|
|
@ -39,6 +38,11 @@
|
||||||
$files[] = $obj;
|
$files[] = $obj;
|
||||||
$attached_size += $file_info->file_size;
|
$attached_size += $file_info->file_size;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$upload_target_srl = 0;
|
||||||
|
$attached_size = 0;
|
||||||
|
$files = array();
|
||||||
|
}
|
||||||
|
|
||||||
// 업로드 상태 표시 작성
|
// 업로드 상태 표시 작성
|
||||||
$upload_status = $this->getUploadStatus($attached_size);
|
$upload_status = $this->getUploadStatus($attached_size);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue