1 /** 2 * Defines the help component for the main, context sensitive help link 3 * @extends Workbench.component.Component 4 * @author Carl Stahmer 5 */ 6 7 /* Help Component */ 8 Monk.component.HelpComponent = function (args) { 9 10 var eventitem = 'help-start'; 11 12 this.searchForm = null; 13 14 this.panel = new Ext.Panel({ 15 split: false, 16 collapsible: false, 17 border: false, 18 width: 70, 19 bodyStyle: "background: transparent;", 20 items: [{ 21 id: 'universal-help-button', 22 xtype: 'button', 23 text: 'Help', 24 iconCls: 'help-button', 25 width: 68, 26 handler: function(){ 27 this.gethelp(); 28 //var value = this.id; 29 //Monk.component.help.contextSensitive('Context Sensitive Help Test', eventitem); 30 31 //this.fireEvent('search', {query: value}); 32 }, 33 scope: this 34 }] 35 }); 36 37 Monk.component.HelpComponent.superclass.constructor.call(this, args); 38 } 39 40 Workbench.extend(Monk.component.HelpComponent, Monk.component.Component, { 41 42 label : "Help", 43 id: 'HelpComponent', 44 description: 'help-component', 45 helpkey: 'http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/', 46 handle : function(monkEvent, data){ 47 if((monkEvent.instanceOf(Monk.event.flowmanager.StepSelected))){ 48 if(monkEvent.label=="StepSelected: \"toolstep-001-search-and-browse\""){ 49 this.helpkey="../../public/tutorial/defineWorksets/defineWorksets.html#defineWorksets-step1"; 50 }else if(monkEvent.label=="StepSelected: \"toolstep-002-search-and-browse\""){ 51 this.helpkey="../../public/tutorial/defineWorksets/defineWorksets.html#defineWorksets-step2"; 52 }else if(monkEvent.label=="StepSelected: \"project-selector\""){ 53 this.helpkey="../../public/tutorial/gettingStarted/gettingStarted.html#project"; 54 }else if(monkEvent.label=="StepSelected: \"project\""){ 55 this.helpkey="../../public/tutorial/gettingStarted/gettingStarted.html#current_project"; 56 }else if(monkEvent.label=="StepSelected: \"toolstep-001-features\""){ 57 this.helpkey="../../public/tutorial/worksetFeatureComp/worksetFeatureComp.html#worksetFeatureComp-step1"; 58 }else if(monkEvent.label=="StepSelected: \"toolstep-002-feature\""){ 59 this.helpkey="../../public/tutorial/worksetFeatureComp/worksetFeatureComp.html#worksetFeatureComp-step2"; 60 }else if(monkEvent.label=="StepSelected: \"toolstep-001-search-by-example\""){ 61 this.helpkey="../../public/tutorial/searchByexample/searchByexample.html#searchByexample-step1"; 62 }else if(monkEvent.label=="StepSelected: \"toolstep-002-search-by-example\""){ 63 this.helpkey="../../public/tutorial/searchByexample/searchByexample.html#searchByexample-step2"; 64 }else if(monkEvent.label=="StepSelected: \"toolstep-002-zoteroimport\""){ 65 this.helpkey="../../public/tutorial/importWorksets/importWorksets.html#toolstep-002-zoteroimport"; 66 } else if(monkEvent.label=="StepSelected: \"toolstep-001-zoteroimport\""){ 67 this.helpkey="../../public/tutorial/importWorksets/importWorksets.html#toolstep-001-zoteroimport"; 68 } 69 70 71 // Workbench.console.info(monkEvent.label +" HELP URL IS: " + this.helpkey); 72 73 }else if (monkEvent.instanceOf(Monk.event.project.ProjectsReceived)) { 74 //show project selection view help 75 //this.helpkey = 'http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/workbench/projects-help.html'; 76 //this.helpkey = '../../public/tutorial/gettingStarted/gettingStarted.html#project'; 77 } else if (monkEvent.instanceOf(Workbench.event.ComponentLoaded)) { 78 if (monkEvent.label.match('Help')) { 79 //show main help page 80 this.helpkey = 'http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/'; 81 } else if (monkEvent.label.match('Project')) { 82 //show workset and result view of current project help page 83 //this.helpkey = 'http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/workbench/currentproject-help.html'; 84 //this.helpkey = '../../public/tutorial/gettingStarted/gettingStarted.html#current_project'; 85 } else if (monkEvent.label.match('Toolset')) { 86 //show toolset editor view of current project help page 87 this.helpkey = 'http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/'; 88 } 89 } else if (monkEvent.instanceOf(Workbench.event.ComponentRemoved)) { 90 if (monkEvent.label.match('new toolset')) { 91 //show workset and result view of current project help page 92 this.helpkey = 'http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/workbench/currentproject-help.html'; 93 } 94 } else if (monkEvent.instanceOf(Monk.event.flowmanager.StepSelected) && monkEvent.component.id == 'flow-manager') { 95 if (monkEvent.label.match('monk-home')) { 96 //show main help page 97 this.helpkey = 'http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/'; 98 } else if (monkEvent.label.match('project-selector')) { 99 //show project selection view help 100 //this.helpkey = "http://www.cs.umd.edu/hcil/MITH/monkworkbenchhelp/workbench/projects-help.html"; 101 // this.helpkey = '../../public/tutorial/gettingStarted/gettingStarted.html#project'; 102 } 103 } else if (monkEvent.instanceOf(Monk.event.flowmanager.StepSelected) && monkEvent.component.id == 'tool-flow-manager') { 104 this.helpkey = feature.toolFlowManager.toolset.tools.get(data).helpUrl; 105 } 106 }, 107 108 gethelp : function() { 109 var url = this.helpkey; 110 if (url != null) { 111 var helpWindow = window.open(url, 'helpWindow', 'height=600,width=700,location=yes,menubar=yes,titlebar=yes,toolbar=yes,scrollbars=yes'); 112 helpWindow.resizeTo(600,600); 113 if (helpWindow == null) { 114 Monk.component.messenger.alert('MONK Workbench Help', 'MONK Workbench tried to open a help window but it was blocked. Please disable any pop-up blockers and try again.'); 115 } 116 } else { 117 Monk.component.messenger.alert('MONK Workbench Help', 'There is no help to display for this state.'); 118 } 119 } 120 }); 121