* @return array
*/
function embed_longtext_menu($hook, $type, $items, $vars) {
- // yeah this is naughty. embed and ecml might want to merge.
- if (elgg_is_active_plugin('ecml')) {
- $active_section = 'active_section=web_services&';
- } else {
- $active_section = '';
- }
$items[] = ElggMenuItem::factory(array(
'name' => 'embed',
- 'href' => "embed?{$active_section}internal_id={$vars['id']}",
+ 'href' => "embed",
'text' => elgg_echo('media:insert'),
'rel' => 'lightbox',
'link_class' => "elgg-longtext-control elgg-lightbox embed-control embed-control-{$vars['id']}",
$tab = array(
'title' => $section_info['name'],
'url' => '#',
- 'url_class' => 'embed_section',
+ 'url_class' => 'embed-section',
'url_id' => $section_id,
);
$tabs[] = array(
'title' => elgg_echo('embed:upload'),
'url' => '#',
- 'url_class' => 'embed_section',
+ 'url_class' => 'embed-section',
'url_id' => 'upload',
'selected' => ($active_section == 'upload')
);
// special pagination helper for lightbox
$('.embed-wrapper .elgg-pagination a').live('click', elgg.embed.pagination);
+
+ $('.embed-section').live('click', elgg.embed.loadTab);
}
/**
event.preventDefault();
}
+/**
+ * Loads an embed tab
+ *
+ * @param {Object} event
+ * @return void
+ */
+elgg.embed.loadTab = function(event) {
+ var section = $(this).attr('id');
+ var url = elgg.config.wwwroot + 'embed/embed?active_section=' + section;
+ $('.embed-wrapper').parent().load(url);
+ event.preventDefault();
+}
+
elgg.register_hook_handler('init', 'system', elgg.embed.init);