moved user css setup to skinphptal, no hardcoded ?
authorGabriel Wicke <gwicke@users.mediawiki.org>
Thu, 29 Apr 2004 10:56:32 +0000 (10:56 +0000)
committerGabriel Wicke <gwicke@users.mediawiki.org>
Thu, 29 Apr 2004 10:56:32 +0000 (10:56 +0000)
includes/SkinPHPTal.php
templates/xhtml_slim.pt

index 25eb0d6..6de4a21 100644 (file)
                        
                        extract( $wgRequest->getValues( 'oldid', 'diff' ) );
 
+                       $this->initPage( $out );
+                       $tpl = new PHPTAL($this->template . '.pt', 'templates');
+                       
+                       #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
+                       $tpl->setTranslator(new MediaWiki_I18N());
+                       #}
+                       
                        $this->thispage = $wgTitle->getPrefixedDbKey();
                        $this->thisurl = $wgTitle->getPrefixedURL();
                        $this->thisurle = urlencode($this->thisurl);
                        $this->username = $wgUser->getName();
                        $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
                        $this->userpageurl = $this->makeUrl($this->userpage);
-                       $this->userpageurle = htmlspecialchars($this->userpageurl);
-                       $this->titletxt = $wgTitle->getPrefixedText();
                        
-                       $this->initPage( $out );
-                       $tpl = new PHPTAL($this->template . '.pt', 'templates');
+                       if( $this->loggedin ) {
+                               $this->usercss = $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css');
+                               $this->usercsse = htmlspecialchars($this->usercss);
+                               $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
+                               $this->userjse = htmlspecialchars($this->userjs);
+                       } else {
+                               $this->usercss = $this->usercsse =  $this->userjs = $this->userjse = false;
+                       }
+                       $this->titletxt = $wgTitle->getPrefixedText();
                        
-                       #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
-                       $tpl->setTranslator(new MediaWiki_I18N());
-                       #}
-
                        $tpl->set( "title", $wgOut->getPageTitle() );
                        $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
                        
                        $tpl->setRef( "username", &$this->username );
                        $tpl->setRef( "userpage", &$this->userpage);
                        $tpl->setRef( "userpageurl", &$this->userpageurl);
-                       $tpl->setRef( "userpageurle", &$this->userpageurle);
+                       $tpl->setRef( "usercss", &$this->usercss);
+                       $tpl->setRef( "usercsse", &$this->usercsse);
+                       $tpl->setRef( "userjs", &$this->userjs);
+                       $tpl->setRef( "userjse", &$this->userjse);
                        if( $wgUser->getNewtalk() ) {
                                $usertitle = Title::newFromText( $this->userpage );
                                $usertalktitle = $usertitle->getTalkPage();
index 86d0a5c..f04dfef 100644 (file)
     <script type="text/javascript"> /*<![CDATA[*/ if(addcss){addcss('${stylepath}/${skinname}/');} /*]]>*/</script>
     <style tal:condition="rtl" type="text/css">/*<![CDATA[*/@import url(${stylepath}/${skinname}/rtl.css);/*]]>*/</style>
     <!-- user styles and js if logged in -->
-    <style tal:condition="loggedin" type="text/css">/*<![CDATA[*/
-      @import url(${userpageurle}/${skinname}.css?action=raw&ctype=text/css); /*]]>*/</style>
-    <script tal:condition="loggedin" type="text/javascript" 
-      tal:attributes="src string:${userpageurle}/${skinname}.js?action=raw&ctype=text/javascript"></script>
+    <style tal:condition="usercsse" type="text/css">/*<![CDATA[*/
+      @import url(${usercsse}); /*]]>*/</style>
+    <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script>
   </head>
 
   <body tal:attributes="ondblclick body-ondblclick|default">