Difference between revisions of "Issue:Mode=category loses letter headings when ordermethod=titlewithoutnamespace"

From FollowTheScore
Jump to: navigation, search
(Analysis)
(Analysis)
Line 55: Line 55:
  
 
=== Analysis ===
 
=== Analysis ===
In DPL::formatCategoryList, when ordermethod=titlewithoutnamespace, all entries in $aArticles_start_char[] contain the empty string. This is because $this->mArticles[$i]->mStartChar is empty. That's the problem.
+
In this situation, when ordermethod=titlewithoutnamespace, DPLArticle->mStartChar is not being set. This is happening because in DPLMain.php, formatCategoryList() says:
 
 
This is happening because in DPLMain.php, formatCategoryList() says:
 
  
 
<pre>
 
<pre>
Line 65: Line 63:
 
</pre>
 
</pre>
  
but $row->sortkey is ''not'' set, so mStartChar does not get set. I changed it to:
+
but $row->sortkey is ''not'' set. I changed it to
  
 
<pre>
 
<pre>
Line 75: Line 73:
 
</pre>
 
</pre>
  
and things seem to work. What do you think of this patch?
+
and things seem to work. What do you think of this patch?  It looks like mStartChar is unused in DPL, except for category mode, so this should be pretty safe...?
  
 
== Reply ==
 
== Reply ==

Revision as of 18:58, 10 December 2009

Description: mode=category should produce headings A, B, C, etc., but does not when ordermethod=titlewithoutnamespace
Extension / Version: DPL   /   1.8.8
Type / Status: Bug   /   open

Problem

MediaWiki 1.15.1.

This produces the headings A, B, C, etc., like a category page:

<dpl>
category = African Union member states
mode = category
ordermethod = title
</dpl>

Example:

C

N

S

This should produce A, B, C, etc., but does not:

<dpl>
category = African Union member states
mode = category
ordermethod = titlewithoutnamespace
</dpl>

Example:

C

N

S

I think the headings are empty or blank, not missing. If you have many items in your list, you will see continuation headings like "cont." instead of "A cont." So I'm guessing the headings are being rendered, but they are blank, so nothing shows up. Here is an example with "cont.":

Analysis

In this situation, when ordermethod=titlewithoutnamespace, DPLArticle->mStartChar is not being set. This is happening because in DPLMain.php, formatCategoryList() says:

if( isset($row->sortkey) ) {
 $dplArticle->mStartChar = $wgContLang->convert($wgContLang->firstChar($row->sortkey));
} 

but $row->sortkey is not set. I changed it to

if( isset($row->sortkey) ) {
 $dplArticle->mStartChar = $wgContLang->convert($wgContLang->firstChar($row->sortkey));
} else {
 $dplArticle->mStartChar = $wgContLang->convert($wgContLang->firstChar($row->page_title));
}

and things seem to work. What do you think of this patch? It looks like mStartChar is unused in DPL, except for category mode, so this should be pretty safe...?

Reply