r97273 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97272‎ | r97273 | r97274 >
Date:14:24, 16 September 2011
Author:yaron
Status:deferred
Tags:
Comment:
Improved display of lists of categories, and pages
Modified paths:
  • /trunk/extensions/PageSchemas/specials/PS_GeneratePages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php
@@ -25,14 +25,14 @@
2626 }
2727
2828 if ( $category == "") {
29 - // No category listed - show a list of links to all categories with a page
30 - // schema defined.
 29+ // No category listed - show a list of links to all
 30+ // categories with a page schema defined.
3131 $text = "";
32 - $cat_titles = PageSchemas::getCategoriesWithPSDefined();
33 - foreach( $cat_titles as $cat_text ) {
34 - $generatePagesPage = SpecialPage::getTitleFor( 'GeneratePages' );
35 - $url = $generatePagesPage->getFullURL() . '/' . $cat_text;
36 - $text .= '<a href="' . $url . '">' . $cat_text . '</a> <br /> ';
 32+ $categoryNames = PageSchemas::getCategoriesWithPSDefined();
 33+ $generatePagesPage = SpecialPage::getTitleFor( 'GeneratePages' );
 34+ foreach( $categoryNames as $categoryName ) {
 35+ $url = $generatePagesPage->getFullURL() . '/' . $categoryName;
 36+ $text .= '<a href="' . $url . '">' . $categoryName . '</a> <br /> ';
3737 }
3838 $wgOut->addHTML( $text );
3939 return true;
@@ -47,24 +47,22 @@
4848 return true;
4949 }
5050
51 - $generate_page_desc = wfMsg( 'ps-generatepages-desc' );
52 - $text = "<p>$generate_page_desc</p>\n";
53 - $text = '<form method="post"><input type="hidden" name="param" value="'.$category.'" /><br />' . "\n";
54 - //add code to generate a list of check-box for pages to be generated.
 51+ $text = Html::element( 'p', null, wfMsg( 'ps-generatepages-desc' ) ) . "\n";
 52+ $text .= '<form method="post"><input type="hidden" name="param" value="'.$category.'" />' . "\n";
 53+ // Display a list of checkboxes for pages to be generated.
5554 $pageList = array();
5655
57 - // This hook will return an array of strings, with each value as a title of
58 - // the page to be created.
 56+ // This hook will set an array of strings, with each value
 57+ // as a title of a page to be created.
5958 wfRunHooks( 'PageSchemasGetPageList', array( $pageSchemaObj, &$pageList ) );
 59+ $skin = $this->getSkin();
6060 foreach( $pageList as $page ){
61 - $pageURL = $page->getFullUrl();
6261 $pageName = PageSchemas::titleString( $page );
63 - $pageLink = Html::element( 'a', array( 'href' => $pageURL ), $pageName );
6462 $text .= Html::input( 'page[]', $pageName, 'checkbox', array( 'checked' => true ) );
65 - $text .= "\n" . $pageLink . "<br />\n";
 63+ $text .= "\n" . $skin->link( $page ) . "<br />\n";
6664 }
6765 $generate_page_text = wfMsg( 'generatepages' );
68 - $text .= '<br /> <input type="submit" value="'.$generate_page_text.'" /> <br /> <br /></form>';
 66+ $text .= '<br /> <input type="submit" value="'.$generate_page_text.'" /> </form>';
6967 $wgOut->addHTML( $text );
7068 return true;
7169 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r97689Follow-up to r97273 - re-added compatibility for MW 1.17yaron01:38, 21 September 2011

Status & tagging log