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

+280 -65
View File
@@ -13,6 +13,13 @@ _forums.prototype.forums = {
totalChecked: 0,
showMod: [],
fetchMore: {},
modOptionsUnapproved: 0,
modOptionsPinned: 0,
modOptionsUnpinned: 0,
modOptionsLocked: 0,
modOptionsUnlocked: 0,
modOptionsHidden: 0,
modOptionsNotHidden: 0,
init: function()
{
@@ -36,15 +43,12 @@ _forums.prototype.forums = {
$('tmod_all').observe( 'click', ipb.forums.checkAllTopics );
}
if ( $("moderator_toggle") )
{
$("moderator_toggle").on( 'click', ipb.forums.openModPanel );
}
ipb.delegate.register(".topic_mod", ipb.forums.checkTopic );
ipb.delegate.register(".t_rename", ipb.forums.topicRename );
ipb.delegate.register('.t_delete', ipb.forums.topicDeletePopUp );
},
loadMore: function(e)
{
Event.stop(e);
@@ -81,7 +85,15 @@ _forums.prototype.forums = {
{
$('forum_load_more').replace("<span class='desc lighter'>"+ipb.lang['no_more_topics']+"</span>");
return;
}
}
else
{
/* Reset the 'all' checkbox */
if ( $('tmod_all') )
{
$('tmod_all').checked = false;
}
}
}
});
},
@@ -119,14 +131,17 @@ _forums.prototype.forums = {
var temp = ipb.templates['topic_rename'].evaluate( { inputid: link.id + '_input',
submitid: link.id + '_submit',
cancelid: link.id + '_cancel',
value: link.innerHTML.unescapeHTML().replace( /'/g, "&#039;" ).replace( /</g, "&lt;" ).replace( />/g, "&gt;" ) } );
value: link.innerHTML.unescapeHTML().replace( /'/g, "&#039;" ).replace( /</g, "&lt;" ).replace( />/g, "&gt;" ).trim() } );
$( link ).insert( { before: temp } );
// Event handlers
$( link.id + '_input' ).observe('keydown', ipb.forums.saveTopicRename );
$( link.id + '_submit' ).observe('click', ipb.forums.saveTopicRename );
$( link.id + '_cancel' ).observe('click', ipb.forums.cancelTopicRename );
$( link.id + '_cancel' ).observe('click', ipb.forums.cancelTopicRename );
// Select and highlight
$( link.id + '_input' ).focus();
$( link ).hide().writeAttribute('showingRename', 'true');
},
@@ -174,13 +189,13 @@ _forums.prototype.forums = {
try {
tid = elem.up('tr').id.replace( 'trow_', '' );
} catch(err){ Debug.write( err ); return; }
new Ajax.Request( ipb.vars['base_url'] + "app=forums&module=ajax&section=topics&do=saveTopicTitle&md5check="+ipb.vars['secure_hash']+'&tid='+tid,
{
method: 'post',
evalJSON: 'force',
parameters: {
'name': $F('tid-link-' + tid + '_input').replace( /&#039;/g, "'" ).encodeParam()
'name': $F('tid-link-' + tid + '_input').replace( /&#039;/g, "'" ).replace( /\\/g, '\\\\' ).encodeParam()
},
onSuccess: function(t)
{
@@ -228,7 +243,8 @@ _forums.prototype.forums = {
}
ipb.forums.updateTopicModButton();
},
},
checkAllTopics: function(e)
{
Debug.write('checkAllTopics');
@@ -254,9 +270,28 @@ _forums.prototype.forums = {
selectedTopics = selectedTopics.uniq();
if( toRemove.length >= 1 ){
for( i=0; i<toRemove.length; i++ ){
selectedTopics = selectedTopics.without( parseInt( toRemove[i] ) );
if( toRemove.length >= 1 )
{
for( i=0; i<toRemove.length; i++ )
{
//selectedTopics = selectedTopics.without( parseInt( toRemove[i] ) );
idToBeRemoved = parseInt( toRemove[i] );
if ( ! isNaN( idToBeRemoved ) )
{
// without not so hot in Chrome
_selectedTopics = selectedTopics;
selectedTopics = $A();
_selectedTopics.each( function( item )
{
if ( idToBeRemoved != item )
{
selectedTopics.push( item );
}
} );
}
}
}
@@ -266,71 +301,217 @@ _forums.prototype.forums = {
$('selectedtids').value = selectedTopics;
ipb.forums.updateTopicModButton();
ipb.forums.openModPanel();
},
checkTopic: function(e)
{
remove = new Array();
check = Event.findElement( e, 'input' );
checkAll = true;
remove = new Array();
check = Event.findElement( e, 'input' );
selectedTopics = $F('selectedtids').split(',').compact();
if( check.checked == true )
{
selectedTopics.push( check.id.replace('tmod_', '') );
ipb.forums.totalChecked++;
}
else
{
remove.push( check.id.replace('tmod_', '') );
ipb.forums.totalChecked--;
}
selectedTopics = selectedTopics.uniq().without( remove ).join(',');
ipb.Cookie.set('modtids', selectedTopics, 0);
$('selectedtids').value = selectedTopics;
ipb.forums.updateTopicModButton();
ipb.forums.openModPanel();
},
openModPanel: function( e )
{
if( e ){
Event.stop(e);
}
if( $('topic_mod') && $('moderator_toggle') && ! $('topic_mod').visible() ){
$('moderator_toggle').up('li').hide();
new Effect.BlindDown( $('topic_mod'), { duration: 0.3 } );
}
},
updateTopicModButton: function( )
{
if( $('mod_submit') )
{
var _v = $('mod_tact').options[ $('mod_tact').selectedIndex ].value;
if ( _v.match( /^t_/ ) )
if ( check.readAttribute( "data-approved" ) == 1 )
{
$('mod_submit').disabled = false;
$('mod_submit').value = ipb.lang['justgo'];
ipb.forums.modOptionsNotHidden++;
}
else if ( check.readAttribute( "data-approved" ) == 0 )
{
ipb.forums.modOptionsUnapproved++;
}
else if ( check.readAttribute( "data-approved" ) == -1 )
{
ipb.forums.modOptionsHidden++;
}
if ( check.readAttribute( "data-open" ) == 1 )
{
ipb.forums.modOptionsUnlocked++;
}
else
{
if( ipb.forums.totalChecked == 0 ){
$('mod_submit').disabled = true;
} else {
$('mod_submit').disabled = false;
}
/* Make sure it can't say -1 */
if( ipb.forums.totalChecked < 1 )
{
ipb.forums.totalChecked = 0;
}
$('mod_submit').value = ipb.lang['with_selected'].replace('{num}', ipb.forums.totalChecked);
ipb.forums.modOptionsLocked++;
}
if ( check.readAttribute( "data-pinned" ) == 1 )
{
ipb.forums.modOptionsPinned++;
}
else
{
ipb.forums.modOptionsUnpinned++;
}
/* Re-check if all checkboxes are chosen or not */
$$('.topic_mod').each( function(modCheck){
if( checkAll && ! modCheck.checked )
{
checkAll = false;
}
});
}
else
{
checkAll = false;
remove.push( check.id.replace('tmod_', '') );
ipb.forums.totalChecked--;
if ( check.readAttribute( "data-approved" ) == 1 )
{
ipb.forums.modOptionsNotHidden--;
}
else if ( check.readAttribute( "data-approved" ) == 0 )
{
ipb.forums.modOptionsUnapproved--;
}
else if ( check.readAttribute( "data-approved" ) == -1 )
{
ipb.forums.modOptionsHidden--;
}
if ( check.readAttribute( "data-open" ) == 1 )
{
ipb.forums.modOptionsUnlocked--;
}
else
{
ipb.forums.modOptionsLocked--;
}
if ( check.readAttribute( "data-pinned" ) == 1 )
{
ipb.forums.modOptionsPinned--;
}
else
{
ipb.forums.modOptionsUnpinned--;
}
}
/* without not so hot in Chrome */
_selectedTopics = selectedTopics;
selectedTopics = $A();
_selectedTopics.each( function( item )
{
ok = true;
remove.each( function( ritem )
{
if ( ritem == item )
{
ok = false;
}
} )
if ( ok === true )
{
selectedTopics.push( item );
}
} );
selectedTopics = selectedTopics.uniq().join(',');
ipb.Cookie.set('modtids', selectedTopics, 0);
$('selectedtids').value = selectedTopics;
$('tmod_all').checked = checkAll;
ipb.forums.updateTopicModButton();
},
updateTopicModButton: function( )
{
/* Do we have any checked? */
if( ipb.forums.totalChecked > 0 )
{
/* Yes! Have we loaded in the HTML for the box? */
if( !$('comment_moderate_box') )
{
/* No? Then do it! */
$$('body')[0].insert({'bottom': ipb.templates['topic_moderation'].evaluate({count: ipb.forums.totalChecked}) });
/* And set the action for the submit button */
$('submitModAction').on('click', ipb.forums.doModerate);
}
else
{
/* Yes, just update the number of checked boxes */
$('comment_count').update( ipb.forums.totalChecked );
}
/* And show the box */
if( !$('comment_moderate_box').visible() )
{
new Effect.Appear( $('comment_moderate_box'), { duration: 0.3 } );
}
/* Update the available options */
$('tactInPopup').select('option').invoke('remove');
if ( ipb.forums.modOptionsUnapproved )
{
$('tactInPopup').insert( new Element('option', { value: 'approve' } ).update( ipb.lang['cpt_approve_f'] ) );
}
if ( ipb.forums.modOptionsUnpinned )
{
$('tactInPopup').insert( new Element('option', { value: 'pin' } ).update( ipb.lang['cpt_pin_f'] ) );
}
if ( ipb.forums.modOptionsPinned )
{
$('tactInPopup').insert( new Element('option', { value: 'unpin' } ).update( ipb.lang['cpt_unpin_f'] ) );
}
if ( ipb.forums.modOptionsLocked )
{
$('tactInPopup').insert( new Element('option', { value: 'open' } ).update( ipb.lang['cpt_open_f'] ) );
}
if ( ipb.forums.modOptionsUnlocked )
{
$('tactInPopup').insert( new Element('option', { value: 'close' } ).update( ipb.lang['cpt_close_f'] ) );
}
$('tactInPopup').insert( new Element('option', { value: 'move' } ).update( ipb.lang['cpt_move_f'] ) );
$('tactInPopup').insert( new Element('option', { value: 'merge' } ).update( ipb.lang['cpt_merge_f'] ) );
if ( ipb.forums.modOptionsNotHidden )
{
$('tactInPopup').insert( new Element('option', { value: 'delete' } ).update( ipb.lang['cpt_hide_f'] ) );
}
if ( ipb.forums.modOptionsHidden )
{
$('tactInPopup').insert( new Element('option', { value: 'sundelete' } ).update( ipb.lang['cpt_unhide_f'] ) );
}
$('tactInPopup').insert( new Element('option', { value: 'deletedo' } ).update( ipb.lang['cpt_delete_f'] ) );
$('multiModOptions').select('option').each( function( item ){
$('tactInPopup').insert( $( item ).clone().update( item.innerHTML ) );
});
}
else
{
/* No - get rid of the box */
if( $('comment_moderate_box') )
{
new Effect.Fade( $('comment_moderate_box'), { duration: 0.3 } );
}
}
},
doModerate: function()
{
if ( ipb.forums.totalChecked > 0 )
{
$('tact').value = $('tactInPopup').value;
$('modform').submit();
}
},
@@ -351,6 +532,40 @@ _forums.prototype.forums = {
url = ipb.vars['base_url'] + "&app=forums&module=ajax&secure_key=" + ipb.vars['secure_hash'] + '&section=stats&do=who&t=' + tid;
popup = new ipb.Popup( 'whoPosted', { type: 'pane', modal: false, w: '500px', h: 400, ajaxURL: url, hideAtStart: false, close: 'a[rel="close"]' } );
return false;
},
/**
* 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&amp;module=ajax&amp;section=templates&amp;secure_key=" + ipb.vars['secure_hash'] + "&amp;template_group=forum&amp;template_bit=deleteTopic&amp;lang_module=forums&amp;lang_app=forums";
new Ajax.Request( url.replace(/&amp;/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: '350px' } );
}
}
);
}
};