]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
rewrote pagination for embed file listing
authorcash <cash.costello@gmail.com>
Sun, 19 Jun 2011 01:54:58 +0000 (21:54 -0400)
committercash <cash.costello@gmail.com>
Sun, 19 Jun 2011 01:54:58 +0000 (21:54 -0400)
mod/embed/views/default/embed/addcontentjs.php
mod/embed/views/default/embed/embed.php
mod/embed/views/default/js/embed/embed.php

index 18d2927fdc9540bc0f118a06a6566ff7f27b262f..ffed211f57cc2c41ccc458fad45e539d871cdf6b 100644 (file)
@@ -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);
index 9f0ac730fd083db6d7cef06467a28b9d106244d0..77ce0369995fee1610f8ba4a557ec6c31338ee1f 100644 (file)
@@ -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();
 
index 78ad125ef7ab220321158f34fb2b9f741d58c2cb..b709af05ecf5951f93587c70f67271e353a7dd39 100644 (file)
@@ -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);