diff options
author | Sem <sembrestels@riseup.net> | 2014-01-22 03:37:52 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2014-01-22 03:37:52 +0100 |
commit | 4a2ed114bb18c5363f594a380676c5654f4165a4 (patch) | |
tree | 3a37094b249c40e3e6bf122691db53115f65f8f0 /mod/embed | |
parent | 673932bc46a3918293a28c2c2fc622b3e5ff6bde (diff) | |
parent | 0dd36c458d41e77521c36ae572fe73114ad4bc5a (diff) | |
download | elgg-4a2ed114bb18c5363f594a380676c5654f4165a4.tar.gz elgg-4a2ed114bb18c5363f594a380676c5654f4165a4.tar.bz2 |
Merge tag '1.8.18' of git://github.com/Elgg/Elgg into develop
1.8.18
Conflicts:
mod/tinymce/vendor/tinymce/jscripts/tiny_mce/langs/en.js
mod/tinymce/vendor/tinymce/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js
Diffstat (limited to 'mod/embed')
-rw-r--r-- | mod/embed/start.php | 26 | ||||
-rw-r--r-- | mod/embed/views/default/js/embed/embed.php | 13 |
2 files changed, 32 insertions, 7 deletions
diff --git a/mod/embed/start.php b/mod/embed/start.php index e8a3f8c14..1da35aa46 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -13,14 +13,19 @@ elgg_register_event_handler('init', 'system', 'embed_init'); */ function embed_init() { elgg_extend_view('css/elgg', 'embed/css'); - - elgg_register_plugin_hook_handler('register', 'menu:longtext', 'embed_longtext_menu'); + elgg_extend_view('css/admin', 'embed/css'); + + 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 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'); } /** @@ -39,10 +44,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 +102,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'); diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index eb6153abf..e84427f24 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -1,3 +1,4 @@ +//<script> elgg.provide('elgg.embed'); elgg.embed.init = function() { @@ -90,6 +91,18 @@ elgg.embed.submit = function(event) { $('.embed-wrapper .elgg-form-file-upload').show(); } } + + // ie 7 and 8 have a null response because of the use of an iFrame + // so just show the list after upload. + // http://jquery.malsup.com/form/#file-upload claims you can wrap JSON + // in a textarea, but a quick test didn't work, and that is fairly + // intrusive to the rest of the ajax system. + else if (response === undefined && $.browser.msie) { + var forward = $('input[name=embed_forward]').val(); + var url = elgg.normalize_url('embed/tab/' + forward); + url = elgg.embed.addContainerGUID(url); + $('.embed-wrapper').parent().load(url); + } }, error : function(xhr, status) { // @todo nothing for now |