summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-03-03 19:52:28 -0500
committerSarven Capadisli <csarven@status.net>2010-03-03 19:52:28 -0500
commit0994589b7389caa609f9b93e7c1572463b7dca36 (patch)
tree5e7e71df492aa09cbacca44232c7479f12f8ce22 /lib
parenta26d23b39515e42a2f5437203d90d583d9a1be89 (diff)
parent61de37ec7bfb620288d3bc3b1fcdfb66725f0f99 (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'lib')
-rw-r--r--lib/adminpanelaction.php5
-rw-r--r--lib/atom10feed.php20
-rw-r--r--lib/atomgroupnoticefeed.php32
-rw-r--r--lib/atomusernoticefeed.php41
-rw-r--r--lib/router.php1
5 files changed, 92 insertions, 7 deletions
diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php
index eb622871e..d1aab3dfc 100644
--- a/lib/adminpanelaction.php
+++ b/lib/adminpanelaction.php
@@ -381,6 +381,11 @@ class AdminPanelNav extends Widget
_('Edit site notice'), $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
}
+ if (AdminPanelAction::canAdmin('snapshot')) {
+ $this->out->menuItem(common_local_url('snapshotadminpanel'), _('Snapshots'),
+ _('Snapshots configuration'), $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
+ }
+
Event::handle('EndAdminPanelNav', array($this));
}
$this->action->elementEnd('ul');
diff --git a/lib/atom10feed.php b/lib/atom10feed.php
index 8842840d5..c1fdeaae9 100644
--- a/lib/atom10feed.php
+++ b/lib/atom10feed.php
@@ -49,6 +49,8 @@ class Atom10FeedException extends Exception
class Atom10Feed extends XMLStringer
{
public $xw;
+
+ // @fixme most of these should probably be read-only properties
private $namespaces;
private $authors;
private $subject;
@@ -57,10 +59,12 @@ class Atom10Feed extends XMLStringer
private $generator;
private $icon;
private $links;
- private $logo;
+ private $selfLink;
+ private $selfLinkType;
+ public $logo;
private $rights;
- private $subtitle;
- private $title;
+ public $subtitle;
+ public $title;
private $published;
private $updated;
private $entries;
@@ -184,6 +188,10 @@ class Atom10Feed extends XMLStringer
$this->renderAuthors();
+ if ($this->selfLink) {
+ $this->addLink($this->selfLink, array('rel' => 'self',
+ 'type' => $this->selfLinkType));
+ }
$this->renderLinks();
}
@@ -253,6 +261,12 @@ class Atom10Feed extends XMLStringer
$this->id = $id;
}
+ function setSelfLink($url, $type='application/atom+xml')
+ {
+ $this->selfLink = $url;
+ $this->selfLinkType = $type;
+ }
+
function setTitle($title)
{
$this->title = $title;
diff --git a/lib/atomgroupnoticefeed.php b/lib/atomgroupnoticefeed.php
index 52ee4c7d6..08c1c707c 100644
--- a/lib/atomgroupnoticefeed.php
+++ b/lib/atomgroupnoticefeed.php
@@ -49,14 +49,42 @@ class AtomGroupNoticeFeed extends AtomNoticeFeed
/**
* Constructor
*
- * @param Group $group the group for the feed (optional)
+ * @param Group $group the group for the feed
* @param boolean $indent flag to turn indenting on or off
*
* @return void
*/
- function __construct($group = null, $indent = true) {
+ function __construct($group, $indent = true) {
parent::__construct($indent);
$this->group = $group;
+
+ $title = sprintf(_("%s timeline"), $group->nickname);
+ $this->setTitle($title);
+
+ $sitename = common_config('site', 'name');
+ $subtitle = sprintf(
+ _('Updates from %1$s on %2$s!'),
+ $group->nickname,
+ $sitename
+ );
+ $this->setSubtitle($subtitle);
+
+ $avatar = $group->homepage_logo;
+ $logo = ($avatar) ? $avatar : User_group::defaultLogo(AVATAR_PROFILE_SIZE);
+ $this->setLogo($logo);
+
+ $this->setUpdated('now');
+
+ $self = common_local_url('ApiTimelineGroup',
+ array('id' => $group->id,
+ 'format' => 'atom'));
+ $this->setId($self);
+ $this->setSelfLink($self);
+
+ $this->addAuthorRaw($group->asAtomAuthor());
+ $this->setActivitySubject($group->asActivitySubject());
+
+ $this->addLink($group->homeUrl());
}
function getGroup()
diff --git a/lib/atomusernoticefeed.php b/lib/atomusernoticefeed.php
index 2ad8de455..55cebef6d 100644
--- a/lib/atomusernoticefeed.php
+++ b/lib/atomusernoticefeed.php
@@ -49,19 +49,56 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
/**
* Constructor
*
- * @param User $user the user for the feed (optional)
+ * @param User $user the user for the feed
* @param boolean $indent flag to turn indenting on or off
*
* @return void
*/
- function __construct($user = null, $indent = true) {
+ function __construct($user, $indent = true) {
parent::__construct($indent);
$this->user = $user;
if (!empty($user)) {
$profile = $user->getProfile();
$this->addAuthor($profile->nickname, $user->uri);
}
+
+ $title = sprintf(_("%s timeline"), $user->nickname);
+ $this->setTitle($title);
+
+ $sitename = common_config('site', 'name');
+ $subtitle = sprintf(
+ _('Updates from %1$s on %2$s!'),
+ $user->nickname, $sitename
+ );
+ $this->setSubtitle($subtitle);
+
+ $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
+ $logo = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
+ $this->setLogo($logo);
+
+ $this->setUpdated('now');
+
+ $this->addLink(
+ common_local_url(
+ 'showstream',
+ array('nickname' => $user->nickname)
+ )
+ );
+
+ $self = common_local_url('ApiTimelineUser',
+ array('id' => $user->id,
+ 'format' => 'atom'));
+ $this->setId($self);
+ $this->setSelfLink($self);
+
+ $this->addLink(
+ common_local_url('sup', null, null, $user->id),
+ array(
+ 'rel' => 'http://api.friendfeed.com/2008/03#sup',
+ 'type' => 'application/json'
+ )
+ );
}
function getUser()
diff --git a/lib/router.php b/lib/router.php
index 15f88c959..706120e0b 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -651,6 +651,7 @@ class Router
$m->connect('admin/paths', array('action' => 'pathsadminpanel'));
$m->connect('admin/sessions', array('action' => 'sessionsadminpanel'));
$m->connect('admin/sitenotice', array('action' => 'sitenoticeadminpanel'));
+ $m->connect('admin/snapshot', array('action' => 'snapshotadminpanel'));
$m->connect('getfile/:filename',
array('action' => 'getfile'),