Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -616,6 +616,10 @@ |
617 | 617 | } else { |
618 | 618 | return wfMsgExt( 'pt-log-priority-langs', $opts, $title->getPrefixedText(), $user , $_['languages'], $_['reason'] ); |
619 | 619 | } |
| 620 | + } elseif ( $action === 'associate' ) { |
| 621 | + return wfMsgExt( 'pt-log-aggregategroup-associate', $opts, $title->getPrefixedText(), $user, $_['aggregategroup'] ); |
| 622 | + } elseif ( $action === 'dissociate' ) { |
| 623 | + return wfMsgExt( 'pt-log-aggregategroup-dissociate', $opts, $title->getPrefixedText(), $user, $_['aggregategroup'] ); |
620 | 624 | } |
621 | 625 | return ''; |
622 | 626 | } |
Index: trunk/extensions/Translate/TranslateHooks.php |
— | — | @@ -70,6 +70,8 @@ |
71 | 71 | $wgLogActionsHandlers['pagetranslation/encourage'] = 'PageTranslationHooks::formatLogEntry'; |
72 | 72 | $wgLogActionsHandlers['pagetranslation/discourage'] = 'PageTranslationHooks::formatLogEntry'; |
73 | 73 | $wgLogActionsHandlers['pagetranslation/prioritylanguages'] = 'PageTranslationHooks::formatLogEntry'; |
| 74 | + $wgLogActionsHandlers['pagetranslation/associate'] = 'PageTranslationHooks::formatLogEntry'; |
| 75 | + $wgLogActionsHandlers['pagetranslation/dissociate'] = 'PageTranslationHooks::formatLogEntry'; |
74 | 76 | |
75 | 77 | global $wgJobClasses; |
76 | 78 | $wgJobClasses['RenderJob'] = 'RenderJob'; |
Index: trunk/extensions/Translate/PageTranslation.i18n.php |
— | — | @@ -145,6 +145,8 @@ |
146 | 146 | 'pt-log-priority-langs-unset' => '{{GENDER:$2|removed}} priority languages from translatable page [[:$1]]', |
147 | 147 | 'pt-log-priority-langs' => '{{GENDER:$2|set}} the priority languages for translatable page [[:$1]] to $3. Reason: $4', |
148 | 148 | 'pt-log-priority-langs-force' => '{{GENDER:$2|limited}} languages for translatable page [[:$1]] to $3. Reason: $4', |
| 149 | + 'pt-log-aggregategroup-associate' => '{{GENDER:$2|added}} page [[:$1]] to $3.', |
| 150 | + 'pt-log-aggregategroup-dissociate' => '{{GENDER:$2|removed}} page [[:$1]] from $3.', |
149 | 151 | |
150 | 152 | # move page replacement |
151 | 153 | 'pt-movepage-title' => 'Move translatable page $1', |
— | — | @@ -299,6 +301,8 @@ |
300 | 302 | 'pt-log-priority-langs-unset' => '{{logentry|[[Special:Log/pagetranslation]]}}', |
301 | 303 | 'pt-log-priority-langs' => 'Used on [[Special:Log/pagetranslation]]. $3 is comma-separated list of languages.', |
302 | 304 | 'pt-log-priority-langs-force' => 'Used on [[Special:Log/pagetranslation]]. $3 is a comma-separated list of languages.', |
| 305 | + 'pt-log-aggregategroup-associate' => '{{logentry|[[Special:Log/pagetranslation]]}}', |
| 306 | + 'pt-log-aggregategroup-dissociate' => '{{logentry|[[Special:Log/pagetranslation]]}}', |
303 | 307 | 'pt-movepage-block-base-exists' => "'''base page''' refers to the untranslated version of the translatable page.", |
304 | 308 | 'pt-movepage-block-tp-exists' => 'translation page is a translated version of a translatable page', |
305 | 309 | 'pt-movepage-block-section-exists' => 'Section page is a translation of one section. Translation page consists of many translation sections.', |
Index: trunk/extensions/Translate/api/ApiAggregateGroups.php |
— | — | @@ -26,6 +26,7 @@ |
27 | 27 | $this->dieUsage( 'Permission denied', 'permissiondenied' ); |
28 | 28 | } |
29 | 29 | |
| 30 | + $logger = new LogPage( 'pagetranslation' ); |
30 | 31 | $params = $this->extractRequestParams(); |
31 | 32 | $aggregateGroup = $params['aggregategroup']; |
32 | 33 | $action = $params['do']; |
— | — | @@ -37,7 +38,7 @@ |
38 | 39 | } |
39 | 40 | |
40 | 41 | // Get the list of group ids |
41 | | - $group = $params['group']; |
| 42 | + $groupId = $params['group']; |
42 | 43 | $subgroups = TranslateMetadata::get( $aggregateGroup, 'subgroups' ); |
43 | 44 | if ( $subgroups ) { |
44 | 45 | $subgroups = array_map( 'trim', explode( ',', $subgroups ) ); |
— | — | @@ -45,22 +46,29 @@ |
46 | 47 | // For newly created groups the subgroups value might be empty |
47 | 48 | $subgroups = array(); |
48 | 49 | } |
| 50 | + $group = MessageGroups::getGroup( $groupId ); |
| 51 | + if ( $group === null || !$group instanceof WikiPageMessageGroup ) { |
| 52 | + $this->dieUsage( 'Group does not exist or invalid', 'invalidgroup' ); |
| 53 | + } |
49 | 54 | |
50 | | - // @FIXME: check that the group id is a translatable page |
51 | 55 | // @FIXME: handle pages with a comma in their name |
52 | 56 | |
53 | 57 | // Add or remove from the list |
54 | | - // @TODO logging |
55 | 58 | if ( $action === 'associate' ) { |
56 | | - $subgroups[] = $group; |
| 59 | + $subgroups[] = $groupId; |
57 | 60 | $subgroups = array_unique( $subgroups ); |
58 | 61 | } elseif ( $action === 'dissociate' ) { |
59 | 62 | $subgroups = array_flip( $subgroups ) ; |
60 | | - unset( $subgroups[$group] ); |
| 63 | + unset( $subgroups[$groupId] ); |
61 | 64 | $subgroups = array_flip( $subgroups ); |
62 | 65 | } |
63 | 66 | |
64 | 67 | TranslateMetadata::set( $aggregateGroup, 'subgroups', implode( ',', $subgroups ) ) ; |
| 68 | + $logparams = array( |
| 69 | + 'user' => $wgUser->getName() , |
| 70 | + 'aggregategroup' => TranslateMetadata::get( $aggregateGroup, 'name' ), |
| 71 | + ); |
| 72 | + $logger->addEntry( $action, $group->getTitle(), null, array( serialize( $logparams ) ) ); |
65 | 73 | } elseif ( $action === 'remove' ) { |
66 | 74 | TranslateMetadata::set( $aggregateGroup, 'subgroups', false ) ; |
67 | 75 | TranslateMetadata::set( $aggregateGroup, 'name', false ) ; |