Commit 4572291a by agentec

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

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