Index: trunk/extensions/Translate/scripts/sync-group.php |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | |
148 | 148 | |
149 | 149 | |
150 | | - $title = Title::makeTitleSafe( $this->group->namespaces[0], "$key/$code" ); |
| 150 | + $title = Title::makeTitleSafe( $this->group->getNamespace(), "$key/$code" ); |
151 | 151 | |
152 | 152 | $page = $title->getPrefixedText(); |
153 | 153 | |
Index: trunk/extensions/Translate/utils/TranslationEditPage.php |
— | — | @@ -1,7 +1,12 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
| 5 | + * This class together with some javascript implements the ajax translation |
| 6 | + * page. |
5 | 7 | * |
| 8 | + * @author Niklas Laxström |
| 9 | + * @copyright Copyright © 2009 Niklas Laxström |
| 10 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
6 | 11 | */ |
7 | 12 | class TranslationEditPage { |
8 | 13 | /// Instance of an Title object |
— | — | @@ -25,6 +30,10 @@ |
26 | 31 | public function setTitle( Title $title ) { $this->title = $title; } |
27 | 32 | public function getTitle() { return $this->title; } |
28 | 33 | |
| 34 | + /** |
| 35 | + * Generates the html snippet for ajax edit. Echoes it to the output and |
| 36 | + * disabled all other output. |
| 37 | + */ |
29 | 38 | public function execute() { |
30 | 39 | $data = $this->getEditInfo(); |
31 | 40 | $helpers = new TranslationHelpers( $this->getTitle() ); |
— | — | @@ -39,7 +48,7 @@ |
40 | 49 | 'class' => 'mw-translate-edit-area', |
41 | 50 | 'rows' => $short ? 2: 10, |
42 | 51 | ); |
43 | | - $textarea = Html::element( 'textarea', $textareaParams, $translation ); |
| 52 | + $textarea = Html::element( 'textarea', $textareaParams, htmlspecialchars($translation) ); |
44 | 53 | |
45 | 54 | $hidden = array(); |
46 | 55 | $hidden[] = Xml::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ); |
— | — | @@ -53,10 +62,12 @@ |
54 | 63 | $summary = Xml::inputLabel( wfMsg( 'summary' ), 'summary', 'summary', 40 ); |
55 | 64 | $save = Html::input( 'submit', wfMsg( 'savearticle' ), 'submit' ); |
56 | 65 | |
| 66 | + // Use the api to submit edits |
57 | 67 | $formParams = array( |
58 | 68 | 'action' => "{$wgServer}{$wgScriptPath}/api.php", |
59 | 69 | 'method' => 'post', |
60 | 70 | ); |
| 71 | + |
61 | 72 | $form = Html::element( 'form', $formParams, |
62 | 73 | implode( "\n", $hidden ) . "\n" . |
63 | 74 | $helpers->getBoxes() . "\n" . |
— | — | @@ -66,6 +77,11 @@ |
67 | 78 | echo $form; |
68 | 79 | } |
69 | 80 | |
| 81 | + /** |
| 82 | + * Gets the edit token and timestamps in some ugly array structure. Needs to |
| 83 | + * be cleaned up. |
| 84 | + * @return Array |
| 85 | + */ |
70 | 86 | protected function getEditInfo() { |
71 | 87 | $params = new FauxRequest( array( |
72 | 88 | 'action' => 'query', |