messageBox.show = function(infoNodeId, PositionNodeId) {
var title = jstree().messageBoxTitle(infoNodeId);
var content = jstree().messageBoxText(infoNodeId, PositionNodeId);
};
//------
contextMenu.delete_node = function(node) {
this.popupMessage.show(node.id, node.id);
this.popupMessage.loading.done(function(){
jstree().CompleteDeleteNode();
});
};
contexeMenu.move_node = function(node, parent, old_parent) {
this.popupMessage.show(node.id, parent.id);
this.popupMessage.loading.done(function(){
jstree().CompleteMoveNode();
});
this.popupMessage.loading.fail(function(msg){
jstree().ResetMoveNodeStatus();
});
};
//-------
var jstree = {};
jstree.messageBoxText = function(InfoNodeID, PositinNodeID) {
var InfoNode = this.get_node(InfoNodeID);
var PositionNode = this.get_node(PositionNodeID);
if (InfoNode.type == 'sample') {
var totalSample = 0;
$.ajax({
url: "json/getFastqInfo",
async: false,
data: { id: InfoNodeID },
type: "post",
error: function(e) {
alertHttpStatus(e);
},
success: function( data ) {
totalSample = data.fastqList.length;
}
});
return InfoNode.text+' contains '+totalSample+' fastq files';
} else {
var child = PositionNode.children_d;
var ar = [];
for(child) {
ar.push('X folders');
}
return InfoNode.text+' contains '+ar.join(", ");
}
};
jstree.messageBoxTitle = function(InfoNodeID, operation) {
var InfoNode = this.get_node(InfoNodeID);
if (operation == 'move_node') {
return "Are you sure you want to move "+InfoNode.type+
" <span style='font-weight:bold;font-style: italic'>"+InfoNode.text+
"</span> to <span style='font-weight:bold;font-style: italic'>"+
targetFolderPath.join(" / ")+"</span> ?";
} else {
return "Are you sure you want to delete "+InfoNode.type+" "+InfoNode.text+" ?";
}
};