Add Atom feed for project activity
This commit is contained in:
parent
cede5d5434
commit
bb5b5dee2d
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class Acl extends Base
|
|||
'user' => array('login', 'check', 'google', 'github'),
|
||||
'task' => array('add', 'readonly'),
|
||||
'board' => array('readonly'),
|
||||
'project' => array('feed'),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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&action=feed&token=<?= $project['token'] ?>" target="_blank"><?= t('RSS feed') ?></a></p>
|
||||
|
||||
<?php foreach ($events as $event): ?>
|
||||
<div class="activity-event">
|
||||
<p class="activity-datetime">
|
||||
|
|
|
|||
|
|
@ -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&action=feed&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&action=show&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>
|
||||
|
|
@ -5,7 +5,10 @@
|
|||
<?php if ($project['is_public']): ?>
|
||||
|
||||
<div class="settings">
|
||||
<strong><a href="?controller=board&action=readonly&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&action=readonly&token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></strong></li>
|
||||
<li><strong><i class="fa fa-rss-square"></i> <a href="?controller=project&action=feed&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&action=readonly&token=<?= $project['token'] ?>"/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -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&action=readonly&token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></li>
|
||||
<li><i class="fa fa-share-alt"></i> <a href="?controller=board&action=readonly&token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></li>
|
||||
<li><i class="fa fa-rss-square"></i> <a href="?controller=project&action=feed&token=<?= $project['token'] ?>" target="_blank"><?= t('RSS feed') ?></a></li>
|
||||
<?php else: ?>
|
||||
<li><?= t('Public access disabled') ?></li>
|
||||
<?php endif ?>
|
||||
|
|
|
|||
|
|
@ -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'])): ?>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ ul.no-bullet li {
|
|||
margin-left: 0;
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* tables */
|
||||
table {
|
||||
width: 100%;
|
||||
|
|
|
|||
Loading…
Reference in New Issue