Index: trunk/tools/ToolserverI18N/TsIntuition.php |
— | — | @@ -509,8 +509,8 @@ |
510 | 510 | * @param $lang string Language code |
511 | 511 | * @return string |
512 | 512 | */ |
513 | | - public function getLangName( $lang ) { |
514 | | - |
| 513 | + public function getLangName( $lang = false ) { |
| 514 | + $lang = $lang ? $lang : $this->getLang(); |
515 | 515 | return isset( $this->langNames[$lang] ) ? $this->langNames[$lang] : ''; |
516 | 516 | } |
517 | 517 | |
— | — | @@ -698,7 +698,11 @@ |
699 | 699 | return $lifetime < 0 ? 0 : $lifetime; |
700 | 700 | } |
701 | 701 | |
| 702 | + public function hasCookies(){ |
| 703 | + return isset( $_COOKIE[ $this->getCookieName( 'userlang' ) ] ); |
| 704 | + } |
702 | 705 | |
| 706 | + |
703 | 707 | /* Load functions |
704 | 708 | * ------------------------------------------------- */ |
705 | 709 | |
Index: trunk/tools/ToolserverI18N/public_html/index.php |
— | — | @@ -55,6 +55,11 @@ |
56 | 56 | |
57 | 57 | $Tool = BaseTool::newFromArray( $toolConfig ); |
58 | 58 | |
| 59 | +// jQuery UI |
| 60 | +$jqueryui = $kgConf->getJQueryUI(); |
| 61 | +$Tool->addScripts( $jqueryui['scripts'] ); |
| 62 | +$Tool->addStyles( $jqueryui['styles'] ); |
| 63 | + |
59 | 64 | $Tool->doHtmlHead(); |
60 | 65 | $Tool->doStartBodyWrapper(); |
61 | 66 | |
— | — | @@ -119,8 +124,10 @@ |
120 | 125 | } |
121 | 126 | } |
122 | 127 | |
| 128 | +$Tool->addOut( '<div id="tsint-dashboard">' ); |
| 129 | + |
123 | 130 | // Cookie has already been set, show "current-settings" box |
124 | | -if ( isset( $_COOKIE[ $I18N->getCookieName( 'userlang' ) ] ) ) { |
| 131 | +if ( $I18N->hasCookies() ) { |
125 | 132 | |
126 | 133 | $lifetime = $I18N->getCookieLifetime(); |
127 | 134 | $after = ''; |
— | — | @@ -150,10 +157,11 @@ |
151 | 158 | } |
152 | 159 | |
153 | 160 | $Tool->addOut( |
154 | | - '<form class="cleanform"><fieldset>' |
| 161 | + '<div id="tsint-currentsettings"><form class="cleanform"><fieldset>' |
155 | 162 | . kfTag( _( 'current-settings' ) . _g( 'colon-separator' ) . ' ', 'legend' ) |
| 163 | + . '<div class="inner">' |
156 | 164 | . kfTag( _( 'current-language' ) . _g( 'colon-separator' ) . ' ', 'label' ) |
157 | | - . kfTag( '', 'input', array( 'value' => $I18N->getLang(), 'readonly' => 'readonly' ) ) |
| 165 | + . kfTag( '', 'input', array( 'value' => $I18N->getLangName(), 'readonly' => 'readonly' ) ) |
158 | 166 | . ' (' |
159 | 167 | . kfTag( _( 'clear-cookies'), 'a', array( 'href' => $Tool->generatePermalink( array( 'action' => 'clearcookies' ) ) ) ) |
160 | 168 | . ')<br />' |
— | — | @@ -162,7 +170,7 @@ |
163 | 171 | . kfTag( _( 'renew-cookies'), 'a', array( 'href' => $Tool->generatePermalink( array( 'action' => 'renewcookies' ) ) ) ) |
164 | 172 | . ')<br />' |
165 | 173 | . $after |
166 | | - . '</form>' |
| 174 | + . '</div></fieldset></form></div><!-- #tsint-currentsettings -->' |
167 | 175 | ); |
168 | 176 | |
169 | 177 | |
— | — | @@ -177,8 +185,8 @@ |
178 | 186 | } |
179 | 187 | $dropdown .= '</select>'; |
180 | 188 | |
181 | | -$form = '<form action="' . $Tool->remoteBasePath . '" method="post" class="cleanform"><fieldset> |
182 | | - <legend>' . _( 'settings-legend' ) . '</legend> |
| 189 | +$form = '<div id="tsint-settingsform"><form action="' . $Tool->remoteBasePath . '" method="post" class="cleanform"><fieldset> |
| 190 | + <legend>' . _( 'settings-legend' ) . '</legend><div class="inner"> |
183 | 191 | |
184 | 192 | <label>' . _html( 'choose-language' ) . _g( 'colon-separator' ) . '</label> |
185 | 193 | ' . $dropdown . ' |
— | — | @@ -189,10 +197,24 @@ |
190 | 198 | <input type="submit" nof value="' . _html( 'form-submit', 'general' ) . '" /> |
191 | 199 | <br /> |
192 | 200 | |
193 | | -</fieldset></form>'; |
| 201 | +</div></fieldset></form></div>'; |
194 | 202 | |
195 | 203 | $Tool->addOut( $form ); |
| 204 | +$Tool->addOut( '</div><!-- #tsint-dashboard -->' ); |
196 | 205 | |
| 206 | +/* JavaScript init */ |
| 207 | +$script[] = '$(document).ready(function(){'; |
| 208 | +$script[] = '$("#tsint-dashboard").prepend(\'<ul>'; |
| 209 | +if ( $I18N->hasCookies() ) { |
| 210 | + $script[] = '<li><a href="#tsint-currentsettings">' . _('tab-overview') . '</a></li>'; |
| 211 | +} |
| 212 | +$script[] = '<li><a href="#tsint-settingsform">' ._('tab-settings') . '</a></li></ul>\');'; |
| 213 | +$script[] = '$("#tsint-dashboard").tabs();'; |
| 214 | +$script[] = '});'; |
| 215 | + |
| 216 | +$Tool->addOut( '<script>' . implode( '', $script ) . '</script>' ); |
| 217 | + |
| 218 | + |
197 | 219 | /** |
198 | 220 | * Close up |
199 | 221 | * ------------------------------------------------- |
Index: trunk/tools/ToolserverI18N/language/messages/Tsintuition.i18n.php |
— | — | @@ -22,6 +22,8 @@ |
23 | 23 | 'cookie-expiration' => 'Cookie expiration', |
24 | 24 | 'clearcookies-success' => 'Succesfully cleared cookies.', |
25 | 25 | 'renewcookies-success' => 'Cookies renewed! You\'re all set for the next $1.', |
| 26 | + 'tab-overview' => 'Overview', |
| 27 | + 'tab-settings' => 'Settings', |
26 | 28 | ); |
27 | 29 | |
28 | 30 | /** |
— | — | @@ -30,6 +32,8 @@ |
31 | 33 | $messages['qqq'] = array( |
32 | 34 | 'clearcookies-success' => 'Message displayed after cookies are cleared.', |
33 | 35 | 'renewcookies-success' => 'This message is shown after the cookies are renewed. The $1 variable contains the period of time until the cookies will expire (eg. "30 days")..', |
| 36 | + 'tab-overview' => 'Dashboard tab for "Overview" which shows the current settings.', |
| 37 | + 'tab-settings' => 'Dashboard tab for "Settings" which allows the user to edit the settings.', |
34 | 38 | ); |
35 | 39 | |
36 | 40 | /** |
— | — | @@ -48,6 +52,8 @@ |
49 | 53 | 'cookie-expiration' => 'Cookie verlooptijd', |
50 | 54 | 'clearcookies-success' => 'Cookies gewist.', |
51 | 55 | 'renewcookies-success' => 'Cookies vernieuwd! Je bent weer helemaal gereed voor de komende $1.', |
| 56 | + 'tab-overview' => 'Overzicht', |
| 57 | + 'tab-settings' => 'Instellingen', |
52 | 58 | ); |
53 | 59 | |
54 | 60 | /** |