Permalink
Browse files

Add email notifications

  • Loading branch information...
1 parent c539bdc commit 9eeded33f68872515954a2fc177fcb47a9273ae9 @fguillot fguillot committed Aug 16, 2014
Showing with 23,403 additions and 301 deletions.
  1. +4 −3 app/Controller/Base.php
  2. +1 −1 app/Controller/Board.php
  3. +11 −2 app/Controller/Config.php
  4. +7 −0 app/Core/Tool.php
  5. +76 −0 app/Event/BaseNotificationListener.php
  6. +30 −0 app/Event/CommentNotificationListener.php
  7. +30 −0 app/Event/FileNotificationListener.php
  8. +30 −0 app/Event/SubTaskNotificationListener.php
  9. +29 −0 app/Event/TaskNotificationListener.php
  10. +27 −0 app/Locales/de_DE/translations.php
  11. +27 −0 app/Locales/es_ES/translations.php
  12. +27 −0 app/Locales/fi_FI/translations.php
  13. +27 −0 app/Locales/fr_FR/translations.php
  14. +27 −0 app/Locales/pl_PL/translations.php
  15. +27 −0 app/Locales/pt_BR/translations.php
  16. +27 −0 app/Locales/sv_SE/translations.php
  17. +26 −0 app/Locales/zh_CN/translations.php
  18. +1 −1 app/Model/Acl.php
  19. +7 −7 app/Model/Action.php
  20. +42 −5 app/Model/Base.php
  21. +8 −8 app/Model/Board.php
  22. +21 −2 app/Model/Comment.php
  23. +9 −0 app/Model/File.php
  24. +9 −16 app/Model/GitHub.php
  25. +7 −13 app/Model/Google.php
  26. +1 −2 app/Model/Ldap.php
  27. +215 −0 app/Model/Notification.php
  28. +12 −24 app/Model/Project.php
  29. +2 −5 app/Model/RememberMe.php
  30. +7 −11 app/Model/ReverseProxyAuth.php
  31. +41 −3 app/Model/SubTask.php
  32. +97 −55 app/Model/Task.php
  33. +4 −7 app/Model/User.php
  34. +3 −5 app/Model/Webhook.php
  35. +16 −1 app/Schema/Mysql.php
  36. +16 −1 app/Schema/Postgres.php
  37. +16 −1 app/Schema/Sqlite.php
  38. +1 −0 app/Templates/comment_edit.php
  39. +19 −8 app/Templates/config_index.php
  40. +8 −0 app/Templates/notification_comment_creation.php
  41. +8 −0 app/Templates/notification_comment_update.php
  42. +6 −0 app/Templates/notification_file_creation.php
  43. +18 −0 app/Templates/notification_subtask_creation.php
  44. +22 −0 app/Templates/notification_subtask_update.php
  45. +6 −0 app/Templates/notification_task_close.php
  46. +44 −0 app/Templates/notification_task_creation.php
  47. +10 −0 app/Templates/notification_task_due.php
  48. +6 −0 app/Templates/notification_task_open.php
  49. +44 −0 app/Templates/notification_task_update.php
  50. +33 −0 app/common.php
  51. +4 −0 assets/css/app.css
  52. +4 −3 assets/js/app.js
  53. +15 −0 config.default.php
  54. +19 −11 jsonrpc.php
  55. +32 −3 kanboard
  56. +4 −4 tests/units/AclTest.php
  57. +5 −5 tests/units/ActionTaskAssignColorCategoryTest.php
  58. +4 −4 tests/units/ActionTaskAssignColorUserTest.php
  59. +6 −6 tests/units/ActionTaskAssignCurrentUserTest.php
  60. +5 −5 tests/units/ActionTaskAssignSpecificUserTest.php
  61. +5 −5 tests/units/ActionTaskCloseTest.php
  62. +5 −5 tests/units/ActionTaskDuplicateAnotherProjectTest.php
  63. +23 −23 tests/units/ActionTest.php
  64. +5 −2 tests/units/Base.php
  65. +2 −2 tests/units/BoardTest.php
  66. +11 −11 tests/units/CommentTest.php
  67. +9 −9 tests/units/ProjectTest.php
  68. +22 −22 tests/units/TaskTest.php
  69. +6 −0 vendor/PicoDb/Table.php
  70. +80 −0 vendor/swiftmailer/classes/Swift.php
  71. +71 −0 vendor/swiftmailer/classes/Swift/Attachment.php
  72. +179 −0 vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php
  73. +184 −0 vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php
  74. +229 −0 vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php
  75. +42 −0 vendor/swiftmailer/classes/Swift/ByteStream/TemporaryFileByteStream.php
  76. +67 −0 vendor/swiftmailer/classes/Swift/CharacterReader.php
  77. +97 −0 vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php
  78. +83 −0 vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php
  79. +179 −0 vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php
  80. +26 −0 vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php
  81. +124 −0 vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
  82. +89 −0 vendor/swiftmailer/classes/Swift/CharacterStream.php
  83. +294 −0 vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php
  84. +275 −0 vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php
  85. +63 −0 vendor/swiftmailer/classes/Swift/ConfigurableSpool.php
  86. +370 −0 vendor/swiftmailer/classes/Swift/DependencyContainer.php
  87. +27 −0 vendor/swiftmailer/classes/Swift/DependencyException.php
  88. +69 −0 vendor/swiftmailer/classes/Swift/EmbeddedFile.php
  89. +27 −0 vendor/swiftmailer/classes/Swift/Encoder.php
  90. +58 −0 vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php
  91. +282 −0 vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php
  92. +84 −0 vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php
  93. +64 −0 vendor/swiftmailer/classes/Swift/Encoding.php
  94. +65 −0 vendor/swiftmailer/classes/Swift/Events/CommandEvent.php
  95. +24 −0 vendor/swiftmailer/classes/Swift/Events/CommandListener.php
  96. +38 −0 vendor/swiftmailer/classes/Swift/Events/Event.php
  97. +83 −0 vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php
  98. +18 −0 vendor/swiftmailer/classes/Swift/Events/EventListener.php
  99. +63 −0 vendor/swiftmailer/classes/Swift/Events/EventObject.php
  100. +66 −0 vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php
  101. +24 −0 vendor/swiftmailer/classes/Swift/Events/ResponseListener.php
  102. +126 −0 vendor/swiftmailer/classes/Swift/Events/SendEvent.php
  103. +31 −0 vendor/swiftmailer/classes/Swift/Events/SendListener.php
  104. +157 −0 vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php
  105. +27 −0 vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php
  106. +45 −0 vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php
  107. +46 −0 vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php
  108. +24 −0 vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php
  109. +45 −0 vendor/swiftmailer/classes/Swift/FailoverTransport.php
  110. +208 −0 vendor/swiftmailer/classes/Swift/FileSpool.php
  111. +24 −0 vendor/swiftmailer/classes/Swift/FileStream.php
  112. +32 −0 vendor/swiftmailer/classes/Swift/Filterable.php
  113. +61 −0 vendor/swiftmailer/classes/Swift/Image.php
  114. +75 −0 vendor/swiftmailer/classes/Swift/InputByteStream.php
  115. +27 −0 vendor/swiftmailer/classes/Swift/IoException.php
  116. +105 −0 vendor/swiftmailer/classes/Swift/KeyCache.php
  117. +206 −0 vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php
  118. +324 −0 vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php
  119. +51 −0 vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php
  120. +115 −0 vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php
  121. +127 −0 vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
  122. +45 −0 vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php
  123. +45 −0 vendor/swiftmailer/classes/Swift/MailTransport.php
  124. +114 −0 vendor/swiftmailer/classes/Swift/Mailer.php
  125. +55 −0 vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php
  126. +32 −0 vendor/swiftmailer/classes/Swift/Mailer/RecipientIterator.php
  127. +83 −0 vendor/swiftmailer/classes/Swift/MemorySpool.php
  128. +272 −0 vendor/swiftmailer/classes/Swift/Message.php
  129. +153 −0 vendor/swiftmailer/classes/Swift/Mime/Attachment.php
  130. +24 −0 vendor/swiftmailer/classes/Swift/Mime/CharsetObserver.php
  131. +34 −0 vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php
  132. +67 −0 vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
  133. +123 −0 vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
  134. +163 −0 vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
  135. +123 −0 vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
  136. +88 −0 vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
  137. +63 −0 vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
  138. +45 −0 vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php
  139. +24 −0 vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php
  140. +176 −0 vendor/swiftmailer/classes/Swift/Mime/Grammar.php
  141. +93 −0 vendor/swiftmailer/classes/Swift/Mime/Header.php
  142. +24 −0 vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php
  143. +55 −0 vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
  144. +65 −0 vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
  145. +78 −0 vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php
  146. +169 −0 vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php
  147. +502 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php
  148. +125 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php
  149. +181 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php
  150. +354 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php
  151. +137 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/OpenDKIMHeader.php
  152. +260 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php
  153. +144 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php
  154. +112 −0 vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php
  155. +223 −0 vendor/swiftmailer/classes/Swift/Mime/Message.php
  156. +115 −0 vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php
  157. +214 −0 vendor/swiftmailer/classes/Swift/Mime/MimePart.php
  158. +34 −0 vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php
  159. +188 −0 vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php
  160. +383 −0 vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php
  161. +651 −0 vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php
  162. +853 −0 vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php
  163. +59 −0 vendor/swiftmailer/classes/Swift/MimePart.php
  164. +39 −0 vendor/swiftmailer/classes/Swift/NullTransport.php
  165. +46 −0 vendor/swiftmailer/classes/Swift/OutputByteStream.php
  166. +141 −0 vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php
  167. +164 −0 vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php
  168. +31 −0 vendor/swiftmailer/classes/Swift/Plugins/Decorator/Replacements.php
  169. +207 −0 vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php
  170. +68 −0 vendor/swiftmailer/classes/Swift/Plugins/ImpersonatePlugin.php
  171. +36 −0 vendor/swiftmailer/classes/Swift/Plugins/Logger.php
  172. +141 −0 vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php
  173. +72 −0 vendor/swiftmailer/classes/Swift/Plugins/Loggers/ArrayLogger.php
  174. +58 −0 vendor/swiftmailer/classes/Swift/Plugins/Loggers/EchoLogger.php
  175. +75 −0 vendor/swiftmailer/classes/Swift/Plugins/MessageLogger.php
  176. +31 −0 vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Connection.php
  177. +27 −0 vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php
  178. +274 −0 vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
  179. +205 −0 vendor/swiftmailer/classes/Swift/Plugins/RedirectingPlugin.php
  180. +32 −0 vendor/swiftmailer/classes/Swift/Plugins/Reporter.php
  181. +73 −0 vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php
  182. +59 −0 vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php
  183. +39 −0 vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php
  184. +24 −0 vendor/swiftmailer/classes/Swift/Plugins/Sleeper.php
  185. +200 −0 vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php
  186. +24 −0 vendor/swiftmailer/classes/Swift/Plugins/Timer.php
  187. +103 −0 vendor/swiftmailer/classes/Swift/Preferences.php
  188. +27 −0 vendor/swiftmailer/classes/Swift/ReplacementFilterFactory.php
  189. +27 −0 vendor/swiftmailer/classes/Swift/RfcComplianceException.php
  190. +45 −0 vendor/swiftmailer/classes/Swift/SendmailTransport.php
  191. +23 −0 vendor/swiftmailer/classes/Swift/SignedMessage.php
  192. +20 −0 vendor/swiftmailer/classes/Swift/Signer.php
  193. +33 −0 vendor/swiftmailer/classes/Swift/Signers/BodySigner.php
  194. +689 −0 vendor/swiftmailer/classes/Swift/Signers/DKIMSigner.php
  195. +512 −0 vendor/swiftmailer/classes/Swift/Signers/DomainKeySigner.php
  196. +65 −0 vendor/swiftmailer/classes/Swift/Signers/HeaderSigner.php
  197. +186 −0 vendor/swiftmailer/classes/Swift/Signers/OpenDKIMSigner.php
  198. +428 −0 vendor/swiftmailer/classes/Swift/Signers/SMimeSigner.php
  199. +57 −0 vendor/swiftmailer/classes/Swift/SmtpTransport.php
  200. +53 −0 vendor/swiftmailer/classes/Swift/Spool.php
  201. +47 −0 vendor/swiftmailer/classes/Swift/SpoolTransport.php
  202. +35 −0 vendor/swiftmailer/classes/Swift/StreamFilter.php
  203. +170 −0 vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
  204. +66 −0 vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php
  205. +45 −0 vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
  206. +27 −0 vendor/swiftmailer/classes/Swift/SwiftException.php
  207. +54 −0 vendor/swiftmailer/classes/Swift/Transport.php
  208. +502 −0 vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php
  209. +81 −0 vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
  210. +51 −0 vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
  211. +699 −0 vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php
  212. +50 −0 vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
  213. +69 −0 vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php
  214. +264 −0 vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php
  215. +35 −0 vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php
  216. +86 −0 vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php
  217. +387 −0 vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php
  218. +86 −0 vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php
  219. +67 −0 vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php
  220. +167 −0 vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php
  221. +32 −0 vendor/swiftmailer/classes/Swift/Transport/MailInvoker.php
  222. +227 −0 vendor/swiftmailer/classes/Swift/Transport/MailTransport.php
  223. +93 −0 vendor/swiftmailer/classes/Swift/Transport/NullTransport.php
  224. +159 −0 vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php
  225. +39 −0 vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php
  226. +36 −0 vendor/swiftmailer/classes/Swift/Transport/SmtpAgent.php
  227. +117 −0 vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php
  228. +321 −0 vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php
  229. +27 −0 vendor/swiftmailer/classes/Swift/TransportException.php
  230. +42 −0 vendor/swiftmailer/classes/Swift/Validate.php
  231. +23 −0 vendor/swiftmailer/dependency_maps/cache_deps.php
  232. +9 −0 vendor/swiftmailer/dependency_maps/message_deps.php
  233. +123 −0 vendor/swiftmailer/dependency_maps/mime_deps.php
  234. +76 −0 vendor/swiftmailer/dependency_maps/transport_deps.php
  235. +1,007 −0 vendor/swiftmailer/mime_types.php
  236. +35 −0 vendor/swiftmailer/preferences.php
  237. +28 −0 vendor/swiftmailer/swift_init.php
  238. +30 −0 vendor/swiftmailer/swift_required.php
  239. +30 −0 vendor/swiftmailer/swift_required_pear.php
  240. +201 −0 vendor/swiftmailer/swiftmailer_generate_mimes_config.php
@@ -2,6 +2,7 @@
namespace Controller;
+use Core\Tool;
use Core\Registry;
use Core\Security;
use Core\Translator;
@@ -24,6 +25,7 @@
* @property \Model\GitHub $gitHub
* @property \Model\LastLogin $lastLogin
* @property \Model\Ldap $ldap
+ * @property \Model\Notification $notification
* @property \Model\Project $project
* @property \Model\RememberMe $rememberMe
* @property \Model\ReverseProxyAuth $reverseProxyAuth
@@ -93,9 +95,7 @@ public function __construct(Registry $registry)
*/
public function __get($name)
{
- $class = '\Model\\'.ucfirst($name);
- $this->registry->$name = new $class($this->registry->shared('db'), $this->registry->shared('event'));
- return $this->registry->shared($name);
+ return Tool::loadModel($this->registry, $name);
}
/**
@@ -157,6 +157,7 @@ public function beforeAction($controller, $action)
$this->action->attachEvents();
$this->project->attachEvents();
$this->webhook->attachEvents();
+ $this->notification->attachEvents();
}
/**
@@ -373,7 +373,7 @@ public function save()
}
if (isset($values['positions'])) {
- $this->board->saveTasksPosition($values['positions']);
+ $this->board->saveTasksPosition($values['positions'], $values['selected_task_id']);
}
$this->response->html(
@@ -20,7 +20,8 @@ public function index()
$this->response->html($this->template->layout('config_index', array(
'db_size' => $this->config->getDatabaseSize(),
'user' => $_SESSION['user'],
- 'projects' => $this->project->getList(),
+ 'user_projects' => $this->project->getAvailableList($this->acl->getUserId()),
+ 'notifications' => $this->notification->readSettings($this->acl->getUserId()),
'languages' => $this->config->getLanguages(),
'values' => $this->config->getAll(),
'errors' => array(),
@@ -32,6 +33,13 @@ public function index()
)));
}
+ public function notifications()
+ {
+ $values = $this->request->getValues();
+ $this->notification->saveSettings($this->acl->getUserId(), $values);
+ $this->response->redirect('?controller=config#notifications');
+ }
+
/**
* Validate and save settings
*
@@ -57,7 +65,8 @@ public function save()
$this->response->html($this->template->layout('config_index', array(
'db_size' => $this->config->getDatabaseSize(),
'user' => $_SESSION['user'],
- 'projects' => $this->project->getList(),
+ 'user_projects' => $this->project->getAvailableList($this->acl->getUserId()),
+ 'notifications' => $this->notification->readSettings($this->acl->getUserId()),
'languages' => $this->config->getLanguages(),
'values' => $values,
'errors' => $errors,
View
@@ -31,4 +31,11 @@ public static function csv(array $rows, $filename = 'php://output')
fclose($fp);
}
}
+
+ public static function loadModel(Registry $registry, $name)
+ {
+ $class = '\Model\\'.ucfirst($name);
+ $registry->$name = new $class($registry);
+ return $registry->shared($name);
+ }
}
@@ -0,0 +1,76 @@
+<?php
+
+namespace Event;
+
+use Core\Listener;
+use Model\Notification;
+
+/**
+ * Base notification listener
+ *
+ * @package event
+ * @author Frederic Guillot
+ */
+abstract class BaseNotificationListener implements Listener
+{
+ /**
+ * Notification model
+ *
+ * @accesss protected
+ * @var Model\Notification
+ */
+ protected $notification;
+
+ /**
+ * Template name
+ *
+ * @accesss private
+ * @var string
+ */
+ private $template = '';
+
+ /**
+ * Fetch data for the mail template
+ *
+ * @access public
+ * @param array $data Event data
+ * @return array
+ */
+ abstract public function getTemplateData(array $data);
+
+ /**
+ * Constructor
+ *
+ * @access public
+ * @param \Model\Notification $notification Notification model instance
+ * @param string $template Template name
+ */
+ public function __construct(Notification $notification, $template)
+ {
+ $this->template = $template;
+ $this->notification = $notification;
+ }
+
+ /**
+ * Execute the action
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function execute(array $data)
+ {
+ $values = $this->getTemplateData($data);
+
+ // Get the list of users to be notified
+ $users = $this->notification->getUsersList($values['task']['project_id']);
+
+ // Send notifications
+ if ($users) {
+ $this->notification->sendEmails($this->template, $users, $values);
+ return true;
+ }
+
+ return false;
+ }
+}
@@ -0,0 +1,30 @@
+<?php
+
+namespace Event;
+
+use Event\BaseNotificationListener;
+
+/**
+ * Comment notification listener
+ *
+ * @package event
+ * @author Frederic Guillot
+ */
+class CommentNotificationListener extends BaseNotificationListener
+{
+ /**
+ * Fetch data for the mail template
+ *
+ * @access public
+ * @param array $data Event data
+ * @return array
+ */
+ public function getTemplateData(array $data)
+ {
+ $values = array();
+ $values['comment'] = $this->notification->comment->getById($data['id']);
+ $values['task'] = $this->notification->task->getById($data['task_id'], true);
+
+ return $values;
+ }
+}
@@ -0,0 +1,30 @@
+<?php
+
+namespace Event;
+
+use Event\BaseNotificationListener;
+
+/**
+ * File notification listener
+ *
+ * @package event
+ * @author Frederic Guillot
+ */
+class FileNotificationListener extends BaseNotificationListener
+{
+ /**
+ * Fetch data for the mail template
+ *
+ * @access public
+ * @param array $data Event data
+ * @return array
+ */
+ public function getTemplateData(array $data)
+ {
+ $values = array();
+ $values['file'] = $data;
+ $values['task'] = $this->notification->task->getById($data['task_id'], true);
+
+ return $values;
+ }
+}
@@ -0,0 +1,30 @@
+<?php
+
+namespace Event;
+
+use Event\BaseNotificationListener;
+
+/**
+ * SubTask notification listener
+ *
+ * @package event
+ * @author Frederic Guillot
+ */
+class SubTaskNotificationListener extends BaseNotificationListener
+{
+ /**
+ * Fetch data for the mail template
+ *
+ * @access public
+ * @param array $data Event data
+ * @return array
+ */
+ public function getTemplateData(array $data)
+ {
+ $values = array();
+ $values['subtask'] = $this->notification->subtask->getById($data['id'], true);
+ $values['task'] = $this->notification->task->getById($data['task_id'], true);
+
+ return $values;
+ }
+}
@@ -0,0 +1,29 @@
+<?php
+
+namespace Event;
+
+use Event\BaseNotificationListener;
+
+/**
+ * Task notification listener
+ *
+ * @package event
+ * @author Frederic Guillot
+ */
+class TaskNotificationListener extends BaseNotificationListener
+{
+ /**
+ * Fetch data for the mail template
+ *
+ * @access public
+ * @param array $data Event data
+ * @return array
+ */
+ public function getTemplateData(array $data)
+ {
+ $values = array();
+ $values['task'] = $this->notification->task->getById($data['task_id'], true);
+
+ return $values;
+ }
+}
@@ -402,4 +402,31 @@
// 'Clone Project' => '',
// 'Project cloned successfully.' => '',
// 'Unable to clone this project.' => '',
+ // 'Email notifications' => '',
+ // 'Enable email notifications' => '',
+ // 'Task position:' => '',
+ // 'The task #%d have been opened.' => '',
+ // 'The task #%d have been closed.' => '',
+ // 'Sub-task updated' => '',
+ // 'Title:' => '',
+ // 'Status:' => '',
+ // 'Assignee:' => '',
+ // 'Time tracking:' => '',
+ // 'New sub-task' => '',
+ // 'New attachment added "%s"' => '',
+ // 'Comment updated' => '',
+ // 'New comment posted by %s' => '',
+ // 'List of due tasks for the project "%s"' => '',
+ // '[%s][New attachment] %s (#%d)' => '',
+ // '[%s][New comment] %s (#%d)' => '',
+ // '[%s][Comment updated] %s (#%d)' => '',
+ // '[%s][New subtask] %s (#%d)' => '',
+ // '[%s][Subtask updated] %s (#%d)' => '',
+ // '[%s][New task] %s (#%d)' => '',
+ // '[%s][Task updated] %s (#%d)' => '',
+ // '[%s][Task closed] %s (#%d)' => '',
+ // '[%s][Task opened] %s (#%d)' => '',
+ // '[%s][Due tasks]' => '',
+ // '[Kanboard] Notification' => '',
+ // 'I want to receive notifications only for those projects:' => '',
);
@@ -401,4 +401,31 @@
// 'Clone Project' => '',
// 'Project cloned successfully.' => '',
// 'Unable to clone this project.' => '',
+ // 'Email notifications' => '',
+ // 'Enable email notifications' => '',
+ // 'Task position:' => '',
+ // 'The task #%d have been opened.' => '',
+ // 'The task #%d have been closed.' => '',
+ // 'Sub-task updated' => '',
+ // 'Title:' => '',
+ // 'Status:' => '',
+ // 'Assignee:' => '',
+ // 'Time tracking:' => '',
+ // 'New sub-task' => '',
+ // 'New attachment added "%s"' => '',
+ // 'Comment updated' => '',
+ // 'New comment posted by %s' => '',
+ // 'List of due tasks for the project "%s"' => '',
+ // '[%s][New attachment] %s (#%d)' => '',
+ // '[%s][New comment] %s (#%d)' => '',
+ // '[%s][Comment updated] %s (#%d)' => '',
+ // '[%s][New subtask] %s (#%d)' => '',
+ // '[%s][Subtask updated] %s (#%d)' => '',
+ // '[%s][New task] %s (#%d)' => '',
+ // '[%s][Task updated] %s (#%d)' => '',
+ // '[%s][Task closed] %s (#%d)' => '',
+ // '[%s][Task opened] %s (#%d)' => '',
+ // '[%s][Due tasks]' => '',
+ // '[Kanboard] Notification' => '',
+ // 'I want to receive notifications only for those projects:' => '',
);
@@ -401,4 +401,31 @@
// 'Clone Project' => '',
// 'Project cloned successfully.' => '',
// 'Unable to clone this project.' => '',
+ // 'Email notifications' => '',
+ // 'Enable email notifications' => '',
+ // 'Task position:' => '',
+ // 'The task #%d have been opened.' => '',
+ // 'The task #%d have been closed.' => '',
+ // 'Sub-task updated' => '',
+ // 'Title:' => '',
+ // 'Status:' => '',
+ // 'Assignee:' => '',
+ // 'Time tracking:' => '',
+ // 'New sub-task' => '',
+ // 'New attachment added "%s"' => '',
+ // 'Comment updated' => '',
+ // 'New comment posted by %s' => '',
+ // 'List of due tasks for the project "%s"' => '',
+ // '[%s][New attachment] %s (#%d)' => '',
+ // '[%s][New comment] %s (#%d)' => '',
+ // '[%s][Comment updated] %s (#%d)' => '',
+ // '[%s][New subtask] %s (#%d)' => '',
+ // '[%s][Subtask updated] %s (#%d)' => '',
+ // '[%s][New task] %s (#%d)' => '',
+ // '[%s][Task updated] %s (#%d)' => '',
+ // '[%s][Task closed] %s (#%d)' => '',
+ // '[%s][Task opened] %s (#%d)' => '',
+ // '[%s][Due tasks]' => '',
+ // '[Kanboard] Notification' => '',
+ // 'I want to receive notifications only for those projects:' => '',
);
Oops, something went wrong.

0 comments on commit 9eeded3

Please sign in to comment.