1; /* /bitrix/js/main/date/main.date.min.js?171319699617992*/ 2; /* /bitrix/js/main/core/core_date.min.js?171319698426661*/ 3; /* /bitrix/js/main/session.min.js?17131969962394*/ 4; /* /bitrix/js/main/utils.min.js?171319699618721*/ 5; /* /bitrix/js/main/pageobject/pageobject.min.js?1713196982570*/ 6; /* /bitrix/js/main/core/core_window.js?171319698598768*/ 7 8; /* Start:"a:4:{s:4:"full";s:58:"/bitrix/js/main/pageobject/pageobject.min.js?1713196982570";s:6:"source";s:40:"/bitrix/js/main/pageobject/pageobject.js";s:3:"min";s:44:"/bitrix/js/main/pageobject/pageobject.min.js";s:3:"map";s:44:"/bitrix/js/main/pageobject/pageobject.map.js";}"*/ 9window.BX=BX||{};BX.PageObject={getRootWindow:function(){return BX.PageObject.getTopWindowOfCurrentHost(window)},isCrossOriginObject:function(t){try{void t.location.host}catch(t){return true}return false},getTopWindowOfCurrentHost:function(t){if(!BX.PageObject.isCrossOriginObject(t.parent)&&t.parent!==t&&t.parent.location.host===t.location.host){return BX.PageObject.getTopWindowOfCurrentHost(t.parent)}return t},getParentWindowOfCurrentHost:function(t){if(BX.PageObject.isCrossOriginObject(t.parent)){return t}return t.parent}}; 10/* End */ 11; 12; /* Start:"a:4:{s:4:"full";s:51:"/bitrix/js/main/core/core_window.js?171319698598768";s:6:"source";s:35:"/bitrix/js/main/core/core_window.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 13;(function(window) { 14if (BX.WindowManager) return; 15 16/* windows manager */ 17BX.WindowManager = { 18 _stack: [], 19 _runtime_resize: {}, 20 _delta: 2, 21 _delta_start: 1000, 22 currently_loaded: null, 23 24 settings_category: 'BX.WindowManager.9.5', 25 26 register: function (w) 27 { 28 this.currently_loaded = null; 29 30 w.WM_REG_INDEX = this._stack.length; 31 this._stack.push(w); 32 33 if (this._stack.length < 2) 34 { 35 BX.bind(document, 'keyup', BX.proxy(this.__checkKeyPress, this)); 36 } 37 }, 38 39 unregister: function (w) 40 { 41 if (null == w.WM_REG_INDEX) 42 return null; 43 44 var _current; 45 if (this._stack.length > 0) 46 { 47 while ((_current = this.__pop_stack()) != w) 48 { 49 if (!_current) 50 { 51 _current = null; 52 break; 53 } 54 } 55 56 if (this._stack.length <= 0) 57 { 58 this.enableKeyCheck(); 59 } 60 61 return _current; 62 } 63 else 64 { 65 return null; 66 } 67 }, 68 69 __pop_stack: function(clean) 70 { 71 if (this._stack.length > 0) 72 { 73 var _current = this._stack.pop(); 74 _current.WM_REG_INDEX = null; 75 BX.onCustomEvent(_current, 'onWindowUnRegister', [clean === true]); 76 77 return _current; 78 } 79 else 80 return null; 81 }, 82 83 clean: function() 84 { 85 while (this.__pop_stack(true)){} 86 this._stack = null; 87 this.disableKeyCheck(); 88 }, 89 90 Get: function() 91 { 92 if (this.currently_loaded) 93 return this.currently_loaded; 94 else if (this._stack.length > 0) 95 return this._stack[this._stack.length-1]; 96 else 97 return null; 98 }, 99 100 setStartZIndex: function(value) 101 { 102 this._delta_start = value; 103 }, 104 105 restoreStartZIndex: function() 106 { 107 this._delta_start = 1000; 108 }, 109 110 GetZIndex: function() 111 { 112 var _current; 113 return (null != (_current = this._stack[this._stack.length-1]) 114 ? parseInt(_current.Get().style.zIndex) + this._delta 115 : this._delta_start 116 ); 117 }, 118 119 __get_check_url: function(url) 120 { 121 var pos = url.indexOf('?'); 122 return pos == -1 ? url : url.substring(0, pos); 123 }, 124 125 saveWindowSize: function(url, params) 126 { 127 var check_url = this.__get_check_url(url); 128 if (BX.userOptions) 129 { 130 BX.userOptions.save(this.settings_category, 'size_' + check_url, 'width', params.width); 131 BX.userOptions.save(this.settings_category, 'size_' + check_url, 'height', params.height); 132 } 133 134 this._runtime_resize[check_url] = params; 135 }, 136 137 saveWindowOptions: function(wnd_id, opts) 138 { 139 if (BX.userOptions) 140 { 141 for (var i in opts) 142 { 143 if(opts.hasOwnProperty(i)) 144 { 145 BX.userOptions.save(this.settings_category, 'options_' + wnd_id, i, opts[i]); 146 } 147 } 148 } 149 }, 150 151 getRuntimeWindowSize: function(url) 152 { 153 return this._runtime_resize[this.__get_check_url(url)]; 154 }, 155 156 disableKeyCheck: function() 157 { 158 BX.unbind(document, 'keyup', BX.proxy(this.__checkKeyPress, this)); 159 }, 160 161 enableKeyCheck: function() 162 { 163 BX.bind(document, 'keyup', BX.proxy(this.__checkKeyPress, this)); 164 }, 165 166 __checkKeyPress: function(e) 167 { 168 if (null == e) 169 e = window.event; 170 171 if (e.keyCode == 27) 172 { 173 var wnd = BX.WindowManager.Get(); 174 if (wnd && !wnd.unclosable) wnd.Close(); 175 } 176 } 177}; 178 179BX.garbage(BX.WindowManager.clean, BX.WindowManager); 180 181/* base button class */ 182BX.CWindowButton = function(params) 183{ 184 if (params.btn) 185 { 186 this.btn = params.btn; 187 this.parentWindow = params.parentWindow; 188 189 if (/save|apply/i.test(this.btn.name)) 190 { 191 BX.bind(this.btn, 'click', BX.delegate(this.disableUntilError, this)); 192 } 193 } 194 else 195 { 196 this.title = params.title; // html value attr 197 this.hint = params.hint; // html title attr 198 this.id = params.id; // html name and id attrs 199 this.name = params.name; // html name or value attrs when id and title 're absent 200 this.className = params.className; // className for button input 201 202 this.action = params.action; 203 this.onclick = params.onclick; 204 205 // you can override button creation method 206 if (params.Button && BX.type.isFunction(params.Button)) 207 this.Button = params.Button; 208 209 this.btn = null; 210 } 211}; 212 213BX.CWindowButton.prototype.disable = function() 214{ 215 if (this.btn) 216 this.parentWindow.showWait(this.btn); 217}; 218BX.CWindowButton.prototype.enable = function(){ 219 if (this.btn) 220 this.parentWindow.closeWait(this.btn); 221}; 222 223BX.CWindowButton.prototype.emulate = function() 224{ 225 if (this.btn && this.btn.disabled) 226 return; 227 228 var act = 229 this.action 230 ? BX.delegate(this.action, this) 231 : ( 232 this.onclick 233 ? this.onclick 234 : ( 235 this.btn 236 ? this.btn.getAttribute('onclick') 237 : '' 238 ) 239 ); 240 241 if (act) 242 { 243 setTimeout(act, 50); 244 if (this.btn && /save|apply/i.test(this.btn.name) && !this.action) 245 { 246 this.disableUntilError(); 247 } 248 } 249}; 250 251BX.CWindowButton.prototype.Button = function(parentWindow) 252{ 253 this.parentWindow = parentWindow; 254 255 var btn = { 256 props: { 257 'type': 'button', 258 'name': this.id ? this.id : this.name, 259 'value': this.title ? this.title : this.name, 260 'id': this.id 261 } 262 }; 263 264 if (this.hint) 265 btn.props.title = this.hint; 266 if (!!this.className) 267 btn.props.className = this.className; 268 269 if (this.action) 270 { 271 btn.events = { 272 'click': BX.delegate(this.action, this) 273 }; 274 } 275 else if (this.onclick) 276 { 277 if (BX.browser.IsIE()) 278 { 279 btn.events = { 280 'click': BX.delegate(function() {eval(this.onclick)}, this) 281 }; 282 } 283 else 284 { 285 btn.attrs = { 286 'onclick': this.onclick 287 }; 288 } 289 } 290 291 this.btn = BX.create('INPUT', btn); 292 293 return this.btn; 294}; 295 296BX.CWindowButton.prototype.disableUntilError = function() { 297 this.disable(); 298 if (!this.__window_error_handler_set) 299 { 300 BX.addCustomEvent(this.parentWindow, 'onWindowError', BX.delegate(this.enable, this)); 301 this.__window_error_handler_set = true; 302 } 303}; 304 305/* base window class */ 306BX.CWindow = function(div, type) 307{ 308 this.DIV = div || document.createElement('DIV'); 309 310 this.SETTINGS = { 311 resizable: false, 312 min_height: 0, 313 min_width: 0, 314 top: 0, 315 left: 0, 316 draggable: false, 317 drag_restrict: true, 318 resize_restrict: true 319 }; 320 321 this.ELEMENTS = { 322 draggable: [], 323 resizer: [], 324 close: [] 325 }; 326 327 this.type = type == 'float' ? 'float' : 'dialog'; 328 329 BX.adjust(this.DIV, { 330 props: { 331 className: 'bx-core-window' 332 }, 333 style: { 334 'zIndex': 0, 335 'position': 'absolute', 336 'display': 'none', 337 'top': this.SETTINGS.top + 'px', 338 'left': this.SETTINGS.left + 'px', 339 'height': '100px', 340 'width': '100px' 341 } 342 }); 343 344 this.isOpen = false;
345 346 BX.addCustomEvent(this, 'onWindowRegister', BX.delegate(this.onRegister, this)); 347 BX.addCustomEvent(this, 'onWindowUnRegister', BX.delegate(this.onUnRegister, this)); 348 349 this.MOUSEOVER = null; 350 BX.bind(this.DIV, 'mouseover', BX.delegate(this.__set_msover, this)); 351 BX.bind(this.DIV, 'mouseout', BX.delegate(this.__unset_msover, this)); 352 353 BX.ready(BX.delegate(function() { 354 document.body.appendChild(this.DIV); 355 BX.ZIndexManager.register(this.DIV); 356 }, this)); 357}; 358 359BX.CWindow.prototype.Get = function () {return this.DIV}; 360BX.CWindow.prototype.visible = function() {return this.isOpen;}; 361 362BX.CWindow.prototype.Show = function(bNotRegister) 363{ 364 this.DIV.style.display = 'block'; 365 366 if (!bNotRegister) 367 { 368 BX.WindowManager.register(this); 369 BX.onCustomEvent(this, 'onWindowRegister'); 370 } 371 372 BX.ZIndexManager.bringToFront(this.DIV); 373}; 374 375BX.CWindow.prototype.Hide = function() 376{ 377 BX.WindowManager.unregister(this); 378 this.DIV.style.display = 'none'; 379}; 380 381BX.CWindow.prototype.onRegister = function() 382{ 383 this.isOpen = true; 384}; 385 386BX.CWindow.prototype.onUnRegister = function(clean) 387{ 388 this.isOpen = false; 389 390 if (clean || (this.PARAMS && this.PARAMS.content_url)) 391 { 392 if (clean) {BX.onCustomEvent(this, 'onWindowClose', [this, true]);} 393 394 if (this.DIV.parentNode) 395 this.DIV.parentNode.removeChild(this.DIV); 396 } 397 else 398 { 399 this.DIV.style.display = 'none'; 400 } 401}; 402 403BX.CWindow.prototype.CloseDialog = // compatibility 404BX.CWindow.prototype.Close = function(bImmediately) 405{ 406 BX.onCustomEvent(this, 'onBeforeWindowClose', [this]); 407 if (bImmediately !== true) 408 { 409 if (this.denyClose) 410 return false; 411 } 412 413 BX.onCustomEvent(this, 'onWindowClose', [this]); 414 415 //this crashes vis editor in ie via onWindowResizeExt event handler 416 //if (this.bExpanded) this.__expand(); 417 // alternative version: 418 if (this.bExpanded) 419 { 420 var pDocElement = BX.GetDocElement(); 421 BX.unbind(window, 'resize', BX.proxy(this.__expand_onresize, this)); 422 pDocElement.style.overflow = this.__expand_settings.overflow; 423 } 424 425 BX.WindowManager.unregister(this); 426 427 return true; 428}; 429 430BX.CWindow.prototype.SetResize = function(elem) 431{ 432 elem.style.cursor = 'se-resize'; 433 BX.bind(elem, 'mousedown', BX.proxy(this.__startResize, this)); 434 435 this.ELEMENTS.resizer.push(elem); 436 this.SETTINGS.resizable = true; 437}; 438 439BX.CWindow.prototype.SetExpand = function(elem, event_name) 440{ 441 event_name = event_name || 'click'; 442 BX.bind(elem, event_name, BX.proxy(this.__expand, this)); 443}; 444 445BX.CWindow.prototype.__expand_onresize = function() 446{ 447 var windowSize = BX.GetWindowInnerSize(); 448 this.DIV.style.width = windowSize.innerWidth + "px"; 449 this.DIV.style.height = windowSize.innerHeight + "px"; 450 451 BX.onCustomEvent(this, 'onWindowResize'); 452}; 453 454BX.CWindow.prototype.__expand = function() 455{ 456 var pDocElement = BX.GetDocElement(); 457 458 if (!this.bExpanded) 459 { 460 var wndScroll = BX.GetWindowScrollPos(), 461 wndSize = BX.GetWindowInnerSize(); 462 463 this.__expand_settings = { 464 resizable: this.SETTINGS.resizable, 465 draggable: this.SETTINGS.draggable, 466 width: this.DIV.style.width, 467 height: this.DIV.style.height, 468 left: this.DIV.style.left, 469 top: this.DIV.style.top, 470 scrollTop: wndScroll.scrollTop, 471 scrollLeft: wndScroll.scrollLeft, 472 overflow: BX.style(pDocElement, 'overflow') 473 }; 474 475 this.SETTINGS.resizable = false; 476 this.SETTINGS.draggable = false; 477 478 window.scrollTo(0,0); 479 pDocElement.style.overflow = 'hidden'; 480 481 this.DIV.style.top = '0px'; 482 this.DIV.style.left = '0px'; 483 484 this.DIV.style.width = wndSize.innerWidth + 'px'; 485 this.DIV.style.height = wndSize.innerHeight + 'px'; 486 487 this.bExpanded = true; 488 489 BX.onCustomEvent(this, 'onWindowExpand'); 490 BX.onCustomEvent(this, 'onWindowResize'); 491 492 BX.bind(window, 'resize', BX.proxy(this.__expand_onresize, this)); 493 } 494 else 495 { 496 BX.unbind(window, 'resize', BX.proxy(this.__expand_onresize, this)); 497 498 this.SETTINGS.resizable = this.__expand_settings.resizable; 499 this.SETTINGS.draggable = this.__expand_settings.draggable; 500 501 pDocElement.style.overflow = this.__expand_settings.overflow; 502 503 this.DIV.style.top = this.__expand_settings.top; 504 this.DIV.style.left = this.__expand_settings.left; 505 this.DIV.style.width = this.__expand_settings.width; 506 this.DIV.style.height = this.__expand_settings.height; 507 508 window.scrollTo(this.__expand_settings.scrollLeft, this.__expand_settings.scrollTop); 509 510 this.bExpanded = false;
511 512 BX.onCustomEvent(this, 'onWindowNarrow'); 513 BX.onCustomEvent(this, 'onWindowResize'); 514 515 } 516}; 517 518BX.CWindow.prototype.Resize = function(x, y) 519{ 520 var new_width = Math.max(x - this.pos.left + this.dx, this.SETTINGS.min_width); 521 var new_height = Math.max(y - this.pos.top + this.dy, this.SETTINGS.min_height); 522 523 if (this.SETTINGS.resize_restrict) 524 { 525 var scrollSize = BX.GetWindowScrollSize(); 526 527 if (this.pos.left + new_width > scrollSize.scrollWidth - this.dw) 528 new_width = scrollSize.scrollWidth - this.pos.left - this.dw; 529 } 530 531 this.DIV.style.width = new_width + 'px'; 532 this.DIV.style.height = new_height + 'px'; 533 534 BX.onCustomEvent(this, 'onWindowResize'); 535}; 536 537BX.CWindow.prototype.__startResize = function(e) 538{ 539 if (!this.SETTINGS.resizable) 540 return false; 541 542 if(!e) e = window.event; 543 544 this.wndSize = BX.GetWindowScrollPos(); 545 this.wndSize.innerWidth = BX.GetWindowInnerSize().innerWidth; 546 547 this.pos = BX.pos(this.DIV); 548 549 this.x = e.clientX + this.wndSize.scrollLeft; 550 this.y = e.clientY + this.wndSize.scrollTop; 551 552 this.dx = this.pos.left + this.pos.width - this.x; 553 this.dy = this.pos.top + this.pos.height - this.y; 554 this.dw = this.pos.width - parseInt(this.DIV.style.width); 555 556 BX.bind(document, "mousemove", BX.proxy(this.__moveResize, this)); 557 BX.bind(document, "mouseup", BX.proxy(this.__stopResize, this)); 558 559 if(document.body.setCapture) 560 document.body.setCapture(); 561 562 document.onmousedown = BX.False; 563 564 var b = document.body; 565 b.ondrag = b.onselectstart = BX.False; 566 b.style.MozUserSelect = this.DIV.style.MozUserSelect = 'none'; 567 b.style.cursor = 'se-resize'; 568 569 BX.onCustomEvent(this, 'onWindowResizeStart'); 570 571 return true; 572}; 573 574BX.CWindow.prototype.__moveResize = function(e) 575{ 576 if(!e) e = window.event; 577 578 var windowScroll = BX.GetWindowScrollPos(); 579 580 var x = e.clientX + windowScroll.scrollLeft; 581 var y = e.clientY + windowScroll.scrollTop; 582 583 if(this.x == x && this.y == y) 584 return; 585 586 this.Resize(x, y); 587 588 this.x = x; 589 this.y = y; 590}; 591 592BX.CWindow.prototype.__stopResize = function() 593{ 594 if(document.body.releaseCapture) 595 document.body.releaseCapture(); 596 597 BX.unbind(document, "mousemove", BX.proxy(this.__moveResize, this)); 598 BX.unbind(document, "mouseup", BX.proxy(this.__stopResize, this)); 599 600 document.onmousedown = null; 601 602 var b = document.body; 603 b.ondrag = b.onselectstart = null; 604 b.style.MozUserSelect = this.DIV.style.MozUserSelect = ''; 605 b.style.cursor = ''; 606 607 BX.onCustomEvent(this, 'onWindowResizeFinished') 608}; 609 610BX.CWindow.prototype.SetClose = function(elem) 611{ 612 BX.bind(elem, 'click', BX.proxy(this.Close, this)); 613 this.ELEMENTS.close.push(elem); 614}; 615 616BX.CWindow.prototype.SetDraggable = function(elem) 617{ 618 BX.bind(elem, 'mousedown', BX.proxy(this.__startDrag, this)); 619 620 elem.style.cursor = 'move'; 621 622 this.ELEMENTS.draggable.push(elem); 623 this.SETTINGS.draggable = true; 624}; 625 626BX.CWindow.prototype.Move = function(x, y) 627{ 628 var dxShadow = 1; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 629 630 var left = parseInt(this.DIV.style.left)+x; 631 var top = parseInt(this.DIV.style.top)+y; 632 633 if (this.SETTINGS.drag_restrict) 634 { 635 //Left side 636 if (left < 0) 637 left = 0; 638 639 //Right side 640 var scrollSize = BX.GetWindowScrollSize(); 641 var floatWidth = this.DIV.offsetWidth; 642 var floatHeight = this.DIV.offsetHeight; 643 644 if (left > (scrollSize.scrollWidth - floatWidth - dxShadow)) 645 left = scrollSize.scrollWidth - floatWidth - dxShadow; 646 647 var scrollHeight = Math.max( 648 document.body.scrollHeight, document.documentElement.scrollHeight, 649 document.body.offsetHeight, document.documentElement.offsetHeight, 650 document.body.clientHeight, document.documentElement.clientHeight, 651 scrollSize.scrollHeight 652 ); 653 654 if (top > (scrollHeight - floatHeight - dxShadow)) 655 top = scrollHeight - floatHeight - dxShadow; 656 657 //Top side 658 if (top < 0) 659 top = 0; 660 } 661 662 this.DIV.style.left = left+'px'; 663 this.DIV.style.top = top+'px'; 664 665 //this.AdjustShadow(div); 666}; 667 668BX.CWindow.prototype.__startDrag = function(e) 669{ 670 if (!this.SETTINGS.draggable) 671 return false; 672 673 if(!e) e = window.event; 674 675 this.x = e.clientX + document.body.scrollLeft; 676 this.y = e.clientY + document.body.scrollTop; 677 678 this.__bWasDragged = false;
679 BX.bind(document, "mousemove", BX.proxy(this.__moveDrag, this)); 680 BX.bind(document, "mouseup", BX.proxy(this.__stopDrag, this)); 681 682 if(document.body.setCapture) 683 document.body.setCapture(); 684 685 document.onmousedown = BX.False; 686 687 var b = document.body; 688 b.ondrag = b.onselectstart = BX.False; 689 b.style.MozUserSelect = this.DIV.style.MozUserSelect = 'none'; 690 b.style.cursor = 'move'; 691 return BX.PreventDefault(e); 692}; 693 694BX.CWindow.prototype.__moveDrag = function(e) 695{ 696 if(!e) e = window.event; 697 698 var x = e.clientX + document.body.scrollLeft; 699 var y = e.clientY + document.body.scrollTop; 700 701 if(this.x == x && this.y == y) 702 return; 703 704 this.Move((x - this.x), (y - this.y)); 705 this.x = x; 706 this.y = y; 707 708 if (!this.__bWasDragged) 709 { 710 BX.onCustomEvent(this, 'onWindowDragStart'); 711 this.__bWasDragged = true; 712 BX.bind(BX.proxy_context, "click", BX.PreventDefault); 713 } 714 715 BX.onCustomEvent(this, 'onWindowDrag'); 716}; 717 718BX.CWindow.prototype.__stopDrag = function(e) 719{ 720 if(document.body.releaseCapture) 721 document.body.releaseCapture(); 722 723 BX.unbind(document, "mousemove", BX.proxy(this.__moveDrag, this)); 724 BX.unbind(document, "mouseup", BX.proxy(this.__stopDrag, this)); 725 726 document.onmousedown = null; 727 728 var b = document.body; 729 b.ondrag = b.onselectstart = null; 730 b.style.MozUserSelect = this.DIV.style.MozUserSelect = ''; 731 b.style.cursor = ''; 732 733 if (this.__bWasDragged) 734 { 735 BX.onCustomEvent(this, 'onWindowDragFinished'); 736 var _proxy_context = BX.proxy_context; 737 setTimeout(function(){BX.unbind(_proxy_context, "click", BX.PreventDefault)}, 100); 738 this.__bWasDragged = false; 739 } 740 return BX.PreventDefault(e); 741}; 742 743BX.CWindow.prototype.DenyClose = function() 744{ 745 this.denyClose = true; 746}; 747 748BX.CWindow.prototype.AllowClose = function() 749{ 750 this.denyClose = false; 751}; 752 753BX.CWindow.prototype.ShowError = function(str) 754{ 755 BX.onCustomEvent(this, 'onWindowError', [str]); 756 757 if (this._wait) 758 BX.closeWait(this._wait); 759 760 window.alert(str); 761}; 762 763BX.CWindow.prototype.__set_msover = function() {this.MOUSEOVER = true;}; 764BX.CWindow.prototype.__unset_msover = function() {this.MOUSEOVER = false;}; 765 766/* dialog window class extends window class */ 767BX.CWindowDialog = function() { 768 var a = arguments; 769 a[1] = 'dialog'; 770 BX.CWindowDialog.superclass.constructor.apply(this, a); 771 772 this.DIV.style.top = '10px'; 773 this.OVERLAY = null; 774}; 775BX.extend(BX.CWindowDialog, BX.CWindow); 776 777BX.CWindowDialog.prototype.__resizeOverlay = function() 778{ 779 var windowSize = BX.GetWindowScrollSize(); 780 this.OVERLAY.style.width = windowSize.scrollWidth + "px"; 781}; 782 783BX.CWindowDialog.prototype.CreateOverlay = function(zIndex) 784{ 785 if (null == this.OVERLAY) 786 { 787 var windowSize = BX.GetWindowScrollSize(); 788 789 // scrollHeight in BX.GetWindowScrollSize may be incorrect 790 var scrollHeight = Math.max( 791 document.body.scrollHeight, document.documentElement.scrollHeight, 792 document.body.offsetHeight, document.documentElement.offsetHeight, 793 document.body.clientHeight, document.documentElement.clientHeight, 794 windowSize.scrollHeight 795 ); 796 797 this.OVERLAY = document.body.appendChild(BX.create("DIV", { 798 style: { 799 position: 'absolute', 800 top: '0px', 801 left: '0px', 802 zIndex: zIndex || (parseInt(this.DIV.style.zIndex)-2), 803 width: windowSize.scrollWidth + "px", 804 height: scrollHeight + "px" 805 } 806 })); 807 808 var component = BX.ZIndexManager.getComponent(this.DIV); 809 if (component) 810 { 811 component.setOverlay(this.OVERLAY); 812 } 813 } 814 815 return this.OVERLAY; 816}; 817 818BX.CWindowDialog.prototype.Show = function() 819{ 820 BX.CWindowDialog.superclass.Show.apply(this, arguments); 821 822 this.CreateOverlay(); 823 824 this.OVERLAY.style.display = 'block'; 825 826 BX.unbind(window, 'resize', BX.proxy(this.__resizeOverlay, this)); 827 BX.bind(window, 'resize', BX.proxy(this.__resizeOverlay, this)); 828}; 829 830BX.CWindowDialog.prototype.onUnRegister = function(clean) 831{ 832 BX.CWindowDialog.superclass.onUnRegister.apply(this, arguments); 833 834 if (this.clean) 835 { 836 if (this.OVERLAY.parentNode) 837 this.OVERLAY.parentNode.removeChild(this.OVERLAY); 838 } 839 else 840 { 841 this.OVERLAY.style.display = 'none'; 842 } 843 844 BX.unbind(window, 'resize', BX.proxy(this.__resizeOverlay, this)); 845}; 846 847/* standard bitrix dialog extends BX.CWindowDialog */ 848/*
849 arParams = { 850 ( 851 title: 'dialog title', 852 head: 'head block html', 853 content: 'dialog content', 854 icon: 'head icon classname or filename', 855 856 resize_id: 'some id to save resize information'// useless if resizable = false 857 ) 858 or 859 ( 860 content_url: url to content load 861 loaded content scripts can use BX.WindowManager.Get() to get access to the current window object 862 ) 863 864 height: window_height_in_pixels, 865 width: window_width_in_pixels, 866 867 draggable: true|false, 868 resizable: true|false, 869 870 min_height: min_window_height_in_pixels, // useless if resizable = false 871 min_width: min_window_width_in_pixels, // useless if resizable = false 872 873 buttons: [ 874 'html_code', 875 BX.CDialog.btnSave, BX.CDialog.btnCancel, BX.CDialog.btnClose 876 ] 877 } 878*/ 879BX.CDialog = function(arParams) 880{ 881 BX.CDialog.superclass.constructor.apply(this); 882 883 this._sender = 'core_window_cdialog'; 884 885 this.PARAMS = arParams || {}; 886 887 for (var i in this.defaultParams) 888 { 889 if (typeof this.PARAMS[i] == 'undefined') 890 this.PARAMS[i] = this.defaultParams[i]; 891 } 892 893 this.PARAMS.width = (!isNaN(parseInt(this.PARAMS.width))) 894 ? this.PARAMS.width 895 : this.defaultParams['width']; 896 this.PARAMS.height = (!isNaN(parseInt(this.PARAMS.height))) 897 ? this.PARAMS.height 898 : this.defaultParams['height']; 899 900 if (this.PARAMS.resize_id || this.PARAMS.content_url) 901 { 902 var arSize = BX.WindowManager.getRuntimeWindowSize(this.PARAMS.resize_id || this.PARAMS.content_url); 903 if (arSize) 904 { 905 this.PARAMS.width = arSize.width; 906 this.PARAMS.height = arSize.height; 907 } 908 } 909 910 BX.addClass(this.DIV, 'bx-core-adm-dialog'); 911 this.DIV.id = 'bx-admin-prefix'; 912 913 this.PARTS = {}; 914 915 this.DIV.style.height = null; 916 this.DIV.style.width = null; 917 918 this.PARTS.TITLEBAR = this.DIV.appendChild(BX.create('DIV', {props: { 919 className: 'bx-core-adm-dialog-head' 920 } 921 })); 922 923 this.PARTS.TITLE_CONTAINER = this.PARTS.TITLEBAR.appendChild(BX.create('SPAN', { 924 props: {className: 'bx-core-adm-dialog-head-inner'}, 925 text: this.PARAMS.title 926 })); 927 928 this.PARTS.TITLEBAR_ICONS = this.PARTS.TITLEBAR.appendChild(BX.create('DIV', { 929 props: { 930 className: 'bx-core-adm-dialog-head-icons' 931 }, 932 children: (this.PARAMS.resizable ? [ 933 BX.create('SPAN', {props: {className: 'bx-core-adm-icon-expand', title: BX.message('JS_CORE_WINDOW_EXPAND')}}), 934 BX.create('SPAN', {props: {className: 'bx-core-adm-icon-close', title: BX.message('JS_CORE_WINDOW_CLOSE')}}) 935 ] : [ 936 BX.create('SPAN', {props: {className: 'bx-core-adm-icon-close', title: BX.message('JS_CORE_WINDOW_CLOSE')}}) 937 ]) 938 })); 939 940 941 this.PARTS.CONTENT = this.DIV.appendChild(BX.create('DIV', { 942 props: {className: 'bx-core-adm-dialog-content-wrap adm-workarea'} 943 })); 944 945 this.PARTS.CONTENT_DATA = this.PARTS.CONTENT.appendChild(BX.create('DIV', { 946 props: {className: 'bx-core-adm-dialog-content'}, 947 style: { 948 height: this.PARAMS.height + 'px', 949 width: this.PARAMS.width + 'px' 950 } 951 })); 952 953 this.PARTS.HEAD = this.PARTS.CONTENT_DATA.appendChild(BX.create('DIV', { 954 props: { 955 className: 'bx-core-adm-dialog-head-block' + (this.PARAMS.icon ? ' ' + this.PARAMS.icon : '') 956 } 957 })); 958 959 this.SetHead(this.PARAMS.head); 960 this.SetContent(this.PARAMS.content); 961 this.SetTitle(this.PARAMS.title); 962 this.SetClose(this.PARTS.TITLEBAR_ICONS.lastChild); 963 964 if (this.PARAMS.resizable) 965 { 966 this.SetExpand(this.PARTS.TITLEBAR_ICONS.firstChild); 967 this.SetExpand(this.PARTS.TITLEBAR, 'dblclick'); 968 969 BX.addCustomEvent(this, 'onWindowExpand', BX.proxy(this.__onexpand, this)); 970 BX.addCustomEvent(this, 'onWindowNarrow', BX.proxy(this.__onexpand, this)); 971 } 972 973 this.PARTS.FOOT = this.PARTS.BUTTONS_CONTAINER = this.PARTS.CONTENT.appendChild(BX.create('DIV', { 974 props: { 975 className: 'bx-core-adm-dialog-buttons' 976 }, 977 //events: { 978 // 'click': BX.delegateEvent({property:{type: /button|submit/}}, BX.delegate(function() {this.showWait(BX.proxy_context)}, this)) 979 //}, 980 children: this.ShowButtons() 981 } 982 )); 983 984 if (this.PARAMS.draggable) 985 this.SetDraggable(this.PARTS.TITLEBAR); 986 987 if (this.PARAMS.resizable) 988 { 989 this.PARTS.RESIZER = this.DIV.appendChild(BX.create('DIV', { 990 props: {className: 'bx-core-resizer'} 991 })); 992 993 this.SetResize(this.PARTS.RESIZER); 994 995 this.SETTINGS.min_width = this.PARAMS.min_width; 996 this.SETTINGS.min_height = this.PARAMS.min_height; 997 } 998 999 this.auth_callback = BX.delegate(function(){ 1000 this.PARAMS.content = ''; 1001 this.hideNotify(); 1002 this.Show(); 1003 }, this) 1004}; 1005BX.extend(BX.CDialog, BX.CWindowDialog); 1006 1007BX.CDialog.prototype.defaultParams = { 1008 width: 700, 1009 height: 400, 1010 min_width: 500, 1011 min_height: 300, 1012 1013 resizable: true, 1014 draggable: true, 1015 1016 title: '', 1017 icon: '' 1018}; 1019 1020BX.CDialog.prototype.showWait = function(el) 1021{ 1022 if (BX.type.isElementNode(el) && (el.type == 'button' || el.type == 'submit')) 1023 { 1024 BX.defer(function(){el.disabled = true})(); 1025 1026 var bSave = (BX.hasClass(el, 'adm-btn-save') || BX.hasClass(el, 'adm-btn-save')), 1027 pos = BX.pos(el, true); 1028 1029 el.bxwaiter = this.PARTS.FOOT.appendChild(BX.create('DIV', { 1030 props: {className: 'adm-btn-load-img' + (bSave ? '-green' : '')}, 1031 style: { 1032 top: parseInt((pos.bottom + pos.top)/2 - 10) + 'px', 1033 left: parseInt((pos.right + pos.left)/2 - 10) + 'px' 1034 } 1035 })); 1036 1037 BX.addClass(el, 'adm-btn-load'); 1038 1039 this.lastWaitElement = el; 1040 1041 return el.bxwaiter; 1042 } 1043 return null; 1044}; 1045 1046BX.CDialog.prototype.closeWait = function(el) 1047{ 1048 el = el || this.lastWaitElement; 1049 1050 if (BX.type.isElementNode(el)) 1051 { 1052 if (el.bxwaiter) 1053 { 1054 if(el.bxwaiter.parentNode) 1055 { 1056 el.bxwaiter.parentNode.removeChild(el.bxwaiter); 1057 } 1058 1059 el.bxwaiter = null; 1060 } 1061 1062 el.disabled = false;
1063 BX.removeClass(el, 'adm-btn-load'); 1064 1065 if (this.lastWaitElement == el) 1066 this.lastWaitElement = null; 1067 } 1068}; 1069 1070BX.CDialog.prototype.Authorize = function(arAuthResult) 1071{ 1072 this.bSkipReplaceContent = true; 1073 this.ShowError(BX.message('JSADM_AUTH_REQ')); 1074 1075 BX.onCustomEvent(this, 'onWindowError', []); 1076 1077 BX.closeWait(); 1078 1079 (new BX.CAuthDialog({ 1080 content_url: this.PARAMS.content_url, 1081 auth_result: arAuthResult, 1082 callback: BX.delegate(function(){ 1083 if (this.auth_callback) 1084 this.auth_callback() 1085 }, this) 1086 })).Show(); 1087}; 1088 1089BX.CDialog.prototype.ShowError = function(str) 1090{ 1091 BX.onCustomEvent(this, 'onWindowError', [str]); 1092 1093 this.closeWait(); 1094 1095 if (this._wait) 1096 BX.closeWait(this._wait); 1097 1098 this.Notify(str, true); 1099}; 1100 1101 1102BX.CDialog.prototype.__expandGetSize = function() 1103{ 1104 var pDocElement = BX.GetDocElement(); 1105 pDocElement.style.overflow = 'hidden'; 1106 1107 var wndSize = BX.GetWindowInnerSize(); 1108 1109 pDocElement.scrollTop = 0; 1110 1111 this.DIV.style.top = '-' + this.dxShadow + 'px'; 1112 this.DIV.style.left = '-' + this.dxShadow + 'px'; 1113 1114 return { 1115 width: (wndSize.innerWidth - parseInt(BX.style(this.PARTS.CONTENT, 'padding-right')) - parseInt(BX.style(this.PARTS.CONTENT, 'padding-left'))) + this.dxShadow, 1116 height: (wndSize.innerHeight - this.PARTS.TITLEBAR.offsetHeight - this.PARTS.FOOT.offsetHeight - parseInt(BX.style(this.PARTS.CONTENT, 'padding-top')) - parseInt(BX.style(this.PARTS.CONTENT, 'padding-bottom'))) + this.dxShadow 1117 }; 1118}; 1119 1120BX.CDialog.prototype.__expand = function() 1121{ 1122 var pDocElement = BX.GetDocElement(); 1123 this.dxShadow = 2; 1124 1125 if (!this.bExpanded) 1126 { 1127 var wndScroll = BX.GetWindowScrollPos(); 1128 1129 this.__expand_settings = { 1130 resizable: this.SETTINGS.resizable, 1131 draggable: this.SETTINGS.draggable, 1132 width: this.PARTS.CONTENT_DATA.style.width, 1133 height: this.PARTS.CONTENT_DATA.style.height, 1134 left: this.DIV.style.left, 1135 top: this.DIV.style.top, 1136 scrollTop: wndScroll.scrollTop, 1137 scrollLeft: wndScroll.scrollLeft, 1138 overflow: BX.style(pDocElement, 'overflow') 1139 }; 1140 1141 this.SETTINGS.resizable = false; 1142 this.SETTINGS.draggable = false; 1143 1144 var pos = this.__expandGetSize(); 1145 1146 this.PARTS.CONTENT_DATA.style.width = pos.width + 'px'; 1147 this.PARTS.CONTENT_DATA.style.height = pos.height + 'px'; 1148 1149 window.scrollTo(0,0); 1150 pDocElement.style.overflow = 'hidden'; 1151 1152 this.bExpanded = true; 1153 1154 BX.onCustomEvent(this, 'onWindowExpand'); 1155 BX.onCustomEvent(this, 'onWindowResize'); 1156 BX.onCustomEvent(this, 'onWindowResizeExt', [{'width': pos.width, 'height': pos.height}]); 1157 1158 BX.bind(window, 'resize', BX.proxy(this.__expand_onresize, this)); 1159 } 1160 else 1161 { 1162 BX.unbind(window, 'resize', BX.proxy(this.__expand_onresize, this)); 1163 1164 this.SETTINGS.resizable = this.__expand_settings.resizable; 1165 this.SETTINGS.draggable = this.__expand_settings.draggable; 1166 1167 pDocElement.style.overflow = this.__expand_settings.overflow; 1168 1169 this.DIV.style.top = this.__expand_settings.top; 1170 this.DIV.style.left = this.__expand_settings.left; 1171 this.PARTS.CONTENT_DATA.style.width = this.__expand_settings.width; 1172 this.PARTS.CONTENT_DATA.style.height = this.__expand_settings.height; 1173 window.scrollTo(this.__expand_settings.scrollLeft, this.__expand_settings.scrollTop); 1174 this.bExpanded = false; 1175 1176 BX.onCustomEvent(this, 'onWindowNarrow'); 1177 BX.onCustomEvent(this, 'onWindowResize'); 1178 BX.onCustomEvent(this, 'onWindowResizeExt', [{'width': parseInt(this.__expand_settings.width), 'height': parseInt(this.__expand_settings.height)}]); 1179 } 1180}; 1181 1182BX.CDialog.prototype.__expand_onresize = function() 1183{ 1184 var pos = this.__expandGetSize(); 1185 1186 this.PARTS.CONTENT_DATA.style.width = pos.width + 'px'; 1187 this.PARTS.CONTENT_DATA.style.height = pos.height + 'px'; 1188 1189 BX.onCustomEvent(this, 'onWindowResize'); 1190 BX.onCustomEvent(this, 'onWindowResizeExt', [pos]); 1191}; 1192 1193BX.CDialog.prototype.__onexpand = function() 1194{ 1195 var ob = this.PARTS.TITLEBAR_ICONS.firstChild; 1196 ob.className = BX.toggle(ob.className, ['bx-core-adm-icon-expand', 'bx-core-adm-icon-narrow']); 1197 ob.title = BX.toggle(ob.title, [BX.message('JS_CORE_WINDOW_EXPAND'), BX.message('JS_CORE_WINDOW_NARROW')]); 1198 1199 if (this.PARTS.RESIZER) 1200 { 1201 this.PARTS.RESIZER.style.display = this.bExpanded ? 'none' : 'block'; 1202 } 1203}; 1204 1205 1206BX.CDialog.prototype.__startResize = function(e) 1207{ 1208 if (!this.SETTINGS.resizable) 1209 return false;
1210 1211 if(!e) e = window.event; 1212 1213 this.wndSize = BX.GetWindowScrollPos(); 1214 this.wndSize.innerWidth = BX.GetWindowInnerSize().innerWidth; 1215 1216 this.pos = BX.pos(this.PARTS.CONTENT_DATA); 1217 1218 this.x = e.clientX + this.wndSize.scrollLeft; 1219 this.y = e.clientY + this.wndSize.scrollTop; 1220 1221 this.dx = this.pos.left + this.pos.width - this.x; 1222 this.dy = this.pos.top + this.pos.height - this.y; 1223 1224 1225 // TODO: suspicious 1226 this.dw = this.pos.width - parseInt(this.PARTS.CONTENT_DATA.style.width) + parseInt(BX.style(this.PARTS.CONTENT, 'padding-right')); 1227 1228 BX.bind(document, "mousemove", BX.proxy(this.__moveResize, this)); 1229 BX.bind(document, "mouseup", BX.proxy(this.__stopResize, this)); 1230 1231 if(document.body.setCapture) 1232 document.body.setCapture(); 1233 1234 document.onmousedown = BX.False; 1235 1236 var b = document.body; 1237 b.ondrag = b.onselectstart = BX.False; 1238 b.style.MozUserSelect = this.DIV.style.MozUserSelect = 'none'; 1239 b.style.cursor = 'se-resize'; 1240 1241 BX.onCustomEvent(this, 'onWindowResizeStart'); 1242 1243 return true; 1244}; 1245 1246BX.CDialog.prototype.Resize = function(x, y) 1247{ 1248 var new_width = Math.max(x - this.pos.left + this.dx, this.SETTINGS.min_width); 1249 var new_height = Math.max(y - this.pos.top + this.dy, this.SETTINGS.min_height); 1250 1251 if (this.SETTINGS.resize_restrict) 1252 { 1253 var scrollSize = BX.GetWindowScrollSize(); 1254 1255 if (this.pos.left + new_width > scrollSize.scrollWidth - this.dw) 1256 new_width = scrollSize.scrollWidth - this.pos.left - this.dw; 1257 } 1258 1259 this.PARTS.CONTENT_DATA.style.width = new_width + 'px'; 1260 this.PARTS.CONTENT_DATA.style.height = new_height + 'px'; 1261 1262 BX.onCustomEvent(this, 'onWindowResize'); 1263 BX.onCustomEvent(this, 'onWindowResizeExt', [{'height': new_height, 'width': new_width}]); 1264}; 1265 1266BX.CDialog.prototype.SetSize = function(obSize) 1267{ 1268 this.PARTS.CONTENT_DATA.style.width = obSize.width + 'px'; 1269 this.PARTS.CONTENT_DATA.style.height = obSize.height + 'px'; 1270 1271 BX.onCustomEvent(this, 'onWindowResize'); 1272 BX.onCustomEvent(this, 'onWindowResizeExt', [obSize]); 1273}; 1274 1275BX.CDialog.prototype.GetParameters = function(form_name) 1276{ 1277 var form = this.GetForm(); 1278 1279 if(!form) 1280 return ""; 1281 1282 var i, s = ""; 1283 var n = form.elements.length; 1284 1285 var delim = ''; 1286 for(i=0; i<n; i++) 1287 { 1288 if (s != '') delim = '&'; 1289 var el = form.elements[i]; 1290 if (el.disabled) 1291 continue; 1292 1293 switch(el.type.toLowerCase()) 1294 { 1295 case 'text': 1296 case 'textarea': 1297 case 'password': 1298 case 'hidden': 1299 if (null == form_name && el.name.substr(el.name.length-4) == '_alt' && form.elements[el.name.substr(0, el.name.length-4)]) 1300 break; 1301 s += delim + el.name + '=' + BX.util.urlencode(el.value); 1302 break; 1303 case 'radio': 1304 if(el.checked) 1305 s += delim + el.name + '=' + BX.util.urlencode(el.value); 1306 break; 1307 case 'checkbox': 1308 s += delim + el.name + '=' + BX.util.urlencode(el.checked ? 'Y':'N'); 1309 break; 1310 case 'select-one': 1311 var val = ""; 1312 if (null == form_name && form.elements[el.name + '_alt'] && el.selectedIndex == 0) 1313 val = form.elements[el.name+'_alt'].value; 1314 else 1315 val = el.value; 1316 s += delim + el.name + '=' + BX.util.urlencode(val); 1317 break; 1318 case 'select-multiple': 1319 var j, bAdded = false; 1320 var l = el.options.length; 1321 for (j=0; j<l; j++) 1322 { 1323 if (el.options[j].selected) 1324 { 1325 s += delim + el.name + '=' + BX.util.urlencode(el.options[j].value); 1326 bAdded = true; 1327 } 1328 } 1329 if (!bAdded) 1330 s += delim + el.name + '='; 1331 break; 1332 default: 1333 break; 1334 } 1335 } 1336 1337 return s; 1338}; 1339 1340BX.CDialog.prototype.PostParameters = function(params) 1341{ 1342 var url = this.PARAMS.content_url; 1343 1344 if (null == params) 1345 params = ""; 1346 1347 params += (params == "" ? "" : "&") + "bxsender=" + this._sender; 1348 1349 var index = url.indexOf('?'); 1350 if (index == -1) 1351 url += '?' + params; 1352 else 1353 url = url.substring(0, index) + '?' + params + "&" + url.substring(index+1); 1354 1355 BX.showWait(); 1356 1357 this.auth_callback = BX.delegate(function(){ 1358 this.hideNotify(); 1359 this.PostParameters(params); 1360 }, this); 1361 1362 BX.ajax.Setup({skipAuthCheck:true},true); 1363 BX.ajax.post(url, this.GetParameters(), BX.delegate(function(result) { 1364 BX.closeWait(); 1365 if (!this.bSkipReplaceContent) 1366 { 1367 this.ClearButtons(); // buttons are appended during form reload, so we should clear footer 1368 this.SetContent(result); 1369 this.Show(true); 1370 } 1371 1372 this.bSkipReplaceContent = false;
1373 }, this)); 1374}; 1375 1376BX.CDialog.prototype.Submit = function(params, url) 1377{ 1378 var FORM = this.GetForm(); 1379 if (FORM) 1380 { 1381 FORM.onsubmit = null; 1382 1383 FORM.method = 'POST'; 1384 if (!FORM.action || url) 1385 { 1386 url = url || this.PARAMS.content_url; 1387 if (null != params) 1388 { 1389 var index = url.indexOf('?'); 1390 if (index == -1) 1391 url += '?' + params; 1392 else 1393 url = url.substring(0, index) + '?' + params + "&" + url.substring(index+1); 1394 } 1395 1396 FORM.action = url; 1397 } 1398 1399 if (!FORM._bxsender) 1400 { 1401 FORM._bxsender = FORM.appendChild(BX.create('INPUT', { 1402 attrs: { 1403 type: 'hidden', 1404 name: 'bxsender', 1405 value: this._sender 1406 } 1407 })); 1408 } 1409 1410 this._wait = BX.showWait(); 1411 1412 this.auth_callback = BX.delegate(function(){ 1413 this.hideNotify(); 1414 this.Submit(params); 1415 }, this); 1416 1417 BX.ajax.submit(FORM, BX.delegate(function(){this.closeWait()}, this)); 1418 } 1419 else 1420 { 1421 window.alert('no form registered!'); 1422 } 1423}; 1424 1425BX.CDialog.prototype.GetForm = function() 1426{ 1427 if (null == this.__form) 1428 { 1429 var forms = this.PARTS.CONTENT_DATA.getElementsByTagName('FORM'); 1430 this.__form = forms[0] ? forms[0] : null; 1431 } 1432 1433 return this.__form; 1434}; 1435 1436BX.CDialog.prototype.GetRealForm = function() 1437{ 1438 if (null == this.__rform) 1439 { 1440 var forms = this.PARTS.CONTENT_DATA.getElementsByTagName('FORM'); 1441 this.__rform = forms[1] ? forms[1] : (forms[0] ? forms[0] : null); 1442 } 1443 1444 return this.__rform; 1445}; 1446 1447BX.CDialog.prototype._checkButton = function(btn) 1448{ 1449 var arCustomButtons = ['btnSave', 'btnCancel', 'btnClose']; 1450 1451 for (var i = 0; i < arCustomButtons.length; i++) 1452 { 1453 if (this[arCustomButtons[i]] && (btn == this[arCustomButtons[i]])) 1454 return arCustomButtons[i]; 1455 } 1456 1457 return false; 1458}; 1459 1460BX.CDialog.prototype.ShowButtons = function() 1461{ 1462 var result = []; 1463 if (this.PARAMS.buttons) 1464 { 1465 if (this.PARAMS.buttons.title) this.PARAMS.buttons = [this.PARAMS.buttons]; 1466 1467 for (var i=0, len=this.PARAMS.buttons.length; i<len; i++) 1468 { 1469 if (BX.type.isNotEmptyString(this.PARAMS.buttons[i])) 1470 { 1471 result.push(this.PARAMS.buttons[i]); 1472 } 1473 else if (BX.type.isElementNode(this.PARAMS.buttons[i])) 1474 { 1475 result.push(this.PARAMS.buttons[i]); 1476 } 1477 else if (this.PARAMS.buttons[i]) 1478 { 1479 //if (!(this.PARAMS.buttons[i] instanceof BX.CWindowButton)) 1480 if (!BX.is_subclass_of(this.PARAMS.buttons[i], BX.CWindowButton)) 1481 { 1482 var b = this._checkButton(this.PARAMS.buttons[i]); // hack to set links to real CWindowButton object in btnSave etc; 1483 this.PARAMS.buttons[i] = new BX.CWindowButton(this.PARAMS.buttons[i]); 1484 if (b) this[b] = this.PARAMS.buttons[i]; 1485 } 1486 1487 result.push(this.PARAMS.buttons[i].Button(this)); 1488 } 1489 } 1490 } 1491 1492 return result; 1493}; 1494 1495BX.CDialog.prototype.setAutosave = function () { 1496 if (!this.bSetAutosaveDelay) 1497 { 1498 this.bSetAutosaveDelay = true; 1499 setTimeout(BX.proxy(this.setAutosave, this), 10); 1500 } 1501}; 1502 1503BX.CDialog.prototype.SetTitle = function(title) 1504{ 1505 this.PARAMS.title = title; 1506 BX.cleanNode(this.PARTS.TITLE_CONTAINER).appendChild(document.createTextNode(this.PARAMS.title)); 1507}; 1508 1509BX.CDialog.prototype.SetHead = function(head) 1510{ 1511 this.PARAMS.head = BX.util.trim(head); 1512 this.PARTS.HEAD.innerHTML = this.PARAMS.head || " "; 1513 this.PARTS.HEAD.style.display = this.PARAMS.head ? 'block' : 'none'; 1514 this.adjustSize(); 1515}; 1516 1517BX.CDialog.prototype.Notify = function(note, bError, html) 1518{ 1519 if (!this.PARTS.NOTIFY) 1520 { 1521 this.PARTS.NOTIFY = this.DIV.insertBefore(BX.create('DIV', { 1522 props: {className: 'adm-warning-block'}, 1523 children: [ 1524 BX.create('SPAN', { 1525 props: {className: 'adm-warning-text'} 1526 }), 1527 BX.create('SPAN', { 1528 props: {className: 'adm-warning-icon'} 1529 }), 1530 BX.create('SPAN', { 1531 props: {className: 'adm-warning-close'}, 1532 events: {click: BX.proxy(this.hideNotify, this)} 1533 }) 1534 ] 1535 }), this.DIV.firstChild); 1536 } 1537 1538 if (bError) 1539 BX.addClass(this.PARTS.NOTIFY, 'adm-warning-block-red'); 1540 else 1541 BX.removeClass(this.PARTS.NOTIFY, 'adm-warning-block-red'); 1542 1543 if(html !== true) 1544 { 1545 note = BX.util.htmlspecialchars(note); 1546 } 1547 1548 this.PARTS.NOTIFY.firstChild.innerHTML = note || ' '; 1549 this.PARTS.NOTIFY.firstChild.style.width = (this.PARAMS.width-50) + 'px'; 1550 BX.removeClass(this.PARTS.NOTIFY, 'adm-warning-animate'); 1551}; 1552 1553BX.CDialog.prototype.hideNotify = function() 1554{ 1555 BX.addClass(this.PARTS.NOTIFY, 'adm-warning-animate'); 1556}; 1557 1558BX.CDialog.prototype.__adjustHeadToIcon = function() 1559{ 1560 if (!this.PARTS.HEAD.offsetHeight) 1561 { 1562 setTimeout(BX.delegate(this.__adjustHeadToIcon, this), 50); 1563 } 1564 else 1565 { 1566 if (this.icon_image && this.icon_image.height && this.icon_image.height > this.PARTS.HEAD.offsetHeight - 5) 1567 { 1568 this.PARTS.HEAD.style.height = this.icon_image.height + 5 + 'px'; 1569 this.adjustSize(); 1570 } 1571 1572 this.icon_image.onload = null; 1573 this.icon_image = null; 1574 } 1575}; 1576 1577BX.CDialog.prototype.SetIcon = function(icon_class) 1578{ 1579 if (this.PARAMS.icon != icon_class) 1580 { 1581 if (this.PARAMS.icon) 1582 BX.removeClass(this.PARTS.HEAD, this.PARAMS.icon); 1583 1584 this.PARAMS.icon = icon_class; 1585 1586 if (this.PARAMS.icon) 1587 { 1588 BX.addClass(this.PARTS.HEAD, this.PARAMS.icon); 1589 1590 var icon_file = (BX.style(this.PARTS.HEAD, 'background-image') || BX.style(this.PARTS.HEAD, 'backgroundImage')); 1591 if (BX.type.isNotEmptyString(icon_file) && icon_file != 'none') 1592 { 1593 var match = icon_file.match(new RegExp('url\\s*\\(\\s*(\'|"|)(.+?)(\\1)\\s*\\)')); 1594 if(match) 1595 { 1596 icon_file = match[2]; 1597 if (BX.type.isNotEmptyString(icon_file)) 1598 { 1599 this.icon_image = new Image(); 1600 this.icon_image.onload = BX.delegate(this.__adjustHeadToIcon, this); 1601 this.icon_image.src = icon_file; 1602 } 1603 } 1604 } 1605 } 1606 } 1607 this.adjustSize(); 1608}; 1609 1610BX.CDialog.prototype.SetIconFile = function(icon_file) 1611{ 1612 this.icon_image = new Image(); 1613 this.icon_image.onload = BX.delegate(this.__adjustHeadToIcon, this); 1614 this.icon_image.src = icon_file; 1615 1616 BX.adjust(this.PARTS.HEAD, {style: {backgroundImage: 'url(' + icon_file + ')', backgroundPosition: 'right 9px'/*'99% center'*/}}); 1617 this.adjustSize(); 1618}; 1619 1620/* 1621BUTTON: { 1622 title: 'title',
1623 'action': function executed in window object context 1624} 1625BX.CDialog.btnSave || BX.CDialog.btnCancel - standard buttons 1626*/ 1627 1628BX.CDialog.prototype.SetButtons = function(a) 1629{ 1630 if (BX.type.isString(a)) 1631 { 1632 if (a.length > 0) 1633 { 1634 this.PARTS.BUTTONS_CONTAINER.innerHTML += a; 1635 1636 var btns = this.PARTS.BUTTONS_CONTAINER.getElementsByTagName('INPUT'); 1637 if (btns.length > 0) 1638 { 1639 this.PARAMS.buttons = []; 1640 for (var i = 0; i < btns.length; i++) 1641 { 1642 this.PARAMS.buttons.push(new BX.CWindowButton({btn: btns[i], parentWindow: this})); 1643 } 1644 } 1645 } 1646 } 1647 else 1648 { 1649 this.PARAMS.buttons = a; 1650 BX.adjust(this.PARTS.BUTTONS_CONTAINER, { 1651 children: this.ShowButtons() 1652 }); 1653 } 1654 this.adjustSize(); 1655}; 1656 1657BX.CDialog.prototype.ClearButtons = function() 1658{ 1659 BX.cleanNode(this.PARTS.BUTTONS_CONTAINER); 1660 this.adjustSize(); 1661}; 1662 1663BX.CDialog.prototype.SetContent = function(html) 1664{ 1665 this.__form = null; 1666 1667 if (BX.type.isElementNode(html)) 1668 { 1669 if (html.parentNode) 1670 html.parentNode.removeChild(html); 1671 } 1672 else if (BX.type.isString(html)) 1673 { 1674 html = BX.create('DIV', {html: html}); 1675 } 1676 1677 this.PARAMS.content = html; 1678 BX.cleanNode(this.PARTS.CONTENT_DATA); 1679 1680 BX.adjust(this.PARTS.CONTENT_DATA, { 1681 children: [ 1682 this.PARTS.HEAD, 1683 BX.create('DIV', { 1684 props: { 1685 className: 'bx-core-adm-dialog-content-wrap-inner' 1686 }, 1687 children: [this.PARAMS.content] 1688 }) 1689 ] 1690 }); 1691 1692 if (this.PARAMS.content_url && this.GetForm()) 1693 { 1694 this.__form.submitbtn = this.__form.appendChild(BX.create('INPUT', {props:{type:'submit'},style:{display:'none'}})); 1695 this.__form.onsubmit = BX.delegate(this.__submit, this); 1696 } 1697}; 1698 1699BX.CDialog.prototype.__submit = function(e) 1700{ 1701 for (var i=0,len=this.PARAMS.buttons.length; i<len; i++) 1702 { 1703 if ( 1704 this.PARAMS.buttons[i] 1705 && ( 1706 this.PARAMS.buttons[i].name && /save|apply/i.test(this.PARAMS.buttons[i].name) 1707 || 1708 this.PARAMS.buttons[i].btn && this.PARAMS.buttons[i].btn.name && /save|apply/i.test(this.PARAMS.buttons[i].btn.name) 1709 ) 1710 ) 1711 { 1712 this.PARAMS.buttons[i].emulate(); 1713 break; 1714 } 1715 } 1716 1717 return BX.PreventDefault(e); 1718}; 1719 1720BX.CDialog.prototype.SwapContent = function(cont) 1721{ 1722 cont = BX(cont); 1723 1724 BX.cleanNode(this.PARTS.CONTENT_DATA); 1725 cont.parentNode.removeChild(cont); 1726 this.PARTS.CONTENT_DATA.appendChild(cont); 1727 cont.style.display = 'block'; 1728 this.SetContent(cont.innerHTML); 1729}; 1730 1731// this method deprecated 1732BX.CDialog.prototype.adjustSize = function() 1733{ 1734}; 1735 1736// this method deprecated 1737BX.CDialog.prototype.__adjustSize = function() 1738{ 1739}; 1740 1741BX.CDialog.prototype.adjustSizeEx = function() 1742{ 1743 BX.defer(this.__adjustSizeEx, this)(); 1744}; 1745 1746BX.CDialog.prototype.__adjustSizeEx = function() 1747{ 1748 var ob = this.PARTS.CONTENT_DATA.firstChild, 1749 new_height = 0, 1750 marginTop, 1751 marginBottom; 1752 1753 while (ob) 1754 { 1755 if (BX.type.isElementNode(ob)) 1756 { 1757 marginTop = parseInt(BX.style(ob, 'margin-top'), 10); 1758 if (isNaN(marginTop)) 1759 marginTop = 0; 1760 marginBottom = parseInt(BX.style(ob, 'margin-bottom'), 10); 1761 if (isNaN(marginBottom)) 1762 marginBottom = 0; 1763 new_height += ob.offsetHeight + marginTop + marginBottom; 1764 } 1765 ob = BX.nextSibling(ob); 1766 } 1767 1768 if (new_height) 1769 this.PARTS.CONTENT_DATA.style.height = new_height + 'px'; 1770}; 1771 1772 1773BX.CDialog.prototype.__onResizeFinished = function() 1774{ 1775 BX.WindowManager.saveWindowSize( 1776 this.PARAMS.resize_id || this.PARAMS.content_url, {height: parseInt(this.PARTS.CONTENT_DATA.style.height), width: parseInt(this.PARTS.CONTENT_DATA.style.width)} 1777 ); 1778}; 1779 1780BX.CDialog.prototype.Show = function(bNotRegister) 1781{ 1782 if ((!this.PARAMS.content) && this.PARAMS.content_url && BX.ajax && !bNotRegister) 1783 { 1784 var wait = BX.showWait(); 1785 1786 BX.WindowManager.currently_loaded = this; 1787 1788 this.CreateOverlay(); 1789 this.OVERLAY.style.display = 'block'; 1790 this.OVERLAY.className = 'bx-core-dialog-overlay'; 1791 1792 var post_data = '', method = 'GET'; 1793 if (this.PARAMS.content_post) 1794 { 1795 post_data = this.PARAMS.content_post; 1796 method = 'POST'; 1797 } 1798 1799 var url = this.PARAMS.content_url 1800 + (this.PARAMS.content_url.indexOf('?')<0?'?':'&')+'bxsender=' + this._sender; 1801 1802 this.auth_callback = BX.delegate(function(){ 1803 this.PARAMS.content = ''; 1804 this.hideNotify(); 1805 this.Show(); 1806 }, this); 1807 1808 BX.ajax({ 1809 method: method, 1810 dataType: 'html', 1811 url: url, 1812 data: post_data, 1813 skipAuthCheck: true, 1814 onsuccess: BX.delegate(function(data) { 1815 BX.closeWait(null, wait); 1816 1817 this.SetContent(data || ' '); 1818 this.Show(); 1819 }, this) 1820 }); 1821 } 1822 else 1823 { 1824 BX.WindowManager.currently_loaded = null; 1825 BX.CDialog.superclass.Show.apply(this, arguments); 1826 1827 this.adjustPos(); 1828 1829 this.OVERLAY.className = 'bx-core-dialog-overlay'; 1830 1831 this.__adjustSize(); 1832 1833 BX.removeCustomEvent(this, 'onWindowResize', BX.proxy(this.__adjustSize, this)); 1834 BX.addCustomEvent(this, 'onWindowResize', BX.proxy(this.__adjustSize, this)); 1835 1836 if (this.PARAMS.resizable && (this.PARAMS.content_url || this.PARAMS.resize_id)) 1837 { 1838 BX.removeCustomEvent(this, 'onWindowResizeFinished', BX.proxy(this.__onResizeFinished, this)); 1839 BX.addCustomEvent(this, 'onWindowResizeFinished', BX.proxy(this.__onResizeFinished, this)); 1840 } 1841 } 1842}; 1843 1844BX.CDialog.prototype.GetInnerPos = function() 1845{ 1846 return {'width': parseInt(this.PARTS.CONTENT_DATA.style.width), 'height': parseInt(this.PARTS.CONTENT_DATA.style.height)}; 1847}; 1848 1849BX.CDialog.prototype.adjustPos = function() 1850{ 1851 if (!this.bExpanded) 1852 { 1853 var currentWindow = window; 1854 var topWindow = BX.PageObject.getRootWindow(); 1855 if (topWindow.BX.SidePanel && topWindow.BX.SidePanel.Instance && topWindow.BX.SidePanel.Instance.getTopSlider()) 1856 { 1857 currentWindow = topWindow.BX.SidePanel.Instance.getTopSlider().getWindow(); 1858 } 1859 var windowSize = currentWindow.BX.GetWindowInnerSize(); 1860 var windowScroll = currentWindow.BX.GetWindowScrollPos(); 1861 1862 var style = { 1863 left: parseInt(windowScroll.scrollLeft + windowSize.innerWidth / 2 - parseInt(this.DIV.offsetWidth) / 2) + 'px', 1864 top: Math.max(parseInt(windowScroll.scrollTop + windowSize.innerHe
1864ight / 2 - parseInt(this.DIV.offsetHeight) / 2), 0) + 'px' 1865 }; 1866 1867 BX.adjust(this.DIV, { 1868 style: style 1869 }); 1870 } 1871}; 1872 1873BX.CDialog.prototype.GetContent = function () {return this.PARTS.CONTENT_DATA}; 1874 1875BX.CDialog.prototype.btnSave = BX.CDialog.btnSave = { 1876 title: BX.message('JS_CORE_WINDOW_SAVE'), 1877 id: 'savebtn', 1878 name: 'savebtn', 1879 className: BX.browser.IsIE() && BX.browser.IsDoctype() && !BX.browser.IsIE10() ? '' : 'adm-btn-save', 1880 action: function () { 1881 this.disableUntilError(); 1882 this.parentWindow.PostParameters(); 1883 } 1884}; 1885 1886BX.CDialog.prototype.btnCancel = BX.CDialog.btnCancel = { 1887 title: BX.message('JS_CORE_WINDOW_CANCEL'), 1888 id: 'cancel', 1889 name: 'cancel', 1890 action: function () { 1891 this.parentWindow.Close(); 1892 } 1893}; 1894 1895BX.CDialog.prototype.btnClose = BX.CDialog.btnClose = { 1896 title: BX.message('JS_CORE_WINDOW_CLOSE'), 1897 id: 'close', 1898 name: 'close', 1899 action: function () { 1900 this.parentWindow.Close(); 1901 } 1902}; 1903 1904/* special child for admin forms loaded into public page */ 1905BX.CAdminDialog = function(arParams) 1906{ 1907 BX.CAdminDialog.superclass.constructor.apply(this, arguments); 1908 1909 this._sender = 'core_window_cadmindialog'; 1910 1911 BX.addClass(this.DIV, 'bx-core-adm-admin-dialog'); 1912 1913 this.PARTS.CONTENT.insertBefore(this.PARTS.HEAD, this.PARTS.CONTENT.firstChild); 1914 this.PARTS.HEAD.className = 'bx-core-adm-dialog-tabs'; 1915}; 1916BX.extend(BX.CAdminDialog, BX.CDialog); 1917 1918BX.CAdminDialog.prototype.SetHead = function() 1919{ 1920 BX.CAdminDialog.superclass.SetHead.apply(this, arguments); 1921 1922 if (this.PARTS.HEAD.firstChild && BX.type.isElementNode(this.PARTS.HEAD.firstChild)) 1923 { 1924 var ob = this.PARTS.HEAD.firstChild, new_width = 0, marginLeft = 0, marginRight = 0; 1925 1926 while (ob) 1927 { 1928 if (BX.type.isElementNode(ob)) 1929 { 1930 marginLeft = parseInt(BX.style(ob, 'margin-left'), 10); 1931 if (isNaN(marginLeft)) 1932 marginLeft = 0; 1933 marginRight = parseInt(BX.style(ob, 'margin-right'), 10); 1934 if (isNaN(marginRight)) 1935 marginRight = 0; 1936 new_width += ob.offsetWidth + marginLeft + marginRight; 1937 } 1938 ob = BX.nextSibling(ob); 1939 } 1940 1941 this.SETTINGS.min_width = Math.max(new_width, this.SETTINGS.min_width) - 2; 1942 if (this.PARAMS.width < this.SETTINGS.min_width) 1943 { 1944 BX.adjust(this.PARTS.CONTENT_DATA, { 1945 style: { 1946 width: this.SETTINGS.min_width + 'px' 1947 } 1948 }); 1949 } 1950 } 1951}; 1952 1953BX.CAdminDialog.prototype.SetContent = function(html) 1954{ 1955 this.__form = null; 1956 1957 if (BX.type.isElementNode(html)) 1958 { 1959 if (html.parentNode) 1960 html.parentNode.removeChild(html); 1961 } 1962 1963 this.PARAMS.content = html; 1964 BX.cleanNode(this.PARTS.CONTENT_DATA); 1965 1966 BX.adjust(this.PARTS.CONTENT_DATA, { 1967 children: [ 1968 this.PARAMS.content || ' ' 1969 ] 1970 }); 1971 1972 if (this.PARAMS.content_url && this.GetForm()) 1973 { 1974 this.__form.appendChild(BX.create('INPUT', {props:{type:'submit'},style:{display:'none'}})); 1975 this.__form.onsubmit = BX.delegate(this.__submit, this); 1976 } 1977}; 1978 1979BX.CAdminDialog.prototype.__expandGetSize = function() 1980{ 1981 var res = BX.CAdminDialog.superclass.__expandGetSize.apply(this, arguments); 1982 1983 res.width -= parseInt(BX.style(this.PARTS.CONTENT_DATA, 'padding-right')) + parseInt(BX.style(this.PARTS.CONTENT_DATA, 'padding-left')); 1984 res.height -= parseInt(BX.style(this.PARTS.CONTENT_DATA, 'padding-top')) + parseInt(BX.style(this.PARTS.CONTENT_DATA, 'padding-bottom')); 1985 1986 res.height -= this.PARTS.HEAD.offsetHeight; 1987 1988 return res; 1989}; 1990 1991BX.CAdminDialog.prototype.Submit = function() 1992{ 1993 var FORM = this.GetForm(); 1994 if (FORM && !FORM['bxpublic'] && !/bxpublic=/.test(FORM.action)) 1995 { 1996 FORM.appendChild(BX.create('INPUT', { 1997 props: { 1998 type: 'hidden', 1999 name: 'bxpublic', 2000 value: 'Y' 2001 } 2002 })); 2003 } 2004 2005 return BX.CAdminDialog.superclass.Submit.apply(this, arguments); 2006}; 2007 2008BX.CAdminDialog.prototype.btnSave = BX.CAdminDialog.btnSave = { 2009 title: BX.message('JS_CORE_WINDOW_SAVE'), 2010 id: 'savebtn', 2011 name: 'savebtn', 2012 className: 'adm-btn-save', 2013 action: function () { 2014 this.disableUntilError(); 2015 this.parentWindow.Submit(); 2016 } 2017}; 2018 2019BX.CAdminDialog.btnCancel = BX.CAdminDialog.superclass.btnCancel; 2020BX.CAdminDialog.btnClose = BX.CAdminDialog.superclass.btnClose; 2021 2022BX.CDebugDialog = function(arParams) 2023{ 2024 BX.CDebugDialog.superclass.constructor.apply(this, arguments); 2025}; 2026BX.extend(BX.CDebugDialog, BX.CDialog); 2027
2028BX.CDebugDialog.prototype.ShowDetails = function(div_id) 2029{ 2030 var div = BX(div_id); 2031 if (div) 2032 { 2033 if (this.div_detail_current) 2034 this.div_detail_current.style.display = 'none'; 2035 2036 div.style.display = 'block'; 2037 this.div_detail_current = div; 2038 } 2039}; 2040 2041BX.CDebugDialog.prototype.SetContent = function(html) 2042{ 2043 if (!html) 2044 return; 2045 2046 var arHtml = html.split('#DIVIDER#'); 2047 if (arHtml.length > 1) 2048 { 2049 this.PARAMS.content = arHtml[1]; 2050 2051 this.PARTS.CONTENT_DATA.style.overflow = 'hidden'; 2052 2053 BX.CDebugDialog.superclass.SetContent.apply(this, [arHtml[1]]); 2054 2055 this.PARTS.CONTENT_INNER = this.PARTS.CONTENT_DATA.firstChild.nextSibling; 2056 this.PARTS.CONTENT_TOP = this.PARTS.CONTENT_DATA.insertBefore(BX.create('DIV', { 2057 props: { 2058 className: 'bx-debug-content-top' 2059 }, 2060 html: arHtml[0] 2061 }), this.PARTS.CONTENT_INNER); 2062 this.PARTS.CONTENT_INNER.style.overflow = 'auto'; 2063 } 2064 else 2065 { 2066 BX.CDebugDialog.superclass.SetContent.apply(this, arguments); 2067 } 2068}; 2069 2070BX.CDebugDialog.prototype.__adjustSize = function() 2071{ 2072 BX.CDebugDialog.superclass.__adjustSize.apply(this, arguments); 2073 2074 if (this.PARTS.CONTENT_TOP) 2075 { 2076 var new_height = this.PARTS.CONTENT_DATA.offsetHeight - this.PARTS.HEAD.offsetHeight - this.PARTS.CONTENT_TOP.offsetHeight - 38; 2077 2078 if (new_height > 0) 2079 { 2080 this.PARTS.CONTENT_INNER.style.height = new_height + 'px'; 2081 } 2082 } 2083}; 2084 2085 2086/* class for dialog window with editors */ 2087 2088BX.CEditorDialog = function(arParams) 2089{ 2090 BX.CEditorDialog.superclass.constructor.apply(this, arguments); 2091 2092 BX.removeClass(this.PARTS.CONTENT, 'bx-core-adm-dialog-content-wrap'); 2093 BX.removeClass(this.PARTS.CONTENT_DATA, 'bx-core-adm-dialog-content'); 2094 2095 BX.removeClass(this.PARTS.CONTENT_DATA.lastChild, 'bx-core-adm-dialog-content-wrap-inner'); 2096 BX.removeClass(this.PARTS.BUTTONS_CONTAINER, 'bx-core-adm-dialog-buttons'); 2097 2098 BX.addClass(this.PARTS.CONTENT, 'bx-core-editor-dialog-content-wrap'); 2099 BX.addClass(this.PARTS.CONTENT_DATA, 'bx-core-editor-dialog-content'); 2100 BX.addClass(this.PARTS.BUTTONS_CONTAINER, 'bx-core-editor-dialog-buttons'); 2101}; 2102BX.extend(BX.CEditorDialog, BX.CDialog); 2103 2104BX.CEditorDialog.prototype.SetContent = function() 2105{ 2106 BX.CEditorDialog.superclass.SetContent.apply(this, arguments); 2107 2108 BX.removeClass(this.PARTS.CONTENT_DATA.lastChild, 'bx-core-adm-dialog-content-wrap-inner'); 2109}; 2110 2111/* class for wizards in admin section */ 2112BX.CWizardDialog = function(arParams) 2113{ 2114 BX.CWizardDialog.superclass.constructor.apply(this, arguments); 2115 2116 BX.removeClass(this.PARTS.CONTENT, 'bx-core-adm-dialog-content-wrap'); 2117 BX.removeClass(this.PARTS.CONTENT_DATA, 'bx-core-adm-dialog-content'); 2118 BX.removeClass(this.PARTS.CONTENT_DATA.lastChild, 'bx-core-adm-dialog-content-wrap-inner'); 2119 BX.removeClass(this.PARTS.BUTTONS_CONTAINER, 'bx-core-adm-dialog-buttons'); 2120 2121 BX.addClass(this.PARTS.CONTENT, 'bx-core-wizard-dialog-content-wrap'); 2122}; 2123 2124BX.extend(BX.CWizardDialog, BX.CDialog); 2125 2126/* class for auth dialog */ 2127BX.CAuthDialog = function(arParams) 2128{ 2129 arParams.resizable = false; 2130 arParams.width = 350;
2131 arParams.height = 200; 2132 2133 arParams.buttons = [this.btnSave]; 2134 2135 BX.CAuthDialog.superclass.constructor.apply(this, arguments); 2136 this._sender = 'core_window_cauthdialog'; 2137 2138 BX.addClass(this.DIV, 'bx-core-auth-dialog'); 2139 2140 BX.AUTHAGENT = this; 2141}; 2142BX.extend(BX.CAuthDialog, BX.CDialog); 2143 2144BX.CAuthDialog.prototype.btnSave = BX.CAuthDialog.btnSave = { 2145 title: BX.message('JS_CORE_WINDOW_AUTH'), 2146 id: 'savebtn', 2147 name: 'savebtn', 2148 className: 'adm-btn-save', 2149 action: function () { 2150 this.disableUntilError(); 2151 this.parentWindow.Submit('', this.parentWindow.PARAMS.content_url); 2152 } 2153}; 2154 2155BX.CAuthDialog.prototype.SetError = function(error) 2156{ 2157 BX.closeWait(); 2158 2159 if (!!error) 2160 this.ShowError(error.MESSAGE || error); 2161}; 2162 2163BX.CAuthDialog.prototype.setAuthResult = function(result) 2164{ 2165 BX.closeWait(); 2166 2167 if (result === false) 2168 { 2169 this.Close(); 2170 if (this.PARAMS.callback) 2171 this.PARAMS.callback(); 2172 } 2173 else 2174 { 2175 this.SetError(result); 2176 } 2177}; 2178 2179/* MENU CLASSES */ 2180 2181BX.CWindowFloat = function(node) 2182{ 2183 BX.CWindowFloat.superclass.constructor.apply(this, [node, 'float']); 2184 2185 this.SETTINGS.resizable = false; 2186}; 2187BX.extend(BX.CWindowFloat, BX.CWindow); 2188 2189BX.CWindowFloat.prototype.adjustPos = function() 2190{ 2191 if (this.PARAMS.parent) 2192 this.adjustToNode(); 2193 else if (this.PARAMS.x && this.PARAMS.y) 2194 this.adjustToPos([this.PARAMS.x, this.PARAMS.y]); 2195}; 2196 2197BX.CWindowFloat.prototype.adjustToPos = function(pos) 2198{ 2199 this.DIV.style.left = parseInt(pos[0]) + 'px'; 2200 this.DIV.style.top = parseInt(pos[1]) + 'px'; 2201}; 2202 2203BX.CWindowFloat.prototype.adjustToNodeGetPos = function() 2204{ 2205 return BX.pos(this.PARAMS.parent); 2206}; 2207 2208BX.CWindowFloat.prototype.adjustToNode = function(el) 2209{ 2210 el = el || this.PARAMS.parent; 2211 2212 this.PARAMS.parent = BX(el); 2213 2214 if (this.PARAMS.parent) 2215 { 2216 var pos = this.adjustToNodeGetPos(); 2217 2218 this.DIV.style.top = pos.top + 'px';//(pos.top - 26) + 'px'; 2219 this.DIV.style.left = pos.left + 'px'; 2220 2221 this.PARAMS.parent.OPENER = this; 2222 } 2223}; 2224 2225BX.CWindowFloat.prototype.Show = function() 2226{ 2227 this.adjustToPos([-1000, -1000]); 2228 BX.CWindowFloat.superclass.Show.apply(this, arguments); 2229 this.adjustPos(); 2230}; 2231 2232/* menu opener class */ 2233/* 2234{ 2235 DOMNode DIV, 2236 BX.CMenu or Array MENU, 2237 TYPE = 'hover' | 'click', 2238 TIMEOUT: 1000 2239 ATTACH_MODE: 'top' | 'right' 2240 ACTIVE_CLASS: className for opener element when menu is opened 2241} 2242*/ 2243BX.COpener = function(arParams) 2244{ 2245 this.PARAMS = arParams || {}; 2246 2247 this.MENU = arParams.MENU || []; 2248 2249 this.DIV = arParams.DIV; 2250 this.ATTACH = arParams.ATTACH || arParams.DIV; 2251 this.ATTACH_MODE = arParams.ATTACH_MODE || 'bottom'; 2252 2253 this.ACTIVE_CLASS = arParams.ACTIVE_CLASS || ''; 2254 this.PUBLIC_FRAME = arParams.PUBLIC_FRAME || 0; 2255 this.LEVEL = arParams.LEVEL || 0; 2256 2257 this.CLOSE_ON_CLICK = typeof arParams.CLOSE_ON_CLICK != 'undefined' ? !!arParams.CLOSE_ON_CLICK : true; 2258 this.ADJUST_ON_CLICK = typeof arParams.ADJUST_ON_CLICK != 'undefined' ? !!arParams.ADJUST_ON_CLICK : true; 2259 2260 this.TYPE = this.PARAMS.TYPE == 'hover' ? 'hover' : 'click'; 2261 2262 this._openTimeout = null; 2263 2264 if (this.PARAMS.TYPE == 'hover' && arParams.TIMEOUT !== 0)
2265 this.TIMEOUT = arParams.TIMEOUT || 1000; 2266 else 2267 this.TIMEOUT = 0; 2268 2269 this.bMenuInit = false; 2270 2271 if (!!this.PARAMS.MENU_URL) 2272 { 2273 this.bMenuLoaded = false; 2274 this.bMenuLoading = false; 2275 2276 this.MENU = [{ 2277 TEXT: BX.message('JS_CORE_LOADING'), 2278 CLOSE_ON_CLICK: false 2279 }]; 2280 2281 if (this.PARAMS.MENU_PRELOAD) 2282 { 2283 BX.defer(this.Load, this)(); 2284 } 2285 } 2286 2287 BX.ready(BX.defer(this.Init, this)); 2288}; 2289 2290BX.COpener.prototype.Init = function() 2291{ 2292 this.DIV = BX(this.DIV); 2293 2294 switch (this.TYPE) 2295 { 2296 case 'hover': 2297 BX.bind(this.DIV, 'mouseover', BX.proxy(this.Open, this)); 2298 BX.bind(this.DIV, 'click', BX.proxy(this.Toggle, this)); 2299 break; 2300 2301 case 'click': 2302 BX.bind(this.DIV, 'click', BX.proxy(this.Toggle, this)); 2303 break; 2304 } 2305 2306 //BX.bind(window, 'scroll', BX.delegate(this.__close_immediately, this)); 2307 2308 //this.bMenuInit = false; 2309}; 2310 2311BX.COpener.prototype.Load = function() 2312{ 2313 if (this.PARAMS.MENU_URL && !this.bMenuLoaded) 2314 { 2315 if (!this.bMenuLoading) 2316 { 2317 var url = this.PARAMS.MENU_URL; 2318 if (url.indexOf('sessid=') <= 0) 2319 url += (url.indexOf('?') > 0 ? '&' : '?') + 'sessid=' + BX.bitrix_sessid(); 2320 2321 this.bMenuLoading = true; 2322 BX.ajax.loadJSON(url, BX.proxy(this.SetMenu, this), BX.proxy(this.LoadFailed, this)); 2323 } 2324 } 2325}; 2326 2327BX.COpener.prototype.SetMenu = function(menu) 2328{ 2329 this.bMenuLoaded = true; 2330 this.bMenuLoading = false; 2331 if (this.bMenuInit) 2332 { 2333 this.MENU.setItems(menu); 2334 } 2335 else 2336 { 2337 this.MENU = menu; 2338 } 2339}; 2340 2341BX.COpener.prototype.LoadFailed = function(type, error) 2342{ 2343 this.bMenuLoading = false; 2344 this.SetMenu([{ 2345 TEXT: BX.message('JS_CORE_NO_DATA'), 2346 CLOSE_ON_CLICK: true 2347 }]); 2348 BX.debug(arguments); 2349}; 2350 2351BX.COpener.prototype.checkAdminMenu = function() 2352{ 2353 if (document.documentElement.id == 'bx-admin-prefix') 2354 return true; 2355 2356 return !!BX.findParent(this.DIV, {property: {id: 'bx-admin-prefix'}}); 2357}; 2358 2359BX.COpener.prototype.Toggle = function(e) 2360{ 2361 this.__clear_timeout(); 2362 2363 if (!this.bMenuInit || !this.MENU.visible()) 2364 { 2365 var t = this.TIMEOUT; 2366 this.TIMEOUT = 0; 2367 this.Open(e); 2368 this.TIMEOUT = t; 2369 } 2370 else 2371 { 2372 this.MENU.Close(); 2373 } 2374 2375 return !!(e||window.event) && BX.PreventDefault(e); 2376}; 2377 2378BX.COpener.prototype.GetMenu = function() 2379{ 2380 if (!this.bMenuInit) 2381 { 2382 if (BX.type.isArray(this.MENU)) 2383 { 2384 this.MENU = new BX.CMenu({ 2385 ITEMS: this.MENU, 2386 ATTACH_MODE: this.ATTACH_MODE, 2387 SET_ID: this.checkAdminMenu() ? 'bx-admin-prefix' : '', 2388 CLOSE_ON_CLICK: !!this.CLOSE_ON_CLICK, 2389 ADJUST_ON_CLICK: !!this.ADJUST_ON_CLICK, 2390 PUBLIC_FRAME: !!this.PUBLIC_FRAME, 2391 LEVEL: this.LEVEL, 2392 parent: BX(this.DIV), 2393 parent_attach: BX(this.ATTACH) 2394 }); 2395 2396 if (this.LEVEL > 0) 2397 { 2398 BX.bind(this.MENU.DIV, 'mouseover', BX.proxy(this._on_menu_hover, this)); 2399 BX.bind(this.MENU.DIV, 'mouseout', BX.proxy(this._on_menu_hout, this)); 2400 } 2401 } 2402 2403 BX.addCustomEvent(this.MENU, 'onMenuOpen', BX.proxy(this.handler_onopen, this)); 2404 BX.addCustomEvent(this.MENU, 'onMenuClose', BX.proxy(this.handler_onclose, this)); 2405 2406 BX.addCustomEvent('onMenuItemHover', BX.proxy(this.handler_onover, this)); 2407 2408 this.bMenuInit = true; 2409 } 2410 2411 return this.MENU; 2412}; 2413 2414BX.COpener.prototype.Open = function() 2415{ 2416 this.GetMenu(); 2417 2418 this.bOpen = true; 2419 2420 this.__clear_timeout(); 2421 2422 if (this.TIMEOUT > 0) 2423 { 2424 BX.bind(this.DIV, 'mouseout', BX.proxy(this.__clear_timeout, this)); 2425 this._openTimeout = setTimeout(BX.proxy(this.__open, this), this.TIMEOUT); 2426 } 2427 else 2428 { 2429 this.__open(); 2430 } 2431 2432 if (!!this.PARAMS.MENU_URL && !this.bMenuLoaded) 2433 { 2434 this._loadTimeout = setTimeout(BX.proxy(this.Load, this), parseInt(this.TIMEOUT/2)); 2435 } 2436 2437 return true; 2438}; 2439 2440BX.COpener.prototype.__clear_timeout = function() 2441{ 2442 if (!!this._openTimeout) 2443 clearTimeout(this._openTimeout); 2444 if (!!this._loadTimeout) 2445 clearTimeout(this._loadTimeout); 2446 2447 BX.unbind(this.DIV, 'mouseout', BX.proxy(this.__clear_timeout, this)); 2448}; 2449 2450BX.COpener.prototype._on_menu_hover = function() 2451{ 2452 this.bMenuHover = true; 2453 2454 this.__clear_timeout(); 2455 2456 if (this.ACTIVE_CLASS) 2457 BX.addClass(this.DIV, this.ACTIVE_CLASS); 2458 2459}; 2460 2461BX.COpener.prototype._on_menu_hout = function() 2462{ 2463 this.bMenuHover = false; 2464}; 2465 2466BX.COpener.prototype.handler_onover = function(level, opener) 2467{ 2468 if (this.bMenuHover) 2469 return; 2470 2471 if (opener != this && level == this.LEVEL-1 && this.ACTIVE_CLASS) 2472 { 2473 BX.removeClass(this.DIV, this.ACTIVE_CLASS); 2474 } 2475 2476 if (this.bMenuInit && level <= this.LEVEL-1 && this.MENU.visible()) 2477 { 2478 if (opener != this) 2479 { 2480 this.__clear_timeout(); 2481 this._openTimeout = setTimeout(BX.proxy(this.Close, this), this.TIMEOUT); 2482 } 2483 } 2484}; 2485 2486BX.COpener.prototype.handler_onopen = function() 2487{ 2488 this.bOpen = true; 2489 2490 if (this.ACTIVE_CLASS) 2491 BX.addClass(this.DIV, this.ACTIVE_CLASS); 2492 2493 BX.defer(function() { 2494 BX.onCustomEvent(this, 'onOpenerMenuOpen'); 2495 }, this)(); 2496}; 2497 2498BX.COpener.prototype.handler_onclose = function() 2499{ 2500 this.bOpen = false;
2501 BX.onCustomEvent(this, 'onOpenerMenuClose'); 2502 2503 if (this.ACTIVE_CLASS) 2504 BX.removeClass(this.DIV, this.ACTIVE_CLASS); 2505}; 2506 2507BX.COpener.prototype.Close = function() 2508{ 2509 if (!this.bMenuInit) 2510 return; 2511 2512 if (!!this._openTimeout) 2513 clearTimeout(this._openTimeout); 2514 2515 this.bOpen = false; 2516 2517 this.__close(); 2518}; 2519 2520BX.COpener.prototype.__open = function() 2521{ 2522 this.__clear_timeout(); 2523 2524 if (this.bMenuInit && this.bOpen && !this.MENU.visible()) 2525 this.MENU.Show(); 2526}; 2527 2528BX.COpener.prototype.__close = function() 2529{ 2530 if (this.bMenuInit && !this.bOpen && this.MENU.visible()) 2531 this.MENU.Hide(); 2532}; 2533 2534BX.COpener.prototype.__close_immediately = function() { 2535 this.bOpen = false; this.__close(); 2536}; 2537 2538BX.COpener.prototype.isMenuVisible = function() { 2539 return null != this.MENU.visible && this.MENU.visible() 2540}; 2541 2542/* common menu class */ 2543 2544BX.CMenu = function(arParams) 2545{ 2546 BX.CMenu.superclass.constructor.apply(this); 2547 2548 this.DIV.style.width = 'auto';//this.DIV.firstChild.offsetWidth + 'px'; 2549 this.DIV.style.height = 'auto';//this.DIV.firstChild.offsetHeight + 'px'; 2550 2551 this.PARAMS = arParams || {}; 2552 this.PARTS = {}; 2553 2554 this.PARAMS.ATTACH_MODE = this.PARAMS.ATTACH_MODE || 'bottom'; 2555 this.PARAMS.CLOSE_ON_CLICK = typeof this.PARAMS.CLOSE_ON_CLICK == 'undefined' ? true : this.PARAMS.CLOSE_ON_CLICK; 2556 this.PARAMS.ADJUST_ON_CLICK = typeof this.PARAMS.ADJUST_ON_CLICK == 'undefined' ? true : this.PARAMS.ADJUST_ON_CLICK; 2557 this.PARAMS.PUBLIC_FRAME = typeof this.PARAMS.PUBLIC_FRAME == 'undefined' ? false : this.PARAMS.PUBLIC_FRAME; 2558 this.PARAMS.LEVEL = this.PARAMS.LEVEL || 0; 2559 2560 this.DIV.className = 'bx-core-popup-menu bx-core-popup-menu-' + this.PARAMS.ATTACH_MODE + ' bx-core-popup-menu-level' + this.PARAMS.LEVEL + (typeof this.PARAMS.ADDITIONAL_CLASS != 'undefined' ? ' ' + this.PARAMS.ADDITIONAL_CLASS : ''); 2561 if (!!this.PARAMS.SET_ID) 2562 this.DIV.id = this.PARAMS.SET_ID; 2563 2564 if (this.PARAMS.LEVEL == 0) 2565 { 2566 this.ARROW = this.DIV.appendChild(BX.create('SPAN', {props: {className: 'bx-core-popup-menu-angle'}, style: {left:'15px'}})); 2567 } 2568 2569 if (!!this.PARAMS.CLASS_NAME) 2570 this.DIV.className += ' ' + this.PARAMS.CLASS_NAME; 2571 2572 BX.bind(this.DIV, 'click', BX.eventCancelBubble); 2573 2574 this.ITEMS = []; 2575 2576 this.setItems(this.PARAMS.ITEMS); 2577 2578 BX.addCustomEvent('onMenuOpen', BX.proxy(this._onMenuOpen, this)); 2579 BX.addCustomEvent('onMenuItemSelected', BX.proxy(this.Hide, this)); 2580}; 2581BX.extend(BX.CMenu, BX.CWindowFloat); 2582 2583BX.CMenu.broadcastCloseEvent = function() 2584{ 2585 BX.onCustomEvent("onMenuItemSelected"); 2586}; 2587 2588BX.CMenu._toggleChecked = function() 2589{ 2590 BX.toggleClass(this, 'bx-core-popup-menu-item-checked'); 2591}; 2592 2593BX.CMenu._itemDblClick = function() 2594{ 2595 window.location.href = this.href; 2596}; 2597 2598BX.CMenu.prototype.toggleArrow = function(v) 2599{ 2600 if (!!this.ARROW) 2601 { 2602 if (typeof v == 'undefined') 2603 { 2604 v = this.ARROW.style.visibility == 'hidden'; 2605 } 2606 2607 this.ARROW.style.visibility = !!v ? 'visible' : 'hidden'; 2608 } 2609}; 2610 2611BX.CMenu.prototype.visible = function() 2612{ 2613 return this.DIV.style.display !== 'none'; 2614}; 2615 2616BX.CMenu.prototype._onMenuOpen = function(menu, menu_level) 2617{ 2618 if (this.visible()) 2619 { 2620 if (menu_level == this.PARAMS.LEVEL && menu != this) 2621 { 2622 this.Hide(); 2623 } 2624 } 2625}; 2626 2627BX.CMenu.prototype.onUnRegister = function() 2628{ 2629 if (!this.visible()) 2630 return; 2631 2632 this.Hide(); 2633}; 2634 2635BX.CMenu.prototype.setItems = function(items) 2636{ 2637 this.PARAMS.ITEMS = items; 2638 2639 BX.cleanNode(this.DIV); 2640 2641 if (!!this.ARROW) 2642 this.DIV.appendChild(this.ARROW); 2643 2644 if (this.PARAMS.ITEMS) 2645 { 2646 this.PARAMS.ITEMS = BX.util.array_values(this.PARAMS.ITEMS); 2647 2648 var bIcons = false; 2649 var cnt = 0; 2650 for (var i = 0, len = this.PARAMS.ITEMS.length; i < len; i++) 2651 { 2652 if ((i == 0 || i == len-1) && this.PARAMS.ITEMS[i].SEPARATOR) 2653 continue; 2654 2655 cnt++; 2656 2657 if (!bIcons) 2658 bIcons = !!this.PARAMS.ITEMS[i].GLOBAL_ICON; 2659 2660 this.addItem(this.PARAMS.ITEMS[i], i); 2661 } 2662 2663 // Occam turning in his grave 2664 if (cnt === 1) 2665 BX.addClass(this.DIV, 'bx-core-popup-menu-single-item'); 2666 else 2667 BX.removeClass(this.DIV, 'bx-core-popup-menu-single-item'); 2668 2669 if (!bIcons) 2670 BX.addClass(this.DIV, 'bx-core-popup-menu-no-icons'); 2671 else 2672 BX.removeClass(this.DIV, 'bx-core-popup-menu-no-icons'); 2673 2674 } 2675}; 2676 2677BX.CMenu.prototype.addItem = function(item) 2678{ 2679 this.ITEMS.push(item); 2680 2681 if (item.SEPARATOR) 2682 { 2683 item.NODE = BX.create( 2684 'DIV', {props: {className: 'bx-core-popup-menu-separator'}} 2685 ); 2686 } 2687 else 2688 { 2689 var bHasMenu = (!!item.MENU 2690 && (
2691 (BX.type.isArray(item.MENU) && item.MENU.length > 0) 2692 || item.MENU instanceof BX.CMenu 2693 ) || !!item.MENU_URL 2694 ); 2695 2696 if (item.DISABLED) 2697 { 2698 item.CLOSE_ON_CLICK = false; 2699 item.LINK = null; 2700 item.ONCLICK = null; 2701 item.ACTION = null; 2702 } 2703 2704 var attrs = {}; 2705 if (!!item.LINK || BX.browser.IsIE() && !BX.browser.IsDoctype()) 2706 { 2707 attrs.href = item.LINK || 'javascript:void(0)'; 2708 } 2709 if (this.PARAMS.PUBLIC_FRAME) 2710 { 2711 attrs.target = '_top'; 2712 } 2713 2714 item.NODE = BX.create(!!item.LINK || BX.browser.IsIE() && !BX.browser.IsDoctype() ? 'A' : 'SPAN', { 2715 props: { 2716 className: 'bx-core-popup-menu-item' 2717 + (bHasMenu ? ' bx-core-popup-menu-item-opener' : '') 2718 + (!!item.DEFAULT ? ' bx-core-popup-menu-item-default' : '') 2719 + (!!item.DISABLED ? ' bx-core-popup-menu-item-disabled' : '') 2720 + (!!item.CHECKED ? ' bx-core-popup-menu-item-checked' : ''), 2721 title: !!BX.message['MENU_ENABLE_TOOLTIP'] || !!item.SHOW_TITLE ? item.TITLE || '' : '', 2722 BXMENULEVEL: this.PARAMS.LEVEL 2723 }, 2724 attrs: attrs, 2725 events: { 2726 mouseover: function() 2727 { 2728 BX.onCustomEvent('onMenuItemHover', [this.BXMENULEVEL, this.OPENER]) 2729 } 2730 }, 2731 html: '<span class="bx-core-popup-menu-item-icon' + (item.GLOBAL_ICON ? ' '+item.GLOBAL_ICON : '') + '"></span><span class="bx-core-popup-menu-item-text">'+(item.HTML||(item.TEXT? BX.util.htmlspecialchars(item.TEXT) : ''))+'</span>' 2732 }); 2733 2734 if (bHasMenu && !item.DISABLED) 2735 { 2736 item.NODE.OPENER = new BX.COpener({ 2737 DIV: item.NODE, 2738 ACTIVE_CLASS: 'bx-core-popup-menu-item-opened', 2739 TYPE: 'hover', 2740 MENU: item.MENU, 2741 MENU_URL: item.MENU_URL, 2742 MENU_PRELOAD: !!item.MENU_PRELOAD, 2743 LEVEL: this.PARAMS.LEVEL + 1, 2744 ATTACH_MODE:'right', 2745 TIMEOUT: 500 2746 }); 2747 } 2748 else if (this.PARAMS.CLOSE_ON_CLICK && (typeof item.CLOSE_ON_CLICK == 'undefined' || !!item.CLOSE_ON_CLICK)) 2749 { 2750 BX.bind(item.NODE, 'click', BX.CMenu.broadcastCloseEvent); 2751 } 2752 else if (this.PARAMS.ADJUST_ON_CLICK && (typeof item.ADJUST_ON_CLICK == 'undefined' || !!item.ADJUST_ON_CLICK)) 2753 { 2754 BX.bind(item.NODE, 'click', BX.defer(this.adjustPos, this)); 2755 } 2756 2757 if (bHasMenu && !!item.LINK) 2758 { 2759 BX.bind(item.NODE, 'dblclick', BX.CMenu._itemDblClick); 2760 } 2761 2762 if (typeof item.CHECKED != 'undefined') 2763 { 2764 BX.bind(item.NODE, 'click', BX.CMenu._toggleChecked); 2765 } 2766 2767 item.ONCLICK = item.ACTION || item.ONCLICK; 2768 if (!!item.ONCLICK) 2769 { 2770 if (BX.type.isString(item.ONCLICK)) 2771 { 2772 item.ONCLICK = new Function("event", item.ONCLICK); 2773 } 2774 2775 BX.bind(item.NODE, 'click', item.ONCLICK); 2776 } 2777 } 2778 2779 this.DIV.appendChild(item.NODE); 2780}; 2781 2782BX.CMenu.prototype._documentClickBind = function() 2783{ 2784 this._documentClickUnBind(); 2785 BX.bind(document, 'click', BX.proxy(this._documentClick, this)); 2786}; 2787 2788BX.CMenu.prototype._documentClickUnBind = function() 2789{ 2790 BX.unbind(document, 'click', BX.proxy(this._documentClick, this)); 2791}; 2792 2793BX.CMenu.prototype._documentClick = function(e) 2794{ 2795 e = e||window.event; 2796 if(!!e && !(BX.getEventButton(e) & BX.MSLEFT)) 2797 return; 2798 2799 this.Close(); 2800}; 2801 2802BX.CMenu.prototype.Show = function() 2803{ 2804 BX.onCustomEvent(this, 'onMenuOpen', [this, this.PARAMS.LEVEL]); 2805 BX.CMenu.superclass.Show.apply(this, []); 2806 2807 this.bCloseEventFired = false; 2808 2809 BX.addCustomEvent(this.PARAMS.parent_attach, 'onChangeNodePosition', BX.proxy(this.adjustToNode, this)); 2810 2811 (BX.defer(this._documentClickBind, this))(); 2812}; 2813 2814BX.CMenu.prototype.Close = // we shouldn't 'Close' window - only hide 2815BX.CMenu.prototype.Hide = function() 2816{ 2817 if (!this.visible()) 2818 return; 2819 2820 BX.removeCustomEvent(this.PARAMS.parent_attach, 'onChangeNodePosition', BX.proxy(this.adjustToNode, this)); 2821 2822 this._documentClickUnBind(); 2823 2824 if (!this.bCloseEventFired) 2825 { 2826 BX.onCustomEvent(this, 'onMenuClose', [this, this.PARAMS.LEVEL]); 2827 this.bCloseEventFired = true; 2828 } 2829 BX.CMenu.superclass.Hide.apply(this, arguments); 2830 2831 2832// this.DIV.onclick = null; 2833 //this.PARAMS.parent.onclick = null; 2834}; 2835 2836BX.CMenu.prototype.__adjustMenuToNode = function() 2837{ 2838 var pos = BX.pos(this.PARAMS.parent_attach), 2839 bFixed = !!BX.findParent(this.PARAMS.parent_attach, BX.is_fixed); 2840 2841 if (bFixed) 2842 this.DIV.style.position = 'fixed'; 2843 else 2844 this.DIV.style.position = 'absolute'; 2845 2846 if (!pos.top) 2847 { 2848 this.DIV.style.top = '-1000px'; 2849 this.DIV.style.left = '-1000px'; 2850 } 2851 2852 if (this.bTimeoutSet) return; 2853 2854 var floatWidth = this.DIV.offsetWidth, floatHeight = this.DIV.offsetHeight; 2855 if (!floatWidth) 2856 { 2857 setTimeout(BX.delegate(function(){ 2858 this.bTimeoutSet = false; this.__adjustMenuToNode(); 2859 }, this), 100); 2860 2861 this.bTimeoutSet = true; 2862 return; 2863 } 2864 2865 var menu_pos = {}, 2866 wndSize = BX.GetWindowSize(); 2867 2868/* 2869 if (BX.browser.IsIE() && !BX.browser.IsDoctype()) 2870 { 2871 pos.top -= 4; pos.bottom -= 4; 2872 pos.left -= 2; pos.right -= 2; 2873 } 2874*/ 2875 2876 switch (this.PARAMS.ATTACH_MODE) 2877 { 2878 case 'bottom': 2879 menu_pos.top = pos.bottom + 9; 2880 menu_pos.left = pos.left; 2881 2882 var arrowPos = 0; 2883 if (!!this.ARROW) 2884 { 2885 if (pos.width > floatWidth) 2886 arrowPos = parseInt(floatWidth/2 - 7); 2887 else 2888 arrowPos = parseInt(Math.min(floatWidth, pos.width)/2 - 7); 2889 2890 if (arrowPos < 7) 2891 { 2892 menu_pos.left -= 15; 2893 arrowPos += 15; 2894 } 2895 } 2896 2897 if (menu_pos.left > wndSize.scrollWidth - floatWidth - 10) 2898 { 2899 var orig_menu_pos = menu_pos.left; 2900 menu_pos.left = wndSize.scrollWidth - floatWidth - 10; 2901 2902 if (!!this.ARROW) 2903 arrowPos += orig_menu_pos - menu_pos.left; 2904 } 2905 2906 if (bFixed) 2907 { 2908 menu_pos.left -= wndSize.scrollLeft; 2909 } 2910 2911 if (!!this.ARROW) 2912 this.ARROW.style.left = arrowPos + 'px'; 2913 break; 2914 case 'right': 2915 menu_pos.top = pos.top-1; 2916 menu_pos.left = pos.right; 2917 2918 if (menu_pos.left > wndSize.scrollWidth - floatWidth - 10) 2919 { 2920 menu_pos.left = pos.left - floatWidth - 1; 2921 } 2922 break; 2923 } 2924 2925 if (bFixed) 2926 { 2927 menu_pos.top -= wndSize.scrollTop; 2928 } 2929 2930 if (!!this.ARROW) 2931 this.ARROW.className = 'bx-core-popup-menu-angle'; 2932 2933 if((menu_pos.top + floatHeight >
2933 wndSize.scrollTop + wndSize.innerHeight) 2934 || (menu_pos.top + floatHeight > wndSize.scrollHeight)) 2935 { 2936 var new_top = this.PARAMS.ATTACH_MODE == 'bottom' 2937 ? pos.top - floatHeight - 9 2938 : pos.bottom - floatHeight + 1; 2939 2940 if((new_top > wndSize.scrollTop) 2941 || (menu_pos.top + floatHeight > wndSize.scrollHeight)) 2942 { 2943 if ((menu_pos.top + floatHeight > wndSize.scrollHeight)) 2944 { 2945 menu_pos.top = Math.max(0, wndSize.scrollHeight-floatHeight); 2946 this.toggleArrow(false); 2947 } 2948 else 2949 { 2950 menu_pos.top = new_top; 2951 2952 if (!!this.ARROW) 2953 this.ARROW.className = 'bx-core-popup-menu-angle-bottom'; 2954 } 2955 } 2956 } 2957 2958 if (menu_pos.top + menu_pos.left == 0) 2959 { 2960 this.Hide(); 2961 } 2962 else 2963 { 2964 this.DIV.style.top = menu_pos.top + 'px'; 2965 this.DIV.style.left = menu_pos.left + 'px'; 2966 } 2967}; 2968 2969BX.CMenu.prototype.adjustToNode = function(el) 2970{ 2971 this.PARAMS.parent_attach = BX(el) || this.PARAMS.parent_attach || this.PARAMS.parent; 2972 this.__adjustMenuToNode(); 2973}; 2974 2975 2976/* components toolbar class */ 2977 2978BX.CMenuOpener = function(arParams) 2979{ 2980 BX.CMenuOpener.superclass.constructor.apply(this); 2981 2982 this.PARAMS = arParams || {}; 2983 this.setParent(this.PARAMS.parent); 2984 this.PARTS = {}; 2985 2986 this.SETTINGS.drag_restrict = true; 2987 2988 this.defaultAction = null; 2989 2990 this.timeout = 500; 2991 2992 this.DIV.className = 'bx-component-opener'; 2993 this.DIV.ondblclick = BX.PreventDefault; 2994 2995 if (this.PARAMS.component_id) 2996 { 2997 this.PARAMS.transform = !!this.PARAMS.transform; 2998 } 2999 3000 this.OPENERS = []; 3001 3002 this.DIV.appendChild(BX.create('SPAN', { 3003 props: {className: 'bx-context-toolbar' + (this.PARAMS.transform ? ' bx-context-toolbar-vertical-mode' : '')} 3004 })); 3005 3006 //set internal structure and register draggable element 3007 this.PARTS.INNER = this.DIV.firstChild.appendChild(BX.create('SPAN', { 3008 props: {className: 'bx-context-toolbar-inner'}, 3009 html: '<span class="bx-context-toolbar-drag-icon"></span><span class="bx-context-toolbar-vertical-line"></span><br>' 3010 })); 3011 3012 this.EXTRA_BUTTONS = {}; 3013 3014 var btnCount = 0; 3015 for (var i = 0, len = this.PARAMS.menu.length; i < len; i++) 3016 { 3017 var item = this.addItem(this.PARAMS.menu[i]); 3018 if (null != item) 3019 { 3020 btnCount++; 3021 this.PARTS.INNER.appendChild(item); 3022 this.PARTS.INNER.appendChild(BX.create('BR')); 3023 } 3024 } 3025 var bHasButtons = btnCount > 0; 3026 3027 //menu items will be attached here 3028 3029 this.PARTS.ICONS = this.PARTS.INNER.appendChild(BX.create('SPAN', { 3030 props: {className: 'bx-context-toolbar-icons'} 3031 })); 3032 3033 if (this.PARAMS.component_id) 3034 { 3035 this.PARAMS.pin = !!this.PARAMS.pin; 3036 3037 if (bHasButtons) 3038 this.PARTS.ICONS.appendChild(BX.create('SPAN', {props: {className: 'bx-context-toolbar-separator'}})); 3039 3040 this.PARTS.ICON_PIN = this.PARTS.ICONS.appendChild(BX.create('A', { 3041 attrs: { 3042 href: 'javascript:void(0)' 3043 }, 3044 props: { 3045 className: this.PARAMS.pin 3046 ? 'bx-context-toolbar-pin-fixed' 3047 : 'bx-context-toolbar-pin' 3048 }, 3049 events: { 3050 click: BX.delegate(this.__pin_btn_clicked, this) 3051 } 3052 })); 3053 } 3054 3055 3056 if (this.EXTRA_BUTTONS['components2_props']) 3057 { 3058 var btn = this.EXTRA_BUTTONS['components2_props'] || {URL: 'javascript:void(0)'}; 3059 if (null == this.defaultAction) 3060 { 3061 this.defaultAction = btn.ONCLICK; 3062 this.defaultActionTitle = btn.TITLE || btn.TEXT; 3063 } 3064 3065 btn.URL = 'javascript:' + BX.util.urlencode(btn.ONCLICK); 3066 3067 this.ATTACH = this.PARTS.ICONS.appendChild(BX.create('SPAN', { 3068 props: {className: 'bx-context-toolbar-button bx-context-toolbar-button-settings' }, 3069 children: 3070 [ 3071 BX.create('SPAN', 3072 { 3073 props:{className: 'bx-context-toolbar-button-inner'}, 3074 children: 3075 [ 3076 BX.create('A', { 3077 attrs: {href: btn.URL}, 3078 events: { 3079 mouseover: BX.proxy(this.__msover_text, this), 3080 mouseout: BX.proxy(this.__msout_text, this), 3081 mousedown: BX.proxy(this.__msdown_text, this) 3082 }, 3083 html: '<span class="bx-context-toolbar-button-icon bx-context-toolbar-settings-icon"></span>' 3084 }), 3085 BX.create('A', { 3086 attrs: {href: 'javascript: void(0)'}, 3087 props: {className: 'bx-context-toolbar-button-arrow'}, 3088 events: { 3089 mouseover: BX.proxy(this.__msover_arrow, this), 3090 mouseout: BX.proxy(this.__msout_arrow, this), 3091 mousedown: BX.proxy(this.__msdown_arrow, this) 3092 }, 3093 html: '<span class="bx-context-toolbar-button-arrow"></span>' 3094 }) 3095 ] 3096 }) 3097 ] 3098 })); 3099
3100 this.OPENER = this.ATTACH.firstChild.lastChild; 3101 3102 var opener = this.attachMenu(this.EXTRA_BUTTONS['components2_submenu']['MENU']); 3103 3104 BX.addCustomEvent(opener, 'onOpenerMenuOpen', BX.proxy(this.__menu_open, this)); 3105 BX.addCustomEvent(opener, 'onOpenerMenuClose', BX.proxy(this.__menu_close, this)); 3106 } 3107 3108 if (btnCount > 1) 3109 { 3110 this.PARTS.ICONS.appendChild(BX.create('span', { props: {className: 'bx-context-toolbar-separator bx-context-toolbar-separator-switcher'}})); 3111 3112 this.ICON_TRANSFORM = this.PARTS.ICONS.appendChild(BX.create('A', { 3113 attrs: {href: 'javascript: void(0)'}, 3114 props: {className: 'bx-context-toolbar-switcher'}, 3115 events: { 3116 click: BX.delegate(this.__trf_btn_clicked, this) 3117 } 3118 })); 3119 } 3120 3121 if (this.PARAMS.HINT) 3122 { 3123 this.DIV.BXHINT = this.HINT = new BX.CHint({ 3124 parent: this.DIV, 3125 hint:this.PARAMS.HINT.TEXT || '', 3126 title: this.PARAMS.HINT.TITLE || '', 3127 hide_timeout: this.timeout/2, 3128 preventHide: false 3129 }); 3130 } 3131 3132 BX.addCustomEvent(this, 'onWindowDragFinished', BX.delegate(this.__onMoveFinished, this)); 3133 BX.addCustomEvent('onDynamicModeChange', BX.delegate(this.__onDynamicModeChange, this)); 3134 BX.addCustomEvent('onTopPanelCollapse', BX.delegate(this.__onPanelCollapse, this)); 3135 3136 BX.addCustomEvent('onMenuOpenerMoved', BX.delegate(this.checkPosition, this)); 3137 BX.addCustomEvent('onMenuOpenerUnhide', BX.delegate(this.checkPosition, this)); 3138 3139 BX.Event.EventEmitter.incrementMaxListeners('onDynamicModeChange'); 3140 BX.Event.EventEmitter.incrementMaxListeners('onTopPanelCollapse'); 3141 BX.Event.EventEmitter.incrementMaxListeners('onMenuOpenerMoved'); 3142 BX.Event.EventEmitter.incrementMaxListeners('onMenuOpenerUnhide'); 3143 3144 if (this.OPENERS) 3145 { 3146 for (i=0,len=this.OPENERS.length; i<len; i++) 3147 { 3148 BX.addCustomEvent(this.OPENERS[i], 'onOpenerMenuOpen', BX.proxy(this.__hide_hint, this)); 3149 } 3150 } 3151}; 3152BX.extend(BX.CMenuOpener, BX.CWindowFloat); 3153 3154BX.CMenuOpener.prototype.setParent = function(new_parent) 3155{ 3156 new_parent = BX(new_parent); 3157 3158 if (!new_parent) 3159 { 3160 return; 3161 } 3162 3163 if(new_parent.OPENER && new_parent.OPENER != this) 3164 { 3165 new_parent.OPENER.Close(); 3166 new_parent.OPENER.clearHoverHoutEvents(); 3167 } 3168 3169 if(this.PARAMS.parent && this.PARAMS.parent != new_parent) 3170 { 3171 this.clearHoverHoutEvents(); 3172 this.PARAMS.parent.OPENER = null; 3173 } 3174 3175 this.PARAMS.parent = new_parent; 3176 this.PARAMS.parent.OPENER = this; 3177}; 3178 3179BX.CMenuOpener.prototype.setHoverHoutEvents = function(hover, hout) 3180{ 3181 if(!this.__opener_events_set) 3182 { 3183 BX.bind(this.Get(), 'mouseover', hover); 3184 BX.bind(this.Get(), 'mouseout', hout); 3185 this.__opener_events_set = true; 3186 } 3187}; 3188 3189BX.CMenuOpener.prototype.clearHoverHoutEvents = function() 3190{ 3191 if(this.Get()) 3192 { 3193 BX.unbindAll(this.Get()); 3194 this.__opener_events_set = false; 3195 } 3196}; 3197 3198 3199BX.CMenuOpener.prototype.unclosable = true; 3200 3201BX.CMenuOpener.prototype.__check_intersection = function(pos_self, pos_other) 3202{ 3203 return !(pos_other.right <= pos_self.left || pos_other.left >= pos_self.right 3204 || pos_other.bottom <= pos_self.top || pos_other.top >= pos_self.bottom); 3205}; 3206 3207 3208BX.CMenuOpener.prototype.__msover_text = function() { 3209 this.bx_hover = true; 3210 if (!this._menu_open) 3211 BX.addClass(this.ATTACH, 'bx-context-toolbar-button-text-hover'); 3212}; 3213 3214BX.CMenuOpener.prototype.__msout_text = function() { 3215 this.bx_hover = false; 3216 if (!this._menu_open) 3217 BX.removeClass(this.ATTACH, 'bx-context-toolbar-button-text-hover bx-context-toolbar-button-text-active'); 3218}; 3219 3220BX.CMenuOpener.prototype.__msover_arrow = function() { 3221 this.bx_hover = true; 3222 if (!this._menu_open) 3223 BX.addClass(this.ATTACH, 'bx-context-toolbar-button-arrow-hover'); 3224}; 3225 3226BX.CMenuOpener.prototype.__msout_arrow = function() { 3227 this.bx_hover = false; 3228 if (!this._menu_open) 3229 BX.removeClass(this.ATTACH, 'bx-context-toolbar-button-arrow-hover bx-context-toolbar-button-arrow-active'); 3230}; 3231 3232BX.CMenuOpener.prototype.__msdown_text = function() { 3233 this.bx_active = true; 3234 if (!this._menu_open) 3235 BX.addClass(this.ATTACH, 'bx-context-toolbar-button-text-active'); 3236}; 3237 3238BX.CMenuOpener.prototype.__msdown_arrow = function() { 3239 this.bx_active = true; 3240 if (!this._menu_open) 3241 BX.addClass(this.ATTACH, 'bx-context-toolbar-button-arrow-active'); 3242}; 3243 3244BX.CMenuOpener.prototype.__menu_close = function() { 3245 this._menu_open = false;
3246 this.bx_active = false; 3247 BX.removeClass(this.ATTACH, 'bx-context-toolbar-button-active bx-context-toolbar-button-text-active bx-context-toolbar-button-arrow-active'); 3248 if (!this.bx_hover) 3249 { 3250 BX.removeClass(this.ATTACH, 'bx-context-toolbar-button-hover bx-context-toolbar-button-text-hover bx-context-toolbar-button-arrow-hover'); 3251 this.bx_hover = false; 3252 } 3253}; 3254 3255BX.CMenuOpener.prototype.__menu_open = function() { 3256 this._menu_open = true; 3257}; 3258 3259BX.CMenuOpener.prototype.checkPosition = function() 3260{ 3261 if (this.isMenuVisible() || this.DIV.style.display == 'none' 3262 || this == BX.proxy_context || BX.proxy_context.zIndex > this.zIndex) 3263 return; 3264 3265 this.correctPosition(BX.proxy_context); 3266}; 3267 3268BX.CMenuOpener.prototype.correctPosition = function(opener) 3269{ 3270 var pos_self = BX.pos(this.DIV), pos_other = BX.pos(opener.Get()); 3271 if (this.__check_intersection(pos_self, pos_other)) 3272 { 3273 var new_top = pos_other.top - pos_self.height; 3274 if (new_top < 0) 3275 new_top = pos_other.bottom; 3276 3277 this.DIV.style.top = new_top + 'px'; 3278 3279 BX.addCustomEvent(opener, 'onMenuOpenerHide', BX.proxy(this.restorePosition, this)); 3280 BX.onCustomEvent(this, 'onMenuOpenerMoved'); 3281 } 3282}; 3283 3284BX.CMenuOpener.prototype.restorePosition = function() 3285{ 3286 if (!this.MOUSEOVER && !this.isMenuVisible()) 3287 { 3288 if (this.originalPos) 3289 this.DIV.style.top = this.originalPos.top + 'px'; 3290 3291 BX.removeCustomEvent(BX.proxy_context, 'onMenuOpenerHide', BX.proxy(this.restorePosition, this)); 3292 if (this.restore_pos_timeout) clearTimeout(this.restore_pos_timeout); 3293 } 3294 else 3295 { 3296 this.restore_pos_timeout = setTimeout(BX.proxy(this.restorePosition, this), this.timeout); 3297 } 3298}; 3299 3300 3301BX.CMenuOpener.prototype.Show = function() 3302{ 3303 BX.CMenuOpener.superclass.Show.apply(this, arguments); 3304 3305 this.SetDraggable(this.PARTS.INNER.firstChild); 3306 3307 this.DIV.style.width = 'auto'; 3308 this.DIV.style.height = 'auto'; 3309 3310 if (!this.PARAMS.pin) 3311 { 3312 this.DIV.style.left = '-1000px'; 3313 this.DIV.style.top = '-1000px'; 3314 3315 this.Hide(); 3316 } 3317 else 3318 { 3319 this.bPosAdjusted = true; 3320 this.bMoved = true; 3321 3322 if (this.PARAMS.top) this.DIV.style.top = this.PARAMS.top + 'px'; 3323 if (this.PARAMS.left) this.DIV.style.left = this.PARAMS.left + 'px'; 3324 3325 this.DIV.style.display = (!BX.admin.dynamic_mode || BX.admin.dynamic_mode_show_borders) ? 'block' : 'none'; 3326 3327 if (this.DIV.style.display == 'block') 3328 { 3329 setTimeout(BX.delegate(function() {BX.onCustomEvent(this, 'onMenuOpenerUnhide')}, this), 50); 3330 } 3331 } 3332}; 3333 3334BX.CMenuOpener.prototype.executeDefaultAction = function() 3335{ 3336 if (this.defaultAction) 3337 { 3338 if (BX.type.isFunction(this.defaultAction)) 3339 this.defaultAction(); 3340 else if(BX.type.isString(this.defaultAction)) 3341 BX.evalGlobal(this.defaultAction); 3342 } 3343}; 3344 3345BX.CMenuOpener.prototype.__onDynamicModeChange = function(val) 3346{ 3347 this.DIV.style.display = val ? 'block' : 'none'; 3348}; 3349 3350BX.CMenuOpener.prototype.__onPanelCollapse = function(bCollapsed, dy) 3351{ 3352 this.DIV.style.top = (parseInt(this.DIV.style.top) + dy) + 'px'; 3353 if (this.PARAMS.pin) 3354 { 3355 this.__savePosition(); 3356 } 3357}; 3358 3359BX.CMenuOpener.prototype.__onMoveFinished = function() 3360{ 3361 BX.onCustomEvent(this, 'onMenuOpenerMoved'); 3362 3363 this.bMoved = true; 3364 3365 if (this.PARAMS.pin) 3366 this.__savePosition(); 3367}; 3368 3369BX.CMenuOpener.prototype.__savePosition = function() 3370{ 3371 var arOpts = {}; 3372 3373 arOpts.pin = this.PARAMS.pin; 3374 if (!this.PARAMS.pin) 3375 { 3376 arOpts.top = false; arOpts.left = false; arOpts.transform = false; 3377 } 3378 else 3379 { 3380 arOpts.transform = this.PARAMS.transform; 3381 if (this.bMoved) 3382 { 3383 arOpts.left = parseInt(this.DIV.style.left); 3384 arOpts.top = parseInt(this.DIV.style.top); 3385 } 3386 } 3387 3388 BX.WindowManager.saveWindowOptions(this.PARAMS.component_id, arOpts); 3389}; 3390 3391BX.CMenuOpener.prototype.__pin_btn_clicked = function() {this.Pin()}; 3392BX.CMenuOpener.prototype.Pin = function(val) 3393{ 3394 if (null == val) 3395 this.PARAMS.pin = !this.PARAMS.pin; 3396 else 3397 this.PARAMS.pin = !!val; 3398 3399 this.PARTS.ICON_PIN.className = (this.PARAMS.pin ? 'bx-context-toolbar-pin-fixed' : 'bx-context-toolbar-pin'); 3400 3401 this.__savePosition(); 3402}; 3403 3404BX.CMenuOpener.prototype.__trf_btn_clicked = function() {this.Transform()}; 3405BX.CMenuOpener.prototype.Transform = function(val) 3406{ 3407 var pos = {}; 3408 3409 if (null == val) 3410 this.PARAMS.transform = !this.PARAMS.transform; 3411 else 3412 this.PARAMS.transform = !!val; 3413 3414 if (this.bMoved) 3415 { 3416 pos = BX.pos(this.DIV); 3417 } 3418 3419 if (this.PARAMS.transform) 3420 BX.addClass(this.DIV.firstChild, 'bx-context-toolbar-vertical-mode'); 3421 else 3422 BX.removeClass(this.DIV.firstChild, 'bx-context-toolbar-vertical-mode'); 3423 3424 if (!this.bMoved) 3425 { 3426 this.adjustPos(); 3427 } 3428 else 3429 { 3430 this.DIV.style.left = (pos.right - this.DIV.offsetWidth - (BX.browser.IsIE() && !BX.browser.IsDoctype() ? 2 : 0)) + 'px'; 3431 } 3432 3433 this.__savePosition(); 3434}; 3435 3436BX.CMenuOpener.prototype.adjustToNodeGetPos = function() 3437{ 3438 var pos = BX.pos(this.PARAMS.parent/*, true*/); 3439 3440 var scrollSize = BX.GetWindowScrollSize(); 3441 var floatWidth = this.DIV.offsetWidth; 3442 3443 pos.left -= BX.admin.__border_dx; 3444 pos.top -= BX.admin.__border_dx; 3445 3446 if (true || !this.PARAMS.transform) 3447 { 3448 pos.top -= 45; 3449 } 3450 3451 if (pos.left > scrollSize.scrollWidth - floatWidth) 3452 { 3453 pos.left = scrollSize.scrollWidth - floatWidth; 3454 } 3455 3456 return pos; 3457}; 3458 3459BX.CMenuOpener.prototype.addItem = function(item) 3460{ 3461 if (item.TYPE) 3462 { 3463 this.EXTRA_BUTTONS[item.TYPE] = item; 3464 return null; 3465 } 3466 else 3467 { 3468 var q = new BX.CMenuOpenerItem(item); 3469 if (null == this.defaultAction) 3470 { 3471 if (q.item.ONCLICK) 3472 { 3473 this.defaultAction = item.ONCLICK; 3474 } 3475 else if (q.item.MENU) 3476 { 3477 this.defaultAction = BX.delegate(function() {this.Open()}, q.item.OPENER); 3478 } 3479 3480 this.defaultActionTitle = item.TITLE || item.TEXT; 3481 3482 BX.addClass(q.Get(), 'bx-content-toolbar-default'); 3483 } 3484 if (q.item.OPENER) this.OPENERS[this.OPENERS.length] = q.item.OPENER; 3485 return q.Get(); 3486 } 3487}; 3488 3489BX.CMenuOpener.prototype.attachMenu = function(menu) 3490{ 3491 var opener = new BX.COpener({ 3492 'DIV': this.OPENER,
3493 'ATTACH': this.ATTACH, 3494 'MENU': menu, 3495 'TYPE': 'click' 3496 }); 3497 3498 this.OPENERS[this.OPENERS.length] = opener; 3499 3500 return opener; 3501}; 3502 3503BX.CMenuOpener.prototype.__hide_hint = function() 3504{ 3505 if (this.HINT) this.HINT.__hide_immediately(); 3506}; 3507 3508BX.CMenuOpener.prototype.isMenuVisible = function() 3509{ 3510 for (var i=0,len=this.OPENERS.length; i<len; i++) 3511 { 3512 if (this.OPENERS[i].isMenuVisible()) 3513 return true; 3514 } 3515 3516 return false; 3517}; 3518 3519BX.CMenuOpener.prototype.Hide = function() 3520{ 3521 if (!this.PARAMS.pin) 3522 { 3523 this.DIV.style.display = 'none'; 3524 BX.onCustomEvent(this, 'onMenuOpenerHide'); 3525 } 3526}; 3527BX.CMenuOpener.prototype.UnHide = function() 3528{ 3529 this.DIV.style.display = 'block'; 3530 if (!this.bPosAdjusted && !this.PARAMS.pin) 3531 { 3532 this.adjustPos(); 3533 this.bPosAdjusted = true; 3534 } 3535 3536 if (null == this.originalPos && !this.bMoved) 3537 { 3538 this.originalPos = BX.pos(this.DIV); 3539 } 3540 3541 BX.onCustomEvent(this, 'onMenuOpenerUnhide'); 3542}; 3543 3544BX.CMenuOpenerItem = function(item) 3545{ 3546 this.item = item; 3547 3548 if (this.item.ACTION && !this.item.ONCLICK) 3549 { 3550 this.item.ONCLICK = this.item.ACTION; 3551 } 3552 3553 this.DIV = BX.create('SPAN'); 3554 this.DIV.appendChild(BX.create('SPAN', {props: {className: 'bx-context-toolbar-button-underlay'}})); 3555 3556 this.WRAPPER = this.DIV.appendChild(BX.create('SPAN', { 3557 props: {className: 'bx-context-toolbar-button-wrapper'}, 3558 children: [ 3559 BX.create('SPAN', { 3560 props: {className: 'bx-context-toolbar-button', title: item.TITLE}, 3561 children: [ 3562 BX.create('SPAN', { 3563 props: {className: 'bx-context-toolbar-button-inner'} 3564 }) 3565 ] 3566 }) 3567 ] 3568 })); 3569 3570 var btn_icon = BX.create('SPAN', { 3571 props: {className: 'bx-context-toolbar-button-icon' + (this.item.ICON || this.item.ICONCLASS ? ' ' + (this.item.ICON || this.item.ICONCLASS) : '')}, 3572 attrs: ( 3573 !(this.item.ICON || this.item.ICONCLASS) 3574 && 3575 (this.item.SRC || this.item.IMAGE) 3576 ) 3577 ? { 3578 style: 'background: scroll transparent url(' + (this.item.SRC || this.item.IMAGE) + ') no-repeat center center !important;' 3579 } 3580 : {} 3581 }), btn_text = BX.create('SPAN', { 3582 props: {className: 'bx-context-toolbar-button-text'}, 3583 text: this.item.TEXT 3584 }); 3585 3586 if (this.item.ACTION && !this.item.ONCLICK) 3587 { 3588 this.item.ONCLICK = this.item.ACTION; 3589 } 3590 3591 this.bHasMenu = !!this.item.MENU; 3592 this.bHasAction = !!this.item.ONCLICK; 3593 3594 if (this.bHasAction) 3595 { 3596 this.LINK = this.WRAPPER.firstChild.firstChild.appendChild(BX.create('A', { 3597 attrs: { 3598 'href': 'javascript: void(0)' 3599 }, 3600 events: { 3601 mouseover: this.bHasMenu ? BX.proxy(this.__msover_text, this) : BX.proxy(this.__msover, this), 3602 mouseout: this.bHasMenu ? BX.proxy(this.__msout_text, this) : BX.proxy(this.__msout, this), 3603 mousedown: this.bHasMenu ? BX.proxy(this.__msdown_text, this) : BX.proxy(this.__msdown, this) 3604 }, 3605 children: [btn_icon, btn_text] 3606 })); 3607 3608 if (this.bHasMenu) 3609 { 3610 this.LINK_MENU = this.WRAPPER.firstChild.firstChild.appendChild(BX.create('A', { 3611 props: {className: 'bx-context-toolbar-button-arrow'}, 3612 attrs: { 3613 'href': 'javascript: void(0)' 3614 }, 3615 events: { 3616 mouseover: BX.proxy(this.__msover_arrow, this), 3617 mouseout: BX.proxy(this.__msout_arrow, this), 3618 mousedown: BX.proxy(this.__msdown_arrow, this) 3619 }, 3620 children: [ 3621 BX.create('SPAN', {props: {className: 'bx-context-toolbar-button-arrow'}}) 3622 ] 3623 })); 3624 } 3625 3626 } 3627 else if (this.bHasMenu) 3628 { 3629 this.item.ONCLICK = null; 3630 3631 this.LINK = this.LINK_MENU = this.WRAPPER.firstChild.firstChild.appendChild(BX.create('A', { 3632 attrs: { 3633 'href': 'javascript: void(0)' 3634 }, 3635 events: { 3636 mouseover: BX.proxy(this.__msover, this), 3637 mouseout: BX.proxy(this.__msout, this), 3638 mousedown: BX.proxy(this.__msdown, this) 3639 }, 3640 children: [ 3641 btn_icon, 3642 btn_text 3643 ] 3644 })); 3645 3646 this.LINK.appendChild(BX.create('SPAN', {props: {className: 'bx-context-toolbar-single-button-arrow'}})); 3647 3648 } 3649 3650 if (this.bHasMenu) 3651 { 3652 this.item.SUBMENU = new BX.CMenu({ 3653 ATTACH_MODE:'bottom', 3654 ITEMS:this.item['MENU'], 3655 //PARENT_MENU:this.parentMenu, 3656 parent: this.LINK_MENU, 3657 parent_attach: this.WRAPPER.firstChild 3658 }); 3659 3660 this.item.OPENER = new BX.COpener({ 3661 DIV: this.LINK_MENU, 3662 TYPE: 'click', 3663 MENU: this.item.SUBMENU 3664 }); 3665 3666 BX.addCustomEvent(this.item.OPENER, 'onOpenerMenuOpen', BX.proxy(this.__menu_open, this)); 3667 BX.addCustomEvent(this.item.OPENER, 'onOpenerMenuClose', BX.proxy(this.__menu_close, this)); 3668 } 3669 3670 if (this.bHasAction) 3671 { 3672 BX.bind(this.LINK, 'click', BX.delegate(this.__click, this)); 3673 } 3674}; 3675 3676BX.CMenuOpenerItem.prototype.Get = function() {return this.DIV;}; 3677BX.CMenuOpenerItem.prototype.__msover = function() { 3678 this.bx_hover = true; 3679 if (!this._menu_open) 3680 BX.addClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-hover'); 3681}; 3682BX.CMenuOpenerItem.prototype.__msout = function() { 3683 this.bx_hover = false;
3684 if (!this._menu_open) 3685 BX.removeClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-hover bx-context-toolbar-button-active'); 3686}; 3687BX.CMenuOpenerItem.prototype.__msover_text = function() { 3688 this.bx_hover = true; 3689 if (!this._menu_open) 3690 BX.addClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-text-hover'); 3691}; 3692BX.CMenuOpenerItem.prototype.__msout_text = function() { 3693 this.bx_hover = false; 3694 if (!this._menu_open) 3695 BX.removeClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-text-hover bx-context-toolbar-button-text-active'); 3696}; 3697BX.CMenuOpenerItem.prototype.__msover_arrow = function() { 3698 this.bx_hover = true; 3699 if (!this._menu_open) 3700 BX.addClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-arrow-hover'); 3701}; 3702BX.CMenuOpenerItem.prototype.__msout_arrow = function() { 3703 this.bx_hover = false; 3704 if (!this._menu_open) 3705 BX.removeClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-arrow-hover bx-context-toolbar-button-arrow-active'); 3706}; 3707BX.CMenuOpenerItem.prototype.__msdown = function() { 3708 this.bx_active = true; 3709 if (!this._menu_open) 3710 BX.addClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-active'); 3711}; 3712BX.CMenuOpenerItem.prototype.__msdown_text = function() { 3713 this.bx_active = true; 3714 if (!this._menu_open) 3715 BX.addClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-text-active'); 3716}; 3717BX.CMenuOpenerItem.prototype.__msdown_arrow = function() { 3718 this.bx_active = true; 3719 if (!this._menu_open) 3720 BX.addClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-arrow-active'); 3721}; 3722BX.CMenuOpenerItem.prototype.__menu_close = function() { 3723 3724 this._menu_open = false; 3725 this.bx_active = false; 3726 BX.removeClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-active bx-context-toolbar-button-text-active bx-context-toolbar-button-arrow-active'); 3727 if (!this.bx_hover) 3728 { 3729 BX.removeClass(this.LINK.parentNode.parentNode, 'bx-context-toolbar-button-hover bx-context-toolbar-button-text-hover bx-context-toolbar-button-arrow-hover'); 3730 this.bx_hover = false; 3731 } 3732}; 3733BX.CMenuOpenerItem.prototype.__menu_open = function() { 3734 this._menu_open = true; 3735}; 3736 3737BX.CMenuOpenerItem.prototype.__click = function() {BX.evalGlobal(this.item.ONCLICK)}; 3738 3739/* global page opener class */ 3740BX.CPageOpener = function(arParams) 3741{ 3742 //if (null == arParams.pin) arParams.pin = true; 3743 BX.CPageOpener.superclass.constructor.apply(this, arguments); 3744 3745 this.timeout = 505; 3746 3747 window.PAGE_EDIT_CONTROL = this; 3748}; 3749BX.extend(BX.CPageOpener, BX.CMenuOpener); 3750 3751BX.CPageOpener.prototype.checkPosition = function() 3752{ 3753 if (/*this.isMenuVisible() || this.DIV.style.display == 'none' || */this == BX.proxy_context) 3754 return; 3755 3756 this.correctPosition(BX.proxy_context); 3757}; 3758 3759BX.CPageOpener.prototype.correctPosition = function(opener) 3760{ 3761 if (this.bPosCorrected) return; 3762 var pos_self; 3763 if (this.DIV.style.display == 'none') 3764 { 3765 pos_self = this.adjustToNodeGetPos(); 3766 pos_self.bottom = pos_self.top + 30; 3767 pos_self.right = pos_self.left + 300; 3768 } 3769 else 3770 { 3771 pos_self = BX.pos(this.DIV); 3772 } 3773 3774 var pos_other = BX.pos(opener.Get()); 3775 if (this.__check_intersection(pos_self, pos_other)) 3776 { 3777 this.DIV.style.display = 'none'; 3778 3779 var handler = BX.proxy(this.restorePosition, this); 3780 3781 BX.removeCustomEvent(opener, 'onMenuOpenerHide', handler); 3782 BX.addCustomEvent(opener, 'onMenuOpenerHide', handler); 3783 3784 this.bPosCorrected = true; 3785 } 3786}; 3787 3788BX.CPageOpener.prototype.restorePosition = function() 3789{ 3790 if (BX.proxy_context && BX.proxy_context.Get().style.display == 'none') 3791 { 3792 this.bPosCorrected = false; 3793 3794 if (this.PARAMS.parent.bx_over || this.PARAMS.pin) 3795 this.UnHide(); 3796 3797 BX.removeCustomEvent('onMenuOpenerHide', BX.proxy(this.restorePosition, this)); 3798 } 3799}; 3800 3801BX.CPageOpener.prototype.UnHide = function() 3802{ 3803 if (!this.bPosCorrected) 3804 BX.CPageOpener.superclass.UnHide.apply(this, arguments); 3805}; 3806 3807BX.CPageOpener.prototype.Remove = function() 3808{ 3809 BX.admin.removeComponentBorder(this.PARAMS.parent); 3810 BX.userOptions.save('global', 'settings', 'page_edit_control_enable', 'N'); 3811 this.DIV.style.display = 'none'; 3812}; 3813 3814/******* HINT ***************/ 3815BX.CHintSimple = function() 3816{ 3817 BX.CHintSimple.superclass.constructor.apply(this, arguments); 3818}; 3819BX.extend(BX.CHintSimple, BX.CHint); 3820 3821BX.CHintSimple.prototype.Init = function() 3822{ 3823 this.DIV = document.body.appendChild(BX.create('DIV', {props: {className: 'bx-tooltip-simple'}, style: {display: 'none'}, children: [(this.CONTENT = BX.create('DIV'))]})); 3824 3825 BX.ZIndexManager.register(this.DIV); 3826 3827 if (this.HINT_TITLE) 3828 this.CONTENT.appendChild(BX.create('B', {text: this.HINT_TITLE})); 3829 3830 if (this.HINT) 3831 this.CONTENT_TEXT = this.CONTENT.appendChild(BX.create('DIV')).appendChild(BX.create('SPAN', {html: this.HINT})); 3832 3833 if (this.PARAMS.preventHide) 3834 { 3835 BX.bind(this.DIV, 'mouseout', BX.proxy(this.Hide, this)); 3836 BX.bind(this.DIV, 'mouseover', BX.proxy(this.Show, this)); 3837 } 3838 3839 this.bInited = true; 3840}; 3841 3842/*************************** admin informer **********************************/ 3843BX.adminInformer = { 3844 3845 itemsShow: 3, 3846 3847 Init: function (itemsShow) 3848 { 3849 if(itemsShow) 3850 BX.adminInformer.itemsShow = itemsShow; 3851 3852 var informer = BX("admin-informer"); 3853 3854 if(informer) 3855 { 3856 document.body.appendChild(informer); 3857 BX.ZIndexManager.register(informer); 3858 } 3859 3860 BX.addCustomEvent("onTopPanelCollapse", BX.proxy(BX.adminInformer.Close, BX.adminInformer)); 3861 }, 3862 3863 Toggle: function(notifyBlock) 3864 { 3865 var informer = BX("admin-informer"); 3866 3867 if(!informer) 3868 return false;
3869 3870 var pos = BX.pos(notifyBlock); 3871 3872 informer.style.top = (parseInt(pos.top)+parseInt(pos.height)+7)+'px'; 3873 informer.style.left = pos.left+'px'; 3874 3875 if(!BX.hasClass(informer, "adm-informer-active")) 3876 BX.adminInformer.Show(informer); 3877 else 3878 BX.adminInformer.Hide(informer); 3879 3880 return false; 3881 }, 3882 3883 Close: function() 3884 { 3885 BX.adminInformer.Hide(BX("admin-informer")); 3886 }, 3887 3888 OnInnerClick: function(event) 3889 { 3890 var target = event.target || event.srcElement; 3891 3892 if(target.nodeName.toLowerCase() != 'a' || BX.hasClass(target,"adm-informer-footer")) 3893 { 3894 return BX.PreventDefault(event); 3895 } 3896 3897 return true; 3898 }, 3899 3900 ToggleExtra : function() 3901 { 3902 var footerLink = BX("adm-informer-footer"); 3903 3904 if (BX.hasClass(footerLink, "adm-informer-footer-collapsed")) 3905 this.ShowAll(); 3906 else 3907 this.HideExtra(); 3908 3909 return false; 3910 }, 3911 3912 ShowAll: function() 3913 { 3914 var informer = BX("admin-informer"); 3915 for(var i=0; i<informer.children.length; i++) 3916 3917 if(BX.hasClass(informer.children[i], "adm-informer-item") && informer.children[i].style.display == "none") { 3918 informer.children[i].style.display = "block"; 3919 } 3920 3921 var footerLink = BX("adm-informer-footer"); 3922 3923 if(footerLink.textContent !== undefined) 3924 footerLink.textContent = BX.message('JSADM_AI_HIDE_EXTRA'); 3925 else 3926 footerLink.innerText = BX.message('JSADM_AI_HIDE_EXTRA'); 3927 3928 BX.removeClass(footerLink, "adm-informer-footer-collapsed"); 3929 3930 return false; 3931 }, 3932 3933 HideExtra: function() 3934 { 3935 var informer = BX("admin-informer"); 3936 var hided = 0; 3937 3938 for(var i=BX.adminInformer.itemsShow+1; i<informer.children.length; i++) 3939 { 3940 if (BX.hasClass(informer.children[i], "adm-informer-item") && informer.children[i].style.display == "block") { 3941 informer.children[i].style.display = "none"; 3942 hided++; 3943 } 3944 } 3945 3946 var footerLink = BX("adm-informer-footer"); 3947 3948 var linkText = BX.message('JSADM_AI_ALL_NOTIF')+" ("+(BX.adminInformer.itemsShow+parseInt(hided))+")"; 3949 3950 if(footerLink.textContent !== undefined) 3951 footerLink.textContent = linkText; 3952 else 3953 footerLink.innerText = linkText; 3954 3955 BX.addClass(footerLink, "adm-informer-footer-collapsed"); 3956 3957 return false; 3958 }, 3959 3960 Show: function(informer) 3961 { 3962 var notifButton = BX("adm-header-notif-block"); 3963 if (notifButton) 3964 BX.addClass(notifButton, "adm-header-notif-block-active"); 3965 3966 BX.onCustomEvent(informer, 'onBeforeAdminInformerShow'); 3967 setTimeout( 3968 BX.proxy(function() { 3969 BX.bind(document, "click", BX.proxy(BX.adminInformer.Close, BX.adminInformer)); 3970 }, 3971 BX.adminInformer 3972 ),0 3973 ); 3974 BX.addClass(informer, "adm-informer-active"); 3975 3976 BX.ZIndexManager.bringToFront(informer); 3977 3978 setTimeout(function() {BX.addClass(informer, "adm-informer-animate");},0); 3979 }, 3980 3981 Hide: function(informer) 3982 { 3983 var notifButton = BX("adm-header-notif-block"); 3984 if (notifButton) 3985 BX.removeClass(notifButton, "adm-header-notif-block-active"); 3986 3987 BX.unbind(document, "click", BX.proxy(BX.adminInformer.Close, BX.adminInformer)); 3988 3989 BX.removeClass(informer, "adm-informer-animate"); 3990 3991 if (this.IsAnimationSupported()) 3992 setTimeout(function() {BX.removeClass(informer, "adm-informer-active");}, 300); 3993 else 3994 BX.removeClass(informer, "adm-informer-active"); 3995 3996 BX.onCustomEvent(informer, 'onAdminInformerHide'); 3997 //setTimeout(function() {BX.adminInformer.HideExtra();},500); 3998 }, 3999 4000 IsAnimationSupported : function() 4001 { 4002 var d = document.body || document.documentElement; 4003 if (typeof(d.style.transition) == "string") 4004 return true; 4005 else if (typeof(d.style.MozTransition) == "string") 4006 return true; 4007 else if (typeof(d.style.OTransition) == "string") 4008 return true; 4009 else if (typeof(d.style.WebkitTransition) == "string") 4010 return true; 4011 else if (typeof(d.style.msTransition) == "string") 4012 return true; 4013 4014 return false; 4015 }, 4016 4017 4018 SetItemHtml: function(itemIdx, html) 4019 { 4020 var itemHtmlDiv = BX("adm-informer-item-html-"+itemIdx); 4021 4022 if(!itemHtmlDiv) 4023 return false; 4024 4025 itemHtmlDiv.innerHTML = html; 4026 4027 return true; 4028 }, 4029 4030 SetItemFooter: function(itemIdx, html) 4031 { 4032 var itemFooterDiv = BX("adm-informer-item-footer-"+itemIdx); 4033 4034 if(!itemFooterDiv) 4035 return false; 4036 4037 itemFooterDiv.innerHTML = html; 4038 4039 if(html) 4040 itemFooterDiv.style.display = "block"; 4041 else 4042 itemFooterDiv.style.display = "none"; 4043 4044 return true; 4045 } 4046 4047}; 4048 4049}
4049)(window); 4050 4051 4052/* End */ 4053; 4054; /* Start:"a:4:{s:4:"full";s:45:"/bitrix/js/main/session.min.js?17131969962394";s:6:"source";s:26:"/bitrix/js/main/session.js";s:3:"min";s:30:"/bitrix/js/main/session.min.js";s:3:"map";s:30:"/bitrix/js/main/session.map.js";}"*/ 4055function CBXSession(){var e=this;this.dateInput=new Date;this.dateCheck=new Date;this.dateHit=new Date;this.notifier=null;this.checkInterval=60;this.checkImmediately=false;this.Expand=function(t){this.key=t;BX.ready(function(){BX.bind(document,"keypress",e.OnUserInput);BX.bind(document.body,"mousemove",e.OnUserInput);BX.bind(document.body,"click",e.OnUserInput);setInterval(e.CheckSession,e.checkInterval*1e3)})};this.OnUserInput=function(){var t=new Date;e.dateInput.setTime(t.valueOf());if((t-e.dateHit)/1e3>e.checkInterval+5&&e.checkImmediately===false){e.checkImmediately=true;e.CheckSession()}};this.CheckSession=function(){var t=new Date;if((t-e.dateCheck)/1e3<e.checkInterval-1&&e.checkImmediately===false){return}e.dateCheck.setTime(t.valueOf());if(e.dateInput>e.dateHit){var i={method:"GET",headers:[{name:"X-Bitrix-Csrf-Token",value:BX.bitrix_sessid()}],dataType:"html",url:"/bitrix/tools/public_session.php?k="+e.key,data:"",onsuccess:function(t){e.CheckResult(t)},lsId:"sess_expand",lsTimeout:e.checkInterval-5};BX.ajax(i)}};this.CheckResult=function(t){var i=new Date;e.dateHit.setTime(i.valueOf());e.checkImmediately=false;if(t=="SESSION_EXPIRED"){if(BX.message("SessExpired")){if(!e.notifier){e.notifier=document.body.appendChild(BX.create("DIV",{props:{className:"bx-session-message"},style:{top:"0",backgroundColor:"#FFEB41",border:"1px solid #EDDA3C",width:"630px",fontFamily:"Arial,Helvetica,sans-serif",fontSize:"13px",fontWeight:"bold",textAlign:"center",color:"black",position:"absolute",zIndex:"10000",padding:"10px"},html:'<a class="bx-session-message-close" '+'style="display:block; width:12px; height:12px; background:url(/bitrix/js/main/core/images/close.gif) center no-repeat; float:right;" '+'href="javascript:bxSession.Close()"></a>'+BX.message("SessExpired")}));BX.ZIndexManager.register(e.notifier);BX.ZIndexManager.bringToFront(e.notifier);var s=BX.GetWindowScrollPos();var n=BX.GetWindowInnerSize();e.notifier.style.left=parseInt(s.scrollLeft+n.innerWidth/2-parseInt(e.notifier.clientWidth)/2)+"px";if(BX.browser.IsIE()){e.notifier.style.top=s.scrollTop+"px";BX.bind(window,"scroll",function(){var t=BX.GetWindowScrollPos();e.notifier.style.top=t.scrollTop+"px"})}else{e.notifier.style.position="fixed"}}e.notifier.style.display=""}}};this.Close=function(){this.notifier.style.display="none"}}var bxSession=new CBXSession; 4056/* End */ 4057; 4058; /* Start:"a:4:{s:4:"full";s:44:"/bitrix/js/main/utils.min.js?171319699618721";s:6:"source";s:24:"/bitrix/js/main/utils.js";s:3:"min";s:28:"/bitrix/js/main/utils.min.js";s:3:"map";s:28:"/bitrix/js/main/utils.map.js";}"*/ 4059var phpVars;if(!phpVars){phpVars={ADMIN_THEME_ID:".default",LANGUAGE_ID:"en",FORMAT_DATE:"DD.MM.YYYY",FORMAT_DATETIME:"DD.MM.YYYY HH:MI:SS",opt_context_ctrl:false,cookiePrefix:"BITRIX_SM",titlePrefix:"",bitrix_sessid:"",messHideMenu:"",messShowMenu:"",messHideButtons:"",messShowButtons:"",messFilterInactive:"",messFilterActive:"",messFilterLess:"",messLoading:"Loading...",messMenuLoading:"",messMenuLoadingTitle:"",messNoData:"",messExpandTabs:"",messCollapseTabs:"",messPanelFixOn:"",messPanelFixOff:"",messPanelCollapse:"",messPanelExpand:""}}var jsUtils={arEvents:Array(),addEvent:function(e,t,n,i){if(e.attachEvent)e.attachEvent("on"+t,n);else if(e.addEventListener)e.addEventListener(t,n,false);else e["on"+t]=n;this.arEvents[this.arEvents.length]={element:e,event:t,fn:n}},removeEvent:function(e,t,n){if(e.detachEvent)e.detachEvent("on"+t,n);else if(e.removeEventListener)e.removeEventListener(t,n,false);else e["on"+t]=null},removeAllEvents:function(e){var t;for(t=0;t<this.arEvents.length;t++){if(this.arEvents[t]&&(e==false||e==this.arEvents[t].element)){jsUtils.removeEvent(this.arEvents[t].element,this.arEvents[t].event,this.arEvents[t].fn);this.arEvents[t]=null}}if(e==false)this.arEvents.length=0},IsDoctype:function(){if(document.compatMode)return document.compatMode=="CSS1Compat";
4059if(document.documentElement&&document.documentElement.clientHeight)return true;return false},GetRealPos:function(e){if(window.BX)return BX.pos(e);if(!e||!e.offsetParent)return false;var t=Array();t["left"]=e.offsetLeft;t["top"]=e.offsetTop;var n=e.offsetParent;while(n&&n.tagName!="BODY"){t["left"]+=n.offsetLeft;t["top"]+=n.offsetTop;n=n.offsetParent}t["right"]=t["left"]+e.offsetWidth;t["bottom"]=t["top"]+e.offsetHeight;return t},FindChildObject:function(e,t,n,i){if(!e)return null;var o=t.toUpperCase();var r=n?n.toLowerCase():null;var s=e.childNodes.length;for(var l=0;l<s;l++){var a=e.childNodes[l];if(a.tagName&&a.tagName.toUpperCase()==o)if(!n||a.className.toLowerCase()==r)return a;if(i==true){var f;if(f=jsUtils.FindChildObject(a,t,n,true))return f}}return null},FindParentObject:function(e,t,n){if(!e)return null;var i=e;var o=t.toUpperCase();var r=n?n.toLowerCase():null;while(i.parentNode){var s=i.parentNode;if(s.tagName&&s.tagName.toUpperCase()==o)if(!n||s.className.toLowerCase()==r)return s;i=s}return null},FindNextSibling:function(e,t){if(!e)return null;var n=e;var i=t.toUpperCase();while(n.nextSibling){var o=n.nextSibling;if(o.tagName&&o.tagName.toUpperCase()==i)return o;n=o}return null},FindPreviousSibling:function(e,t){if(!e)return null;var n=e;var i=t.toUpperCase();while(n.previousSibling){var o=n.previousSibling;if(o.tagName&&o.tagName.toUpperCase()==i)return o;n=o}return null},bOpera:navigator.userAgent.toLowerCase().indexOf("opera")!=-1,bIsIE:document.attachEvent&&navigator.userAgent.toLowerCase().indexOf("opera")==-1,IsIE:function(){return this.bIsIE},IsOpera:function(){return this.bOpera},IsSafari:function(){var e=navigator.userAgent.toLowerCase();return/webkit/.test(e)},IsEditor:function(){var e=navigator.userAgent.toLowerCase();var t=(e.match(/.+(msie)[\/: ]([\d.]+)/)||[])[2];var n=/webkit/.test(e);if(this.IsOpera()||document.all&&!document.compatMode&&t<6||n)return false;return true},ToggleDiv:function(e){var t=document.getElementById(e).style;if(t.display!="none")t.display="none";else t.display="block";return t.display!="none"},urlencode:function(e){return escape(e).replace(new RegExp("\\+","g"),"%2B")},OpenWindow:function(e,t,n){var i=screen.width,o=screen.height;if(this.IsOpera()){i=document.body.offsetWidth;o=document.body.offsetHeight}window.open(e,"","status=no,scrollbars=yes,resizable=yes,width="+t+",height="+n+",top="+Math.floor((o-n)/2-14)+",left="+Math.floor((i-t)/2-5))},SetPageTitle:function(e){document.title=phpVars.titlePrefix+e;var t=document.getElementsByTagName("H1");if(t)t[0].innerHTML=e},LoadPageToDiv:function(e,t){var n=document.getElementById(t);if(!n)return;CHttpRequest.Action=function(e){CloseWaitWindow();document.getElementById(t).innerHTML=e};ShowWaitWindow();CHttpRequest.Send(e)},trim:function(e){if(typeof e=="string"||typeof e=="object"&&e.constructor==String){var t,n;n=/^[\s\r\n]+/g;t=e.replace(n,"");n=/[\s\r\n]+$/g;t=t.replace(n,"");return t}else return e},Redirect:function(e,t){var n=null,i=false;if(e&&e.length>0)n=e[0];if(!n)n=window.event;if(n)i=n.shiftKey;if(i)window.open(t);else{window.location.href=t}},False:function(){return false},AlignToPos:function(e,t,n){var i=e["left"],o=e["bottom"];var r=jsUtils.GetWindowScrollPos();var s=jsUtils.GetWindowInnerSize();if(s.innerWidth+r.scrollLeft-(e["left"]+t)<0){if(e["right"]-t>=0)i=e["right"]-t;else i=r.scrollLeft}if(s.innerHeight+r.scrollTop-(e["bottom"]+n)<0){if(e["top"]-n>=0)o=e["top"]-n;else o=r.scrollTop}return{left:i,top:o}},EvalGlobal:function(e){try{if(window.execScript)window.execScript(e,"javascript");else if(jsUtils.IsSafari())window.setTimeout(e,0);else window.eval(e)}catch(e){}},GetStyleValue:function(e,t){var n;if(e.currentStyle)n=e.currentStyle[t];else if(window.getComputedStyle)n=document.defaultView.getComputedStyle(e,null).getPropertyValue(t);if(!n)n="";return n},GetWindowInnerSize:function(e){var t,n;if(!e)e=document;if(self.innerHeight){t=self.innerWidth;n=self.innerHeight}else if(e.documentElement&&(e.documentElement.clientHeight||e.documentElement.clientWidth)){t=e.documentElement.clientWidth;n=e.documentElement.clientHeight}else if(e.body){t=e.body.clientWidth;n=e.body.clientHeight}
4059return{innerWidth:t,innerHeight:n}},GetWindowScrollPos:function(e){var t,n;if(!e)e=document;if(self.pageYOffset){t=self.pageXOffset;n=self.pageYOffset}else if(e.documentElement&&(e.documentElement.scrollTop||e.documentElement.scrollLeft)){t=document.documentElement.scrollLeft;n=document.documentElement.scrollTop}else if(e.body){t=e.body.scrollLeft;n=e.body.scrollTop}return{scrollLeft:t,scrollTop:n}},GetWindowScrollSize:function(e){var t,n;if(!e)e=document;if(e.compatMode&&e.compatMode=="CSS1Compat"){t=e.documentElement.scrollWidth;n=e.documentElement.scrollHeight}else{if(e.body.scrollHeight>e.body.offsetHeight)n=e.body.scrollHeight;else n=e.body.offsetHeight;if(e.body.scrollWidth>e.body.offsetWidth||e.compatMode&&e.compatMode=="BackCompat"||e.documentElement&&!e.documentElement.clientWidth)t=e.body.scrollWidth;else t=e.body.offsetWidth}return{scrollWidth:t,scrollHeight:n}},GetWindowSize:function(){var e=jsUtils.GetWindowInnerSize();var t=jsUtils.GetWindowScrollPos();var n=jsUtils.GetWindowScrollSize();return{innerWidth:e.innerWidth,innerHeight:e.innerHeight,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,scrollWidth:n.scrollWidth,scrollHeight:n.scrollHeight}},arCustomEvents:{},addCustomEvent:function(e,t,n,i){if(!this.arCustomEvents[e])this.arCustomEvents[e]=[];if(!n)n=[];if(!i)i=false;this.arCustomEvents[e].push({handler:t,arParams:n,obj:i})},removeCustomEvent:function(e,t){if(!this.arCustomEvents[e])return;var n=this.arCustomEvents[e].length;if(n==1){delete this.arCustomEvents[e];return}for(var i=0;i<n;i++){if(!this.arCustomEvents[e][i])continue;if(this.arCustomEvents[e][i].handler==t){delete this.arCustomEvents[e][i];return}}},onCustomEvent:function(e,t){if(!this.arCustomEvents[e])return;if(!t)t=[];var n;for(var i=0,o=this.arCustomEvents[e].length;i<o;i++){n=this.arCustomEvents[e][i];if(!n||!n.handler)continue;if(n.obj)n.handler.call(n.obj,n.arParams,t);else n.handler(n.arParams,t)}},loadJSFile:function(e,t,n){if(!n)n=document;if(typeof e=="string")e=[e];var i=function(){if(!t)return;if(typeof t=="function")return t();if(typeof t!="object"||!t.func)return;var e=t.params||{};if(t.obj)t.func.apply(t.obj,e);else t.func(e)};var o=function(t){if(t>=e.length)return i();var r=n.body.appendChild(n.createElement("script"));r.src=e[t];var s=false;r.onload=r.onreadystatechange=function(){if(!s&&(!r.readyState||r.readyState=="loaded"||r.readyState=="complete")){s=true;setTimeout(function(){o(++t)},50)}}};o(0)},loadCSSFile:function(e,t,n){if(typeof e=="string"){var i=true;e=[e]}var o,r=e.length,s=[];if(r==0)return;if(!t)t=document;if(!n)n=window;if(!n.bxhead){var l=t.getElementsByTagName("HEAD");n.bxhead=l[0]}if(!n.bxhead)return;for(o=0;o<r;o++){var a=document.createElement("LINK");a.href=e[o];a.rel="stylesheet";a.type="text/css";n.bxhead.appendChild(a);s.push(a)}if(i)return a;return s},appendBXHint:function(e,t){if(!e||!e.parentNode||!t)return;var n=new BXHint(t);e.parentNode.insertBefore(n.oIcon,e);e.parentNode.removeChild(e);n.oIcon.style.marginLeft="5px"},PreventDefault:function(e){if(!e)e=window.event;if(e.stopPropagation){e.preventDefault();e.stopPropagation()}else{e.cancelBubble=true;e.returnValue=false}return false},CreateElement:function(e,t,n,i){if(!i)i=document;var o=i.createElement(e),r;if(t){for(r in t){if(r=="className"||r=="class"){o.setAttribute("class",t[r]);if(jsUtils.IsIE())o.setAttribute("className",t[r]);continue}if(t[r]!=undefined&&t[r]!=null)o.setAttribute(r,t[r])}}if(n){for(r in n)o.style[r]=n[r]}return o},in_array:function(e,t){for(var n=0;n<t.length;n++){if(t[n]==e)return true}return false},htmlspecialchars:function(e){if(!e.replace)return e;return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}};function JCFloatDiv(){var e=this;this.floatDiv=null;this.x=this.y=0;this.Create=function(e){var t=document.body.appendChild(document.createElement("DIV"));t.id=e.id;t.style.position="absolute";t.style.left="-10000px";t.style.top="-10000px";if(e.className)t.className=e.className;if(e.zIndex)t.style.zIndex=e.zIndex;if(e.width)t.style.width=e.width+"px";if(e.height)t.style.height=e.height+"px";return t};this.Show=function(e,t,n,i,o){var r=BX.ZIndexManager.getComponent(e);
4059if(!r){BX.ZIndexManager.register(e)}BX.ZIndexManager.bringToFront(e);if(t<0)t=0;if(n<0)n=0;e.style.left=parseInt(t)+"px";e.style.top=parseInt(n)+"px";e.restrictDrag=o||false;if(isNaN(i))i=5;e.dxShadow=i};this.Close=function(e){if(!e)return;var t=document.getElementById(e.id+"_shadow");if(t)t.style.visibility="hidden";var n=document.getElementById(e.id+"_frame");if(n)n.style.visibility="hidden"};this.Move=function(e,t,n){if(!e)return;var i=e.dxShadow;var o=parseInt(e.style.left)+t;var r=parseInt(e.style.top)+n;if(e.restrictDrag){if(o<0)o=0;if(document.compatMode&&document.compatMode=="CSS1Compat")windowWidth=document.documentElement.scrollWidth;else{if(document.body.scrollWidth>document.body.offsetWidth||document.compatMode&&document.compatMode=="BackCompat"||document.documentElement&&!document.documentElement.clientWidth)windowWidth=document.body.scrollWidth;else windowWidth=document.body.offsetWidth}var s=e.offsetWidth;if(o>windowWidth-s-i)o=windowWidth-s-i;if(r<0)r=0}e.style.left=o+"px";e.style.top=r+"px";this.AdjustShadow(e)};this.HideShadow=function(e){var t=document.getElementById(e.id+"_shadow");t.style.visibility="hidden"};this.UnhideShadow=function(e){var t=document.getElementById(e.id+"_shadow");t.style.visibility="visible"};this.AdjustShadow=function(e){var t=document.getElementById(e.id+"_shadow");if(t&&t.style.visibility!="hidden"){var n=e.dxShadow;t.style.width=e.offsetWidth+"px";t.style.height=e.offsetHeight+"px";t.style.left=parseInt(e.style.left)+n+"px";t.style.top=parseInt(e.style.top)+n+"px"}var i=document.getElementById(e.id+"_frame");if(i){i.style.width=e.offsetWidth+"px";i.style.height=e.offsetHeight+"px";i.style.left=e.style.left;i.style.top=e.style.top}};this.StartDrag=function(t,n){if(!t)t=window.event;this.x=t.clientX+document.body.scrollLeft;this.y=t.clientY+document.body.scrollTop;this.floatDiv=n;jsUtils.addEvent(document,"mousemove",this.MoveDrag);document.onmouseup=this.StopDrag;if(document.body.setCapture)document.body.setCapture();document.onmousedown=jsUtils.False;var i=document.body;i.ondrag=jsUtils.False;i.onselectstart=jsUtils.False;i.style.MozUserSelect=e.floatDiv.style.MozUserSelect="none";i.style.cursor="move"};this.StopDrag=function(t){if(document.body.releaseCapture)document.body.releaseCapture();jsUtils.removeEvent(document,"mousemove",e.MoveDrag);document.onmouseup=null;this.floatDiv=null;document.onmousedown=null;var n=document.body;n.ondrag=null;n.onselectstart=null;n.style.MozUserSelect=e.floatDiv.style.MozUserSelect="";n.style.cursor=""};this.MoveDrag=function(t){var n=t.clientX+document.body.scrollLeft;var i=t.clientY+document.body.scrollTop;if(e.x==n&&e.y==i)return;e.Move(e.floatDiv,n-e.x,i-e.y);e.x=n;e.y=i}}var jsFloatDiv=new JCFloatDiv;var BXHint=function(e,t,n){this.oDivOver=false;this.timeOutID=null;this.oIcon=null;this.freeze=false;this.x=0;this.y=0;this.time=700;if(!e)e="";this.Create(e,t,n)};BXHint.prototype.Create=function(e,t,n){var i=this,o=0,r=0,s=null,l="icon";this.bWidth=true;if(n){if(n.width===false)this.bWidth=false;else if(n.width)o=n.width;if(n.height)r=n.height;if(n.className)s=n.className;if(n.type&&(n.type=="link"||n.type=="icon"))l=n.type;if(n.time>0)this.time=n.time}if(t)l="element";if(l=="icon"){var t=document.createElement("IMG");t.src=n&&n.iconSrc?n.iconSrc:"/bitrix/themes/"+phpVars.ADMIN_THEME_ID+"/public/popup/hint.gif";t.ondrag=jsUtils.False}else if(l=="link"){var t=document.createElement("A");t.href="";t.onclick=function(e){return false};t.innerHTML="[?]"}this.element=t;if(l=="element"){if(n&&n.show_on_click){jsUtils.addEvent(t,"click",function(t){if(!t)t=window.event;i.GetMouseXY(t);i.timeOutID=setTimeout(function(){i.Show(e,o,r,s)},10)})}else{jsUtils.addEvent(t,"mouseover",function(t){if(!t)t=window.event;i.GetMouseXY(t);i.timeOutID=setTimeout(function(){i.Show(e,o,r,s)},750)})}jsUtils.addEvent(t,"mouseout",function(e){if(i.timeOutID)clearTimeout(i.timeOutID);i.SmartHide(i)})}else{this.oIcon=t;t.onmouseover=function(t){if(!t)t=window.event;i.GetMouseXY(t);i.Show(e,o,r,s)};t.onmouseout=function(){i.SmartHide(i)}}};BXHint.prototype.IsFrozen=function(){return this.freeze};BXHint.prototype.Freeze=function(){this.freeze=true;this.Hide()};BXHint.prototype.UnFreeze=function(){this.freeze=false};BXHint.prototype.GetMouseXY=function(e){if(e.pageX||e.pageY){this.x=e.pageX;this.y=e.pageY}else if(e.clientX||e.clientY){this.x=e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-document.documentElement.clientLeft;this.y=e.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-document.documentElement.clientTop}};BXHint.prototype.Show=function(e,t,n,i){var o=document.getElementById("__BXHint_div");if(o)this.Hide();if(this.freeze)return;var r=this;var s=document.body.appendChild(document.createElement("DIV"));s.onmouseover=function(){r.oDivOver=true};s.onmouseout=function(){r.oDivOver=false;r.SmartHide(r)};s.id="__BXHint_div";s.className=i?i:"bxhint";s.style.position="absolute";if(t&&this.bWidth)s.style.width=t+"px";if(n)s.style.height=n+"px";s.innerHTML=e;var l=s.offsetWidth;var a=s.offsetHeight;if(this.bWidth){if(!t&&l>200)l=Math.round(Math.sqrt(1.618*l*a));s.style.width=l+"px";a=s.offsetHeight}var f={left:this.x+10,right:this.x+l,top:this.y,bottom:this.y+a};f=this.AlignToPos(f,l,a);jsFloatDiv.Show(s,f.left,f.top,3);s=null};BXHint.prototype.AlignToPos=function(e,t,n){var i=document.body;if(i.clientWidth+i.scrollLeft<e.left+t)e.left=e.left-t>=0?e.left-t:i.scrollLeft;if(i.clientHeight+i.scrollTop-e["bottom"]<0)e.top=e.top-n>=0?e.top-n:i.scrollTop;return e};BXHint.prototype.Hide=function(){var e=document.getElementById("__BXHint_div");if(!e)return;BX.ZIndexManager.unregister(e);jsFloatDiv.Close(e);e.parentNode.removeChild(e);e=null};BXHint.prototype.SmartHide=function(e){setTimeout(function(){if(!e.oDivOver)e.Hide()},100)};function WaitOnKeyPress(e){if(!e)e=window.event;if(!e)return;if(e.keyCode==27)CloseWaitWindow()}function ShowWaitWindow(){CloseWaitWindow();var e=jsUtils.GetWindowSize();var t=document.body.appendChild(document.createElement("DIV"));t.id="wait_window_div";t.innerHTML=phpVars.messLoading;t.className="waitwindow";t.style.right=5-e.scrollLeft+"px";t.style.top=e.scrollTop+5+"px";
4059if(jsUtils.IsIE()){var n=document.createElement("IFRAME");n.src="javascript:''";n.id="wait_window_frame";n.className="waitwindow";n.style.width=t.offsetWidth+"px";n.style.height=t.offsetHeight+"px";n.style.right=t.style.right;n.style.top=t.style.top;document.body.appendChild(n)}jsUtils.addEvent(document,"keypress",WaitOnKeyPress)}function CloseWaitWindow(){jsUtils.removeEvent(document,"keypress",WaitOnKeyPress);var e=document.getElementById("wait_window_frame");if(e)e.parentNode.removeChild(e);var t=document.getElementById("wait_window_div");if(t)t.parentNode.removeChild(t)}var jsSelectUtils={addNewOption:function(e,t,n,i,o){var r=typeof e=="string"||e instanceof String?document.getElementById(e):e;if(r){var s=r.length;if(o!==false){for(var l=0;l<s;l++)if(r[l].value==t)return}var a=new Option(n,t,false,false);r.options[s]=a}if(i===true)this.sortSelect(e)},deleteOption:function(e,t){var n=typeof e=="string"||e instanceof String?document.getElementById(e):e;if(n){for(var i=0;i<n.length;i++)if(n[i].value==t){n.remove(i);break}}},deleteSelectedOptions:function(e){var t=typeof e=="string"||e instanceof String?document.getElementById(e):e;if(t){var n=0;while(n<t.length)if(t[n].selected){t[n].selected=false;t.remove(n)}else n++}},deleteAllOptions:function(e){if(e){for(var t=e.length-1;t>=0;t--)e.remove(t)}},optionCompare:function(e,t){var n=e.optText.toLowerCase();var i=t.optText.toLowerCase();if(n>i)return 1;if(n<i)return-1;return 0},sortSelect:function(e){var t=typeof e=="string"||e instanceof String?document.getElementById(e):e;if(t){var n=[];var i=t.options.length;for(var o=0;o<i;o++){n[o]={optText:t[o].text,optValue:t[o].value}}n.sort(this.optionCompare);t.length=0;i=n.length;for(var o=0;o<i;o++){var r=new Option(n[o].optText,n[o].optValue,false,false);t[o]=r}}},selectAllOptions:function(e){var t=typeof e=="string"||e instanceof String?document.getElementById(e):e;if(t){var n=t.length;for(var i=0;i<n;i++)t[i].selected=true}},selectOption:function(e,t){var n=typeof e=="string"||e instanceof String?document.getElementById(e):e;if(n){var i=n.length;for(var o=0;o<i;o++)n[o].selected=n[o].value==t}},addSelectedOptions:function(e,t,n,i){if(!e)return;var o=e.length;for(var r=0;r<o;r++)if(e[r].selected)this.addNewOption(t,e[r].value,e[r].text,i,n)},moveOptionsUp:function(e){if(!e)return;var t=e.length;for(var n=0;n<t;n++){if(e[n].selected&&n>0&&e[n-1].selected==false){var i=new Option(e[n].text,e[n].value);var o=new Option(e[n-1].text,e[n-1].value);e[n]=o;e[n].selected=false;e[n-1]=i;e[n-1].selected=true}}},moveOptionsDown:function(e){if(!e)return;var t=e.length;for(var n=t-1;n>=0;n--){if(e[n].selected&&n<t-1&&e[n+1].selected==false){var i=new Option(e[n].text,e[n].value);var o=new Option(e[n+1].text,e[n+1].value);e[n]=o;e[n].selected=false;e[n+1]=i;e[n+1].selected=true}}}}; 4060/* End */ 4061; 4062; /* Start:"a:4:{s:4:"full";s:53:"/bitrix/js/main/date/main.date.min.js?171319699617992";s:6:"source";s:33:"/bitrix/js/main/date/main.date.js";s:3:"min";s:37:"/bitrix/js/main/date/main.date.min.js";s:3:"map";s:37:"/bitrix/js/main/date/main.date.map.js";}"*/ 4063this.BX=this.BX||{};(function(e,t){"use strict";function _(e){if(!t.Type.isStringFilled(e)){return""}return e.replace("YYYY","Y").replace("MMMM","F").replace("MM","m").replace("M","M").replace("DD","d").replace("G","g").replace(/GG/i,"G").replace("H","h").replace(/HH/i,"H").replace("MI","i").replace("SS","s").replace("TT","A").replace("T","a")}const r=new t.Cache.MemoryCache;function s(e){return r.remember(`main.date.format.${e}`,(()=>{let r=t.Extension.getSettings("main.date").get(`formats.${e}`);if(t.Type.isStringFilled(r)&&(e==="FORMAT_DATE"||e==="FORMAT_DATETIME")){r=_(r)}return r}))}let n=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"isAmPmMode",value:function e(t){if(t===true){return this._getMessage("AMPM_MODE")}return this._getMessage("AMPM_MODE")!==false}},{key:"convertToUTC",value:function e(_){if(!t.Type.isDate(_)){return null}return new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate(),_.getHours(),_.getMinutes(),_.getSeconds(),_.getMilliseconds()))}},{key:"getNewDate",value:function e(t){return new Date(this.getBrowserTimestamp(t))}},{key:"getBrowserTimestamp",value:function e(t){t=parseInt(t,10);const _=new Date(t*1e3).getTimezoneOffset()*60;return(parseInt(t,10)+parseInt(this._getMessage("SERVER_TZ_OFFSET"))+_)*1e3}},{key:"getServerTimestamp",value:function e(t){t=parseInt(t,10);const _=new Date(t).getTimezoneOffset()*60;return Math.round(t/1e3-(parseInt(this._getMessage("SERVER_TZ_OFFSET"),10)+parseInt(_,10)))}},{key:"formatLastActivityDate",value:function e(t,_,r){const s=this.isAmPmMode(true);const n=s===this.AM_PM_MODE.LOWER?"g:i a":s===this.AM_PM_MODE.UPPER?"g:i A":"H:i";const a=[["tomorrow","#01#"+n],["now","#02#"],["todayFuture","#03#"+n],["yesterday","#04#"+n],["-",this.convertBitrixFormat(this._getMessage("FORMAT_DATETIME")).replace(/:s/g,"")],["s60","sago"],["i60","iago"],["H5","Hago"],["H24","#03#"+n],["d31","dago"],["m12>1","mago"],["m12>0","dago"],["","#05#"]];let D=this.format(a,t,_,r);let i=null;if((i=/^#(\d+)#(.*)/.exec(D))!=null){switch(i[1]){case"01":D=this._getMessage("FD_LAST_SEEN_TOMORROW").replace("#TIME#",i[2]);break;case"02":D=this._getMessage("FD_LAST_SEEN_NOW");break;case"03":D=this._getMessage("FD_LAST_SEEN_TODAY").replace("#TIME#",i[2]);break;case"04":D=this._getMessage("FD_LAST_SEEN_YESTERDAY").replace("#TIME#",i[2]);break;case"05":D=this._getMessage("FD_LAST_SEEN_MORE_YEAR");break;default:D=i[2];break}}return D}},{key:"_getMessage",value:function e(_){return t.Loc.getMessage(_)}},{key:"parse",value:function e(_,r,s,n){if(t.Type.isStringFilled(_)){
4063if(!s){s=this._getMessage("FORMAT_DATE")}if(!n){n=this._getMessage("FORMAT_DATETIME")}let e="";for(let t=1;t<=12;t++){e=e+"|"+this._getMessage("MON_"+t)}const t=new RegExp("([0-9]+|[a-z]+"+e+")","ig");const a=_.match(t);let D=s.match(/(DD|MI|MMMM|MM|M|YYYY)/gi);const i=[];const o=[];const M={};if(!a){return null}if(a.length>D.length){D=n.match(/(DD|MI|MMMM|MM|M|YYYY|HH|H|SS|TT|T|GG|G)/gi)}for(let e=0,t=a.length;e<t;e++){if(a[e].trim()!==""){i[i.length]=a[e]}}for(let e=0,t=D.length;e<t;e++){if(D[e].trim()!==""){o[o.length]=D[e]}}let O=o.findIndex((e=>e==="MMMM"));if(O>0){i[O]=this.getMonthIndex(i[O]);o[O]="MM"}else{O=o.findIndex((e=>e==="M"));if(O>0){i[O]=this.getMonthIndex(i[O]);o[O]="MM"}}for(let e=0,t=o.length;e<t;e++){const t=o[e].toUpperCase();M[t]=t==="T"||t==="TT"?i[e]:parseInt(i[e],10)}if(M["DD"]>0&&M["MM"]>0&&M["YYYY"]>0){const e=new Date;if(r){e.setUTCDate(1);e.setUTCFullYear(M["YYYY"]);e.setUTCMonth(M["MM"]-1);e.setUTCDate(M["DD"]);e.setUTCHours(0,0,0,0)}else{e.setDate(1);e.setFullYear(M["YYYY"]);e.setMonth(M["MM"]-1);e.setDate(M["DD"]);e.setHours(0,0,0,0)}if((!isNaN(M["HH"])||!isNaN(M["GG"])||!isNaN(M["H"])||!isNaN(M["G"]))&&!isNaN(M["MI"])){if(!isNaN(M["H"])||!isNaN(M["G"])){const e=(M["T"]||M["TT"]||"am").toUpperCase()==="PM",t=parseInt(M["H"]||M["G"]||0,10);if(e){M["HH"]=t+(t===12?0:12)}else{M["HH"]=t<12?t:0}}else{M["HH"]=parseInt(M["HH"]||M["GG"]||0,10)}if(isNaN(M["SS"])){M["SS"]=0}if(r){e.setUTCHours(M["HH"],M["MI"],M["SS"])}else{e.setHours(M["HH"],M["MI"],M["SS"])}}return e}}return null}},{key:"getMonthIndex",value:function e(t){const _=t.toUpperCase();const r=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"];const s=["january","february","march","april","may","june","july","august","september","october","november","december"];for(let e=1;e<=12;e++){if(_===this._getMessage("MON_"+e).toUpperCase()||_===this._getMessage("MONTH_"+e).toUpperCase()||_===r[e-1].toUpperCase()||_===s[e-1].toUpperCase()){return e}}return t}},{key:"format",value:function e(_,r,s,n){const a=t.Type.isDate(r)?new Date(r.getTime()):t.Type.isNumber(r)?new Date(r*1e3):new Date;const D=t.Type.isDate(s)?new Date(s.getTime()):t.Type.isNumber(s)?new Date(s*1e3):new Date;const i=!!n;const o=this;if(t.Type.isArray(_)){return l(_,a,D,i)}else{if(!t.Type.isStringFilled(_)){return""}}const M=(_.match(/{{([^{}]*)}}/g)||[]).map((e=>(e.match(/[^{}]+/)||[""])[0]));if(M.length>0){M.forEach(((e,t)=>{_=_.replace("{{"+e+"}}","{{"+t+"}}")}))}const O=/\\?(sago|iago|isago|Hago|dago|mago|Yago|sdiff|idiff|Hdiff|ddiff|mdiff|Ydiff|sshort|ishort|Hshort|dshort|mhort|Yshort|yesterday|today|tommorow|tomorrow|[a-z])/gi;const T={d:()=>u(a).toString().padStart(2,"0"),D:()=>this._getMessage("DOW_"+S(a)),j:()=>u(a),l:()=>this._getMessage("DAY_OF_WEEK_"+S(a)),N:()=>S(a)||7,S:()=>{if(u(a)%10==1&&u(a)!=11){return"st"}else if(u(a)%10==2&&u(a)!=12){return"nd"}else if(u(a)%10==3&&u(a)!=13){return"rd"}else{return"th"}},w:()=>S(a),z:()=>{const e=new Date(c(a),0,1);const t=new Date(c(a),F(a),u(a));return Math.ceil((t-e)/(24*3600*1e3))},W:()=>{const e=new Date(a.getTime());const t=(S(a)+6)%7;A(e,u(e)-t+3);const _=e.getTime();H(e,0,1);if(S(e)!=4){H(e,0,1+(4-S(e)+7)%7)}const r=1+Math.ceil((_-e)/(7*24*3600*1e3));return r.toString().padStart(2,"0")},F:()=>this._getMessage("MONTH_"+(F(a)+1)+"_S"),f:()=>this._getMessage("MONTH_"+(F(a)+1)),m:()=>(F(a)+1).toString().padStart(2,"0"),M:()=>this._getMessage("MON_"+(F(a)+1)),n:()=>F(a)+1,t:()=>{const e=i?new Date(Date.UTC(c(a),F(a)+1,0)):new Date(c(a),F(a)+1,0);return u(e)},L:()=>{const e=c(a);return e%4==0&&e%100!=0||e%400==0?1:0},o:()=>{const e=new Date(a.getTime());A(e,u(e)-(S(a)+6)%7+3);return c(e)},Y:()=>c(a),y:()=>c(a).toString().slice(2),a:()=>E(a)>11?"pm":"am",A:()=>E(a)>11?"PM":"AM",B:()=>{const e=(a.getUTCHours()+1)%24+a.getUTCMinutes()/60+a.getUTCSeconds()/3600;return Math.floor(e*1e3/24).toString().padStart(3,"0")},g:()=>E(a)%12||12,G:()=>E(a),h:()=>(E(a)%12||12).toString().padStart(2,"0"),H:()=>E(a).toString().padStart(2,"0"),i:()=>m(a).toString().padStart(2,"0"),s:()=>R(a).toString().padStart(2,"0"),u:()=>(h(a)*1e3).toString().padStart(6,"0"),e:()=>{if(i){return"UTC"}return""},I:()=>
4063{if(i){return 0}const e=new Date(c(a),0,1);const t=Date.UTC(c(a),0,1);const _=new Date(c(a),6,0);const r=Date.UTC(c(a),6,0);return 0+(e-t!==_-r)},O:()=>{if(i){return"+0000"}const e=a.getTimezoneOffset();const t=Math.abs(e);return(e>0?"-":"+")+(Math.floor(t/60)*100+t%60).toString().padStart(4,"0")},P:function(){if(i){return"+00:00"}const e=this.O();return e.substr(0,3)+":"+e.substr(3)},Z:()=>{if(i){return 0}return-a.getTimezoneOffset()*60},c:()=>"Y-m-d\\TH:i:sP".replace(O,d),r:()=>"D, d M Y H:i:s O".replace(O,d),U:()=>Math.floor(a.getTime()/1e3),sago:()=>p(U((D-a)/1e3),{0:"FD_SECOND_AGO_0",1:"FD_SECOND_AGO_1","10_20":"FD_SECOND_AGO_10_20",MOD_1:"FD_SECOND_AGO_MOD_1",MOD_2_4:"FD_SECOND_AGO_MOD_2_4",MOD_OTHER:"FD_SECOND_AGO_MOD_OTHER"}),sdiff:()=>p(U((D-a)/1e3),{0:"FD_SECOND_DIFF_0",1:"FD_SECOND_DIFF_1","10_20":"FD_SECOND_DIFF_10_20",MOD_1:"FD_SECOND_DIFF_MOD_1",MOD_2_4:"FD_SECOND_DIFF_MOD_2_4",MOD_OTHER:"FD_SECOND_DIFF_MOD_OTHER"}),sshort:()=>this._getMessage("FD_SECOND_SHORT").replace(/#VALUE#/g,U((D-a)/1e3)),iago:()=>p(U((D-a)/60/1e3),{0:"FD_MINUTE_AGO_0",1:"FD_MINUTE_AGO_1","10_20":"FD_MINUTE_AGO_10_20",MOD_1:"FD_MINUTE_AGO_MOD_1",MOD_2_4:"FD_MINUTE_AGO_MOD_2_4",MOD_OTHER:"FD_MINUTE_AGO_MOD_OTHER"}),idiff:()=>p(U((D-a)/60/1e3),{0:"FD_MINUTE_DIFF_0",1:"FD_MINUTE_DIFF_1","10_20":"FD_MINUTE_DIFF_10_20",MOD_1:"FD_MINUTE_DIFF_MOD_1",MOD_2_4:"FD_MINUTE_DIFF_MOD_2_4",MOD_OTHER:"FD_MINUTE_DIFF_MOD_OTHER"}),isago:()=>{const e=U((D-a)/60/1e3);let t=p(e,{0:"FD_MINUTE_0",1:"FD_MINUTE_1","10_20":"FD_MINUTE_10_20",MOD_1:"FD_MINUTE_MOD_1",MOD_2_4:"FD_MINUTE_MOD_2_4",MOD_OTHER:"FD_MINUTE_MOD_OTHER"});t+=" ";const _=U((D-a)/1e3)-e*60;t+=p(_,{0:"FD_SECOND_AGO_0",1:"FD_SECOND_AGO_1","10_20":"FD_SECOND_AGO_10_20",MOD_1:"FD_SECOND_AGO_MOD_1",MOD_2_4:"FD_SECOND_AGO_MOD_2_4",MOD_OTHER:"FD_SECOND_AGO_MOD_OTHER"});return t},ishort:()=>this._getMessage("FD_MINUTE_SHORT").replace(/#VALUE#/g,U((D-a)/60/1e3)),Hago:()=>p(U((D-a)/60/60/1e3),{0:"FD_HOUR_AGO_0",1:"FD_HOUR_AGO_1","10_20":"FD_HOUR_AGO_10_20",MOD_1:"FD_HOUR_AGO_MOD_1",MOD_2_4:"FD_HOUR_AGO_MOD_2_4",MOD_OTHER:"FD_HOUR_AGO_MOD_OTHER"}),Hdiff:()=>p(U((D-a)/60/60/1e3),{0:"FD_HOUR_DIFF_0",1:"FD_HOUR_DIFF_1","10_20":"FD_HOUR_DIFF_10_20",MOD_1:"FD_HOUR_DIFF_MOD_1",MOD_2_4:"FD_HOUR_DIFF_MOD_2_4",MOD_OTHER:"FD_HOUR_DIFF_MOD_OTHER"}),Hshort:()=>this._getMessage("FD_HOUR_SHORT").replace(/#VALUE#/g,U((D-a)/60/60/1e3)),yesterday:()=>this._getMessage("FD_YESTERDAY"),today:()=>this._getMessage("FD_TODAY"),tommorow:()=>this._getMessage("FD_TOMORROW"),tomorrow:()=>this._getMessage("FD_TOMORROW"),dago:()=>p(U((D-a)/60/60/24/1e3),{0:"FD_DAY_AGO_0",1:"FD_DAY_AGO_1","10_20":"FD_DAY_AGO_10_20",MOD_1:"FD_DAY_AGO_MOD_1",MOD_2_4:"FD_DAY_AGO_MOD_2_4",MOD_OTHER:"FD_DAY_AGO_MOD_OTHER"}),ddiff:()=>p(U((D-a)/60/60/24/1e3),{0:"FD_DAY_DIFF_0",1:"FD_DAY_DIFF_1","10_20":"FD_DAY_DIFF_10_20",MOD_1:"FD_DAY_DIFF_MOD_1",MOD_2_4:"FD_DAY_DIFF_MOD_2_4",MOD_OTHER:"FD_DAY_DIFF_MOD_OTHER"}),dshort:()=>this._getMessage("FD_DAY_SHORT").replace(/#VALUE#/g,U((D-a)/60/60/24/1e3)),mago:()=>p(U((D-a)/60/60/24/31/1e3),{0:"FD_MONTH_AGO_0",1:"FD_MONTH_AGO_1","10_20":"FD_MONTH_AGO_10_20",MOD_1:"FD_MONTH_AGO_MOD_1",MOD_2_4:"FD_MONTH_AGO_MOD_2_4",MOD_OTHER:"FD_MONTH_AGO_MOD_OTHER"}),mdiff:()=>p(U((D-a)/60/60/24/31/1e3),{0:"FD_MONTH_DIFF_0",1:"FD_MONTH_DIFF_1","10_20":"FD_MONTH_DIFF_10_20",MOD_1:"FD_MONTH_DIFF_MOD_1",MOD_2_4:"FD_MONTH_DIFF_MOD_2_4",MOD_OTHER:"FD_MONTH_DIFF_MOD_OTHER"}),mshort:()=>this._getMessage("FD_MONTH_SHORT").replace(/#VALUE#/g,U((D-a)/60/60/24/31/1e3)),Yago:()=>p(U((D-a)/60/60/24/365/1e3),{0:"FD_YEARS_AGO_0",1:"FD_YEARS_AGO_1","10_20":"FD_YEARS_AGO_10_20",MOD_1:"FD_YEARS_AGO_MOD_1",MOD_2_4:"FD_YEARS_AGO_MOD_2_4",MOD_OTHER:"FD_YEARS_AGO_MOD_OTHER"}),Ydiff:()=>p(U((D-a)/60/60/24/365/1e3),{0:"FD_YEARS_DIFF_0",1:"FD_YEARS_DIFF_1","10_20":"FD_YEARS_DIFF_10_20",MOD_1:"FD_YEARS_DIFF_MOD_1",MOD_2_4:"FD_YEARS_DIFF_MOD_2_4",MOD_OTHER:"FD_YEARS_DIFF_MOD_OTHER"}),Yshort:()=>p(U((D-a)/60/60/24/365/1e3),{0:"FD_YEARS_SHORT_0",1:"FD_YEARS_SHORT_1","10_20":"FD_YEARS_SHORT_10_20",MOD_1:"FD_YEARS_SHORT_MOD_1",MOD_2_4:"FD_YEARS_SHORT_MOD_2_4",MOD_OTHER:"FD_YEARS_SHORT_MOD_OTHER"}),x:()=>{const e=this.isAmPmMode(true);const t=e===this.AM_PM_MODE.LOWER?"g:i a":e===this.AM_PM_MODE.UPPER?"g:i A":"H:i";return this.format([["tomorrow","tomorrow, "+t],["-",this.convertBitrixFormat(this._getMessage("FORMAT_DATETIME")).replace(/:s/g,"")],["s","sago"],["i","iago"],["today","today, "+t],["yesterday","yesterday, "+t],["",this.convertBitrixFormat(this._getMessage("FORMAT_DATETIME")).replace(/:s/g,"")]],a,D,i)},X:()=>{const e=this.isAmPmMode(true);const t=e===this.AM_PM_MODE.LOWER?"g:i a":e===this.AM_PM_MODE.UPPER?"g:i A":"H:i";const _=this.format([["tomorrow","tomorrow"],["-",this.convertBitrixFormat(this._getMessage("FORMAT_DATE"))],["today","today"],["yesterday","yesterday"],["",this.convertBitrixFormat(this._getMessage("FORMAT_DATE"))]],a,D,i);const r=this.format([["tomorrow",t],["today",t],["yesterday",t],["",""]],a,D,i);if(r.length>0){return this._getMessage("FD_DAY_AT_TIME").replace(/#DAY#/g,_).replace(/#TIME#/g,r)}else{return _}},Q:()=>{const e=U((D-a)/60/60/24/1e3);if(e==0){return this._getMessage("FD_DAY_DIFF_1").replace(/#VALUE#/g,1)}else{return this.format([["d","ddiff"],["m","mdiff"],["","Ydiff"]],a,D)}}};let g=false;if(_[0]&&_[0]=="^"){g=true;_=_.substr(1)}let f=_.replace(O,d);
4063if(g){f=f.replace(/\s*00:00:00\s*/g,"").replace(/(\d\d:\d\d)(:00)/g,"$1").replace(/(\s*00:00\s*)(?!:)/g,"")}if(M.length>0){M.forEach((function(e,t){f=f.replace("{{"+t+"}}",e)}))}return f;function l(e,t,_,r){const s=U((_-t)/1e3);for(let n=0;n<e.length;n++){const a=e[n][0];const D=e[n][1];let i=null;if(a=="s"){if(s<60){return o.format(D,t,_,r)}}else if((i=/^s(\d+)\>?(\d+)?/.exec(a))!=null){if(i[1]&&i[2]){if(s<i[1]&&s>i[2]){return o.format(D,t,_,r)}}else if(s<i[1]){return o.format(D,t,_,r)}}else if(a=="i"){if(s<60*60){return o.format(D,t,_,r)}}else if((i=/^i(\d+)\>?(\d+)?/.exec(a))!=null){if(i[1]&&i[2]){if(s<i[1]*60&&s>i[2]*60){return o.format(D,t,_,r)}}else if(s<i[1]*60){return o.format(D,t,_,r)}}else if(a=="H"){if(s<24*60*60){return o.format(D,t,_,r)}}else if((i=/^H(\d+)\>?(\d+)?/.exec(a))!=null){if(i[1]&&i[2]){if(s<i[1]*60*60&&s>i[2]*60*60){return o.format(D,t,_,r)}}else if(s<i[1]*60*60){return o.format(D,t,_,r)}}else if(a=="d"){if(s<31*24*60*60){return o.format(D,t,_,r)}}else if((i=/^d(\d+)\>?(\d+)?/.exec(a))!=null){if(i[1]&&i[2]){if(s<i[1]*24*60*60&&s>i[2]*24*60*60){return o.format(D,t,_,r)}}else if(s<i[1]*24*60*60){return o.format(D,t,_,r)}}else if(a=="m"){if(s<365*24*60*60){return o.format(D,t,_,r)}}else if((i=/^m(\d+)\>?(\d+)?/.exec(a))!=null){if(i[1]&&i[2]){if(s<i[1]*31*24*60*60&&s>i[2]*31*24*60*60){return o.format(D,t,_,r)}}else if(s<i[1]*31*24*60*60){return o.format(D,t,_,r)}}else if(a=="now"){if(t.getTime()==_.getTime()){return o.format(D,t,_,r)}}else if(a=="today"){const e=c(_);const s=F(_);const n=u(_);const a=r?new Date(Date.UTC(e,s,n,0,0,0,0)):new Date(e,s,n,0,0,0,0);const i=r?new Date(Date.UTC(e,s,n+1,0,0,0,0)):new Date(e,s,n+1,0,0,0,0);if(t>=a&&t<i){return o.format(D,t,_,r)}}else if(a=="todayFuture"){const e=c(_);const s=F(_);const n=u(_);const a=_.getTime();const i=r?new Date(Date.UTC(e,s,n+1,0,0,0,0)):new Date(e,s,n+1,0,0,0,0);if(t>=a&&t<i){return o.format(D,t,_,r)}}else if(a=="yesterday"){const e=c(_);const s=F(_);const n=u(_);const a=r?new Date(Date.UTC(e,s,n-1,0,0,0,0)):new Date(e,s,n-1,0,0,0,0);const i=r?new Date(Date.UTC(e,s,n,0,0,0,0)):new Date(e,s,n,0,0,0,0);if(t>=a&&t<i){return o.format(D,t,_,r)}}else if(a=="tommorow"||a=="tomorrow"){const e=c(_);const s=F(_);const n=u(_);const a=r?new Date(Date.UTC(e,s,n+1,0,0,0,0)):new Date(e,s,n+1,0,0,0,0);const i=r?new Date(Date.UTC(e,s,n+2,0,0,0,0)):new Date(e,s,n+2,0,0,0,0);if(t>=a&&t<i){return o.format(D,t,_,r)}}else if(a=="-"){if(s<0){return o.format(D,t,_,r)}}}return e.length>0?o.format(e[e.length-1][1],t,_,r):""}function c(e){return i?e.getUTCFullYear():e.getFullYear()}function u(e){return i?e.getUTCDate():e.getDate()}function F(e){return i?e.getUTCMonth():e.getMonth()}function E(e){return i?e.getUTCHours():e.getHours()}function m(e){return i?e.getUTCMinutes():e.getMinutes()}function R(e){return i?e.getUTCSeconds():e.getSeconds()}function h(e){return i?e.getUTCMilliseconds():e.getMilliseconds()}function S(e){return i?e.getUTCDay():e.getDay()}function A(e,t){return i?e.setUTCDate(t):e.setDate(t)}function H(e,t,_){return i?e.setUTCMonth(t,_):e.setMonth(t,_)}function p(e,t){const _=e<100?Math.abs(e):Math.abs(e%100);const r=_%10;let s="";if(_==0){s=o._getMessage(t["0"])}else if(_==1){s=o._getMessage(t["1"])}else if(_>=10&&_<=20){s=o._getMessage(t["10_20"])}else if(r==1){s=o._getMessage(t["MOD_1"])}else if(2<=r&&r<=4){s=o._getMessage(t["MOD_2_4"])}else{s=o._getMessage(t["MOD_OTHER"])}return s.replace(/#VALUE#/g,e)}function d(e,t){if(T[e]){return T[e]()}else{return t}}function U(e){return e>=0?Math.floor(e):Math.ceil(e)}}}]);return e}();babelHelpers.defineProperty(n,"AM_PM_MODE",{UPPER:1,LOWER:2,NONE:false});babelHelpers.defineProperty(n,"convertBitrixFormat",_);babelHelpers.defineProperty(n,"getFormat",s);const a=new t.Cache.MemoryCache;const D={get SERVER_TO_UTC(){return a.remember("SERVER_TO_UTC",(()=>t.Text.toInteger(t.Loc.getMessage("SERVER_TZ_OFFSET"))))},get USER_TO_SERVER(){return a.remember("USER_TO_SERVER",(()=>t.Text.toInteger(t.Loc.getMessage("USER_TZ_OFFSET"))))},get BROWSER_TO_UTC(){return a.remember("BROWSER_TO_UTC",(()=>t.Text.toInteger((new Date).getTimezoneOffset()*60)))}};Object.freeze(D);function i(e,t,_){o(e,t);return _}function o(e,t){if(e!==t){throw new TypeError("Private static access of wrong provenance")}}let M=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"getTimestamp",value:function e(){return Math.round(Date.now()/1e3)}},{key:"getDate",value:function e(){return new Date(this.getTimestamp()*1e3)}},{key:"toUser",value:function e(_){return t.Text.toInteger(_)+D.USER_TO_SERVER}},{key:"toServer",value:function t(_){return i(this,e,O).call(this,_)+D.SERVER_TO_UTC}}]);return e}();function O(e){return t.Text.toInteger(e)-D.BROWSER_TO_UTC}let T=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"getTimestamp",value:function e(){return M.toUser(M.getTimestamp())}},{key:"getDate",value:function e(){return new Date(this.getTimestamp()*1e3)}},{key:"toBrowser",value:function e(_){return t.Text.toInteger(_)+D.BROWSER_TO_UTC-D.SERVER_TO_UTC-D.USER_TO_SERVER}},{key:"toServer",value:function e(_){return t.Text.toInteger(_)-D.USER_TO_SERVER}}]);return e}();let g=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"getTimestamp",value:function e(){return M.toServer(M.getTimestamp())}},{key:"getDate",value:function e(){return new Date(this.getTimestamp()*1e3)}},{key:"toUser",value:function e(_){return t.Text.toInteger(_)+D.USER_TO_SERVER}},{key:"toBrowser",value:function e(_){return t.Text.toInteger(_)+D.BROWSER_TO_UTC-D.SERVER_TO_UTC}}]);return e}();const f=n;const l=Object.freeze({Offset:D,BrowserTime:M,UserTime:T,ServerTime:g});e.DateTimeFormat=n;e.Date=f;e.Timezone=l})(this.BX.Main=this.BX.Main||{},BX); 4064/* End */ 4065; 4066; /* Start:"a:4:{s:4:"full";s:53:"/bitrix/js/main/core/core_date.min.js?171319698426661";s:6:"source";s:33:"/bitrix/js/main/core/core_date.js";s:3:"min";
4066s:37:"/bitrix/js/main/core/core_date.min.js";s:3:"map";s:37:"/bitrix/js/main/core/core_date.map.js";}"*/ 4067(function(){if(BX.date)return;BX.date=BX.Main.Date;var e=null;BX.calendar=function(e){return BX.calendar.get().Show(e)};BX.calendar.get=function(){if(!e)e=new BX.JCCalendar;return e};BX.calendar.InsertDaysBack=function(e,t){if(t!=""){var a=new Date;if(t>0){a.setTime(a.valueOf()-t*864e5)}e.value=BX.date.format(BX.date.convertBitrixFormat(BX.message("FORMAT_DATE")),a,null)}else{e.value=""}};BX.calendar.ValueToString=function(e,t,a){return BX.date.format(BX.date.convertBitrixFormat(BX.message(t?"FORMAT_DATETIME":"FORMAT_DATE")),e,null,!!a)};BX.calendar.ValueToStringFormat=function(e,t,a){return BX.date.format(BX.date.convertBitrixFormat(t),e,null,!!a)};BX.CalendarPeriod={Init:function(e,t,a){if((e.value!=""||t.value!="")&&a.value=="")a.value="interval";a.onchange()},ChangeDirectOpts:function(e,t){var a=BX.findChild(t,{className:"adm-select adm-calendar-direction"},true);if(e=="week"){a.options[0].text=BX.message("JSADM_CALEND_PREV_WEEK");a.options[1].text=BX.message("JSADM_CALEND_CURR_WEEK");a.options[2].text=BX.message("JSADM_CALEND_NEXT_WEEK")}else{a.options[0].text=BX.message("JSADM_CALEND_PREV");a.options[1].text=BX.message("JSADM_CALEND_CURR");a.options[2].text=BX.message("JSADM_CALEND_NEXT")}},SaveAndClearInput:function(e){if(!window.SavedPeriodValues)window.SavedPeriodValues={};window.SavedPeriodValues[e.id]=e.value;e.value=""},RestoreInput:function(e){if(!window.SavedPeriodValues||!window.SavedPeriodValues[e.id])return;e.value=window.SavedPeriodValues[e.id];delete window.SavedPeriodValues[e.id]},OnChangeP:function(e){var t=e.parentNode.parentNode;var a,i,s,n;a=i=s=n=false;var r=BX.findChild(t,{className:"adm-input-wrap adm-calendar-inp adm-calendar-first"});var o=BX.findChild(t,{className:"adm-input-wrap adm-calendar-second"});var l=BX.findChild(t,{className:"adm-select-wrap adm-calendar-direction"});var p=BX.findChild(t,{className:"adm-calendar-separate"});var h=BX.findChild(t,{className:"adm-input adm-calendar-from"},true);var c=BX.findChild(t,{className:"adm-input adm-calendar-to"},true);switch(e.value){case"day":case"week":case"month":case"quarter":case"year":s=true;BX.CalendarPeriod.OnChangeD(l.children[0]);break;case"before":i=true;break;case"after":a=true;break;case"exact":a=true;break;case"interval":a=i=n=true;BX.CalendarPeriod.RestoreInput(h);BX.CalendarPeriod.RestoreInput(c);break;case"":BX.CalendarPeriod.SaveAndClearInput(h);BX.CalendarPeriod.SaveAndClearInput(c);break;default:break}BX.CalendarPeriod.ChangeDirectOpts(e.value,t);r.style.display=a?"inline-block":"none";o.style.display=i?"inline-block":"none";l.style.display=s?"inline-block":"none";p.style.display=n?"inline-block":"none"},OnChangeD:function(e){var t=e.parentNode.parentNode;var a=BX.findChild(t,{className:"adm-input adm-calendar-from"},true);var i=BX.findChild(t,{className:"adm-input adm-calendar-to"},true);var s=BX.findChild(t,{className:"adm-select adm-calendar-period"},true);var n=0;switch(e.value){case"previous":n=-1;break;case"next":n=1;break;case"current":default:break}var r=false;var o=false;var l=new Date;var p=l.getFullYear();var h=l.getMonth();var c=l.getDate();var u=l.getDay();if(u==0)u=7;switch(s.value){case"day":r=new Date(p,h,c+n,0,0,0);o=new Date(p,h,c+n,23,59,59);break;case"week":r=new Date(p,h,c-u+1+n*7,0,0,0);o=new Date(p,h,c+(7-u)+n*7,23,59,59);break;case"month":r=new Date(p,h+n,1,0,0,0);o=new Date(p,h+1+n,0,23,59,59);break;case"quarter":var d=Math.floor(h/3)+n;r=new Date(p,3*d,1,0,0,0);o=new Date(p,3*(d+1),0,23,59,59);break;case"year":r=new Date(p+n,0,1,0,0,0);o=new Date(p+1+n,0,0,23,59,59);break;default:break}var m=window[a.name+"_bTime"]?BX.message("FORMAT_DATETIME"):BX.message("FORMAT_DATE");if(r){a.value=BX.formatDate(r,m);BX.addClass(a,"adm-calendar-inp-setted")}if(o){i.value=BX.formatDate(o,m);BX.addClass(i,"adm-calendar-inp-setted")}}};BX.JCCalendar=function(){this.params={};this.bAmPm=BX.isAmPmMode();this.popup=null;this.popup_month=null;this.popup_year=null;this.month_popup_classname="";this.year_popup_classname="";this.value=null;this._layers={};this._current_layer=null;this.DIV=null;this.PARTS={};this.weekStart=0;this.numRows=6;this._create=function(e){this.popup=new BX.PopupWindow("calendar_popup_"+Math.random(),e.node,{closeByEsc:true,autoHide:false,content:this._get_content(),bindOptions:{forceBindPosition:true}});BX.bind(this.popup.popupContainer,"click",function(e){e.stopPropagation()})};this._auto_hide_disable=function(){BX.unbind(document,"click",BX.proxy(this._auto_hide,this))};this._auto_hide_enable=function(){BX.bind(document,"click",BX.proxy(this._auto_hide,this))};this._auto_hide=function(e){this._auto_hide_disable();this.popup.close()};this._get_content=function(){var e=BX.delegate(function(e){e=e||window.event;this.SetDate(new Date(parseInt(BX.proxy_context.getAttribute("data-date"))),e.type==="dblclick"||this.params.bCompatibility&&!this.params.bTimeVisibility)},this);this.DIV=BX.create("DIV",{props:{className:"bx-calendar"},children:[BX.create("DIV",{props:{className:"bx-calendar-header"},children:[BX.create("A",{attrs:{href:"javascript:void(0)"},props:{className:"bx-calendar-left-arrow"},events:{click:BX.proxy(this._prev,this)}}),BX.create("SPAN",{props:{className:"bx-calendar-header-content"},children:[this.PARTS.MONTH=BX.create("A",{attrs:{href:"javascript:void(0)"},props:{className:"bx-calendar-top-month"},events:{click:BX.proxy(this._menu_month,this)}}),this.PARTS.YEAR=BX.create("A",{attrs:{href:"javascript:void(0)"},props:{className:"bx-calendar-top-year"},events:{click:BX.proxy(this._menu_year,this)}})]}),BX.create("A",{attrs:{href:"javascript:void(0)"},props:{className:"bx-calendar-right-arrow"},events:{click:BX.proxy(this._next,this)}})]}),this.PARTS.WEEK=BX.create("DIV",{props:{className:"bx-calendar-name-day-wrap"}}),this.PARTS.LAYERS=BX.create("DIV",{props:{className:"bx-calendar-cell-block"},events:{click:BX.delegateEvent({className:"bx-calendar-cell"},e),dblclick:BX.delegateEvent({className:"bx-calendar-cell"},e)}}),this.PARTS.TIME=BX.create("DIV",{props:{className:"bx-calendar-set-time-wrap"},events:{click:BX.delegateEvent({attr:"data-action"},BX.delegate(this._time_actions,this))},html:'<a href="javascript:void(0)" data-action="time_show" class="bx-calendar-set-time"><i></i>'+BX.message("CAL_TIME_SET")+'</a><div class="bx-calendar-form-block"><span class="bx-calendar-form-text">'+BX.message("CAL_TIME")+'</span><span class="bx-calendar-form"><input type="text" class="bx-calendar-form-input" maxwidth="2" onkeyup="BX.calendar.get()._check_time()" /><span class="bx-calendar-form-separator"></span><input type="text" class="bx-calendar-form-input" maxwidth="2" onkeyup="BX.calendar.get()._check_time()" />'+(this.bAmPm?'<span class="bx-calendar-AM-PM-block"><span class="bx-calendar-AM-PM-text" data-action="time_ampm"></span><span class="bx-calendar-form-arrow-r"><a href="javascript:void(0)" class="bx-calendar-form-arrow-top" data-action="time_ampm_up"><i></i></a><a href="javascript:void(0)" class="bx-calendar-form-arrow-bottom" data-action="time_ampm_down"><i></i></a></span></span>':"")+'</span><a href="javascript:void(0)" data-action="time_hide" class="bx-calendar-form-close"><i></i></a></div>'}),this.PARTS.BUTTONS=BX.create("DIV",{props:{className:"bx-calendar-button-block"},events:{click:BX.delegateEvent({attr:"data-action"},BX.delegate(this._button_actions,this))},html:'<a href="javascript:void(0)" class="bx-calendar-button bx-calendar-button-select" data-action="submit"><span class="bx-calendar-button-left"></span><span class="bx-calendar-button-text">'+BX.message("CAL_BUTTON")+'</span><span class="bx-calendar-button-right"></span></a><a href="javascript:void(0)" class="bx-calendar-button bx-calendar-button-cancel" data-action="cancel"><span class="bx-calendar-button-left"></span><span class="bx-calendar-button-text">'+BX.message("JS_CORE_WINDOW_CLOSE")+'</span><span class="bx-calendar-button-right"></span></a>'})]});this.PARTS.TIME_INPUT_H=BX.findChild(this.PARTS.TIME,{tag:"INPUT"},true);this.PARTS.TIME_INPUT_M=this.PARTS.TIME_INPUT_H.nextSibling.nextSibling;if(this.bAmPm)this.PARTS.TIME_AMPM=this.PARTS.TIME_INPUT_M.nextSibling.firstChild;var t=new BX.JCSpinner({input:this.PARTS.TIME_INPUT_H,callback_change:BX.proxy(this._check_time,this),bSaveValue:false}).Show();t.className="bx-calendar-form-arrow-l";this.PARTS.TIME_INPUT_H.parentNode.insertBefore(t,this.PARTS.TIME_INPUT_H);t=new BX.JCSpinner({input:this.PARTS.TIME_INPUT_M,callback_change:BX.proxy(this._check_time,this),bSaveValue:true}).Show();t.className="bx-calendar-form-arrow-r";if(!this.PARTS.TIME_INPUT_M.nextSibling)this.PARTS.TIME_INPUT_M.parentNode.appendChild(t);else this.PARTS.TIME_INPUT_M.parentNode.insertBefore(t,this.PARTS.TIME_INPUT_M.nextSibling);for(var a=0;a<7;a++){this.PARTS.WEEK.appendChild(BX.create("SPAN",{props:{className:"bx-calendar-name-day"},text:BX.message("DOW_"+(a+this.weekStart)%7)}))}return this.DIV};this._time_actions=function(){switch(BX.proxy_context.getAttribute("data-action")){case"time_show":BX.addClass(this.PARTS.TIME,"bx-calendar-set-time-opened");if(this.params.bCompatibility){BX.removeClass(this.PARTS.BUTTONS,"bx-calendar-buttons-disabled")}this.popup.adjustPosition();break;case"time_hide":BX.removeClass(this.PARTS.TIME,"bx-calendar-set-time-opened");if(this.params.bCompatibility){this._saveChoice("hide");BX.addClass(this.PARTS.BUTTONS,"bx-calendar-buttons-disabled")}this.popup.adjustPosition();break;case"time_ampm":this.PARTS.TIME_AMPM.innerHTML=this.PARTS.TIME_AMPM.innerHTML=="AM"?"PM":"AM";break;case"time_ampm_up":this._check_time({bSaveValue:false},null,12);return;break;case"time_ampm_down":this._check_time({bSaveValue:false},null,-12);return;break}this._check_time()};this._button_actions=function(){switch(BX.proxy_context.getAttribute("data-action")){case"submit":if(this.params.bCompatibility){this._saveChoice("show")}this.SaveValue();break;case"cancel":this.Close();break}};this._saveChoice=function(e){if(this.params.bCategoryTimeVisibilityOption){BX.userOptions.save(this.params.bCategoryTimeVisibilityOption,this.params.bNameTimeVisibilityOption,"visibility",e==="show"?"Y":"N")}this._bTimeVisibility=e==="show";this.params.bTimeVisibility=this._bTimeVisibility};this._check_time=function(e,t,a){var i=parseInt(this.PARTS.TIME_INPUT_H.value.substring(0,5),10)||0,s=parseInt(this.PARTS.TIME_INPUT_M.value.substring(0,5),10)||0,n=false;if(!!e&&!e.bSaveValue){this.value.setUTCHours(this.value.getUTCHours()+a)}else if(!isNaN(i)){if(this.bAmPm){if(i!=12&&this.PARTS.TIME_AMPM.innerHTML=="PM"){i+=12}}n=true;this.value.setUTCHours(i%24)}if(!isNaN(s)){n=true;this.value.setUTCMinutes(s%60)}if(n){this.SetValue(this.value)}};this._set_layer=function(){var e=parseInt(this.value.getUTCFullYear()+""+BX.util.str_pad_left(this.value.getUTCMonth()+"",2,"0"));if(!this._layers[e]){this._layers[e]=this._create_layer();this._layers[e].BXLAYERID=e}if(this._current_layer){var t=new Date(this.value.valueOf());t.setUTCHours(0);t.setUTCMinutes(0);var a=BX.findChild(this._layers[e],{tag:"A",className:"bx-calendar-active"},true),i=BX.findChild(this._layers[e],{tag:"A",attr:{"data-date":t.valueOf()+""}},true);if(a){BX.removeClass(a,"bx-calendar-active")}if(i){BX.addClass(i,"bx-calendar-active")}this._replace_layer(this._current_layer,this._layers[e])}else{this.PARTS.LAYERS.appendChild(this._layers[e])}this._current_layer=this._layers[e]};this._replace_layer=function(e,t){if(e!=t){if(!BX.browser.IsIE()||BX.browser.IsDoctype()){var a=e.BXLAYERID>t.BXLAYERID?1:-1;var i=0;var s=-a*e.offsetHeight;e.style.position="relative";e.style.top="0px";e.style.zIndex=5;t.style.position="absolute";t.style.top=s+"px";t.style.zIndex=6;this.PARTS.LAYERS.appendChild(t);var n=15;var r;(r=function(){s+=a*n;i+=a*n;if(a*s<0){e.style.top=i+"px";t.style.top=s+"px";setTimeout(r,10)}else{e.parentNode.removeChild(e);t.style.top="0px";t.style.position="static";t.style.zIndex=0}})()}else{this.PARTS.LAYERS.replaceChild(t,e)}}};this._create_layer=function(){var e=BX.create("DIV",{props:{className:"bx-calendar-layer"}});var t=new Date(this.value);t.setUTCHours(0);t.setUTCMinutes(0);t.setUTCDate(1);if(t.getUTCDay()!=this.weekStart){var a=t.getUTCDay()-this.weekStart;a+=a<0?7:0;t.setUTCDate(t.getUTCDate()-a)}var i=this.value.getUTCMonth(),s=this.value.getUTCDate(),n="";for(var r=0;r<this.numRows;r++){n+='<div class="bx-calendar-range'+(r==this.numRows-1?" bx-calendar-range-noline":"")+'">';
4067for(var o=0;o<7;o++){a=t.getUTCDate();var l=t.getUTCDay();var p="bx-calendar-cell";if(i!=t.getUTCMonth())p+=" bx-calendar-date-hidden";else if(s==a)p+=" bx-calendar-active";if(l==0||l==6)p+=" bx-calendar-weekend";n+='<a href="javascript:void(0)" class="'+p+'" data-date="'+t.valueOf()+'">'+a+"</a>";t.setUTCDate(t.getUTCDate()+1)}n+="</div>"}e.innerHTML=n;return e};this._prev=function(){this.SetMonth(this.value.getUTCMonth()-1)};this._next=function(){this.SetMonth(this.value.getUTCMonth()+1)};this._menu_month_content=function(){var e="",t=this.value.getMonth(),a;for(a=0;a<12;a++){e+='<span class="bx-calendar-month'+(a==t?" bx-calendar-month-active":"")+'" data-bx-month="'+a+'">'+BX.message("MONTH_"+(a+1))+"</span>"}return'<div class="bx-calendar-month-popup"><div class="bx-calendar-month-title" data-bx-month="'+this.value.getUTCMonth()+'">'+BX.message("MONTH_"+(this.value.getUTCMonth()+1))+'</div><div class="bx-calendar-month-content">'+e+"</div></div>"};this._menu_month=function(){if(!this.popup_month){this.popup_month=new BX.PopupWindow("calendar_popup_month_"+Math.random(),this.PARTS.MONTH,{content:this._menu_month_content(),closeByEsc:true,autoHide:true,offsetTop:-29,offsetLeft:-1,className:this.month_popup_classname,events:{onPopupShow:BX.delegate(function(){if(this.popup_year){this.popup_year.close()}},this)}});BX.bind(this.popup_month.popupContainer,"click",BX.proxy(this.month_popup_click,this));this.popup_month.BXMONTH=this.value.getUTCMonth()}else if(this.popup_month.BXMONTH!=this.value.getUTCMonth()){this.popup_month.setContent(this._menu_month_content());this.popup_month.BXMONTH=this.value.getUTCMonth()}this.popup_month.show()};this.month_popup_click=function(e){var t=e.target||e.srcElement;if(t&&t.getAttribute&&t.getAttribute("data-bx-month")){this.SetMonth(parseInt(t.getAttribute("data-bx-month")));this.popup_month.close()}};this._menu_year_content=function(){var e='<div class="bx-calendar-year-popup"><div class="bx-calendar-year-title" data-bx-year="'+this.value.getUTCFullYear()+'">'+this.value.getUTCFullYear()+'</div><div class="bx-calendar-year-content" id="bx-calendar-year-content">';for(var t=-3;t<=3;t++){e+='<span class="bx-calendar-year-number'+(t==0?" bx-calendar-year-active":"")+'" data-bx-year="'+(this.value.getUTCFullYear()-t)+'">'+(this.value.getUTCFullYear()-t)+"</span>"}e+='</div><input data-bx-year-input="Y" type="text" class="bx-calendar-year-input" maxlength="4" /></div>';return e};this._menu_year=function(){if(!this.popup_year){this.popup_year=new BX.PopupWindow("calendar_popup_year_"+Math.random(),this.PARTS.YEAR,{content:this._menu_year_content(),closeByEsc:true,autoHide:true,offsetTop:-29,offsetLeft:-1,className:this.year_popup_classname,events:{onPopupShow:BX.delegate(function(){if(this.popup_month){this.popup_month.close()}},this)}});BX.bind(this.popup_year.popupContainer,"click",BX.proxy(this.year_popup_click,this));BX.bind(this.popup_year.popupContainer,"keyup",BX.proxy(this.year_popup_keyup,this));this.popup_year.BXYEAR=this.value.getUTCFullYear()}else if(this.popup_year.BXYEAR!=this.value.getUTCFullYear()){this.popup_year.setContent(this._menu_year_content());this.popup_year.BXYEAR=this.value.getUTCFullYear()}this.popup_year.show()};this.year_popup_click=function(e){var t=e.target||e.srcElement;if(t&&t.getAttribute&&t.getAttribute("data-bx-year")){this.SetYear(parseInt(t.getAttribute("data-bx-year")));this.popup_year.close()}};this.year_popup_keyup=function(e){var t=e.target||e.srcElement;if(t&&t.getAttribute&&t.getAttribute("data-bx-year-input")=="Y"){var a=parseInt(t.value);if(a>=1900&&a<=2100){this.SetYear(a);this.popup_year.close()}}};this._check_date=function(e){var t=e;if(BX.type.isString(e)){t=BX.parseDate(e,true)}if(!BX.type.isDate(t)||isNaN(t.valueOf())){t=BX.date.convertToUTC(new Date);if(this.params.bHideTime){t.setUTCHours(0);t.setUTCMinutes(0)}}t.setUTCMilliseconds(0);t.setUTCSeconds(0);t.BXCHECKED=true;return t}};BX.JCCalendar.prototype.Show=function(e){if(!BX.isReady){BX.ready(BX.delegate(function(){this.Show(e)},this));return}e.node=e.node||document.body;if(BX.type.isNotEmptyString(e.node)){var t=BX(e.node);
4067if(!t){t=document.getElementsByName(e.node);if(t&&t.length>0){t=t[0]}}e.node=t}if(!e.node)return;if(!!e.field){if(BX.type.isString(e.field)){t=BX(e.field);if(!!t){e.field=t}else{if(e.form){if(BX.type.isString(e.form)){e.form=document.forms[e.form]}}if(BX.type.isDomNode(e.form)&&!!e.form[e.field]){e.field=e.form[e.field]}else{t=document.getElementsByName(e.field);if(t&&t.length>0){t=t[0];e.field=t}}}if(BX.type.isString(e.field)){e.field=BX(e.field)}}}var a=!this.popup||!this.popup.isShown()||this.params.node!=e.node;this.params=e;this.params.bCompatibility=typeof this.params.bCompatibility=="undefined"?false:this.params.bCompatibility;this.params.bTimeVisibility=typeof this.params.bTimeVisibility=="undefined"?!this.params.bCompatibility:this.params.bTimeVisibility;if(this.params.bCompatibility){this.params.bCategoryTimeVisibilityOption=this.params.bCategoryTimeVisibilityOption?this.params.bCategoryTimeVisibilityOption:"";this.params.bNameTimeVisibilityOption=this.params.bNameTimeVisibilityOption?this.params.bNameTimeVisibilityOption:"time_visibility";if(typeof this._bTimeVisibility!=="undefined"){this.params.bTimeVisibility=this._bTimeVisibility}}this.params.bTime=typeof this.params.bTime=="undefined"?true:!!this.params.bTime;this.params.bHideTime=typeof this.params.bHideTime=="undefined"?true:!!this.params.bHideTime;this.params.bUseSecond=typeof this.params.bUseSecond=="undefined"?true:!!this.params.bUseSecond;this.weekStart=parseInt(this.params.weekStart||this.params.weekStart||BX.message("WEEK_START"));if(isNaN(this.weekStart))this.weekStart=1;if(!this.popup){this._create(this.params)}else{this.popup.setBindElement(this.params.node)}var i=!!this.params.bHideTime;if(this.params.value){this.SetValue(this.params.value);i=this.value.getUTCHours()<=0&&this.value.getUTCMinutes()<=0}else if(this.params.field){this.SetValue(this.params.field.value);i=this.value.getUTCHours()<=0&&this.value.getUTCMinutes()<=0}else if(!!this.params.currentTime){this.SetValue(this.params.currentTime)}else{this.SetValue()}if(!!this.params.bTime){this.activateTimeStyle(i)}else{this.activateDateStyle(i)}if(a){this._auto_hide_disable();this.popup.show();setTimeout(BX.proxy(this._auto_hide_enable,this),0)}this.params.bSetFocus=typeof this.params.bSetFocus=="undefined"?true:!!this.params.bSetFocus;if(this.params.bSetFocus){e.node.blur()}else{BX.bind(e.node,"keyup",BX.defer(function(){this.SetValue(e.node.value);if(!!this.params.bTime){if(this.value.getUTCHours()<=0&&this.value.getUTCMinutes()<=0)BX.removeClass(this.PARTS.TIME,"bx-calendar-set-time-opened");else BX.addClass(this.PARTS.TIME,"bx-calendar-set-time-opened")}},this))}return this};BX.JCCalendar.prototype.activateDateStyle=function(e){BX.addClass(this.DIV,"bx-calendar-time-disabled");if(!!e)BX.removeClass(this.PARTS.TIME,"bx-calendar-set-time-opened");else BX.addClass(this.PARTS.TIME,"bx-calendar-set-time-opened")};BX.JCCalendar.prototype.activateTimeStyle=function(e){if(this.params.bCompatibility&&!this.params.bTimeVisibility){BX.addClass(this.PARTS.BUTTONS,"bx-calendar-buttons-disabled");BX.addClass(this.PARTS.TIME,"bx-calendar-set-time-wrap-simple");BX.removeClass(this.PARTS.TIME,"bx-calendar-set-time-opened")}else{BX.removeClass(this.DIV,"bx-calendar-time-disabled");if(!!e)BX.removeClass(this.PARTS.TIME,"bx-calendar-set-time-opened");else BX.addClass(this.PARTS.TIME,"bx-calendar-set-time-opened")}};BX.JCCalendar.prototype.SetDay=function(e){this.value.setUTCDate(e);return this.SetValue(this.value)};BX.JCCalendar.prototype.SetMonth=function(e){if(this.popup_month)this.popup_month.close();this.value.setUTCMonth(e);if(e<0)e+=12;else if(e>=12)e-=12;while(this.value.getUTCMonth()>e){this.value.setUTCDate(this.value.getUTCDate()-1)}return this.SetValue(this.value)};BX.JCCalendar.prototype.SetYear=function(e){if(this.popup_year)this.popup_year.close();this.value.setUTCFullYear(e);return this.SetValue(this.value)};BX.JCCalendar.prototype.SetDate=function(e,t){e=this._check_date(e);e.setUTCHours(this.value.getUTCHours());e.setUTCMinutes(this.value.getUTCMinutes());e.setUTCSeconds(this.value.getUTCSeconds());if(this.params.bTime&&!t){return this.SetValue(e)}else{this.SetValue(e);this.SaveValue()}};BX.JCCalendar.prototype.SetValue=function(e){this.value=e&&e.BXCHECKED?e:this._check_date(e);this.PARTS.MONTH.innerHTML=BX.message("MONTH_"+(this.value.getUTCMonth()+1));this.PARTS.YEAR.innerHTML=this.value.getUTCFullYear();if(!!this.params.bTime){var t=this.value.getUTCHours();if(this.bAmPm){if(t>=12){this.PARTS.TIME_AMPM.innerHTML="PM";if(t!=12)t-=12}else{this.PARTS.TIME_AMPM.innerHTML="AM";if(t==0)t=12}}this.PARTS.TIME_INPUT_H.value=BX.util.str_pad_left(t.toString(),2,"0");this.PARTS.TIME_INPUT_M.value=BX.util.str_pad_left(this.value.getUTCMinutes().toString(),2,"0")}this._set_layer();return this};BX.JCCalendar.prototype.SaveValue=function(){if(this.popup_month)this.popup_month.close();if(this.popup_year)this.popup_year.close();var e=true;if(!!this.params.callback){var t=this.params.callback.apply(this,[new Date(this.value.valueOf()+this.value.getTimezoneOffset()*6e4)]);if(t===false)e=false}if(e){var a=!!this.params.bTime&&BX.hasClass(this.PARTS.TIME,"bx-calendar-set-time-opened");if(this.params.field){var i=BX.message(a?"FORMAT_DATETIME":"FORMAT_DATE");if(a&&!this.params.bUseSecond){i=i.replace(":SS","")}this.params.field.value=BX.calendar.ValueToStringFormat(this.value,i,true);BX.fireEvent(this.params.field,"change")}this.popup.close();if(!!this.params.callback_after){this.params.callback_after.apply(this,[new Date(this.value.valueOf()+this.value.getTimezoneOffset()*6e4),a])}}return this};BX.JCCalendar.prototype.Close=function(){if(!!this.popup)this.popup.close();return this};BX.JCSpinner=function(e){e=e||{};this.params={input:e.input||null,delta:e.delta||1,timeout_start:e.timeout_start||1e3,timeout_cont:e.timeout_cont||150,callback_start:e.callback_start||null,callback_change:e.callback_change||null,callback_finish:e.callback_finish||null,bSaveValue:typeof e.bSaveValue=="undefined"?!!e.input:!!e.bSaveValue};this.mousedown=false;this.direction=1};BX.JCSpinner.prototype.Show=function(){this.node=BX.create("span",{events:{mousedown:BX.delegateEvent({attr:"data-dir"},BX.delegate(this.Start,this))},html:'<a href="javascript:void(0)" class="bx-calendar-form-arrow bx-calendar-form-arrow-top" data-dir="1"><i></i></a><a href="javascript:void(0)" class="bx-calendar-form-arrow bx-calendar-form-arrow-bottom" data-dir="-1"><i></i></a>'});return this.node};BX.JCSpinner.prototype.Start=function(){this.mousedown=true;this.direction=BX.proxy_context.getAttribute("data-dir")>0?1:-1;BX.bind(document,"mouseup",BX.proxy(this.MouseUp,this));this.ChangeValue(true)};BX.JCSpinner.prototype.ChangeValue=function(e){if(!this.mousedown)return;if(this.params.input){var t=parseInt(this.params.input.value,10)+this.params.delta*this.direction;
4067if(this.params.bSaveValue)this.params.input.value=t;if(!!e&&this.params.callback_start)this.params.callback_start(this.params,t,this.direction);if(this.params.callback_change)this.params.callback_change(this.params,t,this.direction);setTimeout(BX.proxy(this.ChangeValue,this),!!e?this.params.timeout_start:this.params.timeout_cont)}};BX.JCSpinner.prototype.MouseUp=function(){this.mousedown=false;BX.unbind(document,"mouseup",BX.proxy(this.MouseUp,this));if(this.params.callback_finish)this.params.callback_finish(this.params,this.params.input.value)};window.jsCalendar={Show:function(e,t,a,i,s,n,r,o){return BX.calendar({node:e,field:t,form:r,bTime:!!s,currentTime:n,bHideTimebar:!!o})},ValueToString:BX.calendar.ValueToString};BX.CClockSelector=function(e){this.params=e;this.params.popup_buttons=this.params.popup_buttons||[new BX.PopupWindowButton({text:BX.message("CAL_BUTTON"),className:"popup-window-button-create",events:{click:BX.proxy(this.setValue,this)}})];this.isReady=false;this.WND=new BX.PopupWindow(this.params.popup_id||"clock_selector_popup",this.params.node,this.params.popup_config||{titleBar:BX.message("CAL_TIME"),offsetLeft:-45,offsetTop:-135,autoHide:true,closeIcon:true,closeByEsc:true});this.SHOW=false;BX.addCustomEvent(this.WND,"onPopupClose",BX.delegate(this.onPopupClose,this));this.obClocks={};this.CLOCK_ID=this.params.clock_id||"clock_selector"};BX.CClockSelector.prototype.Show=function(){if(!this.isReady){BX.addCustomEvent("onClockRegister",BX.proxy(this.onClockRegister,this));return BX.ajax.get("/bitrix/tools/clock_selector.php",{start_time:this.params.start_time,clock_id:this.CLOCK_ID,sessid:BX.bitrix_sessid()},BX.delegate(this.Ready,this))}this.WND.setButtons(this.params.popup_buttons);this.WND.show();this.SHOW=true;if(window["bxClock_"+this.obClocks[this.CLOCK_ID]]){setTimeout("window['bxClock_"+this.obClocks[this.CLOCK_ID]+"'].CalculateCoordinates()",40)}return true};BX.CClockSelector.prototype.onClockRegister=function(e){if(e[this.CLOCK_ID]){this.obClocks[this.CLOCK_ID]=e[this.CLOCK_ID];BX.removeCustomEvent("onClockRegister",BX.proxy(this.onClockRegister,this))}};BX.CClockSelector.prototype.Ready=function(e){this.content=this.CreateContent(e);this.WND.setContent(this.content);this.isReady=true;setTimeout(BX.proxy(this.Show,this),30)};BX.CClockSelector.prototype.CreateContent=function(e){return BX.create("DIV",{events:{click:BX.PreventDefault},html:'<div class="bx-tm-popup-clock">'+e+"</div>"})};BX.CClockSelector.prototype.setValue=function(e){if(this.params.callback){var t=BX.findChild(this.content,{tagName:"INPUT"},true);this.params.callback.apply(this.params.node,[t.value])}return BX.PreventDefault(e)};BX.CClockSelector.prototype.closeWnd=function(e){this.WND.close();return e||window.event?BX.PreventDefault(e):true};BX.CClockSelector.prototype.setNode=function(e){this.WND.setBindElement(e)};BX.CClockSelector.prototype.setTime=function(e){this.params.start_time=e;if(window["bxClock_"+this.obClocks[this.CLOCK_ID]]){window["bxClock_"+this.obClocks[this.CLOCK_ID]].SetTime(parseInt(e/3600),parseInt(e%3600/60))}};BX.CClockSelector.prototype.setCallback=function(e){this.params.callback=e};BX.CClockSelector.prototype.onPopupClose=function(){this.SHOW=false}})(); 4068/* End */ 4069; 4070//# sourceMappingURL=kernel_main.map.js
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.