Indefero

Indefero Commit Details


Date:2008-08-07 16:12:24 (16 years 4 months ago)
Author:Loic d'Anterroches
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3, svn
Commit:6360ea93be9ad4ec6b6885a9e9812347bec413ec
Parents: 4b2139fe997a0743af5a1e40ef54badd668444ac
Message:Fixed issue 13, email notifications.

Email notifications are now sent at creation/modification of an issue.
Changes:

File differences

src/IDF/Issue.php
136136
137137
138138
139
139
140140
141141
142142
......
144144
145145
146146
147
147
148148
149149
150150
}
function preSave()
function preSave($create=false)
{
if ($this->id == '') {
$this->creation_dtime = gmdate('Y-m-d H:i:s');
$this->modif_dtime = gmdate('Y-m-d H:i:s');
}
function postSave()
function postSave($create=false)
{
// This will be used to fire the indexing or send a
// notification email to the interested people, etc.
src/IDF/IssueComment.php
9090
9191
9292
93
93
9494
9595
9696
......
9898
9999
100100
101
101
102102
103103
104104
105105
106106
107107
108
108
109109
110110
111111
function changedIssue()
{
return count($this->changes) > 0;
return (is_array($this->changes) and count($this->changes) > 0);
}
function _toIndex()
return $this->content;
}
function preSave()
function preSave($create=false)
{
if ($this->id == '') {
$this->creation_dtime = gmdate('Y-m-d H:i:s');
}
}
function postSave()
function postSave($create=false)
{
// This will be used to fire the indexing or send a
// notification email to the interested people, etc.
src/IDF/Project.php
9090
9191
9292
93
93
9494
9595
9696
}
function preSave()
function preSave($create=false)
{
if ($this->id == '') {
$this->creation_dtime = gmdate('Y-m-d H:i:s');
src/IDF/Tag.php
8989
9090
9191
92
92
9393
9494
9595
);
}
function preSave()
function preSave($create=false)
{
$this->lcname = mb_strtolower($this->name);
}
src/IDF/Upload.php
133133
134134
135135
136
136
137137
138138
139139
return '';
}
function preSave()
function preSave($create=false)
{
if ($this->id == '') {
$this->creation_dtime = gmdate('Y-m-d H:i:s');
src/IDF/Views/Issue.php
144144
145145
146146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
147165
148166
149167
......
186204
187205
188206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
189239
190240
191241
$urlissue = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($prj->shortname, $issue->id));
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been created.'), $urlissue, $issue->id));
if (null != $issue->get_owner() and $issue->owner != $issue->submitter) {
$comments = $issue->get_comments_list(array('order' => 'id ASC'));
$context = new Pluf_Template_Context(
array(
'issue' => $issue,
'comment' => $comments[0],
'project' => $prj,
'url_base' => Pluf::f('url_base'),
)
);
$oemail = $issue->get_owner()->email;
$email = new Pluf_Mail(Pluf::f('from_email'), $oemail,
sprintf(__('Issue %s - %s (InDefero)'),
$issue->id, $issue->summary));
$tmpl = new Pluf_Template('issues/issue-created-email.txt');
$email->addTextMessage($tmpl->render($context));
$email->sendMail();
}
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
$urlissue = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($prj->shortname, $issue->id));
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been updated.'), $urlissue, $issue->id));
// Get the list of interested person + owner + submitter
$interested = $issue->get_interested_list();
if (!Pluf_Model_InArray($issue->get_submitter(), $interested)) {
$interested[] = $issue->get_submitter();
}
if (null != $issue->get_owner() and
!Pluf_Model_InArray($issue->get_owner(), $interested)) {
$interested[] = $issue->get_owner();
}
$comments = $issue->get_comments_list(array('order' => 'id DESC'));
$context = new Pluf_Template_Context(
array(
'issue' => $issue,
'comments' => $comments,
'project' => $prj,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('issues/issue-updated-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail_Batch(Pluf::f('from_email'));
foreach ($interested as $user) {
if ($user->id != $request->user->id) {
$email->setSubject(sprintf(__('Updated Issue %s - %s (InDefero)'),
$issue->id, $issue->summary));
$email->setTo($user->email);
$email->setReturnPath(Pluf::f('from_email'));
$email->addTextMessage($text_email);
$email->sendMail();
}
}
$email->close();
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
src/IDF/templates/issues/issue-created-email.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{trans 'Hello,'}
{blocktrans}A new issue has been created and assigned
to you:{/blocktrans}
{$issue.id} - {$issue.summary|safe}
{trans 'Project:'} {$project.name|safe}
{trans 'Status:'} {$issue.get_status.name|safe}
{trans 'Reported by:'} {$issue.get_submitter|safe}
{assign $tags = $issue.get_tags_list()}{if $tags.count()}{trans 'Labels:'}
{foreach $tags as $tag} {$tag.class|safe}:{$tag.name|safe}
{/foreach}{/if}
{trans 'Description:'}
{$comment.content|safe}
--
{trans 'Issue:'} {$url_base}{url 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}
src/IDF/templates/issues/issue-updated-email.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{trans 'Hello,'}
{blocktrans}The following issue has been updated:{/blocktrans}
{$issue.id} - {$issue.summary|safe}
{trans 'Project:'} {$project.name|safe}
{trans 'Status:'} {$issue.get_status.name}
{trans 'Reported by:'} {$issue.get_submitter|safe}
{trans 'URL:'} {$url_base}{url 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}
{assign $tags = $issue.get_tags_list()}{if $tags.count()}{trans 'Labels:'}
{foreach $tags as $tag} {$tag.class|safe}:{$tag.name|safe}
{/foreach}
{/if}{trans 'Comments (last first):'}
{foreach $comments as $c}{assign $who = $c.get_submitter()}# {blocktrans}By {$who|safe}, {$c.creation_dtime|date}:{/blocktrans}
{if strlen($c.content) > 0}{$c.content|safe}{else}{trans '(No comments were given for this change.)'}{/if}{if $c.changedIssue()}
{foreach $c.changes as $w => $v}
{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if} {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}{/foreach}{/if}
{/foreach}
--
{trans 'Issue:'} {$url_base}{url 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}

Archive Download the corresponding diff file

Page rendered in 0.11874s using 14 queries.