Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php |
— | — | @@ -120,6 +120,19 @@ |
121 | 121 | $wgOut->addHTML( $text ); |
122 | 122 | } |
123 | 123 | |
| 124 | + /** |
| 125 | + * Helper function - returns a URL that includes Special:FormEdit. |
| 126 | + */ |
| 127 | + static function getFormEditURL( $formName, $targetTitle) { |
| 128 | + $fe = SpecialPage::getPage( 'FormEdit' ); |
| 129 | + $targetName = SFUtils::titleURLString( $targetTitle ); |
| 130 | + // Special handling for forms whose name contains a slash. |
| 131 | + if ( strpos( $formName, '/' ) !== false ) { |
| 132 | + return $fe->getTitle()->getFullURL( array( 'form' => $formName, 'target' => $targetName ) ); |
| 133 | + } |
| 134 | + return $fe->getTitle()->getFullURL() . "/" . $formName . "/" . $targetName; |
| 135 | + } |
| 136 | + |
124 | 137 | function doRedirect( $form_name, $page_name, $params ) { |
125 | 138 | global $wgOut; |
126 | 139 | |
— | — | @@ -148,12 +161,10 @@ |
149 | 162 | if ( $form_name == $default_form_name ) { |
150 | 163 | $redirect_url = $page_title->getLocalURL( 'action=formedit' ); |
151 | 164 | } else { |
152 | | - $fe = SpecialPage::getPage( 'FormEdit' ); |
153 | | - $redirect_url = $fe->getTitle()->getFullURL() . "/" . $form_name . "/" . SFUtils::titleURLString( $page_title ); |
| 165 | + $redirect_url = self::getFormEditURL( $form_name, $page_title ); |
154 | 166 | } |
155 | 167 | } else { |
156 | | - $fe = SpecialPage::getPage( 'FormEdit' ); |
157 | | - $redirect_url = $fe->getTitle()->getFullURL() . "/" . $form_name . "/" . SFUtils::titleURLString( $page_title ); |
| 168 | + $redirect_url = self::getFormEditURL( $form_name, $page_title ); |
158 | 169 | // Of all the request values, send on to 'FormEdit' |
159 | 170 | // only 'preload' and specific form fields - we can |
160 | 171 | // identify the latter because they show up as arrays. |