diff --git a/classes/Member.php b/classes/Member.php index ea9c5796ce..42a370effd 100644 --- a/classes/Member.php +++ b/classes/Member.php @@ -35,6 +35,7 @@ public function isDead() { HOUSE_TYPE_LORDS, HOUSE_TYPE_SCOTLAND, HOUSE_TYPE_NI, + HOUSE_TYPE_WALES, HOUSE_TYPE_LONDON_ASSEMBLY, ); @@ -430,6 +431,8 @@ public function getEnterLeaveStrings() { $output[] = $this->left_house_line(HOUSE_TYPE_NI, 'Assembly'); $output[] = $this->entered_house_line(HOUSE_TYPE_SCOTLAND, 'Scottish Parliament'); $output[] = $this->left_house_line(HOUSE_TYPE_SCOTLAND, 'Scottish Parliament'); + $output[] = $this->entered_house_line(HOUSE_TYPE_WALES, 'Welsh Parliament'); + $output[] = $this->left_house_line(HOUSE_TYPE_WALES, 'Welsh Parliament'); $output[] = $this->entered_house_line(HOUSE_TYPE_LONDON_ASSEMBLY, 'London Assembly'); $output[] = $this->left_house_line(HOUSE_TYPE_LONDON_ASSEMBLY, 'London Assembly'); @@ -584,6 +587,9 @@ public static function getRepNameForHouse($house) { case HOUSE_TYPE_SCOTLAND: $name = 'MSP'; break; + case HOUSE_TYPE_WALES: + $name = 'MS'; + break; case HOUSE_TYPE_LONDON_ASSEMBLY: $name = 'London Assembly Member'; break; diff --git a/classes/People/MSs.php b/classes/People/MSs.php new file mode 100644 index 0000000000..f7afba5a10 --- /dev/null +++ b/classes/People/MSs.php @@ -0,0 +1,20 @@ +data['meta_keywords']) { $this->data['meta_keywords'] .= ', '; } - $this->data['meta_keywords'] .= 'Hansard, Official Report, Parliament, government, House of Commons, House of Lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, Scottish Parliament, Northern Ireland Assembly, MSP, MLA, MSPs, MLAs, London Assembly Members'; + $this->data['meta_keywords'] .= 'Hansard, Official Report, Parliament, government, House of Commons, House of Lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, Scottish Parliament, Northern Ireland Assembly, MSP, MLA, MSPs, MLAs, London Assembly Members, MS, MSs, Welsh Parliament, Senedd Cymru, Senedd, Member of the Senedd'; } $this->data['meta_description'] = "Making it easy to keep an eye on the UK’s parliaments. Discover who represents you, how they’ve voted and what they’ve said in debates."; @@ -278,7 +278,7 @@ private function get_top_and_bottom_links() { array('hansard', 'mps', 'peers', 'alldebatesfront', 'wranswmsfront', 'pbc_front', 'divisions_recent', 'calendar_summary'), array('sp_home', 'spoverview', 'msps', 'spdebatesfront', 'spwransfront'), array('ni_home', 'nioverview', 'mlas'), - array('wales_home'), + array('wales_home', 'mss'), array('london_home', 'lmqsfront', 'london-assembly-members'), ); diff --git a/classes/Utility/House.php b/classes/Utility/House.php index b008712504..b7468b6bdc 100644 --- a/classes/Utility/House.php +++ b/classes/Utility/House.php @@ -39,6 +39,10 @@ public static function house_to_members($house) { 'singular' => 'MSP', 'plural' => 'MSPs' ), + HOUSE_TYPE_WALES => array( + 'singular' => 'MS', + 'plural' => 'MSs' + ), HOUSE_TYPE_LONDON_ASSEMBLY => array( 'singular' => 'Member of the London Assembly', 'plural' => 'Members of the London Assembly' @@ -71,6 +75,13 @@ public static function getCountryDetails($house) { 'cons_type' => 'SPC', 'assembly_name' => 'Scottish Parliament', ), + HOUSE_TYPE_WALES => array ( + 'country' => 'WALES', + 'assembly' => 'wales', + 'location' => '– in the Senedd', + 'cons_type' => 'WAC', + 'assembly_name' => 'Welsh Parliament', + ), HOUSE_TYPE_LORDS => array ( 'country' => 'UK', 'assembly' => 'uk-lords', @@ -105,6 +116,8 @@ public static function majorToHouse($major) { 7 => array(HOUSE_TYPE_SCOTLAND), 8 => array(HOUSE_TYPE_SCOTLAND), 9 => array(HOUSE_TYPE_LONDON_ASSEMBLY), + 10 => array(HOUSE_TYPE_WALES), + 11 => array(HOUSE_TYPE_WALES), 101 => array(HOUSE_TYPE_LORDS), ); diff --git a/conf/httpd.conf b/conf/httpd.conf index 840ed77057..434e90fbb4 100644 --- a/conf/httpd.conf +++ b/conf/httpd.conf @@ -33,7 +33,7 @@ RewriteRule ^/mps/(c4|c4x)/$ /mps/ [R] RewriteRule ^/mp/(c4|c4x)/([^/]+)/([^/]+)$ /mp/$2/$3 [R] # List of rep pages -RewriteRule ^/(msp|mla|peer|london-assembly-member)s/$ /mps/index.php?representative_type=$1 [QSA] +RewriteRule ^/(msp|mla|ms|peer|london-assembly-member)s/$ /mps/index.php?representative_type=$1 [QSA] # Section pages RewriteRule ^/(debates|whall|wrans|wms|lords|ni|sp|spwrans|pbc|london)$ /$1/ [L,R=temporary] @@ -62,10 +62,10 @@ RewriteRule ^/api/docs/?$ /api/index.php?docs=1 RewriteRule ^/api/docs/(.*)$ /api/index.php?docs=1&method=$1 [QSA] # Other people types -RewriteRule ^/(peer|royal|mla|msp|london-assembly-member)/$ /mp/index.php?representative_type=$1 [QSA] +RewriteRule ^/(peer|royal|mla|msp|ms|london-assembly-member)/$ /mp/index.php?representative_type=$1 [QSA] # Inherited the title in 2003 RewriteRule ^/peer/viscount_cranborne /peer/marquess_of_salisbury [R=permanent] -RewriteRule ^/(peer|royal|mla|msp|london-assembly-member)/(.+) /mp/$2?representative_type=$1 [QSA] +RewriteRule ^/(peer|royal|mla|msp|ms|london-assembly-member)/(.+) /mp/$2?representative_type=$1 [QSA] # Calendar RewriteRule ^/calendar/([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])$ /calendar/index.php?d=$1 diff --git a/scripts/load-people b/scripts/load-people index 9933d9d1dd..07242bb60b 100755 --- a/scripts/load-people +++ b/scripts/load-people @@ -31,6 +31,7 @@ my %slug_to_house_id = ( 'house-of-lords' => 2, 'northern-ireland-assembly' => 3, 'scottish-parliament' => 4, + 'welsh-parliament' => 5, 'london-assembly' => 6, ); diff --git a/www/docs/api/api_getMS.php b/www/docs/api/api_getMS.php new file mode 100644 index 0000000000..5d254a7272 --- /dev/null +++ b/www/docs/api/api_getMS.php @@ -0,0 +1,45 @@ + +
Fetch a particular MS.
+ +<twfy> + </twfy> ++ + +
Fetch a list of MSs.
+ +a:646:{ + i:0; a:5:{ + s:9:"member_id"; s:4:"1368"; + s:9:"person_id"; s:5:"10900"; + s:4:"name"; s:13:"Hywel Francis"; + s:5:"party"; s:6:"Labour"; + s:12:"constituency"; s:8:"Aberavon"; + } + i:1; ... ++ +constituency(); } +// Enhance title if this is a member of Welsh Parliament +if ($MEMBER->house(HOUSE_TYPE_WALES)) { + if ($MEMBER->house(HOUSE_TYPE_COMMONS) || $MEMBER->house(HOUSE_TYPE_LORDS)) { + $desc = str_replace('Parliament', 'the UK and Welsh Parliaments', $desc); + } else { + $desc = str_replace('Parliament', 'the Welsh Parliament', $desc); + } + $desc = str_replace(', and get email alerts on their activity', '', $desc); + if (!$MEMBER->current_member(HOUSE_TYPE_WALES)) { + $title .= ', former'; + } + $title .= ' MS, '.$MEMBER->constituency(); +} + $known_for = ''; $current_offices_ignoring_committees = $MEMBER->offices('current', TRUE); if (count($current_offices_ignoring_committees) > 0) { @@ -539,6 +556,8 @@ function get_regional_by_user_postcode($pc, $page) { $this_page = "your$page"; if ($page == 'msp' && \MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsScottish($pc)) { regional_list($pc, 'SPC', $page); + } elseif ($page == 'ms' && \MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsWelsh($pc)) { + regional_list($pc, 'WAC', $page); } elseif ($page == 'mla' && \MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsNi($pc)) { regional_list($pc, 'NIE', $page); } else { @@ -684,7 +703,7 @@ function person_summary_description ($MEMBER) { $desc .= $last['from'] . ' '; } } - if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) { + if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND || $house==HOUSE_TYPE_WALES) { $desc .= ' '; if ($house==HOUSE_TYPE_COMMONS) { $desc .= 'MP'; @@ -695,6 +714,9 @@ function person_summary_description ($MEMBER) { if ($house==HOUSE_TYPE_SCOTLAND) { $desc .= 'MSP'; } + if ($house==HOUSE_TYPE_WALES) { + $desc .= 'MS'; + } if ($party_br) { $desc .= " ($party_br)"; } @@ -984,7 +1006,7 @@ function regional_list($pc, $area_type, $rep_type) { WHERE constituency IN ('" . join("','", $a) . "') AND member.person_id = pn.person_id AND pn.type = 'name' AND pn.end_date = (SELECT MAX(end_date) FROM person_names WHERE person_names.person_id = member.person_id)"; - $q = $db->query($query_base . " AND left_reason = 'still_in_office' AND house in (" . HOUSE_TYPE_NI . "," . HOUSE_TYPE_SCOTLAND . ")"); + $q = $db->query($query_base . " AND left_reason = 'still_in_office' AND house in (" . HOUSE_TYPE_NI . "," . HOUSE_TYPE_SCOTLAND . "," . HOUSE_TYPE_WALES . ")"); $current = true; if (!$q->rows() && ($dissolution = MySociety\TheyWorkForYou\Dissolution::db())) { $current = false; @@ -1005,6 +1027,12 @@ function regional_list($pc, $area_type, $rep_type) { } elseif ($cons == $constituencies['SPE']) { $mreg[] = $row; } + } elseif ($house == HOUSE_TYPE_WALES) { + if ($cons == $constituencies['WAC']) { + $mcon = $row; + } elseif ($cons == $constituencies['WAE']) { + $mreg[] = $row; + } } else { throw new MySociety\TheyWorkForYou\MemberException('Odd result returned!' . $house); } @@ -1021,6 +1049,18 @@ function regional_list($pc, $area_type, $rep_type) { $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . ', MSP for ' . $mcon['constituency']; $data['members_statement'] .= '.
Your ' . $constituencies['SPE'] . ' region MSPs were:
'; } + } elseif ($rep_type == 'ms') { + if ($current) { + $data['members_statement'] = 'You have one constituency MS (Member of the Senedd) and multiple region MSs.
'; + $data['members_statement'] .= 'Your constituency MS is '; + $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . ', MS for ' . $mcon['constituency']; + $data['members_statement'] .= '.
Your ' . $constituencies['WAE'] . ' region MSs are:
'; + } else { + $data['members_statement'] = 'You had one constituency MS (Member of the Senedd) and multiple region MSs.
'; + $data['members_statement'] .= 'Your constituency MS was '; + $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . ', MS for ' . $mcon['constituency']; + $data['members_statement'] .= '.
Your ' . $constituencies['WAE'] . ' region MSs were:
'; + } } else { if ($current) { $data['members_statement'] = 'You have multiple MLAs (Members of the Legislative Assembly) who represent you in ' . $constituencies['NIE'] . '. They are:
'; diff --git a/www/docs/mps/index.php b/www/docs/mps/index.php index 96dff30c14..3b400368ed 100644 --- a/www/docs/mps/index.php +++ b/www/docs/mps/index.php @@ -12,6 +12,9 @@ case 'msp': $people = new MySociety\TheyWorkForYou\People\MSPs(); break; + case 'ms': + $people = new MySociety\TheyWorkForYou\People\MSs(); + break; case 'london-assembly-member': $people = new MySociety\TheyWorkForYou\People\LondonAssemblyMembers(); break; diff --git a/www/includes/easyparliament/hansardlist.php b/www/includes/easyparliament/hansardlist.php index 9b3d93d9b5..bb2869423c 100644 --- a/www/includes/easyparliament/hansardlist.php +++ b/www/includes/easyparliament/hansardlist.php @@ -2193,6 +2193,8 @@ private function _get_speaker_url($house) { $URL = new \MySociety\TheyWorkForYou\Url('mla'); } elseif ($house == HOUSE_TYPE_SCOTLAND) { $URL = new \MySociety\TheyWorkForYou\Url('msp'); + } elseif ($house == HOUSE_TYPE_WALES) { + $URL = new \MySociety\TheyWorkForYou\Url('ms'); } elseif ($house == HOUSE_TYPE_ROYAL) { $URL = new \MySociety\TheyWorkForYou\Url('royal'); } diff --git a/www/includes/easyparliament/member.php b/www/includes/easyparliament/member.php index 5cba011ca6..81c44ddf39 100644 --- a/www/includes/easyparliament/member.php +++ b/www/includes/easyparliament/member.php @@ -30,6 +30,7 @@ class MEMBER { 2 => 'House of Lords', 3 => 'Northern Ireland Assembly', 4 => 'Scottish Parliament', + 5 => 'Senedd', 6 => 'London Assembly', ); @@ -84,6 +85,7 @@ private function isHigherPriorityHouse(int $house) if (! (bool) $this->house_disp) { if ($house == HOUSE_TYPE_LONDON_ASSEMBLY # London Assembly || $house == HOUSE_TYPE_SCOTLAND # MSPs and + || $house == HOUSE_TYPE_WALES # MSs and || $house == HOUSE_TYPE_NI # MLAs have lowest priority || $house == HOUSE_TYPE_COMMONS # MPs ) { @@ -359,6 +361,8 @@ public function name_to_person_id($name, $const='') { $params[':house'] = HOUSE_TYPE_LORDS; } elseif ($this_page == 'msp') { $params[':house'] = HOUSE_TYPE_SCOTLAND; + } elseif ($this_page == 'ms') { + $params[':house'] = HOUSE_TYPE_WALES; } elseif ($this_page == 'mla') { $params[':house'] = HOUSE_TYPE_NI; } elseif ($this_page == 'royal') { @@ -523,7 +527,7 @@ public function given_name() { return $this->given_name; } public function family_name() { return $this->family_name; } public function full_name($no_mp_title = false) { $title = $this->title; - if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND)) { + if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND || $this->house_disp==HOUSE_TYPE_WALES)) { $title = ''; } return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname); @@ -665,6 +669,10 @@ public function url($absolute = false) { $URL = new \MySociety\TheyWorkForYou\Url('msp'); break; + case HOUSE_TYPE_WALES: + $URL = new \MySociety\TheyWorkForYou\Url('ms'); + break; + case HOUSE_TYPE_LONDON_ASSEMBLY: $URL = new \MySociety\TheyWorkForYou\Url('london-assembly-member'); break; diff --git a/www/includes/easyparliament/metadata.php b/www/includes/easyparliament/metadata.php index d6995d7b89..5b41b660f7 100644 --- a/www/includes/easyparliament/metadata.php +++ b/www/includes/easyparliament/metadata.php @@ -1056,6 +1056,20 @@ 'url' => 'wales/', 'parent' => 'wales_home', ), + 'mss' => array ( + 'parent' => 'wales_home', + 'menu' => array ( + 'text' => 'MSs', + 'title' => "List of Members of the Senedd (MSs)" + ), + 'title' => '', + 'url' => 'mss/' + ), + 'ms' => array ( + 'parent' => 'mss', + 'title' => 'Find your MS', + 'url' => 'ms/' + ), /* Westminster Hall */ 'whall' => array ( diff --git a/www/includes/easyparliament/templates/html/search/by-person.php b/www/includes/easyparliament/templates/html/search/by-person.php index c9379852a1..6ae1ae27aa 100644 --- a/www/includes/easyparliament/templates/html/search/by-person.php +++ b/www/includes/easyparliament/templates/html/search/by-person.php @@ -19,6 +19,8 @@ No results for Peers only No results for MSPs only + + No results for MSs only No results for MLAs only @@ -69,6 +71,12 @@ MSPs only | + + MSs only + + MSs only + + | MLAs only