var $FRSPackage;
var $release_files;
var $files_count = null;
+ var $send_notice = true;
/**
* @param object $FRSPackage The FRSPackage object to which this release is associated.
@mkdir($newdirlocation);
}
db_commit();
+ if ($status_id == 1) {
+ $this->sendNotice();
+ }
return true;
}
}
function getReleaseDate() {
return $this->data_array['release_date'];
}
+
+ /**
+ * setSendNotice - sets if the notice email should be send
+ * @param $value true/false
+ */
+ function setSendNotice($value) {
+ $this->send_notice = $value;
+ }
+
+ /**
+ * getSendNotice - get if the notice email should be send
+ * @return true/false
+ */
+ function getSendNotice() {
+ return $this->send_notice;
+ }
/**
* sendNotice - the logic to send an email notice for a release.
*/
function sendNotice() {
$arr =& $this->FRSPackage->getMonitorIDs();
+ $project_adresses = $this->FRSPackage->Group->getFRSEmailAddress();
$subject = sprintf(_('[%1$s Release] %2$s'),
$this->FRSPackage->Group->getUnixName(),
forge_get_config('forge_name'))
. "\n\n"
. util_make_url('/frs/monitor.php?filemodule_id='.$this->FRSPackage->getID()."&group_id=".$this->FRSPackage->Group->getID()."&stop=1");
- if (count($arr)) {
- util_handle_message(array_unique($arr), $subject, $text);
+ if (count($arr) || strlen($project_adresses) > 0) {
+ util_handle_message(array_unique($arr), $subject, $text, $project_adresses);
}
}
if ($this->hasFiles()) {
$this->FRSPackage->createReleaseFilesAsZip($this->getID());
}
+ if ($this->getSendNotice()) {
+ $this->sendNotice();
+ }
return true;
}
$userfile_name = $userfile['name'];
$type_id = getIntFromRequest('type_id');
$release_name = getStringFromRequest('release_name');
+$status_id = getIntFromRequest('status_id');
$uploaded_notes = getUploadedFile('uploaded_notes');
$uploaded_changes = getUploadedFile('uploaded_changes');
$release_notes = getStringFromRequest('release_notes');
if ($exec_changes) {
$frsr = new FRSRelease($frsp);
- if ($frsr->create($release_name, $notes, $changes, $preformatted, $release_date)) {
+ if ($frsr->create($release_name, $notes, $changes, $preformatted, $release_date, $status_id)) {
$feedback = _('Release successfully created');
if (strlen($userfile_name) || strlen($ftp_filename) || strlen($manual_filename) || $docman_fileid) {
$ret = frs_add_file_from_form($frsr, $type_id, $processor_id, $release_date, $userfile, $ftp_filename, $manual_filename, $docman_fileid);
$release_date = getStringFromRequest('release_date');
$release_name = getStringFromRequest('release_name');
$status_id = getIntFromRequest('status_id');
+$send_notice = getIntFromRequest('send_notice');
$uploaded_notes = getUploadedFile('uploaded_notes');
$uploaded_changes = getUploadedFile('uploaded_changes');
$release_notes = getStringFromRequest('release_notes');
// If we haven't encountered any problems so far then save the changes
if ($exec_changes) {
+ $frsr->setSendNotice($send_notice == 1 && $frsr->getStatus() == 3 && $status_id == 1);
$release_date = strtotime($release_date);
if (!$frsr->update($status_id, $release_name, $notes, $changes, $preformatted, $release_date)) {
$error_msg = $frsr->getErrorMessage();
echo $HTML->multiTableRow(array(), $cells);
$cells = array();
$cells[][] = '<strong>'._('Status')._(':').'</strong>';
- $cells[][] = frs_show_status_popup('status_id',$frsr->getStatus());
+ $cells[][] = frs_show_status_popup('status_id',$frsr->getStatus()).($frsr->getStatus() == 3?' <input type="checkbox" name="send_notice" value="1" checked="checked"> '. _('Send release notice email if set to active'):'');
echo $HTML->multiTableRow(array(), $cells);
$cells = array();
$cells[] = array(_('Edit the Release Notes or Change Log for this release of this package. These changes will apply to all files attached to this release.').'<br/>'.
$cells[][] = html_e('input', array('type' => 'text', 'name' => 'release_date', 'value' => date('Y-m-d H:i'), 'size' => 16, 'maxlength' => 16));
echo $HTML->multiTableRow(array(), $cells);
$cells = array();
+$cells[][] = html_e('strong', array(), _('Status')._(':'));
+$cells[][] = frs_show_status_popup('status_id',1)." " . _("NOTE: Release notification will only be send if status is active.");
+echo $HTML->multiTableRow(array(), $cells);
+$cells = array();
$cells[][] = html_e('strong', array(), _('File Name')._(':'));
$content = $HTML->information(sprintf(_('You can probably not upload files larger than about %.2f MiB in size.'), human_readable_bytes(util_get_maxuploadfilesize()))).
_('Upload a new file')._(': ').html_e('input', array('type' => 'file', 'name' => 'userfile', 'size' => 30));