From: Jens Frank Date: Mon, 17 May 2004 23:18:37 +0000 (+0000) Subject: Add different CardSets for rendering of preferences. X-Git-Tag: 1.3.0beta1~48 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=4a7596429cd9ef9cbcd2cae90104dc029b31078f;p=lhc%2Fweb%2Fwiklou.git Add different CardSets for rendering of preferences. Make SkinPHPTal use the JavaScript based tabbed version, while others stay with the old fieldsets. --- diff --git a/includes/CardSet.php b/includes/CardSet.php new file mode 100644 index 0000000000..956a18e26c --- /dev/null +++ b/includes/CardSet.php @@ -0,0 +1,48 @@ +mLabels = array(); + $this->mBodies = array(); + $this->mTitle = $title; + } + + // Add a card to the set. The body of the card is expected to be + // HTML, not wikitext. + function addCard( $label, $body ) + { + $this->mLabels[] = $label; + $this->mBodies[] = $body; + } + + // Return the HTML of this CardSet + function renderToOutpage( &$out ) + { + for ( $i=0; $imLabels ); $i++ ) + { + $s .= "
\n" . $this->mLabels[$i] . "\n" + . $this->mBodies[$i] . "
\n"; + } + + $out->addHTML( $s ); + } + +} // end of: class CardSet + +?> diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e859ed2229..00ec47fd66 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -7,8 +7,9 @@ class OutputPage { var $mHeaders, $mCookies, $mMetatags, $mKeywords; var $mLinktags, $mPagetitle, $mBodytext, $mDebugtext; var $mHTMLtitle, $mRobotpolicy, $mIsarticle, $mPrintable; - var $mSubtitle, $mRedirect, $mHeadtext; + var $mSubtitle, $mRedirect; var $mLastModified, $mCategoryLinks; + var $mScripts; var $mSuppressQuickbar; var $mOnloadHandler; @@ -35,6 +36,7 @@ class OutputPage { $this->mContainsOldMagic = $this->mContainsNewMagic = 0; $this->mParserOptions = ParserOptions::newFromUser( $temp = NULL ); $this->mSquidMaxage = 0; + $this->mScripts = ""; } function addHeader( $name, $val ) { array_push( $this->mHeaders, "$name: $val" ) ; } @@ -44,6 +46,8 @@ class OutputPage { # To add an http-equiv meta tag, precede the name with "http:" function addMeta( $name, $val ) { array_push( $this->mMetatags, array( $name, $val ) ); } function addKeyword( $text ) { array_push( $this->mKeywords, $text ); } + function addScript( $script ) { $this->mScripts .= $script; } + function getScript() { return $this->mScripts; } function addLink( $linkarr ) { # $linkarr should be an associative array of attributes. We'll escape on output. @@ -186,7 +190,6 @@ class OutputPage { function isQuickbarSuppressed() { return $this->mSuppressQuickbar; } function addHTML( $text ) { $this->mBodytext .= $text; } - function addHeadtext( $text ) { $this->mHeadtext .= $text; } function debug( $text ) { $this->mDebugtext .= $text; } function setParserOptions( $options ) @@ -664,6 +667,7 @@ class OutputPage { $sk = $wgUser->getSkin(); $ret .= $sk->getHeadScripts(); + $ret .= $this->mScripts; $ret .= $sk->getUserStyles(); $ret .= "\n"; diff --git a/includes/Skin.php b/includes/Skin.php index 4e9eff90ce..4f45e4f737 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2,6 +2,7 @@ require_once( "Feed.php" ); require_once( "Image.php" ); +require_once( "CardSet.php" ); # See skin.doc @@ -2695,6 +2696,13 @@ class Skin { $toolbar.="/*]]>*/\n"; return $toolbar; } + + // Return a new cardset. + // By overloading this function, Skins can alter the appearance of e.g. the preferences + function newCardSet( $title = "") + { + return new CardSet( $title ); + } } require_once( "SkinStandard.php" ); diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index bf39da2599..cd0cd29be8 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -29,6 +29,8 @@ require_once "GlobalFunctions.php"; require_once $IP."/PHPTAL-NP-0.7.0/libs/PHPTAL.php"; + require_once "TabbedCardSet.php"; + class MediaWiki_I18N extends PHPTAL_I18N { var $_context = array(); @@ -112,6 +114,7 @@ $tpl->setRef( 'mimetype', &$wgMimeType ); $tpl->setRef( 'charset', &$wgOutputEncoding ); $tpl->set( 'headlinks', $out->getHeadLinks() ); + $tpl->set( 'customscript', $out->getScript() ); $tpl->setRef( 'skinname', &$this->skinname ); $tpl->setRef( "loggedin", &$this->loggedin ); /* XXX currently unused, might get useful later @@ -196,6 +199,7 @@ } else { $tpl->set('body-ondblclick', false); } + $tpl->set( 'body-onload',$wgOut->getOnloadHandler() ); $tpl->set( "nav_urls", $this->buildNavUrls() ); // execute template @@ -545,6 +549,7 @@ return wfMsg('nstab-main'); } } + /* private */ function setupUserCssJs () { global $wgRequest, $wgTitle; $action = $wgRequest->getText('action'); @@ -562,6 +567,14 @@ $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript'); } } + + // Overload the Skin::newCardSet function to replace + // the default CardSet widget + function newCardSet( $title = "") + { + return new TabbedCardSet( $title ); + } + } class SkinDaVinci extends SkinPHPTal { diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index ba649eaa49..775a74584a 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -1,4 +1,6 @@ \n"; } + /* private */ function mainPrefsForm( $err ) { global $wgUser, $wgOut, $wgLang, $wgUseDynamicDates, $wgValidSkinNames; + + $skin = $wgUser->getSkin(); + $cardset = $skin->newCardSet( wfMsg( "preferences" ) ); $wgOut->setPageTitle( wfMsg( "preferences" ) ); $wgOut->setArticleRelated( false ); @@ -288,17 +294,12 @@ class PreferencesForm { $titleObj = Title::makeTitle( NS_SPECIAL, "Preferences" ); $action = $titleObj->escapeLocalURL(); - $qb = wfMsg( "qbsettings" ); $cp = wfMsg( "changepassword" ); - $sk = wfMsg( "skin" ); - $math = wfMsg( "math" ); - $dateFormat = wfMsg("dateformat"); $opw = wfMsg( "oldpassword" ); $npw = wfMsg( "newpassword" ); $rpw = wfMsg( "retypenew" ); $svp = wfMsg( "saveprefs" ); $rsp = wfMsg( "resetprefs" ); - $tbs = wfMsg( "textboxsize" ); $tbr = wfMsg( "rows" ); $tbc = wfMsg( "columns" ); $ltz = wfMsg( "localtime" ); @@ -311,16 +312,15 @@ class PreferencesForm { $emf = wfMsg( "emailflag" ); $ynn = wfMsg( "yournick" ); $stt = wfMsg ( "stubthreshold" ) ; - $srh = wfMsg( "searchresultshead" ); $rpp = wfMsg( "resultsperpage" ); $scl = wfMsg( "contextlines" ); $scc = wfMsg( "contextchars" ); $rcc = wfMsg( "recentchangescount" ); - $dsn = wfMsg( "defaultns" ); $wgOut->addHTML( "
" ); + ###################################################################### # First section: identity # Email, etc. # @@ -330,139 +330,125 @@ class PreferencesForm { if ( $this->mEmailFlag ) { $emfc = 'checked="checked"'; } else { $emfc = ""; } - $ps = $this->namespacesCheckboxes(); - - $wgOut->addHTML( "
- Idento -
-
-
-
\n" ); - # Fields for changing password # $this->mOldpass = wfEscapeHTML( $this->mOldpass ); $this->mNewpass = wfEscapeHTML( $this->mNewpass ); $this->mRetypePass = wfEscapeHTML( $this->mRetypePass ); - $wgOut->addHTML( "
+ $cardset->addCard( "Idento", "
+
+
+
+
$cp:
" . $this->getToggle( "rememberpassword" ) . " -
\n
\n" ); +
"); + ###################################################################### # Quickbar setting # - $wgOut->addHtml( "
\n$qb:\n" ); + $s=""; for ( $i = 0; $i < count( $qbs ); ++$i ) { if ( $i == $this->mQuickbar ) { $checked = ' checked="checked"'; } else { $checked = ""; } - $wgOut->addHTML( "
\n" ); + $s .= "
\n"; } - $wgOut->addHtml( "
\n\n" ); + $cardset->addCard( wfMsg( "qbsettings" ), $s ); + + ###################################################################### # Skin setting # - $wgOut->addHTML( "
\n$sk:\n" ); # Only show members of $wgValidSkinNames rather than # $skinNames (skins is all skin names from Language.php) + $s=""; foreach ($wgValidSkinNames as $skinkey => $skinname ) { if ( $skinkey == $this->mSkin ) { $checked = ' checked="checked"'; } else { $checked = ""; } - $wgOut->addHTML( "
\n" ); + $s .= "
\n"; } - $wgOut->addHTML( "
\n\n" ); + $cardset->addCard( wfMsg( "skin" ), $s ); + ###################################################################### # Math setting # - $wgOut->addHTML( "
\n$math:\n" ); + $s=""; for ( $i = 0; $i < count( $mathopts ); ++$i ) { if ( $i == $this->mMath ) { $checked = ' checked="checked"'; } else { $checked = ""; } - $wgOut->addHTML( "
\n" ); + $s .= "
\n"; } - $wgOut->addHTML( "
\n\n" ); + $cardset->addCard( wfMsg( "math" ), $s ); + ###################################################################### # Date format # if ( $wgUseDynamicDates ) { - $wgOut->addHTML( "
\n$dateFormat:\n" ); + $s=""; for ( $i = 0; $i < count( $dateopts ); ++$i) { if ( $i == $this->mDate ) { $checked = ' checked="checked"'; } else { $checked = ""; } - $wgOut->addHTML( "
\n" ); + $s .= "
\n" ; } - $wgOut->addHTML( "
\n\n"); + $cardset->addCard( wfMsg("dateformat"), $s ); } + ###################################################################### # Textbox rows, cols # $nowlocal = $wgLang->time( $now = wfTimestampNow(), true ); $nowserver = $wgLang->time( $now, false ); - $wgOut->addHTML( "
- $tbs:\n -
+ $cardset->addCard( wfMsg( "textboxsize" ), "
-
" . - $this->getToggle( "editwidth" ) . - $this->getToggle( "showtoolbar" ) . - $this->getToggle( "previewontop" ) . - $this->getToggle( "watchdefault" ) . - $this->getToggle( "minordefault" ) . " -
- -
- $dateFormat: -
$tzServerTime: $nowserver
-
$ltz: $nowlocal
-
-
-
\n\n" ); + " . + $this->getToggle( "editwidth" ) . + $this->getToggle( "showtoolbar" ) . + $this->getToggle( "previewontop" ) . + $this->getToggle( "watchdefault" ) . + $this->getToggle( "minordefault" ) ); + + $cardset->addCard( wfMsg( "dateformat" ), "
$tzServerTime: $nowserver
+
$ltz: $nowlocal
+
+
" ); + + $cardset->addCard( wfMsg( "recentchangescount" ), + "
+ " . $this->getToggle( "hideminor" ) . + $this->getToggle( "usenewrc" ) . " +
" ); + + $cardset->addCard( wfMsg( "searchresultshead" ), " +
+
+
+
" . wfMsg( "defaultns" ) . "\n" . $this->namespacesCheckboxes() . "
" ); - $wgOut->addHTML( " -
-
- " . $this->getToggle( "hideminor" ) . - $this->getToggle( "usenewrc" ) . " -
-
- -
- $srh -
-
-
- -
- $dsn - $ps -
-
- " ); + ###################################################################### # Various checkbox options # - $wgOut->addHTML("
"); + $s=""; foreach ( $togs as $tname => $ttext ) { if( !array_key_exists( $tname, $this->mUsedToggles ) ) { - $wgOut->addHTML( $this->getToggle( $tname ) ); + $s .= $this->getToggle( $tname ) ; } } - $wgOut->addHTML( "
\n\n" ); + $cardset->addCard( wfMsg("misc"), $s ); + + $cardset->renderToOutpage( $wgOut ); $wgOut->addHTML( "
diff --git a/includes/TabbedCardSet.php b/includes/TabbedCardSet.php new file mode 100644 index 0000000000..e9a10b1d9b --- /dev/null +++ b/includes/TabbedCardSet.php @@ -0,0 +1,74 @@ +
\n"; + + for ( $i=0; $imLabels ); $i++ ) + { + $s .= "

". + $this->mLabels[$i] . "

" . $this->mBodies[$i] . "
\n\n"; + } + $s .= "
\n\n
\n
    \n"; + + for ( $i=0; $imLabels ); $i++ ) + { + $selected = ($i==0 ? "class=\"selected\"" : ""); + $s .= "
  • ". + $this->mLabels[$i] . "
  • "; + } + + $s .= "
\n\n"; + + $out->addScript(" + + " ); + + $out->setOnloadHandler( $out->getOnloadHandler() . "inittabs();" ); + $out->addHTML( $s ); + } + +} // end of: class CardSet + +?> diff --git a/languages/LanguageDe.php b/languages/LanguageDe.php index 0c930e9a13..1562a4efe8 100644 --- a/languages/LanguageDe.php +++ b/languages/LanguageDe.php @@ -38,9 +38,9 @@ if($wgMetaNamespace === FALSE) ); /* private */ $wgMathNamesDe = array( - "Immer als PNG", - "Einfaches TeX als HTML, sonst PNG", - "HTML wenn möglich, sonst PNG", + "Immer als PNG darstellen", + "Einfaches TeX als HTML darstellen, sonst PNG", + "Wenn möglich als HTML darstellen, sonst PNG", "Als TeX belassen (für Textbrowser)", "Empfehlenswert für moderne Browser" ); @@ -507,7 +507,7 @@ Ihre interne ID-Nummer ist $2.", "qbsettings" => "Seitenleiste", "changepassword" => "Passwort ändern", "skin" => "Skin", -"math" => "TeX darstellen", +"math" => "TeX", "dateformat" => "Datumsformat", "math_failure" => "Parser-Fehler", "math_unknown_error" => "Unbekannter Fehler", diff --git a/stylesheets/monobook/main.css b/stylesheets/monobook/main.css index 83c7290d86..0bfe935dab 100644 --- a/stylesheets/monobook/main.css +++ b/stylesheets/monobook/main.css @@ -686,6 +686,8 @@ li#pt-login { list-style: none; font-size: 95%; } + + #p-cactions .hiddenStructure { display: none; } #p-cactions ul { list-style: none; @@ -714,6 +716,10 @@ li#pt-login { z-index: 0; margin: 0; } +#bar #p-cactions { + top: 8.0em; + left: 5em; +} #p-cactions .selected a { z-index: 3; } #p-cactions .new a { color:#ba0000; } #p-cactions li a:hover { @@ -731,6 +737,9 @@ li#pt-login { li#ca-talk { margin-right: 1.6em; } li#ca-watch { margin-left: 1.6em; } +form #content { + left: -8em; +} /* ** the remaining portlets diff --git a/templates/xhtml_slim.pt b/templates/xhtml_slim.pt index f255a4df0c..fb53223185 100644 --- a/templates/xhtml_slim.pt +++ b/templates/xhtml_slim.pt @@ -16,9 +16,10 @@ + ${customscript} - +