Index: trunk/extensions/Translate/js/quickedit.js |
— | — | @@ -21,8 +21,9 @@ |
22 | 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
23 | 23 | */ |
24 | 24 | |
25 | | -function trlOpenJsEdit( page ) { |
26 | | - var url = trlEditUrl.replace( "$1", page ); |
| 25 | +function trlOpenJsEdit( page, group ) { |
| 26 | + var url = wgScript + "?title=Special:Translate/editpage&page=$1&loadgroup=$2"; |
| 27 | + url = url.replace( "$1", page ).replace( "$2", group ); |
27 | 28 | var id = "jsedit" + page.replace( /[^a-zA-Z0-9_]/g, '_' ); |
28 | 29 | |
29 | 30 | var dialog = jQuery("#"+id); |
Index: trunk/extensions/Translate/utils/MessageTable.php |
— | — | @@ -68,13 +68,8 @@ |
69 | 69 | |
70 | 70 | // Helper stuff for JS |
71 | 71 | $trlKeys = array_values( $this->collection->keys() ); |
72 | | - $editQuery = wfArrayToCgi( array( |
73 | | - 'title' => SpecialPage::getTitleFor( 'Translate', 'editpage' )->getPrefixedText(), |
74 | | - 'loadgroup' => $this->group->getId(), |
75 | | - )); |
76 | 72 | |
77 | 73 | $vars = array( |
78 | | - 'trlEditUrl' => "$wgScript?$editQuery&page=$1", |
79 | 74 | 'trlKeys' => $trlKeys, |
80 | 75 | 'trlMsgNoNext' => wfMsg( 'translate-js-nonext' ), |
81 | 76 | 'trlMsgSaveFailed' => wfMsg( 'translate-js-save-failed' ), |
Index: trunk/extensions/Translate/utils/TranslationEditPage.php |
— | — | @@ -111,14 +111,15 @@ |
112 | 112 | return $data; |
113 | 113 | } |
114 | 114 | |
115 | | - public static function jsEdit( Title $title ) { |
| 115 | + public static function jsEdit( Title $title, $group = "" ) { |
116 | 116 | global $wgUser; |
117 | 117 | |
118 | 118 | if ( !$wgUser->isAllowed( 'translate' ) ) return array(); |
119 | 119 | if ( !$wgUser->getOption( 'translate-jsedit' ) ) return array(); |
120 | 120 | |
121 | 121 | $jsTitle = Xml::escapeJsString( $title->getPrefixedDbKey() ); |
122 | | - return array( 'onclick' => "return trlOpenJsEdit( \"$jsTitle\" );" ); |
| 122 | + $jsGroup = Xml::escapeJsString( $group ); |
| 123 | + return array( 'onclick' => "return trlOpenJsEdit( \"$jsTitle\", \"$jsGroup\" );" ); |
123 | 124 | } |
124 | 125 | |
125 | 126 | } |
\ No newline at end of file |
Index: trunk/extensions/Translate/utils/TranslationHelpers.php |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | |
179 | 179 | $source_page = Title::newFromText( $s['context'] . "/$code" ); |
180 | 180 | if ( $source_page ) { |
181 | | - $legend[$accuracy][] = self::editLink( $source_page, '•' ); |
| 181 | + $legend[$accuracy][] = self::ajaxEditLink( $source_page, '•' ); |
182 | 182 | } |
183 | 183 | |
184 | 184 | $text = $this->suggestionField( $s['target'] ); |
— | — | @@ -423,7 +423,7 @@ |
424 | 424 | |
425 | 425 | $target = Title::makeTitleSafe( $ns, "$page/$fbcode" ); |
426 | 426 | if ( $target ) { |
427 | | - $label = self::editLink( $target, htmlspecialchars( $label ) ); |
| 427 | + $label = self::ajaxEditLink( $target, htmlspecialchars( $label ) ); |
428 | 428 | } |
429 | 429 | |
430 | 430 | $text = TranslateUtils::convertWhiteSpaceToHTML( $text ); |
— | — | @@ -452,7 +452,7 @@ |
453 | 453 | $ns = $this->title->getNamespace(); |
454 | 454 | |
455 | 455 | $title = Title::makeTitle( $ns, $page . '/' . $wgTranslateDocumentationLanguageCode ); |
456 | | - $edit = self::editLink( $title, wfMsgHtml( 'translate-edit-contribute' ) ); |
| 456 | + $edit = self::ajaxEditLink( $title, wfMsgHtml( 'translate-edit-contribute' ) ); |
457 | 457 | $info = TranslateUtils::getMessageContent( $page, $wgTranslateDocumentationLanguageCode, $ns ); |
458 | 458 | |
459 | 459 | $class = 'mw-sp-translate-edit-info'; |
— | — | @@ -611,17 +611,24 @@ |
612 | 612 | return $this->adder( $id ) . "\n" . Html::rawElement( 'span', array( 'id' => $id ), $contents ); |
613 | 613 | } |
614 | 614 | |
615 | | - public static function editLink( $target, $text, $params = array() ) { |
| 615 | + /** |
| 616 | + * Ajax-enabled message editing link. |
| 617 | + * @param $target Title: Title of the target message. |
| 618 | + * @param $text String: Link text for Linker::link() |
| 619 | + * @return link |
| 620 | + */ |
| 621 | + public static function ajaxEditLink( $target, $text ) { |
616 | 622 | global $wgUser; |
617 | 623 | |
618 | 624 | list( $page, ) = self::figureMessage( $target ); |
619 | 625 | $group = TranslateUtils::messageKeyToGroup( $target->getNamespace(), $page ); |
620 | | - if ( $group ) $group = MessageGroups::getGroup( $group ); |
621 | | - $params += array( 'action' => 'edit' ); |
622 | | - if ( $group ) $params += array( 'loadgroup' => $group->getId() ); |
623 | 626 | |
624 | | - $jsEdit = TranslationEditPage::jsEdit( $target ); |
| 627 | + $params = array(); |
| 628 | + $params['action'] = 'edit'; |
| 629 | + $params['loadgroup'] = $group; |
625 | 630 | |
| 631 | + $jsEdit = TranslationEditPage::jsEdit( $target, $group ); |
| 632 | + |
626 | 633 | return $wgUser->getSkin()->link( $target, $text, $jsEdit, $params ); |
627 | 634 | } |
628 | 635 | } |