Commit 4572291a by agentec

#19124 コンテンツ閲覧のインデックスが効かない問題対応

parent e9330aa6
/*
* Treeview 1.5pre - jQuery plugin to hide and show branches of a tree
*
*
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
* http://docs.jquery.com/Plugins/Treeview
*
......@@ -59,7 +59,7 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
} else {
this.hide();
if (callback)
this.each(callback);
this.each(callback);
}
},
prepareBranches: function(settings) {
......@@ -79,18 +79,18 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
if ( this == event.target )
toggler.apply($(this).next());
}).add( $("a", this) ).hoverClass();
if (!settings.prerendered) {
// handle closed ones first
this.filter(":has(>ul:hidden)")
.addClass(CLASSES.expandable)
.replaceClass(CLASSES.last, CLASSES.lastExpandable);
// handle open ones
this.not(":has(>ul:hidden)")
.addClass(CLASSES.collapsable)
.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
// create hitarea if not present
var hitarea = this.find("div." + CLASSES.hitarea);
if (!hitarea.length)
......@@ -103,23 +103,23 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
$(this).addClass( classes );
})
}
// apply event to hitarea
this.find("div." + CLASSES.hitarea).click( toggler );
},
treeview: function(settings) {
settings = $.extend({
cookieId: "treeview"
}, settings);
if ( settings.toggle ) {
var callback = settings.toggle;
settings.toggle = function() {
return callback.apply($(this).parent()[0], arguments);
};
}
// factory for treecontroller
function treeController(tree, control) {
// factory for click handlers
......@@ -139,9 +139,9 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
// click on second to expand tree
$("a:eq(1)", control).click( handler(CLASSES.expandable) );
// click on third to toggle tree
$("a:eq(2)", control).click( handler() );
$("a:eq(2)", control).click( handler() );
}
// handle toggle event
function toggler() {
$(this)
......@@ -173,7 +173,7 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
}
}
this.data("toggler", toggler);
function serialize() {
function binary(arg) {
return arg ? 1 : 0;
......@@ -184,7 +184,7 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
});
$.cookie(settings.cookieId, data.join(""), settings.cookieOptions );
}
function deserialize() {
var stored = $.cookie(settings.cookieId);
if ( stored ) {
......@@ -194,13 +194,13 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
});
}
}
// add treeview class to activate styles
this.addClass("treeview");
// prepare branches and find all tree items with child lists
var branches = this.find("li").prepareBranches(settings);
switch(settings.persist) {
case "cookie":
var toggleCallback = settings.toggle;
......@@ -231,19 +231,19 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
}
break;
}
branches.applyClasses(settings, toggler);
// if control option is set, create the treecontroller and show it
if ( settings.control ) {
treeController(this, settings.control);
$(settings.control).show();
}
return this;
}
});
// classes used by the plugin
// need to be styled via external stylesheet, see first example
$.treeview = {};
......@@ -261,7 +261,7 @@ JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
last: "last",
hitarea: "hitarea"
});
})(jQuery);
// ====================================================
......@@ -293,10 +293,6 @@ function TreeNode() {
*/
};
// Add category node
function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFunction) {
var branches;
......@@ -408,7 +404,8 @@ function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFun
}
else {
if(sourceTreeNodeItem.ContentCount == 0){
if (callbackFunction != undefined && callbackFunction != null) {
//#19124 インデックスのページ移動が効かなくなった対応 targetTreeView.treeViewType
if (callbackFunction != undefined && callbackFunction != null && targetTreeView.treeViewType == "normal") {
scriptCallback = ' id="' + sourceTreeNodeItem.Id + '"';
}
tmpClass = JQ_TREEVIEW.CLASS_FILE_ZERO;
......@@ -423,7 +420,8 @@ function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFun
}
else {
if(targetTreeView.TotalCount == 0){
if (callbackFunction != undefined && callbackFunction != null) {
//#19124 インデックスのページ移動が効かなくなった対応 targetTreeView.treeViewType
if (callbackFunction != undefined && callbackFunction != null && targetTreeView.treeViewType == "normal") {
scriptCallback = ' id="' + sourceTreeNodeItem.Id + '"';
}
tmpClass = JQ_TREEVIEW.CLASS_FILE_ZERO;
......@@ -437,7 +435,8 @@ function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFun
}
else {
if(sourceTreeNodeItem.ContentCount == 0){
if (callbackFunction != undefined && callbackFunction != null) {
//#19124 インデックスのページ移動が効かなくなった対応 targetTreeView.treeViewType
if (callbackFunction != undefined && callbackFunction != null && targetTreeView.treeViewType == "normal") {
scriptCallback = ' id="' + sourceTreeNodeItem.Id + '"';
}
tmpClass = JQ_TREEVIEW.CLASS_FILE_ZERO;
......@@ -456,7 +455,7 @@ function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFun
function AddChildNode(tree, parenTreeNode, childDataNode, callbackFunctionName) {
if (childDataNode.IsCategory) {
// Count contents of childs
childDataNode.ChildsCount = Number(childDataNode.ContentCount) + CountChilds(childDataNode.ChildNodes);
if (childDataNode.ChildsCount > 0) {
......@@ -464,7 +463,7 @@ function AddChildNode(tree, parenTreeNode, childDataNode, callbackFunctionName)
childDataNode.Id += nodeId++;
if (childDataNode.ChildsCount != childDataNode.ContentCount) {
// Add category
AddCategory(tree, childDataNode, parenTreeNode, callbackFunctionName);
if (childDataNode.ChildNodes.length > 0) {
......@@ -496,7 +495,7 @@ function AddChildNode(tree, parenTreeNode, childDataNode, callbackFunctionName)
function AddChildNodeIndex(tree, parenTreeNode, childDataNode, callbackFunctionName) {
if (childDataNode.IsCategory) {
// Set unique id
childDataNode.Id += nodeId++;
......@@ -529,7 +528,7 @@ function AddChildNodeIndex(tree, parenTreeNode, childDataNode, callbackFunctionN
Calculate childs count
*/
function CountChilds(nodes) {
var nTotal = 0;
if (nodes) {
for (var nIndex = 0; nIndex < nodes.length; nIndex++) {
......@@ -554,6 +553,7 @@ function TreeView() {
this.IsShowTotal = true;
this.ExpandNodes = [];
this.CategoryTagName = "span"; // Use to expand/ not expand when clicking in
this.treeViewType = "normal"; //#19124 コンテンツ閲覧のインデックスでページ移動しなくなった対応のため
this.Show = function (containerId, nodes, callbackFunctionName) {
var tree = this;
tree.Id = containerId;
......@@ -562,7 +562,7 @@ function TreeView() {
newItem.Id = "all";
newItem.IsCategory = false;
newItem.ContentCount = this.TotalCount;
AddItem(tree, newItem, null, callbackFunctionName);
if (nodes != undefined && nodes != null) {
......@@ -586,9 +586,10 @@ function TreeViewIndex() {
this.TotalCount = 0;
this.IsShowTotal = true;
this.CategoryTagName = "span";
this.treeViewType = "index"; //#19124 コンテンツ閲覧のインデックスでページ移動しなくなった対応のため
this.Show = function (containerId, nodes, callbackFunctionName) {
var tree = this;
tree.Id = containerId;
tree.Id = containerId;
if (nodes != undefined && nodes != null) {
for (var nIndex = 0; nIndex < nodes.length; nIndex++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment