Move event and notification templates to a subfolder
This commit is contained in:
@@ -101,18 +101,18 @@ class Notification extends Base
|
|||||||
public function attachEvents()
|
public function attachEvents()
|
||||||
{
|
{
|
||||||
$events = array(
|
$events = array(
|
||||||
Task::EVENT_CREATE => 'notification_task_creation',
|
Task::EVENT_CREATE => 'task_creation',
|
||||||
Task::EVENT_UPDATE => 'notification_task_update',
|
Task::EVENT_UPDATE => 'task_update',
|
||||||
Task::EVENT_CLOSE => 'notification_task_close',
|
Task::EVENT_CLOSE => 'task_close',
|
||||||
Task::EVENT_OPEN => 'notification_task_open',
|
Task::EVENT_OPEN => 'task_open',
|
||||||
Task::EVENT_MOVE_COLUMN => 'notification_task_move_column',
|
Task::EVENT_MOVE_COLUMN => 'task_move_column',
|
||||||
Task::EVENT_MOVE_POSITION => 'notification_task_move_position',
|
Task::EVENT_MOVE_POSITION => 'task_move_position',
|
||||||
Task::EVENT_ASSIGNEE_CHANGE => 'notification_task_assignee_change',
|
Task::EVENT_ASSIGNEE_CHANGE => 'task_assignee_change',
|
||||||
SubTask::EVENT_CREATE => 'notification_subtask_creation',
|
SubTask::EVENT_CREATE => 'subtask_creation',
|
||||||
SubTask::EVENT_UPDATE => 'notification_subtask_update',
|
SubTask::EVENT_UPDATE => 'subtask_update',
|
||||||
Comment::EVENT_CREATE => 'notification_comment_creation',
|
Comment::EVENT_CREATE => 'comment_creation',
|
||||||
Comment::EVENT_UPDATE => 'notification_comment_update',
|
Comment::EVENT_UPDATE => 'comment_update',
|
||||||
File::EVENT_CREATE => 'notification_file_creation',
|
File::EVENT_CREATE => 'file_creation',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($events as $event_name => $template_name) {
|
foreach ($events as $event_name => $template_name) {
|
||||||
@@ -162,43 +162,43 @@ class Notification extends Base
|
|||||||
public function getMailSubject($template, array $data)
|
public function getMailSubject($template, array $data)
|
||||||
{
|
{
|
||||||
switch ($template) {
|
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']);
|
$subject = e('[%s][New attachment] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][New comment] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Comment updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][New subtask] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Subtask updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][New task] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Task updated] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Task closed] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Task opened] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Column Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Position Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
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']);
|
$subject = e('[%s][Assignee Change] %s (#%d)', $data['task']['project_name'], $data['task']['title'], $data['task']['id']);
|
||||||
break;
|
break;
|
||||||
case 'notification_task_due':
|
case 'task_due':
|
||||||
$subject = e('[%s][Due tasks]', $data['project']);
|
$subject = e('[%s][Due tasks]', $data['project']);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -218,7 +218,7 @@ class Notification extends Base
|
|||||||
public function getMailContent($template, array $data)
|
public function getMailContent($template, array $data)
|
||||||
{
|
{
|
||||||
$tpl = new Template;
|
$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')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ class ProjectActivity extends Base
|
|||||||
public function getContent(array $params)
|
public function getContent(array $params)
|
||||||
{
|
{
|
||||||
$tpl = new Template;
|
$tpl = new Template;
|
||||||
return $tpl->load('event_'.str_replace('.', '_', $params['event_name']), $params);
|
return $tpl->load('event/'.str_replace('.', '_', $params['event_name']), $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
<?= Helper\markdown($comment['comment']) ?>
|
<?= Helper\markdown($comment['comment']) ?>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
<?= Helper\markdown($comment['comment']) ?>
|
<?= Helper\markdown($comment['comment']) ?>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
5
app/Template/notification/file_creation.php
Normal file
5
app/Template/notification/file_creation.php
Normal file
@@ -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)) ?>
|
||||||
@@ -14,4 +14,4 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -18,4 +18,4 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -17,4 +17,4 @@
|
|||||||
<?= Helper\markdown($task['description']) ?: t('There is no description.') ?>
|
<?= Helper\markdown($task['description']) ?: t('There is no description.') ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
<p><?= t('The task #%d have been closed.', $task['id']) ?></p>
|
<p><?= t('The task #%d have been closed.', $task['id']) ?></p>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -40,4 +40,4 @@
|
|||||||
<?= Helper\markdown($task['description']) ?>
|
<?= Helper\markdown($task['description']) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -17,4 +17,4 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task)) ?>
|
||||||
@@ -8,4 +8,4 @@
|
|||||||
<li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
|
<li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -8,4 +8,4 @@
|
|||||||
<li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
|
<li><?= t('Task position:').' '.Helper\escape($task['position']) ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
<p><?= t('The task #%d have been opened.', $task['id']) ?></p>
|
<p><?= t('The task #%d have been opened.', $task['id']) ?></p>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -40,4 +40,4 @@
|
|||||||
<?= Helper\markdown($task['description']) ?: t('There is no description.') ?>
|
<?= Helper\markdown($task['description']) ?: t('There is no description.') ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= Helper\template('notification_footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
<?= Helper\template('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
|
||||||
@@ -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)) ?>
|
|
||||||
@@ -8,13 +8,16 @@
|
|||||||
|
|
||||||
<?= Helper\form_checkbox('notifications_enabled', t('Enable email notifications'), '1', $notifications['notifications_enabled'] == 1) ?><br/>
|
<?= 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">
|
<div class="form-actions">
|
||||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||||
<?= t('or') ?> <a href="?controller=user&action=show&user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
|
<?= t('or') ?> <a href="?controller=user&action=show&user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
|
||||||
|
|||||||
Reference in New Issue
Block a user