Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -760,7 +760,6 @@ |
761 | 761 | 'not_end', |
762 | 762 | 'not_enabled', |
763 | 763 | 'not_preferred', |
764 | | - 'not_project', |
765 | 764 | 'not_locked', |
766 | 765 | 'not_geo' |
767 | 766 | ), |
— | — | @@ -789,7 +788,7 @@ |
790 | 789 | $isEnabled = $wgRequest->getCheck( 'enabled' ); |
791 | 790 | $isPreferred = $wgRequest->getCheck( 'preferred' ); |
792 | 791 | $isLocked = $wgRequest->getCheck( 'locked' ); |
793 | | - $projectSelected = $wgRequest->getVal( 'project_name' ); |
| 792 | + $noticeProjects = $wgRequest->getArray( 'projects', array() ); |
794 | 793 | $noticeLanguages = $wgRequest->getArray( 'project_languages', array() ); |
795 | 794 | $isGeotargeted = $wgRequest->getCheck( 'geotargeted' ); |
796 | 795 | $countries = $wgRequest->getArray( 'geo_countries', array() ); |
— | — | @@ -799,7 +798,7 @@ |
800 | 799 | $isEnabled = ( $row->not_enabled == '1' ); |
801 | 800 | $isPreferred = ( $row->not_preferred == '1' ); |
802 | 801 | $isLocked = ( $row->not_locked == '1' ); |
803 | | - $projectSelected = $row->not_project; |
| 802 | + $noticeProjects = $this->getNoticeProjects( $notice ); |
804 | 803 | $noticeLanguages = $this->getNoticeLanguages( $notice ); |
805 | 804 | $isGeotargeted = ( $row->not_geo == '1' ); |
806 | 805 | $countries = $this->getNoticeCountries( $notice ); |
— | — | @@ -833,8 +832,10 @@ |
834 | 833 | $htmlOut .= Xml::closeElement( 'tr' ); |
835 | 834 | // Project |
836 | 835 | $htmlOut .= Xml::openElement( 'tr' ); |
837 | | - $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-projects' ) ); |
838 | | - $htmlOut .= Xml::tags( 'td', array(), $this->projectDropDownList( $projectSelected ) ); |
| 836 | + $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), |
| 837 | + wfMsgHtml( 'centralnotice-projects' ) ); |
| 838 | + $htmlOut .= Xml::tags( 'td', array(), |
| 839 | + $this->projectMultiSelector( $noticeProjects ) ); |
839 | 840 | $htmlOut .= Xml::closeElement( 'tr' ); |
840 | 841 | // Languages |
841 | 842 | $htmlOut .= Xml::openElement( 'tr' ); |
— | — | @@ -1256,6 +1257,21 @@ |
1257 | 1258 | return null; |
1258 | 1259 | } |
1259 | 1260 | } |
| 1261 | + |
| 1262 | + function getNoticeProjects( $noticeName ) { |
| 1263 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1264 | + $eNoticeName = htmlspecialchars( $noticeName ); |
| 1265 | + $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) ); |
| 1266 | + $projects = array(); |
| 1267 | + if ( $row ) { |
| 1268 | + $res = $dbr->select( 'cn_notice_projects', 'np_project', |
| 1269 | + array( 'np_notice_id' => $row->not_id ) ); |
| 1270 | + foreach ( $res as $projectRow ) { |
| 1271 | + $projects[] = $projectRow->np_project; |
| 1272 | + } |
| 1273 | + } |
| 1274 | + return $projects; |
| 1275 | + } |
1260 | 1276 | |
1261 | 1277 | function getNoticeLanguages( $noticeName ) { |
1262 | 1278 | $dbr = wfGetDB( DB_SLAVE ); |
Index: trunk/extensions/CentralNotice/centralnotice.js |
— | — | @@ -1,3 +1,10 @@ |
| 2 | +function selectProjects( selectAll ) { |
| 3 | + var selectBox = document.getElementById('projects[]'); |
| 4 | + var firstSelect = selectBox.options.length - 1; |
| 5 | + for (var i = firstSelect; i >= 0; i--) { |
| 6 | + selectBox.options[i].selected = selectAll; |
| 7 | + } |
| 8 | +} |
2 | 9 | function selectLanguages( selectAll ) { |
3 | 10 | var selectBox = document.getElementById('project_languages[]'); |
4 | 11 | var firstSelect = selectBox.options.length - 1; |