HomeHelpTrac

Changeset 15934 for trunk/inc


Ignore:
Timestamp:
01/30/12 01:29:27 (4 months ago)
Author:
Alexander Trofimov
Message:

Code cleaning

Location:
trunk/inc
Files:
42 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/classes/BxDolAcl.php

    r15893 r15934  
    3333 * Action ID's 
    3434 */ 
    35 define('ACTION_ID_SEND_VKISS', 1); 
    36 define('ACTION_ID_VIEW_PROFILES', 2); 
    3735define('ACTION_ID_VOTE', 3); 
    38 define('ACTION_ID_SEND_MESSAGE', 4); 
    39 define('ACTION_ID_GET_EMAIL', 5); 
    4036define('ACTION_ID_COMMENTS_POST', 6); 
    4137define('ACTION_ID_COMMENTS_VOTE', 7); 
  • trunk/inc/classes/BxDolAlerts.php

    r15211 r15934  
    66 */ 
    77defined('BX_DOL') or die('hack attempt'); 
    8  
    9 bx_import('BxDolSubscription'); 
    108 
    119/** 
     
    8280    function alert() { 
    8381 
    84         $oSubscription = new BxDolSubscription(); 
    85         $oSubscription->send($this->sUnit, $this->sAction, $this->iObject, $this->aExtras); 
    86  
    8782        if (isset($this->_aAlerts[$this->sUnit]) && isset($this->_aAlerts[$this->sUnit][$this->sAction])) 
    8883            foreach($this->_aAlerts[$this->sUnit][$this->sAction] as $iHandlerId) { 
  • trunk/inc/classes/BxDolCmts.php

    r15733 r15934  
    369369    function isPostReplyAllowed () 
    370370    { 
    371         if($this->_checkGuestsPermission() == false) return false; 
    372371        return $this->checkAction (ACTION_ID_COMMENTS_POST); 
    373     } 
    374  
    375  
    376  
    377     function _checkGuestsPermission() 
    378     { 
    379         if(getParam("enable_guest_comments") == "on") return true; 
    380         if ($this->_getAuthorId() > 0) return true; 
    381         return false; 
    382372    } 
    383373 
  • trunk/inc/classes/BxDolTemplate.php

    r15931 r15934  
    2323define('BX_PAGE_POPUP', 44); ///< popup page, without any headers and footers 
    2424define('BX_PAGE_TRANSITION', 150); ///< transition page with redirect to display some msg, like 'please wait', without headers footers 
    25  
     25define('BX_PAGE_MOBILE', 11); ///< mobile page 
    2626/** 
    2727 * Template engine. 
  • trunk/inc/classes/BxDolTwigModule.php

    r15733 r15934  
    244244        $this->_oTemplate->addCss ('main.css'); 
    245245        $this->_oTemplate->addCss ('entry_view.css'); 
    246         $this->_oTemplate->addCss ('unit_fan.css'); 
    247246        $this->_oTemplate->pageCode($aDataEntry[$this->_oDb->_sFieldTitle], false, false); 
    248247 
  • trunk/inc/js/common_anim.js

    r15211 r15934  
    55 */ 
    66 
    7 // TODO: remove bxShowLoading after replacing uploaders 
    87// TODO: make sure that there is no duplicate code in bx_loading functions 
    98// TODO: name it with jquery. prefix since it is jquery plugin 
     
    8685    }); 
    8786}; 
    88 $.fn.bx_message_box = function(sMessage, iTimer, onClose) { 
    89     return this.each(function() { 
    90         var oParent = $(this); 
    9187 
    92         if(oParent.children(':first').hasClass('MsgBox')) 
    93             oParent.children(':first').replaceWith(sMessage); 
    94         else 
    95             oParent.prepend(sMessage); 
    9688 
    97         if(iTimer == undefined || parseInt(iTimer) == 0) 
    98             return; 
    99  
    100         setTimeout(function(oParent, onClose) { 
    101             oParent.children('div.MsgBox:first').bx_anim('hide', 'fade', 'slow', function(){ 
    102                 $(this).remove(); 
    103                 if(onClose != undefined) 
    104                     onClose(); 
    105             }); 
    106         }, 1000 * parseInt(iTimer), oParent, onClose); 
    107     }); 
    108 }; 
    109 function bxShowLoading(oParent, bShow) { 
    110     var oLoading = oParent.children('.upload-loading'); 
    111  
    112     if(bShow) { 
    113         oLoading.css('left', (oParent.width() - oLoading.width())/2); 
    114         oLoading.css('top', (oParent.height() - oLoading.height())/2); 
    115         oLoading.show(); 
    116     } 
    117     else 
    118         oLoading.hide(); 
    119 } 
  • trunk/inc/js/functions.js

    r15497 r15934  
    55 */ 
    66 
    7 function ps_page_toggle(sPageName, iProfileId, iBlockId) { 
    8     if($('body').find('div#dbPrivacyMenu' + iBlockId).length > 0){ 
    9         $('body').find('div#dbPrivacyMenu' + iBlockId).dolPopup({}); 
    10         return; 
    11     } 
    12  
    13     $.post( 
    14         sUrlRoot + 'member_privacy.php', 
    15         { 
    16             ps_action: 'get_chooser', 
    17             ps_page_name: sPageName, 
    18             ps_profile_id: iProfileId, 
    19             ps_block_id: iBlockId 
    20         }, 
    21         function(oData) { 
    22             if(parseInt(oData.code) == 0) { 
    23                 $('body').append($(oData.data).addClass('dbPrivacyMenu')); 
    24                 $('body').find('div#dbPrivacyMenu' + iBlockId).dolPopup({}); 
    25             } 
    26         }, 
    27         'json' 
    28     ); 
    29 } 
    30 function ps_page_select(oLink, iBlockId, iGroupId) { 
    31     $.post( 
    32         sUrlRoot + 'member_privacy.php', 
    33         { 
    34             ps_action: 'view_block', 
    35             ps_block_id: iBlockId, 
    36             ps_group_id: iGroupId 
    37         }, 
    38         function(oData) { 
    39             if(parseInt(oData.code) == 0) { 
    40                 $(oLink).parents('.dbPrivacyMenu').dolPopupHide().find('.dbPrivacyGroupActive').removeClass('dbPrivacyGroupActive').addClass('dbPrivacyGroup'); 
    41                 $(oLink).removeClass('dbPrivacyGroup').addClass('dbPrivacyGroupActive'); 
    42  
    43                 $('#dbPrivacy' + iBlockId + ' a:first').attr('title', oData.group); 
    44             } 
    45         }, 
    46         'json' 
    47     ); 
    48 } 
    49 function ps_showDialog(sType, iGroupId, oLink) { 
    50     var oDiv = $('#ps-' + sType + '-members'); 
    51  
    52     $("#ps-" + sType + "-member-form :hidden[name='ps-" + sType + "-member-group']").val(iGroupId); 
    53     oDiv.dolPopup({}); 
    54  
    55     if(sType == 'del') { 
    56         $('#ps-' + sType + '-members-loading').bx_loading(); 
    57  
    58         $.post( 
    59             sPSSiteUrl + 'member_privacy.php', 
    60             { 
    61                 ps_action: 'members', 
    62                 ps_value: iGroupId 
    63             }, 
    64             function(sData) { 
    65                 $('#ps-' + sType + '-members-loading').bx_loading(); 
    66                 oDiv.find('.ps-search-results').html(sData); 
    67             }, 
    68             'html' 
    69         ); 
    70     } 
    71 } 
    72 function ps_ad_search() { 
    73     var sSearchValue = $('#ps-search-member-form').find(':text:first').val(); 
    74  
    75     if(sSearchValue) { 
    76         $('#ps-add-members-loading').bx_loading(); 
    77  
    78         $.post( 
    79             sPSSiteUrl + 'member_privacy.php', 
    80             { 
    81                 ps_action: 'search', 
    82                 ps_value: sSearchValue 
    83             }, 
    84             function(sData) { 
    85                 $('#ps-add-members-loading').bx_loading(); 
    86                 $('#ps-add-members .ps-search-results').html(sData); 
    87             }, 
    88             'html' 
    89         ); 
    90     } 
    91 } 
    92  
    93 /** 
    94  * Checks/unchecks all tables 
    95  * 
    96  * @param   string   the form name 
    97  * @param   boolean  whether to check or to uncheck the element 
    98  * 
    99  * @return  boolean  always true 
    100  */ 
    101 function setCheckboxes(the_form, do_check) 
    102 { 
    103     var elts  = document.forms[the_form].getElementsByTagName('input'); 
    104     var elts_cnt  = elts.length; 
    105  
    106     for ( i = 0; i < elts_cnt; i++) 
    107     { 
    108         elts[i].checked = do_check; 
    109         if ( elts[i].type == "submit" ) 
    110             elts[i].disabled = !do_check; 
    111     } 
    112 } 
    113  
    114 function UpdateSubmit(the_form) { 
    115     var elts  = document.forms[the_form].getElementsByTagName('input'); 
    116     var elts_cnt  = elts.length; 
    117     var bChecked = false; 
    118  
    119     for ( i = 0; i < elts_cnt; i++) { 
    120         if (elts[i].type == "checkbox" && elts[i].checked == true) { 
    121             bChecked = true; 
    122         } 
    123         if ( elts[i].type == "submit" ) { 
    124             elts[i].disabled = true; 
    125         } 
    126     } 
    127     for ( i = 0; i < elts_cnt; i++) { 
    128         if ( elts[i].type == "submit" ) { 
    129             if (bChecked == true) { 
    130                 elts[i].disabled = false; 
    131             } else { 
    132                 elts[i].disabled = true; 
    133             } 
    134         } 
    135     } 
    136 } 
    137  
    138 /** 
    139  * Allow open window with extra params 
    140  * 
    141  * @param sWindowUrl string 
    142  * @param sWindowId string 
    143  * @param aVarNames array 
    144  * @param aVarValues array 
    145  * @param sWindowParams string 
    146  * @param sMethod string 
    147  * @return mixed 
    148  */ 
    149 function openWindowWithParams(sWindowUrl, sWindowId, aVarNames, aVarValues, sWindowParams, sMethod) 
    150 { 
    151     var newWindow = window.open(sWindowUrl, sWindowId, sWindowParams); 
    152     if (!newWindow) return false; 
    153  
    154     var html = ''; 
    155     html += '<html><head></head><body><form id="' + sWindowId + '" method="' + sMethod + '" action="' + sWindowUrl + '">'; 
    156  
    157     if (aVarNames && aVarValues && (aVarNames.length == aVarValues.length)) { 
    158         for (var i=0; i < aVarNames.length; i++) 
    159         { 
    160             html += '<input type=\"hidden\" name="' + aVarNames[i] + '" value="' + aVarValues[i] + '" />'; 
    161         } 
    162     } 
    163  
    164     html += '</body></html></form><script type="text/javascript">document.getElementById("' + sWindowId + '").submit()</script></body></html>'; 
    165     newWindow.document.write(html); 
    166     return newWindow; 
    167 } 
    168  
    169 function setCheckbox(the_form) 
    170 { 
    171     var elts      = document.forms[the_form].getElementsByTagName('input'); 
    172     var elts_cnt  = elts.length; 
    173  
    174     var allUnchecked = true; 
    175  
    176     for (var i = 0; i < elts_cnt; i++) 
    177         if(elts[i].checked) 
    178             allUnchecked = false; 
    179  
    180     for (var i = 0; i < elts_cnt; i++) 
    181         if( elts[i].type == "submit" ) 
    182             elts[i].disabled = allUnchecked; 
    183 } 
    184  
    185  
    186 var win = 'width=500,height=600,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes'; 
    187  
    188 function launchTellFriend() { 
    189     var sBaseUrl = document.getElementsByTagName('base')[0].href; 
    190  
    191     var win = 'width=380,height=270,left=200,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no'; 
    192     return !window.open(sBaseUrl + 'tellfriend.php', 'tellfriend', win); 
    193 } 
    194  
    195 function launchTellFriendProfile( sID ) { 
    196     var sBaseUrl = document.getElementsByTagName('base')[0].href; 
    197  
    198     var win = "width=400,height=450,left=200,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no"; 
    199     return !window.open(sBaseUrl + 'tellfriend.php?ID='+sID,'tellfriendprofile',win); 
    200 } 
    201  
    202  
    203 function charCounter(field,maxLength,countTarget) 
    204 { 
    205  
    206     field = document.getElementById(field); 
    207     countTarget = document.getElementById(countTarget); 
    208     var inputLength=field.value.length; 
    209  
    210     if(inputLength >= maxLength) 
    211     { 
    212         field.value=field.value.substring(0,maxLength); 
    213  
    214     } 
    215     countTarget.innerHTML=maxLength-field.value.length; 
    216  
    217  
    218 } 
    219  
    220  
    221  
    222 /** 
    223  * change images onHover mouse action 
    224  */ 
    225 function show(FileName,jpg1Name) 
    226 { 
    227     document.images[FileName].src = jpg1Name; 
    228 } 
    229  
    230 /** 
    231  * set status of the browser window to 's' 
    232  */ 
    233 function ss(s) 
    234 { 
    235     window.status = s; 
    236     return true; 
    237 } 
    238  
    239 /** 
    240  * set status of the browser window to empty 
    241  */ 
    242 function ce() 
    243 { 
    244     window.status=''; 
    245 } 
    246  
    247  
    248 /** 
    249  * insert emotion item 
    250  */ 
    251 function emoticon( txtarea, text ) { 
    252  
    253     text = ' ' + text + ' '; 
    254     if (txtarea.createTextRange && txtarea.caretPos) { 
    255         var caretPos = txtarea.caretPos; 
    256         caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; 
    257         txtarea.focus(); 
    258     } else { 
    259         txtarea.value  += text; 
    260         txtarea.focus(); 
    261     } 
    262 } 
    263  
    264 function docOpen(text) 
    265 { 
    266     newWindow=window.open('','','toolbar=no,resizable=yes,scrollbars=yes,width=400,height=300'); 
    267     newWindow.document.open("text/html"); 
    268     newWindow.document.write(unescape(text)); 
    269     newWindow.document.close(); 
    270 } 
    271  
    272  
    273 function createNamedElement( type, name ) 
    274 { 
    275  
    276     var element; 
    277  
    278     try 
    279     { 
    280         element = document.createElement('<'+type+' name="'+name+'">'); 
    281     } catch (e) { } 
    282  
    283     if (!element || !element.name) // Cool, this is not IE !! 
    284     { 
    285         element = document.createElement(type) 
    286         element.name = name; 
    287     } 
    288  
    289     return element; 
    290 } 
    291  
    292 function stripSlashes(str) 
    293 { 
    294     return str.replace(/\\/g, ''); 
    295 } 
    296  
    297 function createXmlHttpObj() 
    298 { 
    299     if ( window.XMLHttpRequest ) 
    300         return new XMLHttpRequest(); 
    301     else if ( window.ActiveXObject ) 
    302         return new ActiveXObject("Microsoft.XMLHTTP"); 
    303     else 
    304     { 
    305         alert( 'Please upgrade your browser' ); 
    306         return false; 
    307     } 
    308 } 
     7 
    3098 
    3109function getHtmlData( elem, url, callback, method ) 
     
    35453} 
    35554 
    356  
    357 /* 
    358     Show the Floating Description for any element. 
    359  
    360     usage: 
    361     <element 
    362         onmouseover="showFloatDesc( 'your html description here...' );" 
    363         onmousemove="moveFloatDesc( event );" 
    364         onmouseout="hideFloatDesc();"> 
    365  
    366     Your document must contain in the root of body following content: 
    367         <div id="FloatDesc" style="position:absolute;display:none;"></div> 
    368     and specific stylesheet for it. 
    369 */ 
    370 function showFloatDesc( text, time) 
    371 { 
    372     var time = time || 0; 
    373     descDiv = document.getElementById( 'FloatDesc' ); 
    374     if ( descDiv ) 
    375     { 
    376         //descDiv.innerHTML = text; 
    377         //descDiv.style.display = 'block'; 
    378         $(descDiv).html(text).animate({opacity:'show'}, time); 
    379     } 
    380 } 
    381  
    382 function hideFloatDesc() 
    383 { 
    384     descDiv = document.getElementById( 'FloatDesc' ); 
    385     if ( descDiv ) 
    386         descDiv.style.display = 'none'; 
    387 } 
    388  
    389 function moveFloatDesc( ev ) 
    390 { 
    391     descDiv = document.getElementById( 'FloatDesc' ); 
    392     if ( descDiv ) 
    393     { 
    394         showPos = getPositionData( descDiv, ev ); 
    395         descDiv.style.left = showPos['posX'] + 'px'; 
    396         descDiv.style.top = showPos['posY'] + 'px'; 
    397     } 
    398 } 
    399  
    400 /* 
    401     Core of the Floating Description 
    402 */ 
    403 function getPositionData(obj, showEvent) 
    404 { 
    405     if ( !showEvent ) 
    406         showEvent = window.event; 
    407  
    408     var pos_X = 0, pos_Y = 0; 
    409     if ( showEvent ) 
    410     { 
    411         if ( typeof(showEvent.pageX) == 'number' ) 
    412         { 
    413             pos_X = showEvent.pageX; 
    414             pos_Y = showEvent.pageY; 
    415         } 
    416         else if ( typeof(showEvent.clientX) == 'number' ) 
    417         { 
    418             pos_X = showEvent.clientX; pos_Y = showEvent.clientY; 
    419             if ( document.body && 
    420                 ( document.body.scrollTop || document.body.scrollLeft ) && 
    421                 !( window.opera || window.debug || navigator.vendor == 'KDE' ) ) 
    422             { 
    423                 pos_X += document.body.scrollLeft; 
    424                 pos_Y += document.body.scrollTop; 
    425             } 
    426             else if ( document.documentElement && 
    427                 ( document.documentElement.scrollTop || 
    428                 document.documentElement.scrollLeft ) && 
    429                 !( window.opera || window.debug || navigator.vendor == 'KDE' ) ) 
    430             { 
    431                 pos_X += document.documentElement.scrollLeft; 
    432                 pos_Y += document.documentElement.scrollTop; 
    433             } 
    434         } 
    435     } 
    436  
    437     var scroll_X = 0, scroll_Y = 0; 
    438     if ( document.body && 
    439         ( document.body.scrollTop || document.body.scrollLeft ) && 
    440         !( window.debug || navigator.vendor == 'KDE' ) ) 
    441     { 
    442         scroll_X = document.body.scrollLeft; 
    443         scroll_Y = document.body.scrollTop; 
    444     } 
    445     else if ( document.documentElement && 
    446         ( document.documentElement.scrollTop || 
    447         document.documentElement.scrollLeft ) && 
    448         !( window.debug || navigator.vendor == 'KDE' ) ) 
    449     { 
    450         scroll_X = document.documentElement.scrollLeft; 
    451         scroll_Y = document.documentElement.scrollTop; 
    452     } 
    453  
    454     var win_size_X = 0, win_size_Y = 0; 
    455     if (window.innerWidth && window.innerHeight) 
    456     { 
    457         win_size_X = window.innerWidth; 
    458         win_size_Y = window.innerHeight; 
    459     } 
    460     else if ( document.documentElement && 
    461         document.documentElement.clientWidth && 
    462         document.documentElement.clientHeight ) 
    463     { 
    464         win_size_X = document.documentElement.clientWidth; 
    465         win_size_Y = document.documentElement.clientHeight; 
    466     } 
    467     else if (document.body && document.body.clientWidth && document.body.clientHeight) 
    468     { 
    469         win_size_X = document.body.clientWidth; 
    470         win_size_Y = document.body.clientHeight; 
    471     } 
    472  
    473     pos_X += 15; 
    474     pos_Y += 20; 
    475  
    476     if (obj.offsetWidth && obj.offsetHeight) 
    477     { 
    478         if (pos_X - scroll_X + obj.offsetWidth + 5 > win_size_X) 
    479             pos_X -= (obj.offsetWidth + 25); 
    480         if (pos_Y - scroll_Y + obj.offsetHeight + 5 > win_size_Y) 
    481             pos_Y -= (obj.offsetHeight + 20); 
    482     } 
    483  
    484     var res = new Array; 
    485     res['posX'] = pos_X; 
    486     res['posY'] = pos_Y; 
    487     res['scrollX'] = scroll_X; 
    488     res['scrollY'] = scroll_Y; 
    489     res['winSizeX'] = win_size_X; 
    490     res['winSizeY'] = win_size_Y; 
    491  
    492     return res; 
    493 } 
    494  
    495 function addBookmark( title, url ) 
    496 { 
    497     if (title == undefined) 
    498         title = document.title; 
    499  
    500     if (url == undefined) 
    501         url = top.location.href; 
    502  
    503     if (window.sidebar) // firefox 
    504         window.sidebar.addPanel(title, url, ''); 
    505     else if(window.opera && window.print) // opera 
    506     { 
    507         var elem = document.createElement('a'); 
    508         elem.setAttribute('href',url); 
    509         elem.setAttribute('title',title); 
    510         elem.setAttribute('rel','sidebar'); 
    511         elem.click(); 
    512     } 
    513     else if(document.all) // ie 
    514         window.external.AddFavorite(url, title); 
    515     else if (navigator.appName=="Netscape") //Netscape 
    516         alert( 'To bookmark this site press "Ctrl+D".' ); 
    517     else 
    518         alert( 'Your browser doesn\'t support this feature' ); 
    519 } 
    520  
    521 function changeBigPicTo(newBigImageName, newBigImageHref) { 
    522     var el; 
    523     el = document.getElementById('AdvBigImg'); 
    524     el.style.backgroundImage = 'url(' + newBigImageName + ')'; 
    525     el = document.getElementById('AdvBigImgFullSize'); 
    526     el.href = newBigImageHref; 
    527 } 
    528  
    529 function moveScrollRightAuto( el_id, b ) { 
    530     if (b) 
    531         scrollTimerId = setInterval("moveScrollRight('"+el_id+"')", 100); 
    532     else 
    533         clearInterval(scrollTimerId); 
    534 } 
    535  
    536 function moveScrollLeftAuto( el_id, b ) { 
    537     if (b) 
    538         scrollTimerId = setInterval("moveScrollLeft('"+el_id+"')", 100); 
    539     else 
    540         clearInterval(scrollTimerId); 
    541 } 
    542  
    543 function moveScrollRight( el_id ) { 
    544     var step = 5; 
    545     var e = $('#' + el_id); 
    546     var left = e.css('left') ? parseInt(e.css('left')) : 0; 
    547     var minLeft = e.parent().width() - parseInt(e.width()); 
    548  
    549     if((left-step) > minLeft) 
    550         e.css('left', left - step + 'px'); 
    551     else { 
    552         e.css('left', minLeft + 'px'); 
    553         moveScrollRightAuto(el_id, false); 
    554     } 
    555 } 
    556  
    557 function moveScrollLeft(el_id) { 
    558     var step = 5; 
    559     var e = $('#' + el_id); 
    560     var left = e.css('left') ? parseInt(e.css('left')) : 0; 
    561  
    562     if(left + step < 0) 
    563         e.css('left', left + step + 'px'); 
    564     else { 
    565         e.css('left', '0px'); 
    566         moveScrollLeftAuto(el_id, false); 
    567     } 
    568 } 
    569  
    570 function addEvent( obj, evt, func ) 
    571 { 
    572     if( !obj || !evt || !func ) 
    573         return false; 
    574  
    575     if( obj.addEventListener ) 
    576         obj.addEventListener( evt, func, false ); 
    577     else if( obj.attachEvent ) 
    578         obj.attachEvent( 'on' + evt, func ); 
    579 } 
    580  
    581 function checkAll( formName, _pref, doCheck ) { 
    582     _form = document.forms[formName]; 
    583  
    584     if( !_form ) 
    585         return false; 
    586  
    587     for( ind = 0; ind < _form.length; ind ++ ) { 
    588         _elem = _form[ind]; 
    589  
    590         if( _elem.type != 'checkbox' ) 
    591             continue; 
    592  
    593         if( _elem.name.substr( 0, _pref.length ) != _pref ) 
    594             continue; 
    595  
    596         _elem.checked = doCheck; 
    597     } 
    598 } 
    599  
    600 function emailCheck( str ) 
    601 { 
    602  
    603  if (str.search( /^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel)$/i ) == -1 ) 
    604      return false; 
    605  else 
    606      return true; 
    607 } 
    608  
    609 function getBoonexId( formFrom, formTo ) 
    610 { 
    611     if( !formFrom || !formTo ) 
    612         return false; 
    613  
    614     var ID = formFrom.ID; 
    615     var Password = formFrom.Password; 
    616  
    617     if( !ID || !Password ) 
    618         return false; 
    619  
    620     if( !ID.value.length ) 
    621     { 
    622         alert( 'Please enter BoonEx ID' ); 
    623         ID.focus(); 
    624         return false; 
    625     } 
    626  
    627     if( !Password.value.length ) 
    628     { 
    629         alert( 'Please enter Password' ); 
    630         Password.focus(); 
    631         return false; 
    632     } 
    633  
    634     formFrom.Submit.disabled = true; 
    635     formFrom.Submit.value = 'Wait...'; 
    636  
    637     $.get( 
    638         'get_boonex_id.php', 
    639         { 
    640             ID: encodeURIComponent(ID.value), 
    641             Password: encodeURIComponent(Password.value), 
    642             _r: Math.random() 
    643         }, 
    644         function(oXML){ 
    645  
    646                 if( !oXML.getElementsByTagName( 'ID' ).length ) 
    647                 { 
    648                     alert( 'Authorization failed. Try again.' ); 
    649                     return false; 
    650                 } 
    651  
    652                 var aFields = new Array(); 
    653                 aFields['Username'] = 'NickName[0]'; 
    654                 aFields['Email']    = 'Email[0]'; 
    655                 aFields['Password'] = 'Password[0],Password_confirm[0]'; 
    656                 aFields['Realname'] = 'Realname[0]'; 
    657                 aFields['DateOfBirth'] = 'DateOfBirth[0]'; 
    658                 aFields['Sex']      = 'Sex[0]'; 
    659                 aFields['Country']  = 'Country[0]'; 
    660                 aFields['City']     = 'City[0]'; 
    661                 aFields['ZIP']      = 'zip[0]'; 
    662                 aFields['Headline'] = 'Headline[0]'; 
    663                 aFields['DescriptionMe'] = 'DescriptionMe[0]'; 
    664                 aFields['tags']     = 'Tags'; 
    665  
    666                 for( var fieldFrom in aFields ) 
    667                 { 
    668                     if( !oXML.getElementsByTagName( fieldFrom ).length ) 
    669                         continue; 
    670  
    671                     var eFieldFrom = oXML.getElementsByTagName( fieldFrom )[0]; 
    672                     var sValue = eFieldFrom.firstChild.data; 
    673  
    674                     if( fieldFrom == 'DateOfBirth' ) { //convert date 
    675                         var aDate = sValue.split( '-' ); 
    676                         sValue = parseInt( aDate[2], 10 ) + '/' + parseInt( aDate[1], 10 ) + '/' + parseInt( aDate[0], 10 ); 
    677                     } 
    678  
    679                     var aFieldsTo = aFields[fieldFrom].split( ',' ); 
    680  
    681                     for( var i in aFieldsTo ) 
    682                     { 
    683                         fieldTo = aFieldsTo[i]; 
    684                         if( formTo[fieldTo] ) 
    685                         { 
    686                             eFieldTo = formTo[fieldTo]; 
    687  
    688                             switch( eFieldTo.type ) 
    689                             { 
    690                                 case 'text': 
    691                                 case 'textarea': 
    692                                 case 'password': 
    693                                 case 'select-one': 
    694                                     eFieldTo.value = sValue; 
    695                                     break; 
    696                                 default: 
    697                                     if( typeof eFieldTo == 'object' ) //radio 
    698                                         for( n = 0; n < eFieldTo.length; n++ ) 
    699                                             if( eFieldTo[n].value == sValue ) 
    700                                                 eFieldTo[n].checked = true; 
    701                             } 
    702                         } 
    703                     } 
    704                 } 
    705  
    706         }, 
    707         'xml' 
    708     ); 
    709  
    710     formFrom.Submit.disabled = false; 
    711     formFrom.Submit.value = 'Import'; 
    712 } 
    71355 
    71456function loadDynamicBlock( iBlockID, sUrl ) { 
     
    74082    $('#dynamicPopup').dolPopupHide(); 
    74183} 
    742 function dbTopMenuLoad(iId) { 
    743     var oTopMenu = $('#dbTopMenu' + iId); 
    744     var iOuterWidth = oTopMenu.parent('.boxFirstHeader').width() - oTopMenu.siblings('.dbTitle').width() - 10; 
    745     if(iOuterWidth == -10) 
    746         return; 
    747  
    748     var iInnerWidth = 0, iSelectedOffset = 0; 
    749     $.each(oTopMenu.find('.dbTmContent > div:visible:not(.clear_both)'), function() { 
    750         if($(this).hasClass('active')) 
    751             iSelectedOffset = -iInnerWidth; 
    752  
    753         iInnerWidth += parseInt($(this).outerWidth()) + 5; 
    754     }); 
    755  
    756     if(iOuterWidth >= iInnerWidth) { 
    757         oTopMenu.find('.dbTmContent').width(iInnerWidth); 
    758         oTopMenu.find('.dbTmLeft, .dbTmRight').hide().siblings('.dbTmCenter').width(iInnerWidth); 
    759         oTopMenu.width(iInnerWidth); 
    760     } 
    761     else { 
    762         oTopMenu.find('.dbTmContent').width(iInnerWidth); 
    763         oTopMenu.find('.dbTmCenter').width(iOuterWidth - 2 * oTopMenu.find('.dbTmLeft').outerWidth()); 
    764         oTopMenu.width(iOuterWidth); 
    765  
    766         var iSelectedOffsetMin = parseInt(oTopMenu.find('.dbTmCenter').width()) - parseInt(oTopMenu.find('.dbTmContent').width()); 
    767         if(iSelectedOffset < iSelectedOffsetMin) 
    768             iSelectedOffset = iSelectedOffsetMin; 
    769         oTopMenu.find('.dbTmContent').css('left', iSelectedOffset + 'px'); 
    770     } 
    771  
    772     oTopMenu.css('top', '0px'); 
    773 } 
    774  
    775 function showItemEditForm( element_id ) 
    776 { 
    777     var editFormWrap = document.getElementById( element_id ); 
    778  
    779     editFormWrap.style.width   = document.body.clientWidth + 30 + "px"; 
    780     editFormWrap.style.height  = (window.innerHeight ? (window.innerHeight + 30) : screen.height) + "px"; 
    781     editFormWrap.style.left    = getHorizScroll1() - 30 + "px"; 
    782     editFormWrap.style.top     = getVertScroll1() - 30 + "px"; 
    783     editFormWrap.style.display = 'block'; 
    784 } 
    785  
    786 function getHorizScroll1() 
    787 { 
    788     if (navigator.appName == "Microsoft Internet Explorer") 
    789         return document.documentElement.scrollLeft; 
    790     else 
    791         return window.pageXOffset; 
    792 } 
    793  
    794 function getVertScroll1() 
    795 { 
    796     if (navigator.appName == "Microsoft Internet Explorer") 
    797         return document.documentElement.scrollTop; 
    798     else 
    799         return window.pageYOffset; 
    800 } 
     84 
    80185 
    80286/** 
     
    81498} 
    81599 
    816 function showPopupLoginFormOld() { 
    817     if ($('#login_div').length) { 
    818         //alert(1); 
    819         $('#login_div').show(); 
    820     } else { 
    821  
    822         $.get( 
    823             sUrlRoot + 'member.php', 
    824             { 
    825                 action: 'show_login_form', 
    826                 relocate: String(window.location) 
    827             }, 
    828             function(data) { 
    829                 // trim needed for Safari. LOL 
    830                 $($.trim(data)).prependTo('body'); 
    831  
    832                 $('#login_div').show(); 
    833                 setDivToCenter($('#login_div')); 
    834  
    835                 // attach onresize event 
    836                 $(window).resize(function() { 
    837                     setDivToCenter($('#login_div')); 
    838                 }); 
    839  
    840                 // attach document onclick event 
    841                 $(document).click(function(event) { 
    842                     var event = event || window.event; 
    843                     var t = event.target || event.srcElement; 
    844  
    845                     if (!( 
    846                             $(t).parents('#login_div').length || 
    847                             $(t).parents('#bigLoginButton').length || 
    848                             $('#login_div').is(':hidden') 
    849                     )) 
    850                         $('#login_div').hide(); 
    851  
    852                     return true; 
    853                 }); 
    854             }, 
    855             'html' 
    856         ); 
    857     } 
    858 } 
    859100 
    860101function showPopupLoginForm() { 
     
    893134} 
    894135 
    895 function startUserInfoTimer(iId, oObject) 
    896 { 
    897     if (typeof glUserInfoDisabled != 'undefined' && 'yes' == glUserInfoDisabled) 
    898         return; 
    899  
    900     if( typeof oObject == 'undefined') { 
    901         stopUserInfoTimer(iId); 
    902         return; 
    903     } 
    904  
    905     aUserInfoTimers[iId] = setTimeout(function(){ 
    906         showFloatUserInfo(iId, oObject); 
    907     }, 1000 * parseInt(aDolOptions['sys_user_info_timeout'])); 
    908 } 
    909  
    910 function stopUserInfoTimer(iId) { 
    911     clearTimeout(aUserInfoTimers[iId]); 
    912 } 
    913  
    914 function showFloatUserInfo(iId, oObject) 
    915 { 
    916     if (typeof glUserInfoDisabled != 'undefined' && 'yes' == glUserInfoDisabled) 
    917         return; 
    918  
    919     if( typeof oObject == 'undefined') { 
    920         return; 
    921     } 
    922  
    923     if (!$('#short_profile_info').length) { 
    924          $('<div id="short_profile_info" style="display: none;"></div>').prependTo('body'); 
    925     } 
    926  
    927     $('#short_profile_info').load( 
    928         sUrlRoot + 'short_profile_info.php?ID=' + iId, 
    929         function() { 
    930            $(this).dolPopup({position: $(oObject).get()}); 
    931         } 
    932     ); 
    933 } 
    934  
    935  
    936 function setDivToCenter(el) { 
    937     var $el = $(el || this); 
    938  
    939     if ($el.length == 0 || $el[0] == window) 
    940         return false; 
    941  
    942     var iLeft = ((window.innerWidth  ? window.innerWidth  : screen.width)  - $el.height()) / 2; 
    943     var iTop  = ((window.innerHeight ? window.innerHeight : screen.height) - $el.width())  / 2; 
    944  
    945     iLeft = iLeft > 0 ? iLeft : 0; 
    946     iTop  = iTop  > 0 ? iTop  : 0; 
    947  
    948     $el.css({ 
    949         position: 'fixed', 
    950         left: iLeft, 
    951         top:  iTop 
    952     }); 
    953 } 
    954136 
    955137function bx_loading (elem, b) { 
Note: See TracChangeset for help on using the changeset viewer.