https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113336
Revision: 113336 Author: jeroendedauw Date: 2012-03-08 00:08:52 +0000 (Thu, 08 Mar 2012) Log Message: ----------- http://education.wmflabs.org/index.php/Thread:MW_1.18_talk:Community_portal/Changes_to_profiles_unlogged Modified Paths: -------------- trunk/extensions/EducationProgram/EducationProgram.i18n.php trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php Modified: trunk/extensions/EducationProgram/EducationProgram.i18n.php =================================================================== --- trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-07 23:55:48 UTC (rev 113335) +++ trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-08 00:08:52 UTC (rev 113336) @@ -104,11 +104,13 @@ 'logentry-online-remove' => '$1 removed {{PLURAL:$4|Online Ambassador|Online Ambassadors}} $5 from course $3', 'logentry-online-selfadd' => '$1 added {{GENDER:$2|himself|herself}} as {{GENDER:$2|Online Ambassador}} to course $3', 'logentry-online-selfremove' => '$1 removed {{GENDER:$2|himself|herself}} as {{GENDER:$2|Online Ambassador}} from course $3', + 'logentry-online-profilesave' => '$1 updated {{GENDER:$2|his|her}} Online Ambassador profile', 'logentry-campus-add' => '$1 added {{PLURAL:$4|Campus Ambassador|Campus Ambassadors}} $5 to course $3', 'logentry-campus-remove' => '$1 removed {{PLURAL:$4|Campus Ambassador|Campus Ambassadors}} $5 from course $3', 'logentry-campus-selfadd' => '$1 added {{GENDER:$2|himself|herself}} as {{GENDER:$2|Campus Ambassador}} to course $3', 'logentry-campus-selfremove' => '$1 removed {{GENDER:$2|himself|herself}} as {{GENDER:$2|Campus Ambassador}} from course $3', + 'logentry-campus-profilesave' => '$1 updated {{GENDER:$2|his|her}} Campus Ambassador profile', 'logentry-student-add' => '$1 enrolled in course $3', 'logentry-student-remove' => '$1 removed $5 as {{GENDER:$2|student}} from course $3', @@ -724,6 +726,7 @@ 'epoa-profile-photo' => 'Profile photo', 'epoa-profile-photo-help' => 'A picture of you that will be shown next to your bio. Enter the name of an image on Wikimedia Commons and a preview will appear. You can type the first few letters of the image name and then select your image from the suggestion list. If you do not have a picture of you on commons yet, [$1 go upload one]!', 'epoa-profile-saved' => 'Your profile has been saved', + 'epoa-profile-invalid-bio' => 'Your bio needs to be at least contain $1 {{PLURAL:$1|character|characters}}.', // Special:CampusAmbassadorProfile 'campusambassadorprofile' => 'Campus Ambassador profile', @@ -734,6 +737,7 @@ 'epca-profile-photo' => 'Profile photo', 'epca-profile-photo-help' => 'A picture of you that will be shown next to your bio. Enter the name of an image on Wikimedia Commons and a preview will appear. You can type the first few letters of the image name and then select your image from the suggestion list. If you do not have a picture of you on commons yet, [$1 go upload one]!', 'epca-profile-saved' => 'Your profile has been saved', + 'epca-profile-invalid-bio' => 'Your bio needs to be at least contain $1 {{PLURAL:$1|character|characters}}.', ); /** Message documentation (Message documentation) Modified: trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php =================================================================== --- trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php 2012-03-07 23:55:48 UTC (rev 113335) +++ trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php 2012-03-08 00:08:52 UTC (rev 113336) @@ -92,19 +92,20 @@ $class = $this->getClassName(); $ambassador = $class::newFromUser( $this->getUser() ); + $msgPrefix = $this->getMsgPrefix(); + $fields['bio'] = array( 'type' => 'textarea', 'label-message' => $this->getMsgPrefix() . 'profile-bio', 'required' => true, - 'validation-callback' => function ( $value, array $alldata = null ) { - return strlen( $value ) < 10 ? wfMsgExt( $this->getMsgPrefix() . 'profile-invalid-bio', 'parsemag', 10 ) : true; + 'validation-callback' => function ( $value, array $alldata = null ) use( $msgPrefix ) { + return strlen( $value ) < 10 ? wfMsgExt( $msgPrefix . 'profile-invalid-bio', 'parsemag', 10 ) : true; }, 'rows' => 10, 'id' => 'wpTextbox1', 'default' => $ambassador->getField( 'bio' ), ); - // FIXME: ambassadorCommonsUrl is not getting passed, this looks like a bug or regression in HTMLForm since nothing else passes args to help-message. $fields['photo'] = array( 'type' => 'text', 'label-message' => $this->getMsgPrefix() . 'profile-photo', @@ -122,6 +123,16 @@ * @since 0.1 */ public function onSuccess() { + $class = $this->getClassName(); + $ambassador = $class::newFromUser( $this->getUser() ); + + EPUtils::log( array( + 'type' => $ambassador->getRoleName(), + 'subtype' => 'profilesave', + 'user' => $this->getUser(), + 'title' => $this->getTitle(), + ) ); + $this->getRequest()->setSessionData( 'epprofilesaved', true ); $this->getOutput()->redirect( $this->getTitle()->getLocalURL() ); } _______________________________________________ MediaWiki-CVS mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
