Changeset 542

Show
Ignore:
Timestamp:
2007-07-26 01:03:02 (18 months ago)
Author:
wwalc
Message:

added user css trick

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • MediaWiki/trunk/extensions/FCKeditor/FCKeditor.body.php

    r539 r542  
    258258        global $wgStylePath, $wgStyleVersion; 
    259259         
     260        print "ONEDIT!!!!!"; 
     261         
    260262        $options = new FCKeditorParserOptions(); 
    261263        $options->setTidy(true); 
     
    263265        $parser->setOutputType(OT_HTML); 
    264266        $form->textbox1 = $parser->parse($form->textbox1, $wgTitle, $options)->getText(); 
    265          
    266         $EditorAreaCSS = " "; 
    267         $EditorAreaCSS .= ""; 
    268         $EditorAreaCSS .= ""; 
    269         $EditorAreaCSS .= ""; 
    270         $EditorAreaCSS .= ""; 
    271         $EditorAreaCSS .= ""; 
    272          
     267                 
    273268        if (!$wgUser->getOption( 'showtoolbar' ) || $wgUser->getOption( 'riched_disable' )) { 
    274269            return true; 
     
    281276                $printsheet = htmlspecialchars( "$wgStylePath/common/wikiprintable.css?$wgStyleVersion" );               
    282277                 
     278                //CSS trick,  we need to get user CSS stylesheets somehow... it must be done in a different way! 
     279                $skin = $wgUser->getSkin(); 
     280                $skin->loggedin = $wgUser->isLoggedIn(); 
     281                $skin->mTitle =& $wgTitle; 
     282                $skin->skinname = 'monobook'; 
     283                $skin->userpage = $wgUser->getUserPage()->getPrefixedText(); 
     284                $skin->setupUserCss(); 
     285                 
     286                preg_match_all('/@import "([^"]+)";/', $skin->usercss, $matches); 
     287        $userStyles = $matches[1]; 
     288        //End of CSS trick 
    283289         
    284290        $script = <<<HEREDOC 
     
    292298<!--[if IE 7]><script type="text/javascript">sEditorAreaCSS += ',/mediawiki/skins/monobook/IE70Fixes.css?{$wgStyleVersion}'; </script><![endif]--> 
    293299<!--[if lt IE 7]><script type="text/javascript">sEditorAreaCSS += ',/mediawiki/skins/monobook/IEFixes.css?{$wgStyleVersion}'; </script><![endif]--> 
    294  
     300HEREDOC; 
     301 
     302        if (!is_null($userStyles) && !empty($userStyles)) { 
     303            $script .= ' 
     304<script type="text/javascript">  
     305sEditorAreaCSS += ",'.implode(',', $userStyles).'"; 
     306</script>'; 
     307        } 
     308         
     309        $script .= <<<HEREDOC 
    295310<script type="text/javascript">  
    296311function onLoadFCKeditor() 
     
    301316                oFCKeditor.BasePath = '$wgScriptPath/$wgFCKEditorDir/' ; 
    302317                oFCKeditor.Config['CustomConfigurationsPath'] = '$wgScriptPath/$wgFCKEditorExtDir/fckeditor_config.js' ; 
    303                 //oFCKeditor.Config['EditorAreaCSS'] = sEditorAreaCSS;         
    304                 //oFCKeditor.Config['EditorAreaCSS'] = '/mediawiki/allinone.css?{$wgStyleVersion}'; 
     318                oFCKeditor.Config['EditorAreaCSS'] = sEditorAreaCSS;         
    305319                oFCKeditor.Height = '$wgFCKEditorHeight' ; 
    306320                oFCKeditor.ToolbarSet = '$wgFCKEditorToolbarSet' ; 
    307321                oFCKeditor.ReplaceTextarea() ; 
    308322                document.getElementById('toolbar').style.cssText = 'display:none;' ; 
    309             //alert(oFCKeditor.Config['EditorAreaCSS']); 
    310323        } 
    311324}