mirror of
https://gh.wpcy.net/https://github.com/buddypress/buddypress.git
synced 2026-05-31 05:04:29 +08:00
You should install all BuddyPress component plugin files in /wp-content/plugins/buddypress/ however you can call the "buddypress" dir anything you like. BuddyPress plugins can then be activated and deactivated through the "Plugins" admin panel. If you are upgrading to this version please move all BuddyPress plugins to the location mentioned above and then update. You will also need to make sure your themes reference the new locations. There are two constants you should use "BP_PLUGIN_DIR" and "BP_PLUGIN_URL". You will need to re-activate the plugins via the "Plugins" admin panel. Again, from now on BuddyPress will ONLY work with WPMU 2.7.1+ so please use the 2.7 branch from the WordPress MU SVN repo. Link: http://trac.mu.wordpress.org/browser/branches/2.7 git-svn-id: https://buddypress.svn.wordpress.org/trunk@1303 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
304 lines
No EOL
8.5 KiB
PHP
304 lines
No EOL
8.5 KiB
PHP
<?php
|
|
/* Load the WP environment */
|
|
require_once( preg_replace('%(.*)[/\\\\]wp-content[/\\\\].*%', '\1', dirname( __FILE__ ) ) . '/wp-load.php' );
|
|
|
|
/* Set the content type to CSS */
|
|
header('Content-type: text/javascript');
|
|
?>
|
|
function checkAll() {
|
|
var checkboxes = document.getElementsByTagName("input");
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
if(checkboxes[i].type == "checkbox") {
|
|
if($("check_all").checked == "") {
|
|
checkboxes[i].checked = "";
|
|
}
|
|
else {
|
|
checkboxes[i].checked = "checked";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
jQuery(document).ready( function() {
|
|
jQuery("input#send-notice").click(
|
|
function() {
|
|
if ( jQuery("#send_to") ) {
|
|
jQuery("#send_to").val('');
|
|
}
|
|
}
|
|
);
|
|
|
|
jQuery("input#send_reply_button").click(
|
|
function() {
|
|
//tinyMCE.triggerSave(true, true);
|
|
|
|
var rand = Math.floor(Math.random()*100001);
|
|
jQuery("form#send-reply").before('<div style="display:none;" class="ajax_reply" id="' + rand + '"><img src="<?php echo BP_PLUGIN_URL . '/bp-messages/images/loading.gif' ?>" alt="Loading" /> Sending Message...</div>');
|
|
jQuery("div#" + rand).fadeIn();
|
|
|
|
jQuery.post( ajaxurl, {
|
|
action: 'messages_send_reply',
|
|
'cookie': encodeURIComponent(document.cookie),
|
|
'_wpnonce': jQuery("input#_wpnonce_send_message").val(),
|
|
|
|
'content': jQuery("#message_content").val(),
|
|
'send_to': jQuery("input#send_to").val(),
|
|
'subject': jQuery("input#subject").val(),
|
|
'thread_id': jQuery("input#thread_id").val()
|
|
},
|
|
function(response)
|
|
{
|
|
response = response.substr(0, response.length-1);
|
|
var css_class = 'message-box';
|
|
|
|
setTimeout( function() {
|
|
jQuery("div#" + rand).slideUp();
|
|
}, 500);
|
|
|
|
setTimeout( function() {
|
|
var err_num = response.split('[[split]]');
|
|
if ( err_num[0] == "-1" ) {
|
|
response = err_num[1];
|
|
css_class = 'error-box';
|
|
}
|
|
|
|
//tinyMCE.activeEditor.setContent('')
|
|
jQuery("#message_content").val('');
|
|
|
|
jQuery("div#" + rand).html(response).attr('class', css_class).slideDown();
|
|
}, 1250);
|
|
});
|
|
|
|
return false;
|
|
}
|
|
);
|
|
|
|
jQuery("a#mark_as_read").click(
|
|
function() {
|
|
checkboxes_tosend = '';
|
|
checkboxes = jQuery("#message-threads tr td input[type='checkbox']");
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
if(checkboxes[i].checked) {
|
|
if ( jQuery('tr#m-' + checkboxes[i].value).hasClass('unread') ) {
|
|
checkboxes_tosend += checkboxes[i].value;
|
|
jQuery('tr#m-' + checkboxes[i].value).removeClass('unread');
|
|
jQuery('tr#m-' + checkboxes[i].value).addClass('read');
|
|
jQuery('tr#m-' + checkboxes[i].value + ' td span.unread-count').html('0');
|
|
var inboxcount = jQuery('.inbox-count').html();
|
|
if ( parseInt(inboxcount) == 1 ) {
|
|
jQuery('.inbox-count').css('display', 'none');
|
|
jQuery('.inbox-count').html('0');
|
|
} else {
|
|
jQuery('.inbox-count').html(parseInt(inboxcount) - 1);
|
|
}
|
|
|
|
if ( i != checkboxes.length - 1 ) {
|
|
checkboxes_tosend += ','
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
jQuery.post( ajaxurl, {
|
|
action: 'messages_markread',
|
|
'thread_ids': checkboxes_tosend
|
|
},
|
|
function(response) {
|
|
response = response.substr(0, response.length-1);
|
|
var err_num = response.split('[[split]]');
|
|
if ( err_num[0] == "-1" ) {
|
|
// error
|
|
jQuery('table#message-threads').before('<div id="message" class="error fade"><p>' + err_num[1] + '</p></div>')
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
);
|
|
|
|
jQuery("a#mark_as_unread").click(
|
|
function() {
|
|
checkboxes_tosend = '';
|
|
checkboxes = jQuery("#message-threads tr td input[type='checkbox']");
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
if(checkboxes[i].checked) {
|
|
if ( jQuery('tr#m-' + checkboxes[i].value).hasClass('read') ) {
|
|
checkboxes_tosend += checkboxes[i].value;
|
|
jQuery('tr#m-' + checkboxes[i].value).removeClass('read');
|
|
jQuery('tr#m-' + checkboxes[i].value).addClass('unread');
|
|
jQuery('tr#m-' + checkboxes[i].value + ' td span.unread-count').html('1');
|
|
var inboxcount = jQuery('.inbox-count').html();
|
|
|
|
if ( parseInt(inboxcount) == 0 ) {
|
|
jQuery('.inbox-count').css('display', 'inline');
|
|
jQuery('.inbox-count').html('1');
|
|
} else {
|
|
jQuery('.inbox-count').html(parseInt(inboxcount) + 1);
|
|
}
|
|
|
|
if ( i != checkboxes.length - 1 ) {
|
|
checkboxes_tosend += ','
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
jQuery.post( ajaxurl, {
|
|
action: 'messages_markunread',
|
|
'thread_ids': checkboxes_tosend
|
|
},
|
|
function(response) {
|
|
response = response.substr(0, response.length-1);
|
|
var err_num = response.split('[[split]]');
|
|
if ( err_num[0] == "-1" ) {
|
|
// error
|
|
jQuery('table#message-threads').before('<div id="message" class="error fade"><p>' + err_num[1] + '</p></div>')
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
);
|
|
|
|
jQuery("a#delete_inbox_messages").click(
|
|
function() {
|
|
checkboxes_tosend = '';
|
|
checkboxes = jQuery("#message-threads tr td input[type='checkbox']");
|
|
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
if(checkboxes[i].checked) {
|
|
checkboxes_tosend += checkboxes[i].value;
|
|
|
|
if ( jQuery('tr#m-' + checkboxes[i].value).hasClass('unread') ) {
|
|
var inboxcount = jQuery('.inbox-count').html();
|
|
|
|
if ( parseInt(inboxcount) == 1 ) {
|
|
jQuery('.inbox-count').css('display', 'none');
|
|
jQuery('.inbox-count').html('0');
|
|
} else {
|
|
jQuery('.inbox-count').html(parseInt(inboxcount) - 1);
|
|
}
|
|
}
|
|
|
|
if ( i != checkboxes.length - 1 ) {
|
|
checkboxes_tosend += ','
|
|
}
|
|
|
|
jQuery('tr#m-' + checkboxes[i].value).remove();
|
|
}
|
|
}
|
|
|
|
if ( !checkboxes_tosend ) return false;
|
|
|
|
jQuery.post( ajaxurl, {
|
|
action: 'messages_delete',
|
|
'thread_ids': checkboxes_tosend
|
|
},
|
|
function(response) {
|
|
response = response.substr(0, response.length-1);
|
|
var err_num = response.split('[[split]]');
|
|
|
|
jQuery('#message').remove();
|
|
|
|
if ( err_num[0] == "-1" ) {
|
|
// error
|
|
jQuery('table#message-threads').before('<div id="message" class="error fade"><p>' + err_num[1] + '</p></div>')
|
|
} else {
|
|
jQuery('table#message-threads').before('<div id="message" class="updated"><p>' + response + '</p></div>')
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
);
|
|
|
|
jQuery("a#delete_sentbox_messages").click(
|
|
function() {
|
|
checkboxes_tosend = '';
|
|
checkboxes = jQuery("#message-threads tr td input[type='checkbox']");
|
|
|
|
if ( !checkboxes.length ) return false;
|
|
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
if(checkboxes[i].checked) {
|
|
checkboxes_tosend += checkboxes[i].value;
|
|
|
|
if ( i != checkboxes.length - 1 ) {
|
|
checkboxes_tosend += ','
|
|
}
|
|
jQuery('tr#m-' + checkboxes[i].value).remove();
|
|
}
|
|
}
|
|
|
|
if ( !checkboxes_tosend ) return false;
|
|
|
|
jQuery.post( ajaxurl, {
|
|
action: 'messages_delete',
|
|
'thread_ids': checkboxes_tosend
|
|
},
|
|
function(response) {
|
|
response = response.substr(0, response.length-1);
|
|
var err_num = response.split('[[split]]');
|
|
|
|
jQuery('#message').remove();
|
|
|
|
if ( err_num[0] == "-1" ) {
|
|
// error
|
|
jQuery('table#message-threads').before('<div id="message" class="error fade"><p>' + err_num[1] + '</p></div>')
|
|
} else {
|
|
jQuery('table#message-threads').before('<div id="message" class="updated"><p>' + response + '</p></div>')
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
);
|
|
|
|
|
|
jQuery("a#close-notice").click(
|
|
function() {
|
|
jQuery.post( ajaxurl, {
|
|
action: 'messages_close_notice',
|
|
'notice_id': jQuery('.notice').attr('id')
|
|
},
|
|
function(response) {
|
|
response = response.substr(0, response.length-1);
|
|
var err_num = response.split('[[split]]');
|
|
|
|
if ( err_num[0] == "-1" ) {
|
|
// error
|
|
jQuery('.notice').before('<div id="message" class="error fade"><p>' + err_num[1] + '</p></div>')
|
|
} else {
|
|
jQuery('.notice').remove();
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
);
|
|
|
|
jQuery("select#message-type-select").change(
|
|
function() {
|
|
var selection = jQuery("select#message-type-select").val();
|
|
var checkboxes = jQuery("td input[type='checkbox']");
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
checkboxes[i].checked = "";
|
|
}
|
|
|
|
switch(selection) {
|
|
case 'unread':
|
|
var checkboxes = jQuery("tr.unread td input[type='checkbox']");
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
checkboxes[i].checked = "checked";
|
|
}
|
|
break;
|
|
case 'read':
|
|
var checkboxes = jQuery("tr.read td input[type='checkbox']");
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
checkboxes[i].checked = "checked";
|
|
}
|
|
break;
|
|
case 'all':
|
|
for(var i=0; i<checkboxes.length; i++) {
|
|
checkboxes[i].checked = "checked";
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
);
|
|
});
|