Index: trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationUtil.php |
— | — | @@ -66,7 +66,19 @@ |
67 | 67 | |
68 | 68 | self::clickTracking( $event, Title::newFromText( $par ) ); |
69 | 69 | } |
| 70 | + |
| 71 | + /** |
| 72 | + * Track pages created from article creation |
| 73 | + * @param $title Title |
| 74 | + */ |
| 75 | + public static function TrackCompleteSave( $title ) { |
| 76 | + global $wgRequest; |
70 | 77 | |
| 78 | + if ( $wgRequest->getVal( 'fromacw' ) ) { |
| 79 | + self::clickTracking( 'created-from-article-creation', $title ); |
| 80 | + } |
| 81 | + } |
| 82 | + |
71 | 83 | /** |
72 | 84 | * Tracking code that calls ClickTracking |
73 | 85 | * @param $event string the event name |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php |
— | — | @@ -29,6 +29,8 @@ |
30 | 30 | $wgHooks['BeforeWelcomeCreation'][] = 'ArticleCreationHooks::BeforeWelcomeCreation'; |
31 | 31 | $wgHooks['AlternateEdit'][] = 'ArticleCreationHooks::AlternateEdit'; |
32 | 32 | $wgHooks['SpecialSearchCreateLink'][] = 'ArticleCreationHooks::SpecialSearchCreateLink'; |
| 33 | +$wgHooks['EditPage::showEditForm:fields'][] = 'ArticleCreationHooks::pushTrackingFieldsToEdit'; |
| 34 | +$wgHooks['ArticleSaveComplete'][] = 'ArticleCreationHooks::trackEditSuccess'; |
33 | 35 | |
34 | 36 | $wgHooks['ResourceLoaderGetConfigVars'][] = 'ArticleCreationHooks::resourceLoaderGetConfigVars'; |
35 | 37 | |
— | — | @@ -168,8 +170,8 @@ |
169 | 171 | |
170 | 172 | $wgArticleCreationConfig = array( |
171 | 173 | 'action-url' => array( |
172 | | - 'draft' => '{{SCRIPT}}?title=User:{{USER}}/{{PAGE}}&action=edit', |
173 | | - 'create' => '{{SCRIPT}}?title={{PAGE}}&action=edit', |
| 174 | + 'draft' => '{{SCRIPT}}?title=User:{{USER}}/{{PAGE}}&action=edit&fromacw=1', |
| 175 | + 'create' => '{{SCRIPT}}?title={{PAGE}}&action=edit&fromacw=1', |
174 | 176 | 'login' => '{{SCRIPT}}?title=Special:Userlogin&returnto=Special:ArticleCreationLanding/{{PAGE}}&returntoquery=' . urlencode( 'fromlogin=1' ), |
175 | 177 | 'signup' => '{{SCRIPT}}?title=Special:Userlogin/signup&returnto=Special:ArticleCreationLanding/{{PAGE}}&returntoquery=' . urlencode( 'fromsignup=1' ), |
176 | 178 | 'request' => 'http://google.com/?q={{PAGE}}' |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.hooks.php |
— | — | @@ -93,4 +93,44 @@ |
94 | 94 | return true; |
95 | 95 | } |
96 | 96 | |
| 97 | + /** |
| 98 | + * Pushes the tracking fields into the edit page |
| 99 | + * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::showEditForm:fields |
| 100 | + * @param $editPage EditPage |
| 101 | + * @param $output OutputPage |
| 102 | + * @return bool |
| 103 | + */ |
| 104 | + public static function pushTrackingFieldsToEdit( $editPage, $output ) { |
| 105 | + $fromacw = $output->getRequest()->getVal( 'fromacw' ); |
| 106 | + |
| 107 | + if ( $fromacw ) { |
| 108 | + $editPage->editFormTextAfterContent .= Html::hidden( 'fromacw', '1' ); |
| 109 | + } |
| 110 | + |
| 111 | + return true; |
| 112 | + } |
| 113 | + |
| 114 | + /** |
| 115 | + * Tracks successful edits |
| 116 | + * |
| 117 | + * @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticleSaveComplete |
| 118 | + * @param $article WikiPage |
| 119 | + * @param $user |
| 120 | + * @param $text |
| 121 | + * @param $summary |
| 122 | + * @param $minoredit |
| 123 | + * @param $watchthis |
| 124 | + * @param $sectionanchor |
| 125 | + * @param $flags |
| 126 | + * @param $revision |
| 127 | + * @param $status |
| 128 | + * @param $baseRevId |
| 129 | + * @return bool |
| 130 | + */ |
| 131 | + public static function trackEditSuccess( &$article, &$user, $text, |
| 132 | + $summary, $minoredit, $watchthis, $sectionanchor, &$flags, |
| 133 | + $revision, &$status, $baseRevId /*, &$redirect */ ) { // $redirect not passed in 1.18wmf1 |
| 134 | + ArticleCreationUtil::trackCompleteSave( $article->getTitle() ); |
| 135 | + return true; |
| 136 | + } |
97 | 137 | } |