r85260 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85259‎ | r85260 | r85261 >
Date:16:16, 3 April 2011
Author:krinkle
Status:deferred
Tags:
Comment:
Putting dashboard in jquery.ui tabs
Modified paths:
  • /trunk/tools/ToolserverI18N/TsIntuition.php (modified) (history)
  • /trunk/tools/ToolserverI18N/language/messages/Tsintuition.i18n.php (modified) (history)
  • /trunk/tools/ToolserverI18N/public_html/index.php (modified) (history)

Diff [purge]

Index: trunk/tools/ToolserverI18N/TsIntuition.php
@@ -509,8 +509,8 @@
510510 * @param $lang string Language code
511511 * @return string
512512 */
513 - public function getLangName( $lang ) {
514 -
 513+ public function getLangName( $lang = false ) {
 514+ $lang = $lang ? $lang : $this->getLang();
515515 return isset( $this->langNames[$lang] ) ? $this->langNames[$lang] : '';
516516 }
517517
@@ -698,7 +698,11 @@
699699 return $lifetime < 0 ? 0 : $lifetime;
700700 }
701701
 702+ public function hasCookies(){
 703+ return isset( $_COOKIE[ $this->getCookieName( 'userlang' ) ] );
 704+ }
702705
 706+
703707 /* Load functions
704708 * ------------------------------------------------- */
705709
Index: trunk/tools/ToolserverI18N/public_html/index.php
@@ -55,6 +55,11 @@
5656
5757 $Tool = BaseTool::newFromArray( $toolConfig );
5858
 59+// jQuery UI
 60+$jqueryui = $kgConf->getJQueryUI();
 61+$Tool->addScripts( $jqueryui['scripts'] );
 62+$Tool->addStyles( $jqueryui['styles'] );
 63+
5964 $Tool->doHtmlHead();
6065 $Tool->doStartBodyWrapper();
6166
@@ -119,8 +124,10 @@
120125 }
121126 }
122127
 128+$Tool->addOut( '<div id="tsint-dashboard">' );
 129+
123130 // Cookie has already been set, show "current-settings" box
124 -if ( isset( $_COOKIE[ $I18N->getCookieName( 'userlang' ) ] ) ) {
 131+if ( $I18N->hasCookies() ) {
125132
126133 $lifetime = $I18N->getCookieLifetime();
127134 $after = '';
@@ -150,10 +157,11 @@
151158 }
152159
153160 $Tool->addOut(
154 - '<form class="cleanform"><fieldset>'
 161+ '<div id="tsint-currentsettings"><form class="cleanform"><fieldset>'
155162 . kfTag( _( 'current-settings' ) . _g( 'colon-separator' ) . ' ', 'legend' )
 163+ . '<div class="inner">'
156164 . 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' ) )
158166 . ' ('
159167 . kfTag( _( 'clear-cookies'), 'a', array( 'href' => $Tool->generatePermalink( array( 'action' => 'clearcookies' ) ) ) )
160168 . ')<br />'
@@ -162,7 +170,7 @@
163171 . kfTag( _( 'renew-cookies'), 'a', array( 'href' => $Tool->generatePermalink( array( 'action' => 'renewcookies' ) ) ) )
164172 . ')<br />'
165173 . $after
166 - . '</form>'
 174+ . '</div></fieldset></form></div><!-- #tsint-currentsettings -->'
167175 );
168176
169177
@@ -177,8 +185,8 @@
178186 }
179187 $dropdown .= '</select>';
180188
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">
183191
184192 <label>' . _html( 'choose-language' ) . _g( 'colon-separator' ) . '</label>
185193 ' . $dropdown . '
@@ -189,10 +197,24 @@
190198 <input type="submit" nof value="' . _html( 'form-submit', 'general' ) . '" />
191199 <br />
192200
193 -</fieldset></form>';
 201+</div></fieldset></form></div>';
194202
195203 $Tool->addOut( $form );
 204+$Tool->addOut( '</div><!-- #tsint-dashboard -->' );
196205
 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+
197219 /**
198220 * Close up
199221 * -------------------------------------------------
Index: trunk/tools/ToolserverI18N/language/messages/Tsintuition.i18n.php
@@ -22,6 +22,8 @@
2323 'cookie-expiration' => 'Cookie expiration',
2424 'clearcookies-success' => 'Succesfully cleared cookies.',
2525 'renewcookies-success' => 'Cookies renewed! You\'re all set for the next $1.',
 26+ 'tab-overview' => 'Overview',
 27+ 'tab-settings' => 'Settings',
2628 );
2729
2830 /**
@@ -30,6 +32,8 @@
3133 $messages['qqq'] = array(
3234 'clearcookies-success' => 'Message displayed after cookies are cleared.',
3335 '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.',
3438 );
3539
3640 /**
@@ -48,6 +52,8 @@
4953 'cookie-expiration' => 'Cookie verlooptijd',
5054 'clearcookies-success' => 'Cookies gewist.',
5155 'renewcookies-success' => 'Cookies vernieuwd! Je bent weer helemaal gereed voor de komende $1.',
 56+ 'tab-overview' => 'Overzicht',
 57+ 'tab-settings' => 'Instellingen',
5258 );
5359
5460 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r85261notes for r85260krinkle16:31, 3 April 2011

Status & tagging log