We are moving to Git Issues for bug tracking in future releases. During transition, content will be in both tools. If you'd like to file a new bug, please create an issue.

View | Details | Raw Unified | Return to bug 8125
Collapse All | Expand All

(-)a/controllers/grid/submissions/SubmissionsListGridHandler.inc.php (-2 / +46 lines)
 Lines 22-27   import('controllers.grid.submissions.SubmissionsListGridCellProvider'); Link Here 
22
import('classes.workflow.EditorDecisionActionsManager');
22
import('classes.workflow.EditorDecisionActionsManager');
23
23
24
class SubmissionsListGridHandler extends GridHandler {
24
class SubmissionsListGridHandler extends GridHandler {
25
	/** @var $_isManager true iff the current user has a managerial role */
26
	var $_isManager;
25
27
26
	/**
28
	/**
27
	 * Constructor
29
	 * Constructor
 Lines 63-72   class SubmissionsListGridHandler extends GridHandler { Link Here 
63
		$user =& $request->getUser();
65
		$user =& $request->getUser();
64
		$this->setGridDataElements($this->getSubmissions($request, $user->getId()));
66
		$this->setGridDataElements($this->getSubmissions($request, $user->getId()));
65
67
68
		// Fetch the authorized roles and determine if the user is a manager.
69
		$authorizedRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
70
		$this->_isManager = in_array(ROLE_ID_PRESS_MANAGER, $authorizedRoles);
71
66
		// If there is more than one press in the system, add a press column
72
		// If there is more than one press in the system, add a press column
67
		$pressDao =& DAORegistry::getDAO('PressDAO');
73
		$pressDao =& DAORegistry::getDAO('PressDAO');
68
		$presses =& $pressDao->getPresses();
74
		$presses =& $pressDao->getPresses();
69
		$authorizedRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
70
		$cellProvider = new SubmissionsListGridCellProvider($authorizedRoles);
75
		$cellProvider = new SubmissionsListGridCellProvider($authorizedRoles);
71
		if($presses->getCount() > 1) {
76
		if($presses->getCount() > 1) {
72
			$this->addColumn(
77
			$this->addColumn(
 Lines 114-120   class SubmissionsListGridHandler extends GridHandler { Link Here 
114
119
115
120
116
	//
121
	//
117
	// Protected template methods to be overridden by sub-classes.
122
	// Public handler operations
123
	//
124
	/**
125
	 * Delete a submission
126
	 * @param $args array
127
	 * @param $request PKPRequest
128
	 * @return string Serialized JSON object
129
	 */
130
	function deleteSubmission($args, &$request) {
131
		$monographDao =& DAORegistry::getDAO('MonographDAO');
132
		$monograph = $monographDao->getById(
133
			(int) $request->getUserVar('monographId')
134
		);
135
136
		// If the submission is incomplete, or this is a manager, allow it to be deleted
137
		if ($monograph && ($this->_isManager || $monograph->getSubmissionProgress() != 0)) {
138
			$monographDao =& DAORegistry::getDAO('MonographDAO'); /* @var $monographDao MonographDAO */
139
			$monographDao->deleteById($monograph->getId());
140
141
			$user =& $request->getUser();
142
			NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedSubmission')));
143
			return DAO::getDataChangedEvent($monograph->getId());
144
		} else {
145
			$json = new JSONMessage(false);
146
			return $json->getString();
147
		}
148
	}
149
150
151
	//
152
	// Protected methods
118
	//
153
	//
119
	/**
154
	/**
120
	 * Return a list of submissions.
155
	 * Return a list of submissions.
 Lines 127-132   class SubmissionsListGridHandler extends GridHandler { Link Here 
127
		// Must be implemented by sub-classes.
162
		// Must be implemented by sub-classes.
128
		assert(false);
163
		assert(false);
129
	}
164
	}
165
166
	/**
167
	 * @see GridHandler::getRowInstance()
168
	 * @return SubmissionsListGridRow
169
	 */
170
	function &getRowInstance() {
171
		$row = new SubmissionsListGridRow($this->_isManager);
172
		return $row;
173
	}
130
}
174
}
131
175
132
?>
176
?>
(-)a/controllers/grid/submissions/SubmissionsListGridRow.inc.php (-6 / +5 lines)
 Lines 16-31   import('lib.pkp.classes.controllers.grid.GridRow'); Link Here 
16
import('lib.pkp.classes.linkAction.request.AjaxModal');
16
import('lib.pkp.classes.linkAction.request.AjaxModal');
17
17
18
class SubmissionsListGridRow extends GridRow {
18
class SubmissionsListGridRow extends GridRow {
19
19
	/** @var $_isManager boolean true iff the user has a managerial role */
20
	/** @var boolean */
20
	var $_isManager;
21
	var $_canDelete;
22
21
23
	/**
22
	/**
24
	 * Constructor
23
	 * Constructor
25
	 */
24
	 */
26
	function SubmissionsListGridRow($canDelete = false) {
25
	function SubmissionsListGridRow($isManager) {
27
		$this->_canDelete = $canDelete;
28
		parent::GridRow();
26
		parent::GridRow();
27
		$this->_isManager = $isManager;
29
	}
28
	}
30
29
31
	//
30
	//
 Lines 45-51   class SubmissionsListGridRow extends GridRow { Link Here 
45
			$monographDao =& DAORegistry::getDAO('MonographDAO'); /* @var $monographDao MonographDAO */
44
			$monographDao =& DAORegistry::getDAO('MonographDAO'); /* @var $monographDao MonographDAO */
46
			$monograph =& $monographDao->getById($rowId);
45
			$monograph =& $monographDao->getById($rowId);
47
			assert(is_a($monograph, 'Monograph'));
46
			assert(is_a($monograph, 'Monograph'));
48
			if ($this->_canDelete && $monograph->getSubmissionProgress() != 0) {
47
			if ($monograph->getSubmissionProgress() != 0 || $this->_isManager) {
49
				$router =& $request->getRouter();
48
				$router =& $request->getRouter();
50
				import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
49
				import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
51
				$confirmationModal = new RemoteActionConfirmationModal(
50
				$confirmationModal = new RemoteActionConfirmationModal(
(-)a/controllers/grid/submissions/assignedSubmissions/AssignedSubmissionsListGridHandler.inc.php (-15 / +2 lines)
 Lines 25-34   class AssignedSubmissionsListGridHandler extends SubmissionsListGridHandler { Link Here 
25
	 * Constructor
25
	 * Constructor
26
	 */
26
	 */
27
	function AssignedSubmissionsListGridHandler() {
27
	function AssignedSubmissionsListGridHandler() {
28
		parent::GridHandler();
28
		parent::SubmissionsListGridHandler();
29
		$this->addRoleAssignment(
29
		$this->addRoleAssignment(
30
			array(ROLE_ID_SITE_ADMIN, ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR, ROLE_ID_REVIEWER, ROLE_ID_PRESS_ASSISTANT),
30
			array(ROLE_ID_SITE_ADMIN, ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR, ROLE_ID_REVIEWER, ROLE_ID_PRESS_ASSISTANT),
31
			array('fetchGrid')
31
			array('fetchGrid', 'fetchRow', 'deleteSubmission')
32
		);
32
		);
33
	}
33
	}
34
34
 Lines 112-130   class AssignedSubmissionsListGridHandler extends SubmissionsListGridHandler { Link Here 
112
112
113
		return $data;
113
		return $data;
114
	}
114
	}
115
116
117
	//
118
	// Overridden methods from GridHandler
119
	//
120
	/**
121
	 * Get the row handler - override the default row handler
122
	 * @return SubmissionsListGridRow
123
	 */
124
	function &getRowInstance() {
125
		$row = new SubmissionsListGridRow();
126
		return $row;
127
	}
128
}
115
}
129
116
130
?>
117
?>
(-)a/controllers/grid/submissions/mySubmissions/MySubmissionsListGridHandler.inc.php (-46 / +4 lines)
 Lines 25-33   class MySubmissionsListGridHandler extends SubmissionsListGridHandler { Link Here 
25
	 */
25
	 */
26
	function MySubmissionsListGridHandler() {
26
	function MySubmissionsListGridHandler() {
27
		parent::SubmissionsListGridHandler();
27
		parent::SubmissionsListGridHandler();
28
28
		$this->addRoleAssignment(
29
		$this->addRoleAssignment(array(ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR, ROLE_ID_PRESS_ASSISTANT, ROLE_ID_AUTHOR),
29
			array(ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR, ROLE_ID_PRESS_ASSISTANT, ROLE_ID_AUTHOR),
30
				array('fetchGrid', 'fetchRow', 'deleteSubmission'));
30
			array('fetchGrid', 'fetchRow', 'deleteSubmission')
31
		);
31
	}
32
	}
32
33
33
	//
34
	//
 Lines 45-80   class MySubmissionsListGridHandler extends SubmissionsListGridHandler { Link Here 
45
46
46
47
47
	//
48
	//
48
	// Public Handler Actions
49
	//
50
	/**
51
	 * Delete a submission
52
	 * @param $args array
53
	 * @param $request PKPRequest
54
	 * @return string Serialized JSON object
55
	 */
56
	function deleteSubmission($args, &$request) {
57
		$monographDao =& DAORegistry::getDAO('MonographDAO');
58
		$monograph = $monographDao->getById(
59
			(int) $request->getUserVar('monographId')
60
		);
61
62
		// If the submission is incomplete, allow it to be deleted
63
		if ($monograph && $monograph->getSubmissionProgress() != 0) {
64
			$monographDao =& DAORegistry::getDAO('MonographDAO'); /* @var $monographDao MonographDAO */
65
			$monographDao->deleteById($monograph->getId());
66
67
			$user =& $request->getUser();
68
			NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedSubmission')));
69
			return DAO::getDataChangedEvent($monograph->getId());
70
		} else {
71
			$json = new JSONMessage(false);
72
			return $json->getString();
73
		}
74
	}
75
76
77
	//
78
	// Implement template methods from SubmissionListGridHandler
49
	// Implement template methods from SubmissionListGridHandler
79
	//
50
	//
80
	/**
51
	/**
 Lines 96-114   class MySubmissionsListGridHandler extends SubmissionsListGridHandler { Link Here 
96
67
97
		return $data;
68
		return $data;
98
	}
69
	}
99
100
101
	//
102
	// Overridden methods from GridHandler
103
	//
104
	/**
105
	 * @see GridHandler::getRowInstance()
106
	 * @return SubmissionsListGridRow
107
	 */
108
	function &getRowInstance() {
109
		$row = new SubmissionsListGridRow(true);
110
		return $row;
111
	}
112
}
70
}
113
71
114
?>
72
?>
(-)a/controllers/grid/submissions/unassignedSubmissions/UnassignedSubmissionsListGridHandler.inc.php (-14 / +4 lines)
 Lines 26-32   class UnassignedSubmissionsListGridHandler extends SubmissionsListGridHandler { Link Here 
26
	 */
26
	 */
27
	function UnassignedSubmissionsListGridHandler() {
27
	function UnassignedSubmissionsListGridHandler() {
28
		parent::SubmissionsListGridHandler();
28
		parent::SubmissionsListGridHandler();
29
		$this->addRoleAssignment(array(ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR), array('fetchGrid'));
29
		$this->addRoleAssignment(
30
			array(ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR),
31
			array('fetchGrid', 'fetchRow', 'deleteSubmission')
32
		);
30
	}
33
	}
31
34
32
35
 Lines 98-116   class UnassignedSubmissionsListGridHandler extends SubmissionsListGridHandler { Link Here 
98
101
99
		return $accessibleMonographs;
102
		return $accessibleMonographs;
100
	}
103
	}
101
102
103
	//
104
	// Overridden methods from GridHandler
105
	//
106
	/**
107
	 * Get the row handler - override the default row handler
108
	 * @return SubmissionsListGridRow
109
	 */
110
	function &getRowInstance() {
111
		$row = new SubmissionsListGridRow();
112
		return $row;
113
	}
114
}
104
}
115
105
116
?>
106
?>

Return to bug 8125