diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-12-22 08:12:07 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-12-22 08:12:07 -0500 |
commit | e49df853b2cc3a6a9bc2dd527a64951050142eb9 (patch) | |
tree | 6f485b560f89331c65fad3993e055a1834b07177 /mod/embed/views/default | |
parent | 5e5b3705a5ca7b66dfe386490c5570af88b49009 (diff) | |
parent | fea599f1653d7206e34ac33c0c0a668cb587bc20 (diff) | |
download | elgg-e49df853b2cc3a6a9bc2dd527a64951050142eb9.tar.gz elgg-e49df853b2cc3a6a9bc2dd527a64951050142eb9.tar.bz2 |
Merge branch '1.8' after 1.8.2 release
Conflicts:
version.php
Diffstat (limited to 'mod/embed/views/default')
-rw-r--r-- | mod/embed/views/default/embed/layout.php | 7 | ||||
-rw-r--r-- | mod/embed/views/default/js/embed/embed.php | 32 |
2 files changed, 37 insertions, 2 deletions
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 <<<HTML <div class="embed-wrapper"> $title $menu $tab + $container_info </div> HTML; diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index 8a8f0290c..5fd534a09 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(); @@ -75,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 } }); @@ -93,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); |