Index: trunk/extensions/PageSchemas/specials/GeneratePages.php |
— | — | @@ -18,9 +18,8 @@ |
19 | 19 | $generate_page_desc = wfMsg( 'ps-generate-pages-desc' ); |
20 | 20 | $param = $wgRequest->getText('param'); |
21 | 21 | $text_1 = '<p>All pages will be generated! </p>'; |
22 | | - $text_2 = '<p>'.$generate_page_desc.'</p> <form method="post"> <input type="hidden" name="param" value="'.$category.'" /><br /> <input type="submit" value="'.$generate_page_text.'" /> </form>'; |
23 | | - if ( $param != "" && $category != "" ) { |
24 | | - $this->generate_pages($param); |
| 22 | + if ( $param != "" && $category != "" ) { |
| 23 | + $this->generate_pages( $param, $_POST['page'] ); |
25 | 24 | $wgOut->addHTML($text_1); |
26 | 25 | }else { |
27 | 26 | if( $category == ""){ |
— | — | @@ -69,25 +68,30 @@ |
70 | 69 | 'pp_page' => $pageId, |
71 | 70 | 'pp_propname' => 'PageSchema' |
72 | 71 | ) |
73 | | - ); |
| 72 | + ); |
74 | 73 | //first row of the result set |
75 | 74 | $row = $dbr->fetchRow( $res ); |
76 | 75 | if( $row != null ){ |
| 76 | + $text_2 = '<p>'.$generate_page_desc.'</p> <form method="post"> <input type="hidden" name="param" value="'.$category.'" /><br /> '; |
| 77 | + //add code to generate a list of check-box for pages to be generated. |
| 78 | + $pageSchemaObj = new PSSchema( $category ); |
| 79 | + $pageList = array(); |
| 80 | + wfRunHooks( 'PageSchemasGetPageList', array( $pageSchemaObj, &$pageList )); //will return an array of string, with each value as a title of the page to be created. |
| 81 | + foreach( $pageList as $page ){ |
| 82 | + $text_2 .= '<input type="checkbox" name="page[]" value="'.$page.'" /> '.$page.' <br />'; |
| 83 | + } |
| 84 | + $text_2 .= '<br /> <input type="submit" value="'.$generate_page_text.'" /> <br /> <br /></form>'; |
77 | 85 | $wgOut->addHTML($text_2); |
78 | 86 | }else { |
79 | 87 | $text = "<p>Error: there is no page schema defined for that category in the wiki. </p>"; |
80 | 88 | $wgOut->addHTML( $text ); |
81 | | - } |
| 89 | + } |
82 | 90 | } |
83 | | - |
84 | | - } |
85 | | - } |
86 | | - |
87 | | - function generate_pages ( $categoryName ) { |
88 | | - global $wgRequest, $wgOut; |
| 91 | + } |
| 92 | + } |
| 93 | + function generate_pages ( $categoryName, $toGenPageList ) { |
| 94 | + global $wgRequest, $wgOut; |
89 | 95 | $pageSchema = new PSSchema( $categoryName ); |
90 | | - $pageSchema->generateAllPages(); |
91 | | - |
92 | | - |
93 | | - } |
94 | | -} |
\ No newline at end of file |
| 96 | + $pageSchema->generateAllPages( $toGenPageList ); |
| 97 | + } |
| 98 | +} |