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

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

/**
 * @projectDescription	View controller for ONT's "Find Terms" tab.
 * @inherits 	i2b2.ONT.view
 * @namespace	i2b2.ONT.view.find
 * @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 > Find');
console.time('execute time');


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


// redefine the option functions
// ================================================================================================== //
i2b2.ONT.view.find.showOptions = function(subScreen) {
	if (!this.modalOptions) {
		var handleSubmit = function() {
			// submit value(s)
			var value = $('ONTFINDMaxQryDisp').value;
			if(!isNaN(value) && parseInt(Number(value)) == value && !isNaN(parseInt(value, 10))){
				if(this.submit()) {
					$('ONTFINDMaxQryDisp').style.border = "2px inset";
					i2b2.ONT.view['find'].params.max = parseInt($('ONTFINDMaxQryDisp').value,10);
					i2b2.ONT.view['find'].params.synonyms = $('ONTFINDshowSynonyms').checked;
					i2b2.ONT.view['find'].params.hiddens = $('ONTFINDshowHiddens').checked;
				}
			} else {
				alert('Please enter a valid number for Maximum Children to Display.');
				$('ONTFINDMaxQryDisp').style.border = "2px inset red";
			}
		}
		var handleCancel = function() {
			this.cancel();
		}
		this.modalOptions = new YAHOO.widget.SimpleDialog("optionsOntFind",
		{ width : "400px", 
			fixedcenter : true,
			constraintoviewport : true,
			modal: true,
			zindex: 700,
			buttons : [ { text:"OK", handler:handleSubmit, isDefault:true }, 
				    { text:"Cancel", handler:handleCancel } ] 
		} ); 
		$('optionsOntFind').show();
		this.modalOptions.validate = function() {
			if (parseInt($('ONTFINDMaxQryDisp').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['find'].params.max = parseInt($('ONTFINDMaxQryDisp').value,10);
	i2b2.ONT.view['find'].params.synonyms = $('ONTFINDshowSynonyms').checked;
	i2b2.ONT.view['find'].params.hiddens = $('ONTFINDshowHiddens').checked;

	//$('ONTFINDMaxQryDisp').value = this.params.max;
	//$('ONTFINDshowSynonyms').checked = parseBoolean(this.params.synonyms);
	//$('ONTFINDshowHiddens').checked = parseBoolean(this.params.hiddens);			
}


// ================================================================================================== //
i2b2.ONT.view.find.showView = function() {
	$('tabFind').addClassName('active');
	$('ontFindDisp').style.display = 'block';
}

// ================================================================================================== //
i2b2.ONT.view.find.hideView = function() {
	$('tabFind').removeClassName('active');
	$('ontFindDisp').style.display = 'none';
}

// ================================================================================================== //
i2b2.ONT.view.find.selectSubTab = function(tabCode) {
	// toggle between the Navigate and Find Terms tabs
	switch (tabCode) {
		case "names":
			this.currentTab = 'names';
			$('ontFindTabName').blur();
			$('ontFindTabName').className = 'findSubTabSelected';
			$('ontFindTabCode').className = 'findSubTab';
			$('ontFindFrameName').show();
			$('ontFindFrameCode').hide();
			$('ontSearchNamesResults').show();
			$('ontSearchCodesResults').hide();
		break;
		case "codes":
			this.currentTab = 'codes';
			$('ontFindTabCode').blur();
			$('ontFindTabName').className = 'findSubTab';
			$('ontFindTabCode').className = 'findSubTabSelected';
			$('ontFindFrameModifier').hide();
			//$('ontSearchModifiersResults').hide();			
			$('ontFindFrameName').hide();
			$('ontFindFrameCode').show();
			$('ontSearchNamesResults').hide();
			$('ontSearchCodesResults').show();
		break;
	}
}

// ================================================================================================== //
i2b2.ONT.view.find.PopulateCategories = function() {		
	// insert the categories option list
	var tns = $('ontFindCategory');
	// clear the list first
	while( tns.hasChildNodes() ) { tns.removeChild( tns.lastChild ); }
	// add the default option
	//Load from HTML
	i2b2.ONT.view['find'].params.max = parseInt($('ONTFINDMaxQryDisp').value,10);
	i2b2.ONT.view['find'].params.synonyms = $('ONTFINDshowSynonyms').checked;
	i2b2.ONT.view['find'].params.hiddens = $('ONTFINDshowHiddens').checked;

	var tno = document.createElement('OPTION');
	tno.setAttribute('value', '[[[ALL]]]');
	var tnt = document.createTextNode('Any Category');
	tno.appendChild(tnt);
	tns.appendChild(tno);		
	// populate the Categories from the data model
	for (var i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy