From aeb88b95d16ff1da7e2ce8fadde0eab1f4653d8b Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 18 Jun 2011 21:54:58 -0400 Subject: rewrote pagination for embed file listing --- mod/embed/views/default/embed/addcontentjs.php | 3 ++- mod/embed/views/default/embed/embed.php | 8 +++++++- mod/embed/views/default/js/embed/embed.php | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'mod/embed/views/default') diff --git a/mod/embed/views/default/embed/addcontentjs.php b/mod/embed/views/default/embed/addcontentjs.php index 18d2927fd..ffed211f5 100644 --- a/mod/embed/views/default/embed/addcontentjs.php +++ b/mod/embed/views/default/embed/addcontentjs.php @@ -3,4 +3,5 @@ * Blank for compatibility. * @deprecated 1.8 */ -?> \ No newline at end of file + +elgg_deprecated_notice("The view 'embed/addcontentjs' has been deprecated.", 1.8); diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php index 9f0ac730f..77ce03699 100644 --- a/mod/embed/views/default/embed/embed.php +++ b/mod/embed/views/default/embed/embed.php @@ -21,7 +21,7 @@ if (!$sections) { $content .= elgg_view('embed/tabs', $vars); $offset = max(0, get_input('offset', 0)); - $limit = get_input('limit', 10); + $limit = get_input('limit', 5); // build the items and layout. if ($active_section == 'upload' || array_key_exists($active_section, $sections)) { @@ -55,9 +55,15 @@ if (!$sections) { if (!isset($embed_info['items']) || !is_array($embed_info['items']) || !count($embed_info['items'])) { $content .= elgg_echo('embed:no_section_content'); } else { + elgg_push_context('widgets'); $content .= elgg_view_entity_list($embed_info['items'], array( 'full_view' => false, + 'count' => $embed_info['count'], + 'pagination' => true, + 'position' => 'before', + 'offset' => $offset, + 'limit' => $limit, )); elgg_pop_context(); diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php index 78ad125ef..b709af05e 100644 --- a/mod/embed/views/default/js/embed/embed.php +++ b/mod/embed/views/default/js/embed/embed.php @@ -12,6 +12,9 @@ elgg.embed.init = function() { var textAreaId = class.substr(class.indexOf('embed-control-') + "embed-control-".length); elgg.embed.textAreaId = textAreaId; }); + + // special pagination helper for lightbox + $('.embed-wrapper .elgg-pagination a').live('click', elgg.embed.pagination); } /** @@ -36,4 +39,15 @@ elgg.embed.insert = function(event) { event.preventDefault(); } +/** + * Loads the next chunk of content within the lightbox + * + * @param {Object} event + * @return void + */ +elgg.embed.pagination = function(event) { + $('.embed-wrapper').parent().load($(this).attr('href')); + event.preventDefault(); +} + elgg.register_hook_handler('init', 'system', elgg.embed.init); -- cgit v1.2.3