r107675 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107674‎ | r107675 | r107676 >
Date:00:08, 31 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
added toplink
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/EducationProgram.settings.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -20,6 +20,11 @@
2121 $messages['en'] = array(
2222 'educationprogram-desc' => '', // TODO
2323
 24+
 25+ // Misc
 26+ 'ep-item-summary' => 'Summary',
 27+ 'ep-toplink' => 'My courses',
 28+
2429 // Rights
2530 'right-epadmin' => 'Manage the education program',
2631 'right-epstudent' => 'Enroll in the education program',
@@ -214,9 +219,6 @@
215220 'ep-nav-courses' => 'Courses list',
216221 'ep-nav-terms' => 'Terms list',
217222 'ep-nav-mycourses' => 'My courses',
218 -
219 - // Misc
220 - 'ep-item-summary' => 'Summary',
221223 );
222224
223225 /** Message documentation (Message documentation)
Index: trunk/extensions/EducationProgram/EducationProgram.settings.php
@@ -28,6 +28,7 @@
2929 */
3030 protected static function getDefaultSettings() {
3131 return array(
 32+ 'enableTopLink' => true
3233 );
3334 }
3435
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -219,7 +219,7 @@
220220 $egEPSettings = array();
221221
222222 # The default value for the user preferences.
223 -//$wgDefaultUserOptions[''] = false;
 223+$wgDefaultUserOptions['ep_showtoplink'] = false;
224224
225225 // TODO: put somewhere decent + document
226226 function efEpGetCountryOptions( $langCode ) {
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php
@@ -63,7 +63,24 @@
6464 * @return true
6565 */
6666 public static function onPersonalUrls( array &$personal_urls, Title &$title ) {
 67+ if ( EPSettings::get( 'enableTopLink' ) ) {
 68+ global $wgUser;
6769
 70+ // Find the watchlist item and replace it by the my contests link and itself.
 71+ if ( $wgUser->isLoggedIn() && $wgUser->getOption( 'ep_showtoplink' ) ) {
 72+ $url = SpecialPage::getTitleFor( 'MyCourses' )->getLinkUrl();
 73+ $myCourses = array(
 74+ 'text' => wfMsg( 'ep-toplink' ),
 75+ 'href' => $url,
 76+ 'active' => ( $url == $title->getLinkUrl() )
 77+ );
 78+
 79+ $insertUrls = array( 'mycourses' => $myCourses );
 80+
 81+ $personal_urls = wfArrayInsertAfter( $personal_urls, $insertUrls, 'preferences' );
 82+ }
 83+ }
 84+
6885 return true;
6986 }
7087
@@ -79,7 +96,7 @@
8097 * @return true
8198 */
8299 public static function onGetPreferences( User $user, array &$preferences ) {
83 -
 100+
84101 return true;
85102 }
86103

Status & tagging log