aboutsummaryrefslogtreecommitdiff
path: root/mod/file/views/default/file/embed_upload.php
blob: a5cf7ee5969c75de33baf394b6c3e0e25d21cd15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
 * Files upload form for embed
 */

echo elgg_view_form('file/upload', array('internalid' => 'file_embed_upload'), array('ajax' => TRUE));

?>

<?php //@todo JS 1.8: no ?>
<script type="text/javascript">
$(document).ready(function() {
	// fire off the ajax upload
	$('#file_embed_upload').submit(function() {
		var options = {
			success: function(data) {
				var info = jQuery.parseJSON(data);

				if (info.status == 'success') {
					$('.popup .content').load('<?php echo elgg_get_site_url() . 'pg/embed/embed'; ?>?active_section=file');
				} else {
					$('.popup .content').find('form').prepend('<p>' + info.message + '</p>');
				}
			}
		};
		$(this).ajaxSubmit(options);
		return false;
	});
});
</script>