Version 3.3.4

This commit is contained in:
Neo committed 2025-12-19 00:35:52 -08:00
1 parent 78706903a2
commit fb6b5baabc
2206 files changed
+409828 -382984

No files matched your search

+261 -73
View File
@@ -18,12 +18,17 @@ _topic.prototype.topic = {
deletePerms: {},
deleteUrls: {},
deletePopUps: [],
hidePopUps: [],
restorePopUps: [],
counts: {},
timers: {},
polling: { count: 0 },
mqBoxShowing: false,
fastReplyId: '',
isPosting: false,
modOptionsUnapproved: 0,
modOptionsHidden: 0,
modOptionsUnhidden: 0,
init: function()
{
@@ -46,12 +51,15 @@ _topic.prototype.topic = {
ipb.delegate.register('._ips_trigger_quote', ipb.topic.ajaxQuote);
ipb.delegate.register('.edit_post', ipb.topic.ajaxEditShow);
ipb.delegate.register('.hide_post', ipb.topic.hidePopUp);
ipb.delegate.register('.delete_post', ipb.topic.deletePopUp);
ipb.delegate.register('.toggle_post', ipb.topic.ajaxTogglePostApprove);
ipb.delegate.register('.sd_content', ipb.topic.sDeletePostShow);
ipb.delegate.register('.sd_remove', ipb.topic.confirmSingleDelete);
ipb.delegate.register('input.post_mod', ipb.topic.checkPost);
ipb.delegate.register('.post_id a[rel="bookmark"]', ipb.topic.showLinkToTopic );
ipb.delegate.register('.modlink_09', ipb.topic.topicDeletePopUp );
if ( $('submit_post') ){
$('submit_post').observe( "click", ipb.topic.ajaxFastReply );
@@ -81,18 +89,6 @@ _topic.prototype.topic = {
$('multiQuoteClear').on('click', ipb.topic.clearMultiQuote);
}
}
if ( $('topic_mod') )
{
$('topic_mod').hide();
$('moderator_toggle').up('div').show().observe('click', function(e){
Event.stop(e);
$('moderator_toggle').up('div').hide();
new Effect.BlindDown( $("topic_mod"), { duration: 0.3 } );
});
}
}
else if( ipb.topic.inSection == 'searchview' )
@@ -106,6 +102,57 @@ _topic.prototype.topic = {
ipb.delegate.register('.hide_signature', ipb.topic.signatureCloseClick);
},
/**
* Delete a topic
*/
deleteTopicDialog: function( elem, e )
{
if ( confirm( ipb.lang['delete_confirm'] ) )
{
window.location = ipb.vars['base_url'] + "app=forums&module=moderate&section=moderate&do=deleteArchivedTopic&t=" + ipb.topic.topic_id + "&f=" + ipb.topic.forum_id + "&auth_key=" + ipb.vars['secure_hash'];
}
},
/**
* Flag an item for being restored
*/
restoreTopicDialogGo: function(elem, e)
{
Event.stop(e);
window.location = ipb.vars['base_url'] + "app=forums&module=moderate&section=moderate&do=unArchiveTopic&t=" + ipb.topic.topic_id + "&f=" + ipb.topic.forum_id + "&auth_key=" + ipb.vars['secure_hash'];
},
/**
* Show a pop-up for topic restore dialog
*/
restoreTopicDialog: function(elem, e)
{
Event.stop(e);
// Get popup contents
var url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&topic_id=" + ipb.topic.topic_id + "&secure_key=" + ipb.vars['secure_hash'] + "&template_group=topic&template_bit=restoreTopicDialog&lang_module=topic&lang_app=forums";
new Ajax.Request( url.replace(/&/g, '&'),
{
method: 'post',
evalJSON: 'force',
onSuccess: function(t)
{
/* Create the pop-up */
var popid = 'pop__restore_popup_' + ipb.topic.topic_id;
var content = new Template( t.responseJSON['html'] ).evaluate( { } );
ipb.topic.restorePopUps = new ipb.Popup( popid, { type: 'pane',
modal: true,
initial: content,
hideAtStart: false,
w: '550px' });
}
}
);
},
/* ------------------------------ */
/**
* Event handler for signature closing
@@ -250,24 +297,16 @@ _topic.prototype.topic = {
},
/**
* Show a pop-up for soft delete / delete or just redirect if no hard link
* Show a pop-up for soft delete
*/
deletePopUp: function(e, elem)
hidePopUp: function(e, elem)
{
var postid = elem.up().id.replace( /del_post_/, '' );
var postid = elem.up().id.replace( /hide_post_/, '' );
if( !postid ){ return; }
/* First off, fix URLs */
var _url_delete = ipb.topic.deleteUrls['hardDelete'].evaluate( { 'pid': postid } ).replace(/&/g, '&') + '&nr=1';
var _url_soft = ipb.topic.deleteUrls['softDelete'].evaluate( { 'pid': postid } ).replace(/&/g, '&') + '&nr=1';
var _permaShow = '';
/* If we can't soft delete posts, then just offload to normal function */
if ( ! ipb.topic.deletePerms[ postid ]['canSoftDelete'] )
{
return ipb.topic.confirmSingleDelete(e, elem);
}
Event.stop(e);
// Get popup contents
@@ -280,14 +319,88 @@ _topic.prototype.topic = {
onSuccess: function(t)
{
/* Create the pop-up */
var popid = 'pop__delete_popup_' + postid;
var content = new Template( t.responseJSON['html'] ).evaluate( { removeUrl: _url_soft, permaDelete: _permaShow, permaUrl: _url_delete } );
var popid = 'pop__hide_popup_' + postid;
var content = new Template( t.responseJSON['html'] ).evaluate( { removeUrl: _url_soft, permaDelete: _permaShow } );
ipb.topic.deletePopUps = new ipb.Popup( popid, { type: 'pane',
ipb.topic.hidePopUps = new ipb.Popup( popid, { type: 'balloon',
stem: true,
modal: false,
initial: content,
hideAtStart: false,
w: '550px',
attach: { target: elem, position: 'auto', 'event': 'click' } });
}
}
);
},
/**
* Show a pop-up for hard delete
*/
deletePopUp: function(e, elem)
{
var postid = elem.up().id.replace( /del_post_/, '' );
if( !postid ){ return; }
/* First off, fix URLs */
var _url_delete = ipb.topic.deleteUrls['hardDelete'].evaluate( { 'pid': postid } ).replace(/&/g, '&') + '&nr=1';
var _permaShow = '';
Event.stop(e);
// Get popup contents
var url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&secure_key=" + ipb.vars['secure_hash'] + "&template_group=topic&template_bit=doDeletePost&lang_module=topic&lang_app=forums";
new Ajax.Request( url.replace(/&/g, '&'),
{
method: 'post',
evalJSON: 'force',
onSuccess: function(t)
{
/* Create the pop-up */
var popid = 'pop__delete_popup_' + postid;
var content = new Template( t.responseJSON['html'] ).evaluate( { permaDelete: _permaShow, permaUrl: _url_delete } );
ipb.topic.deletePopUps = new ipb.Popup( popid, { type: 'balloon',
stem: true,
modal: false,
initial: content,
hideAtStart: false,
w: '350px',
attach: { target: elem, position: 'auto', 'event': 'click' } });
}
}
);
},
/**
* Show a pop-up for topic delete
*/
topicDeletePopUp: function(e, elem)
{
/* First off, fix URLs */
var _url_delete = '';
var _permaShow = '';
Event.stop(e);
// Get popup contents
var url = ipb.vars['base_url'] + "app=core&module=ajax&section=templates&secure_key=" + ipb.vars['secure_hash'] + "&template_group=forum&template_bit=deleteTopic&lang_module=forums&lang_app=forums";
new Ajax.Request( url.replace(/&/g, '&'),
{
method: 'post',
evalJSON: 'force',
onSuccess: function(t)
{
/* Create the pop-up */
var popid = 'pop__topic_delete_popup';
var content = new Template( t.responseJSON['html'] ).evaluate( { deleteUrl: elem.href } );
new ipb.Popup( popid, { type: 'pane',
stem: true,
modal: true,
initial: content,
hideAtStart: false,
w: '550px' });
w: '350px' } );
}
}
);
@@ -356,24 +469,12 @@ _topic.prototype.topic = {
}
else
{
if ( toApprove )
{
$('post_id_' + postid).removeClassName( 'moderated' );
$('toggletext_post_' + postid).update( ipb.lang['unapprove'] );
$$('#toggle_post_' + postid + " a img").each( function(elem){
$(elem).src = $(elem).src.replace( /accept/, 'delete' );
});
}
else
{
$('post_id_' + postid).addClassName( 'moderated' );
$('toggletext_post_' + postid).update( ipb.lang['approve'] );
$$('#toggle_post_' + postid + " a img").each( function(elem){
$(elem).src = $(elem).src.replace( /delete/, 'accept' );
});
}
$('post_id_' + postid).removeClassName( 'moderated' );
$( 'postControlsUnapproved_' + postid ).hide();
$( 'postControlsNormal_' + postid ).show();
$( 'checkbox_' + postid ).writeAttribute( 'data-status', '0' );
}
}
}
@@ -470,7 +571,7 @@ _topic.prototype.topic = {
}
}
}
);
)
Debug.write( url );
},
@@ -492,7 +593,7 @@ _topic.prototype.topic = {
if( !postid ){ return; }
var url = ipb.vars['base_url'] + 'app=forums&module=post&section=post&do=edit_post&f=' + ipb.topic.forum_id + '&t=' + ipb.topic.topic_id + '&p=' + postid + '&st=' + ipb.topic.start_id + '&_from=quickedit';
var Post = ipb.textEditor.getEditor( 'edit-' + postid ).CKEditor.getData();
var Post = ipb.textEditor.getEditor( 'edit-' + postid ).getText();
form = new Element('form', { action: url, method: 'post' } );
textarea = new Element('textarea', { name: 'Post' } );
@@ -584,7 +685,14 @@ _topic.prototype.topic = {
toggleEditorButtons( true );
if ( t.responseJSON && t.responseJSON['error'] ){
ipb.global.errorDialogue( t.responseJSON['error'] );
if (! Object.isUndefined( ipb.lang[t.responseJSON['error']] ))
{
ipb.global.errorDialogue( ipb.lang[t.responseJSON['error']] );
}
else
{
ipb.global.errorDialogue( t.responseJSON['error'] );
}
return false;
}
else if( t.responseJSON && t.responseJSON['success'] )
@@ -705,7 +813,7 @@ _topic.prototype.topic = {
pid = elem.readAttribute('pid');
var url = ipb.vars['base_url'] + 'app=forums&module=ajax&section=topics&do=quote&t=' + ipb.topic.topic_id + '&p=' + pid + '&md5check=' + ipb.vars['secure_hash'];
var url = ipb.vars['base_url'] + 'app=forums&module=ajax&section=topics&do=quote&t=' + ipb.topic.topic_id + '&p=' + pid + '&md5check=' + ipb.vars['secure_hash'] + '&isRte=' + ipb.textEditor.getEditor( ipb.topic.fastReplyId ).isRte();
Debug.write( url );
new Ajax.Request( url,
@@ -723,7 +831,7 @@ _topic.prototype.topic = {
else if ( t.responseText && t.responseText != 'nopermission' )
{
editor = ipb.textEditor.getEditor( ipb.topic.fastReplyId );
editor.insert( t.responseText, true );
editor.insert( t.responseText, 'always' );
}
}
}
@@ -998,10 +1106,12 @@ _topic.prototype.topic = {
{
if( !pid.blank() )
{
ipb.topic.totalChecked++;
/* #37999: We don't need this increment as the action of checking the box itself will also increment the count */
//ipb.topic.totalChecked++;
if( $('checkbox_' + pid) )
{
ipb.topic.checkPost( this, $('checkbox_' + pid) );
$('checkbox_' + pid).checked = true;
}
@@ -1029,16 +1139,46 @@ _topic.prototype.topic = {
} else {
pids = $A();
}
if( check.checked == true )
{
pids.push( check.id.replace('checkbox_', '') );
ipb.topic.totalChecked++;
switch ( check.readAttribute("data-status") )
{
case '1':
ipb.topic.modOptionsUnapproved += 1;
break;
case '2':
ipb.topic.modOptionsHidden += 1;
break;
default:
ipb.topic.modOptionsUnhidden += 1;
break;
}
}
else
{
remove.push( check.id.replace('checkbox_', '') );
ipb.topic.totalChecked--;
switch ( check.readAttribute("data-status") )
{
case '1':
ipb.topic.modOptionsUnapproved -= 1;
break;
case '2':
ipb.topic.modOptionsHidden -= 1;
break;
default:
ipb.topic.modOptionsUnhidden -= 1;
break;
}
}
pids = pids.uniq().without( remove ).join(',');
@@ -1046,11 +1186,6 @@ _topic.prototype.topic = {
$('selectedpidsJS').value = pids;
ipb.topic.updatePostModButton();
if( $('moderator_toggle') ){
$('moderator_toggle').up('div').hide();
$("topic_mod").show();
$('topic_mod_2').show();
}
},
/* ------------------------------ */
@@ -1059,28 +1194,81 @@ _topic.prototype.topic = {
*/
updatePostModButton: function()
{
if( $('mod_submit') )
/* Do we have any checked? */
if( ipb.topic.totalChecked > 0 )
{
if( ipb.topic.totalChecked == 0 ){
$('mod_submit').disabled = true;
} else {
$('mod_submit').disabled = false;
/* Yes! Have we loaded in the HTML for the box? */
if( !$('comment_moderate_box') )
{
/* No? Then do it! */
$$('body')[0].insert({'bottom': ipb.templates['post_moderation'].evaluate({count: ipb.topic.totalChecked}) });
/* And set the action for the submit button */
$('submitModAction').on('click', ipb.topic.doModerate);
}
else
{
/* Yes, just update the number of checked boxes */
$('comment_count').update( ipb.topic.totalChecked );
}
$('mod_submit').value = ipb.lang['with_selected'].replace('{num}', ipb.topic.totalChecked);
/* And show the box */
if( !$('comment_moderate_box').visible() )
{
new Effect.Appear( $('comment_moderate_box'), { duration: 0.3 } );
}
$('tactInPopup').select('option').invoke('remove');
/* Update the available options */
if ( ipb.topic.modOptionsUnapproved )
{
$('tactInPopup').insert( new Element('option', { value: 'approve' } ).update( ipb.lang['cpt_approve'] ) );
}
if ( ipb.topic.modOptionsUnhidden )
{
$('tactInPopup').insert( new Element('option', { value: 'delete' } ).update( ipb.lang['cpt_hide'] ) );
}
if ( ipb.topic.modOptionsHidden )
{
$('tactInPopup').insert( new Element('option', { value: 'sundelete' } ).update( ipb.lang['cpt_undelete'] ) );
}
$('tactInPopup').insert( new Element('option', { value: 'deletedo' } ).update( ipb.lang['cpt_delete'] ) );
if ( ipb.topic.totalChecked > 1 )
{
$('tactInPopup').insert( new Element('option', { value: 'merge' } ).update( ipb.lang['cpt_merge'] ) );
}
$('tactInPopup').insert( new Element('option', { value: 'split' } ).update( ipb.lang['cpt_split'] ) );
$('tactInPopup').insert( new Element('option', { value: 'move' } ).update( ipb.lang['cpt_move'] ) );
}
else
{
/* No - get rid of the box */
if( $('comment_moderate_box') )
{
new Effect.Fade( $('comment_moderate_box'), { duration: 0.3 } );
}
}
},
/* ------------------------------ */
/**
* Shows a prompt allowing user to copy the URL
*
* @var {event} e The event
*/
showLinkToTopic: function(e, elem)
doModerate: function()
{
_t = prompt( ipb.lang['copy_topic_link'], $( elem ).readAttribute('href') );
Event.stop(e);
if ( ipb.topic.totalChecked > 0 )
{
$('tact').value = $('tactInPopup').value;
if ( $('tactInPopup').options[ $('tactInPopup').selectedIndex ].value == 'deletedo' )
{
$('modform').confirmAction();
}
else
{
$('modform').submit();
}
}
},
/* ------------------------------ */