Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -14,6 +14,7 @@ var _attach = window.IPBoard;
|
||||
_attach.prototype.attach = {
|
||||
uploaders: [],
|
||||
template: '',
|
||||
_doneJson: false,
|
||||
|
||||
init: function()
|
||||
{
|
||||
@@ -32,9 +33,7 @@ _attach.prototype.attach = {
|
||||
* @param {object} options Options to pass to object
|
||||
*/
|
||||
registerUploader: function( id, type, wrapper, options )
|
||||
{
|
||||
//if( !ipb.vars['use_swfupload'] ){ return false; }
|
||||
|
||||
{
|
||||
if( Object.isUndefined( id ) || id == null )
|
||||
{
|
||||
Debug.error("ips.attach.js: Attachment manager already has that ID");
|
||||
@@ -72,6 +71,65 @@ _attach.prototype.attach = {
|
||||
}
|
||||
},
|
||||
|
||||
switchUploadType: function( mode )
|
||||
{
|
||||
var url = ipb.vars['base_url'] + "app=core&module=ajax§ion=attach&do=setPref&pref=" + mode + '&secure_key=' + ipb.vars['secure_hash'];
|
||||
var wLoc = window.location.toString();
|
||||
|
||||
new Ajax.Request( url,
|
||||
{
|
||||
method: 'post',
|
||||
evalJSON: 'force',
|
||||
hideLoader: true,
|
||||
onSuccess: function(t)
|
||||
{
|
||||
if( Object.isUndefined( t.responseJSON ) ){ alert( ipb.lang['action_failed'] ); return; }
|
||||
|
||||
if ( t.responseJSON['status'] == 'ok' )
|
||||
{
|
||||
/* Do some jazzy stuffs */
|
||||
if ( $('postingform') )
|
||||
{
|
||||
/* Preserve poll
|
||||
@link http://community.invisionpower.com/tracker/issue-32853-poll-data-missing-after-change-the-uploader
|
||||
*/
|
||||
if( $('poll_wrap') && $('add_poll') )
|
||||
{
|
||||
try {
|
||||
$('poll_wrap').hide();
|
||||
$('add_poll').insert({ after: $('poll_wrap') });
|
||||
} catch(err){ }
|
||||
}
|
||||
|
||||
$('postingform').action += '&preview=1&uploadPref=' + mode;
|
||||
$('postingform').submit();
|
||||
}
|
||||
else if( $('msgForm') )
|
||||
{
|
||||
var _key = 'preview';
|
||||
|
||||
if( $('msgForm').action.match( /do=sendReply/ ) )
|
||||
{
|
||||
_key = 'previewReply';
|
||||
}
|
||||
|
||||
$('msgForm').action += '&' + _key + '=1&uploadPref=' + mode;
|
||||
$('msgForm').submit();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location = wLoc.replace("#", "").replace( new RegExp( /&uploadPref=\S+?(&|$)/ ), '' ) + '&uploadPref=' + mode + '&preview=1';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( ipb.lang['action_failed'] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
removeUpload: function(e)
|
||||
{
|
||||
elem = Event.findElement( e, 'li' );
|
||||
@@ -172,33 +230,22 @@ _attach.prototype.attach = {
|
||||
{
|
||||
return ipb.lang['silly_server'];
|
||||
}
|
||||
|
||||
/*switch( msg )
|
||||
{
|
||||
case 'upload_no_file':
|
||||
return ipb.lang['upload_no_file'];
|
||||
break;
|
||||
case 'invalid_mime_type':
|
||||
return ipb.lang['invalid_mime_type'];
|
||||
break;
|
||||
case 'upload_too_big':
|
||||
return ipb.lang['upload_too_big'];
|
||||
break;
|
||||
case 'upload_failed':
|
||||
return ipb.lang['upload_failed'];
|
||||
break;
|
||||
default:
|
||||
return ipb.lang['silly_server'];
|
||||
break;
|
||||
} */
|
||||
},
|
||||
|
||||
_jsonPass: function( id, json )
|
||||
{
|
||||
if( ipb.attach._doneJson ){ return; }
|
||||
|
||||
ipb.attach.uploaders[ 'attach_' + id ].json = json;
|
||||
ipb.attach.uploaders[ 'attach_' + id ].isReady();
|
||||
|
||||
// #33731: Opera would constantly call this function, causing the attachment
|
||||
// list to break. As a workaround, we set this to true so that it only
|
||||
// runs once.
|
||||
ipb.attach._doneJson = true;
|
||||
|
||||
Debug.write( "ips.attach.js: Got json back from iframe id " + id );
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -282,15 +329,15 @@ _attach.prototype.attach = {
|
||||
var fileindex = elem.readAttribute('attachid');
|
||||
var filename = elem.down('.attach_name').innerHTML;
|
||||
|
||||
fileindex = fileindex.replace('cur_', '');
|
||||
fileindex = fileindex.toString().replace('cur_', '');
|
||||
|
||||
if( fileindex && filename )
|
||||
{
|
||||
ipb.editorInsert( "[attachment=" + fileindex + ":" + filename.replace( /\[/, '' ).replace( /\]/, '' ) + "]", 'ed-0' );
|
||||
ipb.editorInsert( "[attachment=" + fileindex + ":" + filename.replace( /\[/, '' ).replace( /\]/, '' ) + "]" );
|
||||
}
|
||||
else if( fileindex )
|
||||
{
|
||||
ipb.editorInsert( "[attachment=" + fileindex + "]", 'ed-0' );
|
||||
ipb.editorInsert( "[attachment=" + fileindex + "]" );
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -315,18 +362,21 @@ _attach.prototype.attachTraditional = Class.create({
|
||||
scrolling: 'no',
|
||||
frameBorder: 'no',
|
||||
border: '0',
|
||||
className: '',
|
||||
className: 'clearfix',
|
||||
allowTransparency: true,
|
||||
src: this.options.upload_url,
|
||||
tabindex: '1'
|
||||
}).setStyle({
|
||||
width: '500px',
|
||||
height: '50px',
|
||||
height: '25px',
|
||||
overflow: 'hidden',
|
||||
backgroundColor: 'transparent'
|
||||
});
|
||||
|
||||
$( this.wrapper ).insert( { after: this.iframe } ).addClassName('traditional');
|
||||
$('add_files_' + this.id ).insert( { before: this.iframe } );
|
||||
$( wrapper ).addClassName('traditional');
|
||||
|
||||
Debug.write("Init traditional");
|
||||
|
||||
$('add_files_' + this.id ).observe('click', this.processUpload.bindAsEventListener( this ) );
|
||||
},
|
||||
@@ -370,6 +420,11 @@ _attach.prototype.attachTraditional = Class.create({
|
||||
var iFrameForm = window.frames[ 'iframeAttach_' + this.options['attach_rel_id'] ].document.getElementById('iframeUploadForm');
|
||||
var box = $('attach_' + this.options['attach_rel_id'] );
|
||||
|
||||
window.frames[ 'iframeAttach_' + this.options['attach_rel_id'] ].document.getElementById('waitImg').style.display = 'inline-block';
|
||||
|
||||
Debug.write( ipb.vars['base_url'] + "app=core&module=attach§ion=attach&do=attachUploadiFrame&attach_rel_module=" +
|
||||
this.options['attach_rel_module'] + "&attach_rel_id=" + this.options['attach_rel_id'] + "&attach_post_key=" +
|
||||
this.options['attach_post_key'] + "&forum_id=" + this.options['forum_id'] + '&fetch_all=1' );
|
||||
iFrameForm.action = ipb.vars['base_url'] + "app=core&module=attach§ion=attach&do=attachUploadiFrame&attach_rel_module=" +
|
||||
this.options['attach_rel_module'] + "&attach_rel_id=" + this.options['attach_rel_id'] + "&attach_post_key=" +
|
||||
this.options['attach_post_key'] + "&forum_id=" + this.options['forum_id'] + '&fetch_all=1';
|
||||
@@ -504,6 +559,7 @@ _attach.prototype.attachSWF = Class.create({
|
||||
{
|
||||
method: 'get',
|
||||
evalJSON: 'force',
|
||||
hideLoader: true,
|
||||
onSuccess: function(t)
|
||||
{
|
||||
if( Object.isUndefined( t.responseJSON ) ){ alert( ipb.lang['action_failed'] ); return; }
|
||||
@@ -516,7 +572,7 @@ _attach.prototype.attachSWF = Class.create({
|
||||
});
|
||||
|
||||
this.obj.onmouseover = $('SWFUpload_0').focus();
|
||||
|
||||
$('SWFUpload_0').writeAttribute("tabindex", "-1");
|
||||
Debug.write( "ips.attach.js: (ID " + this.id + ") Created uploader");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user