메뉴 이미지 버튼 등록시 확장자 처리 오류 수정. png파일일 경우 메뉴의link값에 iePngFix class 자동 연결하도록 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3581 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-23 12:24:22 +00:00
parent bd6d7f2723
commit 890664fd39
3 changed files with 16 additions and 30 deletions

View file

@ -280,7 +280,7 @@
// 요건을 만족하고 업로드된 파일이면 지정된 위치로 이동
} else {
$tmp_arr = explode('/',$target_file['type']);
$tmp_arr = explode('.',$target_file['name']);
$ext = $tmp_arr[count($tmp_arr)-1];
$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
@ -415,9 +415,11 @@
$group_srls = $node->group_srls;
if($normal_btn) {
if(preg_match('/\.png$/',$normal_btn)) $classname = 'class="iePngFix"';
else $classname = '';
if($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = '';
if($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = '';
$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$_SESSION["lang_type"]]) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$_SESSION["lang_type"]]) ?>&quot; %s %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str, $classname);
} else {
$link = '<? print $_names[$_SESSION["lang_type"]]; ?>';
}
@ -510,9 +512,11 @@
$group_srls = $node->group_srls;
if($normal_btn) {
if(preg_match('/\.png$/',$normal_btn)) $classname = 'class=\"iePngFix\"';
else $classname = '';
if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str, $classname);
} else {
$link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
}

View file

@ -207,32 +207,12 @@ function doMenuUploadButton(obj) {
// 이미지인지 체크
if(!/\.(gif|jpg|jpeg|png)$/i.test(obj.value)) return alert(alertImageOnly);
// iframe 객체 생성 (있으면 있는것 이용)
if(!xGetElementById('tmp_upload_iframe')) {
if(xIE4Up) {
window.document.body.insertAdjacentHTML("afterEnd", "<iframe id='tmp_upload_iframe' name='tmp_upload_iframe' style='display:none;width:1px;height:1px;position:absolute;top:-10px;left:-10px'></iframe>");
} else {
var obj_iframe = xCreateElement('IFRAME');
obj_iframe.name = obj_iframe.id = 'tmp_upload_iframe';
obj_iframe.style.display = 'none';
obj_iframe.style.width = '1px';
obj_iframe.style.height = '1px';
obj_iframe.style.position = 'absolute';
obj_iframe.style.top = '-10px';
obj_iframe.style.left = '-10px';
window.document.body.appendChild(obj_iframe);
}
}
// 현재 form의 target을 바꾸고 이미지 등록
obj.form.target = 'tmp_upload_iframe';
// submit
obj.form.act.value = "procMenuAdminUploadButton";
obj.form.target.value = obj.name;
obj.form.submit();
obj.form.act.value = "";
obj.form.target.value = "";
var fo_obj = xGetElementById("fo_menu");
fo_obj.act.value = "procMenuAdminUploadButton";
fo_obj.target.value = obj.name;
fo_obj.submit();
fo_obj.act.value = "";
fo_obj.target.value = "";
}
/* 메뉴 이미지 업로드 후처리 */

View file

@ -69,7 +69,7 @@
<p class="gap1"><input type="checkbox" id="menu_enable_move" class="checkbox" /> <label for="menu_enable_move">{$lang->cmd_enable_move_menu}</label></p>
<div class="gap1">
<form id="fo_menu" action="./" method="post" onsubmit="return procFilter(this, insert_menu_item)" class="clear" enctype="multipart/form-data">
<form id="fo_menu" action="./" method="post" onsubmit="return procFilter(this, insert_menu_item)" class="clear" target="tmp_upload_iframe" enctype="multipart/form-data">
<input type="hidden" name="title" value="{$menu_info->title}" />
<input type="hidden" name="menu_srl" value="{$menu_info->menu_srl}" />
<input type="hidden" name="xml_file" value="{$menu_info->xml_file}" />
@ -92,3 +92,5 @@
</div>
</div>
<iframe id='tmp_upload_iframe' name='tmp_upload_iframe' style='display:none;width:1px;height:1px;position:absolute;top:-10px;left:-10px'></iframe>