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,67 +301,84 @@ function TreeNode() {
function AddCategory(targetTreeView, sourceTreeNode, targetTreeNode, callbackFunction) {
var branches;
var scriptCallback = "";
var tmpClass = JQ_TREEVIEW.CLASS_FOLDER;
if (callbackFunction != undefined && callbackFunction != null) {
scriptCallback += ' onclick="';
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.IsCategory = " + sourceTreeNode.IsCategory + ";";
scriptCallback += callbackFunction + "(currNode);";
scriptCallback += '"';
scriptCallback += ' onclick="';
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.IsCategory = " + sourceTreeNode.IsCategory + ";";
scriptCallback += callbackFunction + "(currNode);";
scriptCallback += '"';
}
if (targetTreeNode != undefined && targetTreeNode != null) {
if (sourceTreeNode.IsClosed == true) { // Collapse
if (targetTreeView.IsShowTotal == true) { // 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 + "'>" +
if (sourceTreeNode.IsClosed == true) { // Collapse
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 + "'>" +
}
else {
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
branches = $("<li ><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" +
}
}
else {
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 + "'>" +
}
else {
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
branches = $("<li class='closed'><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" +
if (sourceTreeNode.IsClosed == true) { // Collapse
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 + "'>" +
}
else {
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
branches = $("<li><" + targetTreeView.CategoryTagName + " style='padding-left: 5px;' class='folder'" + scriptCallback + ">" + sourceTreeNode.Text + "</" + targetTreeView.CategoryTagName + ">&nbsp;(" + sourceTreeNode.ContentCount + ")<ul id='" + sourceTreeNode.Id + "'>" +
}
}
else {
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 + "'>" +
}
else {
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);
}
}
}
}
}
if (sourceTreeNode.ExpandAfterBuild == true) {
// Add node to expand after build treeview
targetTreeView.ExpandNodes.push(sourceTreeNode.Id);
}
/*$("#" + targetTreeView.Id).treeview({
add: branches
});*/
......@@ -362,49 +386,67 @@ 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 + '"';
scriptCallback += ' onclick="';
//scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "'; currNode.Text = '" + sourceTreeNodeItem.Text + "';";
scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "';";
scriptCallback += "currNode.Value = '" + sourceTreeNodeItem.Value + "'; currNode.Tooltip = '" + sourceTreeNodeItem.Tooltip + "'; currNode.IsClosed = " + sourceTreeNodeItem.IsClosed + ";";
scriptCallback += "currNode.IsCategory = " + sourceTreeNodeItem.IsCategory + ";";
scriptCallback += callbackFunction + "(currNode);";
scriptCallback += '"';
scriptCallback += ' id="' + sourceTreeNodeItem.Id + '"';
scriptCallback += ' onclick="';
//scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "'; currNode.Text = '" + sourceTreeNodeItem.Text + "';";
scriptCallback += "var currNode = new TreeNode(); currNode.Id = '" + sourceTreeNodeItem.Id + "';";
scriptCallback += "currNode.Value = '" + sourceTreeNodeItem.Value + "'; currNode.Tooltip = '" + sourceTreeNodeItem.Tooltip + "'; currNode.IsClosed = " + sourceTreeNodeItem.IsClosed + ";";
scriptCallback += "currNode.IsCategory = " + sourceTreeNodeItem.IsCategory + ";";
scriptCallback += callbackFunction + "(currNode);";
scriptCallback += '"';
}
if (targetTreeNode != undefined && targetTreeNode != null) {
// Nodes of root
if (targetTreeView.IsShowTotal == true) {
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);
// Nodes of root
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 {
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) {
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);
}
}
else { // Node of root but not be "all node"
if (targetTreeView.IsShowTotal == true) {
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.Id == "all") { // All nodes
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 {
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 && 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({
add: branches
});*/
......@@ -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