From 2e132718f5d38eb0cdb23aaa0bc888a33c123d4e Mon Sep 17 00:00:00 2001 From: Juho Jaakkola Date: Thu, 18 Apr 2013 11:31:19 +0300 Subject: Fixes 5370: Uses correct container when adding files through embed. --- mod/embed/start.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'mod/embed/start.php') diff --git a/mod/embed/start.php b/mod/embed/start.php index e8a3f8c14..2ece9d2c4 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -39,10 +39,12 @@ function embed_longtext_menu($hook, $type, $items, $vars) { } $url = 'embed'; - if (elgg_get_page_owner_guid()) { - $url = 'embed?container_guid=' . elgg_get_page_owner_guid(); + + $page_owner = elgg_get_page_owner_entity(); + if (elgg_instanceof($page_owner, 'group') && $page_owner->isMember()) { + $url = 'embed?container_guid=' . $page_owner->getGUID(); } - + $items[] = ElggMenuItem::factory(array( 'name' => 'embed', 'href' => $url, @@ -95,7 +97,12 @@ function embed_page_handler($page) { $container_guid = (int)get_input('container_guid'); if ($container_guid) { - elgg_set_page_owner_guid($container_guid); + $container = get_entity($container_guid); + + if (elgg_instanceof($container, 'group') && $container->isMember()) { + // embedding inside a group so save file to group files + elgg_set_page_owner_guid($container_guid); + } } echo elgg_view('embed/layout'); -- cgit v1.2.3 From 67982d671a69ea6251793dfbba26a2845987c6ce Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 20 Apr 2013 13:01:05 -0400 Subject: adding embed css to admin css so it can be used in admin area --- mod/embed/start.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod/embed/start.php') diff --git a/mod/embed/start.php b/mod/embed/start.php index e8a3f8c14..8a55cc5bb 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -13,6 +13,7 @@ elgg_register_event_handler('init', 'system', 'embed_init'); */ function embed_init() { elgg_extend_view('css/elgg', 'embed/css'); + elgg_extend_view('css/admin', 'embed/css'); elgg_register_plugin_hook_handler('register', 'menu:longtext', 'embed_longtext_menu'); elgg_register_plugin_hook_handler('register', 'menu:embed', 'embed_select_tab', 1000); -- cgit v1.2.3 From feeac6824d6c61d98452432f252b6f66436d205b Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 20 Apr 2013 13:06:26 -0400 Subject: caching embed js for one less http request when loading many pages --- mod/embed/start.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mod/embed/start.php') diff --git a/mod/embed/start.php b/mod/embed/start.php index 8a55cc5bb..fb6b8ac84 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -21,7 +21,9 @@ function embed_init() { // Page handler for the modal media embed elgg_register_page_handler('embed', 'embed_page_handler'); - elgg_register_js('elgg.embed', 'js/embed/embed.js', 'footer'); + $embed_js = elgg_get_simplecache_url('js', 'embed/embed'); + elgg_register_simplecache_view('js/embed/embed'); + elgg_register_js('elgg.embed', $embed_js, 'footer'); } /** -- cgit v1.2.3 From f90dce8ad3cc15b008f0ce71ce9e93377be06a5b Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 31 May 2013 07:52:42 -0400 Subject: Fixes #5572 not including embed link in longtext menu for users who are logged out --- mod/embed/start.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod/embed/start.php') diff --git a/mod/embed/start.php b/mod/embed/start.php index e14e0efd4..1da35aa46 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -14,8 +14,10 @@ elgg_register_event_handler('init', 'system', 'embed_init'); function embed_init() { elgg_extend_view('css/elgg', 'embed/css'); elgg_extend_view('css/admin', 'embed/css'); - - elgg_register_plugin_hook_handler('register', 'menu:longtext', 'embed_longtext_menu'); + + if (elgg_is_logged_in()) { + elgg_register_plugin_hook_handler('register', 'menu:longtext', 'embed_longtext_menu'); + } elgg_register_plugin_hook_handler('register', 'menu:embed', 'embed_select_tab', 1000); // Page handler for the modal media embed -- cgit v1.2.3