aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'mod/embed/views/default')
-rw-r--r--mod/embed/views/default/embed/css.php4
-rw-r--r--mod/embed/views/default/embed/embed.php32
-rw-r--r--mod/embed/views/default/embed/item/list.php24
-rw-r--r--mod/embed/views/default/embed/js.php38
4 files changed, 58 insertions, 40 deletions
diff --git a/mod/embed/views/default/embed/css.php b/mod/embed/views/default/embed/css.php
index 736c6ae44..44491846b 100644
--- a/mod/embed/views/default/embed/css.php
+++ b/mod/embed/views/default/embed/css.php
@@ -89,9 +89,6 @@
.embed_data .elgg-image-block {
border-bottom:none;
}
-.embed_data:last-child {
- border-bottom:1px dotted #CCC;
-}
.embed_modal_videolist .elgg-image img {
width:75px;
height:auto;
@@ -111,7 +108,6 @@
width:auto;
margin-top:15px;
margin-left:15px;
- float:left;
}
.embed_data .elgg-image-block {
cursor:pointer;
diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php
index 06d3f48f1..eeeb1d244 100644
--- a/mod/embed/views/default/embed/embed.php
+++ b/mod/embed/views/default/embed/embed.php
@@ -12,7 +12,7 @@
$sections = elgg_extract('sections', $vars, array());
$active_section = elgg_extract('active_section', $vars, array_shift(array_keys($sections)));
$upload_sections = elgg_extract('upload_sections', $vars, array());
-$internal_name = elgg_extract('internal_name', $vars);
+$internal_id = elgg_extract('internal_id', $vars);
if (!$sections) {
$content = elgg_echo('embed:no_sections');
@@ -65,7 +65,7 @@ if (!$sections) {
'limit' => $limit,
'section' => $active_section,
'upload_sections' => $upload_sections,
- 'internal_name' => $internal_name
+ 'internal_id' => $internal_id
);
// allow full override for this section
@@ -92,8 +92,8 @@ if (!$sections) {
} else {
$ecml_valid_keyword = FALSE;
}
-
- $items_content = '';
+
+ $items_content = '<ul class="elgg-list">';
foreach ($embed_info['items'] as $item) {
$item_params = array(
'section' => $active_section,
@@ -103,9 +103,10 @@ if (!$sections) {
'icon_size' => elgg_extract('icon_size', $section_info, 'tiny'),
);
- $items_content .= elgg_view($view, $item_params);
+ $items_content .= '<li class="elgg-list-item">' . elgg_view($view, $item_params) . '</li>';
}
-
+ $items_content .= '</ul>';
+
$params['content'] = $items_content;
$params['count'] = $embed_info['count'];
@@ -126,18 +127,25 @@ echo $content;
<?php //@todo: JS 1.8: ugly ?>
<script type="text/javascript">
$(function() {
- var internal_name = '<?php echo addslashes($internal_name); ?>';
+ var internal_id = '<?php echo addslashes($internal_id); ?>';
+
+ // Remove any existing "live" handlers
+ $('.embed_data').die('click');
+ $('.embed_section').die('click');
+ $('#facebox .elgg-pagination a').die('click');
// insert embed codes
$('.embed_data').live('click', function() {
- var embed_code = $(this).data('embed_code')
- elggEmbedInsertContent(embed_code, internal_name);
+ var embed_code = $(this).data('embed_code');
+ elggEmbedInsertContent(embed_code, internal_id);
+
+ return false;
});
// tabs
$('.embed_section').live('click', function() {
var section = $(this).attr('id');
- var url = elgg.config.wwwroot + 'embed/embed?active_section=' + section + '&internal_name=' + internal_name;
+ var url = elgg.config.wwwroot + 'embed/embed?active_section=' + section + '&internal_id=' + internal_id;
$('#facebox .body .content').load(url);
return false;
@@ -149,9 +157,7 @@ $(function() {
return false;
}
- $('.pagination-number').live('click', elggPaginationClick);
- $('.pagination-next').live('click', elggPaginationClick);
- $('.pagination-previous').live('click', elggPaginationClick);
+ $('#facebox .elgg-pagination a').live('click', elggPaginationClick);
});
</script>
diff --git a/mod/embed/views/default/embed/item/list.php b/mod/embed/views/default/embed/item/list.php
index c5c604854..232f0558b 100644
--- a/mod/embed/views/default/embed/item/list.php
+++ b/mod/embed/views/default/embed/item/list.php
@@ -13,8 +13,9 @@
$item = $vars['item'];
$section = $vars['section'];
$target = $vars['target'];
-$ecml_keyword = (isset($vars['ecml_enabled']) && isset($vars['ecml_keyword'])) ? $vars['ecml_keyword'] : NULL;
+$ecml_keyword = (isset($vars['ecml_enabled']) && $vars['ecml_enabled'] && isset($vars['ecml_keyword'])) ? $vars['ecml_keyword'] : NULL;
$icon_size = $vars['icon_size'];
+$owner = $item->getOwnerEntity();
// @todo add entity checking.
@@ -23,6 +24,11 @@ $title = isset($item->name) ? $item->name : $item->title;
// don't let it be too long
$title = elgg_get_excerpt($title);
+$author_text = elgg_echo('byline', array($owner->name));
+$date = elgg_view_friendly_time($item->time_created);
+
+$subtitle = "$author_text $date";
+
// @todo you can disable plugins that are required by other plugins
// (embed requires ecml) so fallback to a hard-coded check to see if ecml is enabled.
// #grumble
@@ -35,17 +41,23 @@ if ($ecml_keyword) {
$embed_code = elgg_view('output/url', array(
'href' => $item->getURL(),
'title' => $title,
- 'text' => $title,
+ 'text' => $icon,
'encode_text' => FALSE
));
}
-$icon = "<img src=\"{$item->getIcon($icon_size)}\" />";
-$info = "<p class='entity-title'>" . htmlentities($title, ENT_QUOTES, 'UTF-8') . "</p>";
-$info .= "<p class='entity-subtext'>" . elgg_view_friendly_time($vars['item']->time_created) . "</p>";
+$item_icon = elgg_view_entity_icon($item, $icon_size);
+
+$params = array(
+ 'title' => $title,
+ 'entity' => $item,
+ 'subtitle' => $subtitle,
+ 'tags' => FALSE,
+);
+$list_body = elgg_view('page/components/summary', $params);
// @todo JS 1.8: is this approach better than inline js?
-echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">" . elgg_view_listing($icon, $info) . '</div>';
+echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">" . elgg_view_image_block($item_icon, $list_body) . '</div>';
echo "<script type=\"text/javascript\">
$('#embed_{$item->getGUID()}').data('embed_code', " . json_encode($embed_code) . ");
</script>"; \ No newline at end of file
diff --git a/mod/embed/views/default/embed/js.php b/mod/embed/views/default/embed/js.php
index f80d7367d..a0a2e8ff5 100644
--- a/mod/embed/views/default/embed/js.php
+++ b/mod/embed/views/default/embed/js.php
@@ -9,35 +9,39 @@
$(function() {
$('a[rel*=facebox]').facebox();
- // fire off the ajax upload
- $('#file_embed_upload').submit(function() {
- var options = {
- success: function(data) {
- var info = jQuery.parseJSON(data);
-
- if (info.status == 'success') {
- $('.popup .content').load(elgg.get_site_url() + 'embed/embed?active_section=file');
- } else {
- $('.popup .content').find('form').prepend('<p>' + info.message + '</p>');
+ // Only apply the .live binding after facebox has been displayed
+ $(document).bind('afterReveal.facebox', function() {
+
+ // fire off the ajax upload
+ $('#file_embed_upload').live('submit', function() {
+ var options = {
+ success: function(data) {
+ var info = jQuery.parseJSON(data);
+
+ if (info.status == 'success') {
+ $('.popup .content').load(elgg.get_site_url() + 'embed/embed?active_section=file');
+ } else {
+ $('.popup .content').find('form').prepend('<p>' + info.message + '</p>');
+ }
}
- }
- };
- $(this).ajaxSubmit(options);
- return false;
+ };
+ $(this).ajaxSubmit(options);
+ return false;
+ });
});
});
-function elggEmbedInsertContent(content, textAreaName) {
+function elggEmbedInsertContent(content, textAreaId) {
content = ' ' + content + ' ';
// default input.
// if this doesn't match anything it won't add anything.
- $('textarea[name=' + textAreaName + ']').val($('textarea[name=' + textAreaName + ']').val() + ' ' + content);
+ $('#' + textAreaId).val($('#' + textAreaId).val() + ' ' + content);
<?php
// This view includes the guts of the function to do the inserting.
// Anything that overrides input/longtext with its own editor
// needs to supply its own function here that inserts
- // content into textAreaName.
+ // content into textAreaId.
// See TinyMCE as an example.
// for compatibility