r63469 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63468‎ | r63469 | r63470 >
Date:16:13, 9 March 2010
Author:yaron
Status:deferred (Comments)
Tags:
Comment:
Got rid of HTML-encoding for text in redirect form; improved sorting of pages in getAllPagesForCategory() and getAllPagesForConcept()
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.inc
@@ -76,7 +76,7 @@
7777 <p style="position: absolute; left: 45%; top: 45%;"><img src="$sfgScriptPath/skins/loading.gif" /></p>
7878
7979 END;
80 - $form_body = ' ' . Xml::element('input', array('type' => 'hidden', 'name' => 'wpTextbox1', 'id' => 'wpTextbox1', 'value' => $page_contents), null) . "\n";
 80+ $form_body = ' ' . Xml::tags('input', array('type' => 'hidden', 'name' => 'wpTextbox1', 'id' => 'wpTextbox1', 'value' => $page_contents), null) . "\n";
8181 $form_body .= ' ' . Xml::element('input', array('type' => 'hidden', 'name' => 'wpSummary', 'value' => $edit_summary), null) . "\n";
8282 $form_body .= ' ' . Xml::element('input', array('type' => 'hidden', 'name' => 'wpStarttime', 'value' => $start_time), null) . "\n";
8383 $form_body .= ' ' . Xml::element('input', array('type' => 'hidden', 'name' => 'wpEdittime', 'value' => $edit_time), null) . "\n";
@@ -245,7 +245,7 @@
246246 global $sfgMaxAutocompleteValues;
247247
248248 $db = wfGetDB( DB_SLAVE );
249 - $fname = "SFUtils;:getAllPagesForCategory";
 249+ $fname = "SFUtils::getAllPagesForCategory";
250250 $top_category = str_replace(' ', '_', $top_category);
251251 $categories = array($top_category);
252252 $checkcategories = array($top_category);
@@ -265,7 +265,8 @@
266266 array('categorylinks', 'page'),
267267 array('page_title', 'page_namespace'),
268268 array('cl_from = page_id', $conditions),
269 - $fname);
 269+ $fname,
 270+ 'SORT BY cl_sortkey');
270271 if ($res) {
271272 while ($res && $row = $db->fetchRow($res)) {
272273 if (array_key_exists('page_title', $row)) {
@@ -293,14 +294,12 @@
294295 }
295296 }
296297 if (count($newcategories) == 0) {
297 - sort($pages);
298298 return $pages;
299299 } else {
300300 $categories = array_merge($categories, $newcategories);
301301 }
302302 $checkcategories = array_diff($newcategories, array());
303303 }
304 - sort($pages);
305304 return $pages;
306305 }
307306
@@ -330,6 +329,7 @@
331330 while ($res = $query_result->getNext()) {
332331 $pages[] = $res[0]->getNextText(SMW_OUTPUT_WIKI);
333332 }
 333+ sort($pages);
334334 return $pages;
335335 }
336336

Comments

#Comment by Nikerabbit (talk | contribs)   17:44, 9 March 2010

Since input is contentless tag, I don't see how changing from Xml::element to Xml::tags changes anything. Also, $fname can be replaced with __METHOD__. There is also Xml::hidden().

#Comment by Yaron K. (talk | contribs)   18:21, 9 March 2010

Thanks; I incorporated most of these suggestions in r63479.

Status & tagging log