1BX.CLBlock = function(arParams) 2{ 3 this.arData = []; 4 this.arData["Subscription"] = []; 5 this.UTPopup = null; 6 this.createTaskPopup = null; 7 8 this.entity_type = null; 9 this.entity_id = null; 10 this.event_id = null; 11 this.event_id_fullset = false; 12 this.cb_id = null; 13 this.t_val = null; 14 this.ind = null; 15 this.type = null; 16}; 17 18BX.CLBlock.prototype.DataParser = function(str) 19{ 20 str = str.replace(/^\s+|\s+$/g, ''); 21 while (str.length > 0 && str.charCodeAt(0) == 65279) 22 str = str.substring(1); 23 24 if (str.length <= 0) 25 return false; 26 27 if (str.substring(0, 1) != '{' && str.substring(0, 1) != '[' && str.substring(0, 1) != '*') 28 str = '"*"'; 29 30 eval("arData = " + str); 31 32 return arData; 33}; 34 35function __logFilterShow() 36{ 37 if (BX('bx_sl_filter').style.display == 'none') 38 { 39 BX('bx_sl_filter').style.display = 'block'; 40 BX('bx_sl_filter_hidden').style.display = 'none'; 41 } 42 else 43 { 44 BX('bx_sl_filter').style.display = 'none'; 45 BX('bx_sl_filter_hidden').style.display = 'block'; 46 } 47} 48 49if (!window.XMLHttpRequest) 50{ 51 var XMLHttpRequest = function() 52 { 53 try { return new ActiveXObject("MSXML3.XMLHTTP") } catch(e) {} 54 try { return new ActiveXObject("MSXML2.XMLHTTP.3.0") } catch(e) {} 55 try { return new ActiveXObject("MSXML2.XMLHTTP") } catch(e) {} 56 try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {} 57 } 58} 59 60var sonetLXmlHttpGet = new XMLHttpRequest(); 61var sonetLXmlHttpSet = new XMLHttpRequest(); 62 63var LBlock = new BX.CLBlock(); 64 65function __logOnAjaxInsertToNode(params) 66{ 67 var arPos = false; 68 69 if (BX('sonet_log_more_container')) 70 { 71 nodeTmp1 = BX.findChild(BX('sonet_log_more_container'), {'tag':'span', 'className': 'feed-new-message-inf-text'}, false); 72 nodeTmp2 = BX.findChild(BX('sonet_log_more_container'), {'tag':'span', 'className': 'feed-new-message-inf-text-waiting'}, false); 73 if (nodeTmp1 && nodeTmp2) 74 { 75 nodeTmp1.style.display = 'none'; 76 nodeTmp2.style.display = 'inline'; 77 } 78 arPos = BX.pos(BX('sonet_log_more_container')); 79 nodeTmp1Cap = document.body.appendChild(BX.create('div', { 80 style: { 81 position: 'absolute', 82 width: arPos.width + 'px', 83 height: arPos.height + 'px', 84 top: arPos.top + 'px', 85 left: arPos.left + 'px', 86 zIndex: 1000 87 } 88 })); 89 } 90 91 if (BX('sonet_log_counter_2_container')) 92 { 93 nodeTmp1 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text'}, false); 94 nodeTmp2 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text-waiting'}, false); 95 96 if (nodeTmp1 && nodeTmp2) 97 { 98 nodeTmp1.style.display = 'none'; 99 nodeTmp2.style.display = 'inline'; 100 } 101 arPos = BX.pos(BX('sonet_log_more_container')); 102 nodeTmp2Cap = document.body.appendChild(BX.create('div', { 103 style: { 104 position: 'absolute', 105 width: arPos.width + 'px', 106 height: arPos.height + 'px', 107 top: arPos.top + 'px', 108 left: arPos.left + 'px', 109 zIndex: 1000 110 } 111 })); 112 } 113 114 BX.unbind(BX('sonet_log_counter_2_container'), 'click', __logOnAjaxInsertToNode); 115} 116 117function sonetLClearContainerExternalNew() 118{ 119 logAjaxMode = 'new'; 120} 121 122function sonetLClearContainerExternalMore() 123{ 124 logAjaxMode = 'more'; 125} 126 127function _sonetLClearContainerExternal(mode) 128{ 129 if (BX('sonet_log_more_container')) 130 { 131 nodeTmp1 = BX.findChild(BX('sonet_log_more_container'), {'tag':'span', 'className': 'feed-new-message-inf-text'}, false); 132 nodeTmp2 = BX.findChild(BX('sonet_log_more_container'), {'tag':'span', 'className': 'feed-new-message-inf-text-waiting'}, false); 133 if (nodeTmp1 && nodeTmp2) 134 { 135 nodeTmp1.style.display = 'inline'; 136 nodeTmp2.style.display = 'none'; 137 } 138 } 139 140 if (BX('sonet_log_counter_2_wrap')) 141 { 142 BX.removeClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim"); 143 BX("sonet_log_counter_2_wrap").style.visibility = "hidden"; 144 } 145 146 if (BX('sonet_log_counter_2_container')) 147 { 148 nodeTmp1 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text'}, false); 149 nodeTmp2 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text-waiting'}, false); 150 nodeTmp3 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text-reload'}, false); 151 152 if (nodeTmp1 && nodeTmp2 && nodeTmp3) 153 { 154 nodeTmp1.style.display = 'inline'; 155 nodeTmp2.style.display = 'none'; 156 nodeTmp3.style.display = 'none'; 157 } 158 } 159 160 if (nodeTmp1Cap && nodeTmp1Cap.parentNode) 161 { 162 nodeTmp1Cap.parentNode.removeChild(nodeTmp1Cap); 163 } 164 165 if (nodeTmp2Cap && nodeTmp2Cap.parentNode) 166 { 167 nodeTmp2Cap.parentNode.removeChild(nodeTmp2Cap); 168 } 169 170 if (BX("sonet_log_counter_preset") && logAjaxMode == 'new') 171 { 172 BX("sonet_log_counter_preset").style.display = "none"; 173 } 174} 175
176function __logChangeCounter(count) 177{ 178 var bZeroCounterFromDB = (parseInt(count) <= 0); 179 180 oCounter = { 181 iCommentsRead: 0 182 }; 183 184 BX.onCustomEvent(window, 'onSonetLogChangeCounter', [oCounter]); 185 count -= oCounter.iCommentsRead; 186 __logChangeCounterAnimate((parseInt(count) > 0), count, bZeroCounterFromDB); 187} 188 189function __logDecrementCounter(iDecrement) 190{ 191 if (BX("sonet_log_counter_2")) 192 { 193 iDecrement = parseInt(iDecrement); 194 var oldVal = parseInt(BX("sonet_log_counter_2").innerHTML); 195 var newVal = oldVal - iDecrement; 196 if (newVal > 0) 197 BX("sonet_log_counter_2").innerHTML = newVal; 198 else 199 __logChangeCounterAnimate(false, 0); 200 } 201} 202 203function __logChangeCounterAnimate(bShow, count, bZeroCounterFromDB) 204{ 205 bZeroCounterFromDB = !!bZeroCounterFromDB; 206 207 if (!!window.bLockCounterAnimate) 208 { 209 setTimeout(function() { 210 __logChangeCounterAnimate(bShow, count) 211 }, 200); 212 return false; 213 } 214 215 bShow = !!bShow; 216 if (bShow) 217 { 218 if (BX("sonet_log_counter_2")) 219 BX("sonet_log_counter_2").innerHTML = count; 220 221 if (BX("sonet_log_counter_2_wrap")) 222 { 223 BX("sonet_log_counter_2_wrap").style.visibility = "visible"; 224 BX.addClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim"); 225 } 226 } 227 else if (BX("sonet_log_counter_2_wrap")) 228 { 229 if ( 230 bZeroCounterFromDB 231 && BX.hasClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim") 232 ) 233 { 234 if (BX('sonet_log_counter_2_container')) 235 { 236 nodeTmp1 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text'}, false); 237 nodeTmp2 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text-waiting'}, false); 238 nodeTmp3 = BX.findChild(BX('sonet_log_counter_2_container'), {'tag':'span', 'className': 'feed-new-message-inf-text-reload'}, false); 239 240 if (nodeTmp1 && nodeTmp2 && nodeTmp3) 241 { 242 nodeTmp1.style.display = 'none'; 243 nodeTmp2.style.display = 'none'; 244 nodeTmp3.style.display = 'inline'; 245 } 246 } 247 } 248 else 249 setTimeout(function() { 250 BX.removeClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim"); 251 BX("sonet_log_counter_2_wrap").style.visibility = "hidden"; 252 }, 400); 253 } 254} 255 256function __logChangeCounterArray(arCount) 257{ 258 if (typeof arCount[BX.message('sonetLCounterType')] != 'undefined') 259 __logChangeCounter(arCount[BX.message('sonetLCounterType')]); 260} 261 262function __logShowPostMenu(bindElement, ind, entity_type, entity_id, event_id, fullset_event_id, user_id, log_id, bFavorites, arMenuItemsAdditional) 263{ 264 BX.PopupMenu.destroy("post-menu-" + ind); 265 266 var itemFavorites = null; 267 268 if (BX.message('sonetLbUseFavorites') != 'N') 269 { 270 itemFavorites = { 271 text : (bFavorites ? BX.message('sonetLMenuFavoritesTitleY') : BX.message('sonetLMenuFavoritesTitleN')), 272 className : "menu-popup-no-icon", 273 onclick : function(e) { __logChangeFavorites(log_id, 'log_entry_favorites_' + log_id, (bFavorites ? 'N' : 'Y'), true); return BX.PreventDefault(e); } 274 }; 275 } 276 277 var arItems = [ 278 ( 279 bindElement.getAttribute("data-log-entry-url").length > 0 ? 280 { 281 text : '<span id="post-menu-' + ind + '-href-text">' + BX.message("sonetLMenuHref") + '</span>', 282 className : "menu-popup-no-icon feed-entry-popup-menu feed-entry-popup-menu-href", 283 href : bindElement.getAttribute("data-log-entry-url") 284 } : null 285 ), 286 ( 287 bindElement.getAttribute("data-log-entry-url").length > 0 288 ? { 289 text : '<span id="post-menu-' + ind + '-link-text">' + BX.message("sonetLMenuLink") + '</span>', 290 className : "menu-popup-no-icon feed-entry-popup-menu feed-entry-popup-menu-link", 291 onclick : function() { 292 293 id = 'post-menu-' + ind + '-link', 294 it = BX.proxy_context, 295 height = parseInt(!!it.getAttribute("bx-height") ? it.getAttribute("bx-height") : it.offsetHeight); 296 297 if (it.getAttribute("bx-status") != "shown") 298 { 299 it.setAttribute("bx-status", "shown"); 300 if (!BX(id) && !!BX(id + '-text')) 301 { 302 var 303 node = BX(id + '-text'), 304 pos = BX.pos(node), 305 pos2 = BX.pos(node.parentNode); 306 pos3 = BX.pos(BX.findParent(node, {'className': 'menu-popup-item'}, true)); 307 308 pos["height"] = pos2["height"] - 1; 309 310 BX.adjust(it, { 311 attrs : {"bx-height" : it.offsetHeight}, 312 style : { 313 overflow : "hidden", 314 display : 'block' 315 }, 316 children : [ 317 BX.create('BR'), 318 BX.create('DIV', { 319 attrs : {id : id}, 320 children : [ 321 BX.create('SPAN', {attrs : {"className" : "menu-popup-item-left"}}), 322 BX.create('SPAN', {attrs : {"className" : "menu-popup-item-icon"}}), 323 BX.create('SPAN', {attrs : {"className" : "menu-popup-item-text"}, 324 children : [ 325 BX.create('INPUT', { 326 attrs : { 327 id : id + '-input', 328 type : "text", 329 value : bindElement.getAttribute('data-log-entry-url') } , 330 style : { 331 height : pos["height"] + 'px', 332 width : (pos3["width"]-21) + 'px' 333 }, 334 events : { click : function(e){ this.select(); BX.PreventDefault(e); } } 335 } 336 ) 337 ] 338 }) 339 ] 340 }), 341 BX.create('SPAN', {"className" : "menu-popup-item-right"}) 342 ] 343 }); 344 } 345 (new BX.fx({ 346 time: 0.2, 347 step: 0.05, 348 type: 'linear', 349 start: height, 350 finish: height * 2, 351 callback: BX.delegate(function(height) {this.style.height = height + 'px';}, it) 352 })).start(); 353 BX.fx.show(BX(id), 0.2); 354 BX(id + '-input').select(); 355 } 356 else 357 { 358 it.setAttribute("bx-status", "hidden"); 359 (new BX.fx({ 360 time: 0.2, 361 step: 0.05, 362 type: 'linear', 363 start: it.offsetHeight, 364 finish: height, 365 callback: BX.delegate(function(height) {this.style.height = height + 'px';}, it) 366 })).start(); 367 BX.fx.hide(BX(id), 0.2); 368 } 369 } 370 } 371 : null 372 ), 373 itemFavorites, 374 ( 375 BX.message('sonetLCanDelete') == 'Y' ? 376 { 377 text : BX.message('sonetLMenuDelete'), 378 className : "menu-popup-no-icon", 379 onclick : function(e) { 380 if (confirm(BX.message('sonetLMenuDeleteConfirm'))) 381 { 382 __logDelete(log_id, 'log-entry-' + log_id, ind); 383 } 384 return BX.PreventDefault(e); 385 } 386 } : null 387 ) 388 ]; 389 390 if ( 391 !!arMenuItemsAdditional 392 && BX.type.isArray(arMenuItemsAdditional) 393 ) 394 { 395 for (var i = 0; i < arMenuItemsAdditional.length; i++) 396 if (typeof arMenuItemsAdditional[i].className == 'undefined') 397 arMenuItemsAdditional[i].className = "menu-popup-no-icon"; 398 399 arItems = BX.util.array_merge(arItems, arMenuItemsAdditional); 400 } 401 402 var arParams = { 403 offsetLeft: -14, 404 offsetTop: 4, 405 lightShadow: false, 406 angle: {position: 'top', offset : 50}, 407 events : { 408 onPopupShow : function(ob) 409 { 410 if (BX('log_entry_favorites_' + log_id)) 411 { 412 var menuItems = BX.findChildren(ob.contentContainer, {'className' : 'menu-popup-item-text'}, true); 413 if (menuItems != null) 414 { 415 for (var i = 0; i < menuItems.length; i++) 416 { 417 if ( 418 menuItems[i].innerHTML == BX.message('sonetLMenuFavoritesTitleY') 419 || menuItems[i].innerHTML == BX.message('sonetLMenuFavoritesTitleN') 420 ) 421 { 422 var favoritesMenuItem = menuItems[i]; 423 break; 424 } 425 } 426 } 427 428 if (favoritesMenuItem != undefined) 429 { 430 if (BX.hasClass(BX('log_entry_favorites_' + log_id), 'feed-post-important-switch-active')) 431 BX(favoritesMenuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleY'); 432 else 433 BX(favoritesMenuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleN'); 434 } 435 } 436 437 if (BX('post-menu-' + ind + '-link')) 438 { 439 var linkMenuItem = BX.findChild(ob.popupContainer, {className: 'feed-entry-popup-menu-link'}, true, false); 440 if (linkMenuItem) 441 { 442 var height = parseInt(!!linkMenuItem.getAttribute("bx-height") ? linkMenuItem.getAttribute("bx-height") : 0); 443 if (height > 0) 444 { 445 BX('post-menu-' + ind + '-link').style.display = "none"; 446 linkMenuItem.setAttribute("bx-status", "hidden"); 447 linkMenuItem.style.height = height + 'px'; 448 } 449 } 450 } 451 } 452 } 453 }; 454 455 BX.PopupMenu.show("post-menu-" + ind, bindElement, arItems, arParams); 456} 457
458function __logCommentFormAutogrow(el) 459{ 460 var placeNodeoffsetHeightOld = 0; 461 462 if (el && BX.type.isDomNode(el)) 463 var textarea = el; 464 else 465 { 466 var textarea = BX.proxy_context; 467 var event = el || window.event; 468 469 if ((event.keyCode == 13 || event.keyCode == 10) && event.ctrlKey) 470 __logCommentAdd(); 471 } 472 473 var placeNode = BX.findParent(textarea, {'className': 'sonet-log-comment-form-place'}); 474 if (BX(placeNode)) 475 placeNodeoffsetHeightOld = BX(placeNode).offsetHeight; 476 477 var linesCount = 0; 478 var lines = textarea.value.split('\n'); 479 480 for (var i=lines.length-1; i>=0; --i) 481 linesCount += Math.floor((lines[i].length / CommentFormColsDefault) + 1); 482 483 if (linesCount >= CommentFormRowsDefault) 484 textarea.rows = linesCount + 1; 485 else 486 textarea.rows = CommentFormRowsDefault; 487} 488 489function __logGetNextPage(more_url, bFirst, oNode) 490{ 491 if (oLF.bLoadStarted) 492 { 493 return false; 494 } 495 496 oLF.bLoadStarted = true; 497 498 window.bLockCounterAnimate = true; 499 bFirst = !!bFirst; 500 501 if ( 502 !bFirst 503 && BX('feed-new-message-inf-wrap') 504 ) 505 { 506 BX('feed-new-message-inf-wrap').classList.toggle('feed-new-message-anim'); 507 } 508 509 var data = { method: "GET", url: more_url }; 510 BX.onCustomEvent("SonetLogBeforeGetNextPage", [ data ]); 511 if(BX.type.isNotEmptyString(data.url)) 512 { 513 more_url = data.url; 514 } 515 516 BX.ajax({ 517 url: more_url, 518 method: 'GET', 519 dataType: 'json', 520 data: { }, 521 onsuccess: function(data) 522 { 523 oLF.bLoadStarted = false; 524 if ( 525 !bFirst 526 && typeof oNode != 'undefined' 527 && oNode 528 && oNode.parentNode 529 ) 530 { 531 BX.cleanNode(oNode.parentNode, true); 532 } 533 534 window.bLockCounterAnimate = false; 535 536 if ( 537 typeof data != 'undefined' 538 && typeof (data.PROPS) != 'undefined' 539 && typeof (data.PROPS.CONTENT) != 'undefined' 540 && data.PROPS.CONTENT.length > 0 541 && ( 542 typeof data.LAST_TS == 'undefined' 543 || parseInt(data.LAST_TS) <= 0 544 || parseInt(BX.message('sonetLFirstPageLastTS')) <= 0 545 || parseInt(data.LAST_TS) < parseInt(BX.message('sonetLFirstPageLastTS')) 546 ) 547 ) 548 { 549 var content_block_id = 'content_block_' + (Math.floor(Math.random() * 1000)); 550 oLF.processAjaxBlock(data.PROPS, content_block_id, bFirst); 551 _sonetLClearContainerExternal(false); 552 553 if (bFirst) 554 { 555 BX('feed-new-message-inf-wrap-first').style.display = 'block'; 556 var f = function() { 557 if (BX(content_block_id)) 558 { 559 BX(content_block_id).style.display = 'block'; 560 } 561 BX.unbind(BX('sonet_log_more_container_first'), 'click', f); 562 BX('feed-new-message-inf-wrap-first').style.display = 'none'; 563 __logRecalcMoreButton(); 564 }; 565 BX.bind(BX('sonet_log_more_container_first'), 'click', f); 566 } 567 else 568 { 569 setTimeout(function() { __logRecalcMoreButton(); }, 1000); 570 } 571 } 572 }, 573 onfailure: function(data) 574 { 575 oLF.bLoadStarted = false; 576 if ( 577 !bFirst 578 && BX('feed-new-message-inf-wrap') 579 ) 580 { 581 BX('feed-new-message-inf-wrap').classList.toggle('feed-new-message-anim'); 582 } 583 584 window.bLockCounterAnimate = false; 585 _sonetLClearContainerExternal(false); 586 } 587 }); 588 589 return false; 590} 591function __logGetNextPageLinkEntities(entities, correspondences) 592{ 593 if (!!window.__logGetNextPageFormName && !!entities && !!correspondences && 594 !!window["UC"] && !!window["UC"][window.__logGetNextPageFormName] && 595 !!window["UC"][window.__logGetNextPageFormName].linkEntity) 596 { 597 window["UC"][window.__logGetNextPageFormName].linkEntity(entities); 598 for (var ii in correspondences) 599 { 600 if (!!ii && !!correspondences[ii]) 601 window["UC"][window.__logGetNextPageFormName]["entitiesCorrespondence"][ii] = correspondences[ii]; 602 } 603 } 604} 605 606function __logRefresh(refresh_url) 607{ 608 if (oLF.bLoadStarted) 609 { 610 return; 611 } 612 613 var counterWrap = BX("sonet_log_counter_2_wrap", true); 614 oLF.bLoadStarted = true; 615 616 if (counterWrap) 617 { 618 var nodeTmp3 = BX.findChild(counterWrap, {'tag':'span', 'className': 'feed-new-message-inf-text-reload'}, true); 619 if (nodeTmp3) 620 { 621 nodeTmp3.style.display = 'none'; 622 } 623 } 624 625 window.bLockCounterAnimate = true; 626 627 BX.ajax({ 628 url: refresh_url, 629 method: 'GET', 630 dataType: 'json', 631 data: { }, 632 onsuccess: function(data) 633 { 634 oLF.bLoadStarted = false;
635 636 if ( 637 typeof data != 'undefined' 638 && typeof (data.PROPS) != 'undefined' 639 && typeof (data.PROPS.CONTENT) != 'undefined' 640 && (data.PROPS.CONTENT.length > 0) 641 ) 642 { 643 window.bLockCounterAnimate = false; 644 BX.cleanNode('log_internal_container', false); 645 oLF.processAjaxBlock(data.PROPS); 646 _sonetLClearContainerExternal(false); 647 window.bStopTrackNextPage = false; 648 649 if (BX('feed-new-message-inf-wrap-first')) 650 { 651 BX('feed-new-message-inf-wrap-first').style.display = 'none'; 652 } 653 654 if (typeof arCommentsMoreButtonID != 'undefined') 655 { 656 arCommentsMoreButtonID = []; 657 } 658 659 if ( 660 counterWrap 661 && BX.hasClass(counterWrap, "feed-new-message-informer-fixed") 662 ) 663 { 664 var upBtn = BX("feed-up-btn-wrap", true); 665 if (upBtn) 666 { 667 upBtn.style.display = "none"; 668 BX.removeClass(upBtn, 'feed-up-btn-wrap-anim'); 669 } 670 671 var windowScroll = BX.GetWindowScrollPos(); 672 673 (new BX.easing({ 674 duration : 500, 675 start : { scroll : windowScroll.scrollTop }, 676 finish : { scroll : 0 }, 677 transition : BX.easing.makeEaseOut(BX.easing.transitions.quart), 678 step : function(state){ 679 window.scrollTo(0, state.scroll); 680 }, 681 complete: function() { 682 if (upBtn) 683 upBtn.style.display = "block"; 684 BX.onCustomEvent(window, 'onGoUp'); 685 } 686 })).animate(); 687 } 688 } 689 else 690 { 691 oLF.showRefreshError(); 692 } 693 }, 694 onfailure: function(data) 695 { 696 oLF.bLoadStarted = false; 697 oLF.showRefreshError(); 698 } 699 }); 700 701 return false; 702} 703 704function __logChangeFavorites(log_id, node, newState, bFromMenu) 705{ 706 if ( 707 !log_id 708 || !BX(node) 709 ) 710 { 711 return; 712 } 713 714 if (!!bFromMenu) 715 { 716 var menuItem = BX.proxy_context; 717 if (!BX.hasClass(BX(menuItem), 'menu-popup-item-text')) 718 { 719 menuItem = BX.findChild(BX(menuItem), {'className': 'menu-popup-item-text'}, true); 720 } 721 } 722 723 var nodeToAdjust = ( 724 BX.hasClass(BX(node), 'feed-post-important-switch') 725 ? BX(node) 726 : BX.findChild(BX(node), { 'className': 'feed-post-important-switch' }) 727 ); 728 729 if (newState != undefined) 730 { 731 if (newState == "Y") 732 { 733 BX.addClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 734 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleY'); 735 if (typeof menuItem != 'undefined') 736 { 737 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleY'); 738 } 739 } 740 else 741 { 742 BX.removeClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 743 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleN'); 744 if (typeof menuItem != 'undefined') 745 { 746 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleN'); 747 } 748 } 749 } 750 751 var sonetLXmlHttpSet5 = new XMLHttpRequest(); 752 753 sonetLXmlHttpSet5.open("POST", BX.message('sonetLESetPath'), true); 754 sonetLXmlHttpSet5.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 755 756 sonetLXmlHttpSet5.onreadystatechange = function() 757 { 758 if(sonetLXmlHttpSet5.readyState == 4) 759 { 760 if(sonetLXmlHttpSet5.status == 200) 761 { 762 var data = LBlock.DataParser(sonetLXmlHttpSet5.responseText); 763 if (typeof(data) == "object") 764 { 765 if (data[0] == '*') 766 { 767 if (sonetLErrorDiv != null) 768 { 769 sonetLErrorDiv.style.display = "block"; 770 sonetLErrorDiv.innerHTML = sonetLXmlHttpSet5.responseText; 771 } 772 return; 773 } 774 sonetLXmlHttpSet5.abort(); 775 776 var strMessage = ''; 777 778 if ( 779 data["bResult"] != undefined 780 && ( 781 data["bResult"] == "Y" 782 || data["bResult"] == "N" 783 ) 784 ) 785 { 786 if (data["bResult"] == "Y") 787 { 788 BX.addClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 789 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleY'); 790 if (menuItem != undefined) 791 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleY'); 792 } 793 else 794 { 795 BX.removeClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 796 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleN'); 797 if (menuItem != undefined) 798 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleN'); 799 } 800 } 801 } 802 } 803 else 804 {
805 // error! 806 } 807 } 808 } 809 810 sonetLXmlHttpSet5.send("r=" + Math.floor(Math.random() * 1000) 811 + "&" + BX.message('sonetLSessid') 812 + "&site=" + BX.util.urlencode(BX.message('sonetLSiteId')) 813 + "&log_id=" + encodeURIComponent(log_id) 814 + "&action=change_favorites" 815 ); 816} 817 818function __logDelete(log_id, node, ind) 819{ 820 if (!log_id) 821 { 822 return; 823 } 824 825 if (!BX(node)) 826 { 827 return; 828 } 829 830 BX.ajax({ 831 url: BX.message('sonetLESetPath'), 832 method: 'POST', 833 dataType: 'json', 834 data: { 835 sessid : BX.bitrix_sessid(), 836 site : BX.message('sonetLSiteId'), 837 log_id : log_id, 838 action : 'delete' 839 }, 840 onsuccess: function(data) { 841 if ( 842 data.bResult != undefined 843 && (data.bResult == "Y") 844 ) 845 { 846 if (typeof ind != 'undefined') 847 { 848 BX.PopupMenu.destroy("post-menu-" + ind); 849 } 850 __logDeleteSuccess(BX(node)); 851 } 852 else 853 { 854 __logDeleteFailure(BX(node)); 855 } 856 }, 857 onfailure: function(data) { 858 __logDeleteFailure(BX(node)); 859 } 860 }); 861} 862 863function __logDeleteSuccess(node) 864{ 865 if ( 866 typeof node == 'undefined' 867 || !node 868 || !BX(node) 869 ) 870 { 871 return; 872 } 873 874 (new BX.fx({ 875 time: 0.5, 876 step: 0.05, 877 type: 'linear', 878 start: BX(node).offsetHeight, 879 finish: 60, 880 callback: BX.delegate(function(height) { 881 this.style.height = height + 'px'; 882 }, BX(node)), 883 callback_start: BX.delegate(function() { 884 this.style.overflow = 'hidden'; 885 this.style.minHeight = 0; 886 }, BX(node)), 887 callback_complete: BX.delegate(function() { 888 this.style.marginBottom = 0; 889 BX.cleanNode(this); 890 this.appendChild(BX.create('DIV', { 891 props: { 892 'className': 'feed-add-successfully' 893 }, 894 style: { 895 'marginLeft': '17px', 896 'marginRight': '17px', 897 'marginTop': '10px' 898 }, 899 children: [ 900 BX.create('span', { 901 props: { 902 'className': 'feed-add-info-text' 903 }, 904 children: [ 905 BX.create('span', { 906 props: { 907 'className': 'feed-add-info-icon' 908 } 909 }), 910 BX.create('span', { 911 html: BX.message('sonetLMenuDeleteSuccess') 912 }) 913 ] 914 }) 915 ] 916 })); 917 }, BX(node)) 918 })).start(); 919} 920 921function __logDeleteFailure(node) 922{ 923 if ( 924 typeof node == 'undefined' 925 || !node 926 || !BX(node) 927 ) 928 { 929 return; 930 } 931 932 node.insertBefore(BX.create('DIV', { 933 props: { 934 'className': 'feed-add-error' 935 }, 936 style: { 937 'marginLeft': '84px', 938 'marginRight': '37px', 939 'marginTop': '18px', 940 'marginBottom': '4px' 941 }, 942 children: [ 943 BX.create('span', { 944 props: { 945 'className': 'feed-add-info-text' 946 }, 947 children: [ 948 BX.create('span', { 949 props: { 950 'className': 'feed-add-info-icon' 951 } 952 }), 953 BX.create('span', { 954 html: BX.message('sonetLMenuDeleteFailure') 955 }) 956 ] 957 }) 958 ] 959 }), node.firstChild); 960} 961 962function __logOnFeedScroll() 963{ 964 // Live Feed Paging 965 if ( 966 window.feedScrollLock == undefined 967 || window.feedScrollLock === false 968 ) 969 { 970 window.feedScrollLock = true; 971 972 setTimeout(function() { 973 window.feedScrollLock = false; 974 }, 100); 975 976 var windowSize = BX.GetWindowSize(); 977 978 if ( 979 window.bStopTrackNextPage === undefined 980 || window.bStopTrackNextPage == false 981 ) 982 { 983 var maxScroll = parseInt(windowSize.scrollHeight / 2); 984 985 if ((windowSize.scrollHeight - windowSize.innerHeight) < maxScroll) 986 { 987 maxScroll = 1; 988 } 989 990 if (windowSize.scrollTop >= maxScroll && next_url) 991 { 992 window.bStopTrackNextPage = true; 993 __logGetNextPage(next_url, true); 994 } 995 } 996 } 997 998 //Live Feed New Message Block 999 var counterWrap = BX("sonet_log_counter_2_wrap", true); 1000 if (counterWrap) 1001 { 1002 var top = counterWrap.parentNode.getBoundingClientRect().top; 1003 if (top <= 0) 1004 { 1005 BX.addClass(counterWrap, "feed-new-message-informer-fixed"); 1006 setTimeout(function() { 1007 if (BX.hasClass(counterWrap, "feed-new-message-informer-fixed")) 1008 { 1009 BX.addClass(counterWrap, "feed-new-message-informer-fix-anim"); 1010 } 1011 }, 100); 1012 } 1013 else 1014 { 1015 BX.removeClass(counterWrap, "feed-new-message-informer-fixed feed-new-message-informer-fix-anim"); 1016 } 1017 } 1018} 1019 1020function __logScrollInit(enable) 1021{ 1022 if (!!enable) 1023 { 1024 BX.unbind(window, 'scroll', __logOnFeedScroll); 1025 BX.bind(window, 'scroll', __logOnFeedScroll); 1026 } 1027 else 1028 { 1029 BX.unbind(window, 'scroll', __logOnFeedScroll); 1030 } 1031} 1032 1033function __logRecalcMoreButton() 1034{ 1035 if (typeof arMoreButtonID != 'undefined') 1036 { 1037 var arPos = false;
1038 var arPosOuter = false; 1039 var obOuter = false; 1040 var obInner = false; 1041 1042 for (var i = 0; i < arMoreButtonID.length; i++) 1043 { 1044 arPos = BX.pos(BX(arMoreButtonID[i].bodyBlockID)); 1045 if (arPos.height < 280) 1046 { 1047 BX(arMoreButtonID[i].moreButtonBlockID).style.display = "none"; 1048 } 1049 1050 if (typeof arMoreButtonID[i].outerBlockID != 'undefined') 1051 { 1052 obOuter = BX(arMoreButtonID[i].outerBlockID); 1053 if (obOuter) 1054 { 1055 arPosOuter = BX.pos(obOuter); 1056 if (arPosOuter.width < arPos.width) 1057 { 1058 obInner = BX.findChild(obOuter, {'tag':'div', 'className': 'feed-post-text-block-inner'}, false); 1059 obInner.style.overflowX = 'scroll' 1060 } 1061 } 1062 } 1063 } 1064 } 1065 1066 if (typeof arCommentsMoreButtonID != 'undefined') 1067 { 1068 var arPos = false; 1069 for (var i = 0; i < arCommentsMoreButtonID.length; i++) 1070 { 1071 arPos = BX.pos(BX(arCommentsMoreButtonID[i].bodyBlockID)); 1072 if (arPos.height < 200) 1073 { 1074 BX(arCommentsMoreButtonID[i].moreButtonBlockID).style.display = "none"; 1075 } 1076 } 1077 } 1078} 1079 1080window.__socOnUCFormClear = function(obj) { 1081 LHEPostForm.reinitDataBefore(obj.editorId); 1082}; 1083window.__socOnUCFormAfterShow = function(obj, text, data) 1084{ 1085 data = (!!data ? data : {}); 1086 1087 var eId = obj.entitiesCorrespondence[obj.id.join('-')][0], id = obj.entitiesCorrespondence[obj.id.join('-')][1]; 1088 BX.show(BX('feed_comments_block_' + eId)); 1089 BX.onCustomEvent(window, "OnBeforeSocialnetworkCommentShowedUp", ['socialnetwork']); 1090 obj.form.action = obj.url.replace(/\#eId\#/, eId).replace(/\#id\#/, id); 1091 1092 var 1093 post_data = { 1094 ENTITY_XML_ID : obj.id[0], 1095 ENTITY_TYPE : obj.entitiesId[obj.id[0]][0], 1096 ENTITY_ID : obj.entitiesId[obj.id[0]][1], 1097 parentId : obj.id[1], 1098 comment_post_id : obj.entitiesId[obj.id[0]][1], 1099 edit_id : obj.id[1], 1100 act : (obj.id[1] > 0 ? 'edit' : 'add'), 1101 logId : obj.entitiesId[obj.id[0]][2] 1102 }; 1103 for (var ii in post_data) 1104 { 1105 if (!obj.form[ii]) 1106 { 1107 obj.form.appendChild(BX.create('INPUT', {attrs : {name : ii, type: "hidden"}})); 1108 } 1109 obj.form[ii].value = post_data[ii]; 1110 } 1111 __socOnLightEditorShow(text, data); 1112}; 1113window.__socOnUCFormSubmit = function(obj, post_data) { 1114 post_data["r"] = Math.floor(Math.random() * 1000); 1115 post_data["sessid"] = BX.bitrix_sessid(); 1116 post_data["log_id"] = obj.entitiesCorrespondence[obj.id.join('-')][0]; 1117 post_data["p_smile"] = BX.message('sonetLPathToSmile'); 1118 post_data["p_ubp"] = BX.message('sonetLPathToUserBlogPost'); 1119 post_data["p_gbp"] = BX.message('sonetLPathToGroupBlogPost'); 1120 post_data["p_umbp"] = BX.message('sonetLPathToUserMicroblogPost'); 1121 post_data["p_gmbp"] = BX.message('sonetLPathToGroupMicroblogPost'); 1122 post_data["p_user"] = BX.message('sonetLPathToUser'); 1123 post_data["p_le"] = BX.message('sonetLEPath'); 1124 post_data["f_id"] = BX.message('sonetLForumID'); 1125 post_data["bapc"] = BX.message('sonetLBlogAllowPostCode'); 1126 post_data["site"] = BX.message('sonetLSiteId'); 1127 post_data["lang"] = BX.message('sonetLLangId'); 1128 post_data["nt"] = BX.message('sonetLNameTemplate'); 1129 post_data["sl"] = BX.message('sonetLShowLogin'); 1130 post_data["as"] = BX.message('sonetLAvatarSizeComment'); 1131 post_data["dtf"] = BX.message('sonetLDateTimeFormat'); 1132 post_data["message"] = post_data["REVIEW_TEXT"]; 1133 post_data["action"] = 'add_comment' 1134 post_data["RATING_TYPE"] = BX.message("sonetRatingType"); 1135 post_data["pull"] = "Y"; 1136 post_data["crm"] = BX.message('sonetLIsCRM'); 1137 obj.form["bx-action"] = obj.form.action; 1138 obj.form.action = BX.message('sonetLESetPath'); 1139}; 1140window.__socOnUCFormResponse = function(obj, data) 1141{ 1142 obj.form.action = obj.form["bx-action"]; 1143 var return_data = {errorMessage : data}, 1144 eId = obj.entitiesCorrespondence[obj.id.join('-')][0], 1145 res = {}; 1146 1147 if (!(!!data && typeof data == "object")) 1148 {} 1149 else if (data[0] == '*') 1150 { 1151 return_data = {errorMessage : BX.message("sonetLErrorSessid")}; 1152 } 1153 else 1154 { 1155 if (!(data["commentID"] > 0) || !!data["strMessage"]) 1156 return_data['errorMessage'] = data["strMessage"]; 1157 else if (data['return_data']) 1158 return_data = data['return_data']; 1159 else { 1160 var 1161 arComment = data["arCommentFormatted"], 1162 arComm = data["arComment"], 1163 ratingNode = (!!window["__logBuildRating"] ? window["__logBuildRating"](data["arComment"], data["arCommentFormatted"]) : null),
1164 thisId = (!!arComm["SOURCE_ID"] ? arComm["SOURCE_ID"] : arComm["ID"]), 1165 res = { 1166 "ID" : thisId, // integer 1167 "ENTITY_XML_ID" : obj.id[0], // string 1168 "FULL_ID" : [obj.id[0], thisId], 1169 "NEW" : "N", //"Y" | "N" 1170 "APPROVED" : "Y", //"Y" | "N" 1171 "POST_TIMESTAMP" : data["timestamp"] - BX.message('USER_TZ_OFFSET'), 1172 "POST_TIME" : arComment["LOG_TIME_FORMAT"], 1173 "POST_DATE" : arComment["LOG_TIME_FORMAT"], 1174 "~POST_MESSAGE_TEXT" : arComment["MESSAGE"], 1175 "POST_MESSAGE_TEXT" : arComment["MESSAGE_FORMAT"], 1176 "PANELS" : { 1177 "MODERATE" : false 1178 }, 1179 "URL" : { 1180 "LINK" : ((arComm["URL"] && arComm["URL"].length > 0) ? arComm["URL"] : BX.message('sonetLEPath').replace("#log_id#", arComm["LOG_ID"]) + '?commentId=' + arComm["ID"] + '#com' + (parseInt(arComm["SOURCE_ID"]) > 0 ? arComm["SOURCE_ID"] : arComm["ID"])) 1181 }, 1182 "AUTHOR" : { 1183 "ID" : arComment["USER_ID"], 1184 "NAME" : arComment["CREATED_BY"]["FORMATTED"], 1185 "URL" : arComment["CREATED_BY"]["URL"], 1186 "AVATAR" : arComment["AVATAR_SRC"] }, 1187 "BEFORE_ACTIONS" : (!!ratingNode ? ratingNode : ''), 1188 "AFTER" : arComment["UF"] 1189 }; 1190 1191 if ( 1192 typeof (data["hasEditCallback"]) != 'undefined' 1193 && data["hasEditCallback"] == "Y" 1194 ) 1195 { 1196 res["PANELS"]["EDIT"] = "Y"; 1197 res["URL"]["EDIT"] = "__logEditComment('" + obj.id[0] + "', '" + arComm["ID"] + "', '" + arComm["LOG_ID"] + "');"; 1198 } 1199 1200 if ( 1201 typeof (data["hasDeleteCallback"]) != 'undefined' 1202 && data["hasDeleteCallback"] == "Y" 1203 ) 1204 { 1205 res["PANELS"]["DELETE"] = "Y"; 1206 res["URL"]["DELETE"] = BX.message('sonetLESetPath') + '?lang=' + BX.message('sonetLLangId') + '&action=delete_comment&delete_comment_id=' + arComm["ID"] + '&post_id=' + arComm["LOG_ID"] + '&site=' + BX.message('sonetLSiteId'); 1207 } 1208 1209 return_data = { 1210 'errorMessage' : '', 1211 'okMessage' : '', 1212 'status' : true, 1213 'message' : '', 1214 'messageCode' : arComment["MESSAGE"], 1215 'messageId' : [obj.id[0], thisId], 1216 '~message' : '', 1217 'messageFields' : res 1218 }; 1219 } 1220 1221 1222 var node = BX("log_entry_follow_" + eId, true), 1223 strFollowOld = (!!node ? (node.getAttribute("data-follow") == "Y" ? "Y" : "N") : false); 1224 if (strFollowOld == "N") 1225 { 1226 BX.findChild(node, { tagName: 'a' }).innerHTML = BX.message('sonetLFollowY'); 1227 node.setAttribute("data-follow", "Y"); 1228 } 1229 1230 var node = BX("feed-comments-all-cnt-" + eId, true), 1231 val = (!!node ? (node.innerHTML.length > 0 ? parseInt(node.innerHTML) : 0) : false); 1232 if (val !== false) 1233 node.innerHTML = (val + 1); 1234 } 1235 1236 obj.OnUCFormResponseData = return_data; 1237} 1238 1239window.__socOnLightEditorShow = function(content, data){ 1240 var res = {}; 1241 if (data["arFiles"]) 1242 { 1243 var tmp2 = {}, name, size; 1244 for (var ij = 0; ij < data["arFiles"].length; ij++) 1245 { 1246 name = BX.findChild(BX('wdif-doc-' + data["arFiles"][ij]), {className : "feed-com-file-name"}, true); 1247 size = BX.findChild(BX('wdif-doc-' + data["arFiles"][ij]), {className : "feed-con-file-size"}, true); 1248 1249 tmp2['F' + ij] = { 1250 FILE_ID : data["arFiles"][ij], 1251 FILE_NAME : (name ? name.innerHTML : "noname"), 1252 FILE_SIZE : (size ? size.innerHTML : "unknown"), 1253 CONTENT_TYPE : "notimage/xyz"}; 1254 } 1255 res["UF_SONET_COM_DOC"] = { 1256 USER_TYPE_ID : "file", 1257 FIELD_NAME : "UF_SONET_COM_FILE[]", 1258 VALUE : tmp2}; 1259 } 1260 if (data["arDocs"]) 1261 res["UF_SONET_COM_FILE"] = { 1262 USER_TYPE_ID : "webdav_element", 1263 FIELD_NAME : "UF_SONET_COM_DOC[]", 1264 VALUE : BX.clone(data["arDocs"])}; 1265 if (data["arDFiles"]) 1266 res["UF_SONET_COM_FILE"] = { 1267 USER_TYPE_ID : "disk_file", 1268 FIELD_NAME : "UF_SONET_COM_DOC[]", 1269 VALUE : BX.clone(data["arDFiles"])}; 1270 LHEPostForm.reinitData(SLEC.editorId, content, res); 1271} 1272 1273BitrixLF = function () 1274{ 1275 this.bLoadStarted = false; 1276}; 1277 1278BitrixLF.prototype.showRefreshError = function() 1279{ 1280 window.bLockCounterAnimate = false; 1281 _sonetLClearContainerExternal(false); 1282/* 1283 var f = function() 1284 { 1285 if (BX('sonet_log_counter_2_wrap')) 1286 { 1287 BX.unbind(BX('sonet_log_counter_2_error'), 'click', f); 1288 BX('sonet_log_counter_2_error').style.display = 'none'; 1289 BX('sonet_log_counter_2_container').style.display = 'block'; 1290 BX.removeClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim"); 1291 } 1292 }; 1293 1294 if (BX('sonet_log_counter_2_wrap')) 1295 { 1296 BX.addClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim"); 1297 BX.bind(BX('sonet_log_counter_2_error'), 'click', f); 1298 BX('sonet_log_counter_2_container').style.display = 'none'; 1299 BX('sonet_log_counter_2_error').style.display = 'block'; 1300 } 1301*/ 1302} 1303 1304BitrixLF.prototype.LazyLoadCheckVisibility = function(image) // to check if expanded or not 1305{ 1306 var img = image.node;
1307 1308 var textType = 'comment'; 1309 1310 var textBlock = BX.findParent(img, {'className': 'feed-com-text'}); 1311 if (!textBlock) 1312 { 1313 textType = 'post'; 1314 textBlock = BX.findParent(img, {'className': 'feed-post-text-block'}); 1315 } 1316 1317 if (textBlock) 1318 { 1319 var moreBlock = BX.findChild(textBlock, {'tag':'div', 'className': 'feed-post-text-more'}, false) 1320 if ( 1321 moreBlock 1322 && moreBlock.style.display != 'none' 1323 ) 1324 { 1325 return img.parentNode.parentNode.offsetTop < (textType == 'comment' ? 220 : 270); 1326 } 1327 } 1328 1329 return true; 1330}; 1331 1332BitrixLF.prototype.processAjaxBlock = function(block, nodeId, bFirst) 1333{ 1334 if (!block) 1335 { 1336 return; 1337 } 1338 1339 if (!nodeId) 1340 { 1341 nodeId = 'content_block_' + (Math.floor(Math.random() * 1000)); 1342 } 1343 1344 bFirst = !!bFirst; 1345 1346 var htmlWasInserted = false; 1347 var scriptsLoaded = false; 1348 1349 processCSS(insertHTML); 1350 processExternalJS(processInlineJS); 1351 1352 function processCSS(callback) 1353 { 1354 if ( 1355 BX.type.isArray(block.CSS) 1356 && block.CSS.length > 0 1357 ) 1358 { 1359 BX.load(block.CSS, callback); 1360 } 1361 else 1362 { 1363 callback(); 1364 } 1365 } 1366 1367 function insertHTML() 1368 { 1369 BX('log_internal_container').appendChild(BX.create('DIV', { 1370 props: { 1371 id: nodeId, 1372 className: 'feed-wrap' 1373 }, 1374 style: { 1375 display: (bFirst ? 'none' : 'block') 1376 }, 1377 html: block.CONTENT 1378 })); 1379 1380 htmlWasInserted = true; 1381 if (scriptsLoaded) 1382 { 1383 processInlineJS(); 1384 } 1385 } 1386 1387 function processExternalJS(callback) 1388 { 1389 if ( 1390 BX.type.isArray(block.JS) 1391 && block.JS.length > 0 1392 ) 1393 { 1394 BX.load(block.JS, callback); // to initialize 1395 } 1396 else 1397 { 1398 callback(); 1399 } 1400 } 1401 1402 function processInlineJS() 1403 { 1404 scriptsLoaded = true; 1405 if (htmlWasInserted) 1406 { 1407 BX.ajax.processRequestData(block.CONTENT, { 1408 scriptsRunFirst: false, 1409 dataType: "HTML" 1410 }); 1411 } 1412 } 1413}; 1414 1415BitrixLF.prototype.createTask = function(params) 1416{ 1417 this.createTaskPopup = new BX.PopupWindow("BXCTP", null, { 1418 autoHide: false, 1419 zIndex: 0, 1420 offsetLeft: 0, 1421 offsetTop: 0, 1422 overlay: false, 1423 lightShadow: true, 1424 closeIcon: { 1425 right : "12px", 1426 top : "10px" 1427 }, 1428 draggable: { 1429 restrict:true 1430 }, 1431 closeByEsc: false, 1432 contentColor : 'white', 1433 contentNoPaddings: true, 1434 buttons: [], 1435 content: BX.create('DIV', { 1436 attrs: { 1437 id: 'BXCTP_content' 1438 }, 1439 props: { 1440 className: 'feed-create-task-popup-content' 1441 } 1442 }), 1443 events: { 1444 onAfterPopupShow: BX.proxy(function() 1445 { 1446 oLF.createTaskSetContent(BX.create('DIV', { 1447 props: { 1448 className: 'feed-create-task-popup-title' 1449 }, 1450 html: BX.message('sonetLFCreateTaskWait') 1451 })); 1452 1453 BX.ajax({ 1454 url: '/bitrix/components/bitrix/socialnetwork.log.ex/ajax.php', 1455 method: 'POST', 1456 dataType: 'json', 1457 data: { 1458 sessid : BX.bitrix_sessid(), 1459 ENTITY_TYPE : params.entityType, 1460 ENTITY_ID : params.entityId, 1461 action : 'get_raw_data' 1462 }, 1463 onsuccess: BX.proxy(function(data) { 1464 if ( 1465 typeof data.TITLE != 'undefined' 1466 && typeof data.DESCRIPTION != 'undefined' 1467 && typeof data.DISK_OBJECTS != 'undefined' 1468 && data.TITLE.length > 0 1469 && data.DESCRIPTION.length > 0 1470 ) 1471 { 1472 BX.Tasks.Util.Query.runOnce('task.add', {data: { 1473 TITLE: data.TITLE, 1474 DESCRIPTION: data.DESCRIPTION, 1475 RESPONSIBLE_ID: BX.message('USER_ID'), 1476 CREATED_BY: BX.message('USER_ID'), 1477 UF_TASK_WEBDAV_FILES: data.DISK_OBJECTS 1478 }}).then(BX.proxy(function(result){ 1479 var resultData = result.getData(); 1480 1481 if ( 1482 typeof resultData != 'undefined' 1483 && typeof resultData.DATA != 'undefined' 1484 && typeof resultData.DATA.ID != 'undefined' 1485 && parseInt(resultData.DATA.ID) > 0 1486 ) 1487 { 1488 oLF.createTaskSetContentSuccess(resultData.DATA.ID); 1489 1490 BX.ajax({ 1491 url: '/bitrix/components/bitrix/socialnetwork.log.ex/ajax.php', 1492 method: 'POST', 1493 dataType: 'json', 1494 data: { 1495 sessid : BX.bitrix_sessid(), 1496 ENTITY_TYPE : params.entityType, 1497 ENTITY_ID : params.entityId, 1498 TASK_ID : resultData.DATA.ID, 1499 action : 'create_task_comment' 1500 } 1501 }); 1502 } 1503 else 1504 { 1505 oLF.createTaskSetContentFailure(result.getErrors().getMessages()); 1506 } 1507 }, this)); 1508 } 1509 else 1510 { 1511 oLF.createTaskSetContentFailure([ 1512 BX.message('sonetLFCreateTaskErrorGetData') 1513 ]); 1514 } 1515 }, this), 1516 onfailure: function(data) { 1517 oLF.createTaskSetContentFailure([ 1518 BX.message('sonetLFCreateTaskErrorGetData') 1519 ]); 1520 } 1521 }); 1522 1523 }, this), 1524 onPopupClose: BX.proxy(function() { 1525 this.createTaskPopup.destroy(); 1526 }, this) 1527 } 1528 }); 1529 1530 this.createTaskPopup.params.zIndex = (BX.WindowManager ? BX.WindowManager.GetZIndex() : 0); 1531 this.createTaskPopup.show(); 1532}; 1533 1534BitrixLF.prototype.createTaskSetContentSuccess = function(taskId) 1535{ 1536 oLF.createTaskSetContent(BX.create('DIV', { 1537 children: [ 1538 BX.create('DIV', { 1539 props: { 1540 className: 'feed-create-task-popup-title' 1541 }, 1542 html: BX.message('sonetLFCreateTaskSuccessTitle') 1543 }), 1544 BX.create('DIV', { 1545 props: { 1546 className: 'feed-create-task-popup-description' 1547 }, 1548 html: BX.message('sonetLFCreateTaskSuccessDescription') 1549 }) 1550 ] 1551 })); 1552 1553 this.createTaskPopup.setButtons([ 1554 new BX.PopupWindowButton({ 1555 text : BX.message('sonetLFCreateTaskButtonTitle'), 1556 events : { 1557 click : BX.proxy(function() { 1558 this.createTaskPopup.destroy(); 1559 window.open(BX.message('sonetLFCreateTaskTaskPath').replace('#user_id#', BX.message('USER_ID')).replace('#task_id#', taskId), '_blank'); 1560 }, this) 1561 } 1562 }) 1563 ]); 1564 1565}; 1566 1567BitrixLF.prototype.createTaskSetContentFailure = function(errors) 1568{ 1569 oLF.createTaskSetContent(BX.create('DIV', { 1570 children: [ 1571 BX.create('DIV', { 1572 props: { 1573 className: 'feed-create-task-popup-title' 1574 }, 1575 html: BX.message('sonetLFCreateTaskFailureTitle') 1576 }), 1577 BX.create('DIV', { 1578 props: { 1579 className: 'feed-create-task-popup-description' 1580 }, 1581 html: errors.join('<br>') 1582 }) 1583 ] 1584 })); 1585 1586}; 1587 1588BitrixLF.prototype.createTaskSetContent = function(contentNode) 1589{ 1590 if (BX('BXCTP_content')) 1591 { 1592 var containerNode = BX('BXCTP_content'); 1593 BX.cleanNode(containerNode); 1594 containerNode.appendChild(contentNode); 1595 } 1596}; 1597 1598 1599oLF = new BitrixLF; 1600window.oLF = oLF;
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.