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 524 oLF.bLoadStarted = false; 525 if ( 526 !bFirst 527 && typeof oNode != 'undefined' 528 && oNode 529 && oNode.parentNode 530 ) 531 { 532 BX.cleanNode(oNode.parentNode, true); 533 } 534 535 window.bLockCounterAnimate = false; 536 537 if ( 538 typeof data != 'undefined' 539 && typeof (data.PROPS) != 'undefined' 540 && typeof (data.PROPS.CONTENT) != 'undefined' 541 && data.PROPS.CONTENT.length > 0 542 && ( 543 typeof data.LAST_TS == 'undefined' 544 || parseInt(data.LAST_TS) <= 0 545 || parseInt(BX.message('sonetLFirstPageLastTS')) <= 0 546 || parseInt(data.LAST_TS) < parseInt(BX.message('sonetLFirstPageLastTS')) 547 ) 548 ) 549 { 550 var content_block_id = 'content_block_' + (Math.floor(Math.random() * 1000)); 551 oLF.processAjaxBlock(data.PROPS, content_block_id, bFirst); 552 _sonetLClearContainerExternal(false); 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 } 574 }, 575 onfailure: function(data) 576 { 577 oLF.bLoadStarted = false; 578 if ( 579 !bFirst 580 && BX('feed-new-message-inf-wrap') 581 ) 582 { 583 BX('feed-new-message-inf-wrap').classList.toggle('feed-new-message-anim'); 584 585 } 586 587 window.bLockCounterAnimate = false; 588 _sonetLClearContainerExternal(false); 589 } 590 }); 591 592 return false; 593} 594function __logGetNextPageLinkEntities(entities, correspondences) 595{ 596 if (!!window.__logGetNextPageFormName && !!entities && !!correspondences && 597 !!window["UC"] && !!window["UC"][window.__logGetNextPageFormName] && 598 !!window["UC"][window.__logGetNextPageFormName].linkEntity) 599 { 600 window["UC"][window.__logGetNextPageFormName].linkEntity(entities); 601 for (var ii in correspondences) 602 { 603 if (!!ii && !!correspondences[ii]) 604 window["UC"][window.__logGetNextPageFormName]["entitiesCorrespondence"][ii] = correspondences[ii]; 605 } 606 } 607} 608 609function __logRefresh(refresh_url) 610{ 611 if (oLF.bLoadStarted) 612 { 613 return; 614 } 615 616 var counterWrap = BX("sonet_log_counter_2_wrap", true); 617 oLF.bLoadStarted = true; 618 619 if (counterWrap) 620 { 621 var nodeTmp3 = BX.findChild(counterWrap, {'tag':'span', 'className': 'feed-new-message-inf-text-reload'}, true); 622 if (nodeTmp3) 623 { 624 nodeTmp3.style.display = 'none'; 625 } 626 } 627 628 window.bLockCounterAnimate = true; 629 630 BX.ajax({ 631 url: refresh_url, 632 method: 'GET', 633 dataType: 'json', 634 data: { }, 635 onsuccess: function(data) 636 { 637 oLF.bLoadStarted = false;
638 639 if ( 640 typeof data != 'undefined' 641 && typeof (data.PROPS) != 'undefined' 642 && typeof (data.PROPS.CONTENT) != 'undefined' 643 && (data.PROPS.CONTENT.length > 0) 644 ) 645 { 646 window.bLockCounterAnimate = false; 647 BX.cleanNode('log_internal_container', false); 648 oLF.processAjaxBlock(data.PROPS); 649 _sonetLClearContainerExternal(false); 650 window.bStopTrackNextPage = false; 651 652 if (BX('feed-new-message-inf-wrap-first')) 653 { 654 BX('feed-new-message-inf-wrap-first').style.display = 'none'; 655 } 656 657 if (typeof arCommentsMoreButtonID != 'undefined') 658 { 659 arCommentsMoreButtonID = []; 660 } 661 662 if ( 663 counterWrap 664 && BX.hasClass(counterWrap, "feed-new-message-informer-fixed") 665 ) 666 { 667 var upBtn = BX("feed-up-btn-wrap", true); 668 if (upBtn) 669 { 670 upBtn.style.display = "none"; 671 BX.removeClass(upBtn, 'feed-up-btn-wrap-anim'); 672 } 673 674 var windowScroll = BX.GetWindowScrollPos(); 675 676 (new BX.easing({ 677 duration : 500, 678 start : { scroll : windowScroll.scrollTop }, 679 finish : { scroll : 0 }, 680 transition : BX.easing.makeEaseOut(BX.easing.transitions.quart), 681 step : function(state){ 682 window.scrollTo(0, state.scroll); 683 }, 684 complete: function() { 685 if (upBtn) 686 upBtn.style.display = "block"; 687 BX.onCustomEvent(window, 'onGoUp'); 688 } 689 })).animate(); 690 } 691 } 692 else 693 { 694 oLF.showRefreshError(); 695 } 696 }, 697 onfailure: function(data) 698 { 699 oLF.bLoadStarted = false; 700 oLF.showRefreshError(); 701 } 702 }); 703 704 return false; 705} 706 707function __logChangeFavorites(log_id, node, newState, bFromMenu) 708{ 709 if ( 710 !log_id 711 || !BX(node) 712 ) 713 { 714 return; 715 } 716 717 if (!!bFromMenu) 718 { 719 var menuItem = BX.proxy_context; 720 if (!BX.hasClass(BX(menuItem), 'menu-popup-item-text')) 721 { 722 menuItem = BX.findChild(BX(menuItem), {'className': 'menu-popup-item-text'}, true); 723 } 724 } 725 726 var nodeToAdjust = ( 727 BX.hasClass(BX(node), 'feed-post-important-switch') 728 ? BX(node) 729 : BX.findChild(BX(node), { 'className': 'feed-post-important-switch' }) 730 ); 731 732 if (newState != undefined) 733 { 734 if (newState == "Y") 735 { 736 BX.addClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 737 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleY'); 738 if (typeof menuItem != 'undefined') 739 { 740 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleY'); 741 } 742 } 743 else 744 { 745 BX.removeClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 746 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleN'); 747 if (typeof menuItem != 'undefined') 748 { 749 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleN'); 750 } 751 } 752 } 753 754 var sonetLXmlHttpSet5 = new XMLHttpRequest(); 755 756 sonetLXmlHttpSet5.open("POST", BX.message('sonetLESetPath'), true); 757 sonetLXmlHttpSet5.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 758 759 sonetLXmlHttpSet5.onreadystatechange = function() 760 { 761 if(sonetLXmlHttpSet5.readyState == 4) 762 { 763 if(sonetLXmlHttpSet5.status == 200) 764 { 765 var data = LBlock.DataParser(sonetLXmlHttpSet5.responseText); 766 if (typeof(data) == "object") 767 { 768 if (data[0] == '*') 769 { 770 if (sonetLErrorDiv != null) 771 { 772 sonetLErrorDiv.style.display = "block"; 773 sonetLErrorDiv.innerHTML = sonetLXmlHttpSet5.responseText; 774 } 775 return; 776 } 777 sonetLXmlHttpSet5.abort(); 778 779 var strMessage = ''; 780 781 if ( 782 data["bResult"] != undefined 783 && ( 784 data["bResult"] == "Y" 785 || data["bResult"] == "N" 786 ) 787 ) 788 { 789 if (data["bResult"] == "Y") 790 { 791 BX.addClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 792 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleY'); 793 if (menuItem != undefined) 794 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleY'); 795 } 796 else 797 { 798 BX.removeClass(BX(nodeToAdjust), "feed-post-important-switch-active"); 799 BX(nodeToAdjust).title = BX.message('sonetLMenuFavoritesTitleN'); 800 if (menuItem != undefined) 801 BX(menuItem).innerHTML = BX.message('sonetLMenuFavoritesTitleN'); 802 } 803 } 804 } 805 } 806 else 807 {
808 // error! 809 } 810 } 811 } 812 813 sonetLXmlHttpSet5.send("r=" + Math.floor(Math.random() * 1000) 814 + "&" + BX.message('sonetLSessid') 815 + "&site=" + BX.util.urlencode(BX.message('sonetLSiteId')) 816 + "&log_id=" + encodeURIComponent(log_id) 817 + "&action=change_favorites" 818 ); 819} 820 821function __logDelete(log_id, node, ind) 822{ 823 if (!log_id) 824 { 825 return; 826 } 827 828 if (!BX(node)) 829 { 830 return; 831 } 832 833 BX.ajax({ 834 url: BX.message('sonetLESetPath'), 835 method: 'POST', 836 dataType: 'json', 837 data: { 838 sessid : BX.bitrix_sessid(), 839 site : BX.message('sonetLSiteId'), 840 log_id : log_id, 841 action : 'delete' 842 }, 843 onsuccess: function(data) { 844 if ( 845 data.bResult != undefined 846 && (data.bResult == "Y") 847 ) 848 { 849 if (typeof ind != 'undefined') 850 { 851 BX.PopupMenu.destroy("post-menu-" + ind); 852 } 853 __logDeleteSuccess(BX(node)); 854 } 855 else 856 { 857 __logDeleteFailure(BX(node)); 858 } 859 }, 860 onfailure: function(data) { 861 __logDeleteFailure(BX(node)); 862 } 863 }); 864} 865 866function __logDeleteSuccess(node) 867{ 868 if ( 869 typeof node == 'undefined' 870 || !node 871 || !BX(node) 872 ) 873 { 874 return; 875 } 876 877 (new BX.fx({ 878 time: 0.5, 879 step: 0.05, 880 type: 'linear', 881 start: BX(node).offsetHeight, 882 finish: 60, 883 callback: BX.delegate(function(height) { 884 this.style.height = height + 'px'; 885 }, BX(node)), 886 callback_start: BX.delegate(function() { 887 this.style.overflow = 'hidden'; 888 this.style.minHeight = 0; 889 }, BX(node)), 890 callback_complete: BX.delegate(function() { 891 this.style.marginBottom = 0; 892 BX.cleanNode(this); 893 this.appendChild(BX.create('DIV', { 894 props: { 895 'className': 'feed-add-successfully' 896 }, 897 style: { 898 'marginLeft': '17px', 899 'marginRight': '17px', 900 'marginTop': '10px' 901 }, 902 children: [ 903 BX.create('span', { 904 props: { 905 'className': 'feed-add-info-text' 906 }, 907 children: [ 908 BX.create('span', { 909 props: { 910 'className': 'feed-add-info-icon' 911 } 912 }), 913 BX.create('span', { 914 html: BX.message('sonetLMenuDeleteSuccess') 915 }) 916 ] 917 }) 918 ] 919 })); 920 }, BX(node)) 921 })).start(); 922} 923 924function __logDeleteFailure(node) 925{ 926 if ( 927 typeof node == 'undefined' 928 || !node 929 || !BX(node) 930 ) 931 { 932 return; 933 } 934 935 node.insertBefore(BX.create('DIV', { 936 props: { 937 'className': 'feed-add-error' 938 }, 939 style: { 940 'marginLeft': '84px', 941 'marginRight': '37px', 942 'marginTop': '18px', 943 'marginBottom': '4px' 944 }, 945 children: [ 946 BX.create('span', { 947 props: { 948 'className': 'feed-add-info-text' 949 }, 950 children: [ 951 BX.create('span', { 952 props: { 953 'className': 'feed-add-info-icon' 954 } 955 }), 956 BX.create('span', { 957 html: BX.message('sonetLMenuDeleteFailure') 958 }) 959 ] 960 }) 961 ] 962 }), node.firstChild); 963} 964 965function __logOnFeedScroll() 966{ 967 // Live Feed Paging 968 if ( 969 window.feedScrollLock == undefined 970 || window.feedScrollLock === false 971 ) 972 { 973 window.feedScrollLock = true; 974 975 setTimeout(function() { 976 window.feedScrollLock = false; 977 }, 100); 978 979 var windowSize = BX.GetWindowSize(); 980 981 if ( 982 window.bStopTrackNextPage === undefined 983 || window.bStopTrackNextPage == false 984 ) 985 { 986 var maxScroll = parseInt(windowSize.scrollHeight / 2); 987 988 if ((windowSize.scrollHeight - windowSize.innerHeight) < maxScroll) 989 { 990 maxScroll = 1; 991 } 992 993 if (windowSize.scrollTop >= maxScroll && next_url) 994 { 995 window.bStopTrackNextPage = true; 996 __logGetNextPage(next_url, true); 997 } 998 } 999 } 1000 1001 //Live Feed New Message Block 1002 var counterWrap = BX("sonet_log_counter_2_wrap", true); 1003 if (counterWrap) 1004 { 1005 var top = counterWrap.parentNode.getBoundingClientRect().top; 1006 if (top <= 0) 1007 { 1008 BX.addClass(counterWrap, "feed-new-message-informer-fixed"); 1009 setTimeout(function() { 1010 if (BX.hasClass(counterWrap, "feed-new-message-informer-fixed")) 1011 { 1012 BX.addClass(counterWrap, "feed-new-message-informer-fix-anim"); 1013 } 1014 }, 100); 1015 } 1016 else 1017 { 1018 BX.removeClass(counterWrap, "feed-new-message-informer-fixed feed-new-message-informer-fix-anim"); 1019 } 1020 } 1021} 1022 1023function __logScrollInit(enable) 1024{ 1025 if (!!enable) 1026 { 1027 BX.unbind(window, 'scroll', __logOnFeedScroll); 1028 BX.bind(window, 'scroll', __logOnFeedScroll); 1029 } 1030 else 1031 { 1032 BX.unbind(window, 'scroll', __logOnFeedScroll); 1033 } 1034} 1035 1036function __logRecalcMoreButton() 1037{ 1038 if (typeof arMoreButtonID != 'undefined') 1039 { 1040 var arPos = false;
1041 var arPosOuter = false; 1042 var obOuter = false; 1043 var obInner = false; 1044 1045 for (var i = 0; i < arMoreButtonID.length; i++) 1046 { 1047 arPos = BX.pos(BX(arMoreButtonID[i].bodyBlockID)); 1048 if (arPos.height < 280) 1049 { 1050 BX(arMoreButtonID[i].moreButtonBlockID).style.display = "none"; 1051 } 1052 1053 if (typeof arMoreButtonID[i].outerBlockID != 'undefined') 1054 { 1055 obOuter = BX(arMoreButtonID[i].outerBlockID); 1056 if (obOuter) 1057 { 1058 arPosOuter = BX.pos(obOuter); 1059 if (arPosOuter.width < arPos.width) 1060 { 1061 obInner = BX.findChild(obOuter, {'tag':'div', 'className': 'feed-post-text-block-inner'}, false); 1062 obInner.style.overflowX = 'scroll' 1063 } 1064 } 1065 } 1066 } 1067 } 1068 1069 if (typeof arCommentsMoreButtonID != 'undefined') 1070 { 1071 var arPos = false; 1072 for (var i = 0; i < arCommentsMoreButtonID.length; i++) 1073 { 1074 arPos = BX.pos(BX(arCommentsMoreButtonID[i].bodyBlockID)); 1075 if (arPos.height < 200) 1076 { 1077 BX(arCommentsMoreButtonID[i].moreButtonBlockID).style.display = "none"; 1078 } 1079 } 1080 } 1081} 1082 1083window.__socOnUCFormClear = function(obj) { 1084 LHEPostForm.reinitDataBefore(obj.editorId); 1085}; 1086window.__socOnUCFormAfterShow = function(obj, text, data) 1087{ 1088 data = (!!data ? data : {}); 1089 1090 var eId = obj.entitiesCorrespondence[obj.id.join('-')][0], id = obj.entitiesCorrespondence[obj.id.join('-')][1]; 1091 BX.show(BX('feed_comments_block_' + eId)); 1092 BX.onCustomEvent(window, "OnBeforeSocialnetworkCommentShowedUp", ['socialnetwork']); 1093 obj.form.action = obj.url.replace(/\#eId\#/, eId).replace(/\#id\#/, id); 1094 1095 var 1096 post_data = { 1097 ENTITY_XML_ID : obj.id[0], 1098 ENTITY_TYPE : obj.entitiesId[obj.id[0]][0], 1099 ENTITY_ID : obj.entitiesId[obj.id[0]][1], 1100 parentId : obj.id[1], 1101 comment_post_id : obj.entitiesId[obj.id[0]][1], 1102 edit_id : obj.id[1], 1103 act : (obj.id[1] > 0 ? 'edit' : 'add'), 1104 logId : obj.entitiesId[obj.id[0]][2] 1105 }; 1106 for (var ii in post_data) 1107 { 1108 if (!obj.form[ii]) 1109 { 1110 obj.form.appendChild(BX.create('INPUT', {attrs : {name : ii, type: "hidden"}})); 1111 } 1112 obj.form[ii].value = post_data[ii]; 1113 } 1114 __socOnLightEditorShow(text, data); 1115}; 1116window.__socOnUCFormSubmit = function(obj, post_data) { 1117 post_data["r"] = Math.floor(Math.random() * 1000); 1118 post_data["sessid"] = BX.bitrix_sessid(); 1119 post_data["log_id"] = obj.entitiesCorrespondence[obj.id.join('-')][0]; 1120 post_data["p_smile"] = BX.message('sonetLPathToSmile'); 1121 post_data["p_ubp"] = BX.message('sonetLPathToUserBlogPost'); 1122 post_data["p_gbp"] = BX.message('sonetLPathToGroupBlogPost'); 1123 post_data["p_umbp"] = BX.message('sonetLPathToUserMicroblogPost'); 1124 post_data["p_gmbp"] = BX.message('sonetLPathToGroupMicroblogPost'); 1125 post_data["p_user"] = BX.message('sonetLPathToUser'); 1126 post_data["p_le"] = BX.message('sonetLEPath'); 1127 post_data["f_id"] = BX.message('sonetLForumID'); 1128 post_data["bapc"] = BX.message('sonetLBlogAllowPostCode'); 1129 post_data["site"] = BX.message('sonetLSiteId'); 1130 post_data["lang"] = BX.message('sonetLLangId'); 1131 post_data["nt"] = BX.message('sonetLNameTemplate'); 1132 post_data["sl"] = BX.message('sonetLShowLogin'); 1133 post_data["as"] = BX.message('sonetLAvatarSizeComment'); 1134 post_data["dtf"] = BX.message('sonetLDateTimeFormat'); 1135 post_data["message"] = post_data["REVIEW_TEXT"]; 1136 post_data["action"] = 'add_comment' 1137 post_data["RATING_TYPE"] = BX.message("sonetRatingType"); 1138 post_data["pull"] = "Y"; 1139 post_data["crm"] = BX.message('sonetLIsCRM'); 1140 obj.form["bx-action"] = obj.form.action; 1141 obj.form.action = BX.message('sonetLESetPath'); 1142}; 1143window.__socOnUCFormResponse = function(obj, data) 1144{ 1145 obj.form.action = obj.form["bx-action"]; 1146 var return_data = {errorMessage : data}, 1147 eId = obj.entitiesCorrespondence[obj.id.join('-')][0], 1148 res = {}; 1149 1150 if (!(!!data && typeof data == "object")) 1151 {} 1152 else if (data[0] == '*') 1153 { 1154 return_data = {errorMessage : BX.message("sonetLErrorSessid")}; 1155 } 1156 else 1157 { 1158 if (!(data["commentID"] > 0) || !!data["strMessage"]) 1159 return_data['errorMessage'] = data["strMessage"]; 1160 else if (data['return_data']) 1161 return_data = data['return_data']; 1162 else { 1163 var 1164 arComment = data["arCommentFormatted"], 1165 arComm = data["arComment"], 1166 ratingNode = (!!window["__logBuildRating"] ? window["__logBuildRating"](data["arComment"], data["arCommentFormatted"]) : null),
1167 thisId = (!!arComm["SOURCE_ID"] ? arComm["SOURCE_ID"] : arComm["ID"]), 1168 res = { 1169 "ID" : thisId, // integer 1170 "ENTITY_XML_ID" : obj.id[0], // string 1171 "FULL_ID" : [obj.id[0], thisId], 1172 "NEW" : "N", //"Y" | "N" 1173 "APPROVED" : "Y", //"Y" | "N" 1174 "POST_TIMESTAMP" : data["timestamp"] - BX.message('USER_TZ_OFFSET'), 1175 "POST_TIME" : arComment["LOG_TIME_FORMAT"], 1176 "POST_DATE" : arComment["LOG_TIME_FORMAT"], 1177 "~POST_MESSAGE_TEXT" : arComment["MESSAGE"], 1178 "POST_MESSAGE_TEXT" : arComment["MESSAGE_FORMAT"], 1179 "PANELS" : { 1180 "MODERATE" : false 1181 }, 1182 "URL" : { 1183 "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"])) 1184 }, 1185 "AUTHOR" : { 1186 "ID" : arComment["USER_ID"], 1187 "NAME" : arComment["CREATED_BY"]["FORMATTED"], 1188 "URL" : arComment["CREATED_BY"]["URL"], 1189 "AVATAR" : arComment["AVATAR_SRC"] }, 1190 "BEFORE_ACTIONS" : (!!ratingNode ? ratingNode : ''), 1191 "AFTER" : arComment["UF"] 1192 }; 1193 1194 if ( 1195 typeof (data["hasEditCallback"]) != 'undefined' 1196 && data["hasEditCallback"] == "Y" 1197 ) 1198 { 1199 res["PANELS"]["EDIT"] = "Y"; 1200 res["URL"]["EDIT"] = "__logEditComment('" + obj.id[0] + "', '" + arComm["ID"] + "', '" + arComm["LOG_ID"] + "');"; 1201 } 1202 1203 if ( 1204 typeof (data["hasDeleteCallback"]) != 'undefined' 1205 && data["hasDeleteCallback"] == "Y" 1206 ) 1207 { 1208 res["PANELS"]["DELETE"] = "Y"; 1209 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'); 1210 } 1211 1212 return_data = { 1213 'errorMessage' : '', 1214 'okMessage' : '', 1215 'status' : true, 1216 'message' : '', 1217 'messageCode' : arComment["MESSAGE"], 1218 'messageId' : [obj.id[0], thisId], 1219 '~message' : '', 1220 'messageFields' : res 1221 }; 1222 } 1223 1224 1225 var node = BX("log_entry_follow_" + eId, true), 1226 strFollowOld = (!!node ? (node.getAttribute("data-follow") == "Y" ? "Y" : "N") : false); 1227 if (strFollowOld == "N") 1228 { 1229 BX.findChild(node, { tagName: 'a' }).innerHTML = BX.message('sonetLFollowY'); 1230 node.setAttribute("data-follow", "Y"); 1231 } 1232 1233 var node = BX("feed-comments-all-cnt-" + eId, true), 1234 val = (!!node ? (node.innerHTML.length > 0 ? parseInt(node.innerHTML) : 0) : false); 1235 if (val !== false) 1236 node.innerHTML = (val + 1); 1237 } 1238 1239 obj.OnUCFormResponseData = return_data; 1240} 1241 1242window.__socOnLightEditorShow = function(content, data){ 1243 var res = {}; 1244 if (data["arFiles"]) 1245 { 1246 var tmp2 = {}, name, size; 1247 for (var ij = 0; ij < data["arFiles"].length; ij++) 1248 { 1249 name = BX.findChild(BX('wdif-doc-' + data["arFiles"][ij]), {className : "feed-com-file-name"}, true); 1250 size = BX.findChild(BX('wdif-doc-' + data["arFiles"][ij]), {className : "feed-con-file-size"}, true); 1251 1252 tmp2['F' + ij] = { 1253 FILE_ID : data["arFiles"][ij], 1254 FILE_NAME : (name ? name.innerHTML : "noname"), 1255 FILE_SIZE : (size ? size.innerHTML : "unknown"), 1256 CONTENT_TYPE : "notimage/xyz"}; 1257 } 1258 res["UF_SONET_COM_DOC"] = { 1259 USER_TYPE_ID : "file", 1260 FIELD_NAME : "UF_SONET_COM_FILE[]", 1261 VALUE : tmp2}; 1262 } 1263 if (data["arDocs"]) 1264 res["UF_SONET_COM_FILE"] = { 1265 USER_TYPE_ID : "webdav_element", 1266 FIELD_NAME : "UF_SONET_COM_DOC[]", 1267 VALUE : BX.clone(data["arDocs"])}; 1268 if (data["arDFiles"]) 1269 res["UF_SONET_COM_FILE"] = { 1270 USER_TYPE_ID : "disk_file", 1271 FIELD_NAME : "UF_SONET_COM_DOC[]", 1272 VALUE : BX.clone(data["arDFiles"])}; 1273 LHEPostForm.reinitData(SLEC.editorId, content, res); 1274} 1275 1276BitrixLF = function () 1277{ 1278 this.bLoadStarted = false; 1279}; 1280 1281BitrixLF.prototype.showRefreshError = function() 1282{ 1283 window.bLockCounterAnimate = false; 1284 _sonetLClearContainerExternal(false); 1285/* 1286 var f = function() 1287 { 1288 if (BX('sonet_log_counter_2_wrap')) 1289 { 1290 BX.unbind(BX('sonet_log_counter_2_error'), 'click', f); 1291 BX('sonet_log_counter_2_error').style.display = 'none'; 1292 BX('sonet_log_counter_2_container').style.display = 'block'; 1293 BX.removeClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim"); 1294 } 1295 }; 1296 1297 if (BX('sonet_log_counter_2_wrap')) 1298 { 1299 BX.addClass(BX("sonet_log_counter_2_wrap"), "feed-new-message-informer-anim"); 1300 BX.bind(BX('sonet_log_counter_2_error'), 'click', f); 1301 BX('sonet_log_counter_2_container').style.display = 'none'; 1302 BX('sonet_log_counter_2_error').style.display = 'block'; 1303 } 1304*/ 1305} 1306 1307BitrixLF.prototype.LazyLoadCheckVisibility = function(image) // to check if expanded or not 1308{ 1309 var img = image.node;
1310 1311 var textType = 'comment'; 1312 1313 var textBlock = BX.findParent(img, {'className': 'feed-com-text'}); 1314 if (!textBlock) 1315 { 1316 textType = 'post'; 1317 textBlock = BX.findParent(img, {'className': 'feed-post-text-block'}); 1318 } 1319 1320 if (textBlock) 1321 { 1322 var moreBlock = BX.findChild(textBlock, {'tag':'div', 'className': 'feed-post-text-more'}, false) 1323 if ( 1324 moreBlock 1325 && moreBlock.style.display != 'none' 1326 ) 1327 { 1328 return img.parentNode.parentNode.offsetTop < (textType == 'comment' ? 220 : 270); 1329 } 1330 } 1331 1332 return true; 1333}; 1334 1335BitrixLF.prototype.processAjaxBlock = function(block, nodeId, bFirst) 1336{ 1337 if (!block) 1338 { 1339 return; 1340 } 1341 1342 if (!nodeId) 1343 { 1344 nodeId = 'content_block_' + (Math.floor(Math.random() * 1000)); 1345 } 1346 1347 bFirst = !!bFirst; 1348 1349 var htmlWasInserted = false; 1350 var scriptsLoaded = false; 1351 1352 processCSS(insertHTML); 1353 processExternalJS(processInlineJS); 1354 1355 function processCSS(callback) 1356 { 1357 if ( 1358 BX.type.isArray(block.CSS) 1359 && block.CSS.length > 0 1360 ) 1361 { 1362 BX.load(block.CSS, callback); 1363 } 1364 else 1365 { 1366 callback(); 1367 } 1368 } 1369 1370 function insertHTML() 1371 { 1372 BX('log_internal_container').appendChild(BX.create('DIV', { 1373 props: { 1374 id: nodeId, 1375 className: 'feed-wrap' 1376 }, 1377 style: { 1378 //display: (bFirst ? 'none' : 'block') 1379 display: 'block' 1380 }, 1381 html: block.CONTENT 1382 })); 1383 1384 htmlWasInserted = true; 1385 if (scriptsLoaded) 1386 { 1387 processInlineJS(); 1388 } 1389 } 1390 1391 function processExternalJS(callback) 1392 { 1393 if ( 1394 BX.type.isArray(block.JS) 1395 && block.JS.length > 0 1396 ) 1397 { 1398 BX.load(block.JS, callback); // to initialize 1399 } 1400 else 1401 { 1402 callback(); 1403 } 1404 } 1405 1406 function processInlineJS() 1407 { 1408 scriptsLoaded = true; 1409 if (htmlWasInserted) 1410 { 1411 BX.ajax.processRequestData(block.CONTENT, { 1412 scriptsRunFirst: false, 1413 dataType: "HTML" 1414 }); 1415 } 1416 } 1417}; 1418 1419BitrixLF.prototype.createTask = function(params) 1420{ 1421 this.createTaskPopup = new BX.PopupWindow("BXCTP", null, { 1422 autoHide: false, 1423 zIndex: 0, 1424 offsetLeft: 0, 1425 offsetTop: 0, 1426 overlay: false, 1427 lightShadow: true, 1428 closeIcon: { 1429 right : "12px", 1430 top : "10px" 1431 }, 1432 draggable: { 1433 restrict:true 1434 }, 1435 closeByEsc: false, 1436 contentColor : 'white', 1437 contentNoPaddings: true, 1438 buttons: [], 1439 content: BX.create('DIV', { 1440 attrs: { 1441 id: 'BXCTP_content' 1442 }, 1443 props: { 1444 className: 'feed-create-task-popup-content' 1445 } 1446 }), 1447 events: { 1448 onAfterPopupShow: BX.proxy(function() 1449 { 1450 oLF.createTaskSetContent(BX.create('DIV', { 1451 props: { 1452 className: 'feed-create-task-popup-title' 1453 }, 1454 html: BX.message('sonetLFCreateTaskWait') 1455 })); 1456 1457 BX.ajax({ 1458 url: '/bitrix/components/bitrix/socialnetwork.log.ex/ajax.php', 1459 method: 'POST', 1460 dataType: 'json', 1461 data: { 1462 sessid : BX.bitrix_sessid(), 1463 ENTITY_TYPE : params.entityType, 1464 ENTITY_ID : params.entityId, 1465 action : 'get_raw_data' 1466 }, 1467 onsuccess: BX.proxy(function(data) { 1468 if ( 1469 typeof data.TITLE != 'undefined' 1470 && typeof data.DESCRIPTION != 'undefined' 1471 && typeof data.DISK_OBJECTS != 'undefined' 1472 && data.TITLE.length > 0 1473 && data.DESCRIPTION.length > 0 1474 ) 1475 { 1476 BX.Tasks.Util.Query.runOnce('task.add', {data: { 1477 TITLE: data.TITLE, 1478 DESCRIPTION: data.DESCRIPTION, 1479 RESPONSIBLE_ID: BX.message('USER_ID'), 1480 CREATED_BY: BX.message('USER_ID'), 1481 UF_TASK_WEBDAV_FILES: data.DISK_OBJECTS 1482 }}).then(BX.proxy(function(result){ 1483 var resultData = result.getData(); 1484 1485 if ( 1486 typeof resultData != 'undefined' 1487 && typeof resultData.DATA != 'undefined' 1488 && typeof resultData.DATA.ID != 'undefined' 1489 && parseInt(resultData.DATA.ID) > 0 1490 ) 1491 { 1492 oLF.createTaskSetContentSuccess(resultData.DATA.ID); 1493 1494 BX.ajax({ 1495 url: '/bitrix/components/bitrix/socialnetwork.log.ex/ajax.php', 1496 method: 'POST', 1497 dataType: 'json', 1498 data: { 1499 sessid : BX.bitrix_sessid(), 1500 ENTITY_TYPE : params.entityType, 1501 ENTITY_ID : params.entityId, 1502 TASK_ID : resultData.DATA.ID, 1503 action : 'create_task_comment' 1504 } 1505 }); 1506 } 1507 else 1508 { 1509 oLF.createTaskSetContentFailure(result.getErrors().getMessages()); 1510 } 1511 }, this)); 1512 } 1513 else 1514 { 1515 oLF.createTaskSetContentFailure([ 1516 BX.message('sonetLFCreateTaskErrorGetData') 1517 ]); 1518 } 1519 }, this), 1520 onfailure: function(data) { 1521 oLF.createTaskSetContentFailure([ 1522 BX.message('sonetLFCreateTaskErrorGetData') 1523 ]); 1524 } 1525 }); 1526 1527 }, this), 1528 onPopupClose: BX.proxy(function() { 1529 this.createTaskPopup.destroy(); 1530 }, this) 1531 } 1532 }); 1533 1534 this.createTaskPopup.params.zIndex = (BX.WindowManager ? BX.WindowManager.GetZIndex() : 0); 1535 this.createTaskPopup.show(); 1536}; 1537 1538BitrixLF.prototype.createTaskSetContentSuccess = function(taskId) 1539{ 1540 oLF.createTaskSetContent(BX.create('DIV', { 1541 children: [ 1542 BX.create('DIV', { 1543 props: { 1544 className: 'feed-create-task-popup-title' 1545 }, 1546 html: BX.message('sonetLFCreateTaskSuccessTitle') 1547 }), 1548 BX.create('DIV', { 1549 props: { 1550 className: 'feed-create-task-popup-description' 1551 }, 1552 html: BX.message('sonetLFCreateTaskSuccessDescription') 1553 }) 1554 ] 1555 })); 1556 1557 this.createTaskPopup.setButtons([ 1558 new BX.PopupWindowButton({ 1559 text : BX.message('sonetLFCreateTaskButtonTitle'), 1560 events : { 1561 click : BX.proxy(function() { 1562 this.createTaskPopup.destroy(); 1563 window.open(BX.message('sonetLFCreateTaskTaskPath').replace('#user_id#', BX.message('USER_ID')).replace('#task_id#', taskId), '_blank'); 1564 }, this) 1565 } 1566 }) 1567 ]); 1568 1569}; 1570 1571BitrixLF.prototype.createTaskSetContentFailure = function(errors) 1572{ 1573 oLF.createTaskSetContent(BX.create('DIV', { 1574 children: [ 1575 BX.create('DIV', { 1576 props: { 1577 className: 'feed-create-task-popup-title' 1578 }, 1579 html: BX.message('sonetLFCreateTaskFailureTitle') 1580 }), 1581 BX.create('DIV', { 1582 props: { 1583 className: 'feed-create-task-popup-description' 1584 }, 1585 html: errors.join('<br>') 1586 }) 1587 ] 1588 })); 1589 1590}; 1591 1592BitrixLF.prototype.createTaskSetContent = function(contentNode) 1593{ 1594 if (BX('BXCTP_content')) 1595 { 1596 var containerNode = BX('BXCTP_content'); 1597 BX.cleanNode(containerNode); 1598 containerNode.appendChild(contentNode); 1599 } 1600}; 1601 1602 1603oLF = new BitrixLF; 1604window.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.