summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-10 18:12:12 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-10 18:12:12 +0200
commitbb5b5dee2d7ef2244300ff622d11d5a32f6ba55f (patch)
treec1bce860c2ac54c7102fb269ee40925b6c92fc0f
parentcede5d5434e4e50145daf2413c962a335c13cc99 (diff)
Add Atom feed for project activity
-rw-r--r--app/Controller/Project.php21
-rw-r--r--app/Model/Acl.php1
-rw-r--r--app/Templates/project_activity.php3
-rw-r--r--app/Templates/project_feed.php27
-rw-r--r--app/Templates/project_share.php5
-rw-r--r--app/Templates/project_show.php3
-rw-r--r--app/Templates/user_external.php4
-rw-r--r--app/Templates/user_index.php4
-rw-r--r--assets/css/app.css4
9 files changed, 66 insertions, 6 deletions
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
@@ -406,6 +406,27 @@ class Project extends Base
}
/**
+ * 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
*
* @access public
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 @@
<?php if (empty($events)): ?>
<p class="alert"><?= t('No activity.') ?></p>
<?php else: ?>
+
+ <p class="pull-right"><i class="fa fa-rss-square"></i> <a href="?controller=project&amp;action=feed&amp;token=<?= $project['token'] ?>" target="_blank"><?= t('RSS feed') ?></a></p>
+
<?php foreach ($events as $event): ?>
<div class="activity-event">
<p class="activity-datetime">
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 @@
+<?= '<?xml version="1.0" encoding="utf-8"?>' ?>
+<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
+ <title><?= t('%s\'s activity', $project['name']) ?></title>
+ <link rel="alternate" type="text/html" href="<?= Helper\get_current_base_url() ?>"/>
+ <link rel="self" type="application/atom+xml" href="<?= Helper\get_current_base_url() ?>?controller=project&amp;action=feed&amp;token=<?= $project['token'] ?>"/>
+ <updated><?= date(DATE_ATOM) ?></updated>
+ <id><?= Helper\get_current_base_url() ?></id>
+ <icon><?= Helper\get_current_base_url() ?>assets/img/favicon.png</icon>
+
+ <?php foreach ($events as $e): ?>
+ <entry>
+ <title type="text"><?= $e['event_title'] ?></title>
+ <link rel="alternate" href="<?= Helper\get_current_base_url().'?controller=task&amp;action=show&amp;task_id='.$e['task_id'] ?>"/>
+ <id><?= $e['id'].'-'.$e['event_name'].'-'.$e['task_id'].'-'.$e['date_creation'] ?></id>
+ <published><?= date(DATE_ATOM, $e['date_creation']) ?></published>
+ <updated><?= date(DATE_ATOM, $e['date_creation']) ?></updated>
+ <author>
+ <name><?= Helper\escape($e['author']) ?></name>
+ </author>
+ <content type="html">
+ <![CDATA[
+ <?= $e['event_content'] ?>
+ ]]>
+ </content>
+ </entry>
+ <?php endforeach ?>
+</feed> \ 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 @@
<?php if ($project['is_public']): ?>
<div class="settings">
- <strong><a href="?controller=board&amp;action=readonly&amp;token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></strong><br/>
+ <ul class="no-bullet">
+ <li><strong><i class="fa fa-share-alt"></i> <a href="?controller=board&amp;action=readonly&amp;token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></strong></li>
+ <li><strong><i class="fa fa-rss-square"></i> <a href="?controller=project&amp;action=feed&amp;token=<?= $project['token'] ?>" target="_blank"><?= t('RSS feed') ?></a></strong></li>
+ </ul>
<input type="text" readonly="readonly" value="<?= Helper\get_current_base_url() ?>?controller=board&amp;action=readonly&amp;token=<?= $project['token'] ?>"/>
</div>
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 @@
<li><strong><?= $project['is_active'] ? t('Active') : t('Inactive') ?></strong></li>
<?php if ($project['is_public']): ?>
- <li><a href="?controller=board&amp;action=readonly&amp;token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></li>
+ <li><i class="fa fa-share-alt"></i> <a href="?controller=board&amp;action=readonly&amp;token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></li>
+ <li><i class="fa fa-rss-square"></i> <a href="?controller=project&amp;action=feed&amp;token=<?= $project['token'] ?>" target="_blank"><?= t('RSS feed') ?></a></li>
<?php else: ?>
<li><?= t('Public access disabled') ?></li>
<?php endif ?>
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 @@
</div>
<?php if (GOOGLE_AUTH): ?>
- <h3><?= t('Google Account') ?></h3>
+ <h3><i class="fa fa-google"></i> <?= t('Google Account') ?></h3>
<p class="settings">
<?php if (Helper\is_current_user($user['id'])): ?>
@@ -19,7 +19,7 @@
<?php endif ?>
<?php if (GITHUB_AUTH): ?>
- <h3><?= t('Github Account') ?></h3>
+ <h3><i class="fa fa-github"></i> <?= t('Github Account') ?></h3>
<p class="settings">
<?php if (Helper\is_current_user($user['id'])): ?>
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 @@
<td>
<ul class="no-bullet">
<?php if ($user['google_id']): ?>
- <li><?= t('Google account linked') ?></li>
+ <li><i class="fa fa-google"></i> <?= t('Google account linked') ?></li>
<?php endif ?>
<?php if ($user['github_id']): ?>
- <li><?= t('Github account linked') ?></li>
+ <li><i class="fa fa-github"></i> <?= t('Github account linked') ?></li>
<?php endif ?>
</ul>
</td>
diff --git a/assets/css/app.css b/assets/css/app.css
index 97e84b47..abe8130d 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -65,6 +65,10 @@ ul.no-bullet li {
margin-left: 0;
}
+.pull-right {
+ text-align: right;
+}
+
/* tables */
table {
width: 100%;