From bb5b5dee2d7ef2244300ff622d11d5a32f6ba55f Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Wed, 10 Sep 2014 18:12:12 +0200 Subject: Add Atom feed for project activity --- app/Controller/Project.php | 21 +++++++++++++++++++++ app/Model/Acl.php | 1 + app/Templates/project_activity.php | 3 +++ app/Templates/project_feed.php | 27 +++++++++++++++++++++++++++ app/Templates/project_share.php | 5 ++++- app/Templates/project_show.php | 3 ++- app/Templates/user_external.php | 4 ++-- app/Templates/user_index.php | 4 ++-- 8 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 app/Templates/project_feed.php (limited to 'app') diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 6356a9c6..ef9eac6b 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -405,6 +405,27 @@ class Project extends Base $this->response->redirect('?controller=project&action=show&project_id='.$project_id); } + /** + * RSS feed for a project + * + * @access public + */ + public function feed() + { + $token = $this->request->getStringParam('token'); + $project = $this->project->getByToken($token); + + // Token verification + if (! $project) { + $this->forbidden(true); + } + + $this->response->xml($this->template->load('project_feed', array( + 'events' => $this->project->getActivity($project['id']), + 'project' => $project, + ))); + } + /** * Activity page for a project * diff --git a/app/Model/Acl.php b/app/Model/Acl.php index ca00a09e..aea13e8c 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -20,6 +20,7 @@ class Acl extends Base 'user' => array('login', 'check', 'google', 'github'), 'task' => array('add', 'readonly'), 'board' => array('readonly'), + 'project' => array('feed'), ); /** diff --git a/app/Templates/project_activity.php b/app/Templates/project_activity.php index b79d97f9..86e17e7f 100644 --- a/app/Templates/project_activity.php +++ b/app/Templates/project_activity.php @@ -12,6 +12,9 @@

+ +

+

diff --git a/app/Templates/project_feed.php b/app/Templates/project_feed.php new file mode 100644 index 00000000..b47c87ad --- /dev/null +++ b/app/Templates/project_feed.php @@ -0,0 +1,27 @@ +' ?> + + <?= t('%s\'s activity', $project['name']) ?> + + + + + assets/img/favicon.png + + + + <?= $e['event_title'] ?> + + + + + + + + + + ]]> + + + + \ No newline at end of file diff --git a/app/Templates/project_share.php b/app/Templates/project_share.php index 62e05b73..6cfd85f6 100644 --- a/app/Templates/project_share.php +++ b/app/Templates/project_share.php @@ -5,7 +5,10 @@

-
+
    +
  • +
  • +
diff --git a/app/Templates/project_show.php b/app/Templates/project_show.php index 12b0ae64..98ffb581 100644 --- a/app/Templates/project_show.php +++ b/app/Templates/project_show.php @@ -5,7 +5,8 @@
  • -
  • +
  • +
  • diff --git a/app/Templates/user_external.php b/app/Templates/user_external.php index 727cd2bf..a67d886e 100644 --- a/app/Templates/user_external.php +++ b/app/Templates/user_external.php @@ -3,7 +3,7 @@
    -

    +

    @@ -19,7 +19,7 @@ -

    +

    diff --git a/app/Templates/user_index.php b/app/Templates/user_index.php index 7e9197b5..d4e1bbf9 100644 --- a/app/Templates/user_index.php +++ b/app/Templates/user_index.php @@ -53,10 +53,10 @@

    -- cgit v1.2.3