Index: trunk/extensions/ContactPage/SpecialContact.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | | - $f = new EmailContactForm( $nu ); |
| 74 | + $f = new EmailContactForm( $nu, $par); |
75 | 75 | |
76 | 76 | if ( 'success' == $action ) { |
77 | 77 | wfDebug( __METHOD__ . ": success.\n" ); |
— | — | @@ -118,12 +118,43 @@ |
119 | 119 | /** |
120 | 120 | * @param User $target |
121 | 121 | */ |
122 | | - function __construct( $target ) { |
| 122 | + function __construct( $target, $par ) { |
123 | 123 | global $wgRequest, $wgUser; |
124 | 124 | |
| 125 | + $formType = $wgRequest->getText( 'type', $par ); |
| 126 | + |
| 127 | + # Check for type in [[Special:Contact/type]]: change pagetext and prefill form fields |
| 128 | + if ( $formType != '' ) { |
| 129 | + $message = 'contactpage-pagetext-' . $formType; |
| 130 | + $text = wfMsgExt( $message, 'parse' ); |
| 131 | + if ( !wfEmptyMsg( $message, $text ) ) { |
| 132 | + $this->formularText = $text; |
| 133 | + } else { |
| 134 | + $this->formularText = wfMsgExt( 'contactpage-pagetext', 'parse' ); |
| 135 | + } |
| 136 | + |
| 137 | + $message = 'contactpage-subject-' . $formType; |
| 138 | + $text = wfMsgForContentNoTrans( $message ); |
| 139 | + if ( !wfEmptyMsg( $message, $text ) ) { |
| 140 | + $this->subject = $wgRequest->getText( 'wpSubject', $text ); |
| 141 | + } else { |
| 142 | + $this->subject = $wgRequest->getText( 'wpSubject' ); |
| 143 | + } |
| 144 | + |
| 145 | + $message = 'contactpage-text-' . $formType; |
| 146 | + $text = wfMsgForContentNoTrans( $message ); |
| 147 | + if ( !wfEmptyMsg( $message, $text ) ) { |
| 148 | + $this->text = $wgRequest->getText( 'wpText', $text ); |
| 149 | + } else { |
| 150 | + $this->text = $wgRequest->getText( 'wpText' ); |
| 151 | + } |
| 152 | + } else { |
| 153 | + $this->formularText = wfMsgExt( 'contactpage-pagetext', 'parse' ); |
| 154 | + $this->text = $wgRequest->getText( 'wpText' ); |
| 155 | + $this->subject = $wgRequest->getText( 'wpSubject' ); |
| 156 | + } |
| 157 | + |
125 | 158 | $this->target = $target; |
126 | | - $this->text = $wgRequest->getText( 'wpText' ); |
127 | | - $this->subject = $wgRequest->getText( 'wpSubject' ); |
128 | 159 | $this->cc_me = $wgRequest->getBool( 'wpCCMe' ); |
129 | 160 | $this->includeIP = $wgRequest->getBool( 'wpIncludeIP' ); |
130 | 161 | |
— | — | @@ -188,7 +219,7 @@ |
189 | 220 | #TODO: show captcha |
190 | 221 | |
191 | 222 | $wgOut->setPageTitle( wfMsg( 'contactpage-title' ) ); |
192 | | - $wgOut->addWikiMsg( 'contactpage-pagetext' ); |
| 223 | + $wgOut->addHTML( $this->formularText ); |
193 | 224 | |
194 | 225 | if ( $this->subject === '' ) { |
195 | 226 | $this->subject = wfMsgForContent( 'contactpage-defsubject' ); |
Index: trunk/extensions/ContactPage/README |
— | — | @@ -51,3 +51,18 @@ |
52 | 52 | |
53 | 53 | $wgCaptchaTriggers['contactpage'] = true; |
54 | 54 | |
| 55 | +== Costumization == |
| 56 | + |
| 57 | +[[Special:Contact]] calls the default formular. |
| 58 | +Pagetext: [[MediaWiki:contactpage-pagetext]] |
| 59 | +Subject: prefilled with text from [[MediaWiki:Contactpage-defsubject]] |
| 60 | +E-mail body: empty. |
| 61 | + |
| 62 | +[[Special:Contact/typename]] calls the contact page with a customized pagetext and |
| 63 | +prefilled form fields: |
| 64 | +Pagetext: [[MediaWiki:contactpage-pagetext-typename]] |
| 65 | +Subject: prefilled with text from [[MediaWiki:Contactpage-subject-typename]] |
| 66 | +E-mail body: prefilled with text from [[MediaWiki:Contactpage-text-typename]] |
| 67 | + |
| 68 | +If a customized message does not exist the default message is shown. |
| 69 | + |