https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113462
Revision: 113462
Author: amire80
Date: 2012-03-09 10:04:41 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
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/TranslationNotifications.alias.php
trunk/extensions/TranslationNotifications/TranslationNotifications.php
Added Paths:
-----------
trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php
trunk/extensions/TranslationNotifications/resources/
trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js
Added: trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php
===================================================================
--- trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php
(rev 0)
+++ trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php
2012-03-09 10:04:41 UTC (rev 113462)
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Form for translation managers to send a notification
+ * to registered translators.
+ *
+ * @file
+ * @author Amir E. Aharoni
+ * @copyright Copyright © 2012, Amir E. Aharoni
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
+ */
+
+/**
+ * Form for translation managers to send a notification
+ * to registered translators.
+ *
+ * @ingroup SpecialPage TranslateSpecialPage
+ */
+
+class SpecialNotifyTranslators extends SpecialPage {
+ protected static $right = 'translate-manage';
+
+ public function __construct() {
+ parent::__construct( 'NotifyTranslators' );
+ }
+
+ public function execute( $parameters ) {
+ global $wgUser, $wgOut;
+ if ( !$wgUser->isallowed( self::$right ) ) {
+ throw new PermissionsError( self::$right );
+ }
+
+ $wgOut->addModules(
'ext.translationnotifications.notifytranslators' );
+
+ $context = $this->getContext();
+ $htmlForm = new HtmlForm( $this->getDataModel(), $context,
'translationnotifications' );
+ $htmlForm->setId( 'notifytranslators-form' );
+ $htmlForm->setSubmitText( $context->msg(
'translationnotifications-send-notification-button' )->text() );
+ $htmlForm->setSubmitID(
'translationnotifications-send-notification-button' );
+ $htmlForm->setSubmitCallback( array( $this, 'formSubmit' ) );
+ $htmlForm->show();
+
+ $this->setHeaders();
+ }
+
+ public function getDataModel() {
+ $m['LanguagesToNotify'] = array(
+ 'type' => 'text',
+ 'rows' => 20,
+ 'cols' => 80,
+ 'label-message' =>
'translationnotifications-languages-to-notify-label',
+ );
+
+ $m['NotificationText'] = array(
+ 'type' => 'textarea',
+ 'rows' => 20,
+ 'cols' => 80,
+ 'label-message' => 'emailmessage',
+ );
+
+ $m['DeadlineDate'] = array(
+ 'type' => 'text',
+ 'size' => 20,
+ 'label-message' =>
'translationnotifications-deadline-label',
+ );
+
+ return $m;
+ }
+}
Property changes on:
trunk/extensions/TranslationNotifications/SpecialNotifyTranslators.php
___________________________________________________________________
Added: svn:eol-style
+ native
Modified:
trunk/extensions/TranslationNotifications/TranslationNotifications.alias.php
===================================================================
---
trunk/extensions/TranslationNotifications/TranslationNotifications.alias.php
2012-03-09 09:33:14 UTC (rev 113461)
+++
trunk/extensions/TranslationNotifications/TranslationNotifications.alias.php
2012-03-09 10:04:41 UTC (rev 113462)
@@ -10,5 +10,12 @@
/** English (English) */
$specialPageAliases['en'] = array(
+ 'NotifyTranslators' => array( 'NotifyTranslators' ),
'TranslatorSignup' => array( 'TranslatorSignup' ),
);
+
+/** Hebrew (עברית) */
+$specialPageAliases['he'] = array(
+ 'NotifyTranslators' => array( 'מכתבים_למתרגמים' ),
+ 'TranslatorSignup' => array( 'רישום_מתרגמים' ),
+);
Modified: trunk/extensions/TranslationNotifications/TranslationNotifications.php
===================================================================
--- trunk/extensions/TranslationNotifications/TranslationNotifications.php
2012-03-09 09:33:14 UTC (rev 113461)
+++ trunk/extensions/TranslationNotifications/TranslationNotifications.php
2012-03-09 10:04:41 UTC (rev 113462)
@@ -25,11 +25,26 @@
$dir = dirname( __FILE__ );
$wgSpecialPages['TranslatorSignup'] = 'SpecialTranslatorSignup';
+$wgSpecialPages['NotifyTranslators'] = 'SpecialNotifyTranslators';
$wgSpecialPageGroups['TranslatorSignup'] = 'login';
+$wgSpecialPageGroups['NotifyTranslators'] = 'users';
$wgExtensionMessagesFiles['TranslationNotifications'] =
"$dir/TranslationNotifications.i18n.php";
$wgExtensionMessagesFiles['TranslationNotificationsAlias'] =
"$dir/TranslationNotifications.alias.php";
$wgAutoloadClasses['SpecialTranslatorSignup'] =
"$dir/SpecialTranslatorSignup.php";
+$wgAutoloadClasses['SpecialNotifyTranslators'] =
"$dir/SpecialNotifyTranslators.php";
+$resourcePaths = array(
+ 'localBasePath' => dirname( __FILE__ ),
+ 'remoteExtPath' => 'TranslationNotifications'
+);
+
+$wgResourceModules['ext.translationnotifications.notifytranslators'] = array(
+ 'scripts' =>
'resources/ext.translationnotifications.notifytranslators.js',
+ 'dependencies' => array(
+ 'jquery.ui.datepicker'
+ ),
+) + $resourcePaths;
+
$wgTranslationNotificationsContactMethods = array(
'email' => true,
'talkpage' => true,
Added:
trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js
===================================================================
---
trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js
(rev 0)
+++
trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js
2012-03-09 10:04:41 UTC (rev 113462)
@@ -0,0 +1,32 @@
+/**
+ * JavaScript functions for embedding jQuery controls
+ * into TranslationNotificatnions forms.
+ *
+ * @author Amir E. Aharoni
+ * @copyright Copyright © 2012 Amir E. Aharoni
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
+ */
+
+(function ( $ ) {
+ $( document ).ready( function( page, group ) {
+ // Based on UploadWizard
+ $( '#mw-input-wpDeadlineDate' ).datepicker( {
+ dateFormat: 'yy-mm-dd',
+ constrainInput: false,
+ showOn: 'focus',
+ changeMonth: true,
+ changeYear: true,
+ showAnim: false,
+ showButtonPanel: true
+ } )
+ .data( 'open', 0 )
+ .click( function() {
+ var $this = $( this );
+ if ( $this.data( 'open' ) === 0 ) {
+ $this.data( 'open', 1 ).datepicker( 'show' );
+ } else {
+ $this.data( 'open', 0 ).datepicker( 'hide' );
+ }
+ } );
+ } );
+} )( jQuery );
Property changes on:
trunk/extensions/TranslationNotifications/resources/ext.translationnotifications.notifytranslators.js
___________________________________________________________________
Added: svn:eol-style
+ native
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs