r95819 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95818‎ | r95819 | r95820 >
Date:22:26, 30 August 2011
Author:yaron
Status:deferred
Tags:
Comment:
More cleanup
Modified paths:
  • /trunk/extensions/PageSchemas/specials/PS_GeneratePages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php
@@ -5,6 +5,7 @@
66 * @author Ankit Garg
77 */
88
 9+
910 class PSGeneratePages extends IncludableSpecialPage {
1011 function __construct() {
1112 parent::__construct( 'GeneratePages' );
@@ -15,9 +16,10 @@
1617
1718 $this->setHeaders();
1819 $param = $wgRequest->getText('param');
19 - if ( $param != "" && $category != "" ) {
20 - $this->generatePages( $param, $wgRequest->getValues( 'page' ) );
21 - $text = '<p>All pages will be generated! </p>';
 20+ if ( !empty( $param ) && !empty( $category ) ) {
 21+ // Generate the pages!
 22+ $this->generatePages( $param, $wgRequest->getArray( 'page' ) );
 23+ $text = Html::element( 'p', null, wfMsg( 'ps-generatepages-success' ) );
2224 $wgOut->addHTML( $text );
2325 return true;
2426 }
@@ -40,14 +42,14 @@
4143 // Check for a valid category, with a page schema defined.
4244 $pageSchemaObj = new PSSchema( $category );
4345 if ( !$pageSchemaObj->isPSDefined() ) {
44 - $text = "<p>Error: there is no page schema defined for that category in the wiki. </p>";
 46+ $text = Html::element( 'p', null, wfMsg( 'ps-generatepages-noschema' ) );
4547 $wgOut->addHTML( $text );
4648 return true;
4749 }
4850
4951 $generate_page_desc = wfMsg( 'ps-generatepages-desc' );
5052 $text = "<p>$generate_page_desc</p>\n";
51 - $text = '<form method="post"><input type="hidden" name="param" value="'.$category.'" /><br />';
 53+ $text = '<form method="post"><input type="hidden" name="param" value="'.$category.'" /><br />' . "\n";
5254 //add code to generate a list of check-box for pages to be generated.
5355 $pageList = array();
5456
@@ -58,9 +60,10 @@
5961 $pageURL = $page->getFullUrl();
6062 $pageName = PageSchemas::titleString( $page );
6163 $pageLink = Html::element( 'a', array( 'href' => $pageURL ), $pageName );
62 - $text .= '<input type="checkbox" name="page[]" value="' . $pageName . '" checked="checked" />' . $pageLink . ' <br />';
 64+ $text .= Html::input( 'page[]', $pageName, 'checkbox', array( 'checked' => true ) );
 65+ $text .= "\n" . $pageLink . "<br />\n";
6366 }
64 - $generate_page_text = wfMsg( 'ps-generatepages' );
 67+ $generate_page_text = wfMsg( 'generatepages' );
6568 $text .= '<br /> <input type="submit" value="'.$generate_page_text.'" /> <br /> <br /></form>';
6669 $wgOut->addHTML( $text );
6770 return true;

Status & tagging log