r112349 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112348‎ | r112349 | r112350 >
Date:20:21, 24 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added auths and prefs for bulk deletion and added missing messages for rights and actions
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.hooks.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCoursePager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgPager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -230,6 +230,8 @@
231231 $wgAvailableRights[] = 'ep-beinstructor'; // Add or remove yourself as instructor from courses
232232 $wgAvailableRights[] = 'ep-bereviewer'; // Add or remove yourself as reviewer from articles
233233 $wgAvailableRights[] = 'ep-remreviewer'; // Remove reviewers from articles
 234+$wgAvailableRights[] = 'ep-bulkdelorgs'; // Bulk delete institutions
 235+$wgAvailableRights[] = 'ep-bulkdelcourses'; // Bulk delete courses
234236
235237 // User group rights
236238 $wgGroupPermissions['*']['ep-enroll'] = true;
@@ -243,8 +245,10 @@
244246 $wgGroupPermissions['*']['ep-beonline'] = false;
245247 $wgGroupPermissions['*']['ep-becampus'] = false;
246248 $wgGroupPermissions['*']['ep-beinstructor'] = false;
247 -$wgGroupPermissions['*']['ep-bereviewer'] = true;
 249+$wgGroupPermissions['*']['ep-bereviewer'] = true; // TODO: do we want this?
248250 $wgGroupPermissions['*']['ep-remreviewer'] = false;
 251+$wgGroupPermissions['*']['ep-bulkdelorgs'] = false;
 252+$wgGroupPermissions['*']['ep-bulkdelcourses'] = false;
249253
250254 $wgGroupPermissions['epstaff']['ep-org'] = true;
251255 $wgGroupPermissions['epstaff']['ep-course'] = true;
@@ -259,6 +263,8 @@
260264 $wgGroupPermissions['epstaff']['ep-beinstructor'] = true;
261265 $wgGroupPermissions['epstaff']['ep-bereviewer'] = true;
262266 $wgGroupPermissions['epstaff']['ep-remreviewer'] = true;
 267+$wgGroupPermissions['epstaff']['ep-bulkdelorgs'] = true;
 268+$wgGroupPermissions['epstaff']['ep-bulkdelcourses'] = true;
263269
264270 $wgGroupPermissions['epadmin']['ep-org'] = true;
265271 $wgGroupPermissions['epadmin']['ep-course'] = true;
@@ -273,6 +279,7 @@
274280 $wgGroupPermissions['epadmin']['ep-beinstructor'] = true;
275281 $wgGroupPermissions['epadmin']['ep-bereviewer'] = true;
276282 $wgGroupPermissions['epadmin']['ep-remreviewer'] = true;
 283+$wgGroupPermissions['epadmin']['ep-bulkdelcourses'] = true;
277284
278285 $wgGroupPermissions['eponlineamb']['ep-org'] = true;
279286 $wgGroupPermissions['eponlineamb']['ep-course'] = true;
@@ -595,5 +602,7 @@
596603
597604 $egEPSettings = array();
598605
599 -# The default value for the user preferences.
 606+// The default value for the user preferences.
600607 $wgDefaultUserOptions['ep_showtoplink'] = false;
 608+$wgDefaultUserOptions['ep_bulkdelorgs'] = false;
 609+$wgDefaultUserOptions['ep_bulkdelcourses'] = true;
Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php
@@ -166,7 +166,10 @@
167167 protected function getMultipleItemActions() {
168168 $actions = parent::getMultipleItemActions();
169169
170 - if ( $this->getUser()->isAllowed( 'ep-org' ) ) {
 170+ if ( $this->getUser()->isAllowed( 'ep-org' )
 171+ && $this->getUser()->isAllowed( 'ep-bulkdelorgs' )
 172+ && $this->getUser()->getOption( 'ep_bulkdelorgs' ) ) {
 173+
171174 $actions[wfMsg( 'ep-pager-delete-selected' )] = array(
172175 'class' => 'ep-pager-delete-selected',
173176 'data-type' => ApiDeleteEducation::getTypeForClassName( get_class( $this->table ) )
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php
@@ -217,7 +217,11 @@
218218 protected function getMultipleItemActions() {
219219 $actions = parent::getMultipleItemActions();
220220
221 - if ( !$this->readOnlyMode && $this->getUser()->isAllowed( 'ep-course' ) ) {
 221+ if ( !$this->readOnlyMode
 222+ && $this->getUser()->isAllowed( 'ep-course' )
 223+ && $this->getUser()->isAllowed( 'ep-bulkdelcourses' )
 224+ && $this->getUser()->getOption( 'ep_bulkdelcourses' ) ) {
 225+
222226 $actions[wfMsg( 'ep-pager-delete-selected' )] = array(
223227 'class' => 'ep-pager-delete-selected',
224228 'data-type' => ApiDeleteEducation::getTypeForClassName( get_class( $this->table ) )
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -115,6 +115,8 @@
116116 // Preferences
117117 'prefs-education' => 'Education',
118118 'ep-prefs-showtoplink' => 'Show a link to [[Special:MyCourses|your courses]] at the top of every page.',
 119+ 'ep-prefs-bulkdelorgs' => 'Show a bulk deletion control for the [[Special:Institutions|institutions]].',
 120+ 'ep-prefs-bulkdelcourses' => 'Show a bulk deletion control for the [[Special:Courses|courses]].',
119121
120122 // Rights
121123 'right-ep-org' => 'Manage Education Program institutions',
@@ -125,6 +127,13 @@
126128 'right-ep-online' => 'Add or remove online ambassadors to courses',
127129 'right-ep-campus' => 'Add or remove campus ambassadors to courses',
128130 'right-ep-instructor' => 'Add or remove instructors to courses',
 131+ 'right-ep-beonline' => 'Add or remove yourself as online ambassador from terms',
 132+ 'right-ep-becampus' => 'Add or remove yourself as campus ambassador from terms',
 133+ 'right-ep-beinstructor' => ' Add or remove yourself as instructor from courses',
 134+ 'right-ep-bereviewer' => 'Add or remove yourself as reviewer from articles',
 135+ 'right-ep-remreviewer' => 'Remove reviewers from articles',
 136+ 'right-ep-bulkdelorgs' => 'Bulk delete institutions',
 137+ 'right-ep-bulkdelcourses' => 'Bulk delete courses',
129138
130139 // Actions
131140 'action-ep-org' => 'manage institutions',
@@ -135,6 +144,13 @@
136145 'action-ep-online' => 'add or remove online ambassadors to courses',
137146 'action-ep-campus' => 'add or remove campus ambassadors to courses',
138147 'action-ep-instructor' => 'add or remove instructors to courses',
 148+ 'action-ep-beonline' => 'add or remove yourself as online ambassador from terms',
 149+ 'action-ep-becampus' => 'add or remove yourself as campus ambassador from terms',
 150+ 'action-ep-beinstructor' => ' add or remove yourself as instructor from courses',
 151+ 'action-ep-bereviewer' => 'add or remove yourself as reviewer from articles',
 152+ 'action-ep-remreviewer' => 'remove reviewers from articles',
 153+ 'action-ep-bulkdelorgs' => 'bulk delete institutions',
 154+ 'action-ep-bulkdelcourses' => 'bulk delete courses',
139155
140156 // Groups
141157 'group-epadmin' => 'Education program admins',
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php
@@ -118,6 +118,22 @@
119119 'section' => 'education',
120120 );
121121 }
 122+
 123+ if ( $user->isAllowed( 'ep-bulkdelorgs' ) ) {
 124+ $preferences['ep_bulkdelorgs'] = array(
 125+ 'type' => 'toggle',
 126+ 'label-message' => 'ep-prefs-bulkdelorgs',
 127+ 'section' => 'education',
 128+ );
 129+ }
 130+
 131+ if ( $user->isAllowed( 'ep-bulkdelcourses' ) ) {
 132+ $preferences['ep_bulkdelcourses'] = array(
 133+ 'type' => 'toggle',
 134+ 'label-message' => 'ep-prefs-bulkdelcourses',
 135+ 'section' => 'education',
 136+ );
 137+ }
122138
123139 return true;
124140 }

Status & tagging log