diff --git a/common/js/tree_menu.js b/common/js/tree_menu.js
index 316f79f57..2ebb763a2 100644
--- a/common/js/tree_menu.js
+++ b/common/js/tree_menu.js
@@ -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;
diff --git a/config/func.inc.php b/config/func.inc.php
index bbb363239..3c4800c36 100644
--- a/config/func.inc.php
+++ b/config/func.inc.php
@@ -169,4 +169,5 @@
debugPrint($output);
}
+
?>
diff --git a/layouts/sample_layout/layout.html b/layouts/sample_layout/layout.html
index 2ccd35dc9..9f04c6d7a 100644
--- a/layouts/sample_layout/layout.html
+++ b/layouts/sample_layout/layout.html
@@ -9,7 +9,8 @@
-
+
+
{@ $selected_style = 'style="font-weight:bold;"'}
@@ -21,12 +22,12 @@
{$val['text']}
-
+
-
+
{@ $selected_style = 'style="font-weight:bold;"'}
@@ -38,7 +39,7 @@
{$val['text']}
-
+
@@ -54,7 +55,7 @@
-
+
{@ $selected_style = 'style="font-weight:bold;"'}
@@ -65,9 +66,9 @@
{$val['text']}
-
+
-
+
{$content}
diff --git a/modules/layout/layout.controller.php b/modules/layout/layout.controller.php
index 8d4179c0c..e0a736bdc 100644
--- a/modules/layout/layout.controller.php
+++ b/modules/layout/layout.controller.php
@@ -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('%s', $this->getXmlTree($tree[0], $tree));
+ $xml_buff = sprintf('%s', $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('&','"','<','>'),$node->name);
+ $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url);
+ $open_window = $node->open_window;
+ $expand = $node->expand;
+ $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn);
+ $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn);
+ $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$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('&','"','<','>'),$node->name),
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url),
- $node->open_window,
- $node->expand,
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn),
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn),
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$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('%s', $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('&','"','<','>'),$node->name);
+ $href = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href);
+ $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url);
+ $open_window = $node->open_window;
+ $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn);
+ $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn);
+ $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$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('&','"','<','>'),$node->name),
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href),
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url),
- $node->open_window,
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn),
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn),
- str_replace(array('&','"','<','>'),array('&','"','<','>'),$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 데이터를 생성한다
diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php
index 299c1087b..b48b1c7cf 100644
--- a/modules/layout/layout.model.php
+++ b/modules/layout/layout.model.php
@@ -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);
}
diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php
index e8291234e..46b8ec4fc 100644
--- a/modules/member/member.controller.php
+++ b/modules/member/member.controller.php
@@ -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();
}
|