diff --git a/codepot/etc/codepot.ini.in b/codepot/etc/codepot.ini.in index c046a2d4..e7f3dbe8 100644 --- a/codepot/etc/codepot.ini.in +++ b/codepot/etc/codepot.ini.in @@ -296,6 +296,11 @@ commit_review_notification = "yes" ;------------------------------------------------------------------------------ commit_notification_url = "" +;------------------------------------------------------------------------------ +; Send notification upon new issue registration if yes +;------------------------------------------------------------------------------ +issue_notification = "yes" + ;------------------------------------------------------------------------------ ; Codepot sets this revision property to assign a tag to a specific revision. ;------------------------------------------------------------------------------ diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index b66357eb..8d3011aa 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -266,6 +266,8 @@ class Issue extends Controller //} else { + $issue_url_base = $this->input->post('issue_url_base'); + $issue = new stdClass(); $issue->projectid = $projectid; $issue->summary = $this->input->post('issue_new_summary'); @@ -332,13 +334,28 @@ class Issue extends Controller if ($status == '') { - if ($this->issues->createWithFiles ($login['id'], $issue, $attached_files, $this->upload) === FALSE) + $issue_sno = $this->issues->createWithFiles ($login['id'], $issue, $attached_files, $this->upload); + if ($issue_sno === FALSE) { $status = 'error - ' . $this->issues->getErrorMessage(); } else { $status = 'ok'; + + if (CODEPOT_ISSUE_NOTIFICATION) + { + // TODO: message localization + $email_subject = sprintf ( + 'New issue #%d for %s by %s in %s', + $issue_sno, $issue->owner, $login['id'], $projectid + ); + + $email_message = $issue_url_base . '/' . $this->converter->AsciiToHex((string)$issue_sno) . "\r\n" . $issue->summary; + $this->projects->emailMessageToMembers ( + $projectid, $this->login, $email_subject, $email_message + ); + } } } } diff --git a/codepot/src/codepot/views/issue_home.php b/codepot/src/codepot/views/issue_home.php index 212275a0..38e42323 100644 --- a/codepot/src/codepot/views/issue_home.php +++ b/codepot/src/codepot/views/issue_home.php @@ -176,6 +176,7 @@ $(function () { form_data.append ('issue_new_owner', $('#issue_home_new_owner').val()); form_data.append ('issue_new_summary', $('#issue_home_new_summary').val()); form_data.append ('issue_new_description', $('#issue_home_new_description').val()); + form_data.append ('issue_url_base', codepot_merge_path('', 'id}"; ?>')); $('#issue_home_new_form').dialog('disable'); $.ajax({ diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index 429ca936..25ed05a6 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -96,7 +96,8 @@ function load_ini ($file) array ('email_sender', 'string', ''), array ('commit_notification', 'boolean', TRUE), array ('commit_review_notification', 'boolean', TRUE), - array ('commit_notification_url', 'string', ''), + array ('commit_notification_url', 'string', ''), // used by the svn post-commit script + array ('issue_notification', 'boolean', TRUE), array ('svn_tag_property', 'string', 'codepot:tag'),