summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Model/Notification.php52
-rw-r--r--app/Model/ProjectActivity.php2
-rw-r--r--app/Template/event/comment_create.php (renamed from app/Template/event_comment_create.php)0
-rw-r--r--app/Template/event/comment_update.php (renamed from app/Template/event_comment_update.php)0
-rw-r--r--app/Template/event/subtask_create.php (renamed from app/Template/event_subtask_create.php)0
-rw-r--r--app/Template/event/subtask_update.php (renamed from app/Template/event_subtask_update.php)0
-rw-r--r--app/Template/event/task_assignee_change.php (renamed from app/Template/event_task_assignee_change.php)0
-rw-r--r--app/Template/event/task_close.php (renamed from app/Template/event_task_close.php)0
-rw-r--r--app/Template/event/task_create.php (renamed from app/Template/event_task_create.php)0
-rw-r--r--app/Template/event/task_move_column.php (renamed from app/Template/event_task_move_column.php)0
-rw-r--r--app/Template/event/task_move_position.php (renamed from app/Template/event_task_move_position.php)0
-rw-r--r--app/Template/event/task_open.php (renamed from app/Template/event_task_open.php)0
-rw-r--r--app/Template/event/task_update.php (renamed from app/Template/event_task_update.php)0
-rw-r--r--app/Template/notification/comment_creation.php (renamed from app/Template/notification_comment_creation.php)2
-rw-r--r--app/Template/notification/comment_update.php (renamed from app/Template/notification_comment_update.php)2
-rw-r--r--app/Template/notification/file_creation.php5
-rw-r--r--app/Template/notification/footer.php (renamed from app/Template/notification_footer.php)0
-rw-r--r--app/Template/notification/subtask_creation.php (renamed from app/Template/notification_subtask_creation.php)2
-rw-r--r--app/Template/notification/subtask_update.php (renamed from app/Template/notification_subtask_update.php)2
-rw-r--r--app/Template/notification/task_assignee_change.php (renamed from app/Template/notification_task_assignee_change.php)2
-rw-r--r--app/Template/notification/task_close.php (renamed from app/Template/notification_task_close.php)2
-rw-r--r--app/Template/notification/task_creation.php (renamed from app/Template/notification_task_creation.php)2
-rw-r--r--app/Template/notification/task_due.php (renamed from app/Template/notification_task_due.php)2
-rw-r--r--app/Template/notification/task_move_column.php (renamed from app/Template/notification_task_move_column.php)2
-rw-r--r--app/Template/notification/task_move_position.php (renamed from app/Template/notification_task_move_position.php)2
-rw-r--r--app/Template/notification/task_open.php (renamed from app/Template/notification_task_open.php)2
-rw-r--r--app/Template/notification/task_update.php (renamed from app/Template/notification_task_update.php)2
-rw-r--r--app/Template/notification_file_creation.php5
-rw-r--r--app/Template/user_notifications.php15
29 files changed, 53 insertions, 50 deletions
diff --git a/app/Model/Notification.php b/app/Model/Notification.php
index 32765041..8d1fca09 100644
--- a/app/Model/Notification.php
+++ b/app/Model/Notification.php
@@ -101,18 +101,18 @@ class Notification extends Base
public function attachEvents()
{
$events = array(
- Task::EVENT_CREATE => 'notification_task_creation',
- Task::EVENT_UPDATE => 'notification_task_update',
- Task::EVENT_CLOSE => 'notification_task_close',
- Task::EVENT_OPEN => 'notification_task_open',
- Task::EVENT_MOVE_COLUMN => 'notification_task_move_column',
- Task::EVENT_MOVE_POSITION => 'notification_task_move_position',
- Task::EVENT_ASSIGNEE_CHANGE => 'notification_task_assignee_change',
- SubTask::EVENT_CREATE => 'notification_subtask_creation',
- SubTask::EVENT_UPDATE => 'notification_subtask_update',
- Comment::EVENT_CREATE => 'notification_comment_creation',
- Comment::EVENT_UPDATE => 'notification_comment_update',
- File::EVENT_CREATE => 'notification_file_creation',
+ Task::EVENT_CREATE => 'task_creation',
+ Task::EVENT_UPDATE => 'task_update',
+ Task::EVENT_CLOSE => 'task_close',
+ Task::EVENT_OPEN => 'task_open',
+ Task::EVENT_MOVE_COLUMN => 'task_move_column',
+ Task::EVENT_MOVE_POSITION => 'task_move_position',
+ Task::EVENT_ASSIGNEE_CHANGE => 'task_assignee_change',
+ SubTask::EVENT_CREATE => 'subtask_creation',
+ SubTask::EVENT_UPDATE => 'subtask_update',
+ Comment::EVENT_CREATE => 'comment_creation',
+ Comment::EVENT_UPDATE => 'comment_update',
+ File::EVENT_CREATE => 'file_creation',
);
foreach ($events as $event_name => $template_name) {
@@ -162,43 +162,43 @@ class Notification extends Base
public function getMailSubject($template, array $data)
{
switch ($template) {
- case 'notification_file_creation':
+ case 'file_creation':
$subject = e('[%s][New attachment] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_comment_creation':
+ case 'comment_creation':
$subject = e('[%s][New comment] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_comment_update':
+ case 'comment_update':
$subject = e('[%s][Comment updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_subtask_creation':
+ case 'subtask_creation':
$subject = e('[%s][New subtask] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_subtask_update':
+ case 'subtask_update':
$subject = e('[%s][Subtask updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_creation':
+ case 'task_creation':
$subject = e('[%s][New task] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_update':
+ case 'task_update':
$subject = e('[%s][Task updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_close':
+ case 'task_close':
$subject = e('[%s][Task closed] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_open':
+ case 'task_open':
$subject = e('[%s][Task opened] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_move_column':
+ case 'task_move_column':
$subject = e('[%s][Column Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_move_position':
+ case 'task_move_position':
$subject = e('[%s][Position Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_assignee_change':
+ case 'task_assignee_change':
$subject = e('[%s][Assignee Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
break;
- case 'notification_task_due':
+ case 'task_due':
$subject = e('[%s][Due tasks]', $data['project']);
break;
default:
@@ -218,7 +218,7 @@ class Notification extends Base
public function getMailContent($template, array $data)
{
$tpl = new Template;
- return $tpl->load($template, $data + array('application_url' => $this->config->get('application_url')));
+ return $tpl->load('notification/'.$template, $data + array('application_url' => $this->config->get('application_url')));
}
/**
diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php
index 9d7ecfac..000dfa09 100644
--- a/app/Model/ProjectActivity.php
+++ b/app/Model/ProjectActivity.php
@@ -164,7 +164,7 @@ class ProjectActivity extends Base
public function getContent(array $params)
{
$tpl = new Template;
- return $tpl->load('event_'.str_replace('.', '_', $params['event_name']), $params);
+ return $tpl->load('event/'.str_replace('.', '_', $params['event_name']), $params);
}
/**
diff --git a/app/Template/event_comment_create.php b/app/Template/event/comment_create.php
index d2f6f97b..d2f6f97b 100644
--- a/app/Template/event_comment_create.php
+++ b/app/Template/event/comment_create.php
diff --git a/app/Template/event_comment_update.php b/app/Template/event/comment_update.php
index c0b43622..c0b43622 100644
--- a/app/Template/event_comment_update.php
+++ b/app/Template/event/comment_update.php
diff --git a/app/Template/event_subtask_create.php b/app/Template/event/subtask_create.php
index 664e9da2..664e9da2 100644
--- a/app/Template/event_subtask_create.php
+++ b/app/Template/event/subtask_create.php
diff --git a/app/Template/event_subtask_update.php b/app/Template/event/subtask_update.php
index 96a589dd..96a589dd 100644
--- a/app/Template/event_subtask_update.php
+++ b/app/Template/event/subtask_update.php
diff --git a/app/Template/event_task_assignee_change.php b/app/Template/event/task_assignee_change.php
index b346325e..b346325e 100644
--- a/app/Template/event_task_assignee_change.php
+++ b/app/Template/event/task_assignee_change.php
diff --git a/app/Template/event_task_close.php b/app/Template/event/task_close.php
index 48d25678..48d25678 100644
--- a/app/Template/event_task_close.php
+++ b/app/Template/event/task_close.php
diff --git a/app/Template/event_task_create.php b/app/Template/event/task_create.php
index 2515af05..2515af05 100644
--- a/app/Template/event_task_create.php
+++ b/app/Template/event/task_create.php
diff --git a/app/Template/event_task_move_column.php b/app/Template/event/task_move_column.php
index f2aac8f7..f2aac8f7 100644
--- a/app/Template/event_task_move_column.php
+++ b/app/Template/event/task_move_column.php
diff --git a/app/Template/event_task_move_position.php b/app/Template/event/task_move_position.php
index 26cdeb13..26cdeb13 100644
--- a/app/Template/event_task_move_position.php
+++ b/app/Template/event/task_move_position.php
diff --git a/app/Template/event_task_open.php b/app/Template/event/task_open.php
index 9623be74..9623be74 100644
--- a/app/Template/event_task_open.php
+++ b/app/Template/event/task_open.php
diff --git a/app/Template/event_task_update.php b/app/Template/event/task_update.php
index a270b936..a270b936 100644
--- a/app/Template/event_task_update.php
+++ b/app/Template/event/task_update.php
diff --git a/app/Template/notification_comment_creation.php b/app/Template/notification/comment_creation.php
index 5b334d76..52f82a92 100644
--- a/app/Template/notification_comment_creation.php
+++ b/app/Template/notification/comment_creation.php
@@ -4,4 +4,4 @@
<?= Helper\markdown($comment['comment']) ?>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_comment_update.php b/app/Template/notification/comment_update.php
index 04aafb85..8f613eb2 100644
--- a/app/Template/notification_comment_update.php
+++ b/app/Template/notification/comment_update.php
@@ -4,4 +4,4 @@
<?= Helper\markdown($comment['comment']) ?>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification/file_creation.php b/app/Template/notification/file_creation.php
new file mode 100644
index 00000000..aae6fee9
--- /dev/null
+++ b/app/Template/notification/file_creation.php
@@ -0,0 +1,5 @@
+<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
+
+<p><?= t('New attachment added "%s"', $file['name']) ?></p>
+
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_footer.php b/app/Template/notification/footer.php
index 67039e86..67039e86 100644
--- a/app/Template/notification_footer.php
+++ b/app/Template/notification/footer.php
diff --git a/app/Template/notification_subtask_creation.php b/app/Template/notification/subtask_creation.php
index 2ddfc649..b264ef49 100644
--- a/app/Template/notification_subtask_creation.php
+++ b/app/Template/notification/subtask_creation.php
@@ -14,4 +14,4 @@
</li>
</ul>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_subtask_update.php b/app/Template/notification/subtask_update.php
index 999edbf9..08b7d97f 100644
--- a/app/Template/notification_subtask_update.php
+++ b/app/Template/notification/subtask_update.php
@@ -18,4 +18,4 @@
</li>
</ul>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_task_assignee_change.php b/app/Template/notification/task_assignee_change.php
index d23f769e..14beef13 100644
--- a/app/Template/notification_task_assignee_change.php
+++ b/app/Template/notification/task_assignee_change.php
@@ -17,4 +17,4 @@
<?= Helper\markdown($task['description']) ?: t('There is no description.') ?>
<?php endif ?>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_task_close.php b/app/Template/notification/task_close.php
index d56e71bb..1a5ec553 100644
--- a/app/Template/notification_task_close.php
+++ b/app/Template/notification/task_close.php
@@ -2,4 +2,4 @@
<p><?= t('The task #%d have been closed.', $task['id']) ?></p>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_task_creation.php b/app/Template/notification/task_creation.php
index 1b555096..99ebcbe5 100644
--- a/app/Template/notification_task_creation.php
+++ b/app/Template/notification/task_creation.php
@@ -40,4 +40,4 @@
<?= Helper\markdown($task['description']) ?>
<?php endif ?>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_task_due.php b/app/Template/notification/task_due.php
index a32a9efc..c7ea010f 100644
--- a/app/Template/notification_task_due.php
+++ b/app/Template/notification/task_due.php
@@ -17,4 +17,4 @@
<?php endforeach ?>
</ul>
-<?= Helper\template('notification_footer', array('task' => $task)) ?>
+<?= Helper\template('notification/footer', array('task' => $task)) ?>
diff --git a/app/Template/notification_task_move_column.php b/app/Template/notification/task_move_column.php
index c3f94df7..36f4daed 100644
--- a/app/Template/notification_task_move_column.php
+++ b/app/Template/notification/task_move_column.php
@@ -8,4 +8,4 @@
<li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
</ul>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_task_move_position.php b/app/Template/notification/task_move_position.php
index c3f94df7..36f4daed 100644
--- a/app/Template/notification_task_move_position.php
+++ b/app/Template/notification/task_move_position.php
@@ -8,4 +8,4 @@
<li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
</ul>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_task_open.php b/app/Template/notification/task_open.php
index 5d9f7d5b..6ee10242 100644
--- a/app/Template/notification_task_open.php
+++ b/app/Template/notification/task_open.php
@@ -2,4 +2,4 @@
<p><?= t('The task #%d have been opened.', $task['id']) ?></p>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_task_update.php b/app/Template/notification/task_update.php
index b3c07911..cbd6b2e1 100644
--- a/app/Template/notification_task_update.php
+++ b/app/Template/notification/task_update.php
@@ -40,4 +40,4 @@
<?= Helper\markdown($task['description']) ?: t('There is no description.') ?>
<?php endif ?>
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/notification_file_creation.php b/app/Template/notification_file_creation.php
deleted file mode 100644
index d8636820..00000000
--- a/app/Template/notification_file_creation.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<h2><?= Helper\escape($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<h3><?= t('New attachment added "%s"', $file['name']) ?></h3>
-
-<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
diff --git a/app/Template/user_notifications.php b/app/Template/user_notifications.php
index 13dd9809..4a32a41d 100644
--- a/app/Template/user_notifications.php
+++ b/app/Template/user_notifications.php
@@ -8,13 +8,16 @@
<?= 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>
+ <?php if (! empty($projects)): ?>
+ <p><?= t('I want to receive notifications only for those projects:') ?><br/><br/></p>
+
+ <div class="form-checkbox-group">
+ <?php foreach ($projects as $project_id => $project_name): ?>
+ <?= Helper\form_checkbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?>
+ <?php endforeach ?>
+ </div>
+ <?php endif ?>
- <div class="form-checkbox-group">
- <?php foreach ($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"/>
<?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>