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

This commit is contained in:
zero 2007-04-16 03:46:06 +00:00
parent f9b03ddcbc
commit 1cd21bc261
3 changed files with 116 additions and 45 deletions

View file

@ -92,6 +92,9 @@
// import xml filter/ css/ js/ 언어파일 <!--%filename-->
$buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"\)-->!is', array($this, '_compileImportCode'), $buff);
// html 주석 제거
$buff = preg_replace("!<\!--([^\-]+)-->(\\n)!is", '', $buff);
// 파일에 쓰기 전에 직접 호출되는 것을 방지
$buff = sprintf('%s%s%s','<?php if(!defined("__ZBXE__")) exit();?>',"\n",$buff);

View file

@ -0,0 +1,48 @@
/**
* @brief sample_layout에서 메뉴를 출력하는 함수
* text : 메뉴
* href : 연결할 주소
* open_window : [Y|N] 새창으로 띄울 것인지에 대한
* normal_btn : 이미지 버튼
* hover_btn : 이미지 버튼일 경우 mouseover 경우
* active_btn : 선택되어 있을 경우의 이미지
* modifier : 구분자 ( <br /> 또는 null 사용 예상)
* selected_class : 이미지 버튼이 아닐 경우 선택된 문자열에 대한 css class (지정 안되어 있으면 <span style="font-weight:bold">..</span>
* selected : 선택된 메뉴라면 true, 아니면 false
**/
function xe_print_menu(text, href, open_window, normal_btn, hover_btn, active_btn, modifier, selected_class, selected) {
// 텍스트나 이미지 버튼이 없으면 패스~
if(!text && !normal_btn) return;
var html = "";
// 텍스트일 경우
if(!normal_btn) {
// 선택되었을 때의 class or style 지정
if(selected) {
if(!selected_class) selected_class = "style=\"font-weight:bold\"";
else selected_class = "class=\""+selected_class+"\"";
} else {
selected_class = "";
}
if(open_window == "Y") html = "<span "+selected_class+"><a href=\"#\" onclick=\"winopen('"+href+"'); return false;\">"+text+"</a></span>";
else html = "<span "+selected_class+"><a href=\""+href+"\">"+text+"</a></span>";
// 이미지 버튼 일 경우
} else if(normal_btn) {
if(!hover_btn) hover_btn = normal_btn;
if(!active_btn) active_btn = normal_btn;
if(selected) normal_btn = active_btn;
if(open_window == "Y") html = "<a href=\"#\" onclick=\"winopen('"+href+"'); return false;\"><img src=\""+normal_btn+"\" border=\"0\" alt=\""+text+"\" onmouseover=\"this.src='"+hover_btn+"'\" onmouseout=\"this.src='"+normal_btn+"'\" /></a>";
else html = "<a href=\""+href+"\"><img src=\""+normal_btn+"\" border=\"0\" alt=\""+text+"\" onmouseover=\"this.src='"+hover_btn+"'\" onmouseout=\"this.src='"+normal_btn+"'\" /></a>";
}
// modifier 출력
if(modifier) html += modifier;
document.write(html);
}

View file

@ -1,45 +1,55 @@
<!-- 메뉴를 출력하기 위한 javascript 소스가 담긴 파일을 import -->
<!--%import("js/layout.js")-->
<!-- tree_menu.js를 이용한 트리 메뉴 호출 -->
<script type="text/javascript">
loadTreeMenu("{$main_menu->xml_file}", "main_menu", "menu", "{$layout_info->main_menu_name?$layout_info->main_menu_name:'home'}");
</script>
<div style="height:50px;border:1px solid;margin-bottom:10px;">
{$layout_info->top_title}
<div style="float:right">
<div>
<!-- 1차 메뉴 -->
<!--@foreach($main_menu->list as $key => $val)--><!--@if($val['text'])-->
<!-- main_menu 1차 시작 -->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
{@ $second_menu_list = $val['list']; }
<!--@else-->
{@ $selected_style = ''; }
<!--@end-->
<!-- 메뉴 표시 시작 : js/layout.js의 xe_print_menu() 함수를 이용해서 메뉴를 출력한다 (텍스트 혹은 이미지 버튼에 대한 처리를 위해서) -->
<script type="text/javascript">
<!--@foreach($main_menu->list as $key => $val)-->
xe_print_menu("{htmlspecialchars($val['text'])}","{htmlspecialchars($val['href'])}","{$val['open_window']}","{$val['normal_btn']}","{$val['hover_btn']}","{$val['active_btn']}","", "", {$val['selected']?'true':'false'});
<span {$selected_style}>
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</span>
<!-- 선택된 메뉴의 경우 2차 메뉴를 $second_menu_list에 설정 -->
<!--@if($val['selected'])-->
{@ $second_menu_list = $val['list']; }
<!--@end-->
<!--@end--><!--@end-->
<!--@end-->
<!-- 메뉴 표시 끝 -->
</script>
<!-- main_menu 1차 끝 -->
</div>
<div>
<!-- 2차 메뉴 -->
<!--@foreach($second_menu_list as $key => $val)--><!--@if($val['text'])-->
<!-- main_menu 2차 시작 -->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
{@ $third_menu_list = $val['list']; }
<!--@else-->
{@ $selected_style = ''; }
<!--@end-->
<span {$selected_style}>
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</span>
<!-- 메뉴 표시 시작 : js/layout.js의 xe_print_menu() 함수를 이용해서 메뉴를 출력한다 (텍스트 혹은 이미지 버튼에 대한 처리를 위해서) -->
<script type="text/javascript">
<!--@foreach($second_menu_list as $key => $val)-->
xe_print_menu("{htmlspecialchars($val['text'])}","{htmlspecialchars($val['href'])}","{$val['open_window']}","{$val['normal_btn']}","{$val['hover_btn']}","{$val['active_btn']}","", "", {$val['selected']?'true':'false'});
<!--@end--><!--@end-->
<!-- 선택된 메뉴의 경우 3차 메뉴를 $third_menu_list에 설정 -->
<!--@if($val['selected'])-->
{@ $third_menu_list = $val['list']; }
<!--@end-->
<!--@end-->
<!-- 메뉴 표시 끝 -->
</script>
<!-- main_menu 2차 끝 -->
</div>
</div>
@ -65,17 +75,18 @@
<!--@if($third_menu_list)-->
<div>
<!-- 3차 메뉴 -->
<!--@foreach($third_menu_list as $key => $val)--><!--@if($val['text'])-->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
<!--@else-->
{@ $selected_style = ''; }
<!--@end-->
<div {$selected_style}>
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</div>
<!--@end--><!--@end-->
<!-- main_menu 3차 시작 -->
<!-- 메뉴 표시 시작 : js/layout.js의 xe_print_menu() 함수를 이용해서 메뉴를 출력한다 (텍스트 혹은 이미지 버튼에 대한 처리를 위해서) -->
<script type="text/javascript">
<!--@foreach($third_menu_list as $key => $val)-->
xe_print_menu("{htmlspecialchars($val['text'])}","{htmlspecialchars($val['href'])}","{$val['open_window']}","{$val['normal_btn']}","{$val['hover_btn']}","{$val['active_btn']}","<br>","",{$val['selected']?'true':'false'});
<!--@end-->
<!-- 메뉴 표시 끝 -->
</script>
<!-- main_menu 3차 끝 -->
</div>
<!--@end-->
</td>
@ -86,16 +97,25 @@
<tr>
<td colspan="2" align="center">
<div style="margin-top:20px;">
<!--@foreach($bottom_menu->list as $key => $val)-->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
<!--@else-->
{@ $selected_style = ''; }
<!--@end-->
<span {$selected_style}>
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</span>
<!--@end-->
<!-- bottom_menu 메뉴 시작 -->
<!--@foreach($bottom_menu->list as $key => $val)--><!--@if($val['text'])-->
<!-- 1. 이미지 버튼일 경우 -->
<!-- 2. 이미지 버튼이 아닐 경우 -->
<!-- 선택된 메뉴일 경우의 class(or style) 지정 -->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
<!--@else-->
{@ $selected_style = ''; }
<!--@end-->
<span {$selected_style}>
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</span>
<!-- 메뉴 표시 끝 -->
<!--@end--><!--@end-->
</div>
</td>
</tr>