1var $$ = Dom7; 2 3class ValidationUtil { 4 static validate(button, mainContainer, func) { 5 let validateFunc = function () { 6 let isValid = true; 7 $$(mainContainer).find('input, textarea, select').each((index, inputEl) => { 8 app.input.validate(inputEl); 9 if (inputEl.className.indexOf(app.data.inputInvalidClassName) >= 0) { 10 isValid = false; 11 } 12 }); 13 14 if (isValid) { 15 func(); 16 } 17 }; 18 19 $$(button).on('click', validateFunc); 20 } 21 22 static validateWithoutButton(mainContainer) { 23 let isValid = true; 24 $$(mainContainer).find('input, textarea, select').each((index, inputEl) => { 25 app.input.validate(inputEl); 26 if (inputEl.className.indexOf(app.data.inputInvalidClassName) >= 0) { 27 isValid = false; 28 app.input.scrollIntoView(inputEl, 500); 29 } 30 }); 31 32 return isValid; 33 } 34 35 static validateDateFormat(samplingDate) { 36 let currentYear = (new Date()).getFullYear(); 37 let pattern = /^[0-9]+$/; 38 let parts = samplingDate.split("."); 39 40 return !(parts.length !== 3 || !pattern.test(parts[0]) || !pattern.test(parts[1]) || !pattern.test(parts[2]) || parts[2] < currentYear - 2 || parts[2] > currentYear + 2); 41 } 42 43 static validateSamplingDateInRangeToShowSimulationDate(dsnStartSimulation, nsimEndSimulation) { 44 let today = new Date(); 45 let year = DateUtil.getLastYearWhenFirstHalfOfYear(); 46 47 let dsnStartSimulationMonth = (typeof dsnStartSimulation !== 'undefined' && dsnStartSimulation != null ? parseInt(dsnStartSimulation.split("-")[0]) - 1 : null); 48 let dsnStartSimulationDay = (typeof dsnStartSimulation !== 'undefined' && dsnStartSimulation != null ? dsnStartSimulation.split("-")[1] : null); 49 if (dsnStartSimulationMonth == null || dsnStartSimulationDay == null) { 50 return false; 51 } 52 53 let nsimEndSimulationMonth = (typeof nsimEndSimulation !== 'undefined' && nsimEndSimulation != null ? parseInt(nsimEndSimulation.split("-")[0]) - 1 : null); 54 let nsimEndSimulationDay = (typeof nsimEndSimulation !== 'undefined' && nsimEndSimulation != null ? nsimEndSimulation.split("-")[1] : null); 55 if (nsimEndSimulationMonth == null || nsimEndSimulationDay == null) { 56 return false; 57 } 58 59 let dsnStartSimulationDate = new Date(year, dsnStartSimulationMonth, dsnStartSimulationDay); 60 let nsimEndSimulationDate = new Date(year + 1, nsimEndSimulationMonth, nsimEndSimulationDay); 61 62 return DateDiff.inMilliSeconds(dsnStartSimulationDate, today) >= 0 && 63 DateDiff.inMilliSeconds(nsimEndSimulationDate, today) <= 0; 64 } 65 66 static validateFID(value) { 67 let prefix = value.substring(0, 6).match(/^[A-Za-z]+$/); 68 let suffix = value.substring(6, 16).match(/^[A-Za-z0-9]+$/); 69 70 return !(value.length !== 16 || prefix.length !== 1 || prefix[0].length !== 6 || suffix.length !== 1 || suffix[0].length !== 10); 71 } 72}
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.