1// Worker.js 2// Author: Matthew F. Egan 3// 4// This .js file is used to encapsulate all event worker process functions. 5// 6 7// DEVELOPERS: PLEASE REMEMBER TO CHANGE THE VERSIONING PRIOR TO PUBLISH! IT IS VERY IMPORTANT WE KNOW THE VERSIONS OF JAVASCRIPT FILES ON LIVE! 8//Version nomenclature 9// Major (If a major revision is made that changes the functionality) 10// Minor (If a minor revision is made that requires backwards compatability) 11// Revision (Month of the year of the change) 12// System (Day of the Month of the change) 13// Iteration (Number of iterations in the same day of changes) 14// Year (Year of the change) 15// 16// Name is the name of the file 17// Requires is an array of names that represent files the current file needs, right now only used for JavaScripts. 18 19try { 20 versioning.reportVersion({ 21 major: 1, 22 minor: 0, 23 revision: 1, 24 system: 7, 25 iteration: 1, 26 year: 2019, 27 name: 'Worker.js', 28 requires: ['NOAH.Include.Config.js', 'NOAH.Include.js'] 29 }); 30} catch (ex) { console.log(ex.message); } 31 32// DEFINITIONS 33try 34{ 35 // ENUMS 36 var workTypes = { 37 HideShow : 1, 38 Required : 2, 39 RequiredQuestionWhenAnswered: 3, 40 OtherControl: 4, 41 Validate: 5 42 }; 43} 44catch(ex) 45{ 46 handleLogException({ message: "Initialization Worker", messageType: messageTypes.Error, isInitialization: true }); 47} 48 49// CONSTRUCTORS 50function workOnElementParameters() { 51 // ------------------------------------------------- 52 // FUNCTION DESCRIPTION: CREATE ELEMENT PARAMETERS 53 // ------------------------------------------------- 54 55 var result = null; 56 handleLogException({ sender: workOnElementParameters, message: "Entering", isWorkFlow: true, isSupport: true }); 57 try 58 { 59 result = { 60 activationAttribute: "", 61 workOnAttribute: "", 62 collectionToUse: null, 63 workToDo: workTypes.HideShow, 64 workOnGroupCodes: false, 65 workOnMasterCodes: false 66 } 67 } 68 catch (ex) 69 { 70 handleLogException({ sender: workOnElementParameters, message: "Error", isWorkFlow: false }); 71 } 72 handleLogException({ sender: workOnElementParameters, message: "Exiting", isWorkFlow: true, isSupport: true }); 73 return result; 74} 75 76// HANDLE DYNAMIC INSTRUCTIONS 77function doWorkOnElements(sender, e) { 78 // --------------------------------------------------------------------- 79 // FUNCTION DESCRIPTION: DO (DEFINED) WORK ON ELEMENT GENERAL FUNCTION 80 // --------------------------------------------------------------------- 81 82 var result = true; 83 handleLogException({ sender: doWorkOnElements, message: "Entering", isWorkFlow: true, isSupport: true }); 84 try { 85 var doWorkOnElement = false; // DEFAULT IS ASSUMED OFF 86 87 var collectionToWorkOn = e.collectionToUse; 88 var activationAttribute = e.activationAttribute 89 var workOnAttribute = e.workOnAttribute; 90 var workToDo = e.workToDo; 91 var workOnGroupCodes = e.workOnGroupCodes | false; 92 var workOnMasterCodes = e.workOnMasterCodes | false; 93 var doFormSubmitCheck = e.doFormSubmitCheck | false; 94 var showMessages = e.showMessages | false; 95 96 var activationElement = $(sender)[0] || null; if (isNull(activationElement)) { activationElement = $(sender); } 97 98 senderControlData = getControlData(activationElement, { 99 element: activationElement, 100 attribute: activationAttribute 101 }); 102 103 options = senderControlData.options; 104 105 switch (workToDo) { 106 case workTypes.HideShow: 107 senderControlData.reset(sender, { 108 resetValue: false, 109 workOnGroupCodes: workOnGroupCodes, 110 workOnMasterCodes: workOnMasterCodes 111 }); 112 break; 113 114 case workTypes.Required: 115 senderControlData.handleDynamics(sender, { 116 workOnGroupCodes: workOnGroupCodes, 117 workOnMasterCodes: workOnMasterCodes 118 }); 119 break; 120 121 case workTypes.OtherControl: 122 console.log('---> Worker.js OTHER CONTROL'); 123 doOtherElements(sender, e); 124 break; 125 126 case workTypes.Validate:
127 var validationData = senderControlData.validate(sender, e); 128 if (doFormSubmitCheck) { 129 if (validationData.result) { 130 validationData.showMessages = false; 131 passedValidation = isFormSubmittable(sender, validationData); 132 } 133 else { 134 passedValidation = false; 135 } 136 } 137 138 if (!validationData.result) 139 { 140 setDFBMessage({ source: sender, messageType: messageTypes.Validation, message: validationData.validationMessage, resetAll: true }); 141 showDFBMessage({ showMessages: showMessages, source: sender }); 142 } 143 break; 144 } 145 } 146 catch (ex) 147 { 148 handleLogException({ sender: doWorkOnElements, message: "Error", isWorkFlow: false }); 149 } 150 handleLogException({ sender: doWorkOnElements, message: "Exiting", isWorkFlow: true, isSupport: true }); 151 return result 152} 153
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.