Index: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php |
— | — | @@ -25,14 +25,14 @@ |
26 | 26 | } |
27 | 27 | |
28 | 28 | 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. |
31 | 31 | $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 /> '; |
37 | 37 | } |
38 | 38 | $wgOut->addHTML( $text ); |
39 | 39 | return true; |
— | — | @@ -47,24 +47,22 @@ |
48 | 48 | return true; |
49 | 49 | } |
50 | 50 | |
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. |
55 | 54 | $pageList = array(); |
56 | 55 | |
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. |
59 | 58 | wfRunHooks( 'PageSchemasGetPageList', array( $pageSchemaObj, &$pageList ) ); |
| 59 | + $skin = $this->getSkin(); |
60 | 60 | foreach( $pageList as $page ){ |
61 | | - $pageURL = $page->getFullUrl(); |
62 | 61 | $pageName = PageSchemas::titleString( $page ); |
63 | | - $pageLink = Html::element( 'a', array( 'href' => $pageURL ), $pageName ); |
64 | 62 | $text .= Html::input( 'page[]', $pageName, 'checkbox', array( 'checked' => true ) ); |
65 | | - $text .= "\n" . $pageLink . "<br />\n"; |
| 63 | + $text .= "\n" . $skin->link( $page ) . "<br />\n"; |
66 | 64 | } |
67 | 65 | $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>'; |
69 | 67 | $wgOut->addHTML( $text ); |
70 | 68 | return true; |
71 | 69 | } |