1// 2// DotNetNuke® - http://www.dnnsoftware.com 3// Copyright (c) 2002-2008 4// by DNNCorp 5// 6// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7// documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 9// to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10// 11// The above copyright notice and this permission notice shall be included in all copies or substantial portions 12// of the Software. 13// 14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 17// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18// DEALINGS IN THE SOFTWARE. 19// 20// Events module 4.x 21// 22 23// shortcuts 24 25/*global document: true, alert: true, setTimeout: true, dnn: true */ 26 27function byid(eID) { 28 if (document.getElementById) { 29 return document.getElementById(eID); 30 } else if (document.all) { 31 return document.all(eID); 32 } else { 33 return null; 34 } 35} 36 37function selIndex(eID) { 38 return byid(eID).options[byid(eID).selectedIndex].value; 39} 40 41function setselIndex(eID, v) { 42 for (var i = 0; i < byid(eID).options.length; i++) { 43 if (byid(eID).options[i].value == v) { 44 byid(eID).options[i].selected = true; 45 return; 46 } 47 } 48} 49 50// Validation functions 51function timeoutFunc(fid) { 52 byid(fid).focus(); 53 byid(fid).select(); 54} 55 56function SetupRangeValidator(valfieldid, valfieldid2, valGroup, botno, topno, message) { 57 var valField = byid(valfieldid); 58 var valField2 = byid(valfieldid2); 59 valField.maximumvalue = "" + topno + ""; 60 valField.minimumvalue = "" + botno + ""; 61 valField.errormessage = message; 62 valField.innerHTML = message; 63 valField2.errormessage = message; 64 valField2.innerHTML = message; 65 window.Page_ClientValidate(valGroup); 66} 67 68function valRemTime(valTime, valTime2, valGroup, remMeasurement, errorminutes, errorhours, errordays) { 69 if (!errorhours) { 70 errorhours = errorminutes; 71 } 72 if (!errordays) { 73 errordays = errorminutes; 74 } 75 switch (selIndex(remMeasurement)) { 76 case "m": 77 SetupRangeValidator(valTime, valTime2, valGroup, 15, 60, errorminutes); 78 break; 79 case "h": 80 SetupRangeValidator(valTime, valTime2, valGroup, 1, 24, errorhours); 81 break; 82 case "d": 83 SetupRangeValidator(valTime, valTime2, valGroup, 1, 30, errordays); 84 break; 85 } 86} 87 88 89// functions used in EditEvents 90function CopyField() { 91 var sourceField; 92 var targetField; 93 sourceField = window.$find(arguments[0]); 94 targetField = window.$find(arguments[1]); 95 if (!isNaN(sourceField.get_selectedDate())) { 96 if (sourceField.get_selectedDate() > targetField.get_selectedDate()) { 97 targetField.set_selectedDate(sourceField.get_selectedDate()); 98 } 99 } else { 100 targetField.set_selectedDate(sourceField.get_selectedDate()); 101 } 102} 103 104function SetComboIndex() { 105 var tpStartTime = window.$find(arguments[0]); 106 var tpEndTime = window.$find(arguments[1]); 107 var dpStartDate = window.$find(arguments[2]); 108 var dpEndDate = window.$find(arguments[3]); 109 var timeInterval = arguments[4]; 110 var tiStartTime = tpStartTime.get_timeView().getTime(); 111 var tiEndTime = tpEndTime.get_timeView().getTime(); 112 var dtStartDate = dpStartDate.get_selectedDate()._toFormattedString(); 113 var dtEndDate = dpEndDate.get_selectedDate()._toFormattedString();
114 if (dtStartDate == dtEndDate && tiStartTime > tiEndTime) { 115 var tvEndTime = tpEndTime.get_timeView(); 116 tvEndTime.setTime(tiStartTime.getHours(), 117 tiStartTime.getMinutes() + parseInt(timeInterval), 118 tiStartTime.getSeconds(), 119 tiEndTime); 120 dpEndDate.set_selectedDate(tiEndTime); 121 } 122} 123 124function showTbl(chkField, tblDetail) { 125 if (window.dnn.dom.getById(chkField).checked === true) { 126 window.dnn.dom.getById(tblDetail).style.display = "block"; 127 } else { 128 window.dnn.dom.getById(tblDetail).style.display = "none"; 129 } 130} 131 132function showTblSpecified(strDisplayType, chkField, tblDetail) { 133 if (window.dnn.dom.getById(chkField).checked === true) { 134 window.dnn.dom.getById(tblDetail).style.display = strDisplayType; 135 } else { 136 window.dnn.dom.getById(tblDetail).style.display = "none"; 137 } 138} 139 140function showhideTbls(strDisplayType, 141 chkField1, 142 tblDetail1, 143 chkField2, 144 tblDetail2, 145 chkField3, 146 tblDetail3, 147 chkField4, 148 tblDetail4, 149 chkField5, 150 tblDetail5) { 151 showTblSpecified("block", chkField1, tblDetail1); 152 showTblSpecified(strDisplayType, chkField2, tblDetail2); 153 showTblSpecified(strDisplayType, chkField3, tblDetail3); 154 showTblSpecified(strDisplayType, chkField4, tblDetail4); 155 showTblSpecified(strDisplayType, chkField5, tblDetail5); 156} 157 158function showhideChk2(chkField1, tblDetail1, chkField2, tblDetail2) { 159 showTbl(chkField1, tblDetail1); 160 if (window.dnn.dom.getById(chkField1).checked === true) { 161 window.dnn.dom.getById(tblDetail2).style.display = "block"; 162 } else if (window.dnn.dom.getById(chkField2).checked === true) { 163 window.dnn.dom.getById(tblDetail2).style.display = "block"; 164 } else { 165 window.dnn.dom.getById(tblDetail2).style.display = "none"; 166 } 167} 168 169function showTimes(chkField, cmbField1, cmbField2) { 170 if (window.dnn.dom.getById(chkField).checked === true) { 171 window.dnn.dom.getById(cmbField1).style.display = "none"; 172 window.dnn.dom.getById(cmbField2).style.display = "none"; 173 } else { 174 window.dnn.dom.getById(cmbField1).style.display = ""; 175 window.dnn.dom.getById(cmbField2).style.display = ""; 176 } 177} 178 179// Functions used in Event Settings 180function disableactivate(defaultview, ctlMonth, ctlWeek, ctlList) { 181 182 byid(ctlMonth).disabled = false; 183 byid(ctlWeek).disabled = false; 184 byid(ctlList).disabled = false; 185 186 switch (selIndex(defaultview)) { 187 case "EventMonth.ascx": 188 byid(ctlMonth).disabled = true; 189 byid(ctlMonth).checked = true; 190 break; 191 case "EventWeek.ascx": 192 byid(ctlWeek).disabled = true; 193 byid(ctlWeek).checked = true; 194 break; 195 case "EventList.ascx": 196 byid(ctlList).disabled = true; 197 byid(ctlList).checked = true; 198 break; 199 } 200} 201 202function disableControl(sourceID, state, destID) { 203 if (byid(sourceID).checked == state) { 204 byid(destID).disabled = true; 205 } else { 206 byid(destID).disabled = false; 207 } 208} 209 210function CheckBoxFalse(sourceID, state, destID) { 211 if (byid(sourceID).checked == state) { 212 byid(destID).checked = false; 213 } 214 disableControl(sourceID, state, destID); 215} 216 217function GetRadioButtonValue(id) { 218 var rb = byid(id); 219 var radio = rb.getElementsByTagName("input"); 220 for (var j = 0; j < radio.length; j++) { 221 if (radio[j].checked) { 222 return radio[j].value; 223 } 224 } 225// ReSharper disable NotAllPathsReturnValue 226} 227// ReSharper restore NotAllPathsReturnValue 228 229function disableRbl(sourceID, state, destID) { 230 var rbValue = GetRadioButtonValue(sourceID); 231 if (rbValue == state) { 232 byid(destID).disabled = false; 233 } else { 234 byid(destID).disabled = true; 235 } 236} 237 238function disableDDL(sourceID, state, destID) { 239 var ddl = byid(sourceID); 240 var ddlValue = ddl.options[ddl.selectedIndex].value; 241 if (ddlValue == state) { 242 byid(destID).disabled = false; 243 } else { 244 byid(destID).disabled = true; 245 } 246} 247 248function disablelistsettings(sourceID, state, field1, field2, field3, field4) { 249 if (byid(sourceID).checked == state) { 250 byid(field1).disabled = false; 251 byid(field2).disabled = false; 252 byid(field3).disabled = true; 253 byid(field4).disabled = true; 254 } else { 255 byid(field1).disabled = true; 256 byid(field2).disabled = true; 257 byid(field3).disabled = false; 258 byid(field4).disabled = false; 259 } 260} 261 262// Copy the content of the startdate control to the enddate control 263function CopyStartDateToEnddate(startdate, enddate, starttime, endtime, chkField) { 264 window.$find(enddate).set_selectedDate(window.$find(startdate).get_selectedDate(
264)); 265 if (window.dnn.dom.getById(chkField).checked !== true) { 266 var tpStartTime = window.$find(starttime); 267 var tpEndTime = window.$find(endtime); 268 var tvStartTime = tpStartTime.get_timeView(); 269 var tvEndTime = tpEndTime.get_timeView(); 270 var tiStartTime = tvStartTime.getTime(); 271 var tiEndTime = tvEndTime.getTime(); 272 tvEndTime.setTime(tiStartTime.getHours(), tiStartTime.getMinutes(), tiStartTime.getSeconds(), tiEndTime); 273 } 274} 275 276// Limit characters to be entered in a field with a message 277function limitText(limitField, limitNum, message) { 278 if (limitField.value.length > limitNum) { 279 limitField.value = limitField.value.substring(0, limitNum); 280 alert(message + " " + limitNum); 281 } 282} 283 284// functions used in Edit Categories 285function GetColor(valColor) { 286 if (valColor.length === 0 || valColor.substring(0, 1) === "#") { 287 return valColor; 288 } else { 289 return "#" + valColor; 290 } 291} 292 293// ReSharper disable UnusedParameter 294// ReSharper disable UseOfImplicitGlobalInFunctionScope 295function ValidateColor(source, arguments) { 296 var txtColor = GetColor(arguments.Value); 297 if (txtColor.length === 0) { 298 arguments.IsValid = true; 299 } 300 301 var regColorcode = /^(#)?([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/; 302 arguments.IsValid = regColorcode.test(txtColor); 303} 304// ReSharper restore UnusedParameter 305// ReSharper restore UseOfImplicitGlobalInFunctionScope 306 307function CategoryPreviewPane(colPickerBack, 308 colPickerFore, 309 previewpane, 310 lblPreviewCat, 311 catForeColor, 312 catBackColor, 313 catName, 314 catError) { 315 316 var newForeColor = GetColor(byid(catForeColor).value); 317 var newBackColor = GetColor(byid(catBackColor).value); 318 319 if (window.Page_IsValid) { 320 if (newForeColor != "") { 321 byid(catForeColor).value = newForeColor; 322 byid(lblPreviewCat).style.color = newForeColor; 323 window.$find(colPickerFore).set_selectedColor(newForeColor); 324 } 325 if (newBackColor != "") { 326 byid(catBackColor).value = newBackColor; 327 byid(previewpane).style.backgroundColor = newBackColor; 328 window.$find(colPickerBack).set_selectedColor(newBackColor); 329 } 330 byid(lblPreviewCat).innerHTML = byid(catName).value; 331 } else { 332 byid(lblPreviewCat).innerHTML = catError; 333 byid(lblPreviewCat).style.color = "#ffffff"; 334 byid(previewpane).style.backgroundColor = "#ed1c24"; 335 } 336} 337 338// ReSharper disable UnusedParameter 339// ReSharper disable UseOfImplicitGlobalInFunctionScope 340function ValidateTime(source, arguments) { 341 var timeInterval = parseInt(source.TimeInterval); 342 var errorMessage = source.ErrorMessage; 343 var tiEndTime = window.$find(source.ClientID).get_timeView().getTime(); 344 var totalMins = (tiEndTime.getHours() * 60) + tiEndTime.getMinutes(); 345 var remainder = totalMins % timeInterval; 346 if (remainder != 0) { 347 source.innerHTML = errorMessage; 348 source.errormessage = errorMessage; 349 arguments.IsValid = false; 350 } 351} 352// ReSharper restore UseOfImplicitGlobalInFunctionScope 353// ReSharper restore UnusedParameter 354 355function btnUpdateClick(btnUpdateUniqueID, ddlCategoriesClientID) { 356 var ddlCategories = window.$find(ddlCategoriesClientID); 357 if (ddlCatText != ddlCategories.get_text()) { 358 window.__doPostBack(btnUpdateUniqueID, ""); 359 } 360} 361 362var ddlCatText = ""; 363 364function storeText(ddlCategoriesClientID) { 365 var ddlCategories = window.$find(ddlCategoriesClientID); 366 ddlCatText = ddlCategories.get_text(); 367}
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.