Index: trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php |
— | — | @@ -33,8 +33,10 @@ |
34 | 34 | /** |
35 | 35 | * Returns an HTML table containing data from a given two dimensional array. |
36 | 36 | * |
37 | | - * @param $headings Array: List of rows, each a list of columns (values will be escaped) |
38 | | - * @param $rows Array: List of rows, each a list of columns (values will not be escaped) |
| 37 | + * @param $headings Array: List of rows, each a list of column data (values will be escaped) |
| 38 | + * @param $rows Array: List of rows, each a list of either calss/column data pairs (values will |
| 39 | + * be escaped), or arrays containing attr, text and html fields, used to set attributes, text or |
| 40 | + * HTML content of the cell |
39 | 41 | * @param $attribs Array: List of HTML attributes to apply to the table |
40 | 42 | * @return String: HTML table code |
41 | 43 | */ |
— | — | @@ -61,7 +63,20 @@ |
62 | 64 | foreach ( $row as $class => $column ) { |
63 | 65 | $attr = is_string( $class ) |
64 | 66 | ? array( 'class' => 'articleFeedback-table-column-' . $class ) : array(); |
65 | | - $table .= Html::rawElement( 'td', $attr, $column ); |
| 67 | + if ( is_array( $column ) ) { |
| 68 | + if ( isset( $column['attr'] ) ) { |
| 69 | + $attr = array_merge( $attr, $column['attr'] ); |
| 70 | + } |
| 71 | + if ( isset( $column['text'] ) ) { |
| 72 | + $table .= Html::element( 'td', $attr, $column['text'] ); |
| 73 | + } else if ( isset( $column['html'] ) ) { |
| 74 | + $table .= Html::rawElement( 'td', $attr, $column['html'] ); |
| 75 | + } else { |
| 76 | + $table .= Html::element( 'td', $attr ); |
| 77 | + } |
| 78 | + } else { |
| 79 | + $table .= Html::rawElement( 'td', $attr, $column ); |
| 80 | + } |
66 | 81 | } |
67 | 82 | $table .= Html::closeElement( 'tr' ); |
68 | 83 | } |
— | — | @@ -141,13 +156,18 @@ |
142 | 157 | $row = array(); |
143 | 158 | $row['page'] = $page['page']; |
144 | 159 | foreach ( $wgArticleFeedbackRatings as $category ) { |
145 | | - $row[] = in_array( $category, $page['categories'] ) |
146 | | - ? Html::element( |
147 | | - 'span', array( 'class' => 'articleFeedback-table-cell-bad' ), 0 |
148 | | - ) |
149 | | - : Html::element( |
150 | | - 'span', array( 'class' => 'articleFeedback-table-cell-good' ), 1 |
151 | | - ); |
| 160 | + $row[] = array( |
| 161 | + 'attr' => in_array( $category, $page['categories'] ) |
| 162 | + ? array( |
| 163 | + 'class' => 'articleFeedback-table-cell-bad', |
| 164 | + 'data-sort-value' => 0 |
| 165 | + ) |
| 166 | + : array( |
| 167 | + 'class' => 'articleFeedback-table-cell-good', |
| 168 | + 'data-sort-value' => 1 |
| 169 | + ), |
| 170 | + 'html' => ' ' |
| 171 | + ); |
152 | 172 | } |
153 | 173 | $rows[] = $row; |
154 | 174 | } |
— | — | @@ -228,8 +248,20 @@ |
229 | 249 | 'categories' => array( 1, 4 ), |
230 | 250 | ), |
231 | 251 | array( |
232 | | - 'page' => 'Test Article', |
| 252 | + 'page' => 'Test Article 1', |
233 | 253 | 'categories' => array( 1, 3 ), |
| 254 | + ), |
| 255 | + array( |
| 256 | + 'page' => 'Test Article 2', |
| 257 | + 'categories' => array( 2, 3 ), |
| 258 | + ), |
| 259 | + array( |
| 260 | + 'page' => 'Test Article 3', |
| 261 | + 'categories' => array( 3, 4 ), |
| 262 | + ), |
| 263 | + array( |
| 264 | + 'page' => 'Test Article 4', |
| 265 | + 'categories' => array( 1, 2 ), |
234 | 266 | ) |
235 | 267 | ); |
236 | 268 | } |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.dashboard.css |
— | — | @@ -32,13 +32,9 @@ |
33 | 33 | } |
34 | 34 | |
35 | 35 | .articleFeedback-table-cell-bad { |
36 | | - display: block; |
37 | 36 | background-color: #ffcc99; |
38 | | - color: #ffcc99; |
39 | 37 | } |
40 | 38 | |
41 | 39 | .articleFeedback-table-cell-good { |
42 | | - display: block; |
43 | 40 | background-color: #99ff99; |
44 | | - color: #99ff99; |
45 | 41 | } |