From 34c76c0906a639321dedfe0e77d9fd123ed7c792 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 29 Jun 2009 12:32:11 -0700 Subject: A Combined javascript seems to work. 1) CSS files are added to the combined version by use of $theme->css() or $theme->css_theme() methods 2) url references in the css are converted to full paths as opposed to relative 3) @import statements in the css are resolved as well. 4) need to move the [if IE] statements into the css files so the will be honored in the browser. currently the ie fix css are always included. --- modules/gallery/libraries/Admin_View.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/gallery/libraries/Admin_View.php') diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index 01496c0d..5e0d5feb 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -99,6 +99,7 @@ class Admin_View_Core extends Gallery_View { } if ($function == "admin_head") { + array_unshift($blocks, $this->combine_css()); array_unshift($blocks, $this->combine_script()); } -- cgit v1.2.3 From fa8ca2f7ad21980f0b45e7acc67be4be296f9f87 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 29 Jun 2009 18:12:53 -0700 Subject: Refactor combine_xxx() functions together into combine_files() and use html functions to generate the resulting elements. Add phpdoc. --- modules/gallery/controllers/combined.php | 2 + modules/gallery/libraries/Admin_View.php | 6 +-- modules/gallery/libraries/Gallery_View.php | 81 ++++++++++-------------------- modules/gallery/libraries/Theme_View.php | 4 +- 4 files changed, 34 insertions(+), 59 deletions(-) (limited to 'modules/gallery/libraries/Admin_View.php') diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php index f6c6d60b..9df74638 100644 --- a/modules/gallery/controllers/combined.php +++ b/modules/gallery/controllers/combined.php @@ -22,6 +22,7 @@ class Combined_Controller extends Controller { * Return the combined Javascript bundle associated with the given key. */ public function javascript($key) { + $key = substr($key, 0, strlen($key) - 3); // strip off the trailing .js return $this->_emit("javascript", $key); } @@ -29,6 +30,7 @@ class Combined_Controller extends Controller { * Return the combined CSS bundle associated with the given key. */ public function css($key) { + $key = substr($key, 0, strlen($key) - 4); // strip off the trailing .css return $this->_emit("css", $key); } diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index 5e0d5feb..f7de96bf 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -98,9 +98,9 @@ class Admin_View_Core extends Gallery_View { } } - if ($function == "admin_head") { - array_unshift($blocks, $this->combine_css()); - array_unshift($blocks, $this->combine_script()); + if ($function == "head") { + array_unshift($blocks, $this->combine_files($this->css, "css")); + array_unshift($blocks, $this->combine_files($this->css, "javascript")); } if (Session::instance()->get("debug")) { diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 9d4fe5c0..48cf8089 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -49,45 +49,6 @@ class Gallery_View_Core extends View { return $absolute_url ? url::abs_file($arg) : url::file($arg); } - /** - * Combine a series of Javascript files into a single one and cache it in the database, then - * return a single "; - } - /** * Add a css file to the combined css list. * @param $file the relative path to a script from the gallery3 directory @@ -107,12 +68,11 @@ class Gallery_View_Core extends View { } /** - * Combine a series of Javascript files into a single one and cache it in the database, then - * return a single