aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-09 18:04:00 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-09 18:04:00 +0000
commitfe04f54b34210e6771fa06d8e4ca2849749c8477 (patch)
treefeaea79f1057a3313366fd7ec86ed1e3ce1db750
parentd7718ebc40f9e28c6126e65df54e99d5b9948447 (diff)
downloadelgg-fe04f54b34210e6771fa06d8e4ca2849749c8477.tar.gz
elgg-fe04f54b34210e6771fa06d8e4ca2849749c8477.tar.bz2
Closes #81: OpenDD aggregator
http://trac.elgg.org/elgg/ticket/81 git-svn-id: https://code.elgg.org/elgg/trunk@1377 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/river.php111
-rw-r--r--mod/opendd/actions/opendd/feed/delete.php42
-rw-r--r--mod/opendd/actions/opendd/feed/subscribe.php58
-rw-r--r--mod/opendd/edit.php19
-rw-r--r--mod/opendd/feeds.php25
-rw-r--r--mod/opendd/graphics/defaultlarge.jpgbin0 -> 4231 bytes
-rw-r--r--mod/opendd/graphics/defaultmedium.jpgbin0 -> 1807 bytes
-rw-r--r--mod/opendd/graphics/defaultsmall.jpgbin0 -> 990 bytes
-rw-r--r--mod/opendd/graphics/defaulttiny.jpgbin0 -> 640 bytes
-rw-r--r--mod/opendd/index.php76
-rw-r--r--mod/opendd/languages/en.php52
-rw-r--r--mod/opendd/manage.php27
-rw-r--r--mod/opendd/manifest.xml9
-rw-r--r--mod/opendd/start.php116
-rw-r--r--mod/opendd/viewfeed.php75
-rw-r--r--mod/opendd/views/default/forms/opendd/subscribe.php37
-rw-r--r--mod/opendd/views/default/object/oddentity.php25
-rw-r--r--mod/opendd/views/default/object/oddfeed.php21
-rw-r--r--mod/opendd/views/default/object/oddmetadata.php30
-rw-r--r--mod/opendd/views/default/object/oddrelationship.php25
-rw-r--r--mod/opendd/views/default/opendd/css.php3
-rw-r--r--mod/opendd/views/default/opendd/gallery.php25
-rw-r--r--mod/opendd/views/default/opendd/icon.php36
-rw-r--r--mod/opendd/views/default/opendd/link_logo.php22
-rw-r--r--mod/opendd/views/default/opendd/links.php3
-rw-r--r--mod/opendd/views/default/opendd/listing.php26
-rw-r--r--mod/opendd/views/default/opendd/metatags.php16
-rw-r--r--mod/opendd/views/default/opendd/profile.php109
28 files changed, 988 insertions, 0 deletions
diff --git a/engine/lib/river.php b/engine/lib/river.php
index e1a374a31..d9578a195 100644
--- a/engine/lib/river.php
+++ b/engine/lib/river.php
@@ -137,6 +137,117 @@
);
return $river;
+ }
+
+ /**
+ * Extract entities from the system log and produce them as an OpenDD stream.
+ * This stream can be subscribed to and reconstructed on another system as an activity stream.
+ *
+ * @param int $by_user The user who initiated the event.
+ * @param string $relationship Limit return results to only those users who $by_user has $relationship with.
+ * @param int $limit Maximum number of events to show
+ * @param int $offset An offset
+ * @return ODDDocument
+ */
+ function get_river_entries_as_opendd($by_user = "", $relationship = "", $limit = 10, $offset = 0)
+ {
+ // set start limit and offset
+ $cnt = $limit; // Didn' cast to int here deliberately
+ $off = $offset; // here too
+
+ if (is_array($by_user) && sizeof($by_user) > 0) {
+ foreach($by_user as $key => $val) {
+ $by_user[$key] = (int) $val;
+ }
+ } else {
+ $by_user = (int)$by_user;
+ }
+
+ $exit = false;
+
+ // River objects
+ $river = new ODDDocument();
+
+ do
+ {
+ $log_events = get_system_log($by_user, "","", $cnt, $off);
+
+ if (!$log_events)
+ $exit = true;
+ else
+ {
+
+ foreach ($log_events as $log)
+ {
+ // See if we have access to the object we're talking about
+ $event = $log->event;
+ $class = $log->object_class;
+ $tmp = new $class();
+ $object = $tmp->getObjectFromID($log->object_id);
+
+ // Exists and we have access to it
+ // if (is_a($object, $class))
+ if ($object instanceof $class)
+ {
+ // If no relationship defined or it matches $relationship
+ if (
+ (!$relationship) ||
+ (
+ ($relationship) &&
+ (check_entity_relationship($by_user, $relationship, $tmp->getObjectOwnerGUID()))
+ )
+ )
+ {
+ $relationship_obj = NULL;
+
+ // Handle updates of entities
+ if ($object instanceof ElggEntity)
+ {
+ $relationship_obj = new ODDRelationship(
+ guid_to_uuid($log->performed_by_guid),
+ $log->event,
+ guid_to_uuid($log->object_id)
+ );
+ }
+
+ // Handle updates of metadata
+ if ($object instanceof ElggExtender)
+ {
+ $odd = $object->export();
+ $relationship_obj = new ODDRelationship(
+ guid_to_uuid($log->performed_by_guid),
+ $log->event,
+ $odd->getAttribute('uuid')
+ );
+ }
+
+ // Handle updates of relationships
+ if ($object instanceof ElggRelationship)
+ {
+ $relationship_obj = $object->export(); // I figure this is what you're actually interested in in this instance.
+ }
+
+ // If we have handled it then add it to the document
+ if ($relationship_obj) {
+ $relationship_obj->setPublished($log->time_created);
+ $river->addElement($relationship_obj);
+ }
+
+ }
+ }
+
+ // Increase offset
+ $off++;
+ }
+ }
+
+ } while (
+ ($cnt > 0) &&
+ (!$exit)
+ );
+
+ return $river;
+
}
/**
diff --git a/mod/opendd/actions/opendd/feed/delete.php b/mod/opendd/actions/opendd/feed/delete.php
new file mode 100644
index 000000000..2826174bf
--- /dev/null
+++ b/mod/opendd/actions/opendd/feed/delete.php
@@ -0,0 +1,42 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ // Load configuration
+ global $CONFIG;
+
+ gatekeeper();
+
+ $returnurl = $_SERVER['HTTP_REFERER'];
+
+ $feed_guid = get_input('feed_guid');
+ $feed = NULL;
+ if ($feed_guid)
+ $feed = get_entity($feed_guid);
+
+ if (($feed) || (!($feed instanceof ElggObject)))
+ {
+ if ($feed->delete()) {
+ system_message(elgg_echo("opendd:deleted"));
+ $returnurl = $CONFIG->url . "mod/opendd/";
+ }
+ else
+ system_message(elgg_echo("opendd:notdeleted"));
+
+ }
+ else
+ system_message(elgg_echo("opendd:notobject"));
+
+
+
+ $returnurl = $CONFIG->url . "mod/opendd/";
+ forward($returnurl);
+ exit;
+?> \ No newline at end of file
diff --git a/mod/opendd/actions/opendd/feed/subscribe.php b/mod/opendd/actions/opendd/feed/subscribe.php
new file mode 100644
index 000000000..654e6aef3
--- /dev/null
+++ b/mod/opendd/actions/opendd/feed/subscribe.php
@@ -0,0 +1,58 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ // Load configuration
+ global $CONFIG;
+
+ gatekeeper();
+
+ $input = array();
+ foreach($CONFIG->opendd as $shortname => $valuetype) {
+ $input[$shortname] = get_input($shortname);
+ if ($valuetype == 'tags')
+ $input[$shortname] = string_to_tag_array($input[$shortname]);
+ }
+
+ $feed_guid = get_input('feed_guid');
+ $feed = NULL;
+ if ($feed_guid)
+ $feed = get_entity($feed_guid);
+ else
+ {
+ $feed = new ElggObject();
+ $feed->subtype = 'oddfeed';
+ }
+
+ if (!($feed instanceof ElggObject))
+ {
+ system_message(elgg_echo("opendd:notobject"));
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+ }
+
+ // Assume we can edit or this is a new group
+ if (sizeof($input) > 0)
+ {
+ foreach($input as $shortname => $value) {
+ $feed->$shortname = $value;
+ }
+ }
+
+
+ if ($feed->save())
+ system_message(elgg_echo("opendd:feedok"));
+ else
+ system_message(elgg_echo("opendd:feednotok"));
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+?> \ No newline at end of file
diff --git a/mod/opendd/edit.php b/mod/opendd/edit.php
new file mode 100644
index 000000000..f1b060a6c
--- /dev/null
+++ b/mod/opendd/edit.php
@@ -0,0 +1,19 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ $form = elgg_view('forms/opendd/subscribe', array('entity' => get_entity(get_input('feed_guid'))));
+
+ $body = elgg_view_layout('one_column',$form);
+
+ page_draw(elgg_echo("opendd:edit"), $body);
+?> \ No newline at end of file
diff --git a/mod/opendd/feeds.php b/mod/opendd/feeds.php
new file mode 100644
index 000000000..69b35aa7e
--- /dev/null
+++ b/mod/opendd/feeds.php
@@ -0,0 +1,25 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $limit = get_input("limit", 10);
+ $offset = get_input("offset", 0);
+
+ $context = get_context();
+
+ set_context('search');
+ $objects = list_entities('object','oddfeed', page_owner(), $limit, false);
+
+ set_context($context);
+
+ $body = elgg_view_layout('one_column', $objects);
+
+ page_draw(elgg_echo("opendd:feeds"), $body);
+?> \ No newline at end of file
diff --git a/mod/opendd/graphics/defaultlarge.jpg b/mod/opendd/graphics/defaultlarge.jpg
new file mode 100644
index 000000000..04d7b7bef
--- /dev/null
+++ b/mod/opendd/graphics/defaultlarge.jpg
Binary files differ
diff --git a/mod/opendd/graphics/defaultmedium.jpg b/mod/opendd/graphics/defaultmedium.jpg
new file mode 100644
index 000000000..e3475850f
--- /dev/null
+++ b/mod/opendd/graphics/defaultmedium.jpg
Binary files differ
diff --git a/mod/opendd/graphics/defaultsmall.jpg b/mod/opendd/graphics/defaultsmall.jpg
new file mode 100644
index 000000000..1be985956
--- /dev/null
+++ b/mod/opendd/graphics/defaultsmall.jpg
Binary files differ
diff --git a/mod/opendd/graphics/defaulttiny.jpg b/mod/opendd/graphics/defaulttiny.jpg
new file mode 100644
index 000000000..c384ccf3a
--- /dev/null
+++ b/mod/opendd/graphics/defaulttiny.jpg
Binary files differ
diff --git a/mod/opendd/index.php b/mod/opendd/index.php
new file mode 100644
index 000000000..83b6b0368
--- /dev/null
+++ b/mod/opendd/index.php
@@ -0,0 +1,76 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ global $CONFIG;
+
+ $limit = get_input("limit", 10);
+ $offset = get_input("offset", 0);
+ $view = get_input("view");
+
+ $opendd = get_river_entries_as_opendd(page_owner(), "", $limit, $offset);
+
+ if ($view=='odd')
+ {
+ // Slightly crufty hack
+ header ("Content-Type: text/xml");
+ echo $opendd;
+
+ }
+ else
+ {
+ $objects = array();
+
+ $cnt = 0;
+ foreach ($opendd as $obj)
+ {
+ if (($cnt >= $offset) && ($cnt < $offset + $limit))
+ {
+ $tmp = new ElggObject();
+ $tmp->subtype = strtolower(get_class($obj));
+
+ $attr = $obj->getAttributes();
+ foreach ($attr as $k => $v)
+ {
+ $key = 'opendd:' . $k;
+ $tmp->$key = $v;
+ }
+
+ $key = 'opendd:body';
+ $tmp->$key = $obj->getBody();
+
+ $objects[] = $tmp;
+ }
+
+ $cnt++;
+ }
+
+ $context = get_context();
+ set_context('search');
+ $body .= elgg_view_entity_list($objects, $cnt, $offset, $limit, false);
+ set_context($context);
+
+ // Add logo link
+ $body .= elgg_view('opendd/link_logo', array('feed_url' => $CONFIG->url . "pg/opendd/". page_owner_entity()->username ."/activity/opendd"));
+
+ // Turn off rss view & default odd view
+ global $autofeed; $autofeed = false;
+
+ // Point to my activity in odd
+ extend_view('metatags', 'opendd/metatags');
+
+ $body = elgg_view_layout('one_column',$body);
+
+ // Finally draw the page
+ page_draw(sprintf(elgg_echo("opendd:your"),page_owner_entity()->name), $body);
+ }
+?> \ No newline at end of file
diff --git a/mod/opendd/languages/en.php b/mod/opendd/languages/en.php
new file mode 100644
index 000000000..08f764728
--- /dev/null
+++ b/mod/opendd/languages/en.php
@@ -0,0 +1,52 @@
+<?php
+ /**
+ * Elgg groups plugin language pack
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $english = array(
+
+ /**
+ * Menu items and titles
+ */
+
+ 'opendd' => "OpenDD",
+ 'opendd:your' => "Your activity",
+ 'opendd:feeds' => "Your subscriptions",
+ 'opendd:manage' => "Manage subscriptions",
+ 'opendd:edit' => "Edit subscription",
+
+ 'opendd:feedurl' => "Feed URL",
+
+ 'opendd:notobject' => "Entity is not an object, this should not have happened.",
+ 'opendd:feednotok' => "Unable to edit your OpenDD feeds.",
+ 'opendd:feedok' => "Successfully subscribed to feed.",
+
+ 'opendd:deleted' => "Feed subscription deleted.",
+ 'opendd:notdeleted' => "Feed subscription not deleted.",
+
+ 'opendd:noopenddfound' => "No OpenDD elements found in stream.",
+
+ 'opendd:metadata:uuid' => "UUID of metadata",
+ 'opendd:metadata:entityuuid' => "Referring to UUID",
+ 'opendd:metadata:owneruuid' => "Owner",
+ 'opendd:metadata:key' => "Key",
+ 'opendd:metadata:value' => "Value",
+
+ 'opendd:entity:uuid' => "Universal Identifier",
+ 'opendd:entity:class' => "Class",
+ 'opendd:entity:subclass' => "Subclass",
+
+ 'opendd:published' => "Published",
+
+ 'opendd:nodata' => "There was a problem getting the feed, response: %s",
+
+ );
+
+ add_translation("en",$english);
+?> \ No newline at end of file
diff --git a/mod/opendd/manage.php b/mod/opendd/manage.php
new file mode 100644
index 000000000..22c5ace3f
--- /dev/null
+++ b/mod/opendd/manage.php
@@ -0,0 +1,27 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $limit = get_input("limit", 10);
+ $offset = get_input("offset", 0);
+
+ $form = elgg_view('forms/opendd/subscribe');
+
+ $context = get_context();
+
+ set_context('search');
+ $objects = list_entities('object','oddfeed', page_owner(), $limit, false);
+
+ set_context($context);
+
+ $body = elgg_view_layout('one_column',$form . $objects);
+
+ page_draw(elgg_echo("opendd:manage"), $body);
+?> \ No newline at end of file
diff --git a/mod/opendd/manifest.xml b/mod/opendd/manifest.xml
new file mode 100644
index 000000000..9b3923f51
--- /dev/null
+++ b/mod/opendd/manifest.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+ <field key="author" value="Marcus Povey" />
+ <field key="version" value="1.0" />
+ <field key="description" value="Provides an OpenDD aggregator" />
+ <field key="website" value="http://www.opendd.net/" />
+ <field key="copyright" value="(C) Curverider 2008" />
+ <field key="licence" value="GNU Public License version 2" />
+</plugin_manifest> \ No newline at end of file
diff --git a/mod/opendd/start.php b/mod/opendd/start.php
new file mode 100644
index 000000000..88891ba11
--- /dev/null
+++ b/mod/opendd/start.php
@@ -0,0 +1,116 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ /**
+ * Initialise the opendd plugin.
+ * Register actions, set up menus
+ */
+ function opendd_init()
+ {
+ global $CONFIG;
+
+ // Set up the menu for logged in users
+ if (isloggedin())
+ {
+ add_menu(elgg_echo('opendd'), $CONFIG->wwwroot . "pg/opendd/{$_SESSION['user']->username}",array(
+ menu_item(elgg_echo('opendd:your'), $CONFIG->wwwroot."pg/opendd/{$_SESSION['user']->username}"),
+ menu_item(elgg_echo('opendd:feeds'), $CONFIG->wwwroot."pg/opendd/{$_SESSION['user']->username}/feeds/"),
+ menu_item(elgg_echo('opendd:manage'), $CONFIG->wwwroot . "pg/opendd/{$_SESSION['user']->username}/manage/"),
+ ),'opendd');
+ }
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('opendd','opendd_page_handler');
+
+ // Register opendd url
+ register_entity_url_handler('opendd_url','object','oddfeed');
+
+ // Actions
+ register_action("opendd/feed/subscribe",false, $CONFIG->pluginspath . "opendd/actions/opendd/feed/subscribe.php");
+ register_action("opendd/feed/delete",false, $CONFIG->pluginspath . "opendd/actions/opendd/feed/delete.php");
+
+ // Extend some views
+ extend_view('css','opendd/css');
+
+
+ // Subscribe fields
+ $CONFIG->opendd = array(
+ 'feedurl' => 'text',
+ );
+
+ }
+
+ /**
+ * Group page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+ function opendd_page_handler($page)
+ {
+ global $CONFIG;
+
+ if (isset($page[0]))
+ set_input('username',$page[0]);
+
+ if (isset($page[1]))
+ {
+ // See what context we're using
+ switch($page[1])
+ {
+ case "view" :
+ if (isset($page[2]))
+ {
+ set_input('feed_guid', $page[2]);
+ include($CONFIG->pluginspath . "opendd/viewfeed.php");
+ }
+ break;
+ case "manage":
+ include($CONFIG->pluginspath . "opendd/manage.php");
+ break;
+ case "feeds" :
+ include($CONFIG->pluginspath . "opendd/feeds.php");
+ break;
+ case "activity" :
+ if (isset($page[2]))
+ {
+ switch ($page[2])
+ {
+ case 'opendd' :
+ default :
+ set_input('view', 'odd');
+ include($CONFIG->pluginspath . "opendd/index.php");
+ }
+ }
+ break;
+ default:
+ include($CONFIG->pluginspath . "opendd/index.php");
+ }
+ }
+ else
+ include($CONFIG->pluginspath . "opendd/index.php");
+ }
+
+ /**
+ * Register a url to handle opendd feeds.
+ *
+ * @param ElggEntity $feed The feed object.
+ * @return string
+ */
+ function opendd_url($feed)
+ {
+ global $CONFIG;
+ return $CONFIG->wwwroot . "pg/opendd/" . $feed->getOwnerEntity()->username . "/view/{$feed->guid}";
+ }
+
+
+ // Make sure the groups initialisation function is called on initialisation
+ register_elgg_event_handler('init','system','opendd_init');
+?> \ No newline at end of file
diff --git a/mod/opendd/viewfeed.php b/mod/opendd/viewfeed.php
new file mode 100644
index 000000000..a581c834e
--- /dev/null
+++ b/mod/opendd/viewfeed.php
@@ -0,0 +1,75 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ $entity = get_entity(get_input('feed_guid'));
+ $limit = get_input("limit", 10);
+ $offset = get_input("offset", 0);
+
+ $body = elgg_view('opendd/profile', array('entity' => $entity));
+
+ $ctx = stream_context_create(array(
+ 'http' => array(
+ 'timeout' => 1
+ )
+ )
+ );
+
+ $data = file_get_contents($entity->feedurl);//, 0, $ctx);
+
+ if ($data)
+ {
+ $opendd = ODD_Import($data);
+
+ if ($opendd)
+ {
+ $objects = array();
+
+ $cnt = 0;
+ foreach ($opendd as $obj)
+ {
+ if (($cnt >= $offset) && ($cnt < $offset + $limit))
+ {
+ $tmp = new ElggObject();
+ $tmp->subtype = strtolower(get_class($obj));
+
+ $attr = $obj->getAttributes();
+ foreach ($attr as $k => $v)
+ {
+ $key = 'opendd:' . $k;
+ $tmp->$key = $v;
+ }
+
+ $key = 'opendd:body';
+ $tmp->$key = $obj->getBody();
+
+ $objects[] = $tmp;
+ }
+
+ $cnt++;
+ }
+
+ $context = get_context();
+ set_context('search');
+ $body .= elgg_view_entity_list($objects, $cnt, $offset, $limit, false);
+ set_context($context);
+
+ }
+ else
+ $body .= elgg_echo('opendd:noopenddfound');
+ }
+ else
+ $body .= sprintf(elgg_echo('opendd:nodata'), $http_response_header[0]);
+
+ // Finally draw the page
+ page_draw($vars['entity']->feedurl,elgg_view_layout('one_column', $body));
+?> \ No newline at end of file
diff --git a/mod/opendd/views/default/forms/opendd/subscribe.php b/mod/opendd/views/default/forms/opendd/subscribe.php
new file mode 100644
index 000000000..16f0e808b
--- /dev/null
+++ b/mod/opendd/views/default/forms/opendd/subscribe.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+?>
+<form action="<?php echo $vars['url']; ?>action/opendd/feed/subscribe" method="post">
+<?php
+ if (is_array($vars['config']->opendd) && sizeof($vars['config']->opendd) > 0)
+ foreach($vars['config']->opendd as $shortname => $valtype) {
+
+?>
+
+ <p>
+ <label>
+ <?php echo elgg_echo("opendd:{$shortname}") ?><br />
+ <?php echo elgg_view("input/{$valtype}",array(
+ 'internalname' => $shortname,
+ 'value' => $vars['entity']->$shortname,
+ )); ?>
+ </label>
+ </p>
+
+<?php
+
+ }
+
+?>
+ <?php if ($vars['entity']) { ?><input type="hidden" name="feed_guid" value="<?php echo $vars['entity']->guid; ?>" /><?php } ?>
+ <input type="hidden" name="user_guid" value="<?php echo page_owner_entity()->guid; ?>" />
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />
+</form> \ No newline at end of file
diff --git a/mod/opendd/views/default/object/oddentity.php b/mod/opendd/views/default/object/oddentity.php
new file mode 100644
index 000000000..43cba4a2f
--- /dev/null
+++ b/mod/opendd/views/default/object/oddentity.php
@@ -0,0 +1,25 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $entity = $vars['entity'];
+?>
+<div class="opendd_entity">
+ <div>
+ <p><?php echo elgg_echo('opendd:published'); ?>: <?php echo $entity->get('opendd:published'); ?></p>
+ </div>
+ <div>
+ <p><?php echo elgg_echo('opendd:entity:uuid'); ?>: <a href="<?php echo $entity->get('opendd:uuid'); ?>"><?php echo $entity->get('opendd:uuid'); ?></a></p>
+ </div>
+ <div>
+ <p><?php echo elgg_echo('opendd:entity:class'); ?>: <?php echo $entity->get('opendd:class'); ?></p>
+ <p><?php echo elgg_echo('opendd:entity:subclass'); ?>: <?php echo $entity->get('opendd:subclass'); ?></p>
+ </div>
+</div> \ No newline at end of file
diff --git a/mod/opendd/views/default/object/oddfeed.php b/mod/opendd/views/default/object/oddfeed.php
new file mode 100644
index 000000000..265a78257
--- /dev/null
+++ b/mod/opendd/views/default/object/oddfeed.php
@@ -0,0 +1,21 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ if ($vars['full']) {
+ echo elgg_view("opendd/profile",$vars);
+ } else {
+ if (get_input('search_viewtype') == "gallery") {
+ echo elgg_view('opendd/gallery',$vars);
+ } else {
+ echo elgg_view("opendd/listing",$vars);
+ }
+ }
+?> \ No newline at end of file
diff --git a/mod/opendd/views/default/object/oddmetadata.php b/mod/opendd/views/default/object/oddmetadata.php
new file mode 100644
index 000000000..cc63a09ec
--- /dev/null
+++ b/mod/opendd/views/default/object/oddmetadata.php
@@ -0,0 +1,30 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $entity = $vars['entity'];
+?>
+<div class="opendd_metadata">
+ <div>
+ <p><?php echo elgg_echo('opendd:published'); ?>: <?php echo $entity->get('opendd:published'); ?></p>
+ </div>
+ <div>
+ <p><?php echo elgg_echo('opendd:metadata:uuid'); ?>: <a href="<?php echo $entity->get('opendd:uuid'); ?>"><?php echo $entity->get('opendd:uuid'); ?></a></p>
+ </div>
+ <div>
+ <p><?php echo elgg_echo('opendd:metadata:entityuuid'); ?>: <a href="<?php echo $entity->get('opendd:entity_uuid'); ?>"><?php echo $entity->get('opendd:entity_uuid'); ?></a></p>
+ </div>
+ <div>
+ <p><?php echo elgg_echo('opendd:metadata:owneruuid'); ?>: <a href="<?php echo $entity->get('opendd:owner_uuid'); ?>"><?php echo $entity->get('opendd:owner_uuid'); ?></a></p>
+ </div>
+ <div>
+ <p><?php echo $entity->get('opendd:name'); ?> : <?php echo $entity->get('opendd:body'); ?></p>
+ </div>
+</div> \ No newline at end of file
diff --git a/mod/opendd/views/default/object/oddrelationship.php b/mod/opendd/views/default/object/oddrelationship.php
new file mode 100644
index 000000000..beb7847d4
--- /dev/null
+++ b/mod/opendd/views/default/object/oddrelationship.php
@@ -0,0 +1,25 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $entity = $vars['entity'];
+?>
+<div class="opendd_relationship">
+ <div>
+ <p><?php echo elgg_echo('opendd:published'); ?>: <?php echo $entity->get('opendd:published'); ?></p>
+ </div>
+ <div>
+ <p>
+ <a href="<?php echo $entity->get('opendd:uuid1'); ?>"><?php echo $entity->get('opendd:uuid1'); ?></a>
+ <b><?php echo $entity->get('opendd:type'); ?></b>
+ <a href="<?php echo $entity->get('opendd:uuid2'); ?>"><?php echo $entity->get('opendd:uuid2'); ?></a>
+ </p>
+ </div>
+</div> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/css.php b/mod/opendd/views/default/opendd/css.php
new file mode 100644
index 000000000..15c5adc7f
--- /dev/null
+++ b/mod/opendd/views/default/opendd/css.php
@@ -0,0 +1,3 @@
+<?php
+
+?> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/gallery.php b/mod/opendd/views/default/opendd/gallery.php
new file mode 100644
index 000000000..008c1c6bd
--- /dev/null
+++ b/mod/opendd/views/default/opendd/gallery.php
@@ -0,0 +1,25 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $icon = elgg_view(
+ "opendd/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'large',
+ )
+ );
+
+ $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->feedurl . "</a></b></p>";
+
+ // num users, last activity, owner etc
+
+
+ echo elgg_view('search/gallery_listing',array('icon' => $icon, 'info' => $info));
+?> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/icon.php b/mod/opendd/views/default/opendd/icon.php
new file mode 100644
index 000000000..bb8614ea7
--- /dev/null
+++ b/mod/opendd/views/default/opendd/icon.php
@@ -0,0 +1,36 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $group = $vars['entity'];
+
+ // Get size
+ if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar')))
+ $vars['size'] = "medium";
+
+ // Get any align and js
+ if (!empty($vars['align'])) {
+ $align = " align=\"{$vars['align']}\" ";
+ } else {
+ $align = "";
+ }
+
+ if ($icontime = $vars['entity']->icontime) {
+ $icontime = "{$icontime}";
+ } else {
+ $icontime = "default";
+ }
+
+
+?>
+
+<div class="groupicon">
+<a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><img src="<?php echo $vars['url']; ?>mod/opendd/graphics/default<?php echo $vars['size']; ?>" border="0" <?php echo $align; ?> <?php echo $vars['js']; ?> /></a>
+</div> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/link_logo.php b/mod/opendd/views/default/opendd/link_logo.php
new file mode 100644
index 000000000..1d1a81049
--- /dev/null
+++ b/mod/opendd/views/default/opendd/link_logo.php
@@ -0,0 +1,22 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+
+ $url = $vars['feed_url'];
+
+
+?>
+<div id="feed_icon">
+<a href="<?php echo $url; ?>">
+<img src="<?php echo $CONFIG->url . "mod/opendd/graphics/defaulttiny.jpg"; ?>" border="0" />
+</a>
+</div> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/links.php b/mod/opendd/views/default/opendd/links.php
new file mode 100644
index 000000000..15c5adc7f
--- /dev/null
+++ b/mod/opendd/views/default/opendd/links.php
@@ -0,0 +1,3 @@
+<?php
+
+?> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/listing.php b/mod/opendd/views/default/opendd/listing.php
new file mode 100644
index 000000000..748edc20c
--- /dev/null
+++ b/mod/opendd/views/default/opendd/listing.php
@@ -0,0 +1,26 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+
+ $icon = elgg_view(
+ "opendd/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
+
+ $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->feedurl . "</a></b></p>";
+
+ // num users, last activity, owner etc
+
+ echo elgg_view_listing($icon, $info);
+
+?> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/metatags.php b/mod/opendd/views/default/opendd/metatags.php
new file mode 100644
index 000000000..6cc130fc6
--- /dev/null
+++ b/mod/opendd/views/default/opendd/metatags.php
@@ -0,0 +1,16 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ global $CONFIG;
+ $owner = page_owner_entity();
+
+?>
+<link rel="alternate" type="application/odd+xml" title="OpenDD" href="<?php echo $CONFIG->url . "pg/opendd/{$owner->username}/activity/opendd" ?>" /> \ No newline at end of file
diff --git a/mod/opendd/views/default/opendd/profile.php b/mod/opendd/views/default/opendd/profile.php
new file mode 100644
index 000000000..ce4dc9e0f
--- /dev/null
+++ b/mod/opendd/views/default/opendd/profile.php
@@ -0,0 +1,109 @@
+<?php
+ /**
+ * Elgg OpenDD aggregator
+ *
+ * @package ElggOpenDD
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ if ($vars['full'] == true) {
+ $iconsize = "large";
+ } else {
+ $iconsize = "medium";
+ }
+?>
+
+<table>
+ <tr>
+ <td>
+
+ <div id="opendd_info_column_left">
+ <div id="opendd_icon_wrapper">
+
+ <?php
+ echo elgg_view(
+ "opendd/icon", array(
+ 'entity' => $vars['entity'],
+ //'align' => "left",
+ 'size' => $iconsize,
+ )
+ );
+
+ // display relevant links
+ echo elgg_view("opendd/links", array("entity" => $vars['entity']));
+ ?>
+
+ </div>
+ </div>
+
+ </td>
+
+ <td>
+ <div id="opendd_info_column_right">
+
+ <?php
+ echo "<h2><a href=\"" . $vars['entity']->feedurl. "\">" . $vars['entity']->feedurl . "</a></h2> <br />";
+
+ ?>
+
+ <?php
+
+ if ($vars['full'] == true) {
+ if (is_array($vars['config']->opendd) && sizeof($vars['config']->opendd) > 0)
+ {
+
+ foreach($vars['config']->opendd as $shortname => $valtype) {
+ if ($shortname != "title") {
+ $value = $vars['entity']->$shortname;
+
+ if (!empty($value)) {
+
+ //This function controls the alternating class
+ $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
+ }
+
+ echo "<p class=\"{$even_odd}\">";
+ echo "<b>";
+ echo elgg_echo("opendd:{$shortname}");
+ echo ": </b>";
+
+ echo elgg_view("output/{$valtype}",array('value' => $vars['entity']->$shortname));
+
+ echo "</p>";
+ }
+ }
+ }
+ }
+
+
+ ?>
+
+ </div>
+ </td>
+ </tr>
+</table>
+
+<div id="opendd_info_wide">
+
+ <p class="opendd_info_edit_buttons">
+
+<?php
+ if ($vars['entity']->canEdit())
+ {
+
+?>
+
+ <a href="<?php echo $vars['url']; ?>mod/opendd/edit.php?feed_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("edit"); ?></a>
+ &nbsp;
+ <a href="<?php echo $vars['url']; ?>action/opendd/feed/delete?feed_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("delete"); ?></a>
+<?php
+
+ }
+
+?>
+
+ </p>
+</div>