1var __aspxClientValidationStateNameSuffix = "$CVS"; 2ASPxClientEditBase = _aspxCreateClass(ASPxClientControl, { 3 constructor: function(name) { 4 this.constructor.prototype.constructor.call(this, name); 5 }, 6 InlineInitialize: function(){ 7 this.InitializeEnabled(); 8 }, 9 InitializeEnabled: function() { 10 this.SetEnabledInternal(this.clientEnabled, true); 11 }, 12 GetValue: function() { 13 var element = this.GetMainElement(); 14 if(_aspxIsExistsElement(element)) 15 return element.innerHTML; 16 return ""; 17 }, 18 GetValueString: function(){ 19 var value = this.GetValue(); 20 return (value == null) ? null : value.toString(); 21 }, 22 SetValue: function(value) { 23 if(value == null) 24 value = ""; 25 var element = this.GetMainElement(); 26 if(_aspxIsExistsElement(element)) 27 element.innerHTML = value; 28 }, 29 GetEnabled: function(){ 30 return this.enabled && this.clientEnabled; 31 }, 32 SetEnabled: function(enabled){ 33 if(this.clientEnabled != enabled) { 34 var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid(); 35 if(errorFrameRequiresUpdate && !enabled) 36 this.UpdateErrorFrameAndFocus(false , null , true ); 37 this.clientEnabled = enabled; 38 this.SetEnabledInternal(enabled, false); 39 if(errorFrameRequiresUpdate && enabled) 40 this.UpdateErrorFrameAndFocus(false ); 41 } 42 }, 43 SetEnabledInternal: function(enabled, initialization){ 44 if(!this.enabled) return; 45 if(!initialization || !enabled) 46 this.ChangeEnabledStateItems(enabled); 47 this.ChangeEnabledAttributes(enabled); 48 }, 49 ChangeEnabledAttributes: function(enabled){ 50 }, 51 ChangeEnabledStateItems: function(enabled){ 52 } 53}); 54ASPxValidationPattern = _aspxCreateClass(null, { 55 constructor: function(errorText) { 56 this.errorText = errorText; 57 } 58}); 59ASPxRequiredFieldValidationPattern = _aspxCreateClass(ASPxValidationPattern, { 60 constructor: function(errorText) { 61 this.constructor.prototype.constructor.call(this, errorText); 62 }, 63 EvaluateIsValid: function(value) { 64 return value != null && (value.constructor == Array || _aspxTrim(value.toString()) != ""); 65 } 66}); 67ASPxRegularExpressionValidationPattern = _aspxCreateClass(ASPxValidationPattern, { 68 constructor: function(errorText, pattern) { 69 this.constructor.prototype.constructor.call(this, errorText); 70 this.pattern = pattern; 71 }, 72 EvaluateIsValid: function(value) { 73 if (value == null) 74 return true; 75 var strValue = value.toString(); 76 if (_aspxTrim(strValue).length == 0) 77 return true; 78 var regEx = new RegExp(this.pattern); 79 var matches = regEx.exec(strValue); 80 return matches != null && strValue == matches[0]; 81 } 82}); 83function _aspxIsEditorFocusable(inputElement) { 84 return _aspxIsFocusableCore(inputElement, function(container) { 85 return container.getAttribute("errorFrame") == "errorFrame"; 86 }); 87} 88var __aspxInvalidEditorToBeFocused = null; 89ASPxValidationType = { 90 PersonalOnValueChanged: "ValueChanged", 91 PersonalViaScript: "CalledViaScript", 92 MassValidation: "MassValidation" 93}; 94ASPxErrorFrameDisplay = { 95 Static: "Static", 96 Dynamic: "Dynamic" 97}; 98ASPxEditElementSuffix = { 99 ExternalTable: "_ET", 100 ControlCell: "_CC", 101 ErrorCell: "_EC", 102 ErrorTextCell: "_ETC", 103 ErrorImage: "_EI" 104}; 105ASPxClientEdit = _aspxCreateClass(ASPxClientEditBase, { 106 constructor: function(name) { 107 this.constructor.prototype.constructor.call(this, name); 108 this.isASPxClientEdit = true; 109 this.inputElement = null; 110 this.elementCache = { }; 111 this.convertEmptyStringToNull = true; 112 this.readOnly = false; 113 this.focused = false; 114 this.focusEventsLocked = false; 115 this.receiveGlobalMouseWheel = true; 116 this.styleDecoration = null; 117 this.widthCorrectionRequired = false; 118 this.heightCorrectionRequired = false; 119 this.customValidationEnabled = false; 120 this.display = ASPxErrorFrameDisplay.Static; 121 this.initialErrorText = ""; 122 this.causesValidation = false; 123 this.validateOnLeave = true; 124 this.validationGroup = ""; 125 this.sendPostBackWithValidation = null; 126 this.validationPatterns = []; 127 this.setFocusOnError = false; 128 this.errorDisplayMode = "it"; 129 this.errorText = ""; 130 this.isValid = true; 131 this.errorImageIsAssigned = false; 132 this.clientValidationStateElement = null; 133 this.enterProcessed = false; 134 this.keyDownHandlers = {}; 135 this.keyPressHandlers = {}; 136 this.keyUpHandlers = {}; 137 this.specialKeyboardHandlingUsed = false;
138 this.onKeyDownHandler = null; 139 this.onKeyPressHandler = null; 140 this.onKeyUpHandler = null; 141 this.onGotFocusHandler = null; 142 this.onLostFocusHandler = null; 143 this.GotFocus = new ASPxClientEvent(); 144 this.LostFocus = new ASPxClientEvent(); 145 this.Validation = new ASPxClientEvent(); 146 this.ValueChanged = new ASPxClientEvent(); 147 this.KeyDown = new ASPxClientEvent(); 148 this.KeyPress = new ASPxClientEvent(); 149 this.KeyUp = new ASPxClientEvent(); 150 ASPxClientEdit.controls.push(this); 151 }, 152 Initialize: function() { 153 this.initialErrorText = this.errorText; 154 ASPxClientEditBase.prototype.Initialize.call(this); 155 this.InitializeKeyHandlers(); 156 this.UpdateClientValidationState(); 157 }, 158 InlineInitialize: function() { 159 ASPxClientEditBase.prototype.InlineInitialize.call(this); 160 if(this.styleDecoration != null) 161 this.styleDecoration.Update(); 162 }, 163 InitSpecialKeyboardHandling: function(){ 164 this.onKeyDownHandler = _aspxCreateEventHandlerFunction("aspxKBSIKeyDown", this.name, true); 165 this.onKeyPressHandler = _aspxCreateEventHandlerFunction("aspxKBSIKeyPress", this.name, true); 166 this.onKeyUpHandler = _aspxCreateEventHandlerFunction("aspxKBSIKeyUp", this.name, true); 167 this.onGotFocusHandler = _aspxCreateEventHandlerFunction("aspxESGotFocus", this.name, false); 168 this.onLostFocusHandler = _aspxCreateEventHandlerFunction("aspxESLostFocus", this.name, false); 169 this.specialKeyboardHandlingUsed = true; 170 this.InitializeDelayedSpecialFocus(); 171 }, 172 InitializeKeyHandlers: function() { 173 }, 174 AddKeyDownHandler: function(key, handler) { 175 this.keyDownHandlers[key] = handler; 176 }, 177 ChangeSpecialInputEnabledAttributes: function(element, method){ 178 element.autocomplete = "off"; 179 if(this.onKeyDownHandler != null) 180 method(element, "keydown", this.onKeyDownHandler); 181 if(this.onKeyPressHandler != null) 182 method(element, "keypress", this.onKeyPressHandler); 183 if(this.onKeyUpHandler != null) 184 method(element, "keyup", this.onKeyUpHandler); 185 if(this.onGotFocusHandler != null) 186 method(element, "focus", this.onGotFocusHandler); 187 if(this.onLostFocusHandler != null) 188 method(element, "blur", this.onLostFocusHandler); 189 }, 190 UpdateClientValidationState: function() { 191 if(!this.customValidationEnabled) 192 return; 193 var mainElement = this.GetMainElement(); 194 if (_aspxIsExists(mainElement)) { 195 var hiddenField = this.GetClientValidationStateHiddenField(); 196 if(_aspxIsExists(hiddenField)) 197 hiddenField.value = _aspxEncodeHtml(!this.GetIsValid() ? ("-" + this.GetErrorText()) : ""); 198 } 199 }, 200 GetCachedElementByIdSuffix: function(idSuffix) { 201 var element = this.elementCache[idSuffix]; 202 if(!_aspxIsExistsElement(element)) { 203 element = _aspxGetElementById(this.name + idSuffix); 204 this.elementCache[idSuffix] = element; 205 } 206 return element; 207 }, 208 FindInputElement: function(){ 209 return null; 210 }, 211 GetInputElement: function(){ 212 if(!_aspxIsExistsElement(this.inputElement)) 213 this.inputElement = this.FindInputElement(); 214 return this.inputElement; 215 }, 216 GetErrorImage: function() { 217 return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ErrorImage); 218 }, 219 GetExternalTable: function() { 220 return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ExternalTable); 221 }, 222 GetControlCell: function() { 223 return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ControlCell); 224 }, 225 GetErrorCell: function() { 226 return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ErrorCell); 227 }, 228 GetErrorTextCell: function() { 229 return this.GetCachedElementByIdSuffix(this.errorImageIsAssigned ? 230 ASPxEditElementSuffix.ErrorTextCell : ASPxEditElementSuffix.ErrorCell); 231 }, 232 GetClientValidationStateHiddenField: function() { 233 if(!_aspxIsExists(this.clientValidationStateElement)) 234 this.clientValidationStateElement = this.CreateClientValidationStateHiddenField(); 235 return this.clientValidationStateElement; 236 }, 237 CreateClientValidationStateHiddenField: function() { 238 var mainElement = this.GetMainElement(); 239 var hiddenField = _aspxCreateHiddenField(this.uniqueID + __aspxClientValidationStateNameSuffix); 240 mainElement.parentNode.appendChild(hiddenField); 241 return hiddenField; 242 }, 243 SetVisible: function(isVisible){ 244 if(this.clientVisible == isVisible) 245 return; 246 if(this.customValidationEnabled) { 247 var errorFrame = this.GetExternalTable(); 248 if(_aspxIsExists(errorFrame)) { 249 _aspxSetElementDisplay(errorFrame, isVisible); 250 var isValid = !isVisible ? true : void(0); 251 this.UpdateErrorFrameAndFocus(false , true , isValid ); 252 } 253 } 254 ASPxClientControl.prototype.SetVisible.call(this, isVisible); 255 }, 256 GetValueInputToValidate: function() { 257 return this.GetInputElement(); 258 }, 259 IsVisible: function() { 260 if (!this.clientVisible) 261 return false; 262 var element = this.GetMainElement(); 263 while(_aspxIsExists(element) && element.tagName != "BODY") { 264 if (element.getAttribute("errorFrame") != "errorFrame" && (!_aspxGetElementVisibility(element) || !_aspxGetElementDisplay(element))) 265 return false; 266 element = element.parentNode; 267 } 268 return true; 269 }, 270 AdjustControlCore: function() { 271 this.CollapseControl(); 272 if (this.WidthCorrectionRequired()) 273 this.CorrectEditorWidth(); 274 else 275 this.UnstretchInputElement(); 276 if (this.heightCorrectionRequired) 277 this.CorrectEditorHeight(); 278 }, 279 WidthCorrectionRequired: function() { 280 var mainElement = this.GetMainElement(); 281 if(_aspxIsExistsElement(mainElement)) { 282 var mainElementCurStyle = _aspxGetCurrentStyle(mainElement); 283 return this.widthCorrectionRequired && mainElementCurStyle.width != "" && mainElementCurStyle.width != "auto"; 284 } 285 return false; 286 }, 287 CorrectEditorWidth: function() { 288 }, 289 CorrectEditorHeight: function() { 290 }, 291 UnstretchInputElement: function() { 292 }, 293 UseDelayedSpecialFocus: function() { 294 return false; 295 }, 296 GetDelayedSpecialFocusTriggers: function() { 297 return [ this.GetMainElement() ]; 298 }, 299 InitializeDelayedSpecialFocus: function() { 300 if(!this.UseDelayedSpecialFocus()) 301 return; 302 this.specialFocusTimer = -1; 303 var instance = this; 304 var handler = function() { 305 window.setTimeout(function() { instance.SetFocus(); }, 0); 306 }; 307 var triggers = this.GetDelayedSpecialFocusTriggers(); 308 for(var i = 0; i < triggers.length; i++) 309 _aspxAttachEventToElement(triggers[i], "mousedown", handler); 310 }, 311 IsFocusEventsLocked: function() { 312 return this.focusEventsLocked; 313 }, 314 LockFocusEvents: function() { 315 if(!this.focused) return; 316 this.focusEventsLocked = true; 317 }, 318 UnlockFocusEvents: function() { 319 this.focusEventsLocked = false; 320 }, 321 ForceRefocusEditor: function() {
322 this.LockFocusEvents(); 323 this.GetInputElement().blur(); 324 window.setTimeout("aspxGetControlCollection().Get('" + this.name + "').SetFocus();", 0); 325 }, 326 IsEditorElement: function(element) { 327 return this.GetMainElement() == element || _aspxGetIsParent(this.GetMainElement(), element); 328 }, 329 OnFocusCore: function() { 330 if(this.UseDelayedSpecialFocus()) { 331 window.clearTimeout(this.specialFocusTimer); 332 if(this.focused) 333 return; 334 } 335 if (!this.IsFocusEventsLocked()){ 336 this.focused = true; 337 ASPxClientEdit.SetFocusedEditor(this); 338 if(this.styleDecoration != null && !this.readOnly) 339 this.styleDecoration.Update(); 340 if(this.isInitialized) 341 this.RaiseFocus(); 342 } 343 else 344 this.UnlockFocusEvents(); 345 }, 346 OnLostFocusCore: function() { 347 if (!this.IsFocusEventsLocked()){ 348 this.focused = false; 349 ASPxClientEdit.SetFocusedEditor(null); 350 if(this.styleDecoration != null && !this.readOnly) 351 this.styleDecoration.Update(); 352 this.RaiseLostFocus(); 353 if (this.validateOnLeave) 354 this.SetFocusOnError(); 355 } 356 }, 357 OnFocus: function() { 358 if (!this.specialKeyboardHandlingUsed) 359 this.OnFocusCore(); 360 }, 361 OnLostFocus: function() { 362 if (this.isInitialized && !this.specialKeyboardHandlingUsed) 363 this.OnLostFocusCore(); 364 }, 365 OnSpecialFocus: function() { 366 if (this.isInitialized) 367 this.OnFocusCore(); 368 }, 369 OnSpecialLostFocus: function() { 370 if (this.isInitialized) 371 this.OnLostFocusCore(); 372 }, 373 OnMouseWheel: function(evt){ 374 }, 375 OnValidation: function(validationType) { 376 if (this.customValidationEnabled && this.isInitialized && _aspxIsExistsElement(this.GetExternalTable())) { 377 this.BeginErrorFrameUpdate(); 378 try { 379 this.SetIsValid(true); 380 this.SetErrorText(this.initialErrorText); 381 if(this.validateOnLeave || validationType != ASPxValidationType.PersonalOnValueChanged) { 382 this.ValidateWithPatterns(); 383 this.RaiseValidation(); 384 } 385 this.UpdateErrorFrameAndFocus(validationType == ASPxValidationType.PersonalOnValueChanged && this.validateOnLeave && !this.GetIsValid()); 386 } finally { 387 this.EndErrorFrameUpdate(); 388 } 389 } 390 }, 391 OnValueChanged: function() { 392 var processOnServer = this.RaiseValidationInternal(); 393 processOnServer = this.RaiseValueChangedEvent() && processOnServer; 394 if (processOnServer) 395 this.SendPostBackInternal(""); 396 }, 397 ParseValue: function() { 398 }, 399 RaisePersonalStandardValidation: function() { 400 if (_aspxIsFunction(window.ValidatorOnChange)) { 401 var inputElement = this.GetValueInputToValidate(); 402 if (_aspxIsExists(inputElement.Validators)) 403 window.ValidatorOnChange({ srcElement: inputElement }); 404 } 405 }, 406 RaiseValidationInternal: function() { 407 if (this.autoPostBack && this.causesValidation && this.validateOnLeave) 408 return ASPxClientEdit.ValidateGroup(this.validationGroup); 409 else { 410 this.OnValidation(ASPxValidationType.PersonalOnValueChanged); 411 return this.GetIsValid(); 412 } 413 }, 414 RaiseValueChangedEvent: function(){ 415 return this.RaiseValueChanged(); 416 }, 417 SendPostBackInternal: function(postBackArg) { 418 if (_aspxIsFunction(this.sendPostBackWithValidation)) 419 this.sendPostBackWithValidation(postBackArg); 420 else 421 this.SendPostBack(postBackArg); 422 }, 423 SetElementToBeFocused: function() { 424 if (this.IsVisible()) 425 __aspxInvalidEditorToBeFocused = this; 426 }, 427 SetFocus: function(){ 428 var inputElement = this.GetInputElement(); 429 if (_aspxGetActiveElement() != inputElement && _aspxIsEditorFocusable(inputElement)) 430 _aspxSetFocus(inputElement); 431 }, 432 SetFocusOnError: function() { 433 if (__aspxInvalidEditorToBeFocused == this) { 434 this.SetFocus(); 435 __aspxInvalidEditorToBeFocused = null; 436 } 437 }, 438 BeginErrorFrameUpdate: function() { 439 if(!this.errorFrameUpdateLocked) 440 this.errorFrameUpdateLocked = true; 441 }, 442 EndErrorFrameUpdate: function() { 443 this.errorFrameUpdateLocked = false; 444 var args = this.updateErrorFrameAndFocusLastCallArgs; 445 if(args) { 446 this.UpdateErrorFrameAndFocus(args[0], args[1]); 447 delete this.updateErrorFrameAndFocusLastCallArgs; 448 } 449 }, 450 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) { 451 if(!this.GetEnabled() || !ignoreVisibilityCheck && !this.GetVisible() ) 452 return; 453 if(this.errorFrameUpdateLocked) { 454 this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ]; 455 return; 456 } 457 if(typeof(isValid) == "undefined") 458 isValid = this.GetIsValid(); 459 var externalTable = this.GetExternalTable(); 460 var isStaticDisplay = this.display == ASPxErrorFrameDisplay.Static; 461 if(isValid) { 462 if(isStaticDisplay) { 463 externalTable.style.visibility = "hidden"; 464 } else {
465 this.HideErrorCell(); 466 this.SaveErrorFrameStyles(); 467 this.ClearErrorFrameElementsStyles(); 468 } 469 } else { 470 var editorLocatedWithinVisibleContainer = this.IsVisible(); 471 if(this.widthCorrectionRequired) { 472 if(editorLocatedWithinVisibleContainer) 473 this.CollapseControl(); 474 else 475 this.sizeCorrectedOnce = false; 476 } 477 this.UpdateErrorCellContent(); 478 if(isStaticDisplay) { 479 externalTable.style.visibility = "visible"; 480 } else { 481 this.EnsureErrorFrameStylesLoaded(); 482 this.RestoreErrorFrameElementsStyles(); 483 this.ShowErrorCell(); 484 } 485 if(editorLocatedWithinVisibleContainer) { 486 if(this.widthCorrectionRequired) 487 this.AdjustControl(); 488 if(setFocusOnError && this.setFocusOnError && __aspxInvalidEditorToBeFocused == null) 489 this.SetElementToBeFocused(); 490 } 491 } 492 }, 493 ShowErrorCell: function() { 494 var errorCell = this.GetErrorCell(); 495 if(_aspxIsExists(errorCell)) 496 _aspxSetElementDisplay(errorCell, true); 497 }, 498 HideErrorCell: function() { 499 var errorCell = this.GetErrorCell(); 500 if(_aspxIsExists(errorCell)) 501 _aspxSetElementDisplay(errorCell, false); 502 }, 503 SaveErrorFrameStyles: function() { 504 this.EnsureErrorFrameStylesLoaded(); 505 }, 506 EnsureErrorFrameStylesLoaded: function() { 507 if(typeof(this.errorFrameStyles) == "undefined") { 508 var externalTable = this.GetExternalTable(); 509 var controlCell = this.GetControlCell(); 510 this.errorFrameStyles = { 511 errorFrame: { 512 cssClass: externalTable.className,
513 style: this.ExtractElementStyleStringIgnoringVisibilityProps(externalTable) 514 }, 515 controlCell: { 516 cssClass: controlCell.className, 517 style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell) 518 } 519 }; 520 } 521 }, 522 ClearErrorFrameElementsStyles: function() { 523 this.ClearElementStyle(this.GetExternalTable()); 524 this.ClearElementStyle(this.GetControlCell()); 525 }, 526 RestoreErrorFrameElementsStyles: function() { 527 var externalTable = this.GetExternalTable(); 528 externalTable.className = this.errorFrameStyles.errorFrame.cssClass; 529 externalTable.style.cssText = this.errorFrameStyles.errorFrame.style; 530 var controlCell = this.GetControlCell(); 531 controlCell.className = this.errorFrameStyles.controlCell.cssClass; 532 controlCell.style.cssText = this.errorFrameStyles.controlCell.style; 533 }, 534 ExtractElementStyleStringIgnoringVisibilityProps: function(element) { 535 var savedVisibility = element.style.visibility; 536 var savedDisplay = element.style.display; 537 element.style.visibility = ""; 538 element.style.display = ""; 539 var styleStr = element.style.cssText; 540 element.style.visibility = savedVisibility; 541 element.style.display = savedDisplay; 542 return styleStr; 543 }, 544 ClearElementStyle: function(element) { 545 if(!_aspxIsExists(element)) 546 return; 547 element.className = ""; 548 var savedVisibility = element.style.visibility; 549 var savedDisplay = element.style.display; 550 var savedWidth = element.style.width; 551 element.style.cssText = ""; 552 element.style.visibility = savedVisibility; 553 element.style.display = savedDisplay; 554 element.style.width = savedWidth; 555 }, 556 UpdateErrorCellContent: function() { 557 if (this.errorDisplayMode.indexOf("t") > -1) 558 this.UpdateErrorText(); 559 if (this.errorDisplayMode == "i") 560 this.UpdateErrorImage(); 561 }, 562 UpdateErrorImage: function() { 563 var image = this.GetErrorImage(); 564 if (_aspxIsExistsElement(image)) { 565 image.alt = this.errorText; 566 image.title = this.errorText; 567 } else { 568 this.UpdateErrorText(); 569 } 570 }, 571 UpdateErrorText: function() { 572 var errorTextCell = this.GetErrorTextCell(); 573 if(_aspxIsExistsElement(errorTextCell)) 574 errorTextCell.innerHTML = _aspxEncodeHtml(this.errorText); 575 }, 576 ValidateWithPatterns: function() { 577 if (this.validationPatterns.length > 0) { 578 var value = this.GetValue(); 579 for (var i = 0; i < this.validationPatterns.length; i++) { 580 var validator = this.validationPatterns[i]; 581 if (!validator.EvaluateIsValid(value)) { 582 this.SetIsValid(false); 583 this.SetErrorText(validator.errorText); 584 return; 585 } 586 } 587 } 588 }, 589 OnSpecialKeyDown: function(evt){ 590 this.RaiseKeyDown(evt); 591 var handler = this.keyDownHandlers[evt.keyCode]; 592 if(_aspxIsExists(handler)) 593 return this[handler](evt); 594 return false; 595 }, 596 OnSpecialKeyPress: function(evt){ 597 this.RaiseKeyPress(evt); 598 var handler = this.keyPressHandlers[evt.keyCode]; 599 if(_aspxIsExists(handler)) 600 return this[handler](evt); 601 if(__aspxNetscapeFamily || __aspxOpera){ 602 if(evt.keyCode == ASPxKey.Enter) 603 return this.enterProcessed; 604 } 605 return false; 606 }, 607 OnSpecialKeyUp: function(evt){ 608 this.RaiseKeyUp(evt); 609 var handler = this.keyUpHandlers[evt.keyCode]; 610 if(_aspxIsExists(handler)) 611 return this[handler](evt); 612 return false; 613 }, 614 OnKeyDown: function(evt) { 615 if(!this.specialKeyboardHandlingUsed) 616 this.RaiseKeyDown(evt); 617 }, 618 OnKeyPress: function(evt) { 619 if(!this.specialKeyboardHandlingUsed) 620 this.RaiseKeyPress(evt); 621 }, 622 OnKeyUp: function(evt) { 623 if(!this.specialKeyboardHandlingUsed) 624 this.RaiseKeyUp(evt); 625 }, 626 RaiseKeyDown: function(evt){ 627 if(!this.KeyDown.IsEmpty()){ 628 var args = new ASPxClientEditKeyEventArgs(evt); 629 this.KeyDown.FireEvent(this, args); 630 } 631 }, 632 RaiseKeyPress: function(evt){ 633 if(!this.KeyPress.IsEmpty()){ 634 var args = new ASPxClientEditKeyEventArgs(evt); 635 this.KeyPress.FireEvent(this, args); 636 } 637 }, 638 RaiseKeyUp: function(evt){ 639 if(!this.KeyUp.IsEmpty()){ 640 var args = new ASPxClientEditKeyEventArgs(evt); 641 this.KeyUp.FireEvent(this, args); 642 } 643 }, 644 RaiseFocus: function(){ 645 if(!this.GotFocus.IsEmpty()){ 646 var args = new ASPxClientEventArgs(); 647 this.GotFocus.FireEvent(this, args); 648 } 649 }, 650 RaiseLostFocus: function(){ 651 if(!this.LostFocus.IsEmpty()){ 652 var args = new ASPxClientEventArgs(); 653 this.LostFocus.FireEvent(this, args); 654 } 655 }, 656 RaiseValidation: function() { 657 if (this.customValidationEnabled && !this.Validation.IsEmpty()) { 658 var currentValue = this.GetValue(); 659 var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid()); 660 this.Validation.FireEvent(this, args); 661 this.SetErrorText(args.errorText); 662 this.SetIsValid(args.isValid);
663 if (args.value != currentValue) 664 this.SetValue(args.value); 665 } 666 }, 667 RaiseValueChanged: function(){ 668 var processOnServer = this.autoPostBack; 669 if(!this.ValueChanged.IsEmpty()){ 670 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 671 this.ValueChanged.FireEvent(this, args); 672 processOnServer = args.processOnServer; 673 } 674 return processOnServer; 675 }, 676 RequireStyleDecoration: function() { 677 this.styleDecoration = new ASPxClientEditStyleDecoration(this); 678 this.PopulateStyleDecorationPostfixes(); 679 }, 680 PopulateStyleDecorationPostfixes: function() { 681 this.styleDecoration.AddPostfix(""); 682 }, 683 Focus: function(){ 684 this.SetFocus(); 685 }, 686 GetIsValid: function(){ 687 var externalTable = this.GetExternalTable(); 688 return _aspxIsExistsElement(externalTable) ? this.isValid : true; 689 }, 690 GetErrorText: function(){ 691 return this.errorText; 692 }, 693 SetIsValid: function(isValid){ 694 if (this.customValidationEnabled) { 695 this.isValid = isValid; 696 this.UpdateErrorFrameAndFocus(false ); 697 this.UpdateClientValidationState(); 698 } 699 }, 700 SetErrorText: function(errorText){ 701 if (this.customValidationEnabled) { 702 this.errorText = errorText; 703 this.UpdateErrorFrameAndFocus(false ); 704 this.UpdateClientValidationState(); 705 } 706 }, 707 Validate: function(){ 708 this.ParseValue(); 709 this.OnValidation(ASPxValidationType.PersonalViaScript); 710 } 711}); 712ASPxClientEdit.controls = []; 713ASPxClientEdit.focusedEditorName = ""; 714ASPxClientEdit.GetFocusedEditor = function(){ 715 var focusedEditor = aspxGetControlCollection().Get(ASPxClientEdit.focusedEditorName); 716 if(focusedEditor && !focusedEditor.focused){ 717 ASPxClientEdit.SetFocusedEditor(null); 718 focusedEditor = null; 719 } 720 return focusedEditor; 721} 722ASPxClientEdit.SetFocusedEditor = function(editor){ 723 ASPxClientEdit.focusedEditorName = editor ? editor.name : ""; 724} 725ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) { 726 __aspxInvalidEditorToBeFocused = null; 727 _aspxProcessEditorsInContainer(container, _aspxClearProcessingProc, _aspxClearChoiceCondition, validationGroup, clearInvisibleEditors, true ); 728}
729ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) { 730 var container = document.getElementById(containerId); 731 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors); 732} 733ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) { 734 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors); 735} 736ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) { 737 var validationResult = _aspxProcessEditorsInContainer(container, _aspxValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors, 738 false ); 739 if(_aspxIsExistsType(typeof(aspxGetGlobalEvents))) { 740 if(typeof(validateInvisibleEditors) == "undefined") 741 validateInvisibleEditors = false; 742 if(typeof(validationGroup) == "undefined") 743 validationGroup = null; 744 validationResult.isValid = aspxGetGlobalEvents().OnValidationCompleted(container, validationGroup, 745 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid); 746 } 747 return validationResult.isValid; 748}
749ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) { 750 var container = document.getElementById(containerId); 751 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors); 752} 753ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) { 754 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors); 755} 756ASPxClientEditKeyEventArgs = _aspxCreateClass(ASPxClientEventArgs, { 757 constructor: function(htmlEvent) { 758 this.constructor.prototype.constructor.call(this); 759 this.htmlEvent = htmlEvent; 760 } 761}); 762ASPxClientEditValidationEventArgs = _aspxCreateClass(ASPxClientEventArgs, { 763 constructor: function(value, errorText, isValid) { 764 this.constructor.prototype.constructor.call(this); 765 this.errorText = errorText; 766 this.isValid = isValid; 767 this.value = value; 768 } 769}); 770ASPxClientEditStyleDecoration = _aspxCreateClass(null, { 771 constructor: function(editor) { 772 this.editor = editor; 773 this.postfixList = [ ]; 774 this.styles = { }; 775 }, 776 GetStyleSheet: function() { 777 if(!ASPxClientEditStyleDecoration.__sheet) 778 ASPxClientEditStyleDecoration.__sheet = _aspxCreateStyleSheet(); 779 return ASPxClientEditStyleDecoration.__sheet; 780 }, 781 AddPostfix: function(value, applyClass, applyBorders, applyBackground) { 782 this.postfixList.push(value); 783 }, 784 AddStyle: function(key, className, cssText) { 785 this.styles[key] = _aspxTrim(className + " " + _aspxCreateImportantStyleRule(this.GetStyleSheet(), cssText)); 786 }, 787 Update: function() { 788 for(var i = 0; i < this.postfixList.length; i++) { 789 var postfix = this.postfixList[i]; 790 var element = _aspxGetElementById(this.editor.name + postfix); 791 if(!element) continue; 792 if(this.HasDecoration("F")) 793 this.ApplyDecoration("F", element, this.editor.focused); 794 if(this.HasDecoration("N")) { 795 var apply = !this.editor.focused; 796 if(apply) { 797 var value = this.editor.GetValue(); 798 apply = apply && (value == null || value == "" && this.editor.convertEmptyStringToNull); 799 } 800 this.ApplyDecoration("N", element, apply); 801 } 802 } 803 }, 804 HasDecoration: function(key) { 805 return !!this.styles[key]; 806 }, 807 ApplyDecoration: function(key, element, active) { 808 var value = this.styles[key]; 809 element.className = element.className.replace(value, ""); 810 if(active) 811 element.className = _aspxTrim(element.className + " " + value); 812 } 813}); 814function aspxEGotFocus(name){ 815 var edit = aspxGetControlCollection().Get(name); 816 if(edit != null) 817 edit.OnFocus(); 818} 819function aspxELostFocus(name){ 820 var edit = aspxGetControlCollection().Get(name); 821 if(edit != null) 822 edit.OnLostFocus(); 823} 824function aspxESGotFocus(name){ 825 var edit = aspxGetControlCollection().Get(name); 826 if(edit != null) 827 edit.OnSpecialFocus(); 828} 829function aspxESLostFocus(name){ 830 var edit = aspxGetControlCollection().Get(name); 831 if(edit == null) 832 return; 833 if(edit.UseDelayedSpecialFocus()) 834 edit.specialFocusTimer = window.setTimeout(function() { edit.OnSpecialLostFocus(); }, 30); 835 else
836 edit.OnSpecialLostFocus(); 837} 838function aspxEValueChanged(name){ 839 var edit = aspxGetControlCollection().Get(name); 840 if(edit != null) 841 edit.OnValueChanged(); 842} 843_aspxAttachEventToDocument("mousedown", aspxEMouseDown); 844function aspxEMouseDown(evt) { 845 var editor = ASPxClientEdit.GetFocusedEditor(); 846 if (editor != null && editor.IsEditorElement(_aspxGetEventSource(evt))) 847 editor.ForceRefocusEditor(); 848} 849_aspxAttachEventToDocument(__aspxNetscapeFamily ? "DOMMouseScroll" : "mousewheel", aspxEMouseWheel); 850function aspxEMouseWheel(evt) { 851 var editor = ASPxClientEdit.GetFocusedEditor(); 852 if (editor != null && _aspxIsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel) 853 editor.OnMouseWheel(evt); 854} 855function aspxKBSIKeyDown(name, evt){ 856 var control = aspxGetControlCollection().Get(name); 857 if(control != null){ 858 var isProcessed = control.OnSpecialKeyDown(evt); 859 if(isProcessed) 860 return _aspxPreventEventAndBubble(evt); 861 } 862} 863function aspxKBSIKeyPress(name, evt){ 864 var control = aspxGetControlCollection().Get(name); 865 if(control != null){ 866 var isProcessed = control.OnSpecialKeyPress(evt); 867 if(isProcessed) 868 return _aspxPreventEventAndBubble(evt); 869 } 870} 871function aspxKBSIKeyUp(name, evt){ 872 var control = aspxGetControlCollection().Get(name); 873 if(control != null){ 874 var isProcessed = control.OnSpecialKeyUp(evt); 875 if(isProcessed) 876 return _aspxPreventEventAndBubble(evt); 877 } 878} 879function aspxEKeyDown(name, evt){ 880 var edit = aspxGetControlCollection().Get(name); 881 if(edit != null) 882 edit.OnKeyDown(evt); 883} 884function aspxEKeyPress(name, evt){ 885 var edit = aspxGetControlCollection().Get(name); 886 if(edit != null) 887 edit.OnKeyPress(evt); 888} 889function aspxEKeyUp(name, evt){ 890 var edit = aspxGetControlCollection().Get(name); 891 if(edit != null) 892 edit.OnKeyUp(evt); 893} 894ASPxValidationResult = _aspxCreateClass(null, { 895 constructor: function(isValid, firstInvalid, firstVisibleInvalid) { 896 this.isValid = isValid; 897 this.firstInvalid = firstInvalid; 898 this.firstVisibleInvalid = firstVisibleInvalid; 899 } 900}); 901function _aspxProcessEditorsInContainer(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) { 902 var allProcessedSuccessfull = true; 903 var firstInvalid = null; 904 var firstVisibleInvalid = null; 905 var invalidEditorToBeFocused = null; 906 var collection = aspxGetControlCollection(); 907 for (var key in collection.elements) { 908 var control = collection.elements[key]; 909 if (control != null && ASPxIdent.IsASPxClientEdit(control) && (processDisabledEditors || control.GetEnabled())) { 910 var mainElement = control.GetMainElement(); 911 if (_aspxIsExists(mainElement) && 912 (container == null || _aspxGetIsParent(container, mainElement)) && 913 (processInvisibleEditors || control.IsVisible()) && 914 choiceCondition(control, validationGroup)) { 915 var isSuccess = processingProc(control); 916 if(!isSuccess) { 917 allProcessedSuccessfull = false; 918 if(firstInvalid == null) 919 firstInvalid = control; 920 var isVisible = control.IsVisible(); 921 if(isVisible && firstVisibleInvalid == null) 922 firstVisibleInvalid = control; 923 if (control.setFocusOnError && invalidEditorToBeFocused == null && isVisible) 924 invalidEditorToBeFocused = control; 925 } 926 } 927 } 928 } 929 if (invalidEditorToBeFocused != null) 930 invalidEditorToBeFocused.SetFocus(); 931 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid); 932} 933function _aspxClearChoiceCondition(edit, validationGroup) { 934 return !_aspxIsExists(validationGroup) || (edit.validationGroup == validationGroup); 935} 936function _aspxValidateChoiceCondition(edit, validationGroup) { 937 return _aspxClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled; 938} 939function _aspxClearProcessingProc(edit) { 940 edit.SetValue(null); 941 edit.SetIsValid(true); 942 return true; 943} 944function _aspxValidateProcessingProc(edit) { 945 edit.OnValidation(ASPxValidationType.MassValidation); 946 return edit.GetIsValid(); 947} 948function _aspxSetSelectionCore(inputElement, startPos, endPos) { 949 if (__aspxIE) { 950 var range = inputElement.createTextRange(); 951 range.collapse(true); 952 range.moveStart("character", startPos); 953 range.moveEnd("character", endPos - startPos); 954 range.select(); 955 } else 956 inputElement.setSelectionRange(startPos, endPos); 957} 958function _aspxSetSelection(inputElement, startPos, endPos, scrollToSelection) { 959 var textLen = inputElement.value.length; 960 if (endPos == -1 || endPos > textLen) 961 endPos = textLen; 962 if (startPos > textLen) 963 startPos = textLen; 964 if (startPos > endPos) 965 return; 966 _aspxSetSelectionCore(inputElement, startPos, endPos); 967 if (scrollToSelection && inputElement.tagName == 'TEXTAREA') { 968 var scrollHeight = inputElement.scrollHeight; 969 var approxCaretPos = startPos; 970 var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen - inputElement.clientHeight / 2), 0); 971 inputElement.scrollTop = scrollTop; 972 } 973} 974function _aspxSetCaretPosition(inputElement, caretPos, scrollToSelection) { 975 if(!scrollToSelection) 976 scrollToSelection = true; 977 if (caretPos == -1) 978 caretPos = inputElement.value.length; 979 _aspxSetSelection(inputElement, caretPos, caretPos, scrollToSelection); 980}
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.