View | Details | Raw Unified | Return to bug 3922 | Differences between
and this patch

Collapse All | Expand All

(-)classes/article/Article.inc.php (+68 lines)
 Lines 423-428    Link Here 
423
		);
423
		);
424
		return $commentsStatusOptions;
424
		return $commentsStatusOptions;
425
	}
425
	}
426
	
427
	/**
428
	 * Get an array of user IDs associated with this article
429
	 * @param $authors boolean
430
	 * @param $reviewers boolean
431
	 * @param $editors boolean
432
	 * @param $proofreaders boolean
433
	 * @param $copyeditors boolean
434
	 * @param $layoutEditors boolean
435
	 * @return array User IDs
436
	 */
437
	function getAssociatedUserIds($authors = true, $reviewers = true, $editors = true, $proofreaders = true, $copyeditors = true, $layoutEditors = true) {
438
		$articleId = $this->getArticleId();
439
		
440
		$userIds = array();
441
442
		if($authors) {
443
			$authorDao = &DAORegistry::getDAO('AuthorDAO');
444
			$authors = $authorDao->getAuthorsByArticle($articleId);
445
			foreach ($authors as $author) {
446
				$userIds[] = array('id' => $author->getAuthorId(), 'role' => 'author');
447
			}
448
		}
449
		
450
		if($editors) {
451
			$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
452
			$editAssignments =& $editAssignmentDao->getEditorAssignmentsByArticleId($articleId);
453
			while ($editAssignment =& $editAssignments->next()) {
454
				$userIds[] = array('id' => $editAssignment->getEditorId(), 'role' => 'editor');
455
				unset($editAssignment);
456
			}
457
		}
458
		
459
		if($copyeditors) {
460
			$copyAssignmentDao = &DAORegistry::getDAO('CopyAssignmentDAO');
461
			$copyAssignment =& $copyAssignmentDao->getCopyAssignmentByArticleId($articleId);
462
			if ($copyAssignment != null && $copyAssignment->getCopyeditorId() > 0) {
463
				$userIds[] =array('id' =>  $copyAssignment->getCopyeditorId(), 'role' => 'copyeditor');
464
			}
465
		}
466
		
467
		if($layoutEditors) {
468
			$layoutAssignmentDao = &DAORegistry::getDAO('LayoutAssignmentDAO');
469
			$layoutEditorId = $layoutAssignmentDao->getLayoutEditorIdByArticleId($articleId);
470
			if ($layoutEditorId != null && $layoutEditorId > 0) {
471
				$userIds[] = array('id' => $layoutEditorId, 'role' => 'layoutEditor');
472
			}
473
		}	
474
		
475
		if($proofreaders) {
476
			$proofAssignmentDao = &DAORegistry::getDAO('ProofAssignmentDAO');
477
			$proofAssignment =& $proofAssignmentDao->getProofAssignmentByArticleId($articleId);
478
			if ($proofAssignment != null && $proofAssignment->getProofreaderId() > 0) {
479
				$userIds[] = array('id' => $proofAssignment->getProofreaderId(), 'role' => 'proofreader');
480
			}
481
		}
482
		
483
		if($reviewers) {
484
			$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
485
			$reviewAssignments =& $reviewAssignmentDao->getReviewAssignmentsByArticleId($articleId);
486
			foreach ($reviewAssignments as $reviewAssignment) {
487
				$userIds[] = array('id' => $reviewAssignment->getReviewerId(), 'role' => 'reviewer');
488
				unset($reviewAssignment);
489
			}
490
		}
491
				
492
		return $userIds;
493
	}
426
}
494
}
427
495
428
?>
496
?>
(-)classes/core/OJSApplication.inc.php (-1 lines)
 Lines 145-151    Link Here 
145
			'JournalStatisticsDAO' => 'journal.JournalStatisticsDAO',
145
			'JournalStatisticsDAO' => 'journal.JournalStatisticsDAO',
146
			'LayoutAssignmentDAO' => 'submission.layoutAssignment.LayoutAssignmentDAO',
146
			'LayoutAssignmentDAO' => 'submission.layoutAssignment.LayoutAssignmentDAO',
147
			'LayoutEditorSubmissionDAO' => 'submission.layoutEditor.LayoutEditorSubmissionDAO',
147
			'LayoutEditorSubmissionDAO' => 'submission.layoutEditor.LayoutEditorSubmissionDAO',
148
			'NotificationStatusDAO' => 'journal.NotificationStatusDAO',
149
			'OAIDAO' => 'oai.ojs.OAIDAO',
148
			'OAIDAO' => 'oai.ojs.OAIDAO',
150
			'OJSCompletedPaymentDAO' => 'payment.ojs.OJSCompletedPaymentDAO',
149
			'OJSCompletedPaymentDAO' => 'payment.ojs.OJSCompletedPaymentDAO',
151
			'PluginSettingsDAO' => 'plugins.PluginSettingsDAO',
150
			'PluginSettingsDAO' => 'plugins.PluginSettingsDAO',
(-)classes/install/Upgrade.inc.php (-1 / +1 lines)
 Lines 463-469    Link Here 
463
		$tables = array(
463
		$tables = array(
464
			'versions', 'site', 'site_settings', 'scheduled_tasks',
464
			'versions', 'site', 'site_settings', 'scheduled_tasks',
465
			'sessions', 'journal_settings',
465
			'sessions', 'journal_settings',
466
			'plugin_settings', 'roles', 'notification_status', 
466
			'plugin_settings', 'roles', 
467
			'section_settings', 'section_editors', 'issue_settings',
467
			'section_settings', 'section_editors', 'issue_settings',
468
			'custom_issue_orders', 'custom_section_orders',
468
			'custom_issue_orders', 'custom_section_orders',
469
			'article_settings', 'article_author_settings',
469
			'article_settings', 'article_author_settings',
(-)classes/journal/Journal.inc.php (+8 lines)
 Lines 175-180    Link Here 
175
	function getJournalId() {
175
	function getJournalId() {
176
		return $this->getData('journalId');
176
		return $this->getData('journalId');
177
	}
177
	}
178
	
179
	/**
180
	 * Get ID of journal (for generic calls in PKP WAL).
181
	 * @return int
182
	 */
183
	function getId() {
184
		return $this->getData('journalId');
185
	}
178
186
179
	/**
187
	/**
180
	 * Set ID of journal.
188
	 * Set ID of journal.
(-)classes/journal/JournalDAO.inc.php (-3 lines)
 Lines 142-150    Link Here 
142
		$issueDao = &DAORegistry::getDAO('IssueDAO');
142
		$issueDao = &DAORegistry::getDAO('IssueDAO');
143
		$issueDao->deleteIssuesByJournal($journalId);
143
		$issueDao->deleteIssuesByJournal($journalId);
144
144
145
		$notificationStatusDao = &DAORegistry::getDAO('NotificationStatusDAO');
146
		$notificationStatusDao->deleteNotificationStatusByJournal($journalId);
147
148
		$emailTemplateDao = &DAORegistry::getDAO('EmailTemplateDAO');
145
		$emailTemplateDao = &DAORegistry::getDAO('EmailTemplateDAO');
149
		$emailTemplateDao->deleteEmailTemplatesByJournal($journalId);
146
		$emailTemplateDao->deleteEmailTemplatesByJournal($journalId);
150
147
(-)classes/manager/form/AnnouncementForm.inc.php (-1 / +21 lines)
 Lines 129-134    Link Here 
129
	function execute() {
129
	function execute() {
130
		$announcementDao = &DAORegistry::getDAO('AnnouncementDAO');
130
		$announcementDao = &DAORegistry::getDAO('AnnouncementDAO');
131
		$journal = &Request::getJournal();
131
		$journal = &Request::getJournal();
132
		$journalId = $journal->getJournalId();
132
133
133
		if (isset($this->announcementId)) {
134
		if (isset($this->announcementId)) {
134
			$announcement = &$announcementDao->getAnnouncement($this->announcementId);
135
			$announcement = &$announcementDao->getAnnouncement($this->announcementId);
 Lines 138-144    Link Here 
138
			$announcement = new Announcement();
139
			$announcement = new Announcement();
139
		}
140
		}
140
141
141
		$announcement->setJournalId($journal->getJournalId());
142
		$announcement->setJournalId($journalId);
142
		$announcement->setTitle($this->getData('title'), null); // Localized
143
		$announcement->setTitle($this->getData('title'), null); // Localized
143
		$announcement->setDescriptionShort($this->getData('descriptionShort'), null); // Localized
144
		$announcement->setDescriptionShort($this->getData('descriptionShort'), null); // Localized
144
		$announcement->setDescription($this->getData('description'), null); // Localized
145
		$announcement->setDescription($this->getData('description'), null); // Localized
 Lines 162-167    Link Here 
162
			$announcement->setDatetimePosted(Core::getCurrentDate());
163
			$announcement->setDatetimePosted(Core::getCurrentDate());
163
			$announcementDao->insertAnnouncement($announcement);
164
			$announcementDao->insertAnnouncement($announcement);
164
		}
165
		}
166
		
167
		// Send a notification to associated users
168
		import('notification.Notification');
169
		$roleDao = &DAORegistry::getDAO('RoleDAO');
170
		$notificationUsers = array();
171
		$allUsers = $roleDao->getUsersByJournalId($journalId);
172
		while (!$allUsers->eof()) {
173
			$user = &$allUsers->next();
174
			$notificationUsers[] = array('id' => $user->getUserId());
175
			unset($user);
176
		}
177
		$url = Request::url(null, 'announcement', 'view', array(1));
178
		foreach ($notificationUsers as $user) {
179
			Notification::createNotification($user['id'], "notification.type.newAnnouncement",
180
				null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT);
181
		}
182
		$notificationDao = &DAORegistry::getDAO('NotificationDAO');
183
		$notificationDao->sendToMailingList(Notification::createNotification(0, "notification.type.newAnnouncement",
184
				null, $url, 1, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT));
165
	}
185
	}
166
}
186
}
167
187
(-)classes/notification/Notification.inc.php (+137 lines)
Added Link Here 
1
<?php
2
3
/**
4
 * @file classes/notification/Notification.inc.php
5
 *
6
 * Copyright (c) 2003-2008 John Willinsky
7
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
8
 *
9
 * @class OJSNotification
10
 * @ingroup notification
11
 * @see NotificationDAO
12
 * @brief OJS subclass for Notifications (defines OJS-specific types and icons).
13
 */
14
15
// $Id: Notification.inc.php,v 1.10 2008/07/01 01:16:09 asmecher Exp $
16
17
18
/** Notification associative types. */
19
define('NOTIFICATION_TYPE_ARTICLE_SUBMITTED', 		0x1000001);
20
define('NOTIFICATION_TYPE_METADATA_MODIFIED', 		0x1000002);
21
define('NOTIFICATION_TYPE_SUPP_FILE_ADDED', 			0x1000003);
22
define('NOTIFICATION_TYPE_SUPP_FILE_MODIFIED', 		0x1000004);
23
define('NOTIFICATION_TYPE_GALLEY_ADDED', 				0x1000005);
24
define('NOTIFICATION_TYPE_GALLEY_MODIFIED', 			0x1000006);
25
define('NOTIFICATION_TYPE_SUBMISSION_COMMENT', 		0x1000007);
26
define('NOTIFICATION_TYPE_LAYOUT_COMMENT', 			0x1000008);
27
define('NOTIFICATION_TYPE_COPYEDIT_COMMENT', 			0x1000009);
28
define('NOTIFICATION_TYPE_PROOFREAD_COMMENT', 		0x1000010);
29
define('NOTIFICATION_TYPE_REVIEWER_COMMENT', 			0x1000011);
30
define('NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT', 	0x1000012);
31
define('NOTIFICATION_TYPE_EDITOR_DECISION_COMMENT', 	0x1000013);
32
define('NOTIFICATION_TYPE_USER_COMMENT', 				0x10000014);
33
define('NOTIFICATION_TYPE_PUBLISHED_ISSUE', 			0x10000015);
34
define('NOTIFICATION_TYPE_NEW_ANNOUNCEMENT', 			0x10000016);
35
36
import('notification.PKPNotification');
37
import('notification.NotificationDAO');
38
39
class Notification extends PKPNotification {
40
41
	/**
42
	 * Constructor.
43
	 */
44
	function Notification() {
45
		parent::PKPNotification();
46
	}
47
	
48
	/**
49
	 * return the path to the icon for this type
50
	 * @return string
51
	 */
52
	function getIconLocation() {
53
		$baseUrl = Request::getBaseUrl() . '/lib/pkp/templates/images/icons/';
54
		switch ($this->getAssocType()) {
55
			case NOTIFICATION_TYPE_ARTICLE_SUBMITTED:
56
			case NOTIFICATION_TYPE_GALLEY_ADDED:
57
			case NOTIFICATION_TYPE_SUPP_FILE_ADDED:
58
				return $baseUrl . 'page_new.gif';
59
				break;
60
			case NOTIFICATION_TYPE_SUPP_FILE_MODIFIED:
61
			case NOTIFICATION_TYPE_SUPP_FILE_ADDED:
62
				return $baseUrl . 'page_attachment.gif';
63
				break;
64
			
65
			case NOTIFICATION_TYPE_METADATA_MODIFIED:
66
			case NOTIFICATION_TYPE_GALLEY_MODIFIED:
67
				return $baseUrl . 'edit.gif';
68
				break;
69
			case NOTIFICATION_TYPE_SUBMISSION_COMMENT:
70
			case NOTIFICATION_TYPE_LAYOUT_COMMENT:
71
			case NOTIFICATION_TYPE_COPYEDIT_COMMENT:
72
			case NOTIFICATION_TYPE_PROOFREAD_COMMENT:
73
			case NOTIFICATION_TYPE_REVIEWER_COMMENT:
74
			case NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT:
75
			case NOTIFICATION_TYPE_EDITOR_DECISION_COMMENT:
76
			case NOTIFICATION_TYPE_USER_COMMENT:
77
				return $baseUrl . 'comment_new.gif';
78
				break;
79
			case NOTIFICATION_TYPE_PUBLISHED_ISSUE:
80
				return $baseUrl . 'list_world.gif';
81
				break;
82
			case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT:
83
				return $baseUrl . 'note_new.gif';
84
				break;
85
			default:
86
				return $baseUrl . 'page_alert.gif';
87
		}
88
	}
89
	
90
	/**
91
	 * Static function to send an email to a mailing list user regarding signup or a lost password
92
	 * @param $email string
93
	 * @param $password string the user's password
94
	 * @param $template string The mail template to use
95
	 */
96
	function sendMailingListEmail($email, $password, $template) {
97
		import('mail.MailTemplate');
98
		$journal = Request::getJournal();
99
		$site = Request::getSite();
100
		
101
		$params = array(
102
			'password' => $password,
103
			'siteTitle' => $journal->getJournalTitle(),
104
			'unsubscribeLink' => Request::url(null, 'notification', 'unsubscribeMailList')
105
		);
106
		
107
		if ($template == 'NOTIFICATION_MAILLIST_WELCOME') {
108
			$keyHash = md5($password);
109
			$confirmLink = Request::url(null, 'notification', 'confirmMailListSubscription', array($keyHash, $email));
110
			$params["confirmLink"] = $confirmLink;
111
		}
112
		
113
		$mail = new MailTemplate($template);
114
		$mail->setFrom($site->getSiteContactEmail(), $site->getSiteContactName());
115
		$mail->assignParams($params);
116
		$mail->addRecipient($email);
117
		$mail->send();
118
	}
119
	
120
	/**
121
	 * Returns an array of information on the journal's subscription settings
122
	 * @return array
123
	 */
124
	function getSubscriptionSettings() {
125
		$journal = Request::getJournal();
126
		import('payment.ojs.OJSPaymentManager');
127
		$paymentManager =& OJSPaymentManager::getManager();
128
		
129
		$settings = array('subscriptionsEnabled' => $paymentManager->acceptSubscriptionPayments(),
130
				'allowRegReviewer' => $journal->getSetting('allowRegReviewer'),
131
				'allowRegAuthor' => $journal->getSetting('allowRegAuthor'));
132
		
133
		return $settings;
134
	}
135
 }
136
137
?>
(-)classes/notification/form/NotificationSettingsForm.inc.php (+152 lines)
Added Link Here 
1
<?php
2
/**
3
 * @defgroup notification_form
4
 */
5
6
/**
7
 * @file classes/notification/form/NotificationSettingsForm.inc.php
8
 *
9
 * Copyright (c) 2000-2008 John Willinsky
10
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
11
 *
12
 * @class NotificationSettingsForm
13
 * @ingroup notification_form
14
 *
15
 * @brief Form to edit notification settings.
16
 */
17
18
// $Id: NotificationSettingsForm.inc.php,v 1.5 2008/11/05 00:45:13 mcrider Exp $
19
20
21
import('notification.form.PKPNotificationSettingsForm');
22
23
class NotificationSettingsForm extends PKPNotificationSettingsForm {
24
	/**
25
	 * Constructor.
26
	 */
27
	function NotificationSettingsForm() {
28
		parent::PKPNotificationSettingsForm();
29
	}
30
31
	/**
32
	 * Assign form data to user-submitted data.
33
	 */
34
	function readInputData() {
35
		$this->readUserVars(
36
			array('notificationArticleSubmitted',
37
				'notificationMetadataModified',
38
				'notificationSuppFileAdded',
39
				'notificationSuppFileModified',
40
				'notificationGalleyAdded',
41
				'notificationGalleyModified',
42
				'notificationSubmissionComment',
43
				'notificationLayoutComment',
44
				'notificationCopyeditComment',
45
				'notificationProofreadComment',
46
				'notificationReviewerComment',
47
				'notificationReviewerFormComment',
48
				'notificationEditorDecisionComment',
49
				'notificationPublishedIssue',
50
				'notificationUserComment',
51
				'notificationNewAnnouncement',
52
				'emailNotificationArticleSubmitted',
53
				'emailNotificationMetadataModified',
54
				'emailNotificationSuppFileAdded',
55
				'emailNotificationSuppFileModified',
56
				'emailNotificationGalleyAdded',
57
				'emailNotificationGalleyModified',
58
				'emailNotificationSubmissionComment',
59
				'emailNotificationLayoutComment',
60
				'emailNotificationCopyeditComment',
61
				'emailNotificationProofreadComment',
62
				'emailNotificationReviewerComment',
63
				'emailNotificationReviewerFormComment',
64
				'emailNotificationEditorDecisionComment', 
65
				'emailNotificationPublishedIssue',
66
				'emailNotificationUserComment',
67
				'emailNotificationNewAnnouncement')
68
		);
69
	}
70
	
71
	/**
72
	 * Display the form.
73
	 */
74
	function display() {
75
		$journalDao = &DAORegistry::getDAO('JournalDAO');
76
		$journals = &$journalDao->getJournalTitles();
77
		
78
		$canOnlyRead = true;
79
		$canOnlyReview = false;
80
		
81
		if (Validation::isReviewer()) {
82
			$canOnlyRead = false;
83
			$canOnlyReview = true;
84
		}
85
		if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || 
86
			Validation::isSectionEditor() || Validation::isLayoutEditor() || Validation::isCopyeditor() || Validation::isProofreader()) {
87
			$canOnlyRead = false;
88
			$canOnlyReview = false;
89
		}
90
91
		$templateMgr = &TemplateManager::getManager();
92
		$templateMgr->assign('canOnlyRead', $canOnlyRead);
93
		$templateMgr->assign('canOnlyReview', $canOnlyReview);
94
		return parent::display();
95
	}
96
97
	/**
98
	 * Save site settings.
99
	 */
100
	function execute() {		
101
		$user = Request::getUser();
102
		$userId = $user->getUserId();
103
		
104
		// Notification settings
105
		$settings = array();
106
		if(!$this->getData('notificationArticleSubmitted')) $settings[] = NOTIFICATION_TYPE_ARTICLE_SUBMITTED;
107
		if(!$this->getData('notificationMetadataModified')) $settings[] = NOTIFICATION_TYPE_METADATA_MODIFIED;
108
		if(!$this->getData('notificationSuppFileAdded')) $settings[] = NOTIFICATION_TYPE_SUPP_FILE_ADDED;
109
		if(!$this->getData('notificationSuppFileModified')) $settings[] = NOTIFICATION_TYPE_SUPP_FILE_MODIFIED;
110
		if(!$this->getData('notificationGalleyAdded')) $settings[] = NOTIFICATION_TYPE_GALLEY_ADDED;
111
		if(!$this->getData('notificationGalleyModified')) $settings[] = NOTIFICATION_TYPE_GALLEY_MODIFIED;
112
		if(!$this->getData('notificationSubmissionComment')) $settings[] = NOTIFICATION_TYPE_SUBMISSION_COMMENT;
113
		if(!$this->getData('notificationLayoutComment')) $settings[] = NOTIFICATION_TYPE_LAYOUT_COMMENT;
114
		if(!$this->getData('notificationCopyeditComment')) $settings[] = NOTIFICATION_TYPE_COPYEDIT_COMMENT;
115
		if(!$this->getData('notificationProofreadComment')) $settings[] = NOTIFICATION_TYPE_PROOFREAD_COMMENT;
116
		if(!$this->getData('notificationReviewerComment')) $settings[] = NOTIFICATION_TYPE_REVIEWER_COMMENT;
117
		if(!$this->getData('notificationReviewerFormComment')) $settings[] = NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT;
118
		if(!$this->getData('notificationEditorDecisionComment')) $settings[] = NOTIFICATION_TYPE_EDITOR_DECISION_COMMENT; 
119
		if(!$this->getData('notificationPublishedIssue')) $settings[] = NOTIFICATION_TYPE_PUBLISHED_ISSUE;
120
		if(!$this->getData('notificationUserComment')) $settings[] = NOTIFICATION_TYPE_USER_COMMENT;
121
		if(!$this->getData('notificationNewAnnouncement')) $settings[] = NOTIFICATION_TYPE_NEW_ANNOUNCEMENT;
122
		
123
		// Email settings
124
		$emailSettings = array();
125
		if($this->getData('emailNotificationArticleSubmitted')) $emailSettings[] = NOTIFICATION_TYPE_ARTICLE_SUBMITTED;
126
		if($this->getData('emailNotificationMetadataModified')) $emailSettings[] = NOTIFICATION_TYPE_METADATA_MODIFIED;
127
		if($this->getData('emailNotificationSuppFileAdded')) $emailSettings[] = NOTIFICATION_TYPE_SUPP_FILE_ADDED;
128
		if($this->getData('emailNotificationSuppFileModified')) $emailSettings[] = NOTIFICATION_TYPE_SUPP_FILE_MODIFIED;
129
		if($this->getData('emailNotificationGalleyAdded')) $emailSettings[] = NOTIFICATION_TYPE_GALLEY_ADDED;
130
		if($this->getData('emailNotificationGalleyModified')) $emailSettings[] = NOTIFICATION_TYPE_GALLEY_MODIFIED;
131
		if($this->getData('emailNotificationSubmissionComment')) $emailSettings[] = NOTIFICATION_TYPE_SUBMISSION_COMMENT;
132
		if($this->getData('emailNotificationLayoutComment')) $emailSettings[] = NOTIFICATION_TYPE_LAYOUT_COMMENT;
133
		if($this->getData('emailNotificationCopyeditComment')) $emailSettings[] = NOTIFICATION_TYPE_COPYEDIT_COMMENT;
134
		if($this->getData('emailNotificationProofreadComment')) $emailSettings[] = NOTIFICATION_TYPE_PROOFREAD_COMMENT;
135
		if($this->getData('emailNotificationReviewerComment')) $emailSettings[] = NOTIFICATION_TYPE_REVIEWER_COMMENT;
136
		if($this->getData('emailNotificationReviewerFormComment')) $emailSettings[] = NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT;
137
		if($this->getData('emailNotificationEditorDecisionComment')) $emailSettings[] = NOTIFICATION_TYPE_EDITOR_DECISION_COMMENT; 
138
		if($this->getData('emailNotificationPublishedIssue')) $emailSettings[] = NOTIFICATION_TYPE_PUBLISHED_ISSUE;
139
		if($this->getData('emailNotificationUserComment')) $emailSettings[] = NOTIFICATION_TYPE_USER_COMMENT;
140
		if($this->getData('emailNotificationNewAnnouncement')) $emailSettings[] = NOTIFICATION_TYPE_NEW_ANNOUNCEMENT;
141
		
142
		$notificationSettingsDao =& DAORegistry::getDAO('NotificationSettingsDAO');
143
		$notificationSettingsDao->updateNotificationSettings($settings, $userId);
144
		$notificationSettingsDao->updateNotificationEmailSettings($emailSettings, $userId);
145
		
146
		return true;
147
	}
148
149
150
}
151
152
?>
(-)classes/site/ImportOJS1.inc.php (-9 lines)
 Lines 555-561    Link Here 
555
555
556
		$userDao = &DAORegistry::getDAO('UserDAO');
556
		$userDao = &DAORegistry::getDAO('UserDAO');
557
		$roleDao = &DAORegistry::getDAO('RoleDAO');
557
		$roleDao = &DAORegistry::getDAO('RoleDAO');
558
		$notifyDao = &DAORegistry::getDAO('NotificationStatusDAO');
559
558
560
		$result = &$this->importDao->retrieve('SELECT *, DECODE(chPassword, ?) AS chPassword FROM tblusers ORDER BY nUserID', $this->journalConfigInfo['chPasswordSalt']);
559
		$result = &$this->importDao->retrieve('SELECT *, DECODE(chPassword, ?) AS chPassword FROM tblusers ORDER BY nUserID', $this->journalConfigInfo['chPasswordSalt']);
561
		while (!$result->EOF) {
560
		while (!$result->EOF) {
 Lines 625-638    Link Here 
625
			}
624
			}
626
			$userId = $user->getUserId();
625
			$userId = $user->getUserId();
627
626
628
			if ($row['bNotify']) {
629
				if ($existingUser) {
630
					// Just in case
631
					$notifyDao->setJournalNotifications($this->journalId, $userId, 0);
632
				}
633
				$notifyDao->setJournalNotifications($this->journalId, $userId, 1);
634
			}
635
636
			if ($row['fkEditorID']) {
627
			if ($row['fkEditorID']) {
637
				$role = new Role();
628
				$role = new Role();
638
				$role->setJournalId($this->journalId);
629
				$role->setJournalId($this->journalId);
(-)classes/submission/author/AuthorAction.inc.php (+27 lines)
 Lines 277-282    Link Here 
277
			if ($commentForm->validate()) {
277
			if ($commentForm->validate()) {
278
				$commentForm->execute();
278
				$commentForm->execute();
279
279
280
				// Send a notification to associated users
281
				import('notification.Notification');
282
				$notificationUsers = $article->getAssociatedUserIds(true, false);
283
				foreach ($notificationUsers as $user) {
284
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
285
					Notification::createNotification($user['id'], "notification.type.layoutComment",
286
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_LAYOUT_COMMENT);
287
				}
288
				
280
				if ($emailComment) {
289
				if ($emailComment) {
281
					$commentForm->email();
290
					$commentForm->email();
282
				}
291
				}
 Lines 389-394    Link Here 
389
			if ($commentForm->validate()) {
398
			if ($commentForm->validate()) {
390
				$commentForm->execute();
399
				$commentForm->execute();
391
400
401
				// Send a notification to associated users
402
				import('notification.Notification');
403
				$notificationUsers = $article->getAssociatedUserIds(true, false);
404
				foreach ($notificationUsers as $user) {
405
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'copyedit');
406
					Notification::createNotification($user['id'], "notification.type.copyeditComment",
407
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_COPYEDIT_COMMENT);
408
				}
409
				
392
				if ($emailComment) {
410
				if ($emailComment) {
393
					$commentForm->email();
411
					$commentForm->email();
394
				}
412
				}
 Lines 432-437    Link Here 
432
			if ($commentForm->validate()) {
450
			if ($commentForm->validate()) {
433
				$commentForm->execute();
451
				$commentForm->execute();
434
452
453
				// Send a notification to associated users
454
				import('notification.Notification');
455
				$notificationUsers = $article->getAssociatedUserIds(true, false);
456
				foreach ($notificationUsers as $user) {
457
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'proofread');
458
					Notification::createNotification($user['id'], "notification.type.proofreadComment",
459
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_PROOFREAD_COMMENT);
460
				}
461
				
435
				if ($emailComment) {
462
				if ($emailComment) {
436
					$commentForm->email();
463
					$commentForm->email();
437
				}
464
				}
(-)classes/submission/common/Action.inc.php (-1 / +19 lines)
 Lines 149-155    Link Here 
149
149
150
			} else {
150
			} else {
151
				$metadataForm->execute();
151
				$metadataForm->execute();
152
152
				
153
				// Send a notification to associated users
154
				import('notification.Notification');
155
				$notificationUsers = $article->getAssociatedUserIds();
156
				foreach ($notificationUsers as $user) {
157
					$url = Request::url(null, $user['role'], 'submission', $article->getArticleId(), null, 'metadata');
158
					Notification::createNotification($user['id'], "notification.type.metadataModified",
159
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_METADATA_MODIFIED);
160
				}
161
		
153
				// Add log entry
162
				// Add log entry
154
				$user = &Request::getUser();
163
				$user = &Request::getUser();
155
				import('article.log.ArticleLog');
164
				import('article.log.ArticleLog');
 Lines 257-262    Link Here 
257
			if ($commentForm->validate()) {
266
			if ($commentForm->validate()) {
258
				$commentForm->execute();
267
				$commentForm->execute();
259
268
269
				// Send a notification to associated users
270
				import('notification.Notification');
271
				$notificationUsers = $article->getAssociatedUserIds(true, false);
272
				foreach ($notificationUsers as $user) {
273
					$url = Request::url(null, $user['role'], 'submissionReview', $article->getArticleId(), null, 'editorDecision');
274
					Notification::createNotification($user['id'], "notification.type.submissionComment",
275
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_SUBMISSION_COMMENT);
276
				}
277
				
260
				if ($emailComment) {
278
				if ($emailComment) {
261
					$commentForm->email($commentForm->emailHelper());
279
					$commentForm->email($commentForm->emailHelper());
262
				}
280
				}
(-)classes/submission/copyeditor/CopyeditorAction.inc.php (+18 lines)
 Lines 286-291    Link Here 
286
			if ($commentForm->validate()) {
286
			if ($commentForm->validate()) {
287
				$commentForm->execute();
287
				$commentForm->execute();
288
288
289
				// Send a notification to associated users
290
				import('notification.Notification');
291
				$notificationUsers = $article->getAssociatedUserIds(true, false);
292
				foreach ($notificationUsers as $user) {
293
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
294
					Notification::createNotification($user['id'], "notification.type.layoutComment",
295
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_LAYOUT_COMMENT);
296
				}
297
				
289
				if ($emailComment) {
298
				if ($emailComment) {
290
					$commentForm->email();
299
					$commentForm->email();
291
				}
300
				}
 Lines 328-333    Link Here 
328
			if ($commentForm->validate()) {
337
			if ($commentForm->validate()) {
329
				$commentForm->execute();
338
				$commentForm->execute();
330
339
340
				// Send a notification to associated users
341
				import('notification.Notification');
342
				$notificationUsers = $article->getAssociatedUserIds(true, false);
343
				foreach ($notificationUsers as $user) {
344
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'coypedit');
345
					Notification::createNotification($user['id'], "notification.type.copyeditComment",
346
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_COPYEDIT_COMMENT);
347
				}
348
				
331
				if ($emailComment) {
349
				if ($emailComment) {
332
					$commentForm->email();
350
					$commentForm->email();
333
				}
351
				}
(-)classes/submission/layoutEditor/LayoutEditorAction.inc.php (-2 / +20 lines)
 Lines 252-258    Link Here 
252
252
253
			if ($commentForm->validate()) {
253
			if ($commentForm->validate()) {
254
				$commentForm->execute();
254
				$commentForm->execute();
255
255
				
256
				// Send a notification to associated users
257
				import('notification.Notification');
258
				$notificationUsers = $article->getAssociatedUserIds(true, false);
259
				foreach ($notificationUsers as $user) {
260
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
261
					Notification::createNotification($user['id'], "notification.type.layoutComment",
262
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_LAYOUT_COMMENT);
263
				}
264
				
256
				if ($emailComment) {
265
				if ($emailComment) {
257
					$commentForm->email();
266
					$commentForm->email();
258
				}
267
				}
 Lines 294-300    Link Here 
294
303
295
			if ($commentForm->validate()) {
304
			if ($commentForm->validate()) {
296
				$commentForm->execute();
305
				$commentForm->execute();
297
306
				
307
				// Send a notification to associated users
308
				import('notification.Notification');
309
				$notificationUsers = $article->getAssociatedUserIds(true, false);
310
				foreach ($notificationUsers as $user) {
311
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'proofread');
312
					Notification::createNotification($user['id'], "notification.type.proofreadComment",
313
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_PROOFREAD_COMMENT);
314
				}
315
				
298
				if ($emailComment) {
316
				if ($emailComment) {
299
					$commentForm->email();
317
					$commentForm->email();
300
				}
318
				}
(-)classes/submission/proofreader/ProofreaderAction.inc.php (-1 / +19 lines)
 Lines 474-479    Link Here 
474
			if ($commentForm->validate()) {
474
			if ($commentForm->validate()) {
475
				$commentForm->execute();
475
				$commentForm->execute();
476
476
477
				// Send a notification to associated users
478
				import('notification.Notification');
479
				$notificationUsers = $article->getAssociatedUserIds(true, false);
480
				foreach ($notificationUsers as $user) {
481
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'proofread');
482
					Notification::createNotification($user['id'], "notification.type.proofreadComment",
483
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_PROOFREAD_COMMENT);
484
				}
485
				
477
				if ($emailComment) {
486
				if ($emailComment) {
478
					$commentForm->email();
487
					$commentForm->email();
479
				}
488
				}
 Lines 516-522    Link Here 
516
525
517
			if ($commentForm->validate()) {
526
			if ($commentForm->validate()) {
518
				$commentForm->execute();
527
				$commentForm->execute();
519
528
								
529
				// Send a notification to associated users
530
				import('notification.Notification');
531
				$notificationUsers = $article->getAssociatedUserIds(true, false);
532
				foreach ($notificationUsers as $user) {
533
					$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
534
					Notification::createNotification($user['id'], "notification.type.layoutComment",
535
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_LAYOUT_COMMENT);
536
				}
537
				
520
				if ($emailComment) {
538
				if ($emailComment) {
521
					$commentForm->email();
539
					$commentForm->email();
522
				}
540
				}
(-)classes/submission/reviewer/ReviewerAction.inc.php (+24 lines)
 Lines 305-310    Link Here 
305
			if ($commentForm->validate()) {
305
			if ($commentForm->validate()) {
306
				$commentForm->execute();
306
				$commentForm->execute();
307
307
308
				// Send a notification to associated users
309
				import('notification.Notification');
310
				$notificationUsers = $article->getAssociatedUserIds();
311
				foreach ($notificationUsers as $user) {
312
					$url = Request::url(null, $user['role'], 'submissionReview', $article->getArticleId(), null, 'peerReview');
313
					Notification::createNotification($user['id'], "notification.type.reviewerComment",
314
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_REVIEWER_COMMENT);
315
				}
316
				
308
				if ($emailComment) {
317
				if ($emailComment) {
309
					$commentForm->email();
318
					$commentForm->email();
310
				}
319
				}
 Lines 347-352    Link Here 
347
			$reviewForm->readInputData();
356
			$reviewForm->readInputData();
348
			if ($reviewForm->validate()) {
357
			if ($reviewForm->validate()) {
349
				$reviewForm->execute();
358
				$reviewForm->execute();
359
360
				// Send a notification to associated users
361
				import('notification.Notification');
362
				$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
363
				$reviewAssignment = $reviewAssignmentDao->getReviewAssignmentById($reviewId);
364
				$articleId = $reviewAssignment->getArticleId();
365
				$articleDao =& DAORegistry::getDAO('ArticleDAO'); 
366
				$article =& $articleDao->getArticle($articleId);
367
				$notificationUsers = $article->getAssociatedUserIds();
368
				foreach ($notificationUsers as $user) {
369
					$url = Request::url(null, $user['role'], 'submissionReview', $article->getArticleId(), null, 'peerReview');
370
					Notification::createNotification($user['id'], "notification.type.reviewerFormComment",
371
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT);
372
				}
373
				
350
			} else {
374
			} else {
351
				$reviewForm->display();
375
				$reviewForm->display();
352
				return false;
376
				return false;
(-)classes/submission/sectionEditor/SectionEditorAction.inc.php (+45 lines)
 Lines 1758-1763    Link Here 
1758
		if ($commentForm->validate()) {
1758
		if ($commentForm->validate()) {
1759
			$commentForm->execute();
1759
			$commentForm->execute();
1760
1760
1761
			// Send a notification to associated users
1762
			import('notification.Notification');
1763
			$notificationUsers = $article->getAssociatedUserIds();
1764
			foreach ($notificationUsers as $user) {
1765
				$url = Request::url(null, $user['role'], 'submissionReview', $article->getArticleId(), null, 'peerReview');
1766
				Notification::createNotification($user['id'], "notification.type.reviewerComment",
1767
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_REVIEWER_COMMENT);
1768
			}
1769
				
1761
			if ($emailComment) {
1770
			if ($emailComment) {
1762
				$commentForm->email();
1771
				$commentForm->email();
1763
			}
1772
			}
 Lines 1801-1806    Link Here 
1801
		if ($commentForm->validate()) {
1810
		if ($commentForm->validate()) {
1802
			$commentForm->execute();
1811
			$commentForm->execute();
1803
1812
1813
			// Send a notification to associated users
1814
			import('notification.Notification');
1815
			$notificationUsers = $article->getAssociatedUserIds(true, false);
1816
			foreach ($notificationUsers as $user) {
1817
				$url = Request::url(null, $user['role'], 'submissionReview', $article->getArticleId(), null, 'editorDecision');
1818
				Notification::createNotification($user['id'], "notification.type.editorDecisionComment",
1819
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_EDITOR_DECISION_COMMENT);
1820
			}
1821
				
1804
			if ($emailComment) {
1822
			if ($emailComment) {
1805
				$commentForm->email();
1823
				$commentForm->email();
1806
			}
1824
			}
 Lines 2044-2049    Link Here 
2044
		if ($commentForm->validate()) {
2062
		if ($commentForm->validate()) {
2045
			$commentForm->execute();
2063
			$commentForm->execute();
2046
2064
2065
			// Send a notification to associated users
2066
			import('notification.Notification');
2067
			$notificationUsers = $article->getAssociatedUserIds(true, false);
2068
			foreach ($notificationUsers as $user) {
2069
				$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'copyedit');
2070
				Notification::createNotification($user['id'], "notification.type.copyeditComment",
2071
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_COPYEDIT_COMMENT);
2072
			}
2073
2047
			if ($emailComment) {
2074
			if ($emailComment) {
2048
				$commentForm->email();
2075
				$commentForm->email();
2049
			}
2076
			}
 Lines 2087-2092    Link Here 
2087
		if ($commentForm->validate()) {
2114
		if ($commentForm->validate()) {
2088
			$commentForm->execute();
2115
			$commentForm->execute();
2089
2116
2117
			// Send a notification to associated users
2118
			import('notification.Notification');
2119
			$notificationUsers = $article->getAssociatedUserIds(true, false);
2120
			foreach ($notificationUsers as $user) {
2121
				$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
2122
				Notification::createNotification($user['id'], "notification.type.layoutComment",
2123
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_LAYOUT_COMMENT);
2124
			}
2125
				
2090
			if ($emailComment) {
2126
			if ($emailComment) {
2091
				$commentForm->email();
2127
				$commentForm->email();
2092
			}
2128
			}
 Lines 2130-2135    Link Here 
2130
		if ($commentForm->validate()) {
2166
		if ($commentForm->validate()) {
2131
			$commentForm->execute();
2167
			$commentForm->execute();
2132
2168
2169
			// Send a notification to associated users
2170
			import('notification.Notification');
2171
			$notificationUsers = $article->getAssociatedUserIds(true, false);
2172
			foreach ($notificationUsers as $user) {
2173
				$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'proofread');
2174
				Notification::createNotification($user['id'], "notification.type.proofreadComment",
2175
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_PROOFREAD_COMMENT);
2176
			}	
2177
			
2133
			if ($emailComment) {
2178
			if ($emailComment) {
2134
				$commentForm->email();
2179
				$commentForm->email();
2135
			}
2180
			}
(-)classes/user/form/ProfileForm.inc.php (-18 lines)
 Lines 108-114    Link Here 
108
108
109
		$roleDao = &DAORegistry::getDAO('RoleDAO');
109
		$roleDao = &DAORegistry::getDAO('RoleDAO');
110
		$journalDao = &DAORegistry::getDAO('JournalDAO');
110
		$journalDao = &DAORegistry::getDAO('JournalDAO');
111
		$notificationStatusDao = &DAORegistry::getDAO('NotificationStatusDAO');
112
		$userSettingsDao = &DAORegistry::getDAO('UserSettingsDAO');
111
		$userSettingsDao = &DAORegistry::getDAO('UserSettingsDAO');
113
112
114
		$journals = &$journalDao->getJournals();
113
		$journals = &$journalDao->getJournals();
 Lines 124-130    Link Here 
124
123
125
		$journals = &$journalDao->getJournals();
124
		$journals = &$journalDao->getJournals();
126
		$journals = &$journals->toArray();
125
		$journals = &$journals->toArray();
127
		$journalNotifications = &$notificationStatusDao->getJournalNotifications($user->getUserId());
128
126
129
		$countryDao =& DAORegistry::getDAO('CountryDAO');
127
		$countryDao =& DAORegistry::getDAO('CountryDAO');
130
		$countries =& $countryDao->getCountries();
128
		$countries =& $countryDao->getCountries();
 Lines 257-263    Link Here 
257
255
258
		$roleDao = &DAORegistry::getDAO('RoleDAO');
256
		$roleDao = &DAORegistry::getDAO('RoleDAO');
259
		$journalDao = &DAORegistry::getDAO('JournalDAO');
257
		$journalDao = &DAORegistry::getDAO('JournalDAO');
260
		$notificationStatusDao = &DAORegistry::getDAO('NotificationStatusDAO');
261
258
262
		// Roles
259
		// Roles
263
		$journal =& Request::getJournal();
260
		$journal =& Request::getJournal();
 Lines 288-308    Link Here 
288
			}
285
			}
289
		}
286
		}
290
287
291
		$journals = &$journalDao->getJournals();
292
		$journals = &$journals->toArray();
293
		$journalNotifications = $notificationStatusDao->getJournalNotifications($user->getUserId());
294
295
		$readerNotify = Request::getUserVar('journalNotify');
296
297
		foreach ($journals as $thisJournal) {
298
			$thisJournalId = $thisJournal->getJournalId();
299
			$currentlyReceives = !empty($journalNotifications[$thisJournalId]);
300
			$shouldReceive = !empty($readerNotify) && in_array($thisJournal->getJournalId(), $readerNotify);
301
			if ($currentlyReceives != $shouldReceive) {
302
				$notificationStatusDao->setJournalNotifications($thisJournalId, $user->getUserId(), $shouldReceive);
303
			}
304
		}
305
306
		$openAccessNotify = Request::getUserVar('openAccessNotify');
288
		$openAccessNotify = Request::getUserVar('openAccessNotify');
307
289
308
		$userSettingsDao = &DAORegistry::getDAO('UserSettingsDAO');
290
		$userSettingsDao = &DAORegistry::getDAO('UserSettingsDAO');
(-)classes/user/form/RegistrationForm.inc.php (-10 lines)
 Lines 320-335    Link Here 
320
			}
320
			}
321
		}
321
		}
322
322
323
		// By default, self-registering readers will receive
324
		// journal updates. (The double set is here to prevent a
325
		// duplicate insert error msg if there was a notification entry
326
		// left over from a previous role.)
327
		if (isset($allowedRoles['reader']) && $this->getData($allowedRoles['reader'])) {
328
			$notificationStatusDao = &DAORegistry::getDAO('NotificationStatusDAO');
329
			$notificationStatusDao->setJournalNotifications($journal->getJournalId(), $userId, false);
330
			$notificationStatusDao->setJournalNotifications($journal->getJournalId(), $userId, true);
331
		}
332
333
		if (isset($allowedRoles['reader']) && $this->getData('openAccessNotification')) {
323
		if (isset($allowedRoles['reader']) && $this->getData('openAccessNotification')) {
334
			$userSettingsDao = &DAORegistry::getDAO('UserSettingsDAO');
324
			$userSettingsDao = &DAORegistry::getDAO('UserSettingsDAO');
335
			$userSettingsDao->updateSetting($userId, 'openAccessNotification', true, 'bool', $journal->getJournalId());
325
			$userSettingsDao->updateSetting($userId, 'openAccessNotification', true, 'bool', $journal->getJournalId());
(-)dbscripts/xml/ojs_schema.xml (-16 lines)
 Lines 306-327    Link Here 
306
			<UNIQUE />
306
			<UNIQUE />
307
		</index>
307
		</index>
308
	</table>
308
	</table>
309
310
	<table name="notification_status">
311
		<field name="journal_id" type="I8">
312
			<NOTNULL />
313
		</field>
314
		<field name="user_id" type="I8">
315
			<NOTNULL />
316
		</field>
317
		<descr>User "mail notifications to my account" flags</descr>
318
		<index name="notification_status_pkey">
319
			<col>journal_id</col>
320
			<col>user_id</col>
321
			<UNIQUE />
322
		</index>
323
	</table>
324
325
	<!--
309
	<!--
326
	  *
310
	  *
327
	  * TABLE sections
311
	  * TABLE sections
(-)dbscripts/xml/data/email_templates.xml (+15 lines)
 Lines 21-26    Link Here 
21
		  *
21
		  *
22
		  -->
22
		  -->
23
		<row>
23
		<row>
24
			<field name="email_key">NOTIFICATION</field>
25
			<field name="can_edit">1</field>
26
			<field name="can_disable">0</field>
27
		</row>
28
		<row>
29
			<field name="email_key">NOTIFICATION_MAILLIST</field>
30
			<field name="can_edit">1</field>
31
			<field name="can_disable">0</field>
32
		</row>
33
		<row>
34
			<field name="email_key">NOTIFICATION_MAILLIST_PASSWORD</field>
35
			<field name="can_edit">1</field>
36
			<field name="can_disable">0</field>
37
		</row>
38
		<row>
24
			<field name="email_key">PASSWORD_RESET_CONFIRM</field>
39
			<field name="email_key">PASSWORD_RESET_CONFIRM</field>
25
			<field name="can_edit">1</field>
40
			<field name="can_edit">1</field>
26
			<field name="can_disable">0</field>
41
			<field name="can_disable">0</field>
(-)dbscripts/xml/data/locale/en_US/email_templates_data.xml (+51 lines)
 Lines 22-27    Link Here 
22
		  *
22
		  *
23
		  -->
23
		  -->
24
		<row>
24
		<row>
25
			<field name="email_key">NOTIFICATION</field>
26
			<field name="subject">New notification from {$siteTitle}</field>
27
			<field name="body">You have a new notification from {$siteTitle}:
28
29
{$notificationContents}
30
31
Link: {$url}
32
33
{$principalContactSignature}</field>
34
			<field name="description">The email is sent to registered users that have selected to have this type of notification emailed to them.</field>
35
		</row>
36
		<row>
37
			<field name="email_key">NOTIFICATION_MAILLIST</field>
38
			<field name="subject">New notification from {$siteTitle}</field>
39
			<field name="body">You have a new notification from {$siteTitle}:
40
--
41
{$notificationContents}
42
43
Link: {$url}
44
--
45
46
If you wish to stop receiving notification emails, please go to {$unsubscribeLink} and enter your email address and password.
47
48
{$principalContactSignature}</field>
49
			<field name="description">This email is sent to unregistered users on the notification mailing list.</field>
50
		</row>
51
		<row>
52
			<field name="email_key">NOTIFICATION_MAILLIST_WELCOME</field>
53
			<field name="subject">Welcome to the the {$siteTitle} mailing list!</field>
54
			<field name="body">You have signed up to receive notifications from {$siteTitle}.
55
			
56
Please click on this link to confirm your request and add your email address to the mailing list: {$confirmLink}
57
58
If you wish to stop receiving notification emails, please go to {$unsubscribeLink} and enter your email address and password.
59
60
Your password for disabling notification emails is: {$password}
61
62
{$principalContactSignature}</field>
63
			<field name="description">This email is sent to an unregistered user who just registered with the notification mailing list.</field>
64
		</row>
65
		<row>
66
			<field name="email_key">NOTIFICATION_MAILLIST_PASSWORD</field>
67
			<field name="subject">Your notification mailing list information for {$siteTitle}</field>
68
			<field name="body">Your new password for disabling notification emails is: {$password}
69
70
If you wish to stop receiving notification emails, please go to {$unsubscribeLink} and enter your email address and password.
71
72
{$principalContactSignature}</field>
73
			<field name="description">This email is sent to an unregistered user on the notification mailing list when they indicate that they have forgotten their password or are unable to login. It provides a URL they can follow to reset their password.</field>
74
		</row>
75
		<row>
25
			<field name="email_key">PASSWORD_RESET_CONFIRM</field>
76
			<field name="email_key">PASSWORD_RESET_CONFIRM</field>
26
			<field name="subject">Password Reset Confirmation</field>
77
			<field name="subject">Password Reset Confirmation</field>
27
			<field name="body">We have received a request to reset your password for the {$siteTitle} web site.
78
			<field name="body">We have received a request to reset your password for the {$siteTitle} web site.
(-)dbscripts/xml/upgrade/2.3.0_update.xml (+4 lines)
 Lines 23-26    Link Here 
23
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_RESUBMIT', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
23
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_RESUBMIT', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
24
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_DECLINE', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
24
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_DECLINE', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
25
	</sql>
25
	</sql>
26
	<!-- Bug #3922# No need for the notification_status table (it is encapsulated by the notification table) -->
27
	<sql>
28
		<drop table="notification_status" />
29
	</sql>
26
</data>
30
</data>
(-)pages/about/AboutHandler.inc.php (-4 lines)
 Lines 556-565    Link Here 
556
			$templateMgr->assign('subscriptionStatistics', $subscriptionStatistics);
556
			$templateMgr->assign('subscriptionStatistics', $subscriptionStatistics);
557
		}
557
		}
558
558
559
		$notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO');
560
		$notifiableUsers = $notificationStatusDao->getNotifiableUsersCount($journal->getJournalId());
561
		$templateMgr->assign('notifiableUsers', $notifiableUsers);
562
563
		$templateMgr->display('about/statistics.tpl');
559
		$templateMgr->display('about/statistics.tpl');
564
	}
560
	}
565
561
(-)pages/admin/AdminJournalHandler.inc.php (+1 lines)
 Lines 77-82    Link Here 
77
		if ($settingsForm->validate()) {
77
		if ($settingsForm->validate()) {
78
			PluginRegistry::loadCategory('blocks');
78
			PluginRegistry::loadCategory('blocks');
79
			$settingsForm->execute();
79
			$settingsForm->execute();
80
80
			Request::redirect(null, null, 'journals');
81
			Request::redirect(null, null, 'journals');
81
82
82
		} else {
83
		} else {
(-)pages/admin/AdminPeopleHandler.inc.php (-2 lines)
 Lines 125-132    Link Here 
125
			$subscriptionDao->deleteSubscriptionsByUserId($oldUserId);
125
			$subscriptionDao->deleteSubscriptionsByUserId($oldUserId);
126
			$temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO');
126
			$temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO');
127
			$temporaryFileDao->deleteTemporaryFilesByUserId($oldUserId);
127
			$temporaryFileDao->deleteTemporaryFilesByUserId($oldUserId);
128
			$notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO');
129
			$notificationStatusDao->deleteNotificationStatusByUserId($oldUserId);
130
			$userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO');
128
			$userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO');
131
			$userSettingsDao->deleteSettings($oldUserId);
129
			$userSettingsDao->deleteSettings($oldUserId);
132
			$groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
130
			$groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
(-)pages/admin/AdminSettingsHandler.inc.php (-1 lines)
 Lines 77-83    Link Here 
77
			}
77
			}
78
		} elseif ($settingsForm->validate()) {
78
		} elseif ($settingsForm->validate()) {
79
			$settingsForm->execute();
79
			$settingsForm->execute();
80
81
			$templateMgr = &TemplateManager::getManager();
80
			$templateMgr = &TemplateManager::getManager();
82
			$templateMgr->assign(array(
81
			$templateMgr->assign(array(
83
				'currentUrl' => Request::url(null, null, 'settings'),
82
				'currentUrl' => Request::url(null, null, 'settings'),
(-)pages/author/SubmitHandler.inc.php (+19 lines)
 Lines 144-149    Link Here 
144
			$articleId = $submitForm->execute();
144
			$articleId = $submitForm->execute();
145
145
146
			if ($step == 5) {
146
			if ($step == 5) {
147
				// Send a notification to associated users
148
				import('notification.Notification');
149
				$articleDao =& DAORegistry::getDAO('ArticleDAO'); 
150
				$article =& $articleDao->getArticle($articleId);
151
				$roleDao = &DAORegistry::getDAO('RoleDAO');
152
				$notificationUsers = array();
153
				$journalManagers = $roleDao->getUsersByRoleId(ROLE_ID_JOURNAL_MANAGER);
154
				$allUsers = $journalManagers->toArray();
155
				$editors = $roleDao->getUsersByRoleId(ROLE_ID_EDITOR);
156
				array_merge($allUsers, $editors->toArray());
157
				foreach ($allUsers as $user) {
158
					$notificationUsers[] = array('id' => $user->getUserId());
159
				}
160
				foreach ($notificationUsers as $user) {
161
					$url = Request::url(null, 'editor', 'submission', $articleId);
162
					Notification::createNotification($user['id'], "notification.type.articleSubmitted",
163
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_ARTICLE_SUBMITTED);
164
				}
165
				
147
				$journal = &Request::getJournal();
166
				$journal = &Request::getJournal();
148
				$templateMgr = &TemplateManager::getManager();
167
				$templateMgr = &TemplateManager::getManager();
149
				$templateMgr->assign_by_ref('journal', $journal);
168
				$templateMgr->assign_by_ref('journal', $journal);
(-)pages/comment/CommentHandler.inc.php (+12 lines)
 Lines 97-102    Link Here 
97
			$commentForm->readInputData();
97
			$commentForm->readInputData();
98
			if ($commentForm->validate()) {
98
			if ($commentForm->validate()) {
99
				$commentForm->execute();
99
				$commentForm->execute();
100
				
101
				// Send a notification to associated users
102
				import('notification.Notification');
103
				$articleDAO =& DAORegistry::getDAO('ArticleDAO');
104
				$article =& $articleDAO->getArticle($articleId);
105
				$notificationUsers = $article->getAssociatedUserIds();
106
				foreach ($notificationUsers as $user) {
107
					$url = Request::url(null, null, 'view', array($articleId, $galleyId, $parentId));
108
					Notification::createNotification($user['id'], "notification.type.userComment",
109
						$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_USER_COMMENT);
110
				}
111
				
100
				Request::redirect(null, null, 'view', array($articleId, $galleyId, $parentId), array('refresh' => 1));
112
				Request::redirect(null, null, 'view', array($articleId, $galleyId, $parentId), array('refresh' => 1));
101
			}
113
			}
102
		}
114
		}
(-)pages/editor/IssueManagementHandler.inc.php (-10 / +22 lines)
 Lines 94-100    Link Here 
94
				$issueDao->updateIssue($issue);
94
				$issueDao->updateIssue($issue);
95
			}
95
			}
96
		}
96
		}
97
98
		Request::redirect(null, null, 'backIssues');
97
		Request::redirect(null, null, 'backIssues');
99
	}
98
	}
100
99
 Lines 537-543    Link Here 
537
536
538
		$issueDao = &DAORegistry::getDAO('IssueDAO');
537
		$issueDao = &DAORegistry::getDAO('IssueDAO');
539
		$issueDao->updateCurrentIssue($journalId,$issue);
538
		$issueDao->updateCurrentIssue($journalId,$issue);
540
539
		
540
		// Send a notification to associated users
541
		import('notification.Notification');
542
		$roleDao = &DAORegistry::getDAO('RoleDAO');
543
		$notificationUsers = array();
544
		$allUsers = $roleDao->getUsersByJournalId($journalId);
545
		while (!$allUsers->eof()) {
546
			$user = &$allUsers->next();
547
			$notificationUsers[] = array('id' => $user->getUserId());
548
			unset($user);
549
		}
550
		$url = Request::url(null, 'issue', 'current');
551
		foreach ($notificationUsers as $user) {
552
			Notification::createNotification($user['id'], "notification.type.issuePublished",
553
				null, $url, 1, NOTIFICATION_TYPE_PUBLISHED_ISSUE);
554
		}
555
		$notificationDao = &DAORegistry::getDAO('NotificationDAO');
556
		$notificationDao->sendToMailingList(Notification::createNotification(0, "notification.type.issuePublished",
557
				null, $url, 1, NOTIFICATION_TYPE_PUBLISHED_ISSUE));
558
				
541
		Request::redirect(null, null, 'issueToc', $issue->getIssueId());
559
		Request::redirect(null, null, 'issueToc', $issue->getIssueId());
542
	}
560
	}
543
561
 Lines 550-556    Link Here 
550
568
551
		$userDao = &DAORegistry::getDAO('UserDAO');
569
		$userDao = &DAORegistry::getDAO('UserDAO');
552
		$issueDao = &DAORegistry::getDAO('IssueDAO');
570
		$issueDao = &DAORegistry::getDAO('IssueDAO');
553
		$notificationStatusDao = &DAORegistry::getDAO('NotificationStatusDAO');
554
		$roleDao = &DAORegistry::getDAO('RoleDAO');
571
		$roleDao = &DAORegistry::getDAO('RoleDAO');
555
572
556
		$journal = &Request::getJournal();
573
		$journal = &Request::getJournal();
 Lines 563-573    Link Here 
563
		if (Request::getUserVar('send') && !$email->hasErrors()) {
580
		if (Request::getUserVar('send') && !$email->hasErrors()) {
564
			$email->addRecipient($user->getEmail(), $user->getFullName());
581
			$email->addRecipient($user->getEmail(), $user->getFullName());
565
582
566
			if (Request::getUserVar('whichUsers') == 'allUsers') {
583
			$recipients = $roleDao->getUsersByJournalId($journal->getJournalId());
567
				$recipients = $roleDao->getUsersByJournalId($journal->getJournalId());
584
568
			} else {
569
				$recipients = $notificationStatusDao->getNotifiableUsersByJournalId($journal->getJournalId());
570
			}
571
			while (!$recipients->eof()) {
585
			while (!$recipients->eof()) {
572
				$recipient = &$recipients->next();
586
				$recipient = &$recipients->next();
573
				$email->addRecipient($recipient->getEmail(), $recipient->getFullName());
587
				$email->addRecipient($recipient->getEmail(), $recipient->getFullName());
 Lines 610-616    Link Here 
610
					'editorialContactSignature' => $user->getContactSignature()
624
					'editorialContactSignature' => $user->getContactSignature()
611
				));
625
				));
612
			}
626
			}
613
			$notifiableCount = $notificationStatusDao->getNotifiableUsersCount($journal->getJournalId());
614
			$allUsersCount = $roleDao->getJournalUsersCount($journal->getJournalId());
627
			$allUsersCount = $roleDao->getJournalUsersCount($journal->getJournalId());
615
628
616
			$issuesIterator = &$issueDao->getIssues($journal->getJournalId());
629
			$issuesIterator = &$issueDao->getIssues($journal->getJournalId());
 Lines 621-627    Link Here 
621
				'editor/notifyUsers.tpl',
634
				'editor/notifyUsers.tpl',
622
				array(
635
				array(
623
					'issues' => $issuesIterator,
636
					'issues' => $issuesIterator,
624
					'notifiableCount' => $notifiableCount,
625
					'allUsersCount' => $allUsersCount
637
					'allUsersCount' => $allUsersCount
626
				)
638
				)
627
			);
639
			);
(-)pages/layoutEditor/SubmissionLayoutHandler.inc.php (+23 lines)
 Lines 184-189    Link Here 
184
		if ($submitForm->validate()) {
184
		if ($submitForm->validate()) {
185
			$submitForm->execute();
185
			$submitForm->execute();
186
186
187
			// Send a notification to associated users
188
			import('notification.Notification');
189
			$articleDao =& DAORegistry::getDAO('ArticleDAO'); 
190
			$article =& $articleDao->getArticle($articleId);
191
			$notificationUsers = $article->getAssociatedUserIds(true, false);
192
			foreach ($notificationUsers as $user) {
193
				$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
194
				Notification::createNotification($user['id'], "notification.type.galleyModified",
195
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_GALLEY_MODIFIED);
196
			}
197
187
			if (Request::getUserVar('uploadImage')) {
198
			if (Request::getUserVar('uploadImage')) {
188
				$submitForm->uploadImage();
199
				$submitForm->uploadImage();
189
				Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
200
				Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
 Lines 368-373    Link Here 
368
379
369
		if ($submitForm->validate()) {
380
		if ($submitForm->validate()) {
370
			$submitForm->execute();
381
			$submitForm->execute();
382
383
			// Send a notification to associated users
384
			import('notification.Notification');
385
			$articleDao =& DAORegistry::getDAO('ArticleDAO'); 
386
			$article =& $articleDao->getArticle($articleId);
387
			$notificationUsers = $article->getAssociatedUserIds(true, false);
388
			foreach ($notificationUsers as $user) {
389
				$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
390
				Notification::createNotification($user['id'], "notification.type.suppFileModified",
391
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_SUPP_FILE_MODIFIED);
392
			}
393
			
371
			Request::redirect(null, null, 'submission', $articleId);
394
			Request::redirect(null, null, 'submission', $articleId);
372
395
373
		} else {
396
		} else {
(-)pages/manager/ManagerPaymentHandler.inc.php (-1 lines)
 Lines 152-158    Link Here 
152
152
153
		if ($settingsForm->validate()) {
153
		if ($settingsForm->validate()) {
154
			$settingsForm->execute();
154
			$settingsForm->execute();
155
156
			$templateMgr->assign(array(
155
			$templateMgr->assign(array(
157
				'currentUrl' => Request::url(null, null, 'payMethodSettings'),
156
				'currentUrl' => Request::url(null, null, 'payMethodSettings'),
158
				'pageTitle' => 'manager.payment.paymentMethods',
157
				'pageTitle' => 'manager.payment.paymentMethods',
(-)pages/manager/SubscriptionHandler.inc.php (-2 lines)
 Lines 230-236    Link Here 
230
230
231
			if ($subscriptionForm->validate()) {
231
			if ($subscriptionForm->validate()) {
232
				$subscriptionForm->execute();
232
				$subscriptionForm->execute();
233
234
				if (Request::getUserVar('createAnother')) {
233
				if (Request::getUserVar('createAnother')) {
235
					Request::redirect(null, null, 'selectSubscriber', null, array('subscriptionCreated', 1));
234
					Request::redirect(null, null, 'selectSubscriber', null, array('subscriptionCreated', 1));
236
				} else {
235
				} else {
 Lines 465-471    Link Here 
465
464
466
		if ($subscriptionPolicyForm->validate()) {
465
		if ($subscriptionPolicyForm->validate()) {
467
			$subscriptionPolicyForm->execute();
466
			$subscriptionPolicyForm->execute();
468
469
			SubscriptionHandler::setupTemplate(true);
467
			SubscriptionHandler::setupTemplate(true);
470
468
471
			$templateMgr = &TemplateManager::getManager();
469
			$templateMgr = &TemplateManager::getManager();
(-)pages/sectionEditor/SubmissionEditHandler.inc.php (-1 / +46 lines)
 Lines 1214-1219    Link Here 
1214
1214
1215
		if ($submitForm->validate()) {
1215
		if ($submitForm->validate()) {
1216
			$submitForm->execute();
1216
			$submitForm->execute();
1217
1218
			// Send a notification to associated users
1219
			import('notification.Notification');
1220
			$articleDao =& DAORegistry::getDAO('ArticleDAO'); 
1221
			$article =& $articleDao->getArticle($articleId);
1222
			$notificationUsers = $article->getAssociatedUserIds(true, false);
1223
			foreach ($notificationUsers as $user) {
1224
				$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
1225
				Notification::createNotification($user['id'], "notification.type.suppFileModified",
1226
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_SUPP_FILE_MODIFIED);
1227
			}
1228
			
1217
			Request::redirect(null, null, SubmissionEditHandler::getFrom(), $articleId);
1229
			Request::redirect(null, null, SubmissionEditHandler::getFrom(), $articleId);
1218
		} else {
1230
		} else {
1219
			parent::setupTemplate(true, $articleId, 'summary');
1231
			parent::setupTemplate(true, $articleId, 'summary');
 Lines 1463-1468    Link Here 
1463
		$galleyForm =& new ArticleGalleyForm($articleId);
1475
		$galleyForm =& new ArticleGalleyForm($articleId);
1464
		$galleyId = $galleyForm->execute($fileName);
1476
		$galleyId = $galleyForm->execute($fileName);
1465
1477
1478
		// Send a notification to associated users
1479
		import('notification.Notification');
1480
		$articleDao = &DAORegistry::getDAO('ArticleDAO'); 
1481
		$article = &$articleDao->getArticle($articleId);
1482
		$notificationUsers = $article->getAssociatedUserIds(true, false);
1483
		foreach ($notificationUsers as $user) {
1484
			$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
1485
			Notification::createNotification($user['id'], "notification.type.galleyAdded",
1486
				$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_GALLEY_ADDED);
1487
		}
1488
		
1466
		Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
1489
		Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
1467
	}
1490
	}
1468
1491
 Lines 1507-1513    Link Here 
1507
		$submitForm->readInputData();
1530
		$submitForm->readInputData();
1508
		if ($submitForm->validate()) {
1531
		if ($submitForm->validate()) {
1509
			$submitForm->execute();
1532
			$submitForm->execute();
1510
1533
			
1534
			// Send a notification to associated users
1535
			import('notification.Notification');
1536
			$articleDao =& DAORegistry::getDAO('ArticleDAO'); 
1537
			$article =& $articleDao->getArticle($articleId);
1538
			$notificationUsers = $article->getAssociatedUserIds(true, false);
1539
			foreach ($notificationUsers as $user) {
1540
				$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
1541
				Notification::createNotification($user['id'], "notification.type.galleyModified",
1542
					$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_GALLEY_MODIFIED);
1543
			}
1544
			
1511
			if (Request::getUserVar('uploadImage')) {
1545
			if (Request::getUserVar('uploadImage')) {
1512
				$submitForm->uploadImage();
1546
				$submitForm->uploadImage();
1513
				Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
1547
				Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
 Lines 1626-1631    Link Here 
1626
		$suppFileForm->setData('title', Locale::translate('common.untitled'));
1660
		$suppFileForm->setData('title', Locale::translate('common.untitled'));
1627
		$suppFileId = $suppFileForm->execute($fileName);
1661
		$suppFileId = $suppFileForm->execute($fileName);
1628
1662
1663
		// Send a notification to associated users
1664
		import('notification.Notification');
1665
		$articleDao =& DAORegistry::getDAO('ArticleDAO'); 
1666
		$article =& $articleDao->getArticle($articleId);
1667
		$notificationUsers = $article->getAssociatedUserIds(true, false);
1668
		foreach ($notificationUsers as $user) {
1669
			$url = Request::url(null, $user['role'], 'submissionEditing', $article->getArticleId(), null, 'layout');
1670
			Notification::createNotification($user['id'], "notification.type.suppFileAdded",
1671
				$article->getArticleTitle(), $url, 1, NOTIFICATION_TYPE_SUPP_FILE_ADDED);
1672
		}
1673
1629
		Request::redirect(null, null, 'editSuppFile', array($articleId, $suppFileId));
1674
		Request::redirect(null, null, 'editSuppFile', array($articleId, $suppFileId));
1630
	}
1675
	}
1631
1676
(-)plugins/blocks/fontSize/FontSizeBlockPlugin.inc.php (-1 / +1 lines)
 Lines 23-29    Link Here 
23
		if ($success) {
23
		if ($success) {
24
			$this->addLocaleData();
24
			$this->addLocaleData();
25
			$templateMgr =& TemplateManager::getManager();
25
			$templateMgr =& TemplateManager::getManager();
26
			$templateMgr->assign('fontIconPath', 'templates/images/icons');
26
			$templateMgr->assign('fontIconPath', 'lib/pkp/templates/images/icons');
27
			$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
27
			$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
28
28
29
			// Add font sizer js and css if not already in header
29
			// Add font sizer js and css if not already in header
(-)plugins/blocks/navigation/block.tpl (+1 lines)
 Lines 38-43    Link Here 
38
		<li><a href="{url page="search" op="titles"}">{translate key="navigation.browseByTitle"}</a></li>
38
		<li><a href="{url page="search" op="titles"}">{translate key="navigation.browseByTitle"}</a></li>
39
		{if $hasOtherJournals}
39
		{if $hasOtherJournals}
40
		<li><a href="{url journal="index"}">{translate key="navigation.otherJournals"}</a></li>
40
		<li><a href="{url journal="index"}">{translate key="navigation.otherJournals"}</a></li>
41
		<li><a href="{url page="notification"}">{translate key="notification.notifications"}</a></li>
41
		{/if}
42
		{/if}
42
	</ul>
43
	</ul>
43
	{/if}
44
	{/if}
(-)plugins/blocks/notification/NotificationBlockPlugin.inc.php (+120 lines)
Added Link Here 
1
<?php
2
3
/**
4
 * @file NotificationBlockPlugin.inc.php
5
 *
6
 * Copyright (c) 2003-2008 John Willinsky
7
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
8
 *
9
 * @class NotificationBlockPlugin
10
 * @ingroup plugins_blocks_notification
11
 *
12
 * @brief Class for "notification" block plugin
13
 */
14
15
// $Id: NotificationBlockPlugin.inc.php,v 1.6 2008/07/01 01:16:12 asmecher Exp $
16
17
18
import('plugins.BlockPlugin');
19
20
class NotificationBlockPlugin extends BlockPlugin {
21
	function register($category, $path) {
22
		$success = parent::register($category, $path);
23
		if ($success) {
24
			$this->addLocaleData();
25
		}
26
		return $success;
27
	}
28
29
	/**
30
	 * Determine whether the plugin is enabled. Overrides parent so that
31
	 * the plugin will be displayed during install.
32
	 */
33
	function getEnabled() {
34
		if (!Config::getVar('general', 'installed')) return true;
35
		return parent::getEnabled();
36
	}
37
38
	/**
39
	 * Install default settings on system install.
40
	 * @return string
41
	 */
42
	function getInstallSitePluginSettingsFile() {
43
		return $this->getPluginPath() . '/settings.xml';
44
	}
45
46
	/**
47
	 * Install default settings on journal creation.
48
	 * @return string
49
	 */
50
	function getNewJournalPluginSettingsFile() {
51
		return $this->getPluginPath() . '/settings.xml';
52
	}
53
54
	/**
55
	 * Get the block context. Overrides parent so that the plugin will be
56
	 * displayed during install.
57
	 * @return int
58
	 */
59
	function getBlockContext() {
60
		if (!Config::getVar('general', 'installed')) return BLOCK_CONTEXT_RIGHT_SIDEBAR;
61
		return parent::getBlockContext();
62
	}
63
64
	/**
65
	 * Get the supported contexts (e.g. BLOCK_CONTEXT_...) for this block.
66
	 * @return array
67
	 */
68
	function getSupportedContexts() {
69
		return array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR);
70
	}
71
72
	/**
73
	 * Determine the plugin sequence. Overrides parent so that
74
	 * the plugin will be displayed during install.
75
	 */
76
	function getSeq() {
77
		if (!Config::getVar('general', 'installed')) return 1;
78
		return parent::getSeq();
79
	}
80
81
	/**
82
	 * Get the name of this plugin. The name must be unique within
83
	 * its category.
84
	 * @return String name of plugin
85
	 */
86
	function getName() {
87
		return 'NotificationBlockPlugin';
88
	}
89
90
	/**
91
	 * Get the display name of this plugin.
92
	 * @return String
93
	 */
94
	function getDisplayName() {
95
		return Locale::translate('plugins.block.notification.displayName');
96
	}
97
98
	/**
99
	 * Get a description of the plugin.
100
	 */
101
	function getDescription() {
102
		return Locale::translate('plugins.block.notification.description');
103
	}
104
	
105
	
106
	function getContents(&$templateMgr) {
107
		$user =& Request::getUser();
108
		$journal =& Request::getJournal();
109
		
110
		if ($user && $journal) {
111
			$userId = $user->getUserId();
112
			$notificationDao =& DAORegistry::getDAO('NotificationDAO');
113
			$templateMgr->assign('unreadNotifications',  $notificationDao->getUnreadNotificationCount($userId));
114
		}
115
		
116
		return parent::getContents($templateMgr);
117
	}
118
}
119
120
?>
(-)plugins/blocks/notification/block.tpl (+25 lines)
Added Link Here 
1
{**
2
 * block.tpl
3
 *
4
 * Copyright (c) 2003-2008 John Willinsky
5
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
6
 *
7
 * Common site sidebar menu -- "Notification" block.
8
 *
9
 * $Id: block.tpl,v 1.3 2008/06/11 18:55:09 asmecher Exp $
10
 *}
11
<div class="block" id="notification">
12
	{if $currentJournal}
13
		<span class="blockTitle">{translate key="notification.notifications"}</span>
14
		<ul>
15
			{if $isUserLoggedIn}
16
				<li><a href="{url page="notification"}">{translate key="common.view"}</a>
17
					{if $unreadNotifications > 0}{translate key="notification.notificationsNew" numNew=$unreadNotifications}{/if}</li>
18
				<li><a href="{url page="notification" op="settings"}">{translate key="common.manage"}</a></li>			
19
			{else}
20
				<li><a href="{url page="notification"}">{translate key="common.view"}</a></li>
21
				<li><a href="{url page="notification" op="subscribeMailList"}">{translate key="notification.subscribe"}</a> / <a href="{url page="notification" op="unsubscribeMailList"}">{translate key="notification.unsubscribe"}</a></li>	
22
			{/if}
23
		</ul>
24
	{/if}
25
</div>	
(-)plugins/blocks/notification/index.php (+25 lines)
Added Link Here 
1
<?php
2
3
/**
4
 * @defgroup plugins_blocks_notification
5
 */
6
 
7
/**
8
 * @file plugins/blocks/notification/index.php
9
 *
10
 * Copyright (c) 2003-2008 John Willinsky
11
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
12
 *
13
 * @ingroup plugins_blocks_notification
14
 * @brief Wrapper for "notification" block plugin.
15
 *
16
 */
17
18
// $Id: index.php,v 1.5 2008/07/01 01:16:12 asmecher Exp $
19
20
21
require_once('NotificationBlockPlugin.inc.php');
22
23
return new NotificationBlockPlugin();
24
25
?> 
(-)plugins/blocks/notification/settings.xml (+29 lines)
Added Link Here 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE plugin_settings SYSTEM "../../../lib/pkp/dtd/pluginSettings.dtd">
3
4
<!--
5
  * settings.xml
6
  *
7
  * Copyright (c) 2003-2008 John Willinsky
8
  * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9
  *
10
  * Default plugin settings.
11
  *
12
  * $Id: settings.xml,v 1.3 2008/07/14 23:11:06 asmecher Exp $
13
  -->
14
15
<plugin_settings>
16
	<setting type="bool">
17
		<name>enabled</name>
18
		<value>true</value>
19
	</setting>
20
	<setting type="int">
21
		<name>seq</name>
22
		<value>0</value>
23
	</setting>
24
	<setting type="int">
25
		<name>context</name>
26
		<value>2</value><!-- BLOCK_CONTEXT_RIGHT_SIDEBAR -->
27
	</setting>
28
</plugin_settings>
29
(-)plugins/blocks/notification/locale/en_US/locale.xml (+18 lines)
Added Link Here 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE locale SYSTEM "../../../../../lib/pkp/dtd/locale.dtd">
3
4
<!--
5
  * locale.xml
6
  *
7
  * Copyright (c) 2003-2008 John Willinsky
8
  * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9
  *
10
  * Localization strings for the en_US (U.S. English) locale.
11
  *
12
  * $Id: locale.xml,v 1.3 2008/07/14 23:11:06 asmecher Exp $
13
  -->
14
 
15
<locale name="en_US" full_name="U.S. English">
16
	<message key="plugins.block.notification.displayName">"Notification" Block</message>
17
	<message key="plugins.block.notification.description">This plugin displays information about system notifications.</message>
18
</locale>
(-)plugins/blocks/user/UserBlockPlugin.inc.php (+10 lines)
 Lines 77-84    Link Here 
77
	function getContents(&$templateMgr) {
77
	function getContents(&$templateMgr) {
78
		if (!defined('SESSION_DISABLE_INIT')) {
78
		if (!defined('SESSION_DISABLE_INIT')) {
79
			$session =& Request::getSession();
79
			$session =& Request::getSession();
80
			$user =& Request::getUser();
81
			$journal =& Request::getJournal();
82
			
83
			if ($user && $journal) {
84
				$userId = $user->getUserId();
85
				$notificationDao =& DAORegistry::getDAO('NotificationDAO');
86
				$templateMgr->assign('unreadNotifications',  $notificationDao->getUnreadNotificationCount($userId));
87
			}
88
			
80
			$templateMgr->assign_by_ref('userSession', $session);
89
			$templateMgr->assign_by_ref('userSession', $session);
81
			$templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
90
			$templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
91
			
82
		}
92
		}
83
		return parent::getContents($templateMgr);
93
		return parent::getContents($templateMgr);
84
	}
94
	}
(-)plugins/blocks/user/block.tpl (+4 lines)
 Lines 23-28    Link Here 
23
		<li><a href="{url journal="index" page="user"}">{translate key="plugins.block.user.myJournals"}</a></li>
23
		<li><a href="{url journal="index" page="user"}">{translate key="plugins.block.user.myJournals"}</a></li>
24
		{/if}
24
		{/if}
25
		<li><a href="{url page="user" op="profile"}">{translate key="plugins.block.user.myProfile"}</a></li>
25
		<li><a href="{url page="user" op="profile"}">{translate key="plugins.block.user.myProfile"}</a></li>
26
		{if $currentJournal}
27
		<li><a href="{url page="notification"}">{translate key="notification.notifications"}</a>
28
			{if $unreadNotifications > 0}{translate key="notification.notificationsNew" numNew=$unreadNotifications}{/if}</li>
29
		{/if}
26
		<li><a href="{url page="login" op="signOut"}">{translate key="plugins.block.user.logout"}</a></li>
30
		<li><a href="{url page="login" op="signOut"}">{translate key="plugins.block.user.logout"}</a></li>
27
	{if $userSession->getSessionVar('signedInAs')}
31
	{if $userSession->getSessionVar('signedInAs')}
28
		<li><a href="{url page="manager" op="signOutAsUser"}">{translate key="plugins.block.user.signOutAsUser"}</a></li>
32
		<li><a href="{url page="manager" op="signOutAsUser"}">{translate key="plugins.block.user.signOutAsUser"}</a></li>
(-)styles/common.css (-1 / +18 lines)
 Lines 651-657    Link Here 
651
	font-size: 1em;
651
	font-size: 1em;
652
}
652
}
653
653
654
ul.formErrorList a {
654
span.formSuccess {
655
	color: #090;
656
	font-weight: bold;
657
	font-size: 1em;
658
}
659
660
ul.formErrorList {
655
	color: #900;
661
	color: #900;
656
}
662
}
657
663
 Lines 742-744    Link Here 
742
	width: 505px;
748
	width: 505px;
743
	z-index:1;
749
	z-index:1;
744
}
750
}
751
752
td.notificationContent {
753
	padding-left: 5px;
754
	padding-right: 5px;
755
}
756
757
td.notificationFunction {
758
	padding-left: 5px;
759
	padding-right: 5px;
760
	text-align: right;
761
}
(-)templates/article/article.tpl (-12 / +12 lines)
 Lines 15-23    Link Here 
15
		<div id="topBar">
15
		<div id="topBar">
16
			<div id="articleFontSize">
16
			<div id="articleFontSize">
17
				{translate key="article.fontSize"}:&nbsp;
17
				{translate key="article.fontSize"}:&nbsp;
18
				<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.small.altText"}');" class="icon">{icon path="templates/images/icons/" name="font_small"}</a>&nbsp;
18
				<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.small.altText"}');" class="icon">{icon path="lib/pkp/templates/images/icons/" name="font_small"}</a>&nbsp;
19
				<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.medium.altText"}');" class="icon">{icon path="templates/images/icons/" name="font_medium"}</a>&nbsp;
19
				<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.medium.altText"}');" class="icon">{icon path="lib/pkp/templates/images/icons/" name="font_medium"}</a>&nbsp;
20
				<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.large.altText"}');" class="icon">{icon path="templates/images/icons/" name="font_large"}</a>
20
				<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.large.altText"}');" class="icon">{icon path="lib/pkp/templates/images/icons/" name="font_large"}</a>
21
			</div>
21
			</div>
22
		</div>
22
		</div>
23
		{$galley->getHTMLContents()}
23
		{$galley->getHTMLContents()}
 Lines 27-35    Link Here 
27
		{assign var=galleys value=$article->getLocalizedGalleys()}
27
		{assign var=galleys value=$article->getLocalizedGalleys()}
28
		{if $galleys && $subscriptionRequired && $showGalleyLinks}
28
		{if $galleys && $subscriptionRequired && $showGalleyLinks}
29
			<div id="accessKey">
29
			<div id="accessKey">
30
				<img src="{$baseUrl}/templates/images/icons/fulltext_open_medium.gif" alt="{translate key="article.accessLogoOpen.altText"}" />
30
				<img src="{$baseUrl}/lib/pkp/templates/images/icons/fulltext_open_medium.gif" alt="{translate key="article.accessLogoOpen.altText"}" />
31
				{translate key="reader.openAccess"}&nbsp;
31
				{translate key="reader.openAccess"}&nbsp;
32
				<img src="{$baseUrl}/templates/images/icons/fulltext_restricted_medium.gif" alt="{translate key="article.accessLogoRestricted.altText"}" />
32
				<img src="{$baseUrl}/lib/pkp/templates/images/icons/fulltext_restricted_medium.gif" alt="{translate key="article.accessLogoRestricted.altText"}" />
33
				{if $purchaseArticleEnabled}
33
				{if $purchaseArticleEnabled}
34
					{translate key="reader.subscriptionOrFeeAccess"}
34
					{translate key="reader.subscriptionOrFeeAccess"}
35
				{else}
35
				{else}
 Lines 39-47    Link Here 
39
		{/if}
39
		{/if}
40
		<div id="articleFontSize">
40
		<div id="articleFontSize">
41
				{translate key="article.fontSize"}:&nbsp;
41
				{translate key="article.fontSize"}:&nbsp;
42
			<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.small.altText"}');" class="icon">{icon path="templates/images/icons/" name="font_small"}</a>&nbsp;
42
			<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.small.altText"}');" class="icon">{icon path="lib/pkp/templates/images/icons/" name="font_small"}</a>&nbsp;
43
			<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.medium.altText"}');" class="icon">{icon path="templates/images/icons/" name="font_medium"}</a>&nbsp;
43
			<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.medium.altText"}');" class="icon">{icon path="lib/pkp/templates/images/icons/" name="font_medium"}</a>&nbsp;
44
			<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.large.altText"}');" class="icon">{icon path="templates/images/icons/" name="font_large"}</a>
44
			<a href="#" onclick="setFontSize('{translate|escape:"jsparam" key="article.fontSize.large.altText"}');" class="icon">{icon path="lib/pkp/templates/images/icons/" name="font_large"}</a>
45
		</div>
45
		</div>
46
	</div>
46
	</div>
47
	{if $coverPagePath}
47
	{if $coverPagePath}
 Lines 71-87    Link Here 
71
				<a href="{url page="article" op="view" path=$article->getBestArticleId($currentJournal)|to_array:$galley->getBestGalleyId($currentJournal)}" class="file" target="_parent">{$galley->getGalleyLabel()|escape}</a>
71
				<a href="{url page="article" op="view" path=$article->getBestArticleId($currentJournal)|to_array:$galley->getBestGalleyId($currentJournal)}" class="file" target="_parent">{$galley->getGalleyLabel()|escape}</a>
72
				{if $subscriptionRequired && $showGalleyLinks && $restrictOnlyPdf}
72
				{if $subscriptionRequired && $showGalleyLinks && $restrictOnlyPdf}
73
					{if $article->getAccessStatus() || !$galley->isPdfGalley()}	
73
					{if $article->getAccessStatus() || !$galley->isPdfGalley()}	
74
						<img class="accessLogo" src="{$baseUrl}/templates/images/icons/fulltext_open_medium.gif" alt="{translate key="article.accessLogoOpen.altText"}" />
74
						<img class="accessLogo" src="{$baseUrl}/lib/pkp/templates/images/icons/fulltext_open_medium.gif" alt="{translate key="article.accessLogoOpen.altText"}" />
75
					{else}
75
					{else}
76
						<img class="accessLogo" src="{$baseUrl}/templates/images/icons/fulltext_restricted_medium.gif" alt="{translate key="article.accessLogoRestricted.altText"}" />
76
						<img class="accessLogo" src="{$baseUrl}/lib/pkp/templates/images/icons/fulltext_restricted_medium.gif" alt="{translate key="article.accessLogoRestricted.altText"}" />
77
					{/if}
77
					{/if}
78
				{/if}
78
				{/if}
79
			{/foreach}
79
			{/foreach}
80
			{if $subscriptionRequired && $showGalleyLinks && !$restrictOnlyPdf}
80
			{if $subscriptionRequired && $showGalleyLinks && !$restrictOnlyPdf}
81
				{if $article->getAccessStatus()}
81
				{if $article->getAccessStatus()}
82
					<img class="accessLogo" src="{$baseUrl}/templates/images/icons/fulltext_open_medium.gif" alt="{translate key="article.accessLogoOpen.altText"}" />
82
					<img class="accessLogo" src="{$baseUrl}/lib/pkp/templates/images/icons/fulltext_open_medium.gif" alt="{translate key="article.accessLogoOpen.altText"}" />
83
				{else}
83
				{else}
84
					<img class="accessLogo" src="{$baseUrl}/templates/images/icons/fulltext_restricted_medium.gif" alt="{translate key="article.accessLogoRestricted.altText"}" />
84
					<img class="accessLogo" src="{$baseUrl}/lib/pkp/templates/images/icons/fulltext_restricted_medium.gif" alt="{translate key="article.accessLogoRestricted.altText"}" />
85
				{/if}
85
				{/if}
86
			{/if}					
86
			{/if}					
87
		{else}
87
		{else}

Return to bug 3922