var _page_url = '/ua/ajax.php'; var editGroupHandler = { url: '/ua/ajax.php?page=groups&action=editGroup', type: 'post', dataType : 'json', success: postEditGroup }; var createGroupHandler = { url: '/ua/ajax.php?page=groups&action=createGroup', type: 'post', dataType : 'json', success: postEditGroup }; function postEditGroup(reply) { if (reply.result) { $('#savebad').hide(); showNotification(N_JS_SAVED); if (reply.group_id) { // redirect on new group created location.href = 'group'+reply.group_id; return; } if (reply.new_pic) { $('#group_pic').removeAttr('height'); $('#group_pic').removeAttr('width'); $('#group_pic').attr('src', reply.new_pic.src); } $('#fileToUpload').clearFields(); } else { $('#savebad').html(reply.info); $('#savebad').fadeIn(300); } }; /******************************************************************************* * BASE ******************************************************************************/ function saveGroupOptions(groupId) { var parameters = $('#groupOptionsForm').formSerialize(); $.post(_page_url + '?page=groups&action=saveOptions&groupId='+groupId, parameters, function(response) { eval( "var reply = "+response+";"); if (reply.result) { location.href = 'group' + groupId; } }); }; function deleteGroup(groupId) { if (!confirm(Q_JS_DELETE_GROUP)) return false; $.post(_page_url + '?page=groups&action=deleteGroup&groupId='+groupId, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { $('#savebad').hide(); location.href = 'groups'; } else { $('#savebad').css('display', ''); } }); }; /******************************************************************************* * MEMBERS ******************************************************************************/ function getGroupMembers(page) { groupId = $('#group_id').val(); $.post('/ua/ajax.php?page=groups&action=getMembers&groupId='+groupId+'&pg='+page, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { $('#groupMembers').html( reply.info ); $('a.mbrs').cluetip({ onShow:clueShow ,dropShadow: false, showTitle:false, tracking:true, local:true, hideLocal:true, fx:{open:'fadeIn', openSpeed: '300'}}); } }); }; function acceptMember(userIds, groupId) { $.post(_page_url + '?page=groups&action=acceptMember&groupId='+groupId+'&userIds='+userIds, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { moveToMembers(userIds, 0); } }); }; function deleteMember(userIds, groupId, fromSection) { $.post(_page_url + '?page=groups&action=deleteMember&groupId='+groupId+'&userIds='+userIds, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { removeMember(userIds, fromSection); } }); }; function promoteMember(userIds, groupId) { $.post(_page_url + '?page=groups&action=promoteMember&groupId='+groupId+'&userIds='+userIds, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { moveToModerators(userIds); } }); }; function demoteMember(userIds, groupId) { $.post(_page_url + '?page=groups&action=demoteMember&groupId='+groupId+'&userIds='+userIds, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { moveToMembers(userIds, 2); } }); }; /******************************************************************************* * ACTIONS ******************************************************************************/ function inviteToGroup() { if ($('#groupInviteName').val() != '') { location.href = 'search&s=1&invgid='+$('#groupId').val()+'&lfn='+$('#groupInviteName').val(); } }; function joinGroup(groupId, access) { $.post(_page_url + '?page=groups&action=joinGroup&groupId='+groupId, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { if (access == 0) { //location.href = 'group'+groupId; window.location.reload(); } else { $('#modalBox').hide(); $.unblockUI(); showNotification(reply.message); } } }); }; function leaveGroup(groupId) { $.post(_page_url + '?page=groups&action=leaveGroup&groupId='+groupId, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { //window.location.reload(); location.href = '/group'+groupId; } }); }; function acceptGroupInvitation(groupId) { $.post('/ua/ajax.php?page=groups&action=acceptInvitation&groupId='+groupId, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { $('#htmlGI'+ groupId).hide(); } }); }; function rejectGroupInvitation(groupId) { $.post('/ua/ajax.php?page=groups&action=rejectInvitation&groupId='+groupId, '', function(response) { eval( "var reply = "+response+";"); if (reply.result) { $('#htmlGI'+ groupId).hide(); } }); }; function showJoinGroupDlg(group_id) { $.getJSON( '/ua/ajax.php', {page:'dialogs', action:'joingroup', groupId: group_id}, function(json){ completeDialogBox(json); }); }; function searchGroups() { var catId = $("#category_id").val(); var searchVal = $("#groupSearch").val(); if ( searchVal == '') { showNotification('Введите текст для поиска'); return; } else { location.href = 'groups&cat='+catId + '&search=' + searchVal; return false; } }; function getAccessToEnabledCommentBlog(element) { if (element.value == 0) { $("#enableCommentBlog").slideDown("slow"); } else { $("#enableCommentBlog").hide(); } if (element.value == 2) { $("#enableInterest").hide(); } else { $("#enableInterest").show(); } }; function SearchInterestByInterestGroup() { $('#showInterest').hide(); $('#selectInterest').empty(); var request = '/ua/ajax.php?page=groups&action=searchInterestByInterestGroup'; $.post(request, {interestGroupId:$("select#selectInterestGroup").val()}, function(response) { eval( "var reply = "+response+";"); if (reply.result) { $('#showInterest').show(); $("