All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webclient.js-i2b2.cells.ONT.ONT_view_Nav.js Maven / Gradle / Ivy

/**
 * @projectDescription	View controller for ONT's "Navigate Terms" tab.
 * @inherits 	i2b2.ONT.view
 * @namespace	i2b2.ONT.view.nav
 * @author		Nick Benik, Griffin Weber MD PhD
 * @version 	1.3
 * ----------------------------------------------------------------------------------------
 * updated 9-15-08: RC4 launch [Nick Benik] 
 */
console.group('Load & Execute component file: ONT > view > Nav');
console.time('execute time');


// create and save the view object
i2b2.ONT.view.nav = new i2b2Base_cellViewController(i2b2.ONT, 'nav');
i2b2.ONT.view.nav.visible = false;
i2b2.ONT.view.nav.modifier = false; 


// define the option functions
// ================================================================================================== //
i2b2.ONT.view.nav.showOptions = function(subScreen) {
	if (!this.modalOptions) {
		var handleSubmit = function() {
			// submit value(s)
			var value = $('ONTNAVMaxQryDisp').value;
			if(!isNaN(value) && parseInt(Number(value)) == value && !isNaN(parseInt(value, 10))){
				if(this.submit()) {
					$('ONTNAVMaxQryDisp').style.border = "2px inset";
					i2b2.ONT.view['nav'].params.max = parseInt($('ONTNAVMaxQryDisp').value,10);
					i2b2.ONT.view['nav'].params.synonyms = $('ONTNAVshowSynonyms').checked;
					i2b2.ONT.view['nav'].params.hiddens = $('ONTNAVshowHiddens').checked;
					i2b2.ONT.view['nav'].params.modifiers = $('ONTNAVdisableModifiers').checked;
					i2b2.ONT.view.nav.doRefreshAll();
				}
			} else {
				alert('Please enter a valid number for Maximum Children to Display.');
				$('ONTNAVMaxQryDisp').style.border = "2px inset red";
			}
		}
		var handleCancel = function() {
			this.cancel();
		}
		this.modalOptions = new YAHOO.widget.SimpleDialog("optionsOntNav",
		{ width : "400px", 
			fixedcenter : true, 
			constraintoviewport : true, 
			modal: true,
			zindex: 700,
			buttons : [ { text:"OK", handler:handleSubmit, isDefault:true }, 
				    { text:"Cancel", handler:handleCancel } ] 
		} ); 
		$('optionsOntNav').show();
		this.modalOptions.validate = function() {
			if (parseInt($('ONTNAVMaxQryDisp').value,10) <= 0) {
				alert('You must display at least one child!');
				return false;
			}
			return true;
		};
		this.modalOptions.render(document.body);
	}
	this.modalOptions.show();
	// load settings from html
	i2b2.ONT.view['nav'].params.max = parseInt($('ONTNAVMaxQryDisp').value,10);
	i2b2.ONT.view['nav'].params.synonyms = $('ONTNAVshowSynonyms').checked;
	i2b2.ONT.view['nav'].params.hiddens = $('ONTNAVshowHiddens').checked;
	i2b2.ONT.view['nav'].params.modifiers = $('ONTNAVdisableModifiers').checked;

	//$('ONTNAVMaxQryDisp').value = this.params.max;
	//$('ONTNAVshowSynonyms').checked = parseBoolean(this.params.synonyms);
	//$('ONTNAVshowHiddens').checked = parseBoolean(this.params.hiddens);		
}

// ================================================================================================== //
i2b2.ONT.view.nav.showView = function() {
	$('tabNavigate').addClassName('active'); 
	$('ontNavDisp').style.display = 'block';
}

// ================================================================================================== //
i2b2.ONT.view.nav.hideView = function() {
	$('tabNavigate').removeClassName('active');
	$('ontNavDisp').style.display = 'none';
}

// ================================================================================================== //
i2b2.ONT.view.nav.ToggleNode = function(divTarg, divTreeID) {
	// get the i2b2 data from the yuiTree node
	var tvTree = YAHOO.widget.TreeView.findTreeByChildDiv(divTarg.id);
	var tvNode = tvTree.getNodeByProperty('nodeid', divTarg.id);
	tvNode.toggle();
}

// ================================================================================================== //
i2b2.ONT.view.nav.PopulateCategories = function() {		
	// insert the categories nodes into the Nav Treeview
	console.info("Populating Nav treeview with Categories");
	if (!this.yuiTree) { 
		console.error("YUI Treeview not set");
		return false; 
	}
	var tvRoot = this.yuiTree.getRoot();
	// clear the data first
	this.yuiTree.removeChildren(tvRoot);
	// populate the Categories from the data model
	
	i2b2.ONT.view['nav'].params.max = parseInt($('ONTNAVMaxQryDisp').value,10);
	i2b2.ONT.view['nav'].params.synonyms = $('ONTNAVshowSynonyms').checked;
	i2b2.ONT.view['nav'].params.hiddens = $('ONTNAVshowHiddens').checked;
	i2b2.ONT.view['nav'].params.modifiers = $('ONTNAVdisableModifiers').checked;

	for (var i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy