summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-11-19 18:23:30 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-11-19 18:23:30 +0000
commitb3314fc1dcfd73c36c4bab82a5ebabca629845c8 (patch)
tree0f2a53f914302f59a7c8215884b0a6482abbd1b2 /modules
parent161998dde6d976c45cfcea31f1128147acc3d64f (diff)
Update the media rss template to include the resize and the fullsize
added descendants by type method to the item model to allow for the selection of children by type
Diffstat (limited to 'modules')
-rw-r--r--modules/media_rss/controllers/media_rss.php15
-rw-r--r--modules/media_rss/views/feed.mrss.php28
2 files changed, 30 insertions, 13 deletions
diff --git a/modules/media_rss/controllers/media_rss.php b/modules/media_rss/controllers/media_rss.php
index e6b499ea..f88e7004 100644
--- a/modules/media_rss/controllers/media_rss.php
+++ b/modules/media_rss/controllers/media_rss.php
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Media_RSS_Controller extends Controller {
+ public static $LIMIT = 10;
public function feed($id) {
$item = ORM::factory("item", $id)->find();
if (!$item->loaded) {
@@ -27,11 +28,15 @@ class Media_RSS_Controller extends Controller {
$view = new View("feed.mrss");
$view->item = $item;
- // This should probably be a method in ORM_MPTT
- $view->children = ORM::factory("item")
- ->where("parent_id", $item->id)
- ->where("type", "photo")
- ->find_all();
+ $offset = $this->input->get("offset", 0);
+ $view->children = $item->decendents_by_type("photo", Media_RSS_Controller::$LIMIT, $offset);
+
+ if (!empty($offset)) {
+ $view->prevOffset = $offset - Media_RSS_Controller::$LIMIT;
+ }
+ if ($view->children->count() >= Media_RSS_Controller::$LIMIT) {
+ $view->nextOffset = $offset + Media_RSS_Controller::$LIMIT;
+ }
header("Content-type: application/rss+xml");
print $view;
diff --git a/modules/media_rss/views/feed.mrss.php b/modules/media_rss/views/feed.mrss.php
index 4ccde722..f4efe27d 100644
--- a/modules/media_rss/views/feed.mrss.php
+++ b/modules/media_rss/views/feed.mrss.php
@@ -11,7 +11,7 @@
<atom:link rel="previous" href="<?= url::site("media_rss/feed/{$item->id}?offset={$prevOffset}") ?>" />
<? endif; ?>
<? if (isset($nextOffset)): ?>
- <atom:link rel="next" href="href="<?= url::site("media_rss/feed/{$item->id}?offset={$nextOffset}") ?>"/>
+ <atom:link rel="next" href="<?= url::site("media_rss/feed/{$item->id}?offset={$nextOffset}") ?>"/>
<? endif; ?>
<?
// @todo do we want to add an upload date to the items table?
@@ -20,16 +20,28 @@
<pubDate><?= $date ?></pubDate>
<lastBuildDate><?= $date ?></lastBuildDate>
<? foreach ($children as $child): ?>
- <item>
+ <item> $child->resize_url(false, "http")
<title><?= $child->title ?></title>
- <link><?= $child->resize_url(false, "http") ?></link>
+ <link><?= url::site("photos/$child->id", "http") ?></link>
<guid isPermaLink="false"><?= $child->id ?></guid>
<description><?= $child->description ?></description>
- <media:content url="<?= $child->thumbnail_url(false, "http") ?>"
- type="<?= $child->mime_type ?>"
- height="<?= $child->resize_height ?>"
- width="<?= $child->resize_width ?>"
- />
+ <media:group>
+ <media:thumbnail url="<?= $child->thumbnail_url(false, "http") ?>"
+ height="<?= $child->thumbnail_height ?>"
+ width="<?= $child->thumbnail_width ?>"
+ />
+ <media:content url="<?= $child->resize_url(false, "http") ?>"
+ type="<?= $child->mime_type ?>"
+ height="<?= $child->resize_height ?>"
+ width="<?= $child->resize_width ?>"
+ isDefault="true"
+ />
+ <media:content url="<?= $child->url(false, "http") ?>"
+ type="<?= $child->mime_type ?>"
+ height="<?= $child->height ?>"
+ width="<?= $child->width ?>"
+ />
+ </media:group>
</item>
<? endforeach; ?>
</channel>