i2b2.ExampTabs.Init = function (loadedDiv) { // this function is called after the HTML is loaded into the viewer DIV i2b2 i2b2.ExampTabs.view.containerDiv = loadedDiv; // save reference for later use var var cfgObj = {activeIndex : i2b2.ExampTabs.cfg.config.DefaultTab – 1 }; this this.yuiTabs = new YAHOO.widget.TabView("ExampTabs-TABS", cfgObj);
// register DIV as valid DragDrop target for Patient Record Sets (PRS) objects var var divName = "ExampTabs-DROPTRGT";
/ // register for drop events of the following datatypes var var op_trgt = {dropTarget:true}; i2b2 i2b2.sdx.Master.AttachType(divName, 'CONCPT', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'QM', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'QI', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'PRS', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'PRC', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'PR', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'QDEF', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'QGDEF', op_trgt); i2b2 i2b2.sdx.Master.AttachType(divName, 'XML', op_trgt);
// Use an event router to demultiplex the callbacks to the single // drop event handler used by by // this plugin. This also recreates a properly // scoped "this" keyword within the event handler var eventRouterFunct = (function (sdxData) { i2b2.ExampTabs.doDrop(sdxData);});
// register the event handler via eventRouterFunc var var refSDXMaster = i2b2.sdx.Master; refSDXMaster refSDXMaster.setHandlerCustom(divName, 'CONCPT', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'QM', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'QI', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'PRS', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'PRC', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'PR', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'QDEF', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'QGDEF', 'DropHandler', eventRouterFunc); refSDXMaster refSDXMaster.setHandlerCustom(divName, 'XML', 'DropHandler', eventRouterFunc);
// Start Processing when user switches to the results tab IF the data is dirty this this.yuiTabs.on('activeTabChange', function(ev) { //Tabs have changed if if (ev.newValue.get('id')== "ExampTabs-TAB1") { // user switched to Results tab if (i2b2.ExampTabs.model.currectRec) { // gather statistics only if we have data if (i2b2.ExampTabs.model.dirtyResultsData) { // recalculate the results only if the input data has changed i2b2 i2b2.ExampTabs.getResults(); } } } }); }; |