From: Ævar Arnfjörð Bjarmason Date: Tue, 12 Apr 2005 00:37:45 +0000 (+0000) Subject: * A new tab in the preferencesc called 'File' for any current and future X-Git-Tag: 1.5.0alpha1~297 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=e1f576c14e0bce02ca67a3c433a689bec8c74e24;p=lhc%2Fweb%2Fwiklou.git * A new tab in the preferencesc called 'File' for any current and future file-related options, moving the images description limit there (from misc) * (bug 1221) image thumbnail sizes are now a user preference (in the 'Files' tab) --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 61a72aabcc..d7c2d6a8c9 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1070,6 +1070,19 @@ $wgImageLimits = array ( array(1280,1024), array(10000,10000) ); +/** + * Adjust thumbnails on image pages according to a user setting. In order to + * reduce disk usage, the values can only be selected from a list. This is the + * list of settings the user can choose from: + */ +$wgThumbLimits = array( + 120, + 150, + 180, + 200, + 250, + 300 +); /** Navigation links for the user sidebar. * 'text' is the name of the MediaWiki message that contains the label of this link diff --git a/includes/Linker.php b/includes/Linker.php index 84dc09af17..a5c7a2b7b3 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -415,6 +415,8 @@ class Linker { /** @todo document */ function makeImageLinkObj( $nt, $alt = '' ) { global $wgContLang, $wgUseImageResize; + global $wgUser, $wgThumbLimits; + $img = new Image( $nt ); $url = $img->getViewURL(); @@ -495,13 +497,22 @@ class Linker { # for right-to-left-languages ("Semitic languages") # # If thumbnail width has not been provided, it is set - # here to 180 pixels + # to the default user option as specified in Language*.php if ( $align == '' ) { $align = $wgContLang->isRTL() ? 'left' : 'right'; } + + if ( ! isset($width) ) { - $width = 180; + $wopt = $wgUser->getOption( 'thumbsize' ); + + if( !isset( $wgThumbLimits[$wopt] ) ) { + $wopt = User::getDefaultOption( 'thumbsize' ); + } + + $width = $wgThumbLimits[$wopt]; } + return $prefix.$this->makeThumbLinkObj( $img, $alt, $align, $width, $height, $framed, $manual_thumb ).$postfix; } elseif ( isset($width) ) { diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 0c1fd47057..d4e6722565 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -56,13 +56,14 @@ class PreferencesForm { $this->mEmailFlag = $request->getCheck( 'wpEmailFlag' ) ? 1 : 0; $this->mNick = $request->getVal( 'wpNick' ); $this->mUserLanguage = $request->getVal( 'wpUserLanguage' ); - $this->mUserVariant = $request->getVal( 'wpUserVariant' ); + $this->mUserVariant = $request->getVal( 'wpUserVariant' ); $this->mSearch = $request->getVal( 'wpSearch' ); $this->mRecent = $request->getVal( 'wpRecent' ); $this->mHourDiff = $request->getVal( 'wpHourDiff' ); $this->mSearchLines = $request->getVal( 'wpSearchLines' ); $this->mSearchChars = $request->getVal( 'wpSearchChars' ); $this->mImageSize = $request->getVal( 'wpImageSize' ); + $this->mThumbSize = $request->getInt( 'wpThumbSize' ); $this->mAction = $request->getVal( 'action' ); $this->mReset = $request->getCheck( 'wpReset' ); @@ -218,6 +219,7 @@ class PreferencesForm { $wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs ) ); $wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mHourDiff, -12, 14 ) ); $wgUser->setOption( 'imagesize', $this->mImageSize ); + $wgUser->setOption( 'thumbsize', $this->mThumbSize ); # Set search namespace options foreach( $this->mSearchNs as $i => $value ) { @@ -304,6 +306,7 @@ class PreferencesForm { $this->mSearchLines = $wgUser->getOption( 'contextlines' ); $this->mSearchChars = $wgUser->getOption( 'contextchars' ); $this->mImageSize = $wgUser->getOption( 'imagesize' ); + $this->mThumbSize = $wgUser->getOption( 'thumbsize' ); $this->mRecent = $wgUser->getOption( 'rclimit' ); $togs = $wgLang->getUserToggles(); @@ -375,7 +378,7 @@ class PreferencesForm { */ function mainPrefsForm( $err ) { global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames; - global $wgAllowRealName, $wgImageLimits; + global $wgAllowRealName, $wgImageLimits, $wgThumbLimits; global $wgLanguageNames, $wgDisableLangConversion; global $wgEmailNotificationForWatchlistPages, $wgEmailNotificationForUserTalkPages,$wgEmailNotificationForMinorEdits; global $wgRCShowWatchingUsers, $wgEmailNotificationRevealPageEditorAddress; @@ -408,6 +411,7 @@ class PreferencesForm { $cp = wfMsg( 'changepassword' ); $sk = wfMsg( 'skin' ); $math = wfMsg( 'math' ); + $files = wfMsg( 'files' ); $dateFormat = wfMsg('dateformat'); $opw = wfMsg( 'oldpassword' ); $npw = wfMsg( 'newpassword' ); @@ -607,7 +611,28 @@ class PreferencesForm { value=\"$i\"$checked /> ".wfMsg($mathopts[$i])."\n" ); } $wgOut->addHTML( "\n\n" ); - + + # Files + # + $wgOut->addHTML("
+ $files +
+
\n\n"); + # Date format # if ($dateopts) { @@ -680,16 +705,6 @@ class PreferencesForm { # $wgOut->addHTML("
".wfMsg('prefs-misc').""); - $wgOut->addHTML( '
" ); - - foreach ( $togs as $tname ) { if( !array_key_exists( $tname, $this->mUsedToggles ) ) { $wgOut->addHTML( $this->getToggle( $tname ) ); diff --git a/languages/Language.php b/languages/Language.php index ffa19901b9..e80981c4f2 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -76,6 +76,7 @@ if(isset($wgExtraNamespaces)) { 'showtoolbar' => 1, 'date' => 0, 'imagesize' => 2, + 'thumbsize' => 2, 'rememberpassword' => 0, 'enotifwatchlistpages' => 1, 'enotifusertalkpages' => 1, @@ -853,7 +854,7 @@ See [[Project:User preferences help]] for help deciphering the options.", 'changepassword' => 'Change password', 'skin' => 'Skin', 'math' => 'Math', -'dateformat' => 'Date format', +'dateformat' => 'Date format', 'math_failure' => 'Failed to parse', 'math_unknown_error' => 'unknown error', 'math_unknown_function' => 'unknown function ', @@ -891,6 +892,7 @@ from server time (UTC).', 'emailflag' => 'Disable e-mail from other users', 'defaultns' => 'Search in these namespaces by default:', 'default' => 'default', +'files' => 'Files', # User levels special page # @@ -1776,6 +1778,7 @@ ta[\'ca-nstab-category\'] = new Array(\'c\',\'View the category page\'); 'nextdiff' => 'Next diff →', 'imagemaxsize' => 'Limit images on image description pages to: ', +'thumbsize' => 'Thumbnail size : ', 'showbigimage' => 'Download high resolution version ($1x$2, $3 KB)', 'newimages' => 'New images gallery',