summaryrefslogtreecommitdiff
path: root/app/Templates
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-08-15 17:23:41 -0700
committerFrédéric Guillot <fred@kanboard.net>2014-08-15 17:23:41 -0700
commit9eeded33f68872515954a2fc177fcb47a9273ae9 (patch)
treef3ef9507e087ca6bf3ce624232da240a8689b051 /app/Templates
parentc539bdc8ab746c5afd48cf87de057dc38d50adac (diff)
Add email notifications
Diffstat (limited to 'app/Templates')
-rw-r--r--app/Templates/comment_edit.php1
-rw-r--r--app/Templates/config_index.php27
-rw-r--r--app/Templates/notification_comment_creation.php8
-rw-r--r--app/Templates/notification_comment_update.php8
-rw-r--r--app/Templates/notification_file_creation.php6
-rw-r--r--app/Templates/notification_subtask_creation.php18
-rw-r--r--app/Templates/notification_subtask_update.php22
-rw-r--r--app/Templates/notification_task_close.php6
-rw-r--r--app/Templates/notification_task_creation.php44
-rw-r--r--app/Templates/notification_task_due.php10
-rw-r--r--app/Templates/notification_task_open.php6
-rw-r--r--app/Templates/notification_task_update.php44
12 files changed, 192 insertions, 8 deletions
diff --git a/app/Templates/comment_edit.php b/app/Templates/comment_edit.php
index 52695f00..4ce48964 100644
--- a/app/Templates/comment_edit.php
+++ b/app/Templates/comment_edit.php
@@ -6,6 +6,7 @@
<?= Helper\form_csrf() ?>
<?= Helper\form_hidden('id', $values) ?>
+ <?= Helper\form_hidden('task_id', $values) ?>
<?= Helper\form_textarea('comment', $values, $errors, array('autofocus', 'required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?><br/>
<div class="form-actions">
diff --git a/app/Templates/config_index.php b/app/Templates/config_index.php
index 91919776..11662c87 100644
--- a/app/Templates/config_index.php
+++ b/app/Templates/config_index.php
@@ -31,14 +31,25 @@
<div class="page-header">
<h2><?= t('User settings') ?></h2>
</div>
- <section class="settings">
- <ul>
- <li>
- <strong><?= t('My default project:') ?> </strong>
- <?= (isset($user['default_project_id']) && isset($projects[$user['default_project_id']])) ? Helper\escape($projects[$user['default_project_id']]) : t('None') ?>,
- <a href="?controller=user&amp;action=edit&amp;user_id=<?= $user['id'] ?>"><?= t('edit') ?></a>
- </li>
- </ul>
+ <section>
+ <h3 id="notifications"><?= t('Email notifications') ?></h3>
+ <form method="post" action="?controller=config&amp;action=notifications" autocomplete="off">
+
+ <?= Helper\form_csrf() ?>
+
+ <?= Helper\form_checkbox('notifications_enabled', t('Enable email notifications'), '1', $notifications['notifications_enabled'] == 1) ?><br/>
+
+ <p><?= t('I want to receive notifications only for those projects:') ?><br/><br/></p>
+
+ <div class="form-checkbox-group">
+ <?php foreach ($user_projects as $project_id => $project_name): ?>
+ <?= Helper\form_checkbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?>
+ <?php endforeach ?>
+ </div>
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ </div>
+ </form>
</section>
<?php if ($user['is_admin']): ?>
diff --git a/app/Templates/notification_comment_creation.php b/app/Templates/notification_comment_creation.php
new file mode 100644
index 00000000..ff286790
--- /dev/null
+++ b/app/Templates/notification_comment_creation.php
@@ -0,0 +1,8 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<h3><?= t('New comment posted by %s', $comment['username']) ?></h3>
+
+<?= Helper\parse($comment['comment']) ?>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_comment_update.php b/app/Templates/notification_comment_update.php
new file mode 100644
index 00000000..9dbd2332
--- /dev/null
+++ b/app/Templates/notification_comment_update.php
@@ -0,0 +1,8 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<h3><?= t('Comment updated') ?></h3>
+
+<?= Helper\parse($comment['comment']) ?>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_file_creation.php b/app/Templates/notification_file_creation.php
new file mode 100644
index 00000000..57d69f51
--- /dev/null
+++ b/app/Templates/notification_file_creation.php
@@ -0,0 +1,6 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<h3><?= t('New attachment added "%s"', $file['name']) ?></h3>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_subtask_creation.php b/app/Templates/notification_subtask_creation.php
new file mode 100644
index 00000000..e02ceaf0
--- /dev/null
+++ b/app/Templates/notification_subtask_creation.php
@@ -0,0 +1,18 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<h3><?= t('New sub-task') ?></h3>
+
+<ul>
+ <li><?= t('Title:') ?> <?= Helper\escape($subtask['title']) ?></li>
+ <li><?= t('Status:') ?> <?= Helper\escape($subtask['status_name']) ?></li>
+ <li><?= t('Assignee:') ?> <?= Helper\escape($subtask['name'] ?: $subtask['username'] ?: '?') ?></li>
+ <li>
+ <?= t('Time tracking:') ?>
+ <?php if (! empty($subtask['time_estimated'])): ?>
+ <strong><?= Helper\escape($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
+ </li>
+</ul>
+
+<hr/>
+<p>Kanboard</p>
diff --git a/app/Templates/notification_subtask_update.php b/app/Templates/notification_subtask_update.php
new file mode 100644
index 00000000..5ec5ed05
--- /dev/null
+++ b/app/Templates/notification_subtask_update.php
@@ -0,0 +1,22 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<h3><?= t('Sub-task updated') ?></h3>
+
+<ul>
+ <li><?= t('Title:') ?> <?= Helper\escape($subtask['title']) ?></li>
+ <li><?= t('Status:') ?> <?= Helper\escape($subtask['status_name']) ?></li>
+ <li><?= t('Assignee:') ?> <?= Helper\escape($subtask['name'] ?: $subtask['username'] ?: '?') ?></li>
+ <li>
+ <?= t('Time tracking:') ?>
+ <?php if (! empty($subtask['time_spent'])): ?>
+ <strong><?= Helper\escape($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?>
+ <?php endif ?>
+
+ <?php if (! empty($subtask['time_estimated'])): ?>
+ <strong><?= Helper\escape($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
+ </li>
+</ul>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_task_close.php b/app/Templates/notification_task_close.php
new file mode 100644
index 00000000..8b8cedb3
--- /dev/null
+++ b/app/Templates/notification_task_close.php
@@ -0,0 +1,6 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<p><?= t('The task #%d have been closed.', $task['id']) ?></p>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_task_creation.php b/app/Templates/notification_task_creation.php
new file mode 100644
index 00000000..9515e889
--- /dev/null
+++ b/app/Templates/notification_task_creation.php
@@ -0,0 +1,44 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<ul>
+ <li>
+ <?= dt('Created on %B %e, %Y at %k:%M %p', $task['date_creation']) ?>
+ </li>
+ <?php if ($task['date_due']): ?>
+ <li>
+ <strong><?= dt('Must be done before %B %e, %Y', $task['date_due']) ?></strong>
+ </li>
+ <?php endif ?>
+ <?php if ($task['creator_username']): ?>
+ <li>
+ <?= t('Created by %s', $task['creator_username']) ?>
+ </li>
+ <?php endif ?>
+ <li>
+ <strong>
+ <?php if ($task['assignee_username']): ?>
+ <?= t('Assigned to %s', $task['assignee_username']) ?>
+ <?php else: ?>
+ <?= t('There is nobody assigned') ?>
+ <?php endif ?>
+ </strong>
+ </li>
+ <li>
+ <?= t('Column on the board:') ?>
+ <strong><?= Helper\escape($task['column_title']) ?></strong>
+ </li>
+ <li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
+ <?php if ($task['category_name']): ?>
+ <li>
+ <?= t('Category:') ?> <strong><?= Helper\escape($task['category_name']) ?></strong>
+ </li>
+ <?php endif ?>
+</ul>
+
+<?php if (! empty($task['description'])): ?>
+ <h2><?= t('Description') ?></h2>
+ <?= Helper\parse($task['description']) ?>
+<?php endif ?>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_task_due.php b/app/Templates/notification_task_due.php
new file mode 100644
index 00000000..1686c7de
--- /dev/null
+++ b/app/Templates/notification_task_due.php
@@ -0,0 +1,10 @@
+<h2><?= t('List of due tasks for the project "%s"', $project) ?></h2>
+
+<ul>
+ <?php foreach ($tasks as $task): ?>
+ <li>(<strong>#<?= $task['id'] ?></strong>) <?= Helper\escape($task['title']) ?> (<strong><?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?></strong>)</li>
+ <?php endforeach ?>
+</ul>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_task_open.php b/app/Templates/notification_task_open.php
new file mode 100644
index 00000000..2ef0f04f
--- /dev/null
+++ b/app/Templates/notification_task_open.php
@@ -0,0 +1,6 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<p><?= t('The task #%d have been opened.', $task['id']) ?></p>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file
diff --git a/app/Templates/notification_task_update.php b/app/Templates/notification_task_update.php
new file mode 100644
index 00000000..28be9db2
--- /dev/null
+++ b/app/Templates/notification_task_update.php
@@ -0,0 +1,44 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<ul>
+ <li>
+ <?= dt('Created on %B %e, %Y at %k:%M %p', $task['date_creation']) ?>
+ </li>
+ <?php if ($task['date_due']): ?>
+ <li>
+ <strong><?= dt('Must be done before %B %e, %Y', $task['date_due']) ?></strong>
+ </li>
+ <?php endif ?>
+ <?php if ($task['creator_username']): ?>
+ <li>
+ <?= t('Created by %s', $task['creator_username']) ?>
+ </li>
+ <?php endif ?>
+ <li>
+ <strong>
+ <?php if ($task['assignee_username']): ?>
+ <?= t('Assigned to %s', $task['assignee_username']) ?>
+ <?php else: ?>
+ <?= t('There is nobody assigned') ?>
+ <?php endif ?>
+ </strong>
+ </li>
+ <li>
+ <?= t('Column on the board:') ?>
+ <strong><?= Helper\escape($task['column_title']) ?></strong>
+ </li>
+ <li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
+ <?php if ($task['category_name']): ?>
+ <li>
+ <?= t('Category:') ?> <strong><?= Helper\escape($task['category_name']) ?></strong>
+ </li>
+ <?php endif ?>
+</ul>
+
+<?php if (! empty($task['description'])): ?>
+ <h2><?= t('Description') ?></h2>
+ <?= Helper\parse($task['description']) ?: t('There is no description.') ?>
+<?php endif ?>
+
+<hr/>
+<p>Kanboard</p> \ No newline at end of file