Indefero

Indefero Commit Details


Date:2009-10-08 04:23:33 (15 years 2 months ago)
Author:Loic d'Anterroches
Branch: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
Commit:b6c5e803cb798374cc65acc1422a6f4a8b3a1d61
Parents: ec8ff4f76b2036e657c71f338f872cb8b9120f85
Message:Fixed issue 114, email sent in language of commenter.

Changes:

File differences

src/IDF/Commit.php
156156
157157
158158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
159
178160
179161
180162
......
272254
273255
274256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
275291
$commit->origauthor = $change->author;
$commit->creation_dtime = $change->date;
$commit->create();
// We notify the creation of the commit
if ('' != $project->getConf()->getVal('source_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'c' => $commit,
'project' => $project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/source/commit-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$project->getConf()->getVal('source_notification_email'),
sprintf(__('New Commit %s - %s (%s)'),
$commit->scm_id, $commit->summary, $project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$commit->notify($project->getConf());
return $commit;
}
';
return $out;
}
/**
* Notification of change of the object.
*
* @param IDF_Conf Current configuration
* @param bool Creation (true)
*/
public function notify($conf, $create=true)
{
if ('' == $conf->getVal('source_notification_email', '')) {
return;
}
$current_locale = Pluf_Translation::getLocale();
$langs = Pluf::f('languages', array('en'));
Pluf_Translation::loadSetLocale($langs[0]);
$context = new Pluf_Template_Context(
array(
'c' => $this,
'project' => $this->get_project(),
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/source/commit-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$conf->getVal('source_notification_email'),
sprintf(__('New Commit %s - %s (%s)'),
$this->scm_id, $this->summary,
$this->get_project()->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
Pluf_Translation::loadSetLocale($current_locale);
}
}
src/IDF/Form/ReviewCreate.php
204204
205205
206206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
207
227208
228209
229210
$patch->commit = self::findCommit($this->cleaned_data['commit']);
$patch->patch = $this->cleaned_data['patch'];
$patch->create();
// Send create notification
if ('' != $this->project->getConf()->getVal('review_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'review' => $review,
'patch' => $patch,
'comments' => array(),
'project' => $this->project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/review/review-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$this->project->getConf()->getVal('review_notification_email'),
sprintf(__('New Code Review %s - %s (%s)'),
$review->id, $review->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$patch->notify($this->project->getConf());
return $review;
}
src/IDF/Form/ReviewFileComment.php
9393
9494
9595
96
96
9797
9898
}
$this->patch->get_review()->update(); // reindex and put up in
// the list.
return $this->patch;
return $bc;
}
}
src/IDF/Form/Upload.php
175175
176176
177177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
178
193179
194180
195181
$upload->setAssoc($tag);
}
// Send the notification
if ('' != $this->project->getConf()->getVal('downloads_notification_email', '')) {
$context = new Pluf_Template_Context(
array('file' => $upload,
'urlfile' => $upload->getAbsoluteUrl($this->project),
'project' => $this->project,
'tags' => $upload->get_tags_list(),
));
$tmpl = new Pluf_Template('idf/downloads/download-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'), $this->project->getConf()->getVal('downloads_notification_email'),
sprintf(__('New download - %s (%s)'),
$upload->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$upload->notify($this->project->getConf());
return $upload;
}
}
src/IDF/Form/WikiCreate.php
199199
200200
201201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
202
221203
222204
223205
$rev->submitter = $this->user;
$rev->summary = __('Initial page creation');
$rev->create();
// send the notification
if ('' != $this->project->getConf()->getVal('wiki_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'page' => $page,
'rev' => $rev,
'project' => $this->project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/wiki/wiki-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$this->project->getConf()->getVal('wiki_notification_email'),
sprintf(__('New Documentation Page %s - %s (%s)'),
$page->title, $page->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$rev->notify($this->project->getConf());
return $page;
}
}
src/IDF/Form/WikiUpdate.php
236236
237237
238238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
239
258240
259241
260242
$rev->summary = $this->cleaned_data['comment'];
$rev->changes = $changes;
$rev->create();
// send the notification
if ('' != $this->project->getConf()->getVal('wiki_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'page' => $this->page,
'rev' => $rev,
'project' => $this->project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/wiki/wiki-updated-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$this->project->getConf()->getVal('wiki_notification_email'),
sprintf(__('Documentation Page Changed %s - %s (%s)'),
$this->page->title, $this->page->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
$rev->notify($this->project->getConf(), false);
return $this->page;
}
}
src/IDF/Issue.php
227227
228228
229229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
230319
'content' => $content,
'date' => $date));
}
/**
* Notification of change of the object.
*
* For the moment, only email, but one can add webhooks later.
*
* Usage:
* <pre>
* $this->notify($conf); // Notify the creation
* $this->notify($conf, false); // Notify the update of the object
* </pre>
*
* @param IDF_Conf Current configuration
* @param bool Creation (true)
*/
public function notify($conf, $create=true)
{
$prj = $this->get_project();
$to_email = array();
if ('' != $conf->getVal('issues_notification_email', '')) {
$langs = Pluf::f('languages', array('en'));
$to_email[] = array($conf->getVal('issues_notification_email'),
$langs[0]);
}
$current_locale = Pluf_Translation::getLocale();
if ($create) {
if (null != $this->get_owner() and $this->owner != $this->submitter) {
$to_email[] = array($this->get_owner()->email,
$this->get_owner()->language);
}
$comments = $this->get_comments_list(array('order' => 'id ASC'));
$context = new Pluf_Template_Context(
array(
'issue' => $this,
'comment' => $comments[0],
'project' => $prj,
'url_base' => Pluf::f('url_base'),
)
);
foreach ($to_email as $email_lang) {
Pluf_Translation::loadSetLocale($email_lang[1]);
$email = new Pluf_Mail(Pluf::f('from_email'), $email_lang[0],
sprintf(__('Issue %s - %s (%s)'),
$this->id, $this->summary, $prj->shortname));
$tmpl = new Pluf_Template('idf/issues/issue-created-email.txt');
$email->addTextMessage($tmpl->render($context));
$email->sendMail();
}
} else {
$comments = $this->get_comments_list(array('order' => 'id DESC'));
foreach ($this->get_interested_list() as $interested) {
$email_lang = array($interested->email,
$interested->language);
if (!in_array($email_lang, $to_email)) {
$to_email[] = $email_lang;
}
}
$email_lang = array($this->get_submitter()->email,
$this->get_submitter()->language);
if (!in_array($email_lang, $to_email)) {
$to_email[] = $email_lang;
}
if (null != $this->get_owner()) {
$email_lang = array($this->get_owner()->email,
$this->get_owner()->language);
if (!in_array($email_lang, $to_email)) {
$to_email[] = $email_lang;
}
}
$context = new Pluf_Template_Context(
array(
'issue' => $this,
'comments' => $comments,
'project' => $prj,
'url_base' => Pluf::f('url_base'),
));
foreach ($to_email as $email_lang) {
Pluf_Translation::loadSetLocale($email_lang[1]);
$email = new Pluf_Mail(Pluf::f('from_email'), $email_lang[0],
sprintf(__('Updated Issue %s - %s (%s)'),
$this->id, $this->summary, $prj->shortname));
$tmpl = new Pluf_Template('idf/issues/issue-updated-email.txt');
$email->addTextMessage($tmpl->render($context));
$email->sendMail();
}
}
Pluf_Translation::loadSetLocale($current_locale);
}
}
src/IDF/Review/Comment.php
140140
141141
142142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
143197
{
return '';
}
/**
* Notify of the update of the review.
*
*
* @param IDF_Conf Current configuration
* @param bool Creation (true)
*/
public function notify($conf, $create=true)
{
$patch = $this->get_patch();
$review = $patch->get_review();
$prj = $review->get_project();
$to_email = array();
if ('' != $conf->getVal('review_notification_email', '')) {
$langs = Pluf::f('languages', array('en'));
$to_email[] = array($conf->getVal('issues_notification_email'),
$langs[0]);
}
$current_locale = Pluf_Translation::getLocale();
$reviewers = $review->getReviewers();
if (!Pluf_Model_InArray($review->get_submitter(), $reviewers)) {
$reviewers[] = $review->get_submitter();
}
$comments = $patch->getFileComments(array('order' => 'id DESC'));
$context = new Pluf_Template_Context(
array(
'review' => $review,
'patch' => $patch,
'comments' => $comments,
'project' => $prj,
'url_base' => Pluf::f('url_base'),
)
);
// build the list of emails and lang
foreach ($reviewers as $user) {
$email_lang = array($user->email,
$user->language);
if (!in_array($email_lang, $to_email)) {
$to_email[] = $email_lang;
}
}
$tmpl = new Pluf_Template('idf/review/review-updated-email.txt');
foreach ($to_email as $email_lang) {
Pluf_Translation::loadSetLocale($email_lang[1]);
$email = new Pluf_Mail(Pluf::f('from_email'), $email_lang[0],
sprintf(__('Updated Code Review %s - %s (%s)'),
$review->id, $review->summary, $prj->shortname));
$email->addTextMessage($tmpl->render($context));
$email->sendMail();
}
Pluf_Translation::loadSetLocale($current_locale);
}
}
src/IDF/Review/Patch.php
138138
139139
140140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
141172
{
return '';
}
public function notify($conf, $create=true)
{
if ('' == $conf->getVal('review_notification_email', '')) {
return;
}
$current_locale = Pluf_Translation::getLocale();
$langs = Pluf::f('languages', array('en'));
Pluf_Translation::loadSetLocale($langs[0]);
$context = new Pluf_Template_Context(
array(
'review' => $this->get_review(),
'patch' => $this,
'comments' => array(),
'project' => $this->get_review()->get_project(),
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/review/review-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$conf->getVal('review_notification_email'),
sprintf(__('New Code Review %s - %s (%s)'),
$this->get_review()->id,
$this->get_review()->summary,
$this->get_review()->get_project()->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
Pluf_Translation::loadSetLocale($current_locale);
}
}
src/IDF/Upload.php
218218
219219
220220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
221255
'content' => $content,
'date' => $date));
}
/**
* Notification of change of the object.
*
* @param IDF_Conf Current configuration
* @param bool Creation (true)
*/
public function notify($conf, $create=true)
{
if ('' == $conf->getVal('downloads_notification_email', '')) {
return;
}
$current_locale = Pluf_Translation::getLocale();
$langs = Pluf::f('languages', array('en'));
Pluf_Translation::loadSetLocale($langs[0]);
$context = new Pluf_Template_Context(
array('file' => $this,
'urlfile' => $this->getAbsoluteUrl($this->get_project()),
'project' => $this->get_project(),
'tags' => $this->get_tags_list(),
));
$tmpl = new Pluf_Template('idf/downloads/download-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$conf->getVal('downloads_notification_email'),
sprintf(__('New download - %s (%s)'),
$this->summary,
$this->get_project()->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
Pluf_Translation::loadSetLocale($current_locale);
}
}
src/IDF/Views/Issue.php
175175
176176
177177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
178
202179
203180
204181
......
290267
291268
292269
293
270
271
272
294273
295274
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332275
333276
334277
$issue = $form->save();
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($prj->shortname, $issue->id));
$to_emails = array();
if (null != $issue->get_owner() and $issue->owner != $issue->submitter) {
$to_emails[] = $issue->get_owner()->email;
}
if ('' != $request->conf->getVal('issues_notification_email', '')) {
$to_emails[] = $request->conf->getVal('issues_notification_email', '');
}
foreach ($to_emails as $oemail) {
$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'),
)
);
$email = new Pluf_Mail(Pluf::f('from_email'), $oemail,
sprintf(__('Issue %s - %s (%s)'),
$issue->id, $issue->summary, $prj->shortname));
$tmpl = new Pluf_Template('idf/issues/issue-created-email.txt');
$email->addTextMessage($tmpl->render($context));
$email->sendMail();
}
$issue->notify($request->conf);
if ($api) return $issue;
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been created.'), $url, $issue->id));
return new Pluf_HTTP_Response_Redirect($url);
$request->FILES),
$params);
if (!isset($request->POST['preview']) && $form->isValid()) {
$issue = $form->save();
$issue = $form->save(); // Note, should return the
// last comment
$issue->notify($request->conf, false);
$comments = $issue->get_comments_list(array('order' => 'id DESC'));
$url .= '#ic' . $comments[0]->id;
// Get the list of interested person + owner + submitter
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();
}
$context = new Pluf_Template_Context(
array(
'issue' => $issue,
'comments' => $comments,
'project' => $prj,
'url_base' => Pluf::f('url_base'),
));
$tmpl = new Pluf_Template('idf/issues/issue-updated-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail_Batch(Pluf::f('from_email'));
$to_emails = array();
foreach ($interested as $user) {
if ($user->id != $request->user->id) {
$to_emails[] = $user->email;
}
}
if ('' != $request->conf->getVal('issues_notification_email', '')) {
$to_emails[] = $request->conf->getVal('issues_notification_email');
}
foreach ($to_emails as $oemail) {
$email->setSubject(sprintf(__('Updated Issue %s - %s (%s)'),
$issue->id, $issue->summary, $prj->shortname));
$email->setTo($oemail);
$email->setReturnPath(Pluf::f('from_email'));
$email->addTextMessage($text_email);
$email->sendMail();
}
$email->close();
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been updated.'), $url, $issue->id));
return new Pluf_HTTP_Response_Redirect($url);
}
src/IDF/Views/Review.php
152152
153153
154154
155
155
156156
157157
158158
159159
160160
161161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
162
198163
199164
200165
'patch' => $patch,
));
if ($form->isValid()) {
$patch = $form->save();
$review_comment = $form->save();
$review = $patch->get_review();
$urlr = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
array($prj->shortname, $review->id));
$request->user->setMessage(sprintf(__('Your <a href="%s">code review %d</a> has been published.'), $urlr, $review->id));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::index',
array($prj->shortname));
// Get the list of reviewers + submitter
$reviewers = $review->getReviewers();
if (!Pluf_Model_InArray($review->get_submitter(), $reviewers)) {
$reviewers[] = $review->get_submitter();
}
$comments = $patch->getFileComments(array('order' => 'id DESC'));
$context = new Pluf_Template_Context(
array(
'review' => $review,
'patch' => $patch,
'comments' => $comments,
'project' => $prj,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/review/review-updated-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail_Batch(Pluf::f('from_email'));
$to_emails = array();
foreach ($reviewers as $user) {
if ($user->id != $request->user->id) {
$to_emails[] = $user->email;
}
}
if ('' != $request->conf->getVal('review_notification_email', '')) {
$to_emails[] = $request->conf->getVal('review_notification_email');
}
foreach ($to_emails as $oemail) {
$email->setSubject(sprintf(__('Updated Code Review %s - %s (%s)'),
$review->id, $review->summary, $prj->shortname));
$email->setTo($oemail);
$email->setReturnPath(Pluf::f('from_email'));
$email->addTextMessage($text_email);
$email->sendMail();
}
$email->close();
$review_comment->notify($request->conf);
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
src/IDF/WikiRevision.php
218218
219219
220220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
221277
'date' => $date));
}
/**
* Notification of change of a WikiPage.
*
* The content of a WikiPage is in the IDF_WikiRevision object,
* this is why we send the notificatin from there. This means that
* when the create flag is set, this is for the creation of a
* wikipage and not, for the addition of a new revision.
*
* Usage:
* <pre>
* $this->notify($conf); // Notify the creation of a wiki page
* $this->notify($conf, false); // Notify the update of the page
* </pre>
*
* @param IDF_Conf Current configuration
* @param bool Creation (true)
*/
public function notify($conf, $create=true)
{
if ('' == $conf->getVal('wiki_notification_email', '')) {
return;
}
$current_locale = Pluf_Translation::getLocale();
$langs = Pluf::f('languages', array('en'));
Pluf_Translation::loadSetLocale($langs[0]);
$context = new Pluf_Template_Context(
array(
'page' => $this->get_wikipage(),
'rev' => $this,
'project' => $this->get_wikipage()->get_project(),
'url_base' => Pluf::f('url_base'),
)
);
if ($create) {
$template = 'idf/wiki/wiki-created-email.txt';
$title = sprintf(__('New Documentation Page %s - %s (%s)'),
$this->get_wikipage()->title,
$this->get_wikipage()->summary,
$this->get_wikipage()->get_project()->shortname);
} else {
$template = 'idf/wiki/wiki-updated-email.txt';
$title = sprintf(__('Documentation Page Changed %s - %s (%s)'),
$this->get_wikipage()->title,
$this->get_wikipage()->summary,
$this->get_wikipage()->get_project()->shortname);
}
$tmpl = new Pluf_Template($template);
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$conf->getVal('wiki_notification_email'),
$title);
$email->addTextMessage($text_email);
$email->sendMail();
Pluf_Translation::loadSetLocale($current_locale);
}
}
src/IDF/templates/idf/review/review-created-email.txt
33
44
55
6
67
78
89
{blocktrans}The following review has been created:{/blocktrans}
{$review.id} - {$review.summary|safe}
{trans 'Project:'} {$project.name|safe}
{trans 'Status:'} {$review.get_status.name}
{trans 'Reported by:'} {$review.get_submitter|safe}
src/IDF/templates/idf/review/review-updated-email.txt
1515
1616
1717
18
1918
2019
2120
{foreach $comments as $c}{assign $who = $c.get_comment().get_submitter()}# {blocktrans}By {$who|safe}, {$c.creation_dtime|date}, on file:
{$c.cfile|safe}
{/blocktrans}
{$c.content|safe}
{/foreach}
src/IDF/templates/idf/source/commit-created-email.txt
33
44
55
6
67
78
89
{blocktrans}A new commit has been created:{/blocktrans}
{$c.summary|safe}
{trans 'Commit:'} {$c.scm_id|safe}
{trans 'Project:'} {$project.name|safe}
{trans 'Created by:'} {$c.get_author|safe}

Archive Download the corresponding diff file

Page rendered in 0.13006s using 14 queries.