Select a plugin to load from the "Plugins" window.
Query Tool Options
Maximum Time to Wait for XML Response (in seconds):
Options for "Previous Queries" Window
Maximum Number of Queries to Display:
Sort Queries
By Name
By Create Date
Ascending
Descending
Options for Navigating Terms
Maximum Number of Children to Display:
Show Hidden Terms
Show Synonymous Terms
Enable Patient Counts
Use Short Tooltips
Show Concept Codes in Tooltips
Disable Modifiers
Options for Finding Terms
Maximum Number of Children to Display:
Show Hidden Terms
Show Synonymous Terms
Enable Patient Counts
Use Short Tooltips
Show Concept Codes in Tooltips
Disable Modifiers
Constrain Group by Date Range
From:
To:
Constrain Group by Number of Occurances
Event(s) within the group occur more than
times.
Only use FIRST financial encounter in which the event(s) occur.
Only use LAST financial encounter in which the event(s) occur.
Application of relevance for text searches only
Percent of the matching documents which should be returned where documents with the highest relevance will be returned first.
100%
Temporal Interval Limits
This group must occur
At least
after the previous group.
No more than
after the previous group.
At least
before the next group.
No more than
before the next group.
Lab Range Constraint
No value
By flag
By value
Please select a range:
Please select operator:
Please select operator:
Please enter a value:
Please enter values:
-
Enter Search Text:
Use Database Operators (Advanced Searching)
Please select a value:
Click on a bar segment to help specify a value or range:
';
i2b2.CRC.ajax.getQueryResultInstanceList_fromQueryInstanceId("CRC:QueryTool", {qi_key_value: qi_id}, scopedCallbackQRS);
}
}
}
// this is a private function that is used by all QueryStatus object instances to check their status
// callback processor to check the Query Instance
var scopedCallbackQRSI = new i2b2_scopedCallback();
scopedCallbackQRSI.scope = this;
scopedCallbackQRSI.callback = function(results) {
if (results.error) {
alert(results.errorMsg);
return;
} else {
// find our query instance
var ri_list = results.refXML.getElementsByTagName('query_result_instance');
var l = ri_list.length;
for (var i=0; i" + description + "
";
}
var crc_xml = results.refXML.getElementsByTagName('crc_xml_result');
l = crc_xml.length;
for (var i=0; i";
$('infoQueryStatusText').innerHTML += "
";
Row = Row + Cell;
if(QueryReportWin)
jQuery("#temporalQryEventsContainerTable",QueryReportWin.document).append(Row);
if(QueryReportDiv)
jQuery("#temporalQryEventsContainerTable").append(Row);
if(QueryReportWin)
jQuery("#temporalQryEventsContainerTable",QueryReportWin.document).append(qdDescription);
if(QueryReportDiv)
jQuery("#temporalQryEventsContainerTable").append(qdDescription);
}
catch(e)
{
console.error(e);
}
}
//Populate temporal query events relation section
if(this.queryPanelObjForPrinting.subQryStructure && this.queryPanelObjForPrinting.subQryStructure.length>0){
var temporalQEventsRelTable = null;
if(QueryReportWin)
temporalQEventsRelTable = QueryReportWin.document.getElementById("temporalQryEventsRelationsTable");
if(QueryReportDiv)
temporalQEventsRelTable = $("temporalQryEventsRelationsTable");
try{
var qdDescription = this.getTemporalQueryEventRelations(temporalQEventsRelTable);
}
catch(e)
{
console.error(e);
}
}
if(!previewQueryOnly){
//Populate the query results section
var resultsArray = i2b2.CRC.view.graphs.parseInputIntoArray(i2b2.CRC.ctrlr.currentQueryResults.resultString, true);
if(resultsArray && resultsArray.length>0){
try{
if(QueryReportWin)
this.createResultsForPrint(resultsArray,QueryReportWin);
else{
this.createResultsForPrint(resultsArray,false);
}
}
catch(e)
{
console.error(e);
}
}
else // There is no results, so no need to show Query Results section
{
var resultTitleDiv = null;
if(QueryReportWin)
resultTitleDiv = QueryReportWin.document.getElementById("qrsTitle");
if(QueryReportDiv)
resultTitleDiv = $("qrsTitle");
if(resultTitleDiv){
resultTitleDiv.parentNode.removeChild(resultTitleDiv);
}
}
}
else // This window is to only show the query structure preview, so no need to show Query Results section
{
var resultTitleDiv = null;
if(QueryReportWin)
resultTitleDiv = QueryReportWin.document.getElementById("qrsTitle");
if(QueryReportDiv)
resultTitleDiv = $("qrsTitle");
if(resultTitleDiv){
resultTitleDiv.parentNode.removeChild(resultTitleDiv);
}
}
var loaderDiv = null;
if(QueryReportWin)
loaderDiv = QueryReportWin.document.getElementById("QueryReportLoading");
if(QueryReportDiv){
// if(browserIsIE && printFromId)
loaderDiv = jQuery(QueryReportDiv).find('#QueryReportLoading');
// else
// loaderDiv = jQuery("#infoQueryStatusReport #QueryReportLoading");
}
if(loaderDiv)
jQuery(loaderDiv).addClass("no-show");
var resultsDiv = null;
if(QueryReportWin)
resultsDiv = QueryReportWin.document.getElementById("QueryReportContainer");
if(QueryReportDiv){
// if(browserIsIE && printFromId)
resultsDiv = jQuery(QueryReportDiv).find('#QueryReportContainer');
// else
// resultsDiv = $("#infoQueryStatusReport #QueryReportContainer");
}
if(resultsDiv)
jQuery(resultsDiv).removeClass("no-show");
if(browserIsIE && previewQueryOnly)
{
// this.PrintElem();
// jQuery(resultsDiv).html(savedHTML);
}
}
else{
alert("Currently no query is available for printing. \nPlease generate a query before clicking on [Print Query] button.");
}
};
this.getQueryDetails = function(queryObj,query_user_id,previewQueryOnly,QueryReportWin,objId){
var username = this.getQueryUserFullName(query_user_id);
var instanceRec = this.QI_Rec_ForPrinting;
var dateInfoProvided = false;
var diff = "";
var text = "";
var qrNameNotProvided = false;
if(queryObj.name.length <= 0){
text = 'No Query Name is currently provided';
qrNameNotProvided = true;
}
else{
if(previewQueryOnly)
text = 'The query is entitled "' + queryObj.name + '"';
else
text = 'The query entitled "' + queryObj.name ;
}
var formattedResObj = i2b2.CRC.ctrlr.currentQueryResults;
var resString = formattedResObj.resultString;
var computeTime = null;
if(resString.toLowerCase().indexOf("compute time")>0)
{
var textCompTime = resString.match(new RegExp("Compute Time" + "(.*)" + "\n"));
if(textCompTime.length>0)
{
var compText = textCompTime[0];
var splitcompText = compText.split(":");
if(splitcompText && splitcompText.length>1)
computeTime = splitcompText[1];
}
}
text = (qrNameNotProvided ? 'The query "' : '') + text +
'" was completed in '+ computeTime + '. This query was performed by "'+ username +'".';
if(QueryReportWin)
jQuery("#" + objId,QueryReportWin.document).append('
' + text.toString() + '
');
else
jQuery("#" + objId).append('
' + text.toString() + '
');
};
this.getQrTiming = function(queryObj,QueryReportWin,objId){
var tdText = "";
if(queryObj.timing)
{
switch(queryObj.timing)
{
case "ANY":
tdText = " Temporal Constraint: Treat All Groups Independently";
break;
case "SAMEVISIT":
tdText = " Temporal Constraint: Selected groups occur in the same financial encounter";
break;
case "TEMPORAL": //Temporal query
query_order = "Groups occur in the same sequence from left to right";
tdText = " Temporal Constraint: Population in which events occur";
}
if(QueryReportWin)
jQuery("#" + objId,QueryReportWin.document).append('
";
var panelNum = 0;
elemToAppend = elemToAppend + "
";
var tdObj = "
";
queryObj.each(function(queryData){
var andCounter = 0;
var subQryEventNameDisplayed = false;
queryData.each(function(panelData){
var orCounter = 0;
var numItemsInPanel = panelData.items.length;
var panelContdivObj = "
";
var PanelTableTrObj = "
";
var PanelTableTd1Obj = "
";
PanelTableTrObj = PanelTableTrObj + PanelTableTd1Obj;
var PanelTableTd2Obj = "
";
panelNum++ ;
var panelOperatorDivId = "PanelOp-" + panelNum;
var panelOperatorDiv = "
";
if(andCounter == 0){
andCounter++ ;
if (panelData.exclude)
{
panelOperatorDiv = panelOperatorDiv + "NOT";
panelContdivObj = panelContdivObj + " notOpPanel";
}
}
else
{
var text = "AND";
if (panelData.exclude)
{
text = "AND NOT";
panelContdivObj = panelContdivObj + " notOpPanel";
}
panelOperatorDiv = panelOperatorDiv + text;
andCounter++ ;
}
var panelItemDiv = "
";
var panelTiming = "";
switch(panelData.timing)
{
case "ANY":
panelTiming = "Independent of Visit";
break;
case "SAMEVISIT":
panelTiming = "Occurs in Same Encounter";
break;
case "SAMEINSTANCENUM":
panelTiming = "Items Instance will be the same";
break;
}
var panelDateFrom = "";
if(panelData.dateFrom)
{
if(panelData.dateFrom.Month && panelData.dateFrom.Day && panelData.dateFrom.Year)
panelDateFrom = panelData.dateFrom.Month + "/" + panelData.dateFrom.Day + "/" + panelData.dateFrom.Year;
else
{
panelDateFrom = panelData.dateFrom;
}
}
var panelDateTo = "";
if(panelData.dateTo)
{
if(panelData.dateTo.Month && panelData.dateTo.Day && panelData.dateTo.Year)
panelDateTo = panelData.dateTo.Month + "/" + panelData.dateTo.Day + "/" + panelData.dateTo.Year;
else
{
panelDateTo = panelData.dateTo;
}
}
var panelDateRangeText = "From earliest date available to latest date available";
if(panelData.dateFrom && panelData.dateTo)
{
if(panelDateFrom == "none")
panelDateFrom = "earliest date available";
if(panelDateTo == "none")
panelDateTo = "latest date available";
panelDateRangeText = "From " + panelDateFrom + " to " + panelDateTo;
}
else
{
if(panelDateFrom == "none")
panelDateFrom = "earliest date available";
if(panelDateTo == "none")
panelDateTo = "latest date available";
if(panelData.dateFrom && !panelData.dateTo)
panelDateRangeText = "From " + panelDateFrom + " to latest date available";
if(!panelData.dateFrom && panelData.dateTo)
panelDateRangeText = "From earliest date available to " + panelDateTo;
}
var panelItemOccurrenceText = "# of times an item is recorded is > " + panelData.occurs;
panelData.items.each(function(itemData){
var data = itemData;
if(!(typeof itemData.origData == 'undefined'))
data = itemData.origData;
var qrPanelItemTableObj = "
";
jQuery('#tablesContainer').append(content);
}
this.getQueryUserFullName = function(query_user_id)
{
var returnValue = query_user_id;
if(query_user_id)
{
try {
var response = i2b2.PM.ajax.getUser("CRC:PrintQueryNew", {user_id:query_user_id});
response.parse();
var data = response.model[0];
if (data.full_name) { returnValue = data.full_name;}
}
catch (e) {}
}
return returnValue;
};
function getSelectedValueFromOptions(options)
{
var value = null;
for(k = 0; k < options.length; k++) {
var thisOption = options[k];
if(thisOption.selected == true)
{
value = options[k].innerHTML;
break;
}
}
return value;
};
this.PrintElem = function(divIdToPrint)
{
// Popup(jQuery("#" + divToPrint).html());
if(jQuery("#" + divIdToPrint)){
var contents = jQuery("#" + divIdToPrint).html();
var frame1 = jQuery("");
frame1[0].name = "frame1";
frame1.css({ "position": "absolute", "top": "-1000000px" });
jQuery("body").append(frame1);
var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument;
frameDoc.document.open();
//Create a new HTML document.
frameDoc.document.write("Query Report");
//Append the external CSS file.
frameDoc.document.write("");
frameDoc.document.write('');
frameDoc.document.write("");
//Append the DIV contents.
frameDoc.document.write(contents);
frameDoc.document.write('');
frameDoc.document.close();
setTimeout(function () {
window.frames["frame1"].focus();
window.frames["frame1"].print();
frame1.remove();
}, 500);
}
else
alert("Query report can't be printed!");
};
/**********************
* End Query Report BG
**********************/
}
console.timeEnd('execute time');
console.groupEnd();
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_ENS.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_ENS.js
index e71efa662..d36ea2fbc 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_ENS.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_ENS.js
@@ -1,455 +1,452 @@
/**
* @projectDescription The SDX controller library for the PatientRecordSet data-type.
* @namespace i2b2.sdx.TypeControllers.ENS
* @inherits i2b2.sdx.TypeControllers
* @author Mike Mendis
* @version 1.6
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
*/
console.group('Load & Execute component file: CRC > SDX > Encounter Record Set');
console.time('execute time');
i2b2.sdx.TypeControllers.ENS = {};
i2b2.sdx.TypeControllers.ENS.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'ENS', sdxKeyName: 'result_instance_id', sdxControlCell:'CRC', sdxDisplayNameKey: 'title'};
}
i2b2.sdx.TypeControllers.ENS.SaveToDataModel = function(sdxData, sdxParentNode) {
// save to CRC data model
if (!sdxParentNode) { return false; }
var qm_id = sdxData.sdxInfo.sdxKeyValue;
var qm_hash = i2b2.sdx.Master._KeyHash(qm_id);
// class for all SDX communications
function i2b2_SDX_Encapsulation_EXTENDED() {}
// create an instance and populate with info
var t = new i2b2_SDX_Encapsulation_EXTENDED();
t.origData = Object.clone(sdxData.origData);
t.sdxInfo = Object.clone(sdxData.sdxInfo);
t.parent = sdxParentNode;
t.children = new Hash();
t.children.loaded = false;
// add to hash
sdxParentNode.children.set(qm_hash, t);
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
return t;
}
i2b2.sdx.TypeControllers.ENS.LoadFromDataModel = function(key_value) {}
i2b2.sdx.TypeControllers.ENS.ClearAllFromDataModel= function(sdxOptionalParent) {
if (sdxOptionalParent) {
try {
var findFunc = function(item_rec) {
// this function expects the second argument to be the target node's key value
var hash_key = item_rec[0];
var QM_rec = item_rec[1];
if (QM_rec.sdxInfo.sdxKeyValue == this.strip()) { return true; }
}
var dm_loc = 'i2b2.CRC.model.QueryMasters.'+i2b2.sdx.Master._KeyHash(sdxOptionalParent.sdxInfo.sdxKeyValue);
var targets = i2b2.CRC.model.QueryMasters.findAll(findFunc, sdxOptionalParent.sdxInfo.sdxKeyValue);
for (var i=0; i < targets.length; i++) {
var t = parent_QM[i].value;
t.children = new Hash();
}
} catch(e) { console.error('Could not clear children of given parent node!'); }
} else {
var dm_loc = 'i2b2.CRC.model.QueryMasters';
i2b2.CRC.model.QueryMasters.each(function(item_rec) {
try {
item_rec[1].children = new Hash();
} catch(e) { console.error('Could not clear children of all QueryMasters'); }
});
}
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
// updated dm_loc of the data model
return true;
}
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var conceptId = sdxData.name;
var id = "CRC_ID-" + i2b2.GUID();
// process drag drop controllers
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultPRS';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "PRS";
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
// **** Render the HTML ***
var retHtml = '
';
retHtml += '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC > ENS node!');
retHtml += ' PRS '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddPRSTarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddPRSTarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.ENS.DragDrop(divDataID)
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i\n'+
' '+sdxParentNode.sdxInfo.sdxKeyValue+'\n'+
' \n'+
'\n'+
'\n'+
'\n'+
' \n'+
'\n';
// AJAX CALL
var options = {
patient_limit: 0,
PDO_Request: msg_filter
};
i2b2.CRC.ajax.getPDO_fromInputList("CRC:SDX:PatientRecordSet", options, scopedCallback);
}
i2b2.sdx.TypeControllers.ENS.LoadChildrenFromTreeview = function(node, onCompleteCallback) {
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.scope = node.data.i2b2_SDX;
scopedCallback.callback = function(retCellPack) {
var cl_node = node;
var cl_onCompleteCB = onCompleteCallback;
var results = retCellPack.results;
for(var i1=0; i1<1*results.length; i1++) {
var o = results[i1];
var renderOptions = {
dragdrop: "i2b2.sdx.TypeControllers.PRC.AttachDrag2Data",
icon: "sdx_CRC_PR.jpg",
title: o.sdxInfo.sdxDisplayName,
showchildren: false
};
var sdxRenderData = i2b2.sdx.Master.RenderHTML(cl_node.tree.id, o, renderOptions);
i2b2.sdx.Master.AppendTreeNode(cl_node.tree, cl_node, sdxRenderData);
}
// handle the callback
if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') {
cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retCellPack);
} else {
cl_onCompleteCB(retCellPack);
}
}
var sdxParentNode = node.data.i2b2_SDX;
var options = i2b2.CRC.params;
i2b2.sdx.Master.getChildRecords(sdxParentNode, scopedCallback, options);
}
// *********************************************************************************
// DRAG DROP PROXY CONTROLLER
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.DragDrop = function(id, config) {
if (id) {
this.init(id, 'ENS',{isTarget:false});
this.initFrame();
}
var s = this.getDragEl().style;
s.borderColor = "transparent";
s.opacity = 0.75;
s.filter = "alpha(opacity=75)";
s.whiteSpace = "nowrap";
s.overflow = "hidden";
s.textOverflow = "ellipsis";
};
YAHOO.extend(i2b2.sdx.TypeControllers.ENS.DragDrop, YAHOO.util.DDProxy);
i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.startDrag = function(x, y) {
var dragEl = this.getDragEl();
var clickEl = this.getEl();
dragEl.innerHTML = clickEl.innerHTML;
dragEl.className = clickEl.className;
dragEl.style.backgroundColor = '#FFFFEE';
dragEl.style.color = clickEl.style.color;
dragEl.style.border = "1px solid blue";
dragEl.style.width = "160px";
dragEl.style.height = "20px";
this.setDelta(15,10);
};
i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.endDrag = function(e) {
// remove DragDrop targeting CCS
var targets = YAHOO.util.DDM.getRelated(this, true);
for (var i=0; i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.onDragOver = function(e, id) {
// fire the onHoverOver (use SDX so targets can override default event handler)
i2b2.sdx.Master.onHoverOver('ENS', e, id, this);
};
i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.onDragOut = function(e, id) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
i2b2.sdx.Master.onHoverOut('ENS', e, id, this);
};
i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.onDragDrop = function(e, id) {
i2b2.sdx.Master.onHoverOut('ENS', e, id, this);
// retreive the concept data from the dragged element
draggedData = this.yuiTreeNode.data.i2b2_SDX;
i2b2.sdx.Master.ProcessDrop(draggedData, id);
};
// *********************************************************************************
// DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.ENS.DropHandler = function(sdxData) {
alert('[PatientRecordSet DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PR.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PR.js
index 0fc2550fd..ab2d1aaf5 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PR.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PR.js
@@ -1,313 +1,310 @@
/**
* @projectDescription The SDX controller library for the PatientRecord data-type.
* @namespace i2b2.sdx.TypeControllers.PR
* @inherits i2b2.sdx.TypeControllers
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > SDX > Patient Record');
console.time('execute time');
i2b2.sdx.TypeControllers.PR = {};
i2b2.sdx.TypeControllers.PR.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
i2b2.sdx.TypeControllers.PR.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'PR', sdxKeyName: 'patient_id', sdxControlCell:'CRC', sdxDisplayNameKey: 'title'};
}
i2b2.sdx.TypeControllers.PR.SaveToDataModel = function(sdxData, sdxParentNode) {
// do not save save to CRC data model because of sheer
if (!sdxParentNode) { return false; }
var pr_id = sdxData.sdxInfo.sdxKeyValue;
var pr_hash = i2b2.sdx.Master._KeyHash(pr_id);
// class for all SDX communications
function i2b2_SDX_Encapsulation_EXTENDED() {}
// create an instance and populate with info
var t = new i2b2_SDX_Encapsulation_EXTENDED();
t.origData = Object.clone(sdxData.origData);
t.sdxInfo = Object.clone(sdxData.sdxInfo);
t.parent = sdxParentNode;
t.children = new Hash();
t.children.loaded = false;
// add to hash
sdxParentNode.children.set(pr_hash, t);
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
return t;
}
i2b2.sdx.TypeControllers.PR.LoadFromDataModel = function(key_value) {}
i2b2.sdx.TypeControllers.PR.ClearAllFromDataModel= function(sdxOptionalParent) {
// never called
return true;
}
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PR.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var id = "CRC_ID-" + i2b2.GUID();
// process drag drop controllers
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultPR';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "PR";
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
// **** Render the HTML ***
var retHtml = '
';
retHtml += '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC > PR node!');
retHtml += ' PR '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PR.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddPRTarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PR.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddPRTarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PR.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PR.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.PR.DragDrop(divDataID)
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.PR.DragDrop.prototype.onDragOver = function(e, id) {
// fire the onHoverOver (use SDX so targets can override default event handler)
i2b2.sdx.Master.onHoverOver('PR', e, id, this);
};
i2b2.sdx.TypeControllers.PR.DragDrop.prototype.onDragOut = function(e, id) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
i2b2.sdx.Master.onHoverOut('PR', e, id, this);
};
i2b2.sdx.TypeControllers.PR.DragDrop.prototype.onDragDrop = function(e, id) {
i2b2.sdx.Master.onHoverOut('PR', e, id, this);
// retreive the concept data from the dragged element
draggedData = this.yuiTreeNode.data.i2b2_SDX;
i2b2.sdx.Master.ProcessDrop(draggedData, id);
};
// *********************************************************************************
// DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.PR.DropHandler = function(sdxData) {
alert('[PatientRecord DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRC.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRC.js
index eac2c40df..5e2cabe27 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRC.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRC.js
@@ -1,338 +1,335 @@
/**
* @projectDescription The SDX controller library for the PatientRecordCount data-type.
* @namespace i2b2.sdx.TypeControllers.PRC
* @inherits i2b2.sdx.TypeControllers
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > SDX > Patient Record Count');
console.time('execute time');
i2b2.sdx.TypeControllers.PRC = {};
i2b2.sdx.TypeControllers.PRC.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
i2b2.sdx.TypeControllers.PRC.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'PRC', sdxKeyName: 'result_instance_id', sdxControlCell:'CRC', sdxDisplayNameKey:'title'};
}
i2b2.sdx.TypeControllers.PRC.SaveToDataModel = function(sdxData, sdxParentNode) {
// save to CRC data model
if (!sdxParentNode) { return false; }
var qm_id = sdxData.sdxInfo.sdxKeyValue;
var qm_hash = i2b2.sdx.Master._KeyHash(qm_id);
// class for all SDX communications
function i2b2_SDX_Encapsulation_EXTENDED() {}
// create an instance and populate with info
var t = new i2b2_SDX_Encapsulation_EXTENDED();
t.origData = Object.clone(sdxData.origData);
t.sdxInfo = Object.clone(sdxData.sdxInfo);
t.parent = sdxParentNode;
t.children = new Hash();
t.children.loaded = false;
// add to hash
sdxParentNode.children.set(qm_hash, t);
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
return t;
}
i2b2.sdx.TypeControllers.PRC.LoadFromDataModel = function(key_value) {}
i2b2.sdx.TypeControllers.PRC.ClearAllFromDataModel= function(sdxOptionalParent) {
if (sdxOptionalParent) {
try {
var findFunc = function(item_rec) {
// this function expects the second argument to be the target node's key value
var hash_key = item_rec[0];
var QM_rec = item_rec[1];
if (QM_rec.sdxInfo.sdxKeyValue == this.strip()) { return true; }
}
var dm_loc = 'i2b2.CRC.model.QueryMasters.'+i2b2.sdx.Master._KeyHash(sdxOptionalParent.sdxInfo.sdxKeyValue);
var targets = i2b2.CRC.model.QueryMasters.findAll(findFunc, sdxOptionalParent.sdxInfo.sdxKeyValue);
for (var i=0; i < targets.length; i++) {
var t = parent_QM[i].value;
t.children = new Hash();
}
} catch(e) { console.error('Could not clear children of given parent node!'); }
} else {
var dm_loc = 'i2b2.CRC.model.QueryMasters';
i2b2.CRC.model.QueryMasters.each(function(item_rec) {
try {
item_rec[1].children = new Hash();
} catch(e) { console.error('Could not clear children of all QueryMasters'); }
});
}
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
// updated dm_loc of the data model
return true;
}
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRC.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var conceptId = sdxData.name;
var id = "CRC_ID-" + i2b2.GUID();
// process drag drop controllers
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultPRC';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "PRC";
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
// **** Render the HTML ***
var retHtml = '
';
retHtml += '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC > PRC node!');
retHtml += ' PRC '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRC.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddPRCTarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRC.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddPRCTarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRC.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRC.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.PRC.DragDrop(divDataID)
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.PRC.DragDrop.prototype.onDragOver = function(e, id) {
// fire the onHoverOver (use SDX so targets can override default event handler)
i2b2.sdx.Master.onHoverOver('PRC', e, id, this);
};
i2b2.sdx.TypeControllers.PRC.DragDrop.prototype.onDragOut = function(e, id) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
i2b2.sdx.Master.onHoverOut('PRC', e, id, this);
};
i2b2.sdx.TypeControllers.PRC.DragDrop.prototype.onDragDrop = function(e, id) {
i2b2.sdx.Master.onHoverOut('PRC', e, id, this);
// retreive the concept data from the dragged element
draggedData = this.yuiTreeNode.data.i2b2_SDX;
i2b2.sdx.Master.ProcessDrop(draggedData, id);
};
// *********************************************************************************
// DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.PRC.DropHandler = function(sdxData) {
alert('[PatientRecordCount DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRS.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRS.js
index fd229c4b1..483b5dadb 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRS.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_PRS.js
@@ -1,475 +1,472 @@
/**
* @projectDescription The SDX controller library for the PatientRecordSet data-type.
* @namespace i2b2.sdx.TypeControllers.PRS
* @inherits i2b2.sdx.TypeControllers
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > SDX > Patient Record Set');
console.time('execute time');
i2b2.sdx.TypeControllers.PRS = {};
i2b2.sdx.TypeControllers.PRS.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'PRS', sdxKeyName: 'result_instance_id', sdxControlCell:'CRC', sdxDisplayNameKey: 'title'};
}
i2b2.sdx.TypeControllers.PRS.SaveToDataModel = function(sdxData, sdxParentNode) {
// save to CRC data model
if (!sdxParentNode) { return false; }
var qm_id = sdxData.sdxInfo.sdxKeyValue;
var qm_hash = i2b2.sdx.Master._KeyHash(qm_id);
// class for all SDX communications
function i2b2_SDX_Encapsulation_EXTENDED() {}
// create an instance and populate with info
var t = new i2b2_SDX_Encapsulation_EXTENDED();
t.origData = Object.clone(sdxData.origData);
t.sdxInfo = Object.clone(sdxData.sdxInfo);
t.parent = sdxParentNode;
t.children = new Hash();
t.children.loaded = false;
// add to hash
sdxParentNode.children.set(qm_hash, t);
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
return t;
}
i2b2.sdx.TypeControllers.PRS.LoadFromDataModel = function(key_value) {}
i2b2.sdx.TypeControllers.PRS.ClearAllFromDataModel= function(sdxOptionalParent) {
if (sdxOptionalParent) {
try {
var findFunc = function(item_rec) {
// this function expects the second argument to be the target node's key value
var hash_key = item_rec[0];
var QM_rec = item_rec[1];
if (QM_rec.sdxInfo.sdxKeyValue == this.strip()) { return true; }
}
var dm_loc = 'i2b2.CRC.model.QueryMasters.'+i2b2.sdx.Master._KeyHash(sdxOptionalParent.sdxInfo.sdxKeyValue);
var targets = i2b2.CRC.model.QueryMasters.findAll(findFunc, sdxOptionalParent.sdxInfo.sdxKeyValue);
for (var i=0; i < targets.length; i++) {
var t = parent_QM[i].value;
t.children = new Hash();
}
} catch(e) { console.error('Could not clear children of given parent node!'); }
} else {
var dm_loc = 'i2b2.CRC.model.QueryMasters';
i2b2.CRC.model.QueryMasters.each(function(item_rec) {
try {
item_rec[1].children = new Hash();
} catch(e) { console.error('Could not clear children of all QueryMasters'); }
});
}
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
// updated dm_loc of the data model
return true;
}
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var conceptId = sdxData.name;
var id = "CRC_ID-" + i2b2.GUID();
// process drag drop controllers
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultPRS';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "PRS";
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
// **** Render the HTML ***
var retHtml = '
';
retHtml += '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC > PRS node!');
retHtml += ' PRS '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddPRSTarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddPRSTarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.PRS.DragDrop(divDataID)
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i\n'+
' '+sdxParentNode.sdxInfo.sdxKeyValue+'\n'+
' \n'+
'\n'+
'\n'+
'\n'+
' \n'+
'\n';
// AJAX CALL
var options = {
patient_limit: 0,
PDO_Request: msg_filter
};
i2b2.CRC.ajax.getPDO_fromInputList("CRC:SDX:PatientRecordSet", options, scopedCallback);
}
i2b2.sdx.TypeControllers.PRS.LoadChildrenFromTreeview = function(node, onCompleteCallback) {
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.scope = node.data.i2b2_SDX;
scopedCallback.callback = function(retCellPack) {
var cl_node = node;
var cl_onCompleteCB = onCompleteCallback;
var results = retCellPack.results;
for(var i1=0; i1<1*results.length; i1++) {
var o = results[i1];
var renderOptions = {
dragdrop: "i2b2.sdx.TypeControllers.PRC.AttachDrag2Data",
icon: "sdx_CRC_PR.jpg",
title: o.sdxInfo.sdxDisplayName,
showchildren: false
};
var sdxRenderData = i2b2.sdx.Master.RenderHTML(cl_node.tree.id, o, renderOptions);
i2b2.sdx.Master.AppendTreeNode(cl_node.tree, cl_node, sdxRenderData);
}
// handle the callback
if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') {
cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retCellPack);
} else {
cl_onCompleteCB(retCellPack);
}
}
var sdxParentNode = node.data.i2b2_SDX;
var options = i2b2.CRC.params;
if (node.data.i2b2_SDX.origData.size > 200)
{
node.loadComplete();
alert("The patient count is greater then that can be displayed.");
} else {
i2b2.sdx.Master.getChildRecords(sdxParentNode, scopedCallback, options);
}
}
// *********************************************************************************
// DRAG DROP PROXY CONTROLLER
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.DragDrop = function(id, config) {
if (id) {
this.init(id, 'PRS',{isTarget:false});
this.initFrame();
}
var s = this.getDragEl().style;
s.borderColor = "transparent";
s.opacity = 0.75;
s.filter = "alpha(opacity=75)";
s.whiteSpace = "nowrap";
s.overflow = "hidden";
s.textOverflow = "ellipsis";
};
YAHOO.extend(i2b2.sdx.TypeControllers.PRS.DragDrop, YAHOO.util.DDProxy);
i2b2.sdx.TypeControllers.PRS.DragDrop.prototype.startDrag = function(x, y) {
var dragEl = this.getDragEl();
var clickEl = this.getEl();
dragEl.innerHTML = clickEl.innerHTML;
dragEl.className = clickEl.className;
dragEl.style.backgroundColor = '#FFFFEE';
dragEl.style.color = clickEl.style.color;
dragEl.style.border = "1px solid blue";
dragEl.style.width = "160px";
dragEl.style.height = "20px";
this.setDelta(15,10);
};
i2b2.sdx.TypeControllers.PRS.DragDrop.prototype.endDrag = function(e) {
// remove DragDrop targeting CCS
var targets = YAHOO.util.DDM.getRelated(this, true);
for (var i=0; i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.PRS.DragDrop.prototype.onDragOver = function(e, id) {
// fire the onHoverOver (use SDX so targets can override default event handler)
i2b2.sdx.Master.onHoverOver('PRS', e, id, this);
};
i2b2.sdx.TypeControllers.PRS.DragDrop.prototype.onDragOut = function(e, id) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
i2b2.sdx.Master.onHoverOut('PRS', e, id, this);
};
i2b2.sdx.TypeControllers.PRS.DragDrop.prototype.onDragDrop = function(e, id) {
i2b2.sdx.Master.onHoverOut('PRS', e, id, this);
// retreive the concept data from the dragged element
draggedData = this.yuiTreeNode.data.i2b2_SDX;
i2b2.sdx.Master.ProcessDrop(draggedData, id);
};
// *********************************************************************************
// DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.PRS.DropHandler = function(sdxData) {
alert('[PatientRecordSet DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QDEF.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QDEF.js
index e3ffbb200..4dde4ce4d 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QDEF.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QDEF.js
@@ -1,287 +1,284 @@
/**
* @projectDescription The SDX controller library for the Query Definition data-type.
* @namespace i2b2.sdx.TypeControllers.QDEF
* @inherits i2b2.sdx.TypeControllers
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > SDX > Query DEFinition');
console.time('execute time');
i2b2.sdx.TypeControllers.QDEF = {};
i2b2.sdx.TypeControllers.QDEF.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
i2b2.sdx.TypeControllers.QDEF.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'QDEF', sdxKeyName: 'key', sdxControlCell:'CRC', sdxDisplayNameKey: 'QDEF_name'};
}
i2b2.sdx.TypeControllers.QDEF.SaveToDataModel = function(sdxData, sdxParentNode) { return undefined;}
i2b2.sdx.TypeControllers.QDEF.LoadFromDataModel = function(key_value) {}
i2b2.sdx.TypeControllers.QDEF.ClearAllFromDataModel= function(sdxOptionalParent) { return true; }
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QDEF.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var id = "CRC_ID-" + i2b2.GUID();
// process drag drop controllers1
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultQDEF';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "QDEF";
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
// **** Render the HTML ***
var retHtml = '
';
retHtml += '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC > QDEF node!');
retHtml += ' QDEF '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QDEF.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddQDEFTarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QDEF.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddQDEFTarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QDEF.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QDEF.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.QDEF.DragDrop(divDataID)
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.QDEF.DragDrop.prototype.onDragOver = function(e, id) {
// fire the onHoverOver (use SDX so targets can override default event handler)
i2b2.sdx.Master.onHoverOver('QDEF', e, id, this);
};
i2b2.sdx.TypeControllers.QDEF.DragDrop.prototype.onDragOut = function(e, id) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
i2b2.sdx.Master.onHoverOut('QDEF', e, id, this);
};
i2b2.sdx.TypeControllers.QDEF.DragDrop.prototype.onDragDrop = function(e, id) {
i2b2.sdx.Master.onHoverOut('QDEF', e, id, this);
// retreive the concept data from the dragged element
draggedData = this.yuiTreeNode.data.i2b2_SDX;
i2b2.sdx.Master.ProcessDrop(draggedData, id);
};
// *********************************************************************************
// DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.QDEF.DropHandler = function(sdxData) {
alert('[PatientRecord DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QGDEF.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QGDEF.js
index 2189d0ef1..02af27205 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QGDEF.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QGDEF.js
@@ -1,287 +1,284 @@
/**
* @projectDescription The SDX controller library for the Query Group Definition data-type.
* @namespace i2b2.sdx.TypeControllers.QGDEF
* @inherits i2b2.sdx.TypeControllers
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > SDX > Query Group DEFinition');
console.time('execute time');
i2b2.sdx.TypeControllers.QGDEF = {};
i2b2.sdx.TypeControllers.QGDEF.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
i2b2.sdx.TypeControllers.QGDEF.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'QGDEF', sdxKeyName: 'key', sdxControlCell:'CRC', sdxDisplayNameKey: 'QGDEF_name'};
}
i2b2.sdx.TypeControllers.QGDEF.SaveToDataModel = function(sdxData, sdxParentNode) { return undefined; }
i2b2.sdx.TypeControllers.QGDEF.LoadFromDataModel = function(key_value) {}
i2b2.sdx.TypeControllers.QGDEF.ClearAllFromDataModel= function(sdxOptionalParent) { return true; }
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QGDEF.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var id = "CRC_ID-" + i2b2.GUID();
// process drag drop controllers1
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultQGDEF';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "QGDEF";
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
// **** Render the HTML ***
var retHtml = '
';
retHtml += '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC > QGDEF node!');
retHtml += ' QGDEF '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QGDEF.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddQGDEFTarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QGDEF.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddQGDEFTarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QGDEF.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QGDEF.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.QGDEF.DragDrop(divDataID)
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.QGDEF.DragDrop.prototype.onDragOver = function(e, id) {
// fire the onHoverOver (use SDX so targets can override default event handler)
i2b2.sdx.Master.onHoverOver('QGDEF', e, id, this);
};
i2b2.sdx.TypeControllers.QGDEF.DragDrop.prototype.onDragOut = function(e, id) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
i2b2.sdx.Master.onHoverOut('QGDEF', e, id, this);
};
i2b2.sdx.TypeControllers.QGDEF.DragDrop.prototype.onDragDrop = function(e, id) {
i2b2.sdx.Master.onHoverOut('QGDEF', e, id, this);
// retreive the concept data from the dragged element
draggedData = this.yuiTreeNode.data.i2b2_SDX;
i2b2.sdx.Master.ProcessDrop(draggedData, id);
};
// *********************************************************************************
// DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.QGDEF.DropHandler = function(sdxData) {
alert('[PatientRecord DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QI.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QI.js
index e0e0350d5..c7ba435c1 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QI.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QI.js
@@ -1,673 +1,747 @@
/**
* @projectDescription The SDX controller library for the QueryInstance data-type.
* @namespace i2b2.sdx.TypeControllers.QI
* @inherits i2b2.sdx.TypeControllers
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > SDX > QueryInstance');
console.time('execute time');
i2b2.sdx.TypeControllers.QI = {};
i2b2.sdx.TypeControllers.QI.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
/**
* Get the sdxInfo data template for all QueryMaster.
* @memberOf i2b2.sdx.TypeControllers.QM
* @method
* @return {Object} Returns a data object containing sdxType, sdxKeyName, sdxControlCell info for QueryMaster-type objects.
* @author Nick Benik
* @version 1.0
* @alias i2b2.sdx.Master.EncapsulateData
*/
i2b2.sdx.TypeControllers.QI.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'QI', sdxKeyName: 'query_instance_id', sdxControlCell:'CRC', sdxDisplayNameKey:'title'};
}
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QI.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var conceptId = sdxData.name;
var id = "CRC_ID-" + i2b2.GUID();
// process drag drop controllers
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultQI';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "QI";
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = sdxData.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = sdxData.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
// **** Render the HTML ***
var retHtml = '
';
retHtml += '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC>QI node!');
retHtml += ' QI '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QI.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddQITarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QI.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddQITarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QI.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
/**
* Get the child records for the given QueryInstance.
* @param {Object} sdxParentNode The parent node we want to find the children of.
* @param {ScopedCallback} onCompleteCallback A scoped-callback function to be executed using the results array.
* @return {Boolean} Returns true to the calling function.
* @return {Array} Returns an array of QueryInstance data represented as SDX Objects (without render data) to the callback function passed.
* @memberOf i2b2.sdx.TypeControllers.QI
* @method
* @author Nick Benik
* @version 1.0
* @alias i2b2.sdx.Master.getChildRecords
*/
i2b2.sdx.TypeControllers.QI.getChildRecords = function(sdxParentNode, onCompleteCallback, options) {
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.scope = sdxParentNode;
scopedCallback.callback = function(results) {
var cl_node = sdxParentNode;
var cl_onCompleteCB = onCompleteCallback;
// THIS function is used to process the AJAX results of the getChild call
// results data object contains the following attributes:
// refXML: xmlDomObject <--- for data processing
// msgRequest: xml (string)
// msgResponse: xml (string)
// error: boolean
// errorStatus: string [only with error=true]
// errorMsg: string [only with error=true]
var retMsg = {
error: results.error,
msgRequest: results.msgRequest,
msgResponse: results.msgResponse,
msgUrl: results.msgUrl,
results: null
};
var retChildren = [];
// find parent node QI node in data model
var dm = i2b2.CRC.model.QueryMasters;
var dm_loc = 'i2b2.CRC.model.QueryMasters';
+
// Here comes REAL fun, a self-recursive anonymous function instantiated by iteration
// via recursive "collection" calls on Hash objects (Prototype toolkit)
var findFunc = function(item_rec) {
var hash_key = item_rec.key;
var gen_rec = item_rec.value;
var cl_keyValue = keyValue; // <-- closure variable: keyValue must be set before running function
if (gen_rec.sdxInfo.sdxType=="QI") {
// see if this record matches our search
if (gen_rec.sdxInfo.sdxKeyValue == cl_keyValue) { return gen_rec; }
} else {
// recurse into the object's children
var match_children = gen_rec.children.collect(findFunc);
return match_children;
}
}
var keyValue = cl_node.sdxInfo.sdxKeyValue.toString();
var parent_QM = dm.collect(findFunc);
parent_QM = parent_QM.flatten();
parent_QM = parent_QM.compact();
if (parent_QM[0]) {
var pn = parent_QM[0];
} else {
console.error('Parent QM node was not found in the CRC data model!');
return false;
}
// extract records from XML msg
var ps = results.refXML.getElementsByTagName('query_result_instance');
var dm = i2b2.CRC.model.QueryMasters;
+ var x_plusmn_pats = 3;
+
for(var i1=0; i1<3";
- } else {
- o.title += " is " + i2b2.h.getXNodeVal(ps[i1],'query_result_instance/set_size') + "±3";
- }
-
- } else {
- o.title += " is " + i2b2.h.getXNodeVal(ps[i1],'query_result_instance/set_size') + "";
+ o.description = i2b2.h.getXNodeVal(ps[i1],'description');
+ o.qs_name = i2b2.h.getXNodeVal(ps[i1],'query_status_type/name');
+
+ //try{
+ o.result_type = i2b2.h.getXNodeVal(ps[i1],'query_result_type/name');
+ //o.result_type = i2b2.h.XPath(ps[i1],'query_result_type/name/text()')[0].nodeValue;
+ //}
+ //catch(e){
+ if(typeof o.result_type == 'undefined'){
+ try{
+ o.result_type = "SHRINE_ERROR" ;
+ o.qs_name = i2b2.h.getXNodeVal(ps[i1],'query_status_type/name');
+ o.description = i2b2.h.getXNodeVal(ps[i1],'description');
+ o.qs_description = i2b2.h.getXNodeVal(ps[i1],'query_status_type/description');
+ }
+ catch(e){
+ o.result_type = "OTH_ERROR" ;
}
}
+ //}
- if (i2b2.h.XPath(ps[i1],'query_status_type/name/text()')[0].nodeValue != "COMPLETED")
- {
- o.title += " - " + i2b2.h.XPath(ps[i1],'query_status_type/name/text()')[0].nodeValue;
- }
+ var sdxDataNodeChild = null;
+
+ //Added for previous query issue -> oRecord should be o object
+ oRecord = o;
+ var title = null;
+
+ //If Query status = PROCESSING skip printing results
+ if(o.qs_name == "PROCESSING"){
+ var t = o.description;
+ if (!t) { t="Unknown"; }
+
- o.result_type = i2b2.h.XPath(ps[i1],'query_result_type/name/text()')[0].nodeValue;
- var addme = false;
- switch (o.result_type) {
- case "PATIENT_ENCOUNTER_SET":
- o.PRS_id = i2b2.h.getXNodeVal(ps[i1],'result_instance_id');
- // use given title if it exist otherwise generate a title
- /*
- try {
- var t = i2b2.h.XPath(temp,'self::description')[0].firstChild.nodeValue;
- } catch(e) { var t = null; }
- if (!t) { t="Encounter Set"; }
- // create the title using shrine setting
- if (o.size >= 10) {
- if (i2b2.PM.model.userRoles.length == 1 && i2b2.PM.model.userRoles[0] == "DATA_OBFSC") {
- o.title = t+" - "+o.size+"±3 encounters";
+ var d = new Date().getTime();
+ o.result_instance_id = d;
+
+ title = t+" - Still Processing Request";
+
+ o.titleCRC = title;
+
+ o.title = pn.parent.sdxInfo.sdxDisplayName + ' [PATIENT_COUNT_XML_'+ d +']';
+
+
+ //o.title = 'PATIENT_COUNT_XML_'+o.PRC_id;
+
+ sdxDataNodeChild = i2b2.sdx.Master.EncapsulateData('PRC',o);
+
+ }
+ //All other Query Status
+ else{
+ switch (o.result_type) {
+ case "PATIENTSET":
+ o.PRS_id = i2b2.h.getXNodeVal(ps[i1],'result_instance_id');
+ // use given title if it exist otherwise generate a title
+ try {
+ var t = o.description;
+
+ if((t != null) &&
+ (t == "AGGREGATED")
+ ){
+ x_plusmn_pats = ((ps.length) - 1) * 3;
+ }
+
+ } catch(e) { var t = null; }
+ if (!t) { t="Patient Set"; }
+
+ // create the title using shrine setting
+ if (oRecord.size >= 10) {
+ if (i2b2.PM.model.userRoles.lastIndexOf("DATA_AGG") > -1) {
+ title = t+" - "+oRecord.size+" patients";
+ } else {
+ title = t+" - "+oRecord.size+" ±"+ x_plusmn_pats +
+ " patients";
+ }
} else {
- o.title = t+" - "+o.size+" encounters";
+ if (i2b2.PM.model.userRoles.lastIndexOf("DATA_AGG") > -1) {
+ title = t+" - "+oRecord.size+" patients";
+ } else {
+ title = t+" - 10 patients or fewer";
+ }
}
- } else {
- if (i2b2.PM.model.userRoles.length == 1 && i2b2.PM.model.userRoles[0] == "DATA_OBFSC") {
- o.title = t+" - 10 encounters or less";
+ o.titleCRC = title;
+ o.title = pn.parent.sdxInfo.sdxDisplayName + ' [PATIENTSET_'+o.PRS_id+']';
+ o.result_instance_id = o.PRS_id;
+ sdxDataNodeChild = i2b2.sdx.Master.EncapsulateData('PRS',o);
+ break;
+ case "PATIENT_COUNT_XML":
+ o.PRC_id = i2b2.h.getXNodeVal(ps[i1],'result_instance_id');
+ // use given title if it exist otherwise generate a title
+ try {
+ var t = o.description;
+
+ if((t != null) &&
+ (t == "AGGREGATED")
+ ){
+ x_plusmn_pats = ((ps.length) - 1) * 3;
+ }
+
+ } catch(e) { var t = null; }
+ if (!t) { t="Patient Count"; }
+
+ // create the title using shrine setting
+ if (oRecord.size >= 10) {
+ //@pcori_webclient
+ if (i2b2.PM.model.userRoles.lastIndexOf("DATA_AGG") > -1) {
+ title = t+" - "+oRecord.size+" patients";
+ } else {
+ title = t+" - "+oRecord.size+" ±"+ x_plusmn_pats +
+ " patients";
+ }
} else {
- o.title = t+" - "+o.size+" encounters";
+ if (i2b2.PM.model.userRoles.lastIndexOf("DATA_AGG") > -1) {
+ title = t+" - "+oRecord.size+" patients";
+ } else {
+ title = t+" - 10 patients or fewer";
+ }
}
- } */
- o.titleCRC = o.title;
- o.title = pn.parent.sdxInfo.sdxDisplayName + ' [PATIENT_ENCOUNTER_SET_'+o.PRS_id+']';
- o.result_instance_id = o.PRS_id;
- var sdxDataNode = i2b2.sdx.Master.EncapsulateData('ENS',o);
- addme = true;
- break;
- case "PATIENTSET":
- o.PRS_id = i2b2.h.getXNodeVal(ps[i1],'result_instance_id');
- o.titleCRC = o.title;
- o.title = pn.parent.sdxInfo.sdxDisplayName + ' [PATIENTSET_'+o.PRS_id+']';
- o.result_instance_id = o.PRS_id;
- var sdxDataNode = i2b2.sdx.Master.EncapsulateData('PRS',o);
- addme = true;
- break;
- default:
-
- o.PRC_id = i2b2.h.getXNodeVal(ps[i1],'result_instance_id');
- o.titleCRC = o.title;
- //o.title = pn.parent.sdxInfo.sdxDisplayName + ' [PATIENT_COUNT_XML_'+o.PRC_id+']';
- //o.title = 'PATIENT_COUNT_XML_'+o.PRC_id;
- o.result_instance_id = o.PRC_id;
- var sdxDataNode = i2b2.sdx.Master.EncapsulateData('PRC',o);
- addme = true;
- break;
+ o.titleCRC = title;
+ o.title = pn.parent.sdxInfo.sdxDisplayName + ' [PATIENT_COUNT_XML_'+o.PRC_id+']';
+ //o.title = 'PATIENT_COUNT_XML_'+o.PRC_id;
+ o.result_instance_id = o.PRC_id;
+ sdxDataNodeChild = i2b2.sdx.Master.EncapsulateData('PRC',o);
+ break;
+ case "SHRINE_ERROR":
+ try{
+ if(o.qs_name == "UNAVALIABLE"){
+ title = o.description +" - "+ o.qs_description;
+ }
+ else{
+ title = o.description +" - "+ o.qs_description;
+ }
+ }
+ catch(e){
+ title = o.description +" - "+ e.message;
+ }
+
+ var d = new Date().getTime();
+ o.titleCRC = title;
+ o.result_instance_id = d;
+
+ o.title = pn.parent.sdxInfo.sdxDisplayName + ' [PATIENT_COUNT_XML_'+ d +']';
+ //o.title = 'PATIENT_COUNT_XML_'+o.PRC_id;
+ //o.result_instance_id = o.PRC_id;
+ sdxDataNodeChild = i2b2.sdx.Master.EncapsulateData('PRC',o);
+ break;
+ }
}
- if (addme) {
+
+
// save record in the SDX system
- sdxDataNode = i2b2.sdx.Master.Save(sdxDataNode, pn);
+ sdxDataNode = i2b2.sdx.Master.Save(sdxDataNodeChild, pn);
// append the data node to our returned results
retChildren.push(sdxDataNode);
- }
}
pn.children.loaded = true;
// TODO: broadcast a data update event of the CRC data model
retMsg.results = retChildren;
if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') {
cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retMsg);
} else {
cl_onCompleteCB(retMsg);
}
}
i2b2.CRC.ajax.getQueryResultInstanceList_fromQueryInstanceId("CRC:SDX:QueryInstance", {qi_key_value: sdxParentNode.sdxInfo.sdxKeyValue}, scopedCallback);
}
i2b2.sdx.TypeControllers.QI.SaveToDataModel = function(sdxData, sdxParentNode) {
// save to CRC data model
if (!sdxParentNode) { return false; }
var qm_id = sdxData.sdxInfo.sdxKeyValue;
var qm_hash = i2b2.sdx.Master._KeyHash(qm_id);
// class for all SDX communications
function i2b2_SDX_Encapsulation_EXTENDED() {}
// create an instance and populate with info
var t = new i2b2_SDX_Encapsulation_EXTENDED();
t.origData = Object.clone(sdxData.origData);
t.sdxInfo = Object.clone(sdxData.sdxInfo);
t.parent = sdxParentNode;
t.children = new Hash();
t.children.loaded = false;
// add to hash
sdxParentNode.children.set(qm_hash, t);
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
return t;
}
i2b2.sdx.TypeControllers.QI.LoadFromDataModel = function(key_value) {}
i2b2.sdx.TypeControllers.QI.ClearAllFromDataModel= function(sdxOptionalParent) {
if (sdxOptionalParent) {
try {
var findFunc = function(item_rec) {
// this function expects the second argument to be the target node's key value
var hash_key = item_rec[0];
var QM_rec = item_rec[1];
if (QM_rec.sdxInfo.sdxKeyValue == this.strip()) { return true; }
}
var dm_loc = 'i2b2.CRC.model.QueryMasters.'+i2b2.sdx.Master._KeyHash(sdxOptionalParent.sdxInfo.sdxKeyValue);
var targets = i2b2.CRC.model.QueryMasters.findAll(findFunc, sdxOptionalParent.sdxInfo.sdxKeyValue);
for (var i=0; i < targets.length; i++) {
var t = parent_QM[i].value;
t.children = new Hash();
}
} catch(e) { console.error('Could not clear children of given parent node!'); }
} else {
var dm_loc = 'i2b2.CRC.model.QueryMasters';
i2b2.CRC.model.QueryMasters.each(function(item_rec) {
try {
item_rec[1].children = new Hash();
} catch(e) { console.error('Could not clear children of all QueryMasters'); }
});
}
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
// updated dm_loc of the data model
return true;
}
i2b2.sdx.TypeControllers.QI.LoadChildrenFromTreeview = function(node, onCompleteCallback) {
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.scope = node.data.i2b2_SDX;
scopedCallback.callback = function(retCellPack) {
var cl_node = node;
var cl_onCompleteCB = onCompleteCallback;
var results = retCellPack.results;
for(var i1=0; i1<1*results.length; i1++) {
var o = results[i1];
// add visual element
switch (o.sdxInfo.sdxType) {
case "PRS": // patient record set
// add visual element
if (i2b2.PM.model.userRoles.indexOf("DATA_LDS") == -1) {
var renderOptions = {
dragdrop: "i2b2.sdx.TypeControllers.PRS.AttachDrag2Data",
icon: "sdx_CRC_PRS.jpg",
title: o.origData.titleCRC,
showchildren: false
};
} else
{
var renderOptions = {
dragdrop: "i2b2.sdx.TypeControllers.PRS.AttachDrag2Data",
icon: "sdx_CRC_PRS.jpg",
title: o.origData.titleCRC,
showchildren: true
};
}
break;
case "ENS": // encounter record set
// add visual element
if (i2b2.PM.model.userRoles.indexOf("DATA_LDS") == -1) {
var renderOptions = {
dragdrop: "i2b2.sdx.TypeControllers.ENS.AttachDrag2Data",
icon: "sdx_CRC_PRS.jpg",
title: o.origData.titleCRC,
showchildren: false
};
} else {
var renderOptions = {
dragdrop: "i2b2.sdx.TypeControllers.ENS.AttachDrag2Data",
icon: "sdx_CRC_PRS.jpg",
title: o.origData.titleCRC,
showchildren: true
};
}
break;
case "PRC": // patient record count
var renderOptions = {
dragdrop: "i2b2.sdx.TypeControllers.PRC.AttachDrag2Data",
icon: "sdx_CRC_PRC.jpg",
title: o.origData.titleCRC,
showchildren: false
};
break;
}
var sdxRenderData = i2b2.sdx.Master.RenderHTML(cl_node.tree.id, o, renderOptions);
i2b2.sdx.Master.AppendTreeNode(cl_node.tree, cl_node, sdxRenderData);
}
// handle the callback
if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') {
cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retCellPack);
} else {
cl_onCompleteCB(retCellPack);
}
}
var sdxParentNode = node.data.i2b2_SDX;
var options = i2b2.CRC.params;
i2b2.sdx.Master.getChildRecords(sdxParentNode, scopedCallback, options);
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QI.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.QI.DragDrop(divDataID);
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.QI.DragDrop.prototype.onDragOver = function(e, id) {
// check to see if on-the-fly object type translation is needed
var translateTo = false;
if (Object.isUndefined(this.DDM.dragOvers[id])) { return false; }
// we must save which target we are over for the DragOut event later
this.lastDragOver = this.DDM.dragOvers[id];
var t = this.DDM.dragOvers[id].groups;
if (!t['QI']) {
// TRANSLATION NEEDED!
if (t['PRS']) {
translateTo = "PRS";
}
} else {
var translateTo = "QI";
}
// fire the onHoverOver (use SDX so targets can override default event handler)
if (translateTo) { i2b2.sdx.Master.onHoverOver(translateTo, e, id, this); }
};
i2b2.sdx.TypeControllers.QI.DragDrop.prototype.onDragOut = function(e, id) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
// check to see if on-the-fly object type translation is needed
var translateTo = false;
if (Object.isUndefined(this.lastDragOver)) { return false; }
var t = this.lastDragOver.groups;
if (!t['QI']) {
// TRANSLATION NEEDED!
if (t['PRS']) {
translateTo = "PRS";
}
} else {
var translateTo = "QI";
}
// fire the onHoverOver (use SDX so targets can override default event handler)
if (translateTo) { i2b2.sdx.Master.onHoverOut(translateTo, e, id, this); }
};
i2b2.sdx.TypeControllers.QI.DragDrop.prototype.onDragDrop = function(e, id) {
// check to see if on-the-fly object type translation is needed
var translateTo = false;
if (Object.isUndefined(this.lastDragOver)) { return false; }
var t = this.lastDragOver.groups;
if (!t['QI']) {
// TRANSLATION NEEDED!
if (t['PRS']) {
translateTo = "PRS";
}
} else {
var translateTo = "QI";
}
// fire the onHoverOver (use SDX so targets can override default event handler)
if (translateTo) {
i2b2.sdx.Master.onHoverOut(translateTo, e, id, this);
// retreive the concept data from the dragged element
// PERFROM on-the-fly OBJECT TRANSLATION HERE!!
var draggedData;
switch (translateTo) {
case "QI":
// no translation needed
var draggedData = this.yuiTreeNode.data.i2b2_SDX;
// send no so translated info to the drop target handler
i2b2.sdx.Master.ProcessDrop(draggedData, id);
break;
case "PRS":
var draggedData = this.yuiTreeNode.data.i2b2_SDX;
if (draggedData.children.size() == 0) {
// a little explaination about the below code: loading/expanding the
// treeview recursively via asynchronous calls
i2b2.sdx.Master.LoadChildrenFromTreeview(this.yuiTreeNode, (function(){
var cl_tn1 = this.yuiTreeNode;
var cl_id1 = id;
cl_tn1.dynamicLoadComplete = true;
cl_tn1.expand();
for (var i1=0; i1 DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.QI.DropHandler = function(sdxData) {
alert('[QueryInstance DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QM.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QM.js
index a5c0b253f..312f195b3 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QM.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_sdx_QM.js
@@ -1,658 +1,665 @@
/**
* @projectDescription The SDX controller library for the QueryMaster data-type.
* @namespace i2b2.sdx.TypeControllers.QM
* @inherits i2b2.sdx.TypeControllers
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* @see i2b2.sdx
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > SDX > QueryMaster');
console.time('execute time');
i2b2.sdx.TypeControllers.QM = {};
i2b2.sdx.TypeControllers.QM.model = {};
// *********************************************************************************
// ENCAPSULATE DATA
// *********************************************************************************
/**
* Get the sdxInfo data template for all QueryMaster.
* @memberOf i2b2.sdx.TypeControllers.QM
* @method
* @return {Object} Returns a data object containing sdxType, sdxKeyName, sdxControlCell info for QueryMaster-type objects.
* @author Nick Benik
* @version 1.0
* @alias i2b2.sdx.Master.EncapsulateData
*/
i2b2.sdx.TypeControllers.QM.getEncapsulateInfo = function() {
// this function returns the encapsulation head information
return {sdxType: 'QM', sdxKeyName: 'id', sdxControlCell:'CRC', sdxDisplayNameKey:'name'};
}
// *********************************************************************************
// GENERATE HTML (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QM.RenderHTML= function(sdxData, options, targetDiv) {
// OPTIONS:
// title: string
// showchildren: true | false
// cssClass: string
// icon: [data object]
// icon: (filename of img, appended to i2b2_root+cellDir + '/assets')
// iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets')
// dragdrop: string (function name)
// context: string
// click: string
// dblclick: string
if (Object.isUndefined(options)) { options = {}; }
var render = {html: retHtml, htmlID: id};
var conceptId = sdxData.name;
var id = "CRC_ID-" + i2b2.GUID();
if (Object.isUndefined(conceptId))
{
options.title = sdxData.sdxInfo.sdxDisplayName;
}
// process drag drop controllers
if (!Object.isUndefined(options.dragdrop)) {
// NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well?
// This would ensure removal of the onmouseover call in a cross-browser way
var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" ';
} else {
var sDD = '';
}
if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultQM';}
// user can override
bCanExp = true;
if (Object.isBoolean(options.showchildren)) {
bCanExp = options.showchildren;
}
render.canExpand = bCanExp;
render.iconType = "QM";
+ //set icon and iconExp if flagged.
+ if(sdxData.origData.flagged === "true") {
+ options.icon = "sdx_CRC_QM_flagged.gif";
+ options.iconExp = "sdx_CRC_QM_exp_flagged.gif";
+ } else{
+ options.icon = "sdx_CRC_QM.gif";
+ options.iconExp = "sdx_CRC_QM_exp.gif";
+ }
+
if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon }
if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp }
// in cases of one set icon, copy valid icon to the missing icon
if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; }
if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; }
// handle the event controllers
var sMainEvents = sDD;
var sImgEvents = sDD;
if (options.click) {sMainEvents += ' onclick="'+ options.click +'" '; }
if (options.dblclick) {sMainEvents += ' ondblclick="'+ options.dblclick +'" '; }
if (options.context) {sMainEvents += ' oncontext="'+ options.context +'" '; } else {retHtml += ' oncontextmenu="return false" '; }
// **** Render the HTML ***
- var retHtml = '
';
retHtml += ' ';
if (!Object.isUndefined(options.title)) {
retHtml += options.title;
} else {
console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC>QM node!');
retHtml += ' QM '+id;
}
retHtml += '
';
render.html = retHtml;
render.htmlID = id;
var retObj = {};
Object.extend(retObj, sdxData);
retObj.renderData = render;
return retObj;
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QM.onHoverOver = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.addClassName(el,'ddQMTarget'); }
}
// *********************************************************************************
// HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QM.onHoverOut = function(e, id, ddProxy) {
var el = $(id);
if (el) { Element.removeClassName(el,'ddQMTarget'); }
}
// *********************************************************************************
// ADD DATA TO TREENODE (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QM.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true);
if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
return tmpNode;
}
/**
* Get the child QueryInstance records for the given QueryMaster.
* @param {Object} sdxParentNode The parent node we want to find the children of.
* @param {ScopedCallback} onCompleteCallback A scoped-callback function to be executed using the results array.
* @return {Boolean} Returns true to the calling function.
* @return {Array} Returns an array of QueryInstance data represented as SDX Objects (without render data) to the callback function passed.
* @memberOf i2b2.sdx.TypeControllers.QM
* @method
* @author Nick Benik
* @version 1.0
* @alias i2b2.sdx.Master.getChildRecords
*/
i2b2.sdx.TypeControllers.QM.getChildRecords = function(sdxParentNode, onCompleteCallback) {
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.scope = sdxParentNode;
scopedCallback.callback = function(results) {
var cl_node = sdxParentNode;
var cl_onCompleteCB = onCompleteCallback;
// THIS function is used to process the AJAX results of the getChild call
// results data object contains the following attributes:
// refXML: xmlDomObject <--- for data processing
// msgRequest: xml (string)
// msgResponse: xml (string)
// error: boolean
// errorStatus: string [only with error=true]
// errorMsg: string [only with error=true]
var retMsg = {
error: results.error,
msgRequest: results.msgRequest,
msgResponse: results.msgResponse,
msgUrl: results.msgUrl,
results: null
};
var retChildren = [];
// find parent node
var dm = i2b2.CRC.model.QueryMasters;
var dm_loc = 'i2b2.CRC.model.QueryMasters';
var findFunc = function(item_rec) {
// this function expects the second argument to be the target node's key value
var hash_key = item_rec[0];
var QM_rec = item_rec[1];
if (QM_rec.sdxInfo.sdxKeyValue == this.strip()) { return true; }
}
var parent_QM = dm.findAll(findFunc, cl_node.sdxInfo.sdxKeyValue);
if (parent_QM[0]) {
var pn = parent_QM[0].value;
} else {
console.error('Parent QM node was not found in the CRC data model!');
return false;
}
// extract records from XML msg
var qi = results.refXML.getElementsByTagName('query_instance');
for(var i1=0; i1<1*qi.length; i1++) {
var o = new Object;
o.xmlOrig = qi[i1];
o.query_master_id = i2b2.h.getXNodeVal(qi[i1],'query_master_id');
o.query_instance_id = i2b2.h.getXNodeVal(qi[i1],'query_instance_id');
o.id = o.query_instance_id;
o.batch_mode = i2b2.h.getXNodeVal(qi[i1],'batch_mode');
o.start_date = i2b2.h.getXNodeVal(qi[i1],'start_date');
o.end_date = i2b2.h.getXNodeVal(qi[i1],'end_date');
o.query_status_type = i2b2.h.getXNodeVal(qi[i1],'query_status_type');
o.title = "Results of " + pn.origData.name;
if (i2b2.h.getXNodeVal(qi[i1],'description') != "COMPLETED")
{
o.title += " - " + i2b2.h.getXNodeVal(qi[i1],'description');
}
var sdxDataNode = i2b2.sdx.Master.EncapsulateData('QI',o);
// append to the QI record onto the QM in CRC data model
var sdxDataNode = i2b2.sdx.Master.Save(sdxDataNode, pn);
// append the data node to our returned results
retChildren.push(sdxDataNode);
}
pn.children.loaded = true;
// TODO: broadcast a data update event of the CRC data model
retMsg.results = retChildren;
if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') {
cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retMsg);
} else {
cl_onCompleteCB(retMsg);
}
}
i2b2.CRC.ajax.getQueryInstanceList_fromQueryMasterId("CRC:SDX:QueryMaster", {qm_key_value: sdxParentNode.sdxInfo.sdxKeyValue}, scopedCallback);
}
i2b2.sdx.TypeControllers.QM.SaveToDataModel = function(sdxData) {
// save to CRC data model
var dm_loc = 'i2b2.CRC.model.QueryMasters';
var qm_id = sdxData.sdxInfo.sdxKeyValue;
var qm_hash = i2b2.sdx.Master._KeyHash(qm_id);
// class for all SDX communications
function i2b2_SDX_Encapsulation_EXTENDED() {}
// create an instance and populate with info
var t = new i2b2_SDX_Encapsulation_EXTENDED();
t.origData = Object.clone(sdxData.origData);
t.sdxInfo = Object.clone(sdxData.sdxInfo);
t.parent = null;
t.children = new Hash();
t.children.loaded = false;
// add to hash
i2b2.CRC.model.QueryMasters.set(qm_hash, t);
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
return t;
}
i2b2.sdx.TypeControllers.QM.LoadFromDataModel = function(key_value) {
// load from CRC data model
var dm = i2b2.CRC.model.QueryMasters;
var dm_loc = 'i2b2.CRC.model.QueryMasters';
var qm_id = key_value;
var qm_hash = i2b2.sdx.Master._KeyHash(qm_id);
// retreve the record
return dm.get(qm_hash);
}
i2b2.sdx.TypeControllers.QM.ClearAllFromDataModel= function(sdxOptionalParent) {
i2b2.CRC.model.QueryMasters = new Hash();
var dm_loc = 'i2b2.CRC.model.QueryMasters';
// TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!)
return true;
}
i2b2.sdx.TypeControllers.QM.LoadChildrenFromTreeview = function(node, onCompleteCallback) {
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.scope = node.data.i2b2_SDX;
scopedCallback.callback = function(retCellPack) {
var cl_node = node;
var cl_onCompleteCB = onCompleteCallback;
var results = retCellPack.results;
for(var i1=0; i1<1*results.length; i1++) {
var o = results[i1];
var renderOptions = {
title: o.origData.title,
dragdrop: "i2b2.sdx.TypeControllers.QI.AttachDrag2Data",
dblclick: "i2b2.CRC.view.history.ToggleNode(this,'"+cl_node.tree.id+"')",
icon: "sdx_CRC_QI.gif",
iconExp: "sdx_CRC_QI_exp.gif"
};
var sdxRenderData = i2b2.sdx.Master.RenderHTML(cl_node.tree.id, o, renderOptions);
i2b2.sdx.Master.AppendTreeNode(cl_node.tree, cl_node, sdxRenderData);
}
// handle the callback
if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') {
cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retCellPack);
} else {
cl_onCompleteCB(retCellPack);
}
}
var sdxParentNode = node.data.i2b2_SDX;
i2b2.sdx.Master.getChildRecords(sdxParentNode, scopedCallback);
}
// *********************************************************************************
// ATTACH DRAG TO DATA (DEFAULT HANDLER)
// *********************************************************************************
i2b2.sdx.TypeControllers.QM.AttachDrag2Data = function(divParentID, divDataID){
if (Object.isUndefined($(divDataID))) { return false; }
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divParentID);
var tvNode = tvTree.getNodeByProperty('nodeid', divDataID);
if (!Object.isUndefined(tvNode.DDProxy)) { return true; }
//If termporal query than dont allow drag
//if (!Object.isUndefined(tvNode.data.i2b2_SDX.origData.master_type_cd) && tvNode.data.i2b2_SDX.origData.master_type_cd == "TEMPORAL") { return true; }
// attach DD
var t = new i2b2.sdx.TypeControllers.QM.DragDrop(divDataID)
t.yuiTree = tvTree;
t.yuiTreeNode = tvNode;
tvNode.DDProxy = t;
// clear the mouseover attachment function
var tdn = $(divDataID);
if (!Object.isUndefined(tdn.onmouseover)) {
try {
delete tdn.onmouseover;
} catch(e) {
tdn.onmouseover;
}
}
if (!Object.isUndefined(tdn.attributes)) {
for (var i=0;i maxX) {posX = maxX;}
if (posX < 6) {posX = 6;}
if (posY > maxY) {posY = maxY;}
if (posY < 6) {posY = 6;}
YAHOO.util.Dom.setStyle(el, "left", posX + "px");
YAHOO.util.Dom.setStyle(el, "top", posY + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
};
i2b2.sdx.TypeControllers.QM.DragDrop.prototype.onDragOver = function(e, id, sdxType) {
// check to see if on-the-fly object type translation is needed
var translateTo = false;
if (Object.isUndefined(this.DDM.dragOvers[id])) { return false; }
// we must save which target we are over for the DragOut event later
this.lastDragOver = this.DDM.dragOvers[id];
var t = this.DDM.dragOvers[id].groups;
if (!t['QM']) {
// TRANSLATION NEEDED!
if (t['QI']) {
translateTo = "QI";
} else if (t['PRS']) {
translateTo = "PRS";
}
} else {
var translateTo = "QM";
}
// fire the onHoverOver (use SDX so targets can override default event handler)
if (translateTo) { i2b2.sdx.Master.onHoverOver(translateTo, e, id, this); }
};
i2b2.sdx.TypeControllers.QM.DragDrop.prototype.onDragOut = function(e, id, sdxType) {
// fire the onHoverOut handler (use SDX so targets can override default event handlers)
// check to see if on-the-fly object type translation is needed
var translateTo = false;
if (Object.isUndefined(this.lastDragOver)) { return false; }
var t = this.lastDragOver.groups;
if (!t['QM']) {
// TRANSLATION NEEDED!
if (t['QI']) {
translateTo = "QI";
} else if (t['PRS']) {
translateTo = "PRS";
}
} else {
var translateTo = "QM";
}
// fire the onHoverOver (use SDX so targets can override default event handler)
if (translateTo) { i2b2.sdx.Master.onHoverOut(translateTo, e, id, this); }
};
i2b2.sdx.TypeControllers.QM.DragDrop.prototype.onDragDrop = function(e, id, sdxType) {
// handle a bug in YUI (dragdrop.js @ lines 872-881)
if (this._handledDragDropAlready) {
return true;
} else {
this._handledDragDropAlready = true;
var scopeHackThis = this;
var resetClosure = function() {
delete scopeHackThis._handledDragDropAlready;
};
setTimeout(resetClosure, 100);
}
// check to see if on-the-fly object type translation is needed
var translateTo = false;
if (Object.isUndefined(this.lastDragOver)) { return false; }
var t = this.lastDragOver.groups;
if (!t['QM']) {
// TRANSLATION NEEDED!
if (t['QI']) {
translateTo = "QI";
} else if (t['PRS']) {
translateTo = "PRS";
}
} else {
translateTo = "QM";
}
// fire the onHoverOver (use SDX so targets can override default event handler)
if (translateTo) {
i2b2.sdx.Master.onHoverOut(translateTo, e, id, this);
// retreive the concept data from the dragged element
// PERFROM on-the-fly OBJECT TRANSLATION HERE!!
var draggedData;
switch (translateTo) {
case "QM":
// no translation needed
var draggedData = [];
draggedData.push(this.yuiTreeNode.data.i2b2_SDX);
i2b2.sdx.Master.ProcessDrop(draggedData, id);
break;
case "QI":
var draggedData = this.yuiTreeNode.data.i2b2_SDX;
if (draggedData.children.size() == 0) {
alert("Translate QM to QI");
} else {
alert("QI already loaded, drop existing children");
// i2b2.sdx.Master.ProcessDrop(draggedData, id);
}
break;
case "PRS":
var draggedData = this.yuiTreeNode.data.i2b2_SDX;
if (!draggedData.children.loaded) {
// a little explaination about the below code: loading/expanding the
// treeview recursively via asynchronous calls
var tn1 = this.yuiTreeNode;
var id1 = id;
i2b2.sdx.Master.LoadChildrenFromTreeview(this.yuiTreeNode, (function(){
// hated closures are the most loved
var cl_tn1 = tn1;
var cl_id1 = id1;
cl_tn1.dynamicLoadComplete = true;
cl_tn1.expand();
for (var i1=0; i1 DROP HANDLER
// !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING
// !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION
// *********************************************************************************
i2b2.sdx.TypeControllers.QM.DropHandler = function(sdxData) {
alert('[QueryMaster DROPPED] You need to create your own custom drop event handler.');
}
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_History.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_History.js
index fe0af8304..12e35ac6c 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_History.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_History.js
@@ -1,583 +1,585 @@
/**
* @projectDescription View controller for the history viewport. (CRC's "previous queries" window)
* @inherits i2b2.CRC.view
* @namespace i2b2.CRC.view.history
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > view > History');
console.time('execute time');
// create and save the screen objects
i2b2.CRC.view.history = new i2b2Base_cellViewController(i2b2.CRC, 'history');
i2b2.CRC.view.history.visible = false;
// define the option functions
// ================================================================================================== //
i2b2.CRC.view.history.showOptions = function(subScreen){
if (!this.modalOptions) {
var handleSubmit = function(){
// submit value(s)
if (this.submit()) {
if ($('HISTsortOrderASC').checked) {
tmpValue = 'ASC';
}
else {
tmpValue = 'DESC';
}
i2b2.CRC.view['history'].params.sortOrder = tmpValue;
if ($('HISTsortByNAME').checked) {
tmpValue = 'NAME';
}
else {
tmpValue = 'DATE';
}
i2b2.CRC.view['history'].params.sortBy = tmpValue;
tmpValue = parseInt($('HISTMaxQryDisp').value, 10);
i2b2.CRC.view['history'].params.maxQueriesDisp = tmpValue;
// requery the history list
i2b2.CRC.ctrlr.history.Refresh();
}
}
var handleCancel = function(){
this.cancel();
}
this.modalOptions = new YAHOO.widget.SimpleDialog("optionsHistory", {
width: "400px",
fixedcenter: true,
constraintoviewport: true,
modal: true,
zindex: 700,
buttons: [{
text: "OK",
handler: handleSubmit,
isDefault: true
}, {
text: "Cancel",
handler: handleCancel
}]
});
$('optionsHistory').show();
this.modalOptions.validate = function(){
// now process the form data
var tmpValue = parseInt($('HISTMaxQryDisp').value, 10);
if (!isNaN(tmpValue) && tmpValue <= 0) {
alert("The max number of Queries must be a whole number larger then zero.");
return false;
}
return true;
};
this.modalOptions.render(document.body);
}
this.modalOptions.show();
// load settings
if (this.params.sortOrder=="ASC") {
$('HISTsortOrderASC').checked = true;
} else {
$('HISTsortOrderDESC').checked = true;
}
if (this.params.sortBy=="NAME") {
$('HISTsortByNAME').checked = true;
} else {
$('HISTsortByDATE').checked = true;
}
$('HISTMaxQryDisp').value = this.params.maxQueriesDisp;
}
// ================================================================================================== //
i2b2.CRC.view.history.ToggleNode = function(divTarg, divTreeID) {
// get the i2b2 data from the yuiTree node
var tvTree = YAHOO.widget.TreeView.getTree(divTreeID);
var tvNode = tvTree.getNodeByProperty('nodeid', divTarg.id);
tvNode.toggle();
}
// ================================================================================================== //
i2b2.CRC.view.history.Resize = function(e) {
// this function provides the resize functionality needed for this screen
var viewObj = i2b2.CRC.view.history;
var ve = $('crcHistoryBox');
if (viewObj.visible) {
ve.show();
// var ds = document.viewport.getDimensions();
var w = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
var h = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
if (w < 840) {w = 840;}
if (h < 517) {h = 517;}
ve = ve.style;
// resize our visual components
switch(i2b2.hive.MasterView.getViewMode()) {
case "Patients":
if (i2b2.WORK && i2b2.WORK.isLoaded) {
// make room for the workspace window
ve.width = Math.max(initBrowserViewPortDim.width-rightSideWidth, 0);
ve.top = h-196+44;
$('crcHistoryData').style.height = '100px';
} else {
ve.width = w-578;
ve.top = h-196;
$('crcHistoryData').style.height = '144px';
}
break;
case "Analysis":
if (i2b2.WORK && i2b2.WORK.isLoaded) {
// make room for the workspace window
w = parseInt(w/3)-10;
ve.width = w;
ve.top = h-196+44;
$('crcHistoryData').style.height = '100px';
} else {
w = parseInt(w/3)-10;
ve.width = w;
ve.top = h-196;
$('crcHistoryData').style.height = '144px';
}
break;
}
if (viewObj.isZoomed) {
ve.top = '';
$('crcHistoryData').style.height = h-97;
}
$$('DIV#crcHistoryBox DIV#crcHistoryData')[0].style.width = (parseInt(ve.width)-24) + 'px';
this.splitterDragged();
this.ResizeHeight();
} else {
ve.hide();
}
}
//YAHOO.util.Event.addListener(window, "resize", i2b2.CRC.view.history.Resize, i2b2.CRC.view.history); // tdw9
i2b2.CRC.view.history.Resize();
//================================================================================================== //
i2b2.CRC.view.history.splitterDragged = function()
{
var splitter = $( i2b2.hive.mySplitter.name );
var CRCHist = $("crcHistoryBox");
CRCHist.style.width = Math.max((parseInt(splitter.style.left) - CRCHist.offsetLeft - 3), 0) + "px";
$$('DIV#crcHistoryBox DIV#crcHistoryData')[0].style.width = Math.max((parseInt(CRCHist.style.width)-24), 0) + 'px';
}
//================================================================================================== //
i2b2.CRC.view.history.ResizeHeight = function() {
// this function provides the resize functionality needed for this screen
var viewObj = i2b2.CRC.view.history;
var ve = $('crcHistoryBox');
if (viewObj.visible) {
ve.show();
// var ds = document.viewport.getDimensions();
var h = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
if (h < 517) {h = 517;}
ve = ve.style;
// resize our visual components
switch(i2b2.hive.MasterView.getViewMode()) {
case "Patients":
if (i2b2.WORK && i2b2.WORK.isLoaded) {
// make room for the workspace window
ve.top = h-196+44;
$('crcHistoryData').style.height = '100px';
} else {
ve.top = h-196;
$('crcHistoryData').style.height = '144px';
}
break;
case "Analysis":
if (i2b2.WORK && i2b2.WORK.isLoaded) {
// make room for the workspace window
ve.top = h-196+44;
$('crcHistoryData').style.height = '100px';
} else {
ve.top = h-196;
$('crcHistoryData').style.height = '144px';
}
break;
}
if (viewObj.isZoomed) {
ve.top = '';
$('crcHistoryData').style.height = h-97;
}
} else {
ve.hide();
}
}
// ================================================================================================== //
i2b2.CRC.view.history.PopulateQueryMasters = function(dm_ptr, dm_name, options) {
var thisview = i2b2.CRC.view.history;
// clear the data first
var tvTree = i2b2.CRC.view.history.yuiTree;
var tvRoot = tvTree.getRoot();
tvTree.removeChildren(tvRoot);
tvTree.locked = false;
// sort by the options
if (Object.isUndefined(options)) { var options = {}; }
if (!options.sortBy) { options.sortBy = 'DATE'; }
if (!options.sortOrder) { options.sortBy = 'DESC'; }
if (options.sortBy=='NAME') {
var compareAttrib = 'name';
} else {
var compareAttrib = 'created';
}
if (options.sortOrder=='ASC') {
var reverseSort = false;
} else {
var reverseSort = true;
}
// NEW SORT METHOD USING prototype Enumerators
var QM_sortVal = function(rec) {
var hash_key = rec[0];
var sdxExtObj = rec[1];
var cl_compareAttrib = compareAttrib; // <---- closure var
var t = sdxExtObj.origData[cl_compareAttrib];
if (cl_compareAttrib=="created") {
// proper date handling (w/improper handling for latest changes to output format)
var sd = t.toUpperCase();
if (sd.indexOf('Z') != -1 || sd.indexOf('T') != -1) {
t = t.toLowerCase();
} else {
t = Date.parse(t);
}
} else {
t = String(t.toLowerCase() );
}
return t;
};
var sortFinal = i2b2.CRC.model.QueryMasters.sortBy(QM_sortVal);
// reverse if needed
if (reverseSort) { sortFinal.reverse(true); }
// populate the Query Masters into the treeview
for (var i=0; i
i2b2.CRC.view.history.queryResponse = cellResult.msgResponse;
i2b2.CRC.view.history.queryRequest = cellResult.msgRequest;
i2b2.CRC.view.history.queryUrl = cellResult.msgUrl;
//
for(var i1=0; i1<1*cellResult.results.length; i1++) {
var o = cellResult.results[i1];
var renderOptions = {
title: o.origData.title,
dragdrop: "i2b2.sdx.TypeControllers.QI.AttachDrag2Data",
dblclick: "i2b2.CRC.view.history.ToggleNode(this,'"+cl_node.tree.id+"')",
icon: "sdx_CRC_QI.gif",
iconExp: "sdx_CRC_QI_exp.gif"
};
var sdxRenderData = i2b2.sdx.Master.RenderHTML(cl_node.tree.id, o, renderOptions);
i2b2.sdx.Master.AppendTreeNode(cl_node.tree, cl_node, sdxRenderData);
}
// handle the YUI treeview
if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') {
cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, cellResult);
} else {
cl_onCompleteCB(cellResult);
}
}
var sdxParentNode = node.data.i2b2_SDX;
i2b2.sdx.Master.getChildRecords(sdxParentNode, scopedCallback);
}));
// -------------------------------------------------------
i2b2.CRC.view.history.ContextMenu = new YAHOO.widget.ContextMenu(
"divContextMenu-History",
{ lazyload: true,
trigger: $('crcHistoryBox'),
itemdata: [
{ text: "Rename", onclick: { fn: i2b2.CRC.view.history.doRename } },
{ text: "Delete", onclick: { fn: i2b2.CRC.view.history.doDelete } },
{ text: "Refresh All", onclick: { fn: i2b2.CRC.view.history.doRefreshAll } },
{ text: "Flag", onclick: { fn: i2b2.CRC.view.history.doQueryFlagPrompt }},
{ text: "Unflag", onclick: { fn: i2b2.CRC.view.history.doUnflag}}
] }
);
i2b2.CRC.view.history.ContextMenu.subscribe("triggerContextMenu",i2b2.CRC.view.history.ContextMenuValidate);
// =========================================================
}
})
);
//================================================================================================== //
i2b2.events.initView.subscribe((function(eventTypeName, newMode) {
// -------------------------------------------------------
this.visible = true;
if (i2b2.WORK && i2b2.WORK.isLoaded) {
$('crcHistoryData').style.height = '100px';
} else {
$('crcHistoryData').style.height = '144px';
}
$('crcHistoryBox').show();
this.Resize();
// -------------------------------------------------------
}),'',i2b2.CRC.view.history);
// ================================================================================================== //
i2b2.events.changedViewMode.subscribe((function(eventTypeName, newMode) {
newMode = newMode[0];
this.viewMode = newMode;
switch(newMode) {
case "Patients":
case "Analysis":
var wlst = i2b2.hive.MasterView.getZoomWindows();
if (wlst.indexOf("ONT")!=-1 || wlst.indexOf("WORK")!=-1) { return; }
this.visible = true;
if (i2b2.WORK && i2b2.WORK.isLoaded) {
$('crcHistoryData').style.height = '100px';
} else {
$('crcHistoryData').style.height = '144px';
}
$('crcHistoryBox').show();
//this.Resize(); // tdw9
this.splitterDragged();
this.ResizeHeight();
break;
default:
this.visible = false;
$('crcHistoryBox').hide();
break;
}
}),'',i2b2.CRC.view.history);
// ================================================================================================== //
i2b2.events.changedZoomWindows.subscribe((function(eventTypeName, zoomMsg) {
newMode = zoomMsg[0];
if (!newMode.action) { return; }
if (newMode.action == "ADD") {
switch (newMode.window) {
case "HISTORY":
this.isZoomed = true;
this.visible = true;
break;
case "ONT":
case "WORK":
this.visible = false;
this.isZoomed = false;
}
} else {
switch (newMode.window) {
case "HISTORY":
case "ONT":
case "WORK":
this.isZoomed = false;
this.visible = true;
}
}
this.ResizeHeight();
this.splitterDragged();
}),'',i2b2.CRC.view.history);
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_QryTool.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_QryTool.js
index f32609169..1dd9db1f6 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_QryTool.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_QryTool.js
@@ -1,1322 +1,1352 @@
/**
* @projectDescription View controller for CRC Query Tool window.
* @inherits i2b2.CRC.view
* @namespace i2b2.CRC.view.QT
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > view > Main');
console.time('execute time');
// create and save the screen objects
i2b2.CRC.view['QT'] = new i2b2Base_cellViewController(i2b2.CRC, 'QT');
var queryTimingButton;
// define the option functions
// ================================================================================================== //
i2b2.CRC.view.QT.showOptions = function(subScreen) {
if (!this.modalOptions) {
var handleSubmit = function() {
// submit value(s)
if(this.submit()) {
var tmpValue = parseInt($('QryTimeout').value,10);
i2b2.CRC.view['QT'].params.queryTimeout = tmpValue;
// var tmpValue = parseInt($('MaxChldDisp').value,10);
// i2b2.CRC.view['QT'].params.maxChildren = tmpValue;
}
}
var handleCancel = function() {
this.cancel();
}
this.modalOptions = new YAHOO.widget.SimpleDialog("optionsQT",
{ width : "400px",
fixedcenter : true,
constraintoviewport : true,
modal: true,
zindex: 700,
buttons : [ { text:"OK", handler:handleSubmit, isDefault:true },
{ text:"Cancel", handler:handleCancel } ]
} );
$('optionsQT').show();
this.modalOptions.validate = function() {
// now process the form data
var msgError = '';
// var tmpValue = parseInt($('MaxChldDisp').value,10);
// if (!isNaN(tmpValue) && tmpValue <= 0) {
// msgError += "The max number of Children to display must be a whole number larger then zero.\n";
// }
var tmpValue = parseInt($('QryTimeout').value,10);
if (!isNaN(tmpValue) && tmpValue <= 0) {
msgError += "The the query timeout period must be a whole number larger then zero.\n";
}
if (msgError) {
alert(msgError);
return false;
}
return true;
};
this.modalOptions.render(document.body);
}
this.modalOptions.show();
// load settings
// $('MaxChldDisp').value = this.params.maxChildren;
$('QryTimeout').value = this.params.queryTimeout;
}
// ================================================================================================== //
i2b2.CRC.view.QT.ContextMenuPreprocess = function(p_oEvent) {
var clickId = false;
var clickPanel = false;
var isDone = false;
var currentNode = this.contextEventTarget;
var doNotShow = false;
while (!isDone) {
// save the first DOM node found with an ID
if (currentNode.id && !clickId) {
clickId = currentNode.id;
}
// save and exit when we find the linkback to the panel controller
if (currentNode.linkbackPanelController) {
// we are at the tree root...
var clickPanel = currentNode.linkbackPanelController;
isDone = true;
}
if (currentNode.parentNode) {
currentNode = currentNode.parentNode;
} else {
// we have recursed up the tree to the window/document DOM...
isDone = true;
}
}
if (!clickId || !clickPanel) {
// something is missing, exit
this.cancel();
return;
}
// see if the ID maps back to a treenode with SDX data
var tvNode = clickPanel.yuiTree.getNodeByProperty('nodeid', clickId);
if (tvNode) {
if (!Object.isUndefined(tvNode.data.i2b2_SDX)) {
// Make sure the clicked node is at the root level
if (tvNode.parent == clickPanel.yuiTree.getRoot()) {
if (p_oEvent == "beforeShow") {
i2b2.CRC.view.QT.contextRecord = tvNode.data.i2b2_SDX;
i2b2.CRC.view.QT.contextPanelCtrlr = clickPanel;
// custom build the context menu according to the concept that was clicked
var mil = [];
var op = i2b2.CRC.view.QT;
// all nodes can be deleted
mil.push( { text: "Delete", onclick: { fn: op.ContextMenuRouter, obj: 'delete' }} );
if (i2b2.CRC.view.QT.contextRecord.origData.isModifier) {
//Get the blob for this now.
// if (i2b2.CRC.view.QT.contextRecord.origData.xmlOrig != null) {
var cdetails = i2b2.ONT.ajax.GetModifierInfo("CRC:QueryTool", {modifier_applied_path:i2b2.CRC.view.QT.contextRecord.origData.applied_path, modifier_key_value:i2b2.CRC.view.QT.contextRecord.origData.key, ont_synonym_records: true, ont_hidden_records: true} );
// this is what comes out of the old AJAX call
var c = i2b2.h.XPath(cdetails.refXML, 'descendant::modifier');
if (c.length > 0) {
i2b2.CRC.view.QT.contextRecord.origData.xmlOrig = c[0];
}
// }
var lvMetaDatas1 = i2b2.h.XPath(i2b2.CRC.view.QT.contextRecord.origData.xmlOrig, 'metadataxml/ValueMetadata[string-length(Version)>0]');
if (lvMetaDatas1.length > 0) {
mil.push( { text: "Set Modifier Value", onclick: { fn: op.ContextMenuRouter, obj: 'setmodifier' }} );
}
var lvMetaDatas2 = i2b2.h.XPath(i2b2.CRC.view.QT.contextRecord.origData.parent.xmlOrig, 'metadataxml/ValueMetadata[string-length(Version)>0]');
if (lvMetaDatas2.length > 0) {
mil.push( { text: "Set Value...", onclick: { fn: op.ContextMenuRouter, obj: 'labvalues' }} );
}
} else {
// For lab tests...
if (!Object.isUndefined(i2b2.CRC.view.QT.contextRecord.origData.key)) {
var cdetails = i2b2.ONT.ajax.GetTermInfo("CRC:QueryTool", {concept_key_value:i2b2.CRC.view.QT.contextRecord.origData.key, ont_synonym_records: true, ont_hidden_records: true} );
var c = i2b2.h.XPath(cdetails.refXML, 'descendant::concept');
if (c.length > 0) {
i2b2.CRC.view.QT.contextRecord.origData.xmlOrig = c[0];
}
}
var lvMetaDatas = i2b2.h.XPath(i2b2.CRC.view.QT.contextRecord.origData.xmlOrig, 'metadataxml/ValueMetadata[string-length(Version)>0]');
if (lvMetaDatas.length > 0) {
mil.push( { text: "Set Value...", onclick: { fn: op.ContextMenuRouter, obj: 'labvalues' }} );
}
}
i2b2.CRC.view.QT.ContextMenu.clearContent();
i2b2.CRC.view.QT.ContextMenu.addItems(mil);
i2b2.CRC.view.QT.ContextMenu.render();
}
} else {
// not root level node
doNotShow = true;
}
} else {
// no SDX data
doNotShow = true;
}
} else {
// not a treenode
doNotShow = true;
}
if (doNotShow) {
if (p_oEvent == "beforeShow") { i2b2.CRC.view.QT.ContextMenu.clearContent(); }
if (p_oEvent == "triggerContextMenu") { this.cancel(); }
}
}
// ================================================================================================== //
i2b2.CRC.view.QT.ContextMenuRouter = function(a, b, actionName) {
// this is used to route the event to the correct handler
var op = i2b2.CRC.view.QT; // object path
var cdat = { // context node data
data: op.contextRecord,
ctrlr: op.contextPanelCtrlr
};
// route accordingly
switch(actionName) {
case "delete":
// delete item from the panel
cdat.ctrlr._deleteConcept(cdat.data.renderData.htmlID, cdat.data);
break;
case "labvalues":
cdat.ctrlr.showLabValues(cdat.data.sdxInfo.sdxKeyValue, cdat.data);
break;
case "setmodifier":
cdat.ctrlr.showModValues(cdat.data.sdxInfo.sdxKeyValue, cdat.data);
break;
default:
alert('context event was not found for event "'+actionName+'"');
}
}
//================================================================================================== //
i2b2.CRC.view.QT.enableSameTiming = function() {
if (YAHOO.util.Dom.inDocument(queryTimingButton.getMenu().element)) {
var t = queryTimingButton.getMenu().getItems();
if (t.length == 2) {
// queryTimingButton.getMenu().clearContent();
// queryTimingButton.getMenu().addItems([
// { text: "Treat Independently", value: "ANY"}]);
// queryTimingButton.getMenu().addItems([
// { text: "Selected groups occur in the same financial encounter", value: "SAMEVISIT" }]);
queryTimingButton.getMenu().addItems([
{ text: "Items Instance will be the samer", value: "SAMEINSTANCENUM" }]);
queryTimingButton.getMenu().render();
}
} else {
queryTimingButton.itemData =[{ text: "Treat Independently", value: "ANY"},
{ text: "Selected groups occur in the same financial encounter", value: "SAMEVISIT"},
{text: "Items Instance will be the same", value: "SAMEINSTANCENUM" }];
}
}
// ================================================================================================== //
i2b2.CRC.view.QT.setQueryTiming = function(sText) {
//TODO cleanup
if (YAHOO.util.Dom.inDocument(queryTimingButton.getMenu().element)) {
queryTimingButton.getMenu().clearContent();
queryTimingButton.getMenu().addItems([
{ text: "Treat Independently", value: "ANY"}]);
queryTimingButton.getMenu().addItems([
{ text: "Selected groups occur in the same financial encounter", value: "SAMEVISIT" }]);
queryTimingButton.getMenu().addItems([
{ text: "Define sequence of Events", value: "TEMPORAL" }]);
if (sText == "SAMEINSTANCENUM") {
queryTimingButton.getMenu().addItems([
{ text: "Items Instance will be the same", value: "SAMEINSTANCENUM" }]);
}
queryTimingButton.getMenu().render();
} else {
if (sText =="TEMPORAL") {
queryTimingButton.set("label", "Define sequence of Events");
i2b2.CRC.ctrlr.QT.queryTiming = "TEMPORAL";
$('defineTemporalBar').show();
} else if (sText =="SAMEVISIT") {
queryTimingButton.set("label", "Selected groups occur in the same financial encounter");
}
}
queryTimingButton.getMenu().render();
var menu = queryTimingButton.getMenu();
if (sText == "SAMEINSTANCENUM" )
{
var item = menu.getItem(3);
} else if (sText == "SAMEVISIT" )
{
var item = menu.getItem(1);
} else if (sText == "TEMPORAL" )
{
var item = menu.getItem(2);
} else
{
var item = menu.getItem(0);
}
queryTimingButton.set("selectedMenuItem", item);
}
//================================================================================================== //
i2b2.CRC.view.QT.setPanelTiming = function(panelNum, sText) {
if (panelNum > 3) {return}
if (sText == "SAMEVISIT" )
{
$("queryPanelTimingB" + (panelNum) + "-button").innerHTML = "Occurs in Same Encounter";
i2b2.CRC.ctrlr.QT.panelControllers[panelNum - 1].doTiming(sText);
i2b2.CRC.ctrlr.QT.panelControllers[panelNum - 1].refTiming.set('disabled', false);
} else if (sText == "SAMEINSTANCENUM") {
$("queryPanelTimingB" + (panelNum) + "-button").innerHTML = "Items Instance will be the same";
i2b2.CRC.ctrlr.QT.panelControllers[panelNum - 1].doTiming(sText);
i2b2.CRC.ctrlr.QT.panelControllers[panelNum - 1].refTiming.set('disabled', false);
} else {
$("queryPanelTimingB" + (panelNum) + "-button").innerHTML = "Treat Independently";
i2b2.CRC.ctrlr.QT.panelControllers[panelNum - 1].doTiming(sText);
}
}
// ================================================================================================== //
i2b2.CRC.view.QT.ZoomView = function() {
i2b2.hive.MasterView.toggleZoomWindow("QT");
}
// ================================================================================================== //
i2b2.CRC.view.QT.Resize = function(e) {
//var ds = document.viewport.getDimensions();
//var w = ds.width;
//var h = ds.height
var w = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
var h = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
if (w < 840) {w = 840;}
if (h < 517) {h = 517;}
// resize our visual components
//var queryToolWidth = ds.width * 0.6;
//$('crcQueryToolBox').style.left = w-queryToolWidth;
//debugOnScreen("crcQueryToolBox.width = " + queryToolWidth );
$('crcQueryToolBox').style.left = w-550;
if (i2b2.WORK && i2b2.WORK.isLoaded) {
var z = h - 400; //392 + 44 - 17 - 25;
if (i2b2.CRC.view.QT.isZoomed) { z += 196 - 44; }
} else {
var z = h - 392 - 17 - 25;
if (i2b2.CRC.view.QT.isZoomed) { z += 196; }
}
// display the topic selector bar if we are in SHRINE-mode
if (i2b2.h.isSHRINE()) {
$('queryTopicPanel').show();
z = z - 28;
}
$('QPD1').style.height = z;
$('QPD2').style.height = z;
$('QPD3').style.height = z;
$('temporalbuilders').style.height = z + 50;
}
//YAHOO.util.Event.addListener(window, "resize", i2b2.CRC.view.QT.Resize, i2b2.CRC.view.QT); // tdw9
//================================================================================================== //
i2b2.CRC.view.QT.splitterDragged = function()
{
//var viewPortDim = document.viewport.getDimensions();
var w = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
var splitter = $( i2b2.hive.mySplitter.name );
var CRCQT = $("crcQueryToolBox");
var CRCQTBodyBox = $("crcQueryToolBox.bodyBox");
var CRCQueryName = $("queryName");
var CRCQueryNameBar = $("queryNameBar");
var temporalConstraintBar = $("temporalConstraintBar");
var defineTemporalBar = $("defineTemporalBar");
var temporalConstraintLabel = $("temporalConstraintLabel");
var temporalConstraintDiv = $("temporalConstraintDiv");
var queryTiming = $("queryTiming");
var queryTimingButton = $("queryTiming-button");
var defineTemporal = $("defineTemporal");
var defineTemporalButton = $("defineTemporal-button");
var CRCQueryPanels = $("crcQryToolPanels");
var CRCinnerQueryPanel = $("crc.innerQueryPanel");
var CRCtemoralBuilder = $("crc.temoralBuilder");
var basicWidth = parseInt(w) - parseInt(splitter.style.left) - parseInt(splitter.offsetWidth);
/* Title, buttons, and panels */
CRCQT.style.left = parseInt(splitter.offsetWidth) + parseInt(splitter.style.left) + 3 + "px";
CRCQT.style.width = Math.max(basicWidth - 24, 0) + "px";
CRCQTBodyBox.style.width = Math.max(basicWidth - 41, 0) + "px";
CRCQueryNameBar.style.width = Math.max(basicWidth - 38, 0) + "px";
temporalConstraintBar.style.width = Math.max(basicWidth - 38, 0) + "px";
defineTemporalBar.style.width = Math.max(basicWidth - 38, 0) + "px";
temporalConstraintDiv.style.width = Math.max( parseInt(temporalConstraintBar.style.width) - parseInt(temporalConstraintLabel.style.width)-2, 0) + "px";
queryTimingButton.style.width = Math.max( parseInt(temporalConstraintBar.style.width) - 250,0) + "px";
defineTemporalButton.style.width = Math.max( parseInt(temporalConstraintBar.style.width) - 250,0) + "px";
//parseInt(temporalConstraintLabel.style.width)-23, 0) + "px";
CRCQueryName.style.width = Math.max(basicWidth - 128, 0) + "px"; // use max to avoid negative width
CRCQueryPanels.style.width = Math.max(basicWidth - 30, 0) + "px";
CRCinnerQueryPanel.style.width = Math.max(basicWidth - 36, 0) + "px";
CRCtemoralBuilder.style.width = Math.max(basicWidth - 36, 0) + "px";
var panelWidth = (basicWidth - 36)/3 - 4;
var panels = CRCinnerQueryPanel.childNodes;
var panelArray = new Array(3);
var panelCount = 0;
for ( var i = 0; i < panels.length; i++ )
{
if ( panels[i].className === "qryPanel")
{
panels[i].style.width = Math.max(panelWidth, 0) + "px";
var nodes = panels[i].childNodes;
for ( var j = 0; j < nodes.length; j++ )
{
if (nodes[j].className === "qryPanelTitle")
nodes[j].style.width = Math.max(panelWidth - 2, 0) + "px";
else if ( nodes[j].className === "qryPanelButtonBar" )
{
nodes[j].style.width = Math.max(panelWidth, 0) + "px";
var buttons = nodes[j].childNodes;
for ( var k = 0; k < buttons.length; k++)
{
if ( buttons[k].className === "qryButtonOccurs")
buttons[k].style.width = Math.max(panelWidth - 88, 0) + "px";
}
}
else if ( nodes[j].className === "qryPanelTiming" )
{
nodes[j].style.width = Math.max(panelWidth, 0) + "px";
var queryPanelTimingChildren = nodes[j].childNodes;
for ( var k = 0; k < queryPanelTimingChildren.length; k++)
{
if ( queryPanelTimingChildren[k].style == null )
continue;
queryPanelTimingChildren[k].style.width = Math.max(panelWidth - 4, 0) + "px";
}
//handle the special "queryPanelTimingB1"
var queryPanelTimingB1 = $("queryPanelTimingB1");
queryPanelTimingB1.style.width = Math.max(panelWidth - 4, 0) + "px";
}
else if ( nodes[j].className === "queryPanel" || nodes[j].className === "queryPanel queryPanelDisabled" ) // QueryPanel or disabled QueryPanel
nodes[j].style.width = Math.max(panelWidth - 8, 0) + "px";
}
panelArray[panelCount] = panels[i];
panelCount++;
}
else
continue;
}
/* Deal with Footer and its components */
var footer = $("qryToolFooter"); // footer
var printBox = $('printQueryBox'); // print query
var groupCount = $("groupCount"); // # of groups
var scrollBox = $("scrollBox"); // scroll control
footer.style.width = Math.max(basicWidth - 40, 0) + "px"; // adjust footer width
groupCount.style.width = Math.max(parseInt(footer.style.width) - (printBox.offsetLeft + printBox.offsetWidth) - scrollBox.offsetWidth - 5, 0) + "px"; // adjust groupCount width
/* Deal with Baloons */
var baloonBox = $("queryBalloonBox");
var baloons = baloonBox.getElementsByTagName("div");
for ( var i = 0; i < baloons.length; i++ )
{
if ( i%2 === 0) // even baloons
{
var index = i/2;
if ( index < baloons.length)
baloons[i].style.left = panelArray[index].offsetLeft + parseInt(panelArray[index].style.width)/2 - 35 + "px";
}
else
{
var index = Math.floor(i/2);
baloons[i].style.left = panelArray[index].offsetLeft + parseInt(panelArray[index].style.width) - 22.5 + "px";
}
}
}
//================================================================================================== //
i2b2.CRC.view.QT.ResizeHeight = function() {
//var ds = document.viewport.getDimensions();
//var h = ds.height;
//var h = window.document.documentElement.clientHeight;
var h = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
if (h < 517) {h = 517;}
// resize our visual components
if (i2b2.WORK && i2b2.WORK.isLoaded) {
var z = h - 400;
if (i2b2.CRC.view.QT.isZoomed) { z += 196 - 44; }
} else {
var z = h - 434;
if (i2b2.CRC.view.QT.isZoomed) { z += 196; }
}
// display the topic selector bar if we are in SHRINE-mode
if (i2b2.h.isSHRINE() && $('queryTopicPanel')) {
$('queryTopicPanel').show();
z = z - 28;
}
if ($('defineTemporalBar').style.display === '')
z = z - 20;
$('QPD1').style.height = z;
$('QPD2').style.height = z;
$('QPD3').style.height = z;
$('temporalbuilders').style.height = z + 50;
}
+i2b2.CRC.view.QT.deleteLastTemporalGroup = function() {
+
+ if(i2b2.CRC.model.queryCurrent.panels.length > 3){
+ var currentPanels = i2b2.CRC.model.queryCurrent.panels.length - 1;
+ i2b2.CRC.model.queryCurrent.panels.pop();
+ defineTemporalButton.getMenu().removeItem(defineTemporalButton.getMenu().getItems().length-1);
+
+ for( var i = 0; i < i2b2.CRC.ctrlr.QT.tenporalBuilders + 1; i++){
+ var select = document.getElementById("instancevent1["+i+"]");
+ select.remove(select.length - 1);
+
+ select = document.getElementById("instancevent2["+i+"]");
+ select.remove(select.length - 1);
+ }
+
+ alert('Event ' + currentPanels + ' has been removed.');
+ //i2b2.CRC.ctrlr.QT.temporalGroup = i2b2.CRC.model.queryCurrent.panels.length;
+
+ defineTemporalButton.getMenu().getItem(0).element.click()
+
+ } else {
+ alert('You must leave a minimum of two events.');
+
+ }
+};
+
// This is done once the entire cell has been loaded
console.info("SUBSCRIBED TO i2b2.events.afterCellInit");
i2b2.events.afterCellInit.subscribe(
(function(en,co) {
if (co[0].cellCode=='CRC') {
// ================================================================================================== //
console.debug('[EVENT CAPTURED i2b2.events.afterCellInit]');
//Update the result types from ajax call
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.callback = function(results) {
//var cl_onCompleteCB = onCompleteCallback;
// THIS function is used to process the AJAX results of the getChild call
// results data object contains the following attributes:
// refXML: xmlDomObject <--- for data processing
// msgRequest: xml (string)
// msgResponse: xml (string)
// error: boolean
// errorStatus: string [only with error=true]
// errorMsg: string [only with error=true]
var retMsg = {
error: results.error,
msgRequest: results.msgRequest,
msgResponse: results.msgResponse,
msgUrl: results.msgUrl,
results: null
};
var retChildren = [];
// extract records from XML msg
var newHTML = "";
var ps = results.refXML.getElementsByTagName('query_result_type');
for(var i1=0; i1 " + o.description + "
";
///}
}
//commented out for @pcori_webclient.
$('dialogQryRunResultType').innerHTML = newHTML;
}
i2b2.CRC.ajax.getQRY_getResultType("CRC:SDX:PatientRecordSet", null, scopedCallback);
// register the query panels as valid DragDrop targets for Ontology Concepts (CONCPT) and query master (QM) objects
var op_trgt = {dropTarget:true};
i2b2.sdx.Master.AttachType('QPD1', 'CONCPT', op_trgt);
i2b2.sdx.Master.AttachType('QPD2', 'CONCPT', op_trgt);
i2b2.sdx.Master.AttachType('QPD3', 'CONCPT', op_trgt);
i2b2.sdx.Master.AttachType('QPD1', 'ENS', op_trgt);
i2b2.sdx.Master.AttachType('QPD2', 'ENS', op_trgt);
i2b2.sdx.Master.AttachType('QPD3', 'ENS', op_trgt);
i2b2.sdx.Master.AttachType('QPD1', 'PRS', op_trgt);
i2b2.sdx.Master.AttachType('QPD2', 'PRS', op_trgt);
i2b2.sdx.Master.AttachType('QPD3', 'PRS', op_trgt);
i2b2.sdx.Master.AttachType('QPD1', 'QM', op_trgt);
i2b2.sdx.Master.AttachType('QPD2', 'QM', op_trgt);
i2b2.sdx.Master.AttachType('QPD3', 'QM', op_trgt);
i2b2.sdx.Master.AttachType('queryName', 'QM', op_trgt);
//======================= =======================
var funcHovOverQM = function(e, id, ddProxy) {
var el = $(id);
// apply DragDrop targeting CCS
var targets = YAHOO.util.DDM.getRelated(ddProxy, true);
for (var i=0; i =======================
//======================= =======================
i2b2.sdx.Master.setHandlerCustom('QPD1', 'CONCPT', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[0];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD2', 'CONCPT', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[1];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD3', 'CONCPT', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[2];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD1', 'ENS', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[0];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD2', 'ENS', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[1];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD3', 'ENS', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[2];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD1', 'PRS', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[0];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD2', 'PRS', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[1];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD3', 'PRS', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[2];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD1', 'QM', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[0];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD2', 'QM', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[1];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}));
i2b2.sdx.Master.setHandlerCustom('QPD3', 'QM', 'DropHandler', (function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
var t = i2b2.CRC.ctrlr.QT.panelControllers[2];
if (t.isActive=="Y") { t.doDrop(sdxData); }
}))
var funcATN = function(yuiTree, yuiParentNode, sdxDataPack, callbackLoader) {
var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID}
// if the treenode we are appending to is the root node then do not show the [+] infront
if (yuiTree.getRoot() == yuiParentNode) {
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiParentNode, false, false);
} else {
var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiParentNode, false, true);
}
if (sdxDataPack.renderData.iconType != 'CONCPT_item' && !Object.isUndefined(callbackLoader)) {
// add the callback to load child nodes
sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader;
}
tmpNode.data.i2b2_SDX= sdxDataPack;
tmpNode.toggle = function() {
if (!this.tree.locked && ( this.hasChildren(true) ) ) {
var data = this.data.i2b2_SDX.renderData;
var img = this.getContentEl();
img = Element.select(img,'img')[0];
if (this.expanded) {
img.src = data.icon;
this.collapse();
} else {
img.src = data.iconExp;
this.expand();
}
}
};
if (sdxDataPack.renderData.iconType == 'CONCPT_leaf' || !sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; }
}
i2b2.sdx.Master.setHandlerCustom('QPD1', 'CONCPT', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD2', 'CONCPT', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD3', 'CONCPT', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD1', 'ENS', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD2', 'ENS', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD3', 'ENS', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD1', 'PRS', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD2', 'PRS', 'AppendTreeNode', funcATN);
i2b2.sdx.Master.setHandlerCustom('QPD3', 'PRS', 'AppendTreeNode', funcATN);
var funcQMDH = function(sdxData) {
sdxData = sdxData[0]; // only interested in first record
// pass the QM ID to be loaded
var qm_id = sdxData.sdxInfo.sdxKeyValue;
i2b2.CRC.ctrlr.QT.doQueryLoad(qm_id)
};
i2b2.sdx.Master.setHandlerCustom('QPD1', 'QM', 'DropHandler', funcQMDH);
i2b2.sdx.Master.setHandlerCustom('QPD2', 'QM', 'DropHandler', funcQMDH);
i2b2.sdx.Master.setHandlerCustom('QPD3', 'QM', 'DropHandler', funcQMDH);
i2b2.sdx.Master.setHandlerCustom('queryName', 'QM', 'DropHandler', funcQMDH);
//======================= =======================
// ========= Override default LoadChildrenFromTreeview handler (we need this so that we can properly capture the XML request/response messages) =========
var funcLCFT = function(node, onCompleteCallback) {
var scopedCallback = new i2b2_scopedCallback();
scopedCallback.scope = node.data.i2b2_SDX;
scopedCallback.callback = function(results) {
var cl_node = node;
var cl_onCompleteCB = onCompleteCallback;
var cl_options = options;
// THIS function is used to process the AJAX results of the getChild call
// results data object contains the following attributes:
// refXML: xmlDomObject <--- for data processing
// msgRequest: xml (string)
// msgResponse: xml (string)
// error: boolean
// errorStatus: string [only with error=true]
// errorMsg: string [only with error=true]
//
i2b2.CRC.view.QT.queryResponse = results.msgResponse;
i2b2.CRC.view.QT.queryRequest = results.msgRequest;
i2b2.CRC.view.QT.queryUrl = results.msgUrl;
//
// clear the drop-lock so the node can be requeried if anything bad happens below
node.data.i2b2_dropLock = false;
// handle any errors
if (results.error) {
// process the specific error
var errorCode = results.refXML.getElementsByTagName('status')[0].firstChild.nodeValue;
if (errorCode == "MAX_EXCEEDED") {
var eaction = confirm("The number of children in this node exceeds the maximum number you specified in options.\n Displaying all children may take a long time to do.");
}
else {
alert("The following error has occurred:\n" + errorCode);
}
// re-fire the call with no max limit if the user requested so
if (eaction) {
var mod_options = Object.clone(cl_options);
delete mod_options.ont_max_records;
i2b2.ONT.ajax.GetChildConcepts("CRC:QueryTool", mod_options, scopedCallback);
return true;
}
// ROLLBACK the tree changes
cl_onCompleteCB();
// reset dynamic load state for the node (total hack of YUI Treeview)
node.collapse();
node.dynamicLoadComplete = false;
node.expanded = false;
node.childrenRendered = false;
node._dynLoad = true;
// uber-elite code (fix the style settings)
var tc = node.getToggleEl().className;
tc = tc.substring(0, tc.length - 1) + 'p';
node.getToggleEl().className = tc;
// fix the icon image
var img = node.getContentEl();
img = Element.select(img, 'img')[0];
img.src = node.data.i2b2_SDX.sdxInfo.icon;
return false;
}
var c = results.refXML.getElementsByTagName('concept');
for(var i=0; i<1*c.length; i++) {
var o = new Object;
o.xmlOrig = c[i];
o.name = i2b2.h.getXNodeVal(c[i],'name');
o.hasChildren = i2b2.h.getXNodeVal(c[i],'visualattributes').substring(0,2);
o.level = i2b2.h.getXNodeVal(c[i],'level');
o.key = i2b2.h.getXNodeVal(c[i],'key');
o.tooltip = i2b2.h.getXNodeVal(c[i],'tooltip');
o.icd9 = '';
o.table_name = i2b2.h.getXNodeVal(c[i],'tablename');
o.column_name = i2b2.h.getXNodeVal(c[i],'columnname');
o.operator = i2b2.h.getXNodeVal(c[i],'operator');
o.dim_code = i2b2.h.getXNodeVal(c[i],'dimcode');
// append the data node
var sdxDataNode = i2b2.sdx.Master.EncapsulateData('CONCPT',o);
var renderOptions = {
title: o.name,
dblclick: "i2b2.ONT.view.nav.ToggleNode(this,'"+cl_node.tree.id+"')",
icon: {
root: "sdx_ONT_CONCPT_root.gif",
rootExp: "sdx_ONT_CONCPT_root-exp.gif",
branch: "sdx_ONT_CONCPT_branch.gif",
branchExp: "sdx_ONT_CONCPT_branch-exp.gif",
leaf: "sdx_ONT_CONCPT_leaf.gif"
}
};
var sdxRenderData = i2b2.sdx.Master.RenderHTML(cl_node.tree.id, sdxDataNode, renderOptions);
i2b2.sdx.Master.AppendTreeNode(cl_node.tree, cl_node, sdxRenderData);
}
// handle the YUI treeview
cl_onCompleteCB();
}
// fix double loading error via node level dropping-lock
if (node.data.i2b2_dropLock) { return true; }
node.data.i2b2_dropLock = true;
var options = {};
options.ont_max_records = "max='" +i2b2.CRC.cfg.params.maxChildren + "'";
options.result_wait_time= i2b2.CRC.cfg.params.queryTimeout;
options.ont_synonym_records = i2b2.ONT.cfg.params.synonyms;
options.ont_hidden_records = i2b2.ONT.cfg.params.hiddens;
// parent key
options.concept_key_value = node.data.i2b2_SDX.sdxInfo.sdxKeyValue;
options.version = i2b2.ClientVersion;
i2b2.ONT.ajax.GetChildConcepts("CRC:QueryTool", options, scopedCallback);
}
i2b2.sdx.Master.setHandlerCustom('QPD1', 'CONCPT', 'LoadChildrenFromTreeview', funcLCFT);
i2b2.sdx.Master.setHandlerCustom('QPD2', 'CONCPT', 'LoadChildrenFromTreeview', funcLCFT);
i2b2.sdx.Master.setHandlerCustom('QPD3', 'CONCPT', 'LoadChildrenFromTreeview', funcLCFT);
// ========= END Override default LoadChildrenFromTreeview handler (we need this so that we can properly capture the XML request/response messages) END =========
//======================= =======================
// Connect the panel controllers to the DOM nodes in the document
var t = i2b2.CRC.ctrlr.QT;
queryTimingButton = new YAHOO.widget.Button("queryTiming",
{ lazyLoad: "false", type: "menu", menu: "menubutton1select", name:"querytiming" });
defineTemporalButton = new YAHOO.widget.Button("defineTemporal",
{ lazyLoad: "false", type: "menu", menu: "menubutton2select", name:"definetemporal" });
var addDefineGroup = new YAHOO.widget.Button("addDefineGroup");
addDefineGroup.on("click", function (event) {
i2b2.CRC.ctrlr.QT.temporalGroup = i2b2.CRC.model.queryCurrent.panels.length;
//i2b2.CRC.ctrlr.QT.temporalGroup = i2b2.CRC.ctrlr.QT.temporalGroup + 1;
defineTemporalButton.getMenu().addItems([
{ text: "Event " + (i2b2.CRC.ctrlr.QT.temporalGroup), value: i2b2.CRC.ctrlr.QT.temporalGroup}]);
defineTemporalButton.getMenu().render();
i2b2.CRC.model.queryCurrent.panels[i2b2.CRC.ctrlr.QT.temporalGroup] = {};
this.yuiTree = new YAHOO.widget.TreeView("QPD1");
i2b2.CRC.ctrlr.QT.panelAdd(this.yuiTree);
i2b2.CRC.ctrlr.QT._redrawAllPanels();
//Add to define a query
var select = document.getElementById("instancevent1[0]");
select.options[select.options.length] = new Option( 'Event '+i2b2.CRC.ctrlr.QT.temporalGroup, i2b2.CRC.ctrlr.QT.temporalGroup);
select = document.getElementById("instancevent2[0]");
select.options[select.options.length] = new Option( 'Event '+i2b2.CRC.ctrlr.QT.temporalGroup, i2b2.CRC.ctrlr.QT.temporalGroup);
});
+ var removeDefineGroup = new YAHOO.widget.Button("removeDefineGroup");
+ removeDefineGroup.on("click", function (event) {
+ i2b2.CRC.view.QT.deleteLastTemporalGroup();
+ });
queryTimingButton.on("mousedown", function (event) {
//i2b2.CRC.ctrlr.QT.panelControllers[0].doTiming(p_oItem.value);
if ((i2b2.CRC.ctrlr.QT.hasModifier) && (queryTimingButton.getMenu().getItems().length == 3)) {
queryTimingButton.getMenu().addItems([
{ text: "Items Instance will be the same", value: "SAMEINSTANCENUM" }]);
queryTimingButton.getMenu().render();
}
});
defineTemporalButton.on("selectedMenuItemChange", function (event) {
//i2b2.CRC.ctrlr.QT.panelControllers[0].doTiming(p_oItem.value);
var oMenuItem = event.newValue;
var sText = oMenuItem.value;
defineTemporalButton.set("label",oMenuItem.cfg.getProperty("text"));
if (sText != "BUILDER")
{
$('crc.temoralBuilder').hide();
$('crc.innerQueryPanel').show();
i2b2.CRC.ctrlr.QT.temporalGroup = sText;
i2b2.CRC.ctrlr.QT._redrawAllPanels();
if (sText == "0")
{
$('QPD1').style.background = '#FFFFFF';
$('queryPanelTitle1').innerHTML = 'Group 1';
} else {
$('QPD1').style.background = '#D9ECF0';
$('queryPanelTitle1').innerHTML = 'Anchoring Observation';
i2b2.CRC.ctrlr.QT.panelControllers[0].doTiming("SAMEINSTANCENUM");
i2b2.CRC.ctrlr.QT.panelControllers[0].refTiming.set("label", "Items Instance will be the same");
}
} else {
$('crc.innerQueryPanel').hide();
$('crc.temoralBuilder').show();
// queryTimingButton.set("label", "Temporal Contraint Builder");
}
});
queryTimingButton.on("selectedMenuItemChange", function (event) {
//i2b2.CRC.ctrlr.QT.panelControllers[0].doTiming(p_oItem.value);
var oMenuItem = event.newValue;
if (oMenuItem == 0)
{
var sValue = "ANY";
var sText = "Treat all groups independently";
} else if (oMenuItem == 1)
{
var sValue = "SAME";
var sText = "Selected groups occur in the same financial encounter";
} else {
var sValue = oMenuItem.value;
var sText = oMenuItem.cfg.getProperty("text");
}
//var sText = oMenuItem.cfg.getProperty("text");
var length = i2b2.CRC.ctrlr.QT.panelControllers.length;
queryTimingButton.set("label", sText);
if (sValue != "TEMPORAL") {
$('QPD1').style.background = '#FFFFFF';
$('defineTemporalBar').hide();
$('crc.temoralBuilder').hide();
$('crc.innerQueryPanel').show();
}
if (sValue == "SAMEVISIT") {
i2b2.CRC.ctrlr.QT.queryTiming = "SAMEVISIT";
for (var i=0; i" +
oMenuItem.cfg.getProperty("text") + ""));
if (event.newvalue != event.prevValue) {
var panelNumber = this.toString();
panelNumber = panelNumber.substring( panelNumber.length-1, panelNumber.length-0);
i2b2.CRC.ctrlr.QT.panelControllers[panelNumber-1].doTiming(oMenuItem.value);
}
if (oMenuItem.value.substring(0,5) == "OCCUR") {
this.setStyle('width', 130);
$("qryButtonLimitB1").show();
//$('qryPanelTiming Button').style.width = 120;
} else {
this.setStyle('width', 160);
$("qryButtonLimitB1").hide();
//$('qryPanelTiming Button').style.width = 160;
//$(this._button.id).clientWidth = 160;
}
};
//var panelControl = t.panelControllers[i];
t.panelControllers[i].ctrlIndex = i;
t.panelControllers[i].refTitle = $("queryPanelTitle"+(i+1));
t.panelControllers[i].refButtonExclude = $("queryPanelExcludeB"+(i+1));
t.panelControllers[i].refButtonDates = $("queryPanelDatesB"+(i+1));
t.panelControllers[i].refButtonOccurs = $("queryPanelOccursB"+(i+1));
t.panelControllers[i].refButtonOccursNum = $("QP"+(i+1)+"Occurs");
t.panelControllers[i].refBalloon = $("queryBalloon"+(i+1));
t.panelControllers[i].refDispContents = $("QPD"+(i+1));
//t.panelControllers[i].refTiming = $("queryPanelTimingB"+(i+1));
//t.panelControllers[i].refTiming = $("queryPanelTimingB"+(i+1));
var qryButtonTiming = new YAHOO.widget.Button("queryPanelTimingB"+(i+1),
{ type: "menu", menu: "menubutton1select", name:"querytiming" });
//qryButtonTiming.set('disabled', true);
qryButtonTiming.on("selectedMenuItemChange", onSelectedMenuItemChange);
qryButtonTiming.setStyle('width', 160);
t.panelControllers[i].refTiming = qryButtonTiming;
t.panelControllers[i].refTiming.set('disabled', true);
// create a instance of YUI Treeview
if (!t.panelControllers[i].yuiTree) {
t.panelControllers[i].yuiTree = new YAHOO.widget.TreeView("QPD"+(i+1));
t.panelControllers[i].yuiTree.setDynamicLoad(t.panelControllers[i]._loadTreeDataForNode,1);
// forward reference from DOM Node to tree obj
$("QPD"+(i+1)).tree = t.panelControllers[i].yuiTree;
// linkback on the treeview to allow it to find its PanelController
t.panelControllers[i].refDispContents.linkbackPanelController = t.panelControllers[i];
}
}
// display the panels
t.doScrollFirst();
t._redrawPanelCount();
i2b2.CRC.ctrlr.QT.doShowFrom(0);
i2b2.CRC.ctrlr.history.Refresh();
//======================= =======================
function qryPanelTimingClick(p_sType, p_aArgs) {
var oEvent = p_aArgs[0], // DOM event
oMenuItem = p_aArgs[1]; // MenuItem instance that was the
// target of the event
if (oMenuItem) {
YAHOO.log("[MenuItem Properties] text: " +
oMenuItem.cfg.getProperty("text") + ", value: " +
oMenuItem.value);
}
qryButtonTiming.set("label", qryButtonTiming.getMenu().activeItem.srcElement.text );
// i2b2.CRC.ctrlr.QT.panelControllers[0].doTiming(p_oItem.value);
// var sText = p_oItem.cfg.getProperty("text");
// oMenuPanelTiming1.set("label", sText);
}
// attach the context controller to all panel controllers objects
var op = i2b2.CRC.view.QT; // object path
i2b2.CRC.view.QT.ContextMenu = new YAHOO.widget.ContextMenu(
"divContextMenu-QT",
{ lazyload: true,
trigger: [$('QPD1'), $('QPD2'), $('QPD3')],
itemdata: [
{ text: "Delete", onclick: { fn: op.ContextMenuRouter, obj: 'delete' } },
{ text: "Lab Values", onclick: { fn: op.ContextMenuRouter, obj: 'labvalues' } }
] }
);
i2b2.CRC.view.QT.ContextMenu.subscribe("triggerContextMenu", i2b2.CRC.view.QT.ContextMenuPreprocess);
i2b2.CRC.view.QT.ContextMenu.subscribe("beforeShow", i2b2.CRC.view.QT.ContextMenuPreprocess);
i2b2.CRC.view.QT.splitterDragged(); // initialize query tool's elements
i2b2.CRC.view.QT.ResizeHeight();
// ================================================================================================== //
}
})
);
// QueryTool Helper Balloons
// ================================================================================================== //
i2b2.CRC.view.QT.hballoon = {
canShowQueryBalloons: true,
delayQueryBalloons: false,
hideBalloons: function() {
var thisObj = i2b2.CRC.view.QT.hballoon;
thisObj.canShowQueryBalloons = false;
clearTimeout(thisObj.delayQueryBalloons);
$('queryBalloonBox').hide();
YAHOO.util.Event.removeListener(document, "mousemove", thisObj.showBalloons);
YAHOO.util.Event.addListener(document, "mousemove", thisObj.showBalloons);
},
showBalloons: function(e) {
var thisObj = i2b2.CRC.view.QT.hballoon;
var x = YAHOO.util.Event.getPageX(e);
var y = YAHOO.util.Event.getPageY(e);
var elX = parseInt($('crcQueryToolBox').style.left);
if (isNaN(elX)) {elX = 241;}
var elY = $('crcQueryToolBox').getHeight();
if (isNaN(elY)) {elY = 280;}
elY = elY + 76 - 135;
if ( (x < elX-5) || (x > elX+524+5) || (y < elY-15) || (y > elY+110) ) {
if (!thisObj.canShowQueryBalloons) {
thisObj.canShowQueryBalloons = true;
thisObj.delayQueryBalloons = setTimeout("i2b2.CRC.view.QT.hballoon._showQueryBalloons()",200);
}
} else {
thisObj.canShowQueryBalloons = false;
clearTimeout(thisObj.delayQueryBalloons);
}
},
_showQueryBalloons: function() {
var thisObj = i2b2.CRC.view.QT.hballoon;
if (thisObj.canShowQueryBalloons) {
$('queryBalloonBox').show();
YAHOO.util.Event.removeListener(document, "mousemove", thisObj.showBalloons);
}
}
};
//================================================================================================== //
i2b2.events.initView.subscribe((function(eventTypeName, newMode) {
// -------------------------------------------------------
this.visible = true;
$('crcQueryToolBox').show();
this.Resize();
// initialize the dropdown menu for query timing
var temporalConstraintBar = $("temporalConstraintBar");
var temporalConstraintLabel = $("temporalConstraintLabel");
var queryTimingButton = $("queryTiming-button");
temporalConstraintDiv.style.width = Math.max( parseInt(temporalConstraintBar.style.width) - parseInt(temporalConstraintLabel.style.width)-2, 0) + "px";
queryTimingButton.style.width = Math.max( parseInt(temporalConstraintBar.style.width) - parseInt(temporalConstraintLabel.style.width)-6, 0) + "px";
// -------------------------------------------------------
}),'',i2b2.CRC.view.QT);
// ================================================================================================== //
i2b2.events.changedViewMode.subscribe((function(eventTypeName, newMode) {
// -------------------------------------------------------
newMode = newMode[0];
this.viewMode = newMode;
switch(newMode) {
case "Patients":
this.visible = true;
$('crcQueryToolBox').show();
i2b2.CRC.view.QT.splitterDragged();
//this.Resize();
break;
default:
this.visible = false;
$('crcQueryToolBox').hide();
break;
}
// -------------------------------------------------------
}),'', i2b2.CRC.view.QT);
// ================================================================================================== //
i2b2.events.changedZoomWindows.subscribe((function(eventTypeName, zoomMsg) {
newMode = zoomMsg[0];
if (!newMode.action) { return; }
if (newMode.action == "ADD") {
switch (newMode.window) {
case "QT":
this.isZoomed = true;
this.visible = true;
break;
}
} else {
switch (newMode.window) {
case "QT":
this.isZoomed = false;
this.visible = true;
}
}
this.ResizeHeight();
}),'',i2b2.CRC.view.QT);
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_Status.js b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_Status.js
index 7a4574239..ee939a62f 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_Status.js
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/CRC_view_Status.js
@@ -1,191 +1,234 @@
/**
* @projectDescription View controller for the query status window (which is a GUI-only component of the CRC module).
* @inherits i2b2.CRC.view
* @namespace i2b2.CRC.view.status
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
console.group('Load & Execute component file: CRC > view > Status');
console.time('execute time');
// create and save the screen objects
i2b2.CRC.view.status = new i2b2Base_cellViewController(i2b2.CRC, 'status');
i2b2.CRC.view.status.visible = false;
i2b2.CRC.view.status.show = function() {
i2b2.CRC.view.status.visible = true;
$('crcStatusBox').show();
}
i2b2.CRC.view.status.hide = function() {
i2b2.CRC.view.status.visible = false;
$('crcStatusBox').hide();
}
i2b2.CRC.view.status.hideDisplay = function() {
$('infoQueryStatusText').hide();
}
i2b2.CRC.view.status.showDisplay = function() {
var targs = $('infoQueryStatusText').parentNode.parentNode.select('DIV.tabBox.active');
// remove all active tabs
targs.each(function(el) { el.removeClassName('active'); });
// set us as active
$('infoQueryStatusText').parentNode.parentNode.select('DIV.tabBox.tabQueryStatus')[0].addClassName('active');
$('infoQueryStatusText').show();
}
+// ================================================================================================== //
+//BG
+i2b2.CRC.view.status.selectTab = function(tabCode) {
+ // toggle between the Navigate and Find Terms tabs
+ switch (tabCode) {
+ case "graphs":
+ this.currentTab = 'graphs';
+ this.cellRoot.view['graphs'].showDisplay();
+ this.cellRoot.view['status'].hideDisplay();
+ this.cellRoot.view['queryReport'].hideDisplay();
+ this.cellRoot.view['downloadData'].hideDisplay();
+ if(i2b2.CRC.ctrlr.currentQueryResults)
+ i2b2.CRC.view.graphs.createGraphs("infoQueryStatusChart", i2b2.CRC.ctrlr.currentQueryResults.resultString, true);
+ break;
+ case "status":
+ this.currentTab = 'status';
+ this.cellRoot.view['status'].showDisplay();
+ this.cellRoot.view['graphs'].hideDisplay();
+ this.cellRoot.view['queryReport'].hideDisplay();
+ this.cellRoot.view['downloadData'].hideDisplay();
+ break;
+ case "queryReport":
+ this.currentTab = 'queryReport';
+ this.cellRoot.view['queryReport'].showDisplay();
+ this.cellRoot.view['graphs'].hideDisplay();
+ this.cellRoot.view['status'].hideDisplay();
+ this.cellRoot.view['downloadData'].hideDisplay();
+ break;
+ case "downloadData":
+ this.currentTab = 'downloadData';
+ this.cellRoot.view['downloadData'].showDisplay();
+ this.cellRoot.view['graphs'].hideDisplay();
+ this.cellRoot.view['status'].hideDisplay();
+ this.cellRoot.view['queryReport'].hideDisplay();
+ if(i2b2.CRC.ctrlr.currentQueryResults){
+ var resultsTable = jQuery("#infoDownloadStatusData").find("#resultsTable");
+ if(resultsTable && resultsTable.length<=0)
+ i2b2.CRC.view.downloadData.createCSV();
+ }
+ break;
+ }
+}
+//BG
// ================================================================================================== //
i2b2.CRC.view.status.Resize = function(e) {
var viewObj = i2b2.CRC.view.status;
if (viewObj.visible) {
//var ds = document.viewport.getDimensions();
var w = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
var h = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
if (w < 840) {w = 840;}
if (h < 517) {h = 517;}
// resize our visual components
var ve = $('crcStatusBox');
ve.show();
switch(viewObj.viewMode) {
case "Patients":
ve = ve.style;
// keyoff splitter's position
ve.left = addToProperty($('main.splitter').style.left, 9, "px", "px" );
ve.width = rightSideWidth - 51;
//ve.left = w-550;
//ve.width = 524;
if (i2b2.WORK && i2b2.WORK.isLoaded) {
$('infoQueryStatusText').style.height = '100px';
if (YAHOO.env.ua.ie > 0) {
ve.top = h-135; //196+44;
} else {
ve.top = h-152; //196+44;
}
} else {
$('infoQueryStatusText').style.height = '144px';
ve.top = h-196;
}
break;
default:
ve.hide();
}
}
}
// ================================================================================================== //
// YAHOO.util.Event.addListener(window, "resize", i2b2.CRC.view.status.Resize, i2b2.CRC.view.status); // tdw9
//================================================================================================== //
i2b2.CRC.view.status.splitterDragged = function()
{
//var viewPortDim = document.viewport.getDimensions();
var w = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
var splitter = $( i2b2.hive.mySplitter.name );
var CRCStatus = $("crcStatusBox");
CRCStatus.style.left = (parseInt(splitter.offsetWidth) + parseInt(splitter.style.left) + 3) + "px";
CRCStatus.style.width = Math.max(parseInt(w) - parseInt(splitter.style.left) - parseInt(splitter.offsetWidth) - 29, 0) + "px";
}
//================================================================================================== //
i2b2.CRC.view.status.ResizeHeight = function()
{
var viewObj = i2b2.CRC.view.status;
if (viewObj.visible) {
var ds = document.viewport.getDimensions();
var h = ds.height;
if (h < 517) {h = 517;}
// resize our visual components
var ve = $('crcStatusBox');
ve.show();
switch(viewObj.viewMode) {
case "Patients":
ve = ve.style;
if (i2b2.WORK && i2b2.WORK.isLoaded)
{
$('infoQueryStatusText').style.height = '100px';
ve.top = h-152; //196+44;
}
else
{
$('infoQueryStatusText').style.height = '144px';
ve.top = h-196;
}
break;
default:
ve.hide();
}
}
}
// ================================================================================================== //
i2b2.events.initView.subscribe((function(eventTypeName, newMode) {
// -------------------------------------------------------
newMode = newMode[0];
this.viewMode = newMode;
this.visible = true;
$('crcStatusBox').show();
this.Resize();
// -------------------------------------------------------
}),'',i2b2.CRC.view.status);
//================================================================================================== //
i2b2.events.changedViewMode.subscribe((function(eventTypeName, newMode) {
// -------------------------------------------------------
newMode = newMode[0];
this.viewMode = newMode;
switch(newMode) {
case "Patients":
// check if other windows are zoomed and blocking us
var zw = i2b2.hive.MasterView.getZoomWindows();
if (zw.member("QT")) {
this.visible = false;
} else {
this.visible = true;
}
break;
default:
this.visible = false;
break;
}
if (this.visible) {
$('crcStatusBox').show();
i2b2.CRC.view.status.splitterDragged();
//this.Resize(); // tdw9
} else {
$('crcStatusBox').hide();
}
// -------------------------------------------------------
}),'',i2b2.CRC.view.status);
// ================================================================================================== //
i2b2.events.changedZoomWindows.subscribe((function(eventTypeName, zoomMsg) {
newMode = zoomMsg[0];
if (!newMode.action) { return; }
if (newMode.action == "ADD") {
switch (newMode.window) {
case "QT":
this.visible = false;
this.isZoomed = false;
i2b2.CRC.view.status.hide();
}
} else {
switch (newMode.window) {
case "QT":
this.isZoomed = false;
this.visible = true;
i2b2.CRC.view.status.show();
}
}
this.ResizeHeight();
//this.Resize(); // tdw9
}),'',i2b2.CRC.view.status);
console.timeEnd('execute time');
console.groupEnd();
\ No newline at end of file
diff --git a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/assets/vwQryTool.css b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/assets/vwQryTool.css
index aa85ed448..ca67c3d7d 100755
--- a/shrine-webclient/src/main/html/js-i2b2/cells/CRC/assets/vwQryTool.css
+++ b/shrine-webclient/src/main/html/js-i2b2/cells/CRC/assets/vwQryTool.css
@@ -1,293 +1,292 @@
.yui-skin-sam .qryTemporalConstraint .yuimenu .bd {
width:300px;
}
DIV#crcQueryToolBox {
position: absolute;
width: 534px;
}
DIV.relationshipAmongEvents {
text-align: center;
line-height: 30px;
background-color: #CBD8EF;
border: 1px solid #63758C;
}
DIV#crcQueryToolBox DIV.tabBox {}
DIV#crcQueryToolBox DIV.tabBox DIV {}
DIV#crcQueryToolBox DIV.tabBox.active {}
DIV#crcQueryToolBox DIV.tabBox.active DIV {}
DIV#crcQueryToolBox DIV.bodyBox {
background:#BBCCEE none repeat scroll 0%;
border:1px solid #667788;
width:auto;
height:auto;
padding: 5px 5px 0px;
white-space:nowrap;
overflow:hidden;
position:absolute;
xtop:-1px;
top:25px;
clear: both;
z-index:0;
}
DIV#crcQueryToolBox DIV.queryNameBar {
background:#BBCCEE none repeat scroll 0%;
border-bottom:1px solid #667788;
overflow:hidden;
padding: 2px 5px 5px;
margin: 0px -5px 5px;
width: auto;
}
DIV#crcQueryToolBox DIV.queryLabel {
font-size:12px;
height:15px;
line-height:15px;
overflow:hidden;
float:left;
xposition:absolute;
xz-index:99999;
}
DIV#crcQueryToolBox DIV#queryName {
background-color:#CBD8EF;
border:1px solid #63758C;
color:#4C5676;
font-size:11px;
height:15px;
line-height:15px;
overflow:hidden;
padding:0pt 5px;
white-space:nowrap;
width:auto;
}
DIV#crcQueryToolBox DIV.crcQryToolPanels {
height:auto;
}
DIV#crcQueryToolBox DIV.qryPanel {
width:168px;
float: left;
margin: 1px;
padding: 0px 0px 2px 0px;
}
DIV#crcQueryToolBox DIV.qryPanelTitle {
text-align:center;
background:#6677AA none repeat scroll 0%;
border:1px solid #667788;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
height:13px;
line-height:12px;
overflow:hidden;
width:166px;
float:left;
}
DIV#crcQueryToolBox DIV.qryPanelClear {
float:right;
margin:1px;
}
DIV#crcQueryToolBox DIV.queryPanel {
background:#FFFFFF;
border:1px solid #667788;
padding:3px;
white-space:nowrap;
overflow:auto;
width:160px;
float: left;
height:530px;
}
DIV#crcQueryToolBox DIV.qryPanelButtonBar {
float:left;
margin: 0px 0px -1px 0px;
}
DIV#crcQueryToolBox DIV.qryPanelButtonBar DIV {
background:#CBD8EF none repeat scroll 0%;
border:1px solid #667788;
height:16px;
line-height:16px;
text-align:center;
float:left;
}
DIV#crcQueryToolBox DIV.qryButtonDate {width:38px;}
DIV#crcQueryToolBox DIV.qryButtonOccurs {width:80px; margin:0px -1px;}
DIV#crcQueryToolBox DIV.qryButtonExclude {width:46px;}
DIV#crcQueryToolBox DIV.qryPanelTiming {width:166px;text-align:left;}
DIV#crcQueryToolBox DIV.qryPanelTiming .yuimenuitemlabel {width:120px;}
DIV#crcQueryToolBox DIV.qryPanelTiming Button {
line-height:1;
float:left;
/*width:160px;*/
min-height:1em;
}
DIV#crcQueryToolBox DIV.qryTemporalConstraint{
text-align:center;
}
DIV#crcQueryToolBox DIV.qryTemporalConstraint .yuimenuitemlabel {width:200px;}
DIV#crcQueryToolBox DIV.qryTemporalConstraint Button {
line-height:1;
-width:75px;
min-height:1em;
}
DIV#crcQueryToolBox DIV#qryToolFooter {
border-top:1px solid #667788;
clear:both;
margin:0px -5px -2px -5px;
padding: 5px;
position:relative;
width:auto;
height:20px;
overflow:hidden;
}
DIV#crcQueryToolBox DIV#newBox,
DIV#crcQueryToolBox DIV#printQueryBox,
DIV#crcQueryToolBox DIV#addTemporalBox,
DIV#crcQueryToolBox DIV#runBox {
position:relative;
xdisplay:none;
background:#6677AA;
border:1px solid #667788;
color:#FFFFFF;
font-weight:bold;
font-family:arial,helvetica;
font-size:11px;
height:16px;
line-height:16px;
text-align:center;
color:#FFF;
cursor:pointer;
float: left;
margin:0px 5px 0px 0px;
width:72px;
xz-index:5;
overflow:hidden;
}
DIV#crcQueryToolBox DIV#newBox a,
DIV#crcQueryToolBox DIV#printQueryBox a,
DIV#crcQueryToolBox DIV#addTemporalBox a,
DIV#crcQueryToolBox DIV#runBox a {
color:#FFF;
display:block;
text-decoration:none;
}
DIV#crcQueryToolBox DIV#addTemporalBox
{
width: 150px;
float: none;
}
a.topicButton {
color:#FFF;
display:block;
text-decoration:none;
display: inline;
background:#6677AA;
border:1px solid #667788;
color:#FFFFFF;
font-weight:bold;
font-family:arial,helvetica;
font-size:11px;
height:18px;
line-height:18px;
text-align:center;
color:#FFF;
cursor:pointer;
padding: 2px 11px;
}
a.topicButton:hover {
background-color:#7687bf;
}
DIV#crcQueryToolBox DIV#newBox a:hover,
DIV#crcQueryToolBox DIV#printQueryBox a:hover,
DIV#crcQueryToolBox DIV#addTemporalBox a:hover,
DIV#crcQueryToolBox DIV#runBox a:hover {
background-color:#7687bf;
}
DIV#crcQueryToolBox DIV#groupCount {
height:16px;
width:165px;
line-height:16px;
position:relative;
text-align:center;
float:left;
overflow:hidden;
}
DIV#crcQueryToolBox DIV#queryBottom {
position:relative;
height:20px;
border-top:1px solid #667788;
width:100%;
}
DIV#crcQueryToolBox DIV#scrollBox {
position:relative;
overflow:hidden;
float:right;
width:172px;
z-index:5;
}
DIV#crcQueryToolBox DIV#queryBalloonBox {
bottom:80px;
height:30px;
padding:0px 0px 0px 0px;
position:absolute;
width:100%;
z-index:10;
}
DIV#crcQueryToolBox DIV.queryBalloon {
background:#FFFF99;
border:1px solid #667788;
width:70px;
height:40px;
color:#000000;
font-size:12px;
font-weight:bold;
text-align:center;
line-height:13px;
position:absolute;
float:left;
display:none;
}
DIV#crcQueryToolBox DIV.queryBalloonAnd {
background:#6677AA;
border:1px solid #667788;
width:45px;
height:20px;
color:#FFFFFF;
font-size:14px;
font-weight:bold;
text-align:center;
line-height:20px;
position:absolute;
float:left;
/*margin:10px 27px;*/
display:none;
}