Index: trunk/extensions/SemanticForms/specials/SF_AddData.php |
— | — | @@ -132,11 +132,14 @@ |
133 | 133 | $sfgFormPrinter->formHTML($form_definition, $form_submitted, $page_is_source, $page_contents, $page_title, $page_name_formula); |
134 | 134 | if ($form_submitted) { |
135 | 135 | if ($page_name_formula != '') { |
136 | | - // append a namespace, if one was specified |
| 136 | + $target_name = $generated_page_name; |
| 137 | + // prepend a super-page, if one was specified |
| 138 | + if ($wgRequest->getCheck('super_page')) { |
| 139 | + $target_name = $wgRequest->getVal('super_page') . '/' . $target_name; |
| 140 | + } |
| 141 | + // prepend a namespace, if one was specified |
137 | 142 | if ($wgRequest->getCheck('namespace')) { |
138 | | - $target_name = $wgRequest->getVal('namespace') . ':' . $generated_page_name; |
139 | | - } else { |
140 | | - $target_name = $generated_page_name; |
| 143 | + $target_name = $wgRequest->getVal('namespace') . ':' . $target_name; |
141 | 144 | } |
142 | 145 | // replace "unique number" tag with one that |
143 | 146 | // won't get erased by the next line |
— | — | @@ -162,8 +165,13 @@ |
163 | 166 | $target_title = Title::newFromText(preg_replace('/{num.*}/', $title_number, $target_name)); |
164 | 167 | // if title number is blank, |
165 | 168 | // change it to 2; otherwise, |
166 | | - // increment it |
167 | | - $title_number = ($title_number == "") ? 2 : $title_number + 1; |
| 169 | + // increment it, and if necessary |
| 170 | + // pad it with leading 0s as well |
| 171 | + if ($title_number == "") { |
| 172 | + $title_number = 2; |
| 173 | + } else { |
| 174 | + $title_number = str_pad($title_number + 1, strlen($title_number), '0', STR_PAD_LEFT); |
| 175 | + } |
168 | 176 | } while ($target_title->exists()); |
169 | 177 | } else { |
170 | 178 | $target_title = Title::newFromText($target_name); |