From: Michael M Slusarz Date: Mon, 22 Nov 2010 09:03:02 +0000 (-0700) Subject: Use Horde_Themes_Css to output stylesheets X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b67e085bc75067a181344d04d2688141a5116e3c;p=horde.git Use Horde_Themes_Css to output stylesheets --- diff --git a/ansel/faces/custom.php b/ansel/faces/custom.php index 5252a817c..95ac5745c 100644 --- a/ansel/faces/custom.php +++ b/ansel/faces/custom.php @@ -73,6 +73,8 @@ Horde::addScriptFile('dragdrop.js', 'horde'); Horde::addScriptFile('cropper.js'); Horde::addScriptFile('stripe.js', 'horde'); +$injector->getInstance('Horde_Themes_Css')->addThemeStylesheet('cropper.css'); + require ANSEL_TEMPLATES . '/common-header.inc'; echo Horde::menu(); $notification->notify(array('listeners' => 'status')); diff --git a/ansel/image.php b/ansel/image.php index 88969615a..56701a7db 100644 --- a/ansel/image.php +++ b/ansel/image.php @@ -324,7 +324,8 @@ case 'resizeedit': Horde::addScriptFile('controls.js', 'horde'); Horde::addScriptFile('dragdrop.js', 'horde'); Horde::addScriptFile('cropper.js'); - Ansel::attachStylesheet('cropper.css'); + + $GLOBALS['injector']->getInstance('Horde_Themes_Css')->addThemeStylesheet('cropper.css'); } elseif ($actionID == 'resizeedit') { /* js and css files */ // TODO: Combine these cases diff --git a/ansel/lib/Ansel.php b/ansel/lib/Ansel.php index 68ac64625..d0b6db860 100644 --- a/ansel/lib/Ansel.php +++ b/ansel/lib/Ansel.php @@ -733,55 +733,6 @@ class Ansel } /** - * Add a custom stylesheet to the current page. Need our own implementation - * since we want to be able to ouput specific CSS files at specific times - * (like when rendering embedded content, or calling via the api etc...). - * - * @param string $stylesheet The stylesheet to add. A path relative - * to $themesfs - * @param boolean $link Immediately output the CSS link - */ - static public function attachStylesheet($stylesheet, $link = false) - { - $GLOBALS['ansel_stylesheets'][] = $stylesheet; - if ($link) { - Ansel::stylesheetLinks(true); - } - } - - /** - * Output the stylesheet links - * - * @param boolean $custom_only Don't include ansel's base CSS file - */ - static public function stylesheetLinks($custom_only = false) - { - /* Custom CSS */ - $themesuri = $GLOBALS['registry']->get('themesuri', 'ansel'); - $themesfs = $GLOBALS['registry']->get('themesfs', 'ansel'); - $css = array(); - - if (!empty($GLOBALS['ansel_stylesheets'])) { - foreach ($GLOBALS['ansel_stylesheets'] as $css_file) { - $css[$themesfs . '/' . $css_file] = Horde::url($themesuri . '/' . $css_file, true); - } - } - - /* Use Horde's stylesheet code if we aren't ouputting css directly */ - if (!$custom_only) { - foreach ($css as $f => $u) { - $GLOBALS['injector']->getInstance('Horde_Themes_Css')->addStylesheet($f, $u); - } - - Horde::includeStylesheetFiles(); - } else { - foreach ($css as $u) { - echo '' . "\n"; - } - } - } - - /** * Get a date parts array containing only enough date parts for the depth * we are at. If an empty array is passed, attempt to get the parts from * url parametrs. Any missing date parts must be set to 0. diff --git a/ansel/lib/View/EmbeddedRenderer/GalleryLink.php b/ansel/lib/View/EmbeddedRenderer/GalleryLink.php index c0640a95f..4694b326c 100644 --- a/ansel/lib/View/EmbeddedRenderer/GalleryLink.php +++ b/ansel/lib/View/EmbeddedRenderer/GalleryLink.php @@ -83,8 +83,15 @@ class Ansel_View_EmbeddedRenderer_GalleryLink extends Ansel_View_Gallery } $json = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImageJson($images, null, true, $thumbsize, true); + $GLOBALS['injector']->getInstance('Horde_Themes_Css')->addThemeStylesheet('jsembed.css'); + Horde::startBuffer(); + Horde::includeStylesheetFiles(array( + 'nobase' => true, + 'nohorde' => true + )); + $css = Horde::endBuffer(); + /* Some paths */ - $cssurl = Horde::url($GLOBALS['registry']->get('themesuri', 'ansel') . '/jsembed.css', true); $js_path = $GLOBALS['registry']->get('jsuri', 'horde'); $pturl = Horde::url($js_path . '/prototype.js', true); $ansel_js_path = $GLOBALS['registry']->get('jsuri', 'ansel'); @@ -106,7 +113,7 @@ class Ansel_View_EmbeddedRenderer_GalleryLink extends Ansel_View_Gallery } anselnodes = new Array(); anseljson = new Object(); - document.write(''); + document.write('$css'); document.write(''); } anselnodes[anselnodes.length] = '$node'; diff --git a/ansel/lib/View/EmbeddedRenderer/Mini.php b/ansel/lib/View/EmbeddedRenderer/Mini.php index ec0766974..402a40e03 100644 --- a/ansel/lib/View/EmbeddedRenderer/Mini.php +++ b/ansel/lib/View/EmbeddedRenderer/Mini.php @@ -80,9 +80,10 @@ class Ansel_View_EmbeddedRenderer_Mini extends Ansel_View_Gallery $json_full = $GLOBALS['injector']->getInstance('Ansel_Injector_Factory_Storage')->create()->getImageJson($images, null, true, 'screen', true); } + $horde_css = $GLOBALS['injector']->getInstance('Horde_Themes_Css'); + $horde_css->addThemeStylesheet('embed.css'); + /* Some paths */ - $cssurl = Horde::url($GLOBALS['registry']->get('themesuri', 'ansel') . '/embed.css', true); - $hcssurl = Horde::url($GLOBALS['registry']->get('themesuri', 'horde') . '/embed.css', true); $js_path = $GLOBALS['registry']->get('jsuri', 'horde'); $pturl = Horde::url($js_path . '/prototype.js', true); $hjsurl = Horde::url($js_path . '/tooltips.js', true); @@ -94,9 +95,15 @@ class Ansel_View_EmbeddedRenderer_Mini extends Ansel_View_Gallery if (!empty($this->_params['lightbox'])) { $effectsurl = Horde::url($js_path . '/effects.js', true); $lbjsurl = Horde::url($ansel_js_path . '/lightbox.js', true); - $lbcssurl = Horde::url($GLOBALS['registry']->get('themesuri', 'ansel') . '/lightbox.css', true); + $horde_css->addThemeStylesheet('lightbox.css'); } + Horde::startBuffer(); + Horde::includeStylesheetFiles(array( + 'nobase' => true + )); + $css = Horde::endBuffer(); + /* Start building the javascript */ $html = <<'); - document.write(''); } anselnodes = new Array(); anseljson = new Object(); - document.write(''); + document.write('$cssurl'); document.write(''); } anselnodes[anselnodes.length] = '$node'; @@ -143,7 +149,6 @@ EOT; if (typeof lbOptions == 'undefined') { document.write(''); - document.write(''); lbOptions = { fileLoadingImage: '$loading_img', diff --git a/ansel/lib/View/GalleryRenderer/GalleryLightbox.php b/ansel/lib/View/GalleryRenderer/GalleryLightbox.php index b9820f7bc..5e91c9d03 100644 --- a/ansel/lib/View/GalleryRenderer/GalleryLightbox.php +++ b/ansel/lib/View/GalleryRenderer/GalleryLightbox.php @@ -32,7 +32,7 @@ class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRende // Attach the script and CSS files here if we aren't being called via the api if (empty($this->view->api)) { - Ansel::attachStylesheet('lightbox.css'); + $GLOBALS['injector']->getInstance('Horde_Themes_Css')->addThemeStylesheet('lightbox.css'); Horde::addScriptFile('effects.js', 'horde'); Horde::addScriptFile('lightbox.js', 'ansel'); Horde::addScriptFile('popup.js', 'horde'); @@ -135,7 +135,8 @@ class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRende } /* Output js/css here if we are calling via the api */ if ($this->view->api) { - Ansel::attachStylesheet('lightbox.css', true); + $injector->getInstance('Horde_Themes_Css')->addThemeStylesheet('lightbox.css'); + Horde::includeStylesheetFiles(array('nobase' => true)); $includes = $GLOBALS['injector']->createInstance('Horde_Script_Files'); $includes->add('accesskeys.js', 'horde', true, true); $includes->add('effects.js', 'horde', true, true); diff --git a/ansel/templates/common-header.inc b/ansel/templates/common-header.inc index a607aee27..5b1ea0b90 100644 --- a/ansel/templates/common-header.inc +++ b/ansel/templates/common-header.inc @@ -20,7 +20,7 @@ if (!empty($title)) { Horde::outputMetaTags(); Horde::includeScriptFiles(); Horde::includeFavicon(); -echo Ansel::stylesheetLinks(); +Horde::includeStylesheetFiles(); echo Horde::wrapInlineScript(Ansel::initJSVars()); Horde::outputInlineScript(); diff --git a/ansel/templates/faces/custom.inc b/ansel/templates/faces/custom.inc index c0d8696c6..00908c102 100755 --- a/ansel/templates/faces/custom.inc +++ b/ansel/templates/faces/custom.inc @@ -1,5 +1,4 @@

- '); - document.write(''); } kronolith = new Object(); kronolithNodes = new Array(); document.write(''); - document.write(''); + document.write('$css'); } kronolithNodes[kronolithNodes.length] = '$container'; kronolith['$container'] = "$results"; diff --git a/mnemo/lib/Block/summary.php b/mnemo/lib/Block/summary.php index f64a59725..c380653cc 100644 --- a/mnemo/lib/Block/summary.php +++ b/mnemo/lib/Block/summary.php @@ -110,11 +110,9 @@ class Horde_Block_Mnemo_summary extends Horde_Block return '

' . _("No notes to display") . '

'; } - return '' - . '' . $html + $GLOBALS['injector']->getInstance('Horde_Themes_Css')->addThemeStylesheet('categoryCSS.php'); + + return '
' . $html . '
'; } diff --git a/mnemo/templates/common-header.inc b/mnemo/templates/common-header.inc index 38a167b1e..9d604b5a6 100644 --- a/mnemo/templates/common-header.inc +++ b/mnemo/templates/common-header.inc @@ -21,7 +21,7 @@ Horde::outputMetaTags(); Horde::includeScriptFiles(); Horde::includeFavicon(); -$injector->getInstance('Horde_Themes_Css')->addStylesheet($registry->get('themesfs') . '/categoryCSS.php', $registry->get('themesuri') . '/categoryCSS.php'); +$injector->getInstance('Horde_Themes_Css')->addThemeStylesheet('categoryCSS.php'); Horde::includeStylesheetFiles(); $bc = $prefs->getValue('show_panel') diff --git a/nag/lib/Block/summary.php b/nag/lib/Block/summary.php index b0ad2ad54..8b667b69b 100644 --- a/nag/lib/Block/summary.php +++ b/nag/lib/Block/summary.php @@ -247,11 +247,9 @@ class Horde_Block_nag_summary extends Horde_Block return '' . _("No tasks to display") . ''; } - return '' - . '' + $GLOBALS['injector']->getInstance('Horde_Themes_Css')->addThemeStylesheet('categoryCSS.php'); + + return '
' . $html . '
'; } diff --git a/nag/templates/common-header.inc b/nag/templates/common-header.inc index c839b9a43..b4d2aa3b9 100644 --- a/nag/templates/common-header.inc +++ b/nag/templates/common-header.inc @@ -23,7 +23,7 @@ Horde::includeScriptFiles(); Horde::outputInlineScript(); Horde::includeFavicon(); -$injector->getInstance('Horde_Themes_Css')->addStylesheet($registry->get('themesfs') . '/categoryCSS.php', $registry->get('themesuri') . '/categoryCSS.php'); +$injector->getInstance('Horde_Themes_Css')->addThemeStylesheet('categoryCSS.php'); Horde::includeStylesheetFiles(); $bc = $prefs->getValue('show_panel') diff --git a/trean/templates/common-header.inc b/trean/templates/common-header.inc index af19b5f07..8585ce47e 100644 --- a/trean/templates/common-header.inc +++ b/trean/templates/common-header.inc @@ -21,7 +21,7 @@ Horde::outputMetaTags(); Horde::includeScriptFiles(); Horde::includeFavicon(); -$injector->getInstance('Horde_Themes_Css')->addStylesheet($registry->get('themesfs') . '/grids-min.css', $registry->get('themesuri') . '/grids-min.css'); +$injector->getInstance('Horde_Themes_Css')->addThemeStylesheet('grids-min.css'); Horde::includeStylesheetFiles(); $rss = Horde::url('rss.php', true, -1);