Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.searchResult/ext.articleCreation.searchResult.js |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +(function($,mw) { |
| 3 | + var newTitle = 'Special:ArticleCreationLanding' + '/' + |
| 4 | + encodeURIComponent(mw.config.get('acSearch')); |
| 5 | + var landingURL = mw.config.get('wgArticlePath').replace( '$1', newTitle ); |
| 6 | + // change the link to point to the new special page |
| 7 | + $("div.searchresults") |
| 8 | + .find('a[href*="action=edit"]') |
| 9 | + .attr( 'href', landingURL ); |
| 10 | +})( jQuery, window.mediaWiki ); |
Property changes on: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.searchResult/ext.articleCreation.searchResult.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php |
— | — | @@ -28,6 +28,7 @@ |
29 | 29 | $wgHooks['BeforeDisplayNoArticleText'][] = 'ArticleCreationHooks::BeforeDisplayNoArticleText'; |
30 | 30 | $wgHooks['BeforeWelcomeCreation'][] = 'ArticleCreationHooks::BeforeWelcomeCreation'; |
31 | 31 | $wgHooks['AlternateEdit'][] = 'ArticleCreationHooks::AlternateEdit'; |
| 32 | +$wgHooks['SpecialSearchCreateLink'][] = 'ArticleCreationHooks::SpecialSearchCreateLink'; |
32 | 33 | |
33 | 34 | $wgHooks['ResourceLoaderGetConfigVars'][] = 'ArticleCreationHooks::resourceLoaderGetConfigVars'; |
34 | 35 | |
— | — | @@ -44,6 +45,10 @@ |
45 | 46 | 'scripts' => 'ext.articleCreation.init/ext.articleCreation.init.js', |
46 | 47 | ); |
47 | 48 | |
| 49 | +$wgResourceModules['ext.articleCreation.searchResult'] = $acResourceTemplate + array( |
| 50 | + 'scripts' => 'ext.articleCreation.searchResult/ext.articleCreation.searchResult.js', |
| 51 | +); |
| 52 | + |
48 | 53 | $wgResourceModules['ext.articleCreation.core'] = $acResourceTemplate + array ( |
49 | 54 | 'styles' => 'ext.articleCreation.core/ext.articleCreation.core.css', |
50 | 55 | 'scripts' => 'ext.articleCreation.core/ext.articleCreation.core.js', |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.hooks.php |
— | — | @@ -78,4 +78,26 @@ |
79 | 79 | return true; |
80 | 80 | } |
81 | 81 | |
| 82 | + public static function configSearchTitle( &$vars ) { |
| 83 | + global $wgRequest; |
| 84 | + |
| 85 | + $vars['acSearch'] = $wgRequest->getVal( 'search' ); |
| 86 | + |
| 87 | + return true; |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Alter 'Create' Link behavior in search result page |
| 92 | + */ |
| 93 | + public static function SpecialSearchCreateLink( $title, &$params ) { |
| 94 | + global $wgOut, $wgHooks; |
| 95 | + |
| 96 | + if ( ArticleCreationUtil::isEnabled() ) { |
| 97 | + $wgHooks['MakeGlobalVariablesScript'][] = 'ArticleCreationHooks::configSearchTitle'; |
| 98 | + $wgOut->addModules( array( 'ext.articleCreation.searchResult' ) ); |
| 99 | + } |
| 100 | + |
| 101 | + return true; |
| 102 | + } |
| 103 | + |
82 | 104 | } |