From 2ab13017f36a7e6c667e9c9006f24c06fb11a1d6 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 17 Dec 2011 08:18:24 -0500 Subject: embed can now be activated without the file plugin as other plugins can provide content --- mod/embed/manifest.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mod/embed') diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml index 7ffbc23a4..46ab2df9e 100644 --- a/mod/embed/manifest.xml +++ b/mod/embed/manifest.xml @@ -13,9 +13,10 @@ elgg_release 1.8 - + plugin file - + 1.8.1 + true -- cgit v1.2.3 From c97e17eba9a5bd2272c27b15c18580c964a57f9d Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 17 Dec 2011 08:30:44 -0500 Subject: Refs #3971 inserting medium size thumbnails rather than small --- mod/embed/views/default/js/embed/embed.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mod/embed') diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index 8a8f0290c..54b9c391d 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -35,7 +35,12 @@ elgg.embed.insert = function(event) { // generalize this based on a css class attached to what should be inserted var content = ' ' + $(this).find(".embed-insert").parent().html() + ' '; - + + // this is a temporary work-around for #3971 + if (content.indexOf('thumbnail.php') != -1) { + content = content.replace('size=small', 'size=medium'); + } + textArea.val(textArea.val() + content); textArea.focus(); -- cgit v1.2.3 From 3d8ca76d4b8b9e69a92f5f5b034609b410c9ee8c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 17 Dec 2011 10:37:25 -0500 Subject: Fixes #4086 handling containers for embed uploading --- mod/embed/start.php | 26 +++++++++++++++++----- mod/embed/views/default/embed/layout.php | 7 ++++++ mod/embed/views/default/js/embed/embed.php | 25 ++++++++++++++++++++- .../views/default/embed/file_upload/content.php | 3 ++- 4 files changed, 53 insertions(+), 8 deletions(-) (limited to 'mod/embed') diff --git a/mod/embed/start.php b/mod/embed/start.php index 015c0c0e4..940219476 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -37,10 +37,15 @@ function embed_longtext_menu($hook, $type, $items, $vars) { if (elgg_get_context() == 'embed') { return $items; } + + $url = 'embed'; + if (elgg_get_page_owner_guid()) { + $url = 'embed?container_guid=' . elgg_get_page_owner_guid(); + } $items[] = ElggMenuItem::factory(array( 'name' => 'embed', - 'href' => "embed", + 'href' => $url, 'text' => elgg_echo('embed:media'), 'rel' => 'lightbox', 'link_class' => "elgg-longtext-control elgg-lightbox embed-control embed-control-{$vars['id']}", @@ -64,7 +69,9 @@ function embed_longtext_menu($hook, $type, $items, $vars) { */ function embed_select_tab($hook, $type, $items, $vars) { - $tab_name = array_pop(explode('/', full_url())); + // can this ba called from page handler instead? + $page = get_input('page'); + $tab_name = array_pop(explode('/', $page)); foreach ($items as $item) { if ($item->getName() == $tab_name) { $item->setSelected(); @@ -85,6 +92,11 @@ function embed_select_tab($hook, $type, $items, $vars) { */ function embed_page_handler($page) { + $container_guid = (int)get_input('container_guid'); + if ($container_guid) { + elgg_set_page_owner_guid($container_guid); + } + echo elgg_view('embed/layout'); // exit because this is in a modal display. @@ -120,15 +132,17 @@ function embed_list_items($entities, $vars = array()) { */ function embed_get_list_options($options = array()) { + $container_guids = array(elgg_get_logged_in_user_guid()); if (elgg_get_page_owner_guid()) { - $container_guid = elgg_get_page_owner_guid(); - } else { - $container_guid = elgg_get_logged_in_user_guid(); + $page_owner_guid = elgg_get_page_owner_guid(); + if ($page_owner_guid != elgg_get_logged_in_user_guid()) { + $container_guids[] = $page_owner_guid; + } } $defaults = array( 'limit' => 6, - 'container_guid' => $container_guid, + 'container_guids' => $container_guids, 'item_class' => 'embed-item', ); diff --git a/mod/embed/views/default/embed/layout.php b/mod/embed/views/default/embed/layout.php index c1e43f13c..e906160b1 100644 --- a/mod/embed/views/default/embed/layout.php +++ b/mod/embed/views/default/embed/layout.php @@ -21,10 +21,17 @@ if ($selected->getData('view')) { } } + +$container_info = elgg_view('input/hidden', array( + 'name' => 'embed_container_guid', + 'value' => elgg_get_page_owner_guid(), +)); + echo << $title $menu $tab + $container_info HTML; diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index 54b9c391d..5fd534a09 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -80,9 +80,13 @@ elgg.embed.submit = function(event) { if (response.status >= 0) { 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) { + // nothing for now } }); @@ -98,8 +102,27 @@ elgg.embed.submit = function(event) { * @return void */ elgg.embed.forward = function(event) { - $('.embed-wrapper').parent().load($(this).attr('href')); + // make sure container guid is passed + var url = $(this).attr('href'); + url = elgg.embed.addContainerGUID(url); + + $('.embed-wrapper').parent().load(url); event.preventDefault(); }; +/** + * Adds the container guid to a URL + * + * @param {string} url + * @return string + */ +elgg.embed.addContainerGUID = function(url) { + if (url.indexOf('container_guid=') == -1) { + var guid = $('input[name=embed_container_guid]').val(); + return url + '?container_guid=' + guid; + } else { + return url; + } +}; + elgg.register_hook_handler('init', 'system', elgg.embed.init); diff --git a/mod/file/views/default/embed/file_upload/content.php b/mod/file/views/default/embed/file_upload/content.php index 4d3db0d97..8b630c828 100644 --- a/mod/file/views/default/embed/file_upload/content.php +++ b/mod/file/views/default/embed/file_upload/content.php @@ -7,7 +7,8 @@ $form_vars = array( 'enctype' => 'multipart/form-data', 'class' => 'elgg-form-embed', ); -echo elgg_view_form('file/upload', $form_vars); +$body_vars = array('container_guid' => elgg_get_page_owner_guid()); +echo elgg_view_form('file/upload', $form_vars, $body_vars); // the tab we want to be forwarded to after upload is complete echo elgg_view('input/hidden', array( -- cgit v1.2.3 From d784d088ddfd6cc0d74f79539872921c358b75cb Mon Sep 17 00:00:00 2001 From: Ismayil Khayredinov Date: Thu, 15 Dec 2011 13:20:56 +0100 Subject: Fixes 4209: jquery.form.js library loading --- engine/lib/views.php | 1 - mod/developers/start.php | 14 ++++++++------ mod/embed/start.php | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'mod/embed') diff --git a/engine/lib/views.php b/engine/lib/views.php index d3c9ff551..b938dd60e 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1598,7 +1598,6 @@ function elgg_views_boot() { elgg_load_js('jquery'); elgg_load_js('jquery-ui'); - elgg_load_js('jquery.form'); elgg_load_js('elgg'); elgg_register_simplecache_view('js/lightbox'); diff --git a/mod/developers/start.php b/mod/developers/start.php index 2e3df7663..79ec0655a 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -23,6 +23,8 @@ function developers_init() { elgg_register_js('jquery.jstree', 'mod/developers/vendors/jsTree/jquery.jstree.js', 'footer'); elgg_register_css('jquery.jstree', 'mod/developers/vendors/jsTree/themes/default/style.css'); + elgg_load_js('jquery.form'); + elgg_register_js('elgg.dev', 'js/developers/developers.js', 'footer'); elgg_load_js('elgg.dev'); } @@ -166,13 +168,13 @@ function developers_theme_preview_controller($page) { $pages = array( 'buttons', - 'components', - 'forms', - 'grid', + 'components', + 'forms', + 'grid', 'icons', - 'modules', - 'navigation', - 'typography', + 'modules', + 'navigation', + 'typography', ); foreach ($pages as $page_name) { diff --git a/mod/embed/start.php b/mod/embed/start.php index 015c0c0e4..7c070fa75 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -49,6 +49,7 @@ function embed_longtext_menu($hook, $type, $items, $vars) { elgg_load_js('lightbox'); elgg_load_css('lightbox'); + elgg_load_js('jquery.form'); elgg_load_js('elgg.embed'); return $items; -- cgit v1.2.3