r109211 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109210‎ | r109211 | r109212 >
Date:20:49, 17 January 2012
Author:kaldari
Status:ok
Tags:
Comment:
adding a form for no zip code
Modified paths:
  • /trunk/extensions/CongressLookup/SpecialCongressLookup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php
@@ -112,7 +112,6 @@
113113 }
114114 .sopaActionDiv {
115115 margin-bottom: 1em;
116 - margin-left: 1em;
117116 }
118117 </style>
119118 </head>
@@ -140,10 +139,12 @@
141140 </p>
142141 </div>
143142 <div id="contacts">
144 - <h4>Your Representatives:</h4>
 143+
145144 HTML;
146145 if ( $this->zip ) {
147146 $htmlOut .= $this->getCongressTables();
 147+ } else {
 148+ $htmlOut .= $this->getZipForm();
148149 }
149150
150151 // Output end of the page
@@ -156,13 +157,15 @@
157158
158159 /**
159160 * Get an HTML table of data for the user's congressional representatives
160 - * @return HTML for the table
 161+ * @return string HTML for the table
161162 */
162163 private function getCongressTables() {
163164 $myRepresentative = CongressLookupDB::getRepresentative( $this->zip );
164165 $mySenators = CongressLookupDB::getSenators( $this->zip );
165166
166167 $congressTable = '';
 168+
 169+ $congressTable .= Html::element( 'h4', array(), 'Your Representatives:' );
167170
168171 if ( $myRepresentative ) {
169172 $congressTable .= Html::openElement( 'table', array (
@@ -222,5 +225,58 @@
223226
224227 return $congressTable;
225228 }
226 -
 229+
 230+ /**
 231+ * Get HTML for a Zip Code form
 232+ * @return string HTML
 233+ */
 234+ private function getZipForm() {
 235+ $htmlOut = <<<HTML
 236+<h4>Contact your representatives</h4>
 237+<div class="sopaActionDiv">
 238+ <form action="" method="GET">
 239+ <label for="zip">Your zip code:</label>
 240+ <input type="text" maxlength="10" size="5" name="zip"/>
 241+ <input type="submit" value="Look up" name="submit"/>
 242+ </form>
 243+</div>
 244+HTML;
 245+ return $htmlOut;
 246+ }
 247+
 248+ /**
 249+ * Get HTML for social media links
 250+ * @return string HTML for social media links
 251+ */
 252+ private function getSocialMedia() {
 253+ $htmlOut = <<<HTML
 254+<div class="sopaActionDiv">
 255+ <div>
 256+ <div class="sopaSocial">
 257+ <a style="text-decoration: none;" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fexample.com%2F">
 258+ <img width="33" height="33" src="//upload.wikimedia.org/wikipedia/commons/2/2a/WP_SOPA_sm_icon_facebook_dedede.png">
 259+ </a>
 260+ <br/>
 261+ <a style="text-decoration: none;" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fexample.com%2F">Facebook</a>
 262+ </div>
 263+ <div class="sopaSocial">
 264+ <a style="text-decoration: none;" href="https://m.google.com/app/plus/x/?v=compose&content=Google%20Plus%20Post%20Here%20http%3A%2F%2Fexample.com%2F">
 265+ <img width="33" height="33" src="//upload.wikimedia.org/wikipedia/commons/0/08/WP_SOPA_sm_icon_gplus_dedede.png">
 266+ </a>
 267+ <br/>
 268+ <a style="text-decoration: none; color:" href="https://m.google.com/app/plus/x/?v=compose&content=Google%20Plus%20Post%20Here%20http%3A%2F%2Fexample.com%2F">Google+</a>
 269+ </div>
 270+ <div class="sopaSocial">
 271+ <a style="text-decoration: none;" href="https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ftest.wikipedia.org%2Fwiki%2FMain_Page%3Fbanner%3Dblackout&text=Tweet%20here%20%23WikipediaBlackout%20http%3A%2F%2Fexample.com%2F">
 272+ <img width="33" height="33" src="//upload.wikimedia.org/wikipedia/commons/4/45/WP_SOPA_sm_icon_twitter_dedede.png">
 273+ </a>
 274+ <br/>
 275+ <a style="text-decoration: none;" href="https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ftest.wikipedia.org%2Fwiki%2FMain_Page%3Fbanner%3Dblackout&text=Tweet%20here%20%23WikipediaBlackout%20http%3A%2F%2Fexample.com%2F">Twitter</a>
 276+ </div>
 277+ </div>
 278+ <div style="clear: both;"></div>
 279+</div>
 280+HTML;
 281+ return $htmlOut;
 282+ }
227283 }

Status & tagging log