https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106248
Revision: 106248
Author: neilk
Date: 2011-12-14 21:53:47 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
MFT r106156 add links to bugzilla for feedback popup
Modified Paths:
--------------
branches/wmf/1.18wmf1/languages/messages/MessagesEn.php
branches/wmf/1.18wmf1/maintenance/language/messages.inc
branches/wmf/1.18wmf1/resources/Resources.php
branches/wmf/1.18wmf1/resources/mediawiki/mediawiki.feedback.js
Modified: branches/wmf/1.18wmf1/languages/messages/MessagesEn.php
===================================================================
--- branches/wmf/1.18wmf1/languages/messages/MessagesEn.php 2011-12-14
21:42:30 UTC (rev 106247)
+++ branches/wmf/1.18wmf1/languages/messages/MessagesEn.php 2011-12-14
21:53:47 UTC (rev 106248)
@@ -4601,7 +4601,8 @@
# Feedback
-'feedback-note' => 'Your feedback will be posted publicly to the page "[$2
$1]", along with your user name, browser version and operating system.',
+'feedback-note' => 'This form publicly posts a simple comment or suggestion to
the page "[$2 $1]", along with your user name, browser version and operating
system.',
+'feedback-bugnote' => 'Or, you can [$1 post a technical bug report] instead.',
'feedback-subject' => 'Subject:',
'feedback-message' => 'Message:',
'feedback-cancel' => 'Cancel',
@@ -4610,4 +4611,8 @@
'feedback-error1' => 'Error: Unrecognized result from API',
'feedback-error2' => 'Error: Edit failed',
'feedback-error3' => 'Error: No response from API',
+'feedback-thanks' => 'Thanks! Your feedback has been posted to the page "[$2
$1]".',
+'feedback-close' => 'Done',
+'feedback-bugcheck' => 'Great! Just check that it is not already one of the
[$1 known bugs].',
+'feedback-bugnew' => 'I checked. Report a new bug',
);
Modified: branches/wmf/1.18wmf1/maintenance/language/messages.inc
===================================================================
--- branches/wmf/1.18wmf1/maintenance/language/messages.inc 2011-12-14
21:42:30 UTC (rev 106247)
+++ branches/wmf/1.18wmf1/maintenance/language/messages.inc 2011-12-14
21:53:47 UTC (rev 106248)
@@ -3463,14 +3463,19 @@
),
'feedback' => array(
'feedback-note',
+ 'feedback-bugnote',
'feedback-subject',
- 'feedback-message',
- 'feedback-cancel',
- 'feedback-submit',
- 'feedback-adding',
- 'feedback-error1',
- 'feedback-error2',
- 'feedback-error3',
+ 'feedback-message',
+ 'feedback-cancel',
+ 'feedback-submit',
+ 'feedback-adding',
+ 'feedback-error1',
+ 'feedback-error2',
+ 'feedback-error3',
+ 'feedback-thanks',
+ 'feedback-close',
+ 'feedback-bugcheck',
+ 'feedback-bugnew',
),
);
Modified: branches/wmf/1.18wmf1/resources/Resources.php
===================================================================
--- branches/wmf/1.18wmf1/resources/Resources.php 2011-12-14 21:42:30 UTC
(rev 106247)
+++ branches/wmf/1.18wmf1/resources/Resources.php 2011-12-14 21:53:47 UTC
(rev 106248)
@@ -490,6 +490,7 @@
),
'messages' => array(
'feedback-note',
+ 'feedback-bugnote',
'feedback-subject',
'feedback-message',
'feedback-cancel',
@@ -498,6 +499,10 @@
'feedback-error1',
'feedback-error2',
'feedback-error3',
+ 'feedback-thanks',
+ 'feedback-close',
+ 'feedback-bugcheck',
+ 'feedback-bugnew',
),
),
'mediawiki.htmlform' => array(
Modified: branches/wmf/1.18wmf1/resources/mediawiki/mediawiki.feedback.js
===================================================================
--- branches/wmf/1.18wmf1/resources/mediawiki/mediawiki.feedback.js
2011-12-14 21:42:30 UTC (rev 106247)
+++ branches/wmf/1.18wmf1/resources/mediawiki/mediawiki.feedback.js
2011-12-14 21:53:47 UTC (rev 106248)
@@ -19,9 +19,9 @@
*
* Not compatible with LiquidThreads.
*
- * How to use it:
+ * Minimal example in how to use it:
*
- * var feedback = new mw.Feedback( api, myFeedbackPageTitle );
+ * var feedback = new mw.Feedback();
* $( '#myButton' ).click( function() { feedback.launch(); } );
*
* You can also launch the feedback form with a prefilled subject and body.
@@ -35,6 +35,8 @@
* api: {mw.Api} if omitted, will just create a standard
API
* title: {mw.Title} the title of the page where you
collect feedback. Defaults to "Feedback".
* dialogTitleMessageKey: {String} message key for the
title of the dialog box
+ * bugsLink: {mw.Uri|String} url where bugs can be posted
+ * bugsListLink: {mw.Uri|String} url where bugs can be
listed
*/
mw.Feedback = function( options ) {
@@ -54,9 +56,15 @@
options.dialogTitleMessageKey = 'feedback-submit';
}
- this.api = options.api;
- this.feedbackTitle = options.title;
- this.dialogTitleMessageKey = options.dialogTitleMessageKey;
+ if ( options.bugsLink === undefined ) {
+ options.bugsLink =
'//bugzilla.wikimedia.org/enter_bug.cgi';
+ }
+
+ if ( options.bugsListLink === undefined ) {
+ options.bugsListLink =
'//bugzilla.wikimedia.org/query.cgi';
+ }
+
+ $.extend( this, options );
if ( this.dialogTitleMessageKey === undefined ) {
this.dialogTitleMessageKey = 'feedback-submit';
}
@@ -67,19 +75,25 @@
setup: function() {
var _this = this;
- // Set up buttons for dialog box. We have to do it the
hard way since the json keys are localized
- _this.buttons = {};
- _this.buttons[ mw.msg( 'feedback-cancel' ) ] =
function() { _this.cancel(); };
- _this.buttons[ mw.msg( 'feedback-submit' ) ] =
function() { _this.submit(); };
-
- var $feedbackPageLink = $j( '<a></a>' ).attr( { 'href':
_this.feedbackTitle.getUrl(), 'target': '_blank' } );
+
+ var $feedbackPageLink = $( '<a></a>' )
+ .attr( { 'href': _this.title.getUrl(),
'target': '_blank' } )
+ .css( { 'white-space': 'nowrap' } );
+
+ var $bugNoteLink = $( '<a></a>' ).attr( { 'href': '#',
} ).click( function() { _this.displayBugs(); } );
+
+ var $bugsListLink = $( '<a></a>' ).attr( { 'href':
_this.bugsListLink, 'target': '_blank' } );
+
this.$dialog =
$( '<div style="position:relative;"></div>'
).append(
- $( '<div class="feedback-mode
feedback-form"></div>' ).append(
- $( '<div
style="margin-top:0.4em;"></div>' ).append(
- $( '<small></small>'
).msg( 'feedback-note',
-
_this.feedbackTitle.getNameText(),
-
$feedbackPageLink )
+ $( '<div class="feedback-mode
feedback-form"></div>' ).append(
+ $( '<small></small>' ).append(
+ $( '<p></p>' ).msg(
+
'feedback-note',
+
_this.title.getNameText(),
+
$feedbackPageLink.clone()
+ ),
+ $( '<p></p>' ).msg(
'feedback-bugnote', $bugNoteLink )
),
$( '<div
style="margin-top:1em;"></div>' ).append(
mw.msg(
'feedback-subject' ),
@@ -92,16 +106,26 @@
$( '<textarea
name="message" class="feedback-message" style="width:99%;" rows="5"
cols="60"></textarea>' )
)
),
+ $( '<div class="feedback-mode
feedback-bugs"></div>' ).append(
+ $( '<p>' ).msg(
'feedback-bugcheck', $bugsListLink )
+ ),
$( '<div class="feedback-mode
feedback-submitting" style="text-align:center;margin:3em 0;"></div>' ).append(
mw.msg( 'feedback-adding' ),
$( '<br/>' ),
$( '<img
src="http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />' )
),
+ $( '<div class="feedback-mode
feedback-thanks" style="text-align:center;margin:1em"></div>' ).msg(
+ 'feedback-thanks',
_this.title.getNameText(), $feedbackPageLink.clone()
+ ),
$( '<div class="feedback-mode
feedback-error" style="position:relative;"></div>' ).append(
$( '<div
class="feedback-error-msg style="color:#990000;margin-top:0.4em;"></div>' )
+ )
+ );
- )
- ).dialog({
+ // undo some damage from dialog css
+ this.$dialog.find( 'a' ).css( { 'color':
'#0645ad' } );
+
+ this.$dialog.dialog({
width: 500,
autoOpen: false,
title: mw.msg(
this.dialogTitleMessageKey ),
@@ -111,7 +135,7 @@
this.subjectInput = this.$dialog.find(
'input.feedback-subject' ).get(0);
this.messageInput = this.$dialog.find(
'textarea.feedback-message' ).get(0);
- this.displayForm();
+
},
display: function( s ) {
@@ -124,6 +148,23 @@
this.display( 'submitting' );
},
+ displayBugs: function() {
+ var _this = this;
+ this.display( 'bugs' );
+ var bugsButtons = {};
+ bugsButtons[ mw.msg( 'feedback-bugnew' ) ] = function()
{ window.open( _this.bugsLink, '_blank' ); };
+ bugsButtons[ mw.msg( 'feedback-cancel' ) ] = function()
{ _this.cancel(); };
+ this.$dialog.dialog( { buttons: bugsButtons } );
+ },
+
+ displayThanks: function() {
+ var _this = this;
+ this.display( 'thanks' );
+ var closeButton = {};
+ closeButton[ mw.msg( 'feedback-close' ) ] = function()
{ _this.$dialog.dialog( 'close' ); };
+ this.$dialog.dialog( { buttons: closeButton } );
+ },
+
/**
* Display the feedback form
* @param {Object} optional prefilled contents for the feedback
form. Object with properties:
@@ -131,11 +172,17 @@
* message:
{String}
*/
displayForm: function( contents ) {
+ var _this = this;
this.subjectInput.value = (contents &&
contents.subject) ? contents.subject : '';
this.messageInput.value = (contents &&
contents.message) ? contents.message : '';
this.display( 'form' );
- this.$dialog.dialog( { buttons: this.buttons } ); //
put the buttons back
+
+ // Set up buttons for dialog box. We have to do it the
hard way since the json keys are localized
+ var formButtons = {};
+ formButtons[ mw.msg( 'feedback-submit' ) ] = function()
{ _this.submit(); };
+ formButtons[ mw.msg( 'feedback-cancel' ) ] = function()
{ _this.cancel(); };
+ this.$dialog.dialog( { buttons: formButtons } ); // put
the buttons back
},
displayError: function( message ) {
@@ -164,7 +211,7 @@
var ok = function( result ) {
if ( result.edit !== undefined ) {
if ( result.edit.result === 'Success' )
{
- _this.$dialog.dialog( 'close'
); // edit complete, close dialog box
+ _this.displayThanks();
} else {
_this.displayError(
'feedback-error1' ); // unknown API result
}
@@ -177,7 +224,7 @@
displayError( 'feedback-error3' ); // ajax
request failed
};
- this.api.newSection( this.feedbackTitle, subject,
message, ok, err );
+ this.api.newSection( this.title, subject, message, ok,
err );
}, // close submit button function
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs