aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/views
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-06 20:20:09 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-06 20:20:09 +0000
commit60e96102050d1ccc4913753ffda50af0cd9337b7 (patch)
tree159fa7d847b20802fe2492845a342c697926a70c /mod/embed/views
parent45aad80a5b28177a1897ca661f4ae03dae90fb2b (diff)
downloadelgg-60e96102050d1ccc4913753ffda50af0cd9337b7.tar.gz
elgg-60e96102050d1ccc4913753ffda50af0cd9337b7.tar.bz2
Updated documentation for embed. Fixed bug passing internal_name for elggEmbedInsertContent(). Showing a message if no embedable items are returned.
git-svn-id: http://code.elgg.org/elgg/trunk@6644 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/embed/views')
-rw-r--r--mod/embed/views/default/embed/embed.php67
-rw-r--r--mod/embed/views/default/embed/link.php2
2 files changed, 38 insertions, 31 deletions
diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php
index 250a7a465..b57c3b289 100644
--- a/mod/embed/views/default/embed/embed.php
+++ b/mod/embed/views/default/embed/embed.php
@@ -12,7 +12,7 @@
$sections = elgg_get_array_value('sections', $vars, array());
$active_section = elgg_get_array_value('active_section', $vars, array_shift(array_keys($sections)));
$upload_sections = elgg_get_array_value('upload_sections', $vars, array());
-$internal_name = elgg_get_array_value('internal_name', $vars, array());
+$internal_name = elgg_get_array_value('internal_name', $vars);
if (!$sections) {
$content = elgg_echo('embed:no_sections');
@@ -80,34 +80,38 @@ if (!$sections) {
if (!elgg_view_exists($view)) {
$view = "embed/item/$layout";
}
-
- // pull out some common tests
- // embed requires ECML, but until we have plugin deps working
- // we need to explicitly check and use a fallback.
- if ($ecml_enabled = is_plugin_enabled('ecml')){
- $ecml_valid_keyword = ecml_is_valid_keyword($active_section);
+
+ if (!isset($embed_info['items']) || !is_array($embed_info['items']) || !count($embed_info['items'])) {
+ $content .= elgg_echo('embed:no_section_content');
} else {
- $ecml_valid_keyword = FALSE;
- }
-
- $items_content = '';
- foreach ($embed_info['items'] as $item) {
- $item_params = array(
- 'section' => $active_section,
- 'item' => $item,
- 'ecml_enabled' => $ecml_enabled,
- 'ecml_keyword' => ($ecml_valid_keyword) ? $active_section : 'entity',
- 'icon_size' => elgg_get_array_value('icon_size', $section_info, 'tiny'),
- );
-
- $items_content .= elgg_view($view, $item_params);
+ // pull out some common tests
+ // embed requires ECML, but until we have plugin deps working
+ // we need to explicitly check and use a fallback.
+ if ($ecml_enabled = is_plugin_enabled('ecml')){
+ $ecml_valid_keyword = ecml_is_valid_keyword($active_section);
+ } else {
+ $ecml_valid_keyword = FALSE;
+ }
+
+ $items_content = '';
+ foreach ($embed_info['items'] as $item) {
+ $item_params = array(
+ 'section' => $active_section,
+ 'item' => $item,
+ 'ecml_enabled' => $ecml_enabled,
+ 'ecml_keyword' => ($ecml_valid_keyword) ? $active_section : 'entity',
+ 'icon_size' => elgg_get_array_value('icon_size', $section_info, 'tiny'),
+ );
+
+ $items_content .= elgg_view($view, $item_params);
+ }
+
+ $params['content'] = $items_content;
+ $params['count'] = $embed_info['count'];
+
+ $content .= elgg_view('navigation/pagination', $params);
+ $content .= elgg_view("embed/layouts/$layout", $params);
}
-
- $params['content'] = $items_content;
- $params['count'] = $embed_info['count'];
-
- $content .= elgg_view('navigation/pagination', $params);
- $content .= elgg_view("embed/layouts/$layout", $params);
} else {
$content .= elgg_echo('embed:no_section_content');
}
@@ -115,21 +119,24 @@ if (!$sections) {
$content .= elgg_echo('embed:invalid_section');
}
}
+
echo $content;
?>
<script type="text/javascript">
$(document).ready(function() {
+ var internal_name = '<?php echo addslashes($internal_name); ?>';
+
// insert embed codes
$('.embed_data').click(function() {
- var embed_code = $(this).data('embed_code');
- elggEmbedInsertContent(embed_code, '<?php echo addslashes($internal_name); ?>');
+ var embed_code = $(this).data('embed_code')
+ elggEmbedInsertContent(embed_code, internal_name);
});
// tabs
$('.embed_section').click(function() {
var section = $(this).attr('id');
- var url = '<?php echo $vars['url']; ?>pg/embed/embed?active_section=' + section;
+ var url = '<?php echo $vars['url']; ?>pg/embed/embed?active_section=' + section + '&internal_name=' + internal_name;
$('#facebox .body .content').load(url);
return false;
diff --git a/mod/embed/views/default/embed/link.php b/mod/embed/views/default/embed/link.php
index 8776893ec..6740b8e1a 100644
--- a/mod/embed/views/default/embed/link.php
+++ b/mod/embed/views/default/embed/link.php
@@ -3,4 +3,4 @@
* Displays an "Embed media" link in longtext inputs.
*/
?>
-<a class="longtext_control small link" href="<?php echo $vars['url'] . 'pg/embed'; ?>?internalname=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a>
+<a class="longtext_control small link" href="<?php echo $vars['url'] . 'pg/embed'; ?>?internal_name=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a>