includes/clientside/static/upload.js
author Dan Fuhry <dan@enanocms.org>
Thu, 28 Oct 2010 03:05:31 -0400
changeset 1308 f9bee9b125ee
parent 1295 3c9c1b18567b
permissions -rw-r--r--
Parser updates. Added the "styled" keyword to wikitables to allow them to be styled using the current theme's standard table skinning, and changes to how the image tag parser decides how to display an image (framed, inline or raw).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1295
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     1
window.AjaxUpload = function(formid)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     2
{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     3
	load_component(['jquery', 'jquery-ui', 'l10n']);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     4
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     5
	var theform = document.getElementById(formid);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     6
	theform.AjaxUpload = this;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     7
	this.form = theform;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     8
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     9
	$(this.form).submit(function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    10
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    11
			return this.AjaxUpload.presubmit();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    12
		});
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    13
};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    14
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    15
window.zeropad = function(i, ndig)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    16
{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    17
	var s = String(i);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    18
	while ( s.length < ndig )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    19
		s = '0' + s;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    20
	return s;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    21
}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    22
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    23
window.humanize_time = function(secs)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    24
{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    25
	var seconds = secs % 60;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    26
	var minutes = (secs - seconds) / 60;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    27
	if ( minutes >= 60 )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    28
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    29
		var hours = (minutes - (minutes % 60)) / 60;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    30
		minutes = minutes % 60;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    31
		return zeropad(hours, 2) + ':' + zeropad(minutes, 2) + ':' + zeropad(seconds, 2);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    32
	}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    33
	return zeropad(minutes, 2) + ':' + zeropad(seconds, 2);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    34
}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    35
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    36
AjaxUpload.prototype.cancelbit = false;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    37
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    38
AjaxUpload.prototype.status = function(state)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    39
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    40
		if ( state.done )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    41
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    42
			$('div.wait-box', this.statusbox).text($lang.get('upload_msg_processing'));
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    43
			$('div.progress', this.statusbox).progressbar('value', 100);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    44
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    45
		else if ( state.cancel_upload )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    46
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    47
			if ( window.stop )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    48
				window.stop();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    49
			else if ( document.execCommand )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    50
				document.execCommand('Stop');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    51
			$('div.wait-box', this.statusbox).addClass('error-box').removeClass('wait-box').text($lang.get('upload_msg_cancelled'));
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    52
			
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    53
			$('div.progress', this.statusbox).progressbar('value', 100).addClass('ui-progressbar-failure');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    54
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    55
		else
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    56
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    57
			var rawpct = state.bytes_processed / state.content_length;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    58
			var pct = (Math.round((rawpct) * 1000)) / 10;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    59
			var elapsed = state.current_time - state.start_time;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    60
			var rawbps = state.bytes_processed / elapsed;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    61
			var kbps = Math.round((rawbps) / 1024);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    62
			var remain_bytes = state.content_length - state.bytes_processed;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    63
			var remain_time = Math.round(remain_bytes / rawbps);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    64
			if ( pct > 0 )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    65
			$('div.wait-box', this.statusbox).text($lang.get('upload_msg_uploading', {
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    66
								percent: pct,
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    67
								elapsed: humanize_time(elapsed),
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    68
								speed: kbps,
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    69
								remain: humanize_time(remain_time)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    70
							}))
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    71
					.append('<br /><a href="#" class="cancel"></a>');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    72
			else
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    73
				$('div.wait-box', this.statusbox).text($lang.get('upload_msg_starting'))
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    74
					.append('<br /><a href="#" class="cancel"></a>');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    75
			
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    76
			var au = this;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    77
			$('a.cancel', this.statusbox).text($lang.get('upload_btn_cancel')).click(function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    78
				{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    79
					au.cancel();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    80
					return false;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    81
				});
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    82
				
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    83
			$('div.progress', this.statusbox).progressbar('value', pct);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    84
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    85
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    86
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    87
AjaxUpload.prototype.cancel = function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    88
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    89
		this.cancelbit = true;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    90
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    91
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    92
AjaxUpload.prototype.refresh_status = function(au)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    93
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    94
		try
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    95
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    96
			var cancelbit = au.cancelbit ? '&cancel=true' : '';
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    97
			au.cancelbit = false;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    98
			ajaxGet(makeUrlNS('Special', 'AjaxUpload', 'form=' + au.form.id + '&uploadstatus=' + au.key + cancelbit), au._incoming_status);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    99
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   100
		catch (e)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   101
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   102
			alert(e);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   103
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   104
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   105
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   106
AjaxUpload.prototype._incoming_status = function(ajax)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   107
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   108
		if ( ajax.readyState == 4 )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   109
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   110
			var state = parseJSON(ajax.responseText);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   111
			if ( state )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   112
			{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   113
				var au = document.getElementById(state.form).AjaxUpload;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   114
				au.status(state);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   115
				
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   116
				if ( !state.done && !state.cancel_upload )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   117
					setTimeout(function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   118
						{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   119
							au.refresh_status(au)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   120
						}, 250);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   121
			}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   122
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   123
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   124
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   125
AjaxUpload.prototype.presubmit = function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   126
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   127
		try
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   128
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   129
			// create status container and target iframe
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   130
			this.statusbox = document.createElement('div');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   131
			this.iframe = document.createElement('iframe');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   132
			this.iframe.AjaxUpload = this;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   133
			$(this.iframe)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   134
				.attr('src', 'about:blank')
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   135
				.attr('width', '1')
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   136
				.attr('height', '1')
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   137
				.attr('frameborder', '0')
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   138
				.css('visibility', 'hidden')
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   139
				.attr('name', this.form.id + '_frame')
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   140
				.load(this._frame_onload);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   141
				
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   142
			this.form.parentNode.insertBefore(this.statusbox, this.form);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   143
			this.form.parentNode.insertBefore(this.iframe, this.form);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   144
			this.form.target = this.form.id + '_frame';
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   145
			
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   146
			this.upload_start();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   147
			
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   148
			var have_progress_support = this.form.progress_support.value == 'true';
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   149
			if ( have_progress_support )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   150
			{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   151
				this.key = this.form[this.form.upload_progress_name.value].value;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   152
				this.refresh_status(this);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   153
			}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   154
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   155
		catch ( e )
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   156
		{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   157
			console.debug(e);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   158
			return false;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   159
		}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   160
		
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   161
		return true;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   162
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   163
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   164
AjaxUpload.prototype._frame_onload = function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   165
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   166
		var childbody = window[this.AjaxUpload.form.id + '_frame'].document.getElementsByTagName('body')[0];
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   167
		window[this.AjaxUpload.form.id + '_frame'].document.close();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   168
		this.AjaxUpload.upload_success(childbody);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   169
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   170
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   171
AjaxUpload.prototype.upload_start = function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   172
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   173
		$(this.statusbox).html('<div class="wait-box">' + $lang.get('upload_msg_starting') + '</div><div class="progress" style="margin-top: 10px;"></div>');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   174
		$('div.progress', this.statusbox).progressbar({ value: 0 });
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   175
		$(this.form).hide();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   176
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   177
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   178
AjaxUpload.prototype.upload_success = function(childbody)
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   179
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   180
		$(this.statusbox).html('<div class="info-box">Upload complete! Result from server:' + childbody.innerHTML + '</div>');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   181
		$('div.info-box', this.statusbox).append('<a href="#">Reset!</a>');
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   182
		var form_id = this.form.id;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   183
		$('div.info-box a', this.statusbox).click(function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   184
			{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   185
				try
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   186
				{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   187
					var au = document.getElementById(form_id).AjaxUpload;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   188
					au.reset();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   189
				}
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   190
				catch(e) {};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   191
				return false;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   192
			});
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   193
	};
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   194
	
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   195
AjaxUpload.prototype.reset = function()
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   196
	{
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   197
		this.iframe.parentNode.removeChild(this.iframe);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   198
		this.statusbox.parentNode.removeChild(this.statusbox);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   199
		delete(window[this.form.id + '_frame']);
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   200
		$('form#' + this.form.id).show();
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   201
		return false;
3c9c1b18567b Added an API for AJAX file uploads and the monitoring thereof. This is to be used in Snapr and soon core (Special:UploadFile).
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   202
	};