Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -9,6 +9,18 @@ |
10 | 10 | * @author Arthur Richards |
11 | 11 | */ |
12 | 12 | $messages['en'] = array( |
| 13 | + 'articlefeedbackv5-abuse-saved' => 'Abuse flag saved', |
| 14 | + 'articlefeedbackv5-hide-saved' => 'Hide flag saved', |
| 15 | + 'articlefeedbackv5-error-loading-feedback' => 'Error loading Feedback', |
| 16 | + 'articlefeedbackv5-invalid-feedback-id' => 'Invalid feedback ID', |
| 17 | + 'articlefeedbackv5-invalid-feedback-flag' => 'Invalid feedback flag', |
| 18 | + 'articlefeedbackv5-go-to-article' => 'Go to Article', |
| 19 | + 'articlefeedbackv5-discussion-page' => 'Discussion Page', |
| 20 | + 'articlefeedbackv5-whats-this' => 'What\'s this?', |
| 21 | + 'articlefeedbackv5-invalid-page-id' => 'Invalid page ID', |
| 22 | + 'articlefeedbackv5-percent-found' => '$1% of users found what they were looking for.', |
| 23 | + 'articlefeedbackv5-overall-rating' => 'Rating: $1/5', |
| 24 | + 'articlefeedbackv5-special-title' => '==Feedback==', |
13 | 25 | 'articlefeedbackv5' => 'Article feedback dashboard', |
14 | 26 | 'articlefeedbackv5-desc' => 'Article feedback', |
15 | 27 | |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | 'success': function ( data ) { |
68 | 68 | // TODO check output and error if needed |
69 | 69 | $( '#aft5-' + type + '-link-' + id ).html( |
70 | | - type + ' flag saved' |
| 70 | + mw.msg( 'articlefeedbackv5-' + type + '-saved' ) |
71 | 71 | ); |
72 | 72 | } |
73 | 73 | // TODO have a callback for failures. |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | } |
106 | 106 | |
107 | 107 | } else { |
108 | | - // TODO: have error message |
| 108 | + $( '#aft5-show-feedback' ).html( mw.msg( 'articlefeedbackv5-error-loading-feedback' ) ); |
109 | 109 | } |
110 | 110 | } |
111 | 111 | // TODO: have a callback for failures. |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | |
30 | 30 | if ( !isset( $params['feedbackid'] ) |
31 | 31 | || !preg_match( '/^\d+$/', $params['feedbackid'] ) ) { |
32 | | - $error = 'Invalid feedback ID format.'; |
| 32 | + $error = wfMsg( 'articlefeedbackv5-invalid-feedback-id' ); |
33 | 33 | } |
34 | 34 | |
35 | 35 | # load feedback record, bail if we don't have one |
— | — | @@ -40,13 +40,13 @@ |
41 | 41 | |
42 | 42 | if ( !$record->af_id ) { |
43 | 43 | // no-op, because this is already broken |
44 | | - $error = 'Invalid feedback ID.'; |
| 44 | + $error = wfMsg( 'articlefeedbackv5-invalid-feedback-id' ); |
45 | 45 | } elseif ( $params['flagtype'] == 'abuse' ) { |
46 | 46 | $update['af_abuse_count'] = $record->af_abuse_count + 1; |
47 | 47 | } elseif ( $params['flagtype'] == 'hide' ) { |
48 | 48 | $update['af_hide_count'] = $record->af_hide_count + 1; |
49 | 49 | } else { |
50 | | - $error = 'Invalid flag type.'; |
| 50 | + $error = wfMsg( 'articlefeedbackv5-invalid-feedback-flag' ); |
51 | 51 | } |
52 | 52 | |
53 | 53 | if ( !$error ) { |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php |
— | — | @@ -98,7 +98,6 @@ |
99 | 99 | } |
100 | 100 | $where[$prefix . '_page_id'] = $pageId; |
101 | 101 | $where[] = $prefix . '_rating_id = afi_id'; |
102 | | -# $where['afi_bucket_id'] = 5; // TODO: Pass this in |
103 | 102 | |
104 | 103 | $rows = $dbr->select( |
105 | 104 | array( 'aft_' . $table, 'aft_article_field' ), |
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php |
— | — | @@ -9,38 +9,36 @@ |
10 | 10 | public function execute( $title ) { |
11 | 11 | global $wgOut; |
12 | 12 | $pageId = $this->pageIdFromTitle( $title ); |
13 | | - |
14 | | - if( !$pageId ) { |
15 | | - # Probably this is bad. |
16 | | - print "That ain't no good kind of page."; |
17 | | - die(); |
18 | | - } |
19 | | - |
20 | | - $wgOut->setPagetitle( "Feedback for $title" ); |
21 | | -# $wgOut->addModules( 'jquery.articleFeedbackv5.special' ); |
22 | | - |
23 | 13 | $this->api = $this->getApi(); |
24 | | - $output = ''; |
25 | 14 | $ratings = $this->api->fetchOverallRating( $pageId ); |
26 | 15 | $found = isset( $ratings['found'] ) ? $ratings['found'] : null; |
27 | 16 | $rating = isset( $ratings['rating'] ) ? $ratings['rating'] : null; |
28 | 17 | |
29 | | - $output .= "[[Wikipedia:$title|Go to Article]] |
30 | | - | [[Wikipedia:$title|Discussion page]] |
31 | | - | [[Wikipedia:$title|What's this?]]\n"; |
| 18 | + $wgOut->setPagetitle( "Feedback for $title" ); |
32 | 19 | |
| 20 | + if( !$pageId ) { |
| 21 | + $wgOut->addWikiMsg( 'articlefeedbackv5-invalid-page-id' ); |
| 22 | + } else { |
| 23 | + $wgOut->addWikiText( |
| 24 | + "[[Wikipedia:$title|" |
| 25 | + .wfMsg('articlefeedbackv5-go-to-article')."]] |
| 26 | + | [[Wikipedia:$title|" |
| 27 | + .wfMsg('articlefeedbackv5-discussion-page')."]] |
| 28 | + | [[Wikipedia:$title|" |
| 29 | + .wfMsg('articlefeedbackv5-whats-this')."]]" |
| 30 | + ); |
| 31 | + } |
| 32 | + |
33 | 33 | if( $found ) { |
34 | | - $output .= " $found% of users found what they were looking for. "; |
| 34 | + $wgOut->addWikiMsg( 'articlefeedbackv5-percent-found', $found ); |
35 | 35 | } |
36 | 36 | |
37 | 37 | if( $rating ) { |
38 | | - $output .= " Rating: $rating/5 "; |
| 38 | + $wgOut->addWikiMsg( 'articlefeedbackv5-overall-rating', $rating); |
39 | 39 | } |
40 | 40 | |
41 | | - $output .= "\n== Feedback ==\n"; |
| 41 | + $wgOut->addWikiMsg( 'articlefeedbackv5-special-title' ); |
42 | 42 | |
43 | | - $wgOut->addWikiText( $output ); |
44 | | - |
45 | 43 | $wgOut->addHTML(<<<EOH |
46 | 44 | <!-- This is a terrible, terrible hack. I'm taking it out as soon as I stop |
47 | 45 | being an idiot and sort this ResourceLoader thing out --> |