r76351 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76350‎ | r76351 | r76352 >
Date:23:29, 8 November 2010
Author:kaldari
Status:ok
Tags:
Comment:
more work towards multi-project selection - bug 20229
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/centralnotice.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -760,7 +760,6 @@
761761 'not_end',
762762 'not_enabled',
763763 'not_preferred',
764 - 'not_project',
765764 'not_locked',
766765 'not_geo'
767766 ),
@@ -789,7 +788,7 @@
790789 $isEnabled = $wgRequest->getCheck( 'enabled' );
791790 $isPreferred = $wgRequest->getCheck( 'preferred' );
792791 $isLocked = $wgRequest->getCheck( 'locked' );
793 - $projectSelected = $wgRequest->getVal( 'project_name' );
 792+ $noticeProjects = $wgRequest->getArray( 'projects', array() );
794793 $noticeLanguages = $wgRequest->getArray( 'project_languages', array() );
795794 $isGeotargeted = $wgRequest->getCheck( 'geotargeted' );
796795 $countries = $wgRequest->getArray( 'geo_countries', array() );
@@ -799,7 +798,7 @@
800799 $isEnabled = ( $row->not_enabled == '1' );
801800 $isPreferred = ( $row->not_preferred == '1' );
802801 $isLocked = ( $row->not_locked == '1' );
803 - $projectSelected = $row->not_project;
 802+ $noticeProjects = $this->getNoticeProjects( $notice );
804803 $noticeLanguages = $this->getNoticeLanguages( $notice );
805804 $isGeotargeted = ( $row->not_geo == '1' );
806805 $countries = $this->getNoticeCountries( $notice );
@@ -833,8 +832,10 @@
834833 $htmlOut .= Xml::closeElement( 'tr' );
835834 // Project
836835 $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 ) );
839840 $htmlOut .= Xml::closeElement( 'tr' );
840841 // Languages
841842 $htmlOut .= Xml::openElement( 'tr' );
@@ -1256,6 +1257,21 @@
12571258 return null;
12581259 }
12591260 }
 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+ }
12601276
12611277 function getNoticeLanguages( $noticeName ) {
12621278 $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+}
29 function selectLanguages( selectAll ) {
310 var selectBox = document.getElementById('project_languages[]');
411 var firstSelect = selectBox.options.length - 1;

Follow-up revisions

RevisionCommit summaryAuthorDate
r76356more work towards multi-project selection - bug 20229kaldari23:57, 8 November 2010
r76358more work towards multi-project selection - bug 20229kaldari00:08, 9 November 2010
r76361finishing work towards multi-project selection - bug 20229kaldari00:39, 9 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68666updating mySQL set-up script for multi-language support (bug 20229), deleting...kaldari17:01, 28 June 2010
r76347work towards bug 20229kaldari23:02, 8 November 2010

Status & tagging log