Index: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | * @author Ankit Garg |
7 | 7 | */ |
8 | 8 | |
| 9 | + |
9 | 10 | class PSGeneratePages extends IncludableSpecialPage { |
10 | 11 | function __construct() { |
11 | 12 | parent::__construct( 'GeneratePages' ); |
— | — | @@ -15,9 +16,10 @@ |
16 | 17 | |
17 | 18 | $this->setHeaders(); |
18 | 19 | $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' ) ); |
22 | 24 | $wgOut->addHTML( $text ); |
23 | 25 | return true; |
24 | 26 | } |
— | — | @@ -40,14 +42,14 @@ |
41 | 43 | // Check for a valid category, with a page schema defined. |
42 | 44 | $pageSchemaObj = new PSSchema( $category ); |
43 | 45 | 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' ) ); |
45 | 47 | $wgOut->addHTML( $text ); |
46 | 48 | return true; |
47 | 49 | } |
48 | 50 | |
49 | 51 | $generate_page_desc = wfMsg( 'ps-generatepages-desc' ); |
50 | 52 | $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"; |
52 | 54 | //add code to generate a list of check-box for pages to be generated. |
53 | 55 | $pageList = array(); |
54 | 56 | |
— | — | @@ -58,9 +60,10 @@ |
59 | 61 | $pageURL = $page->getFullUrl(); |
60 | 62 | $pageName = PageSchemas::titleString( $page ); |
61 | 63 | $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"; |
63 | 66 | } |
64 | | - $generate_page_text = wfMsg( 'ps-generatepages' ); |
| 67 | + $generate_page_text = wfMsg( 'generatepages' ); |
65 | 68 | $text .= '<br /> <input type="submit" value="'.$generate_page_text.'" /> <br /> <br /></form>'; |
66 | 69 | $wgOut->addHTML( $text ); |
67 | 70 | return true; |