From d631164572a0d4da18a3c9d98638c884329fdd31 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 19 Jun 2011 13:35:15 -0400 Subject: need a default container for files if form included from outside file plugin (like the embed plugin) --- mod/file/views/default/forms/file/upload.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mod/file/views/default/forms') diff --git a/mod/file/views/default/forms/file/upload.php b/mod/file/views/default/forms/file/upload.php index 001e66674..aadc449fd 100644 --- a/mod/file/views/default/forms/file/upload.php +++ b/mod/file/views/default/forms/file/upload.php @@ -11,6 +11,9 @@ $desc = elgg_extract('description', $vars, ''); $tags = elgg_extract('tags', $vars, ''); $access_id = elgg_extract('access_id', $vars, ACCESS_DEFAULT); $container_guid = elgg_extract('container_guid', $vars); +if (!$container_guid) { + $container_guid = elgg_get_logged_in_user_guid(); +} $guid = elgg_extract('guid', $vars, null); $ajax = elgg_extract('ajax', $vars, FALSE); -- cgit v1.2.3 From 0afdb10ff1d079e623685a91c59bac4802aa0069 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 19 Jun 2011 15:02:57 -0400 Subject: removed the special ajax/embed code from the file plugin --- mod/file/actions/file/upload.php | 53 ++++++---------------------- mod/file/views/default/file/embed_upload.php | 8 ----- mod/file/views/default/forms/file/upload.php | 6 ---- 3 files changed, 10 insertions(+), 57 deletions(-) delete mode 100644 mod/file/views/default/file/embed_upload.php (limited to 'mod/file/views/default/forms') diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 5d5c28bee..b17fb6298 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -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 index e5076b052..000000000 --- a/mod/file/views/default/file/embed_upload.php +++ /dev/null @@ -1,8 +0,0 @@ - 'file_embed_upload'), array('ajax' => TRUE)); - - diff --git a/mod/file/views/default/forms/file/upload.php b/mod/file/views/default/forms/file/upload.php index aadc449fd..da764c3d8 100644 --- a/mod/file/views/default/forms/file/upload.php +++ b/mod/file/views/default/forms/file/upload.php @@ -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)); } -- cgit v1.2.3 From 79075fb578b1ba9834594c867530be43bc886101 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 19 Jun 2011 20:18:03 -0400 Subject: we "upload" new files and "save" old ones --- mod/file/views/default/forms/file/upload.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mod/file/views/default/forms') diff --git a/mod/file/views/default/forms/file/upload.php b/mod/file/views/default/forms/file/upload.php index 001e66674..b8a7a1668 100644 --- a/mod/file/views/default/forms/file/upload.php +++ b/mod/file/views/default/forms/file/upload.php @@ -16,8 +16,10 @@ $ajax = elgg_extract('ajax', $vars, FALSE); if ($guid) { $file_label = elgg_echo("file:replace"); + $submit_label = elgg_echo('save'); } else { $file_label = elgg_echo("file:file"); + $submit_label = elgg_echo('upload'); } ?> @@ -63,7 +65,7 @@ if ($guid) { echo elgg_view('input/hidden', array('name' => 'file_guid', 'value' => $guid)); } -echo elgg_view('input/submit', array('value' => elgg_echo("save"))); +echo elgg_view('input/submit', array('value' => $submit_label)); ?> -- cgit v1.2.3 From e35b3ffb512dc6b1af2aacb7bd92d85854a42868 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 28 Jun 2011 06:38:34 -0400 Subject: Fixes #3407 added elgg-foot to plugin forms --- mod/bookmarks/views/default/forms/bookmarks/save.php | 2 +- .../views/default/forms/developers/settings.php | 2 +- mod/externalpages/views/default/forms/expages/edit.php | 3 ++- mod/file/views/default/forms/file/upload.php | 2 +- mod/groups/views/default/forms/discussion/reply/save.php | 16 ++++++++++------ mod/groups/views/default/forms/discussion/save.php | 2 +- .../views/default/forms/invitefriends/invite.php | 2 +- mod/messages/views/default/forms/messages/process.php | 2 +- mod/messages/views/default/forms/messages/reply.php | 2 +- mod/messages/views/default/forms/messages/send.php | 2 +- .../default/forms/notificationsettings/groupsave.php | 2 +- mod/pages/views/default/forms/pages/edit.php | 2 +- .../views/default/forms/reportedcontent/add.php | 2 +- mod/thewire/views/default/forms/thewire/add.php | 2 +- 14 files changed, 24 insertions(+), 19 deletions(-) (limited to 'mod/file/views/default/forms') diff --git a/mod/bookmarks/views/default/forms/bookmarks/save.php b/mod/bookmarks/views/default/forms/bookmarks/save.php index 886283202..7d064a55b 100644 --- a/mod/bookmarks/views/default/forms/bookmarks/save.php +++ b/mod/bookmarks/views/default/forms/bookmarks/save.php @@ -44,7 +44,7 @@ if ($categories) {
'access_id', 'value' => $access_id)); ?> -
+
'container_guid', 'value' => $container_guid)); diff --git a/mod/developers/views/default/forms/developers/settings.php b/mod/developers/views/default/forms/developers/settings.php index a442ca0ce..584f6af30 100644 --- a/mod/developers/views/default/forms/developers/settings.php +++ b/mod/developers/views/default/forms/developers/settings.php @@ -29,6 +29,6 @@ foreach ($vars['data'] as $name => $info) { echo '
'; } -echo '
'; +echo '
'; echo elgg_view('input/submit', array('value' => elgg_echo('save'))); echo '
'; diff --git a/mod/externalpages/views/default/forms/expages/edit.php b/mod/externalpages/views/default/forms/expages/edit.php index b0060477e..ca83ea7df 100644 --- a/mod/externalpages/views/default/forms/expages/edit.php +++ b/mod/externalpages/views/default/forms/expages/edit.php @@ -49,9 +49,10 @@ echo <<$external_page_title $input_area
+
$hidden_value $hidden_type $submit_input - +
EOT; diff --git a/mod/file/views/default/forms/file/upload.php b/mod/file/views/default/forms/file/upload.php index 98b7d9f05..f637a419e 100644 --- a/mod/file/views/default/forms/file/upload.php +++ b/mod/file/views/default/forms/file/upload.php @@ -53,7 +53,7 @@ if ($categories) {
'access_id', 'value' => $access_id)); ?>
-
+
'container_guid', 'value' => $container_guid)); diff --git a/mod/groups/views/default/forms/discussion/reply/save.php b/mod/groups/views/default/forms/discussion/reply/save.php index be258b8fe..40ea07303 100644 --- a/mod/groups/views/default/forms/discussion/reply/save.php +++ b/mod/groups/views/default/forms/discussion/reply/save.php @@ -1,6 +1,6 @@ 'entity_guid', + 'value' => $vars['entity']->getGUID(), + )); + $inline = elgg_extract('inline', $vars, false); if ($inline) { echo elgg_view('input/text', array('name' => 'group_topic_post')); echo elgg_view('input/submit', array('value' => elgg_echo('reply'))); @@ -19,11 +23,11 @@ if (isset($vars['entity']) && elgg_is_logged_in()) { 'group_topic_post')); ?>
+
elgg_echo('reply'))); +?> +
+ 'entity_guid', - 'value' => $vars['entity']->getGUID(), - )); } diff --git a/mod/groups/views/default/forms/discussion/save.php b/mod/groups/views/default/forms/discussion/save.php index 5d50d5c91..a6582ede7 100644 --- a/mod/groups/views/default/forms/discussion/save.php +++ b/mod/groups/views/default/forms/discussion/save.php @@ -42,7 +42,7 @@ $guid = elgg_extract('guid', $vars, null);
'access_id', 'value' => $access_id)); ?>
-
+
'container_guid', 'value' => $container_guid)); diff --git a/mod/invitefriends/views/default/forms/invitefriends/invite.php b/mod/invitefriends/views/default/forms/invitefriends/invite.php index 5af8b5da0..0d7f5d9f2 100644 --- a/mod/invitefriends/views/default/forms/invitefriends/invite.php +++ b/mod/invitefriends/views/default/forms/invitefriends/invite.php @@ -27,7 +27,7 @@ if (elgg_get_config('allow_registration')) {
HTML; - echo '
'; + echo '
'; echo elgg_view('input/submit', array('value' => elgg_echo('send'))); echo '
'; } else { diff --git a/mod/messages/views/default/forms/messages/process.php b/mod/messages/views/default/forms/messages/process.php index 01fe0f431..7e182b8f0 100644 --- a/mod/messages/views/default/forms/messages/process.php +++ b/mod/messages/views/default/forms/messages/process.php @@ -17,7 +17,7 @@ echo '
'; echo $messages; echo '
'; -echo '
'; +echo '
'; echo elgg_view('input/submit', array( 'value' => elgg_echo('delete'), 'name' => 'delete', diff --git a/mod/messages/views/default/forms/messages/reply.php b/mod/messages/views/default/forms/messages/reply.php index e8a27f03e..9f3f4b57e 100644 --- a/mod/messages/views/default/forms/messages/reply.php +++ b/mod/messages/views/default/forms/messages/reply.php @@ -33,6 +33,6 @@ echo elgg_view('input/hidden', array( )); ?>
-
+
elgg_echo('messages:send'))); ?>
\ No newline at end of file diff --git a/mod/messages/views/default/forms/messages/send.php b/mod/messages/views/default/forms/messages/send.php index c0a095993..b0638e0c0 100644 --- a/mod/messages/views/default/forms/messages/send.php +++ b/mod/messages/views/default/forms/messages/send.php @@ -49,6 +49,6 @@ $recipient_drop_down = elgg_view('input/dropdown', array( )); ?>
-
+
elgg_echo('messages:send'))); ?>
diff --git a/mod/notifications/views/default/forms/notificationsettings/groupsave.php b/mod/notifications/views/default/forms/notificationsettings/groupsave.php index 2bf0d9628..61b94ff8b 100644 --- a/mod/notifications/views/default/forms/notificationsettings/groupsave.php +++ b/mod/notifications/views/default/forms/notificationsettings/groupsave.php @@ -96,7 +96,7 @@ END; '; + echo '
'; echo elgg_view('input/submit', array('value' => elgg_echo('save'))); echo '
'; diff --git a/mod/pages/views/default/forms/pages/edit.php b/mod/pages/views/default/forms/pages/edit.php index 5186da11c..c29de1085 100644 --- a/mod/pages/views/default/forms/pages/edit.php +++ b/mod/pages/views/default/forms/pages/edit.php @@ -30,7 +30,7 @@ if (!empty($cats)) { } -echo '
'; +echo '
'; if ($vars['guid']) { echo elgg_view('input/hidden', array( 'name' => 'page_guid', diff --git a/mod/reportedcontent/views/default/forms/reportedcontent/add.php b/mod/reportedcontent/views/default/forms/reportedcontent/add.php index 0b1716a35..f9986849d 100644 --- a/mod/reportedcontent/views/default/forms/reportedcontent/add.php +++ b/mod/reportedcontent/views/default/forms/reportedcontent/add.php @@ -48,7 +48,7 @@ $owner = elgg_get_logged_in_user_entity(); )); ?>
-
+
elgg_echo('reportedcontent:report'), diff --git a/mod/thewire/views/default/forms/thewire/add.php b/mod/thewire/views/default/forms/thewire/add.php index 67585b0df..743294dcc 100644 --- a/mod/thewire/views/default/forms/thewire/add.php +++ b/mod/thewire/views/default/forms/thewire/add.php @@ -25,7 +25,7 @@ if ($post) {
140
-
+