Send comments by email
This commit is contained in:
@@ -3,6 +3,7 @@ Version 1.0.40 (unreleased)
|
|||||||
|
|
||||||
New features:
|
New features:
|
||||||
|
|
||||||
|
* Send comments by email
|
||||||
* Upload Sqlite database from user interface
|
* Upload Sqlite database from user interface
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|||||||
74
app/Controller/CommentMailController.php
Normal file
74
app/Controller/CommentMailController.php
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Kanboard\Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CommentMailController
|
||||||
|
*
|
||||||
|
* @package Kanboard\Controller
|
||||||
|
* @author Frederic Guillot
|
||||||
|
*/
|
||||||
|
class CommentMailController extends BaseController
|
||||||
|
{
|
||||||
|
public function create(array $values = array(), array $errors = array())
|
||||||
|
{
|
||||||
|
$project = $this->getProject();
|
||||||
|
$task = $this->getTask();
|
||||||
|
|
||||||
|
$this->response->html($this->helper->layout->task('comment_mail/create', array(
|
||||||
|
'values' => $values,
|
||||||
|
'errors' => $errors,
|
||||||
|
'task' => $task,
|
||||||
|
'project' => $project,
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save()
|
||||||
|
{
|
||||||
|
$task = $this->getTask();
|
||||||
|
$values = $this->request->getValues();
|
||||||
|
$values['task_id'] = $task['id'];
|
||||||
|
$values['user_id'] = $this->userSession->getId();
|
||||||
|
|
||||||
|
list($valid, $errors) = $this->commentValidator->validateEmailCreation($values);
|
||||||
|
|
||||||
|
if ($valid) {
|
||||||
|
$this->sendByEmail($values);
|
||||||
|
$values = $this->prepareComment($values);
|
||||||
|
|
||||||
|
if ($this->commentModel->create($values) !== false) {
|
||||||
|
$this->flash->success(t('Comment sent by email successfully.'));
|
||||||
|
} else {
|
||||||
|
$this->flash->failure(t('Unable to create your comment.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true);
|
||||||
|
} else {
|
||||||
|
$this->create($values, $errors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sendByEmail(array $values)
|
||||||
|
{
|
||||||
|
$html = $this->template->render('comment_mail/email', array(
|
||||||
|
'email' => $values,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->emailClient->send(
|
||||||
|
$values['email'],
|
||||||
|
$values['email'],
|
||||||
|
$values['subject'],
|
||||||
|
$html
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function prepareComment(array $values)
|
||||||
|
{
|
||||||
|
$values['comment'] .= "\n\n_".t('Sent by email to [%s](mailto:%s) (%s)', $values['email'], $values['email'], $values['subject']).'_';
|
||||||
|
|
||||||
|
unset($values['subject']);
|
||||||
|
unset($values['email']);
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Dodaj',
|
'Append' => 'Dodaj',
|
||||||
'Replace' => 'Zamijeni',
|
'Replace' => 'Zamijeni',
|
||||||
'Import' => 'Uvoz',
|
'Import' => 'Uvoz',
|
||||||
'change sorting' => 'Promijeni sortiranje',
|
'Change sorting' => 'Promijeni sortiranje',
|
||||||
'Tasks Importation' => 'Uvoz zadataka',
|
'Tasks Importation' => 'Uvoz zadataka',
|
||||||
'Delimiter' => 'Djelilac',
|
'Delimiter' => 'Djelilac',
|
||||||
'Enclosure' => 'Prilog',
|
'Enclosure' => 'Prilog',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Anhängen',
|
'Append' => 'Anhängen',
|
||||||
'Replace' => 'Ersetzen',
|
'Replace' => 'Ersetzen',
|
||||||
'Import' => 'Import',
|
'Import' => 'Import',
|
||||||
'change sorting' => 'Sortierung ändern',
|
'Change sorting' => 'Sortierung ändern',
|
||||||
'Tasks Importation' => 'Aufgaben Import',
|
'Tasks Importation' => 'Aufgaben Import',
|
||||||
'Delimiter' => 'Trennzeichen',
|
'Delimiter' => 'Trennzeichen',
|
||||||
'Enclosure' => 'Textbegrenzer',
|
'Enclosure' => 'Textbegrenzer',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Προσθήκη',
|
'Append' => 'Προσθήκη',
|
||||||
'Replace' => 'Αντικατάσταση',
|
'Replace' => 'Αντικατάσταση',
|
||||||
'Import' => 'Εισαγωγή',
|
'Import' => 'Εισαγωγή',
|
||||||
'change sorting' => 'Αλλαγή ταξινόμησης',
|
'Change sorting' => 'Αλλαγή ταξινόμησης',
|
||||||
'Tasks Importation' => 'Εισαγωγή εργασιών',
|
'Tasks Importation' => 'Εισαγωγή εργασιών',
|
||||||
'Delimiter' => 'Delimiter',
|
'Delimiter' => 'Delimiter',
|
||||||
'Enclosure' => 'Enclosure',
|
'Enclosure' => 'Enclosure',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Añadir',
|
'Append' => 'Añadir',
|
||||||
'Replace' => 'Reemplazar',
|
'Replace' => 'Reemplazar',
|
||||||
'Import' => 'Importar',
|
'Import' => 'Importar',
|
||||||
'change sorting' => 'Cambiar orden',
|
'Change sorting' => 'Cambiar orden',
|
||||||
'Tasks Importation' => 'Importación de tareas',
|
'Tasks Importation' => 'Importación de tareas',
|
||||||
'Delimiter' => 'Delimitador',
|
'Delimiter' => 'Delimitador',
|
||||||
'Enclosure' => 'Recinto',
|
'Enclosure' => 'Recinto',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Ajouter',
|
'Append' => 'Ajouter',
|
||||||
'Replace' => 'Remplaçer',
|
'Replace' => 'Remplaçer',
|
||||||
'Import' => 'Importation',
|
'Import' => 'Importation',
|
||||||
'change sorting' => 'changer l\'ordre',
|
'Change sorting' => 'changer l\'ordre',
|
||||||
'Tasks Importation' => 'Importation des tâches',
|
'Tasks Importation' => 'Importation des tâches',
|
||||||
'Delimiter' => 'Délimiteur',
|
'Delimiter' => 'Délimiteur',
|
||||||
'Enclosure' => 'Caractère d\'encadrement',
|
'Enclosure' => 'Caractère d\'encadrement',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Hozzáfűz',
|
'Append' => 'Hozzáfűz',
|
||||||
'Replace' => 'Helyettesít',
|
'Replace' => 'Helyettesít',
|
||||||
'Import' => 'Importál',
|
'Import' => 'Importál',
|
||||||
'change sorting' => 'rendezési sorrend megváltoztatása',
|
'Change sorting' => 'rendezési sorrend megváltoztatása',
|
||||||
'Tasks Importation' => 'Feladat importálás',
|
'Tasks Importation' => 'Feladat importálás',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Tambahkan',
|
'Append' => 'Tambahkan',
|
||||||
'Replace' => 'Ganti',
|
'Replace' => 'Ganti',
|
||||||
'Import' => 'Impor',
|
'Import' => 'Impor',
|
||||||
'change sorting' => 'ubah pengurutan',
|
'Change sorting' => 'ubah pengurutan',
|
||||||
'Tasks Importation' => 'Importasi Tugas',
|
'Tasks Importation' => 'Importasi Tugas',
|
||||||
'Delimiter' => 'Pembatas',
|
'Delimiter' => 'Pembatas',
|
||||||
'Enclosure' => 'Lampiran',
|
'Enclosure' => 'Lampiran',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Aggiungi',
|
'Append' => 'Aggiungi',
|
||||||
'Replace' => 'Sostituisci',
|
'Replace' => 'Sostituisci',
|
||||||
'Import' => 'Importa',
|
'Import' => 'Importa',
|
||||||
'change sorting' => 'cambia ordinamento',
|
'Change sorting' => 'cambia ordinamento',
|
||||||
'Tasks Importation' => 'Importazione task',
|
'Tasks Importation' => 'Importazione task',
|
||||||
'Delimiter' => 'Delimitatore',
|
'Delimiter' => 'Delimitatore',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => '추가',
|
'Append' => '추가',
|
||||||
'Replace' => '변경',
|
'Replace' => '변경',
|
||||||
'Import' => '가져오기',
|
'Import' => '가져오기',
|
||||||
'change sorting' => '정렬 변경',
|
'Change sorting' => '정렬 변경',
|
||||||
'Tasks Importation' => '할일 가져오기',
|
'Tasks Importation' => '할일 가져오기',
|
||||||
'Delimiter' => '구분자',
|
'Delimiter' => '구분자',
|
||||||
'Enclosure' => '동봉',
|
'Enclosure' => '동봉',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Dołącz',
|
'Append' => 'Dołącz',
|
||||||
'Replace' => 'Zastąp',
|
'Replace' => 'Zastąp',
|
||||||
'Import' => 'Importuj',
|
'Import' => 'Importuj',
|
||||||
'change sorting' => 'odwróć sortowanie',
|
'Change sorting' => 'odwróć sortowanie',
|
||||||
'Tasks Importation' => 'Import zadań',
|
'Tasks Importation' => 'Import zadań',
|
||||||
'Delimiter' => 'Separator pola',
|
'Delimiter' => 'Separator pola',
|
||||||
'Enclosure' => 'Separator tekstu',
|
'Enclosure' => 'Separator tekstu',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Adicionar',
|
'Append' => 'Adicionar',
|
||||||
'Replace' => 'Substituir',
|
'Replace' => 'Substituir',
|
||||||
'Import' => 'Importar',
|
'Import' => 'Importar',
|
||||||
'change sorting' => 'alterar ordenação',
|
'Change sorting' => 'alterar ordenação',
|
||||||
'Tasks Importation' => 'Importação de Tarefas',
|
'Tasks Importation' => 'Importação de Tarefas',
|
||||||
'Delimiter' => 'Separador',
|
'Delimiter' => 'Separador',
|
||||||
'Enclosure' => 'Delimitador de campos',
|
'Enclosure' => 'Delimitador de campos',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Acrescentar',
|
'Append' => 'Acrescentar',
|
||||||
'Replace' => 'Substituir',
|
'Replace' => 'Substituir',
|
||||||
'Import' => 'Importar',
|
'Import' => 'Importar',
|
||||||
'change sorting' => 'alterar ordernação',
|
'Change sorting' => 'alterar ordernação',
|
||||||
'Tasks Importation' => 'Importação de Tarefas',
|
'Tasks Importation' => 'Importação de Tarefas',
|
||||||
'Delimiter' => 'Delimitador',
|
'Delimiter' => 'Delimitador',
|
||||||
'Enclosure' => 'Clausura',
|
'Enclosure' => 'Clausura',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Добавление',
|
'Append' => 'Добавление',
|
||||||
'Replace' => 'Замена',
|
'Replace' => 'Замена',
|
||||||
'Import' => 'Импорт',
|
'Import' => 'Импорт',
|
||||||
'change sorting' => 'изменить сортировку',
|
'Change sorting' => 'изменить сортировку',
|
||||||
'Tasks Importation' => 'Импортирование задач',
|
'Tasks Importation' => 'Импортирование задач',
|
||||||
'Delimiter' => 'Разделитель',
|
'Delimiter' => 'Разделитель',
|
||||||
'Enclosure' => 'Тип кавычек',
|
'Enclosure' => 'Тип кавычек',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
// 'Append' => '',
|
// 'Append' => '',
|
||||||
// 'Replace' => '',
|
// 'Replace' => '',
|
||||||
// 'Import' => '',
|
// 'Import' => '',
|
||||||
// 'change sorting' => '',
|
// 'Change sorting' => '',
|
||||||
// 'Tasks Importation' => '',
|
// 'Tasks Importation' => '',
|
||||||
// 'Delimiter' => '',
|
// 'Delimiter' => '',
|
||||||
// 'Enclosure' => '',
|
// 'Enclosure' => '',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'เพิ่มเติม',
|
'Append' => 'เพิ่มเติม',
|
||||||
'Replace' => 'แทนที่',
|
'Replace' => 'แทนที่',
|
||||||
'Import' => 'นำเข้า',
|
'Import' => 'นำเข้า',
|
||||||
'change sorting' => 'เปลี่ยนการเรียง',
|
'Change sorting' => 'เปลี่ยนการเรียง',
|
||||||
'Tasks Importation' => 'การนำเข้างาน',
|
'Tasks Importation' => 'การนำเข้างาน',
|
||||||
'Delimiter' => 'คั่น',
|
'Delimiter' => 'คั่น',
|
||||||
'Enclosure' => 'กำหนดข้อความ',
|
'Enclosure' => 'กำหนดข้อความ',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => 'Ekle',
|
'Append' => 'Ekle',
|
||||||
'Replace' => 'Üzerine yaz',
|
'Replace' => 'Üzerine yaz',
|
||||||
'Import' => 'İçeri aktar',
|
'Import' => 'İçeri aktar',
|
||||||
'change sorting' => 'sıralamayı değiştir',
|
'Change sorting' => 'sıralamayı değiştir',
|
||||||
'Tasks Importation' => 'Görevleri içeri aktar',
|
'Tasks Importation' => 'Görevleri içeri aktar',
|
||||||
'Delimiter' => 'Ayırıcı',
|
'Delimiter' => 'Ayırıcı',
|
||||||
'Enclosure' => 'Enclosure',
|
'Enclosure' => 'Enclosure',
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ return array(
|
|||||||
'Append' => '追加',
|
'Append' => '追加',
|
||||||
'Replace' => '替换',
|
'Replace' => '替换',
|
||||||
'Import' => '导入',
|
'Import' => '导入',
|
||||||
'change sorting' => '改变排序',
|
'Change sorting' => '改变排序',
|
||||||
'Tasks Importation' => '任务重要性',
|
'Tasks Importation' => '任务重要性',
|
||||||
'Delimiter' => '分隔符',
|
'Delimiter' => '分隔符',
|
||||||
'Enclosure' => '附件',
|
'Enclosure' => '附件',
|
||||||
|
|||||||
@@ -8,26 +8,28 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<small class="comment-date"><?= t('Created at:') ?> <?= $this->dt->datetime($comment['date_creation']) ?></small>
|
<small class="comment-date"><?= t('Created at:') ?> <?= $this->dt->datetime($comment['date_creation']) ?></small>
|
||||||
<small class="comment-date"><?= t('Updated at:')?> <?= $this->dt->datetime($comment['date_modification']) ?></small>
|
<small class="comment-date"><?= t('Updated at:') ?> <?= $this->dt->datetime($comment['date_modification']) ?></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (! isset($hide_actions)): ?>
|
<?php if (! isset($hide_actions)): ?>
|
||||||
<div class="comment-actions">
|
<div class="comment-actions">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog"></i><i class="fa fa-caret-down"></i></a>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<i class="fa fa-link fa-fw"></i>
|
<?= $this->url->icon('link', t('Link'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', '', $this->app->isAjax(), 'comment-'.$comment['id']) ?>
|
||||||
<a href="#comment-<?= $comment['id'] ?>"><?= t('link') ?></a>
|
|
||||||
</li>
|
</li>
|
||||||
<?php if ($editable && ($this->user->isAdmin() || $this->user->isCurrentUser($comment['user_id']))): ?>
|
<?php if ($editable && ($this->user->isAdmin() || $this->user->isCurrentUser($comment['user_id']))): ?>
|
||||||
<li>
|
<li>
|
||||||
<?= $this->modal->medium('edit', t('edit'), 'CommentController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>
|
<?= $this->modal->medium('edit', t('Edit'), 'CommentController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?= $this->modal->confirm('trash-o', t('remove'), 'CommentController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>
|
<?= $this->modal->confirm('trash-o', t('Remove'), 'CommentController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<div class="comment-content">
|
<div class="comment-content">
|
||||||
|
|||||||
@@ -1,20 +1,25 @@
|
|||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2><?= $this->text->e($task['title']) ?> > <?= t('Comments') ?></h2>
|
<h2><?= $this->text->e($task['title']) ?></h2>
|
||||||
<?php if (!isset($is_public) || !$is_public): ?>
|
<?php if (!isset($is_public) || !$is_public): ?>
|
||||||
<div class="comment-sorting">
|
<ul>
|
||||||
<small>
|
<li>
|
||||||
<?= $this->url->icon('sort', t('change sorting'), 'CommentListController', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'js-modal-replace') ?>
|
<?= $this->url->icon('sort', t('Change sorting'), 'CommentListController', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'js-modal-replace') ?>
|
||||||
</small>
|
</li>
|
||||||
</div>
|
<?php if ($editable): ?>
|
||||||
|
<li>
|
||||||
|
<?= $this->modal->medium('paper-plane', t('Send by email'), 'CommentMailController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
|
</li>
|
||||||
|
<?php endif ?>
|
||||||
|
</ul>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="comments">
|
<div class="comments">
|
||||||
<?php foreach ($comments as $comment): ?>
|
<?php foreach ($comments as $comment): ?>
|
||||||
<?= $this->render('comment/show', array(
|
<?= $this->render('comment/show', array(
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
'task' => $task,
|
'task' => $task,
|
||||||
'project' => $project,
|
'project' => $project,
|
||||||
'editable' => $editable,
|
'editable' => $editable,
|
||||||
'is_public' => isset($is_public) && $is_public,
|
'is_public' => isset($is_public) && $is_public,
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|||||||
21
app/Template/comment_mail/create.php
Normal file
21
app/Template/comment_mail/create.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<h2><?= t('Create and send comment by email') ?></h2>
|
||||||
|
</div>
|
||||||
|
<form method="post" action="<?= $this->url->href('CommentMailController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
|
||||||
|
<?= $this->form->csrf() ?>
|
||||||
|
<?= $this->form->hidden('task_id', $values) ?>
|
||||||
|
<?= $this->form->hidden('user_id', $values) ?>
|
||||||
|
|
||||||
|
<?= $this->form->label(t('Email'), 'email') ?>
|
||||||
|
<?= $this->form->email('email', $values, $errors, array('autofocus', 'required', 'tabindex="1"')) ?>
|
||||||
|
|
||||||
|
<?= $this->form->label(t('Subject'), 'subject') ?>
|
||||||
|
<?= $this->form->text('subject', $values, $errors, array('required', 'tabindex="2"')) ?>
|
||||||
|
|
||||||
|
<?= $this->form->textEditor('comment', $values, $errors, array('required' => true, 'tabindex' => 3)) ?>
|
||||||
|
|
||||||
|
<?= $this->modal->submitButtons(array(
|
||||||
|
'submitLabel' => t('Send by email'),
|
||||||
|
'tabindex' => 4,
|
||||||
|
)) ?>
|
||||||
|
</form>
|
||||||
1
app/Template/comment_mail/email.php
Normal file
1
app/Template/comment_mail/email.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?= $this->text->markdown($email['comment'], true) ?>
|
||||||
@@ -6,25 +6,28 @@
|
|||||||
<?php if (!isset($is_public) || !$is_public): ?>
|
<?php if (!isset($is_public) || !$is_public): ?>
|
||||||
<div class="comment-sorting">
|
<div class="comment-sorting">
|
||||||
<small>
|
<small>
|
||||||
<?= $this->url->icon('sort', t('change sorting'), 'CommentController', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
<?= $this->url->icon('sort', t('Change sorting'), 'CommentController', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
|
<?php if ($editable): ?>
|
||||||
|
<?= $this->modal->medium('paper-plane', t('Send by email'), 'CommentMailController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
|
<?php endif ?>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php foreach ($comments as $comment): ?>
|
<?php foreach ($comments as $comment): ?>
|
||||||
<?= $this->render('comment/show', array(
|
<?= $this->render('comment/show', array(
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
'task' => $task,
|
'task' => $task,
|
||||||
'project' => $project,
|
'project' => $project,
|
||||||
'editable' => $editable,
|
'editable' => $editable,
|
||||||
'is_public' => isset($is_public) && $is_public,
|
'is_public' => isset($is_public) && $is_public,
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|
||||||
<?php if ($editable): ?>
|
<?php if ($editable): ?>
|
||||||
<?= $this->render('task_comments/create', array(
|
<?= $this->render('task_comments/create', array(
|
||||||
'values' => array(),
|
'values' => array(),
|
||||||
'errors' => array(),
|
'errors' => array(),
|
||||||
'task' => $task,
|
'task' => $task,
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,31 @@ use SimpleValidator\Validators;
|
|||||||
*/
|
*/
|
||||||
class CommentValidator extends BaseValidator
|
class CommentValidator extends BaseValidator
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Validate comment email creation
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param array $values Required parameters to save an action
|
||||||
|
* @return array $valid, $errors [0] = Success or not, [1] = List of errors
|
||||||
|
*/
|
||||||
|
public function validateEmailCreation(array $values)
|
||||||
|
{
|
||||||
|
$rules = array(
|
||||||
|
new Validators\Required('task_id', t('This value is required')),
|
||||||
|
new Validators\Required('user_id', t('This value is required')),
|
||||||
|
new Validators\Required('subject', t('This field is required')),
|
||||||
|
new Validators\Required('email', t('This field is required')),
|
||||||
|
new Validators\Email('email', t('Email address invalid')),
|
||||||
|
);
|
||||||
|
|
||||||
|
$v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
|
||||||
|
|
||||||
|
return array(
|
||||||
|
$v->execute(),
|
||||||
|
$v->getErrors()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate comment creation
|
* Validate comment creation
|
||||||
*
|
*
|
||||||
|
|||||||
2
assets/css/app.min.css
vendored
2
assets/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -12,16 +12,6 @@
|
|||||||
.comment
|
.comment
|
||||||
padding: 5px
|
padding: 5px
|
||||||
margin-bottom: 15px
|
margin-bottom: 15px
|
||||||
&:hover
|
|
||||||
background: #fafafa
|
|
||||||
|
|
||||||
.comment-highlighted
|
|
||||||
background-color: map-get($highlight-colors, 'background')
|
|
||||||
border: 2px solid map-get($highlight-colors, 'background')
|
|
||||||
border-left: 2px solid map-get($highlight-colors, 'border')
|
|
||||||
&:hover
|
|
||||||
background-color: map-get($highlight-colors, 'background')
|
|
||||||
border: 2px solid map-get($highlight-colors, 'border')
|
|
||||||
|
|
||||||
.comment-title
|
.comment-title
|
||||||
border-bottom: 1px dotted #eee
|
border-bottom: 1px dotted #eee
|
||||||
@@ -32,17 +22,7 @@
|
|||||||
font-weight: 200
|
font-weight: 200
|
||||||
|
|
||||||
.comment-actions
|
.comment-actions
|
||||||
font-size: size('small')
|
|
||||||
margin-bottom: 10px
|
|
||||||
text-align: right
|
text-align: right
|
||||||
li
|
|
||||||
display: inline
|
|
||||||
a
|
|
||||||
color: color('light')
|
|
||||||
text-decoration: none
|
|
||||||
&:focus, &:hover
|
|
||||||
color: color('primary')
|
|
||||||
text-decoration: underline
|
|
||||||
|
|
||||||
.comment-content
|
.comment-content
|
||||||
margin-left: 55px
|
margin-left: 55px
|
||||||
@@ -53,3 +33,17 @@
|
|||||||
height: 90px
|
height: 90px
|
||||||
.text-editor-preview-area
|
.text-editor-preview-area
|
||||||
height: 90px
|
height: 90px
|
||||||
|
|
||||||
|
.comment-highlighted
|
||||||
|
background-color: map-get($highlight-colors, 'background')
|
||||||
|
border: 2px solid map-get($highlight-colors, 'border')
|
||||||
|
&:hover
|
||||||
|
background-color: map-get($highlight-colors, 'background')
|
||||||
|
|
||||||
|
.comment
|
||||||
|
&:hover
|
||||||
|
background: map-get($highlight-colors, 'background')
|
||||||
|
&:nth-child(even):not(.comment-highlighted)
|
||||||
|
background: bg-color('primary')
|
||||||
|
&:hover
|
||||||
|
background: map-get($highlight-colors, 'background')
|
||||||
|
|||||||
@@ -6,6 +6,40 @@ use Kanboard\Validator\CommentValidator;
|
|||||||
|
|
||||||
class CommentValidatorTest extends Base
|
class CommentValidatorTest extends Base
|
||||||
{
|
{
|
||||||
|
public function testValidateMailCreation()
|
||||||
|
{
|
||||||
|
$commentValidator = new CommentValidator($this->container);
|
||||||
|
|
||||||
|
$result = $commentValidator->validateEmailCreation(array(
|
||||||
|
'user_id' => 1,
|
||||||
|
'task_id' => 1,
|
||||||
|
'comment' => 'blah',
|
||||||
|
'email' => 'test@localhost',
|
||||||
|
'subject' => 'something',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertTrue($result[0]);
|
||||||
|
|
||||||
|
$result = $commentValidator->validateEmailCreation(array(
|
||||||
|
'user_id' => 1,
|
||||||
|
'task_id' => 1,
|
||||||
|
'comment' => 'blah',
|
||||||
|
'email' => 'invalid',
|
||||||
|
'subject' => 'something',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertFalse($result[0]);
|
||||||
|
|
||||||
|
$result = $commentValidator->validateEmailCreation(array(
|
||||||
|
'user_id' => 1,
|
||||||
|
'task_id' => 1,
|
||||||
|
'comment' => 'bla',
|
||||||
|
'email' => 'test@localhost',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertFalse($result[0]);
|
||||||
|
}
|
||||||
|
|
||||||
public function testValidateCreation()
|
public function testValidateCreation()
|
||||||
{
|
{
|
||||||
$commentValidator = new CommentValidator($this->container);
|
$commentValidator = new CommentValidator($this->container);
|
||||||
|
|||||||
Reference in New Issue
Block a user