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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
/**
* Files upload form for embed
*/
$access_id = get_default_access(get_loggedin_user());
if ($categories = elgg_view('categories', $vars)) {
$categories = "<p>$categories</p>";
}
// recycling the upload action so some of these options are a bit weird.
$form_body = '<p>' . elgg_view('input/file', array('internalname' => 'upload')) . '</p>';
$form_body .= '<p>' . elgg_echo('file:title') . ": " . elgg_view("input/text", array('internalname' => 'title')) . '</p>';
$form_body .= '<p>' . elgg_echo('file:desc') . ": " . elgg_view("input/text",array('internalname' => 'description')) . '</p>';
$form_body .= '<p>' . elgg_echo('file:tags') . ": " . elgg_view("input/tags", array('internalname' => 'tags')) . '</p>';
$form_body .= '<p>' . elgg_echo('access') . ": " . elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id)) . '</p>';
$form_body .= $categories;
$form_body .= elgg_view('input/hidden', array('internalname' => 'ajax', 'value' => TRUE));
$form_body .= '<p>' . elgg_view('input/submit', array('value' => elgg_echo('upload'))) . '</p>';
echo elgg_view('input/form', array(
'body' => $form_body,
'internalid' => 'file_embed_upload',
'action' => 'action/file/upload',
));
?>
<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>
|