Index: trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.php |
— | — | @@ -43,11 +43,10 @@ |
44 | 44 | $wgAjaxExportList[] = "UW_GenericEditPage_emailSuggestion"; |
45 | 45 | |
46 | 46 | function UW_GenericEditPage_addJS( $out ) { |
47 | | - global $wgScriptPath; |
48 | | - $src = "$wgScriptPath/extensions/uniwiki/GenericEditPage/GenericEditPage.js"; |
49 | | - $out->addScript ( "<script type='text/javascript' src='$src'></script>" ); |
50 | | - $href = "$wgScriptPath/extensions/uniwiki/GenericEditPage/global.css"; |
51 | | - $out->addScript ( "<link rel='stylesheet' href='$href' />" ); |
| 47 | + global $wgExtensionAssetsPath; |
| 48 | + |
| 49 | + $out->addScriptFile( "$wgExtensionAssetsPath/uniwiki/GenericEditPage/GenericEditPage.js" ); |
| 50 | + $out->addExtensionStyle( "$wgExtensionAssetsPath/uniwiki/GenericEditPage/global.css" ); |
52 | 51 | return true; |
53 | 52 | } |
54 | 53 | |
— | — | @@ -342,7 +341,7 @@ |
343 | 342 | function UW_GenericEditPage_displayEditPage ( $editor, $out ) { |
344 | 343 | global $wgHooks, $wgParser, $wgTitle, $wgRequest, $wgUser, $wgCategoryBox, $wgSectionBox, $wgRequireCategory; |
345 | 344 | global $wgGenericEditPageClass, $wgSwitchMode, $wgGenericEditPageWhiteList, $wgAllowSimilarTitles; |
346 | | - global $wgAlwaysShowIntroSection; |
| 345 | + global $wgAlwaysShowIntroSection, $wgExtensionAssetsPath; |
347 | 346 | |
348 | 347 | // disable this whole thing on conflict and comment pages |
349 | 348 | if ( $editor->section == "new" || $editor->isConflict ) |
— | — | @@ -358,7 +357,6 @@ |
359 | 358 | * checkboxes later (after the edit form) */ |
360 | 359 | if ( $wgCategoryBox ) { |
361 | 360 | $catbox = UW_GenericEditPage_extractCategoriesIntoBox ( $text ); |
362 | | - $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'UW_GenericEditPage_addCssHookSidebar'; |
363 | 361 | } |
364 | 362 | |
365 | 363 | /* break the page up into sections by splitting |
— | — | @@ -366,10 +364,11 @@ |
367 | 365 | $nodes = preg_split( '/^(==?[^=].*)$/mi', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); |
368 | 366 | |
369 | 367 | // add css hooks only to the edit page |
370 | | - $wgHooks['SkinTemplateSetupPageCss'][] = 'UW_GenericEditPage_editPageCss'; |
| 368 | + $out->addExtensionStyle( "$wgExtensionAssetsPath/uniwiki/GenericEditPage/style.css" ); |
| 369 | + |
371 | 370 | $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'UW_GenericEditPage_addCssHookGenEd'; |
| 371 | + $wgHooks['OutputPageBodyAttributes'][] = 'UW_GenericEditPage_onOutputPageBodyAttributes'; |
372 | 372 | |
373 | | - |
374 | 373 | /* the current contents of the page we are |
375 | 374 | * editing will be broken up into $page(and |
376 | 375 | * combined with $layout, later on) */ |
— | — | @@ -676,22 +675,30 @@ |
677 | 676 | * special class to the <body> tag, to make targetting our css easier |
678 | 677 | * (also add a hook if we just switched modes, to hide the preview) */ |
679 | 678 | function UW_GenericEditPage_addCssHookGenEd ( &$sktemplate, &$tpl ) { |
680 | | - global $wgGenericEditPageClass, $wgSwitchMode; |
| 679 | + global $wgGenericEditPageClass, $wgSwitchMode, $wgCategoryBox; |
| 680 | + |
681 | 681 | $tpl->data['pageclass'] .= " edit-$wgGenericEditPageClass"; |
682 | | - if ( $wgSwitchMode ) $tpl->data['pageclass'] .= " switching-mode"; |
| 682 | + if ( $wgSwitchMode ) { |
| 683 | + $tpl->data['pageclass'] .= ' switching-mode'; |
| 684 | + } |
| 685 | + if ( $wgCategoryBox ) { |
| 686 | + $tpl->data['pageclass'] .= ' with-sidebar'; |
| 687 | + } |
| 688 | + |
683 | 689 | return true; |
684 | 690 | } |
685 | | -function UW_GenericEditPage_addCssHookSidebar ( &$sktemplate, &$tpl ) { |
686 | | - global $wgGenericEditPageClass; |
687 | | - $tpl->data['pageclass'] .= " with-sidebar"; |
688 | | - return true; |
689 | | -} |
690 | 691 | |
| 692 | +function UW_GenericEditPage_onOutputPageBodyAttributes( $out, $sk, &$attr ) { |
| 693 | + global $wgGenericEditPageClass, $wgSwitchMode, $wgCategoryBox; |
691 | 694 | |
692 | | -// also attach our generic editor stylesheet |
693 | | -function UW_GenericEditPage_editPageCss ( &$out ) { |
694 | | - global $wgScriptPath; |
695 | | - $out .= "@import '$wgScriptPath/extensions/uniwiki/GenericEditPage/style.css';\n"; |
| 695 | + $attr['class'] .= " edit-$wgGenericEditPageClass"; |
| 696 | + if ( $wgSwitchMode ) { |
| 697 | + $attr['class'] .= ' switching-mode'; |
| 698 | + } |
| 699 | + if ( $wgCategoryBox ) { |
| 700 | + $attr['class'] .= ' with-sidebar'; |
| 701 | + } |
| 702 | + |
696 | 703 | return true; |
697 | 704 | } |
698 | 705 | |
Index: trunk/extensions/uniwiki/Layouts/Layouts.php |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | /* ---- HOOKS ---- */ |
63 | 63 | $wgHooks['CustomEditor'][] = "UW_Layouts_maybeRedirectToLayout"; |
64 | 64 | $wgHooks['UnknownAction'][] = "UW_Layouts_checkActionIsLayout"; |
65 | | -$wgHooks['SkinTemplateSetupPageCss'][] = "UW_Layouts_Css"; |
| 65 | +$wgHooks['BeforePageDisplay'][] = "UW_Layouts_Css"; |
66 | 66 | $wgHooks['EditFormPreloadText'][] = "UW_Layouts_preFillTextBox"; |
67 | 67 | |
68 | 68 | function UW_Layouts_maybeRedirectToLayout( $article, $user ) { |
— | — | @@ -232,9 +232,9 @@ |
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | | -function UW_Layouts_Css ( &$out ) { |
237 | | - global $wgScriptPath; |
238 | | - $out .= "@import '$wgScriptPath/extensions/uniwiki/Layouts/style.css';\n"; |
| 236 | +function UW_Layouts_Css ( $out, $sk ) { |
| 237 | + global $wgExtensionAssetsPath; |
| 238 | + $out->addExtensionStyle( "$wgExtensionAssetsPath/uniwiki/Layouts/style.css" ); |
239 | 239 | return true; |
240 | 240 | } |
241 | 241 | |