Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | |
62 | 62 | // Show list of campaigns |
63 | 63 | $this->listNotices(); |
| 64 | + $wgOut->addHTML( Xml::closeElement( 'div' ) ); |
64 | 65 | return; |
65 | 66 | } |
66 | 67 | |
— | — | @@ -475,7 +476,7 @@ |
476 | 477 | $language_count = count( $project_langs ); |
477 | 478 | $languageList = ''; |
478 | 479 | if ( $language_count > 3 ) { |
479 | | - $languageList = "multiple ($language_count)"; |
| 480 | + $languageList = wfMsg ( 'centralnotice-multiple_languages', $language_count ); |
480 | 481 | } elseif ( $language_count > 0 ) { |
481 | 482 | $languageList = implode(', ',$project_langs); |
482 | 483 | } |
— | — | @@ -576,7 +577,7 @@ |
577 | 578 | // Name |
578 | 579 | $htmlOut .= Xml::openElement( 'tr' ); |
579 | 580 | $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-notice-name' ) ); |
580 | | - $htmlOut .= Xml::tags( 'td', array(), Xml::inputLabel( '', 'noticeName', 'noticeName', 25 ) ); |
| 581 | + $htmlOut .= Xml::tags( 'td', array(), Xml::input( 'noticeName', 25 ) ); |
581 | 582 | $htmlOut .= Xml::closeElement( 'tr' ); |
582 | 583 | // Start Date |
583 | 584 | $htmlOut .= Xml::openElement( 'tr' ); |
— | — | @@ -585,7 +586,7 @@ |
586 | 587 | $htmlOut .= Xml::closeElement( 'tr' ); |
587 | 588 | // Start Time |
588 | 589 | $htmlOut .= Xml::openElement( 'tr' ); |
589 | | - $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-hour' ) . "(GMT)" ); |
| 590 | + $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-start-hour' ) ); |
590 | 591 | $htmlOut .= Xml::tags( 'td', array(), $this->timeSelector( 'start' ) ); |
591 | 592 | $htmlOut .= Xml::closeElement( 'tr' ); |
592 | 593 | // Project |
— | — | @@ -1062,7 +1063,7 @@ |
1063 | 1064 | "not_end >= $encTimestamp", |
1064 | 1065 | "not_enabled = 1", |
1065 | 1066 | 'cn_notice_languages.not_id = cn_notices.not_id', |
1066 | | - "cn_notice_languages.not_language = '$language'", |
| 1067 | + 'cn_notice_languages.not_language' => $language, |
1067 | 1068 | "not_project" => array( '', $project ), |
1068 | 1069 | 'cn_notices.not_id=cn_assignments.not_id', |
1069 | 1070 | 'cn_assignments.tmp_id=cn_templates.tmp_id' |
— | — | @@ -1089,6 +1090,9 @@ |
1090 | 1091 | if ( $dbr->numRows( $res ) > 0 ) { |
1091 | 1092 | $wgOut->addHTML( Xml::element( 'div', array( 'class' => 'cn-error' ), wfMsg( 'centralnotice-notice-exists' ) ) ); |
1092 | 1093 | return; |
| 1094 | + } elseif ( empty( $project_languages ) ) { |
| 1095 | + $wgOut->addHTML( Xml::element( 'div', array( 'class' => 'cn-error' ), wfMsg( 'centralnotice-no-language' ) ) ); |
| 1096 | + return; |
1093 | 1097 | } else { |
1094 | 1098 | $dbw = wfGetDB( DB_MASTER ); |
1095 | 1099 | $dbw->begin(); |
— | — | @@ -1338,7 +1342,11 @@ |
1339 | 1343 | |
1340 | 1344 | $options = "\n"; |
1341 | 1345 | foreach( $languages as $code => $name ) { |
1342 | | - $options .= Xml::option( "$code - $name", $code, in_array( $code, $selected ) ) . "\n"; |
| 1346 | + $options .= Xml::option( |
| 1347 | + wfMsg( 'centralnotice-language-listing', $code, $name ), |
| 1348 | + $code, |
| 1349 | + in_array( $code, $selected ) |
| 1350 | + ) . "\n"; |
1343 | 1351 | } |
1344 | 1352 | $htmlOut = ''; |
1345 | 1353 | if ( $this->editable ) { |
— | — | @@ -1391,15 +1399,15 @@ |
1392 | 1400 | $row = $dbw->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $notice ) ); |
1393 | 1401 | |
1394 | 1402 | // Add newly assigned languages |
1395 | | - $addLanguages = array_diff($newLanguages, $oldLanguages); |
| 1403 | + $addLanguages = array_diff( $newLanguages, $oldLanguages ); |
| 1404 | + $insertArray = array(); |
1396 | 1405 | foreach( $addLanguages as $code ) { |
1397 | | - $res = $dbw->insert( 'cn_notice_languages', |
1398 | | - array( 'not_id' => $row->not_id, 'not_language' => $code ) |
1399 | | - ); |
| 1406 | + $insertArray[] = array( 'not_id' => $row->not_id, 'not_language' => $code ); |
1400 | 1407 | } |
| 1408 | + $res = $dbw->insert( 'cn_notice_languages', $insertArray ); |
1401 | 1409 | |
1402 | 1410 | // Remove disassociated languages |
1403 | | - $removeLanguages = array_diff($oldLanguages, $newLanguages); |
| 1411 | + $removeLanguages = array_diff( $oldLanguages, $newLanguages ); |
1404 | 1412 | foreach( $removeLanguages as $code ) { |
1405 | 1413 | $res = $dbw->delete( 'cn_notice_languages', |
1406 | 1414 | array( 'not_id' => $row->not_id, 'not_language' => $code ) |
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php |
— | — | @@ -33,6 +33,8 @@ |
34 | 34 | 'centralnotice-add-template' => 'Add a banner', |
35 | 35 | 'centralnotice-show-notices' => 'Show campaigns', |
36 | 36 | 'centralnotice-list-templates' => 'List banners', |
| 37 | + 'centralnotice-multiple_languages' => 'multiple ($1)', |
| 38 | + 'centralnotice-language-listing' => '$1 - $2', |
37 | 39 | 'centralnotice-translations' => 'Translations', |
38 | 40 | 'centralnotice-translate-to' => 'Translate to', |
39 | 41 | 'centralnotice-translate' => 'Translate', |
— | — | @@ -48,6 +50,7 @@ |
49 | 51 | 'centralnotice-notices' => 'Campaigns', |
50 | 52 | 'centralnotice-notice-exists' => 'Campaign already exists. |
51 | 53 | Not adding.', |
| 54 | + 'centralnotice-no-language' => 'No language was selected for the campaign. Not adding.', |
52 | 55 | 'centralnotice-template-exists' => 'Banner already exists. |
53 | 56 | Not adding.', |
54 | 57 | 'centralnotice-notice-doesnt-exist' => 'Campaign does not exist.', |
— | — | @@ -76,7 +79,7 @@ |
77 | 80 | 'centralnotice-template-already-exists' => 'Banner is already tied to campaign. |
78 | 81 | Not adding.', |
79 | 82 | 'centralnotice-preview-template' => 'Preview banner', |
80 | | - 'centralnotice-start-hour' => 'Start time', |
| 83 | + 'centralnotice-start-hour' => 'Start time (GMT)', |
81 | 84 | 'centralnotice-change-lang' => 'Change translation language', |
82 | 85 | 'centralnotice-weights' => 'Weights', |
83 | 86 | 'centralnotice-notice-is-locked' => 'Campaign is locked. |
— | — | @@ -109,7 +112,10 @@ |
110 | 113 | 'centralnotice-donate-button' => 'Donate button', |
111 | 114 | 'centralnotice-expanded-banner' => 'Expanded banner', |
112 | 115 | 'centralnotice-collapsed-banner' => 'Collapsed banner', |
113 | | - 'centralnotice-banner-type' => 'Banner type', |
| 116 | + 'centralnotice-banner-display' => 'Display to:', |
| 117 | + 'centralnotice-banner-anonymous' => 'Anonymous users', |
| 118 | + 'centralnotice-banner-logged-in' => 'Logged in users', |
| 119 | + 'centralnotice-banner-type' => 'Banner type:', |
114 | 120 | 'centralnotice-banner-hidable' => 'Static/Hidable', |
115 | 121 | 'centralnotice-banner-collapsable' => 'Collapsable', |
116 | 122 | |
— | — | @@ -144,6 +150,7 @@ |
145 | 151 | 'centralnotice-remove' => '{{Identical|Remove}}', |
146 | 152 | 'centralnotice-translate-heading' => 'Fieldset label. $1 is a name of a template.', |
147 | 153 | 'centralnotice-add' => '{{Identical|Add}}', |
| 154 | + 'centralnotice-language-listing' => 'A language listing for the language multi-select box. First parameter is the language code. Second parameter is the name of the language.', |
148 | 155 | 'centralnotice-translate' => '{{Identical|Translate}}', |
149 | 156 | 'centralnotice-notice-exists' => 'Error message displayed in Special:CentralNotice when trying to add a notice with the same name of another notice', |
150 | 157 | 'centralnotice-template-exists' => 'Error message displayed in Special:NoticeTemplate when trying to add a template with the same name of another template', |