Index: trunk/extensions/LiveTranslate/LiveTranslate.i18n.php |
— | — | @@ -38,7 +38,11 @@ |
39 | 39 | 'livetranslate-special-button' => 'Save', |
40 | 40 | 'livetranslate-special-type' => 'Type', |
41 | 41 | 'livetranslate-special-location' => 'Location', |
| 42 | + 'livetranslate-special-remove' => 'Remove', |
42 | 43 | 'livetranslate-special-add-tm' => 'Add a new translation memory', |
| 44 | + 'livetranslate-special-current-tms' => 'Existing translation memories', |
| 45 | + 'livetranslate-special-tms-update' => 'Update translation memories', |
| 46 | + 'livetranslate-special-update' => 'Update translation memories', |
43 | 47 | ); |
44 | 48 | |
45 | 49 | /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
Index: trunk/extensions/LiveTranslate/specials/SpecialLiveTranslate.php |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | $this->handleSubmission(); |
82 | 82 | } |
83 | 83 | |
84 | | - $this->displayTMConfig(); |
| 84 | + $this->displayTMConfig( $this->getTMConfigItems() ); |
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
— | — | @@ -109,8 +109,10 @@ |
110 | 110 | * Displays the translation memories config table. |
111 | 111 | * |
112 | 112 | * @since 0.4 |
| 113 | + * |
| 114 | + * @param array $tms The current translation memories |
113 | 115 | */ |
114 | | - protected function displayTMConfig() { |
| 116 | + protected function displayTMConfig( array $tms ) { |
115 | 117 | global $wgOut, $wgUser; |
116 | 118 | |
117 | 119 | $wgOut->addHtml( Html::openElement( |
— | — | @@ -123,19 +125,31 @@ |
124 | 126 | ) |
125 | 127 | ) ); |
126 | 128 | |
127 | | - $tms = $this->getTMConfigItems(); |
128 | | - |
129 | 129 | if ( count( $tms ) > 0 ) { |
| 130 | + $wgOut->addHTML( '<h3>' . htmlspecialchars( wfMsg( 'livetranslate-special-tms-update' ) ) . '</h3>' ); |
| 131 | + |
| 132 | + $wgOut->addHTML( |
| 133 | + Html::input( |
| 134 | + '', |
| 135 | + wfMsg( 'livetranslate-special-update' ), |
| 136 | + 'submit', |
| 137 | + array( 'id' => 'tmform-updatesubmit' ) |
| 138 | + ) |
| 139 | + ); |
| 140 | + |
| 141 | + $wgOut->addHTML( '<h3>' . htmlspecialchars( wfMsg( 'livetranslate-special-current-tms' ) ) . '</h3>' ); |
| 142 | + |
130 | 143 | $wgOut->addHTML( Html::openElement( |
131 | 144 | 'table', |
132 | | - array( 'class' => 'wikitable', 'style' => 'width:100%' ) |
| 145 | + array( 'class' => 'wikitable', 'style' => 'width:50%' ) |
133 | 146 | ) ); |
134 | 147 | |
135 | 148 | $wgOut->addHTML( Html::rawElement( |
136 | 149 | 'tr', |
137 | 150 | array(), |
138 | | - Html::element( 'th', array(), wfMsg( 'livetranslate-special-location' ) ) . |
139 | | - Html::element( 'th', array(), wfMsg( 'livetranslate-special-type' ) ) |
| 151 | + Html::element( 'th', array( 'width' => '400px' ), wfMsg( 'livetranslate-special-location' ) ) . |
| 152 | + Html::element( 'th', array( 'width' => '200px' ), wfMsg( 'livetranslate-special-type' ) ) . |
| 153 | + Html::element( 'th', array( 'width' => '100px' ), wfMsg( 'livetranslate-special-remove' ) ) |
140 | 154 | ) ); |
141 | 155 | |
142 | 156 | foreach ( $tms as $tm ) { |
— | — | @@ -204,8 +218,21 @@ |
205 | 219 | $wgOut->addHTML( Html::rawElement( |
206 | 220 | 'tr', |
207 | 221 | array(), |
208 | | - Html::element( 'td', array(), $tm->memory_location ) . // TODO |
209 | | - Html::element( 'td', array(), $tm->memory_type ) // TODO |
| 222 | + Html::rawElement( |
| 223 | + 'td', |
| 224 | + array(), |
| 225 | + Html::input( 'tmlocation-' . $tm->memory_id, $tm->memory_location, 'text', array( 'size' => 60 ) ) |
| 226 | + ) . |
| 227 | + Html::rawElement( |
| 228 | + 'td', |
| 229 | + array(), |
| 230 | + $this->getTypeSelector( 'tmtype-' . $tm->memory_id, $tm->memory_type ) |
| 231 | + ) . |
| 232 | + Html::rawElement( |
| 233 | + 'td', |
| 234 | + array( 'style' => 'text-align:center' ), |
| 235 | + Xml::check( 'tmdel-' . $tm->memory_id, false ) |
| 236 | + ) |
210 | 237 | ) ); |
211 | 238 | } |
212 | 239 | |
— | — | @@ -221,11 +248,11 @@ |
222 | 249 | |
223 | 250 | $wgOut->addHTML( |
224 | 251 | '<table><tr>' . |
| 252 | + '<td><b>' . htmlspecialchars( wfMsg( 'livetranslate-special-type' ) ) . ': </b></td>' . |
| 253 | + '<td>' . $this->getTypeSelector( 'newtm-type', '' ) . '</td>' . // TODO |
| 254 | + '</tr><tr>' . |
225 | 255 | '<td><b>' . htmlspecialchars( wfMsg( 'livetranslate-special-location' ) ) . ': </b></td>' . |
226 | 256 | '<td>' . Html::input( 'newtm-location', '', 'text', array( 'size' => 75 ) ) . '</td>' . |
227 | | - '</tr><tr>' . |
228 | | - '<td><b>' . htmlspecialchars( wfMsg( 'livetranslate-special-type' ) ) . ': </b></td>' . |
229 | | - '<td>' . $this->getTypeSelector( 'newtm-type', '' ) . '</td>' . // TODO |
230 | 257 | '</tr></table>' |
231 | 258 | ); |
232 | 259 | } |