git-svn-id: http://xe-core.googlecode.com/svn/trunk@1791 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-06-27 05:28:25 +00:00
parent 7e130936a9
commit e0e99b1b46
5 changed files with 90 additions and 22 deletions

View file

@ -70,6 +70,59 @@
$oModuleController->updateModuleLayout($args->layout_srl, $menu_srl_list);
}
}
// extra_vars의 type이 image일 경우 별도 처리를 해줌
if($extra_vars) {
foreach($extra_vars as $vars) {
if($vars->type!='image') continue;
$image_obj = $obj->{$vars->name};
// 삭제 요청에 대한 변수를 구함
$del_var = $obj->{"del_".$vars->name};
unset($obj->{"del_".$vars->name});
if($del_var == 'Y') {
@unlink($module_info->{$vars->name});
continue;
}
// 업로드 되지 않았다면 이전 데이터를 그대로 사용
if(!$image_obj['tmp_name']) {
$obj->{$vars->name} = $module_info->{$vars->name};
continue;
}
// 정상적으로 업로드된 파일이 아니면 무시
if(!is_uploaded_file($image_obj['tmp_name'])) {
unset($obj->{$vars->name});
continue;
}
// 이미지 파일이 아니어도 무시
if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) {
unset($obj->{$vars->name});
continue;
}
// 경로를 정해서 업로드
$path = sprintf("./files/attach/images/%s/", $args->layout_srl);
// 디렉토리 생성
if(!FileHandler::makeDir($path)) return false;
$filename = $path.$image_obj['name'];
// 파일 이동
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
unset($obj->{$vars->name});
continue;
}
// 변수를 바꿈
unset($obj->{$vars->name});
$obj->{$vars->name} = $filename;
}
}
// DB에 입력하기 위한 변수 설정
$args->extra_vars = serialize($extra_vars);
@ -77,7 +130,10 @@
$output = $this->updateLayout($args);
if(!$output->toBool()) return $output;
$this->setMessage('success_updated');
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('default_layout.html');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile("top_refresh.html");
}
function updateLayout($args) {