#603 site map folders set folded state

This commit is contained in:
akasima 2015-02-11 13:11:37 +09:00
parent 64c50c0831
commit 9f618fc331
2 changed files with 78 additions and 2 deletions

View file

@ -46,6 +46,9 @@ body>.x{max-width:none !important}
.col>*>h1>a[target="_blank"]:after{vertical-align:middle;opacity:.75;filter:alpha(opacity=75)}
.col>*>h1>a:hover,
.col>*>h1>a:focus{color:#06C}
.col #menu_find{height:32px}
.col #menu_find input[type="text"]{margin-bottom: 0}
.col #menu_find button[type="button"]{visibility: hidden}
.col>.x_close{position:absolute;top:0;right:0;width:30px;height:30px;color:#666;font-size:17px;opacity:.75;filter:alpha(opacity=75)}
.col input[type="checkbox"],
.col input[type="radio"]{margin:0}

View file

@ -22,6 +22,11 @@
<!--@if($act == 'dispMenuAdminSiteMap')-->
<div class="col map" id="site_map">
<h1>{$lang->menu_gnb_sub['siteMap']} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_site_menu" target="_blank">{$lang->help}</a></h1>
<form id="menu_find">
<input name="keyword" type="text"></input>
<button class="x_btn x_btn-inverse btn-find">{$lang->cmd_find}</button>
<button class="x_btn x_btn-inverse btn-next" type="button">{$lang->cmd_next}</button>
</form>
<div class="cnt">
<section class="mapi" id="siteMapTree">
<script id="tmpl_menuTree" type="text/x-jquery-tmpl">
@ -798,7 +803,12 @@ function onSiteMapReceived(htData){
// it makes sense to configure a plugin only if overriding the defaults
})
.bind("loaded.jstree", function (event, data) {
data.inst.open_all();
//data.inst.open_all();
data.inst.get_container_ul().find("li.jstree-closed").each(function () {
if(issetJSTreeOpenIds(this.id) == true){
$(this).removeClass("jstree-closed").addClass("jstree-open");
}
});
var sRenameId = $._xeAdminVar.sRenameOnload;
$._xeAdminVar.sRenameOnload = null;
@ -823,6 +833,12 @@ function onSiteMapReceived(htData){
}
})
.bind("open_node.jstree", function(event, data){
setJSTreeOpenIds();
})
.bind("close_node.jstree", function(event, data){
setJSTreeOpenIds();
})
.bind("rename.jstree", function(event, data){
$("#siteMapTree").removeClass("_node_renaming");
})
@ -839,6 +855,12 @@ function onSiteMapReceived(htData){
})
.bind("select_node.jstree", function(event, data){
// move scroll
var ul = $($("#siteMapTree").jstree("get_container")[0]);
ul.parent("div.cnt").stop().animate({
scrollTop: data.rslt.obj.offset().top - ul.offset().top
}, 800);
$("#siteMapTree input").blur();
//console.log($("#siteMapTree input"));
@ -965,6 +987,24 @@ console.log(htNodeInfo);
$('#site_map').nextAll().hide();
}
function setJSTreeOpenIds(){
var jstree_open_srls = [];
jQuery("#siteMapTree").find("li.jstree-open").each(function() {
jstree_open_srls.push(this.id);
});
setCookie("__xe_admin_jstree_open_srls", jstree_open_srls.join(","));
}
function issetJSTreeOpenIds(id) {
var jstree_open_srls = getCookie("__xe_admin_jstree_open_srls").split(",");
for (var i=0; i< jstree_open_srls.length; i++) {
if(jstree_open_srls[i] == id) {
return true;
}
}
return false;
}
var htNodeInfo = {};
// return html
function createTreeMarkup(aNode, sParentSrl, sMenuTree, sMenuTreeNode){
@ -1201,6 +1241,37 @@ jQuery(function($){
setItemTypes(htData.menu_types);
setAllModules(htData.all_modules);
});
var find_ids = [];
var find_index = 0;
$("#menu_find").submit(function(){
find_ids = [];
find_index = 0;
$('#menu_find').find('[type="button"]').css("visibility", "hidden");
var keyword = $('[name="keyword"]').val();
$("#siteMapTree").find("li").each(function(){
var pattern = new RegExp(keyword);
if(pattern.test($(this).find("a:first").text())){
find_ids.push(this.id);
}
});
if (find_ids.length>1) {
$('#menu_find').find('[type="button"]').css("visibility", "visible");
}
$("#siteMapTree").jstree("deselect_all").jstree("select_node", "#"+find_ids[find_index]);
return false;
});
$("#menu_find").find('[type="button"]').click(function(){
find_index++;
if (find_ids.length <= find_index){
find_index = 0;
}
$("#siteMapTree").jstree("deselect_all").jstree("select_node", "#"+find_ids[find_index]);
});
<!--@end-->
<!--@if($act == 'dispMenuAdminSiteDesign')-->
@ -3918,15 +3989,17 @@ jQuery(function($){
<!--@else-->
$(window).resize(function(){
var wHeigh = $(window).height();
$('#site').height(wHeigh - 147).find('>.col').height(wHeigh - 185).find('.cnt').height(wHeigh - 252);
$('#properties, #propertiesRoot, #imgbtn, #layoutSetup, #layoutMarkupSetup, #skinSetup').find('.cnt').height(wHeigh - 222);
<!--@if($act == 'dispMenuAdminSiteMap')-->
// minus height 40px for find-form display
$('#site').find('.cnt:first').height(wHeigh - 252 - 40);
$('#design').find('.cnt').height(wHeigh - 222);
<!--@end-->
<!--@if($act == 'dispMenuAdminSiteDesign')-->
$('#layout, #skin').find('.cnt').height(wHeigh - 222);
<!--@end-->
}).resize();