Index: trunk/extensions/LiveTranslate/LiveTranslate.i18n.php |
— | — | @@ -35,6 +35,9 @@ |
36 | 36 | 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
37 | 37 | 'livetranslate-tmtype-gcsv' => 'Google CSV', |
38 | 38 | 'livetranslate-special-no-tms-yet' => 'There are no translation memories yet.', |
| 39 | + 'livetranslate-special-button' => 'Save', |
| 40 | + 'livetranslate-special-type' => 'Type', |
| 41 | + 'livetranslate-special-location' => 'Location', |
39 | 42 | ); |
40 | 43 | |
41 | 44 | /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
Index: trunk/extensions/LiveTranslate/specials/SpecialLiveTranslate.php |
— | — | @@ -76,6 +76,8 @@ |
77 | 77 | return; |
78 | 78 | } |
79 | 79 | |
| 80 | + // TODO: handle submissions |
| 81 | + |
80 | 82 | $this->displayTMConfig(); |
81 | 83 | } |
82 | 84 | |
— | — | @@ -85,20 +87,55 @@ |
86 | 88 | * @since 0.4 |
87 | 89 | */ |
88 | 90 | protected function displayTMConfig() { |
89 | | - global $wgOut; |
| 91 | + global $wgOut, $wgUser; |
90 | 92 | |
91 | | - $tms = $this->getTMConfigItems(); |
| 93 | + $wgOut->addHtml( Html::openElement( |
| 94 | + 'form', |
| 95 | + array( |
| 96 | + 'id' => 'tmform', |
| 97 | + 'name' => 'tmform', |
| 98 | + 'method' => 'post', |
| 99 | + 'action' => $this->getTitle()->getLocalURL(), |
| 100 | + ) |
| 101 | + ) ); |
92 | 102 | |
| 103 | + $tms = $this->getTMConfigItems(); |
| 104 | + |
93 | 105 | if ( count( $tms ) > 0 ) { |
| 106 | + $wgOut->addHTML( Html::openElement( |
| 107 | + 'table', |
| 108 | + array( 'class' => 'wikitable', 'style' => 'width:100%' ) |
| 109 | + ) ); |
| 110 | + |
| 111 | + $wgOut->addHTML( Html::rawElement( |
| 112 | + 'tr', |
| 113 | + array(), |
| 114 | + Html::element( 'th', array(), wfMsg( 'livetranslate-special-location' ) ), |
| 115 | + Html::element( 'th', array(), wfMsg( 'livetranslate-special-type' ) ) |
| 116 | + ) ); |
| 117 | + |
94 | 118 | foreach ( $tms as $tm ) { |
95 | 119 | $this->displayTMItem( $tm ); |
96 | | - } |
| 120 | + } |
| 121 | + |
| 122 | + $wgOut->addHTML( Html::closeElement( 'table' ) ); |
97 | 123 | } |
98 | 124 | else { |
99 | 125 | $wgOut->addWikiMsg( 'livetranslate-special-no-tms-yet' ); |
100 | 126 | } |
101 | 127 | |
102 | 128 | $this->displayAddNewTM(); |
| 129 | + |
| 130 | + $wgOut->addHtml( |
| 131 | + Html::input( |
| 132 | + '', |
| 133 | + wfMsg( 'livetranslate-special-button' ), |
| 134 | + 'submit', |
| 135 | + array( 'id' => 'tmform-submit' ) |
| 136 | + ) . |
| 137 | + Html::hidden( 'wpEditToken', $wgUser->editToken() ) . |
| 138 | + Html::closeElement( 'form' ) |
| 139 | + ); |
103 | 140 | } |
104 | 141 | |
105 | 142 | /** |
— | — | @@ -139,7 +176,12 @@ |
140 | 177 | protected function displayTMItem( $tm ) { |
141 | 178 | global $wgOut; |
142 | 179 | |
143 | | - |
| 180 | + $wgOut->addHTML( Html::rawElement( |
| 181 | + 'tr', |
| 182 | + array(), |
| 183 | + Html::element( 'td', array(), $tm->memory_location ), // TODO |
| 184 | + Html::element( 'rd', array(), $tm->memory_type ) // TODO |
| 185 | + ) ); |
144 | 186 | } |
145 | 187 | |
146 | 188 | /** |
— | — | @@ -148,7 +190,7 @@ |
149 | 191 | * @since 0.4 |
150 | 192 | */ |
151 | 193 | protected function displayAddNewTM() { |
152 | | - |
| 194 | + // TODO |
153 | 195 | } |
154 | 196 | |
155 | 197 | } |