Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/controllers/components/editors.php
diff options
context:
space:
mode:
Diffstat (limited to 'site/app/controllers/components/editors.php')
-rw-r--r--site/app/controllers/components/editors.php103
1 files changed, 93 insertions, 10 deletions
diff --git a/site/app/controllers/components/editors.php b/site/app/controllers/components/editors.php
index 0abb343..4b9dd47 100644
--- a/site/app/controllers/components/editors.php
+++ b/site/app/controllers/components/editors.php
@@ -54,7 +54,7 @@ class EditorsComponent extends Object {
function reviewNominatedAddon($addon, $data) {
//Make sure add-on is actually nominated
if ($addon['Addon']['status'] != STATUS_NOMINATED) {
- $this->controller->Errors->addError(_('This add-on has not been nominated'));
+ $this->controller->Error->addError(___('editor_review_error_addon_not_nominated', 'This add-on has not been nominated'));
return false;
}
@@ -76,12 +76,12 @@ class EditorsComponent extends Object {
$addonData['status'] = STATUS_NOMINATED;
}
else {
- $this->controller->Error->addError(_('Please select a review action.'));
+ $this->controller->Error->addError(___('editor_review_error_no_action', 'Please select a review action.'));
return false;
}
if (empty($data['Approval']['comments'])) {
- $this->controller->Error->addError(_('Please enter review comments.'));
+ $this->controller->Error->addError(___('editor_review_error_no_comments', 'Please enter review comments.'));
return false;
}
@@ -158,7 +158,7 @@ class EditorsComponent extends Object {
*/
function reviewPendingFiles($addon, $data) {
if (empty($data['Approval']['File'])) {
- $this->controller->addError(_('Please select at least one file to review.'));
+ $this->controller->addError(___('editor_review_error_no_files', 'Please select at least one file to review.'));
return false;
}
@@ -179,22 +179,22 @@ class EditorsComponent extends Object {
$fileData['status'] = STATUS_PENDING;
}
else {
- $this->controller->Error->addError(_('Please select a review action.'));
+ $this->controller->Error->addError(___('editor_review_error_no_action', 'Please select a review action.'));
return false;
}
if (empty($data['Approval']['comments'])) {
- $this->controller->Error->addError(_('Please enter review comments.'));
+ $this->controller->Error->addError(___('editor_review_error_no_comments', 'Please enter review comments.'));
return false;
}
if (empty($data['Approval']['applications'])) {
- $this->controller->Error->addError(_('Please enter the tested applications.'));
+ $this->controller->Error->addError(___('editor_review_error_no_applications', 'Please enter the tested applications.'));
return false;
}
if (empty($data['Approval']['os'])) {
- $this->controller->Error->addError(_('Please enter the tested operating systems.'));
+ $this->controller->Error->addError(___('editor_review_error_no_operating_system', 'Please enter the tested operating systems.'));
return false;
}
@@ -210,7 +210,7 @@ class EditorsComponent extends Object {
// Make sure file is pending review
if ($file['File']['status'] != STATUS_PENDING) {
- $this->controller->Error->addError(_('File not pending review.'));
+ $this->controller->Error->addError(___('editor_review_error_file_not_pending', 'File not pending review.'));
return false;
}
@@ -262,13 +262,16 @@ class EditorsComponent extends Object {
'version' => !empty($version) ? $version['Version']['version'] : '',
'files' => $files
);
-
$this->controller->set('info', $emailInfo);
if ($data['Approval']['ActionField'] != 'superreview') {
$this->controller->Email->template = 'email/pending/'.$data['Approval']['ActionField'];
$this->controller->Email->to = $emailInfo['email'];
+<<<<<<< HEAD:site/app/controllers/components/editors.php
$this->controller->Email->subject = sprintf(_('Sugar Labs Activities: %s %s'), $emailInfo['name'], $emailInfo['version']);
+=======
+ $this->controller->Email->subject = sprintf('Mozilla Add-ons: %s %s', $emailInfo['name'], $emailInfo['version']);
+>>>>>>> svn:site/app/controllers/components/editors.php
}
else {
$this->controller->Email->template = 'email/superreview';
@@ -282,6 +285,52 @@ class EditorsComponent extends Object {
}
/**
+ * Request more information from an author regarding an update/nomination
+ * request
+ */
+ function requestInformation($addon, $data) {
+ global $valid_status;
+
+ // store information request
+ $session = $this->controller->Session->read('User');
+ foreach($data['Approval']['File'] as $_fid) {
+ if ($_fid > 0) {
+ $file_id = $_fid;
+ break;
+ }
+ }
+ $approvalData = array(
+ 'user_id' => $session['id'],
+ 'reviewtype' => 'info',
+ 'action' => 0,
+ 'addon_id' => $addon['Addon']['id'],
+ 'comments' => $data['Approval']['comments']
+ );
+ $this->controller->Approval->save($approvalData);
+ $infoid = $this->controller->Approval->getLastInsertID();
+
+ // send email to all authors
+ $authors = array();
+ foreach ($addon['User'] as &$user) $authors[] = $user['email'];
+
+ $versionid = $this->controller->Version->getVersionByAddonId($addon['Addon']['id'], $valid_status);
+ $version = $this->controller->Version->findById($versionid, null, null, -1);
+
+ $emailInfo = array(
+ 'name' => $addon['Translation']['name']['string'],
+ 'infoid' => $infoid,
+ 'reviewer' => $session['firstname'].' '.$session['lastname'],
+ 'comments' => $data['Approval']['comments'],
+ 'version' => !empty($version) ? $version['Version']['version'] : ''
+ );
+ $this->controller->publish('info', $emailInfo, false);
+ $this->controller->Email->template = 'email/inforequest';
+ $this->controller->Email->to = implode(', ', $authors);
+ $this->controller->Email->subject = sprintf('Mozilla Add-ons: %s %s', $emailInfo['name'], $emailInfo['version']);
+ $this->controller->Email->send();
+ }
+
+ /**
* Jump to specific item in queue
* redirects to review page if item was found, to queue otherwise
* @param string $listtype 'nominated' or 'pending'
@@ -318,5 +367,39 @@ class EditorsComponent extends Object {
// if we did not find anything, redirect to queue
$this->controller->redirect("/editors/queue/{$listtype}");
}
+
+ /**
+ * Notify subscribed editors of an add-on's update
+ * @param int $addonid ID of add-on that was updated
+ * @param int $versionid ID of the add-on's new version
+ */
+ function updateNotify($addonid, $versionid) {
+ $_ids = $this->controller->EditorSubscription->getSubscribers($addonid);
+ if (empty($_ids)) return;
+ $subscribers = $this->controller->User->findAllById($_ids, null, null, null, null, -1);
+
+ $addon = $this->controller->Addon->getAddon($addonid);
+ $version = $this->controller->Version->findById($versionid, null, null, null, null, -1);
+
+ // send out notification email(s)
+ $emailInfo = array(
+ 'id' => $addonid,
+ 'name' => $addon['Translation']['name']['string'],
+ 'versionid' => $versionid,
+ 'version' => $version['Version']['version']
+ );
+ $this->controller->publish('info', $emailInfo, false);
+
+ $this->controller->Email->template = '../editors/email/notify_update';
+ $this->controller->Email->subject = sprintf('Mozilla Add-ons: %s Updated', $emailInfo['name']);
+
+ foreach ($subscribers as &$subscriber) {
+ $this->controller->Email->to = $subscriber['User']['email'];
+ $result = $this->controller->Email->send();
+ // unsubscribe user from further updates
+ $this->controller->EditorSubscription->cancelUpdates($subscriber['User']['id'], $addonid);
+ }
+
+ }
}
?>