Commit dd73f008 by Masaru Abe

カテゴリ/グループツリー表示で該当件数が0件なら選択出来ないようにする対応

parent 4bb01134
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
//Add custom i18n.js //Add custom i18n.js
//名前空間用のオブジェクトを用意する
var JQ_TREEVIEW = {};
JQ_TREEVIEW.CLASS_FOLDER = "folder";
JQ_TREEVIEW.CLASS_FOLDER_ZERO = "folderZero";
JQ_TREEVIEW.CLASS_FILE = "file";
JQ_TREEVIEW.CLASS_FILE_ZERO = "fileZero";
;(function($) { ;(function($) {
// TODO rewrite as a widget, removing all the extra plugins // TODO rewrite as a widget, removing all the extra plugins
...@@ -294,67 +301,84 @@ function TreeNode() { ...@@ -294,67 +301,84 @@ function TreeNode() {
function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFunction) { function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFunction) {
var branches; var branches;
var scriptCallback = ""; var scriptCallback = "";
var tmpClass = JQ_TREEVIEW.CLASS_FOLDER;
if (callbackFunction != undefined && callbackFunction != null) { if (callbackFunction != undefined && callbackFunction != null) {
scriptCallback += ' onclick="'; scriptCallback += ' onclick="';
scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNode.Id + "'; currNode.Text = '" + sourceTreeNode.Text + "';"; scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNode.Id + "'; currNode.Text = '" + sourceTreeNode.Text + "';";
scriptCallback += "currNode.Value = '" + sourceTreeNode.Value + "'; currNode.Tooltip = '" + sourceTreeNode.Tooltip + "'; currNode.IsClosed = " + sourceTreeNode.IsClosed + ";"; scriptCallback += "currNode.Value = '" + sourceTreeNode.Value + "'; currNode.Tooltip = '" + sourceTreeNode.Tooltip + "'; currNode.IsClosed = " + sourceTreeNode.IsClosed + ";";
scriptCallback += "currNode.IsCategory = " + sourceTreeNode.IsCategory + ";"; scriptCallback += "currNode.IsCategory = " + sourceTreeNode.IsCategory + ";";
scriptCallback += callbackFunction + "(currNode);"; scriptCallback += callbackFunction + "(currNode);";
scriptCallback += '"'; scriptCallback += '"';
} }
if (targetTreeNode != undefined && targetTreeNode != null) { if (targetTreeNode != undefined && targetTreeNode != null) {
if (sourceTreeNode.IsClosed == true) { // Collapse if (sourceTreeNode.IsClosed == true) { // Collapse
if (targetTreeView.IsShowTotal == true) { // Show total count if (targetTreeView.IsShowTotal == true && sourceTreeNode.ContentCount > 0) { // Show total count
branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder' " + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" + branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder' " + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeNode.Id); "</ul></li>").appendTo("#" + targetTreeNode.Id);
} }
else { else {
branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder' " + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" + if(sourceTreeNode.ContentCount == 0){
scriptCallback = "";
tmpClass = JQ_TREEVIEW.CLASS_FOLDER_ZERO;
}
branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='" + tmpClass + "' " + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeNode.Id); "</ul></li>").appendTo("#" + targetTreeNode.Id);
} }
} }
else { else {
if (targetTreeView.IsShowTotal == true) { // Show total count if (targetTreeView.IsShowTotal == true && sourceTreeNode.ContentCount > 0) { // Show total count
branches = $("<li ><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" + branches = $("<li ><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeNode.Id); "</ul></li>").appendTo("#" + targetTreeNode.Id);
} }
else { else {
branches = $("<li ><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" + if(sourceTreeNode.ContentCount == 0){
scriptCallback = "";
tmpClass = JQ_TREEVIEW.CLASS_FOLDER_ZERO;
}
branches = $("<li ><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='" + tmpClass + "'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeNode.Id); "</ul></li>").appendTo("#" + targetTreeNode.Id);
} }
} }
} }
else { else {
if (sourceTreeNode.IsClosed == true) { // Collapse if (sourceTreeNode.IsClosed == true) { // Collapse
if (targetTreeView.IsShowTotal == true) { // Show total count if (targetTreeView.IsShowTotal == true && sourceTreeNode.ContentCount > 0) { // Show total count
branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" + branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeView.Id); "</ul></li>").appendTo("#" + targetTreeView.Id);
} }
else { else {
branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" + if(sourceTreeNode.ContentCount == 0){
scriptCallback = "";
tmpClass = JQ_TREEVIEW.CLASS_FOLDER_ZERO;
}
branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='" + tmpClass + "'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeView.Id); "</ul></li>").appendTo("#" + targetTreeView.Id);
} }
} }
else { else {
if (targetTreeView.IsShowTotal == true) { // Show total count if (targetTreeView.IsShowTotal == true && sourceTreeNode.ContentCount > 0) { // Show total count
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" + branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeView.Id); "</ul></li>").appendTo("#" + targetTreeView.Id);
} }
else { else {
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" + if(sourceTreeNode.ContentCount == 0){
scriptCallback = "";
tmpClass = JQ_TREEVIEW.CLASS_FOLDER_ZERO;
}
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='" + tmpClass + "'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + "><ul id='" + sourceTreeNode.Id + "'>" +
"</ul></li>").appendTo("#" + targetTreeView.Id); "</ul></li>").appendTo("#" + targetTreeView.Id);
} }
} }
} }
if (sourceTreeNode.ExpandAfterBuild == true) { if (sourceTreeNode.ExpandAfterBuild == true) {
// Add node to expand after build treeview // Add node to expand after build treeview
targetTreeView.ExpandNodes.push(sourceTreeNode.Id); targetTreeView.ExpandNodes.push(sourceTreeNode.Id);
} }
/*$("#" + targetTreeView.Id).treeview({ /*$("#" + targetTreeView.Id).treeview({
add: branches add: branches
});*/ });*/
...@@ -362,49 +386,67 @@ function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFun ...@@ -362,49 +386,67 @@ function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFun
// Add item // Add item
function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFunction) { function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFunction) {
var branches; var branches;
var scriptCallback = ""; var scriptCallback = "";
var tmpClass = JQ_TREEVIEW.CLASS_FILE;
if (callbackFunction != undefined && callbackFunction != null) { if (callbackFunction != undefined && callbackFunction != null) {
scriptCallback += ' id="' + sourceTreeNodeItem.Id + '"'; scriptCallback += ' id="' + sourceTreeNodeItem.Id + '"';
scriptCallback += ' onclick="'; scriptCallback += ' onclick="';
//scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "'; currNode.Text = '" + sourceTreeNodeItem.Text + "';"; //scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "'; currNode.Text = '" + sourceTreeNodeItem.Text + "';";
scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "';"; scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "';";
scriptCallback += "currNode.Value = '" + sourceTreeNodeItem.Value + "'; currNode.Tooltip = '" + sourceTreeNodeItem.Tooltip + "'; currNode.IsClosed = " + sourceTreeNodeItem.IsClosed + ";"; scriptCallback += "currNode.Value = '" + sourceTreeNodeItem.Value + "'; currNode.Tooltip = '" + sourceTreeNodeItem.Tooltip + "'; currNode.IsClosed = " + sourceTreeNodeItem.IsClosed + ";";
scriptCallback += "currNode.IsCategory = " + sourceTreeNodeItem.IsCategory + ";"; scriptCallback += "currNode.IsCategory = " + sourceTreeNodeItem.IsCategory + ";";
scriptCallback += callbackFunction + "(currNode);"; scriptCallback += callbackFunction + "(currNode);";
scriptCallback += '"'; scriptCallback += '"';
} }
if (targetTreeNode != undefined && targetTreeNode != null) { if (targetTreeNode != undefined && targetTreeNode != null) {
// Nodes of root // Nodes of root
if (targetTreeView.IsShowTotal == true) { if (targetTreeView.IsShowTotal == true && sourceTreeNodeItem.ContentCount > 0) {
branches = $("<li><" + targetTreeView.CategoryTagName + " class='file'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNodeItem.ContentCount + ")</li>").appendTo("#" + targetTreeNode.Id); branches = $("<li><" + targetTreeView.CategoryTagName + " class='file'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNodeItem.ContentCount + ")</li>").appendTo("#" + targetTreeNode.Id);
} }
else { else {
branches = $("<li><" + targetTreeView.CategoryTagName + " class='file'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;</li>").appendTo("#" + targetTreeNode.Id); if(sourceTreeNodeItem.ContentCount == 0){
if (callbackFunction != undefined && callbackFunction != null) {
scriptCallback = ' id="' + sourceTreeNodeItem.Id + '"';
}
tmpClass = JQ_TREEVIEW.CLASS_FILE_ZERO;
}
branches = $("<li><" + targetTreeView.CategoryTagName + " class='" + tmpClass + "'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;</li>").appendTo("#" + targetTreeNode.Id);
} }
} }
else { else {
if (sourceTreeNodeItem.Id == "all") { // All nodes if (sourceTreeNodeItem.Id == "all") { // All nodes
if (targetTreeView.IsShowTotal == true) { if (targetTreeView.IsShowTotal == true && targetTreeView.TotalCount > 0) {
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='file lang root' lang='txtAll'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + targetTreeView.TotalCount + ")</li>").appendTo("#" + targetTreeView.Id); branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='file lang root' lang='txtAll'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + targetTreeView.TotalCount + ")</li>").appendTo("#" + targetTreeView.Id);
} }
else { else {
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='file lang root' lang='txtAll'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + "></li>").appendTo("#" + targetTreeView.Id); if(targetTreeView.TotalCount == 0){
} if (callbackFunction != undefined && callbackFunction != null) {
} scriptCallback = ' id="' + sourceTreeNodeItem.Id + '"';
else { // Node of root but not be "all node" }
if (targetTreeView.IsShowTotal == true) { tmpClass = JQ_TREEVIEW.CLASS_FILE_ZERO;
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='file'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNodeItem.ContentCount + ")</li>").appendTo("#" + targetTreeView.Id); }
} branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='" + tmpClass + " lang root' lang='txtAll'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + "></li>").appendTo("#" + targetTreeView.Id);
else { }
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='file'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + "></li>").appendTo("#" + targetTreeView.Id); }
} else { // Node of root but not be "all node"
} if (targetTreeView.IsShowTotal == true && sourceTreeNodeItem.TotalCount > 0) {
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='file'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNodeItem.ContentCount + ")</li>").appendTo("#" + targetTreeView.Id);
}
else {
if(sourceTreeNodeItem.TotalCount == 0){
if (callbackFunction != undefined && callbackFunction != null) {
scriptCallback = ' id="' + sourceTreeNodeItem.Id + '"';
}
tmpClass = JQ_TREEVIEW.CLASS_FILE_ZERO;
}
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='" + tmpClass + "'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + "></li>").appendTo("#" + targetTreeView.Id);
}
}
} }
/*$("#" + targetTreeView.Id).treeview({ /*$("#" + targetTreeView.Id).treeview({
add: branches add: branches
});*/ });*/
...@@ -520,6 +562,7 @@ function TreeView() { ...@@ -520,6 +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) {
......
...@@ -71,6 +71,18 @@ a:hover{ ...@@ -71,6 +71,18 @@ a:hover{
cursor: pointer; cursor: pointer;
} }
.folderZero, .fileZero{
padding-left: 5px;
}
a.folderZero:hover{
cursor: default;
}
a.fileZero:hover{
cursor: default;
}
.sectionhomebookshelf a.name{ } .sectionhomebookshelf a.name{ }
/* hibiya */ /* hibiya */
......
...@@ -62,6 +62,10 @@ ...@@ -62,6 +62,10 @@
font-size: 12px; font-size: 12px;
text-decoration: none; text-decoration: none;
} }
/*
.tabUnit .tabUnitList ul li a:hover{ text-decoration:underline;} .tabUnit .tabUnitList ul li a:hover{ text-decoration:underline;}
*/
.tabUnit .tabUnitList ul li a.folder:hover{ text-decoration:underline;}
.tabUnit .tabUnitList ul li a.file:hover{ text-decoration:underline;}
.sankaku_left{ } .sankaku_left{ }
.sankaku_right{ } .sankaku_right{ }
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