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

This commit is contained in:
zero 2007-03-09 03:50:07 +00:00
parent a6281d0239
commit 7d61b1ff9a
6 changed files with 72 additions and 31 deletions

View file

@ -124,6 +124,8 @@ function drawNode(parent_node, menu_id) {
var text = node.getAttribute("text");
var url = node.getAttribute("url");
var expand = node.getAttribute("expand");
if(!text) continue;
// 자식 노드가 있는지 확인
var hasChild = false;

View file

@ -169,4 +169,5 @@
debugPrint($output);
}
?>

View file

@ -9,7 +9,8 @@
<div>
<!-- 1차 메뉴 -->
<!--@foreach($main_menu->list as $key => $val)-->
<!--@foreach($main_menu->list as $key => $val)--><!--@if($val['text'])-->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
@ -21,12 +22,12 @@
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</span>
<!--@end-->
<!--@end--><!--@end-->
</div>
<div>
<!-- 2차 메뉴 -->
<!--@foreach($second_menu_list as $key => $val)-->
<!--@foreach($second_menu_list as $key => $val)--><!--@if($val['text'])-->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
@ -38,7 +39,7 @@
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</span>
<!--@end-->
<!--@end--><!--@end-->
</div>
</div>
@ -54,7 +55,7 @@
<div>
<!-- 3차 메뉴 -->
<!--@foreach($third_menu_list as $key => $val)-->
<!--@foreach($third_menu_list as $key => $val)--><!--@if($val['text'])-->
<!--@if($val['selected'])-->
{@ $selected_style = 'style="font-weight:bold;"'}
@ -65,9 +66,9 @@
<a href="#" onclick="return move_url('{$val['href']}','{$val['open_window']}');">{$val['text']}</a>
</div>
<!--@end-->
<!--@end--><!--@end-->
</div>
</td>
<td>
<div id="content">
{$content}

View file

@ -231,7 +231,7 @@
if(!$output->toBool()) return;
// 캐시 파일의 이름을 지정
$xml_file = sprintf("./files/cache/layout/%s_%s.xml", $layout_srl, $menu_id);
$xml_file = sprintf("./files/cache/layout/%s_%s.xml.php", $layout_srl, $menu_id);
$php_file = sprintf("./files/cache/layout/%s_%s.php", $layout_srl, $menu_id);
// 구해온 데이터가 없다면 노드데이터가 없는 xml 파일만 생성
@ -256,7 +256,7 @@
}
// xml 캐시 파일 생성
$xml_buff = sprintf('<root>%s</root>', $this->getXmlTree($tree[0], $tree));
$xml_buff = sprintf('<?php header("Content-Type: text/xml; charset=UTF-8"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); @session_start(); ?><root>%s</root>', $this->getXmlTree($tree[0], $tree));
// php 캐시 파일 생성
$php_output = $this->getPhpCacheCode($tree[0], $tree);
@ -278,19 +278,34 @@
foreach($source_node as $menu_srl => $node) {
$child_buff = "";
// 자식 노드의 데이터 가져옴
if($menu_srl&&$tree[$menu_srl]) $child_buff = $this->getXmlTree($tree[$menu_srl], $tree);
// 변수 정리
$name = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->name);
$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
$open_window = $node->open_window;
$expand = $node->expand;
$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
$group_srls = $node->group_srls;
// node->group_srls값이 있으면
if($group_srls) $group_check_code = sprintf('($_SESSION["is_admin"]==true||(is_array($_SESSION["group_srls"])&&count(array_intersect($_SESSION["group_srls"], array(%s)))))',$group_srls);
else $group_check_code = "true";
$attribute = sprintf(
'node_srl="%s" text="%s" url="%s" open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" group_srls="%s"',
$node->menu_srl,
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->name),
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url),
$node->open_window,
$node->expand,
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn),
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn),
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn),
$node->group_srls
'node_srl="%s" text=\'<?=(%s?"%s":"")?>\' url=\'<?=(%s?"%s":"")?>\' open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" ',
$menu_srl,
$group_check_code,
$name,
$group_check_code,
$url,
$open_window,
$expand,
$normal_btn,
$hover_btn,
$active_btn
);
if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
@ -322,20 +337,37 @@
if($node->url) $child_output['url_list'][] = $node->url;
$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
// node->group_srls값이 있으면
if($node->group_srls) $group_check_code = sprintf('($_SESSION["is_admin"]==true||(is_array($_SESSION["group_srls"])&&count(array_intersect($_SESSION["group_srls"], array(%s)))))',$node->group_srls);
else $group_check_code = "true";
// 변수 정리
$name = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->name);
$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
$open_window = $node->open_window;
$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
$selected = '"'.implode('","',$child_output['url_list']).'"';
$child_buff = $child_output['buff'];
// 속성을 생성한다 ( url_list를 이용해서 선택된 메뉴의 노드에 속하는지를 검사한다. 꽁수지만 빠르고 강력하다고 생각;;)
$attribute = sprintf(
'"node_srl"=>"%s","text"=>"%s","href"=>"%s","url"=>"%s","open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","group_srls"=>array(%s),"selected"=>(in_array(Context::get("zbfe_url"),array(%s))?1:0),"list"=>array(%s)',
'"node_srl"=>"%s","text"=>(%s?"%s":""),"href"=>(%s?"%s":""),"url"=>(%s?"%s":""),"open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","selected"=>(in_array(Context::get("zbfe_url"),array(%s))?1:0),"list"=>array(%s)',
$node->menu_srl,
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->name),
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href),
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url),
$node->open_window,
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn),
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn),
str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn),
$node->group_srls,
'"'.implode('","',$child_output['url_list']).'"',
$child_output['buff']
$group_check_code,
$name,
$group_check_code,
$href,
$group_check_code,
$url,
$open_window,
$normal_btn,
$hover_btn,
$active_btn,
$selected,
$child_buff
);
// buff 데이터를 생성한다

View file

@ -165,7 +165,7 @@
$buff .= sprintf('$layout_info->menu->{%s}->id = "%s";',$id, $menus[$i]->attrs->id);
$buff .= sprintf('$layout_info->menu->{%s}->name = "%s";',$id, $menus[$i]->name->body);
$buff .= sprintf('$layout_info->menu->{%s}->maxdepth = "%s";',$id, $menus[$i]->maxdepth->body);
$buff .= sprintf('$layout_info->menu->{%s}->xml_file = "./files/cache/layout/".$layout_srl."_%s.xml";',$id, $id);
$buff .= sprintf('$layout_info->menu->{%s}->xml_file = "./files/cache/layout/".$layout_srl."_%s.xml.php";',$id, $id);
$buff .= sprintf('$layout_info->menu->{%s}->php_file = "./files/cache/layout/".$layout_srl."_%s.php";',$id, $id);
}

View file

@ -44,6 +44,8 @@
// 세션에 로그인 사용자 정보 저장
$_SESSION['member_srl'] = $member_info->member_srl;
$_SESSION['logged_info'] = $member_info;
$_SESSION['group_srls'] = array_keys($member_info->group_list);
$_SESSION['is_admin'] = $member_info->is_admin=='Y'?true:false;
// DB 객체 생성
$oDB = &DB::getInstance();
@ -62,6 +64,9 @@
$_SESSION['is_logged'] = false;
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['logged_info'] = NULL;
$_SESSION['member_srl'] = NULL;
$_SESSION['group_srls'] = array();
$_SESSION['is_admin'] = NULL;
return new Object();
}