aboutsummaryrefslogtreecommitdiff
path: root/mod/file/views
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-06 21:06:15 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-06 21:06:15 +0000
commit0e23ac4909bfa0971bd7253dcde80d6c174d05fc (patch)
treece9e8838a22e1e5325376265770cffd7133472a8 /mod/file/views
parentc5628aeb49123fcddeb8ce3f7bd315b3f7369530 (diff)
downloadelgg-0e23ac4909bfa0971bd7253dcde80d6c174d05fc.tar.gz
elgg-0e23ac4909bfa0971bd7253dcde80d6c174d05fc.tar.bz2
Added upload support to file embed.
git-svn-id: http://code.elgg.org/elgg/trunk@6646 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/views')
-rw-r--r--mod/file/views/default/file/embed_upload.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/mod/file/views/default/file/embed_upload.php b/mod/file/views/default/file/embed_upload.php
new file mode 100644
index 000000000..0460eb481
--- /dev/null
+++ b/mod/file/views/default/file/embed_upload.php
@@ -0,0 +1,49 @@
+<?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>';
+$form_body .= '</div>';
+
+echo elgg_view('input/form', array(
+ 'body' => $form_body,
+ 'internalid' => 'file_embed_upload',
+ 'action' => $vars['url'] . '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 $vars['url'] . 'pg/embed/embed'; ?>?active_section=file');
+ } else {
+ $('.popup .content').find('form').prepend('<p>' + info.message + '</p>');
+ }
+ }
+ };
+ $(this).ajaxSubmit(options);
+ return false;
+ });
+});
+</script>