r113462 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113461‎ | r113462 | r113463 >
Date:10:04, 9 March 2012
Author:amire80
Status:ok
Tags:i18nreview 
Comment:
Follow up to r113459. Adding SpecialNotifyTranslators.php, only the parts that work. It's the first special page that i wrote from scratch, so please be gentle.
Modified paths:
  • /trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php (added) (history)
  • /trunk/extensions/TranslationNotifications/TranslationNotifications.alias.php (modified) (history)
  • /trunk/extensions/TranslationNotifications/TranslationNotifications.php (modified) (history)
  • /trunk/extensions/TranslationNotifications/resources (added) (history)
  • /trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js (added) (history)

Diff [purge]

Index: trunk/extensions/TranslationNotifications/TranslationNotifications.alias.php
@@ -10,5 +10,12 @@
1111
1212 /** English (English) */
1313 $specialPageAliases['en'] = array(
 14+ 'NotifyTranslators' => array( 'NotifyTranslators' ),
1415 'TranslatorSignup' => array( 'TranslatorSignup' ),
1516 );
 17+
 18+/** Hebrew (עברית) */
 19+$specialPageAliases['he'] = array(
 20+ 'NotifyTranslators' => array( 'מכתבים_למתרגמים' ),
 21+ 'TranslatorSignup' => array( 'רישום_מתרגמים' ),
 22+);
Index: trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js
@@ -0,0 +1,32 @@
 2+/**
 3+ * JavaScript functions for embedding jQuery controls
 4+ * into TranslationNotificatnions forms.
 5+ *
 6+ * @author Amir E. Aharoni
 7+ * @copyright Copyright © 2012 Amir E. Aharoni
 8+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 9+ */
 10+
 11+(function ( $ ) {
 12+ $( document ).ready( function( page, group ) {
 13+ // Based on UploadWizard
 14+ $( '#mw-input-wpDeadlineDate' ).datepicker( {
 15+ dateFormat: 'yy-mm-dd',
 16+ constrainInput: false,
 17+ showOn: 'focus',
 18+ changeMonth: true,
 19+ changeYear: true,
 20+ showAnim: false,
 21+ showButtonPanel: true
 22+ } )
 23+ .data( 'open', 0 )
 24+ .click( function() {
 25+ var $this = $( this );
 26+ if ( $this.data( 'open' ) === 0 ) {
 27+ $this.data( 'open', 1 ).datepicker( 'show' );
 28+ } else {
 29+ $this.data( 'open', 0 ).datepicker( 'hide' );
 30+ }
 31+ } );
 32+ } );
 33+} )( jQuery );
Property changes on: trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js
___________________________________________________________________
Added: svn:eol-style
134 + native
Index: trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php
@@ -0,0 +1,68 @@
 2+<?php
 3+/**
 4+ * Form for translation managers to send a notification
 5+ * to registered translators.
 6+ *
 7+ * @file
 8+ * @author Amir E. Aharoni
 9+ * @copyright Copyright © 2012, Amir E. Aharoni
 10+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 11+ */
 12+
 13+/**
 14+ * Form for translation managers to send a notification
 15+ * to registered translators.
 16+ *
 17+ * @ingroup SpecialPage TranslateSpecialPage
 18+ */
 19+
 20+class SpecialNotifyTranslators extends SpecialPage {
 21+ protected static $right = 'translate-manage';
 22+
 23+ public function __construct() {
 24+ parent::__construct( 'NotifyTranslators' );
 25+ }
 26+
 27+ public function execute( $parameters ) {
 28+ global $wgUser, $wgOut;
 29+ if ( !$wgUser->isallowed( self::$right ) ) {
 30+ throw new PermissionsError( self::$right );
 31+ }
 32+
 33+ $wgOut->addModules( 'ext.translationnotifications.notifytranslators' );
 34+
 35+ $context = $this->getContext();
 36+ $htmlForm = new HtmlForm( $this->getDataModel(), $context, 'translationnotifications' );
 37+ $htmlForm->setId( 'notifytranslators-form' );
 38+ $htmlForm->setSubmitText( $context->msg( 'translationnotifications-send-notification-button' )->text() );
 39+ $htmlForm->setSubmitID( 'translationnotifications-send-notification-button' );
 40+ $htmlForm->setSubmitCallback( array( $this, 'formSubmit' ) );
 41+ $htmlForm->show();
 42+
 43+ $this->setHeaders();
 44+ }
 45+
 46+ public function getDataModel() {
 47+ $m['LanguagesToNotify'] = array(
 48+ 'type' => 'text',
 49+ 'rows' => 20,
 50+ 'cols' => 80,
 51+ 'label-message' => 'translationnotifications-languages-to-notify-label',
 52+ );
 53+
 54+ $m['NotificationText'] = array(
 55+ 'type' => 'textarea',
 56+ 'rows' => 20,
 57+ 'cols' => 80,
 58+ 'label-message' => 'emailmessage',
 59+ );
 60+
 61+ $m['DeadlineDate'] = array(
 62+ 'type' => 'text',
 63+ 'size' => 20,
 64+ 'label-message' => 'translationnotifications-deadline-label',
 65+ );
 66+
 67+ return $m;
 68+ }
 69+}
Property changes on: trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php
___________________________________________________________________
Added: svn:eol-style
170 + native
Index: trunk/extensions/TranslationNotifications/TranslationNotifications.php
@@ -25,11 +25,26 @@
2626
2727 $dir = dirname( __FILE__ );
2828 $wgSpecialPages['TranslatorSignup'] = 'SpecialTranslatorSignup';
 29+$wgSpecialPages['NotifyTranslators'] = 'SpecialNotifyTranslators';
2930 $wgSpecialPageGroups['TranslatorSignup'] = 'login';
 31+$wgSpecialPageGroups['NotifyTranslators'] = 'users';
3032 $wgExtensionMessagesFiles['TranslationNotifications'] = "$dir/TranslationNotifications.i18n.php";
3133 $wgExtensionMessagesFiles['TranslationNotificationsAlias'] = "$dir/TranslationNotifications.alias.php";
3234 $wgAutoloadClasses['SpecialTranslatorSignup'] = "$dir/SpecialTranslatorSignup.php";
 35+$wgAutoloadClasses['SpecialNotifyTranslators'] = "$dir/SpecialNotifyTranslators.php";
3336
 37+$resourcePaths = array(
 38+ 'localBasePath' => dirname( __FILE__ ),
 39+ 'remoteExtPath' => 'TranslationNotifications'
 40+);
 41+
 42+$wgResourceModules['ext.translationnotifications.notifytranslators'] = array(
 43+ 'scripts' => 'resources/ext.translationnotifications.notifytranslators.js',
 44+ 'dependencies' => array(
 45+ 'jquery.ui.datepicker'
 46+ ),
 47+) + $resourcePaths;
 48+
3449 $wgTranslationNotificationsContactMethods = array(
3550 'email' => true,
3651 'talkpage' => true,

Follow-up revisions

RevisionCommit summaryAuthorDate
r113669Completing the form fields.amire8021:19, 12 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113459Messages for Special:NotifyTranslators.amire8008:34, 9 March 2012

Status & tagging log