Commit dd73f008 by Masaru Abe

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

parent 4bb01134
......@@ -16,6 +16,13 @@
//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($) {
// TODO rewrite as a widget, removing all the extra plugins
......@@ -294,6 +301,7 @@ function TreeNode() {
function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFunction) {
var branches;
var scriptCallback = "";
var tmpClass = JQ_TREEVIEW.CLASS_FOLDER;
if (callbackFunction != undefined && callbackFunction != null) {
......@@ -307,44 +315,60 @@ function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFun
}
if (targetTreeNode != undefined && targetTreeNode != null) {
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 + "'>" +
"</ul></li>").appendTo("#" + targetTreeNode.Id);
}
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);
}
}
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 + "'>" +
"</ul></li>").appendTo("#" + targetTreeNode.Id);
}
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);
}
}
}
else {
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 + "'>" +
"</ul></li>").appendTo("#" + targetTreeView.Id);
}
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);
}
}
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 + "'>" +
"</ul></li>").appendTo("#" + targetTreeView.Id);
}
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);
}
}
......@@ -362,8 +386,8 @@ function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFun
// Add item
function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFunction) {
var branches;
var scriptCallback = "";
var tmpClass = JQ_TREEVIEW.CLASS_FILE;
if (callbackFunction != undefined && callbackFunction != null) {
scriptCallback += ' id="' + sourceTreeNodeItem.Id + '"';
......@@ -379,28 +403,46 @@ function AddItem(targetTreeView, sourceTreeNodeItem, targetTreeNode, callbackFun
if (targetTreeNode != undefined && targetTreeNode != null) {
// 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);
}
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 {
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);
}
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 + '"';
}
tmpClass = JQ_TREEVIEW.CLASS_FILE_ZERO;
}
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='" + tmpClass + " lang root' lang='txtAll'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + "></li>").appendTo("#" + targetTreeView.Id);
}
}
else { // Node of root but not be "all node"
if (targetTreeView.IsShowTotal == true) {
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 {
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='file'" + scriptCallback + ">" + sourceTreeNodeItem.Text + "</" + targetTreeView.CategoryTagName + "></li>").appendTo("#" + targetTreeView.Id);
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);
}
}
}
......@@ -520,6 +562,7 @@ function TreeView() {
newItem.Id = "all";
newItem.IsCategory = false;
newItem.ContentCount = this.TotalCount;
AddItem(tree, newItem, null, callbackFunctionName);
if (nodes != undefined && nodes != null) {
......
......@@ -71,6 +71,18 @@ a:hover{
cursor: pointer;
}
.folderZero, .fileZero{
padding-left: 5px;
}
a.folderZero:hover{
cursor: default;
}
a.fileZero:hover{
cursor: default;
}
.sectionhomebookshelf a.name{ }
/* hibiya */
......
......@@ -62,6 +62,10 @@
font-size: 12px;
text-decoration: none;
}
/*
.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_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