]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
removed the special ajax/embed code from the file plugin
authorcash <cash.costello@gmail.com>
Sun, 19 Jun 2011 19:02:57 +0000 (15:02 -0400)
committercash <cash.costello@gmail.com>
Sun, 19 Jun 2011 19:02:57 +0000 (15:02 -0400)
mod/file/actions/file/upload.php
mod/file/views/default/file/embed_upload.php [deleted file]
mod/file/views/default/forms/file/upload.php

index 5d5c28bee53d2c0000d061b072ea6c63dea7b8d8..b17fb629882d572b5e377b2c8ec0b16f2414435c 100644 (file)
@@ -13,8 +13,6 @@ $container_guid = (int) get_input('container_guid', 0);
 $guid = (int) get_input('file_guid');
 $tags = get_input("tags");
 
-$ajax = get_input('ajax', FALSE);
-
 if ($container_guid == 0) {
        $container_guid = elgg_get_logged_in_user_guid();
 }
@@ -33,17 +31,8 @@ if ($new_file) {
        if (empty($_FILES['upload']['name'])) {
 
                $error = elgg_echo('file:nofile');
-
-               if ($ajax) {
-                       echo json_encode(array(
-                               'status' => 'error',
-                               'message' => $error
-                       ));
-                       exit;
-               } else {
-                       register_error($error);
-                       forward(REFERER);
-               }
+               register_error($error);
+               forward(REFERER);
        }
 
        $file = new FilePluginFile();
@@ -158,44 +147,22 @@ elgg_clear_sticky_form('file');
 
 
 // handle results differently for new files and file updates
-// ajax is only for new files from embed right now.
 if ($new_file) {
        if ($guid) {
                $message = elgg_echo("file:saved");
-               if ($ajax) {
-                       echo json_encode(array(
-                               'status' => 'success',
-                               'message' => $message
-                       ));
-                       exit;
-
-               } else {
-                       system_message($message);
-                       add_to_river('river/object/file/create', 'create', elgg_get_logged_in_user_guid(), $file->guid);
-               }
+               system_message($message);
+               add_to_river('river/object/file/create', 'create', elgg_get_logged_in_user_guid(), $file->guid);
        } else {
                // failed to save file object - nothing we can do about this
                $error = elgg_echo("file:uploadfailed");
-
-               if ($ajax) {
-                       echo json_encode(array(
-                               'status' => 'error',
-                               'message' => $error
-                       ));
-                       exit;
-
-               } else {
-                       register_error($error);
-               }
+               register_error($error);
        }
 
-       if (!$ajax) {
-               $container = get_entity($container_guid);
-               if (elgg_instanceof($container, 'group')) {
-                       forward("file/group/$container->guid/all");
-               } else {
-                       forward("file/owner/$container->username");
-               }
+       $container = get_entity($container_guid);
+       if (elgg_instanceof($container, 'group')) {
+               forward("file/group/$container->guid/all");
+       } else {
+               forward("file/owner/$container->username");
        }
 
 } else {
diff --git a/mod/file/views/default/file/embed_upload.php b/mod/file/views/default/file/embed_upload.php
deleted file mode 100644 (file)
index e5076b0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/**
- * Files upload form for embed
- */
-
-echo elgg_view_form('file/upload', array('id' => 'file_embed_upload'), array('ajax' => TRUE));
-
-
index aadc449fdddc45c4582133c76e7dc89873d5a378..da764c3d8fcd38b85908e6f4814afafeb752c00a 100644 (file)
@@ -15,7 +15,6 @@ if (!$container_guid) {
        $container_guid = elgg_get_logged_in_user_guid();
 }
 $guid = elgg_extract('guid', $vars, null);
-$ajax = elgg_extract('ajax', $vars, FALSE);
 
 if ($guid) {
        $file_label = elgg_echo("file:replace");
@@ -57,11 +56,6 @@ if ($categories) {
 
 echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid));
 
-//@todo this should not be necessary in 1.8... -- ajax actions can be auto-detected
-if ($ajax) {
-       echo elgg_view('input/hidden', array('name' => 'ajax', 'value' => 1));
-}
-
 if ($guid) {
        echo elgg_view('input/hidden', array('name' => 'file_guid', 'value' => $guid));
 }