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

@ -1,3 +1,4 @@
<script type="text/javascript">
alert("{$lang->success_updated}");
top.location.href = top.location.href;
</script>

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) {

View file

@ -27,7 +27,10 @@
<!--@end-->
</table>
<form id="fo_layout" action="./" method="get" onsubmit="return procFilter(this, update_layout_info)">
<!--<form id="fo_layout" action="./" method="post" onsubmit="return procFilter(this, update_layout_info)" enctype="multipart/form-data" target="hidden_iframe">-->
<form id="fo_layout" action="./" method="post" enctype="multipart/form-data" target="hidden_iframe">
<input type="hidden" name="module" value="layout" />
<input type="hidden" name="act" value="procLayoutAdminUpdate" />
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
<input type="hidden" name="layout" value="{$selected_layout->layout}" />
@ -52,6 +55,18 @@
<!--@elseif($var->type == "textarea")-->
<textarea name="{$name}" class="inputTypeTextArea w100">{htmlspecialchars($var->value)}</textarea>
<!--@elseif($var->type=="image")-->
<!--@if($var->value)-->
<div>
<img src="{$var->value}" /><br />
<input type="checkbox" name="del_{$name}" value="Y" id="del_{$name}" class="checkbox" />
<label for="del_{$name}">{$lang->cmd_delete}</label>
</div>
<!--@end-->
<input type="file" name="{$name}" value="" />
<!--@elseif($var->type == "select")-->
<select name="{$name}">
<!--@foreach($var->options as $key => $val)-->
@ -92,3 +107,5 @@
<!--@end-->
</ul>
</form>
<iframe name="hidden_iframe" frameborder="0" style="display:none"></iframe>

View file

@ -0,0 +1,4 @@
<script type="text/javascript">
alert("{$lang->success_updated}");
top.location.href = top.location.href;
</script>