witten
/
luminotes
Archived
1
0
Fork 0

Removed Wiki.js.Upload_pulldown.shutdown() "force" flag as it's redundant if this.uploading is set accordingly.

Make IE 6 and 7 actually stop uploading a file when the cancel button is clicked.
Ignoring blank filename renames.
This commit is contained in:
Dan Helfman 2008-02-25 21:56:33 +00:00
parent fb7655707e
commit 092f3ff9c6
2 changed files with 18 additions and 9 deletions

View File

@ -2344,7 +2344,7 @@ Upload_pulldown.prototype.upload_complete = function () {
this.link.href = "/files/download?file_id=" + this.file_id this.link.href = "/files/download?file_id=" + this.file_id
new File_link_pulldown( this.wiki, this.notebook_id, this.invoker, this.editor, this.link ); new File_link_pulldown( this.wiki, this.notebook_id, this.invoker, this.editor, this.link );
this.shutdown( true ); this.shutdown();
} }
Upload_pulldown.prototype.update_position = function ( anchor, relative_to ) { Upload_pulldown.prototype.update_position = function ( anchor, relative_to ) {
@ -2352,28 +2352,37 @@ Upload_pulldown.prototype.update_position = function ( anchor, relative_to ) {
} }
Upload_pulldown.prototype.cancel_due_to_click = function () { Upload_pulldown.prototype.cancel_due_to_click = function () {
this.uploading = false;
this.wiki.display_message( "The file upload has been cancelled." ) this.wiki.display_message( "The file upload has been cancelled." )
this.shutdown( true ); this.shutdown();
} }
Upload_pulldown.prototype.cancel_due_to_quota = function () { Upload_pulldown.prototype.cancel_due_to_quota = function () {
this.uploading = false;
this.shutdown();
this.wiki.display_error( this.wiki.display_error(
"That file is too large for your available storage space. Before uploading, please delete some notes or files, empty the trash, or", "That file is too large for your available storage space. Before uploading, please delete some notes or files, empty the trash, or",
[ createDOM( "a", { "href": "/upgrade" }, "upgrade" ), " your account." ] [ createDOM( "a", { "href": "/upgrade" }, "upgrade" ), " your account." ]
); );
this.shutdown( true );
} }
Upload_pulldown.prototype.cancel_due_to_error = function ( message ) { Upload_pulldown.prototype.cancel_due_to_error = function ( message ) {
this.uploading = false;
this.wiki.display_error( message ) this.wiki.display_error( message )
this.shutdown( true ); this.shutdown();
} }
Upload_pulldown.prototype.shutdown = function ( force ) { Upload_pulldown.prototype.shutdown = function () {
if ( this.uploading && !force ) if ( this.uploading )
return; return;
// in Internet Explorer, the upload won't actually cancel without an explicit Stop command
if ( !this.iframe.contentDocument && this.iframe.contentWindow ) {
this.iframe.contentWindow.document.execCommand( 'Stop' );
this.progress_iframe.contentWindow.document.execCommand( 'Stop' );
}
Pulldown.prototype.shutdown.call( this ); Pulldown.prototype.shutdown.call( this );
if ( this.link ) if ( this.link )
this.link.pulldown = null; this.link.pulldown = null;
@ -2450,7 +2459,7 @@ File_link_pulldown.prototype.filename_field_focused = function ( event ) {
File_link_pulldown.prototype.filename_field_changed = function ( event ) { File_link_pulldown.prototype.filename_field_changed = function ( event ) {
// if the filename is actually unchanged, then bail // if the filename is actually unchanged, then bail
var filename = strip( this.filename_field.value ); var filename = strip( this.filename_field.value );
if ( filename == this.previous_filename ) if ( filename == "" || filename == this.previous_filename )
return; return;
var title = link_title( this.link ); var title = link_title( this.link );

View File

@ -35,7 +35,7 @@ def stream_progress( uploading_file, filename, fraction_reported ):
%s %s
</div></td> </div></td>
<td></td> <td></td>
<td><span id="status"></span></td> <td><span id="status">0%%</span></td>
<td></td> <td></td>
<td><input type="submit" id="cancel_button" class="button" value="cancel" onclick="withDocument( window.parent.document, function () { getElement( 'upload_frame' ).pulldown.cancel_due_to_click(); } );" /></td> <td><input type="submit" id="cancel_button" class="button" value="cancel" onclick="withDocument( window.parent.document, function () { getElement( 'upload_frame' ).pulldown.cancel_due_to_click(); } );" /></td>
</tr></table> </tr></table>