From c4f991bb7d7e90f8c55897f89888d9196c7e438f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 19:45:11 -0700 Subject: Clean up the combined javascript change and refactor out the Gallery_View base class from Theme_View and Admin_View. 1) Move all the theme specific jquery stuff from gallery_theme::head() and admin_head() into the theme files. Use $theme->script() as appropriate. 2) Get rid of the extra boolean on $theme->url() that we were using so that we could call $theme->script($theme->url(...)) -- add $theme->theme_script() instead (poorly named, but still clearer than what we had before) 3) Fix the bug that combined scripts didn't work at all in the admin theme. 4) Get rid of $theme->display() in favor of new View(...) --- modules/gallery/libraries/Theme_View.php | 61 ++------------------------------ 1 file changed, 3 insertions(+), 58 deletions(-) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 25818821..8e320f44 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -17,10 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Theme_View_Core extends View { - private $theme_name = null; - private $scripts = array(); - +class Theme_View_Core extends Gallery_View { /** * Attempts to load a view and pre-load view data. * @@ -69,11 +66,6 @@ class Theme_View_Core extends View { return module::get_var("gallery", "thumb_size", 200) / 200; } - public function url($path, $absolute_url=false, $no_root=false) { - $arg = "themes/{$this->theme_name}/$path"; - return $absolute_url ? url::abs_file($arg) : $no_root ? $arg : url::file($arg); - } - public function item() { return $this->item; } @@ -86,10 +78,6 @@ class Theme_View_Core extends View { return $this->page_type; } - public function display($page_name, $view_class="View") { - return new $view_class($page_name); - } - public function site_menu() { $menu = Menu::factory("root"); if ($this->page_type != "login") { @@ -168,49 +156,6 @@ class Theme_View_Core extends View { return message::get(); } - public function script($file) { - $this->scripts[$file] = 1; - } - - /** - * Combine a series of Javascript files into a single one and cache it in the database, then - * return a single "; - } - /** * Handle all theme functions that insert module content. */ @@ -270,8 +215,8 @@ class Theme_View_Core extends View { } } - if ($function == "head" || $function == "admin_head") { - array_unshift($blocks, $this->_combine_script()); + if ($function == "head") { + array_unshift($blocks, $this->combine_script()); } if (Session::instance()->get("debug")) { -- cgit v1.2.3