Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php |
— | — | @@ -206,12 +206,12 @@ |
207 | 207 | $preview_page = $wgRequest->getCheck( 'wpPreview' ); |
208 | 208 | if ( $save_page || $preview_page ) { |
209 | 209 | // Validate form name |
210 | | - if ( $form->form_name == "" ) { |
| 210 | + if ( $form->mFormName == "" ) { |
211 | 211 | $form_name_error_str = wfMsg( 'sf_blank_error' ); |
212 | 212 | } else { |
213 | 213 | // Redirect to wiki interface |
214 | 214 | $wgOut->setArticleBodyOnly( true ); |
215 | | - $title = Title::makeTitleSafe( SF_NS_FORM, $form->form_name ); |
| 215 | + $title = Title::makeTitleSafe( SF_NS_FORM, $form->mFormName ); |
216 | 216 | $full_text = $form->createMarkup(); |
217 | 217 | $text = SFUtils::printRedirectForm( $title, $full_text, "", $save_page, $preview_page, false, false, false, null, null ); |
218 | 218 | $wgOut->addHTML( $text ); |
Index: trunk/extensions/SemanticForms/includes/SF_FormClasses.php |
— | — | @@ -13,30 +13,45 @@ |
14 | 14 | * @ingroup SF |
15 | 15 | */ |
16 | 16 | class SFForm { |
17 | | - var $form_name; |
18 | | - var $templates; |
| 17 | + var $mFormName = null; |
| 18 | + var $mTemplates = null; |
| 19 | + var $mPageNameFormula = null; |
| 20 | + var $mCreateTitle = null; |
| 21 | + var $mEditTitle = null; |
19 | 22 | |
20 | | - static function create( $form_name, $templates ) { |
| 23 | + static function create( $formName, $templates ) { |
21 | 24 | $form = new SFForm(); |
22 | | - $form->form_name = ucfirst( str_replace( '_', ' ', $form_name ) ); |
23 | | - $form->templates = $templates; |
| 25 | + $form->mFormName = ucfirst( str_replace( '_', ' ', $formName ) ); |
| 26 | + $form->mTemplates = $templates; |
24 | 27 | return $form; |
25 | 28 | } |
26 | 29 | |
| 30 | + function setPageNameFormula( $pageNameFormula ) { |
| 31 | + $this->mPageNameFormula = $pageNameFormula; |
| 32 | + } |
| 33 | + |
| 34 | + function setCreateTitle( $createTitle ) { |
| 35 | + $this->mCreateTitle = $createTitle; |
| 36 | + } |
| 37 | + |
| 38 | + function setEditTitle( $editTitle ) { |
| 39 | + $this->mEditTitle = $editTitle; |
| 40 | + } |
| 41 | + |
27 | 42 | function creationHTML() { |
28 | 43 | $text = ""; |
29 | | - foreach ( $this->templates as $i => $ft ) { |
| 44 | + foreach ( $this->mTemplates as $i => $ft ) { |
30 | 45 | $text .= $ft->creationHTML( $i ); |
31 | 46 | } |
32 | 47 | return $text; |
33 | 48 | } |
34 | 49 | |
35 | 50 | function createMarkup() { |
36 | | - $title = Title::makeTitle( SF_NS_FORM, $this->form_name ); |
| 51 | + $title = Title::makeTitle( SF_NS_FORM, $this->mFormName ); |
37 | 52 | $fs = SpecialPage::getPage( 'FormStart' ); |
38 | 53 | $form_start_url = SFUtils::titleURLString( $fs->getTitle() ) . "/" . $title->getPartialURL(); |
39 | | - $form_description = wfMsgForContent( 'sf_form_docu', $this->form_name, $form_start_url ); |
40 | | - $form_input = "{{#forminput:form=" . $this->form_name . "}}\n"; |
| 54 | + $form_description = wfMsgForContent( 'sf_form_docu', $this->mFormName, $form_start_url ); |
| 55 | + $form_input = "{{#forminput:form=" . $this->mFormName . "}}\n"; |
41 | 56 | $text = <<<END |
42 | 57 | <noinclude> |
43 | 58 | $form_description |
— | — | @@ -44,10 +59,26 @@ |
45 | 60 | |
46 | 61 | $form_input |
47 | 62 | </noinclude><includeonly> |
| 63 | + |
| 64 | +END; |
| 65 | + if ( !empty( $this->mPageNameFormula ) || !empty( $this->mCreateTitle ) || !empty( $this->mEditTitle ) ) { |
| 66 | + $text .= "{{{info"; |
| 67 | + if ( !empty( $this->mPageNameFormula ) ) { |
| 68 | + $text .= "|page name=" . $this->mPageNameFormula; |
| 69 | + } |
| 70 | + if ( !empty( $this->mCreateTitle ) ) { |
| 71 | + $text .= "|create title=" . $this->mCreateTitle; |
| 72 | + } |
| 73 | + if ( !empty( $this->mEditTitle ) ) { |
| 74 | + $text .= "|edit title=" . $this->mEditTitle; |
| 75 | + } |
| 76 | + $text .= "}}}\n"; |
| 77 | + } |
| 78 | + $text .= <<<END |
48 | 79 | <div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div> |
49 | 80 | |
50 | 81 | END; |
51 | | - foreach ( $this->templates as $template ) { |
| 82 | + foreach ( $this->mTemplates as $template ) { |
52 | 83 | $text .= $template->createMarkup() . "\n"; |
53 | 84 | } |
54 | 85 | $free_text_label = wfMsgForContent( 'sf_form_freetextlabel' ); |