summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-06-29 06:08:50 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-06-29 06:08:50 -0700
commit42c82ef7f081630c15a5d354205896764348a76a (patch)
tree81fcd4e1298a3b11d7f0b19e153999d5cacdb98d /modules
parentd90e30c37881d4e715b2c798046830242e382d1c (diff)
Temporary checkin to allow merge with trunk... don't integrate
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/libraries/Theme_View.php29
-rw-r--r--modules/organize/helpers/organize_theme.php3
-rw-r--r--modules/server_add/helpers/server_add_theme.php3
3 files changed, 30 insertions, 5 deletions
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 25818821..c5888b4a 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -20,6 +20,7 @@
class Theme_View_Core extends View {
private $theme_name = null;
private $scripts = array();
+ private $css = array();
/**
* Attempts to load a view and pre-load view data.
@@ -172,6 +173,10 @@ class Theme_View_Core extends View {
$this->scripts[$file] = 1;
}
+ public function css($file) {
+ $this->css[$file] = 1;
+ }
+
/**
* Combine a series of Javascript files into a single one and cache it in the database, then
* return a single <script> element to refer to it.
@@ -212,6 +217,21 @@ class Theme_View_Core extends View {
}
/**
+ * Combine a series of Javascript files into a single one and cache it in the database, then
+ * return a single <script> element to refer to it.
+ */
+ private function _combine_css() {
+ $links = array();
+ $key = "";
+ foreach (array_keys($this->css) as $file) {
+ $links[] = "<link media=\"screen, projection\" rel=\"stylesheet\" type=\"text/css\" href=\"" .
+ url::file($file) . "\" />";
+
+ }
+ return implode("\n", $links);
+ }
+
+ /**
* Handle all theme functions that insert module content.
*/
public function __call($function, $args) {
@@ -256,8 +276,14 @@ class Theme_View_Core extends View {
array("gallery_theme", $function),
array_merge(array($this), $args));
}
-
}
+
+ // Give the theme a chance to add its blocks
+ $helper_class = "{$this->theme_name}_theme";
+ $blocks[] = call_user_func_array(
+ array($helper_class, $function),
+ array_merge(array($this), $args));
+
foreach (module::active() as $module) {
if ($module->name == "gallery") {
continue;
@@ -271,6 +297,7 @@ class Theme_View_Core extends View {
}
if ($function == "head" || $function == "admin_head") {
+ array_unshift($blocks, $this->_combine_css());
array_unshift($blocks, $this->_combine_script());
}
diff --git a/modules/organize/helpers/organize_theme.php b/modules/organize/helpers/organize_theme.php
index cddc48b6..02f1f589 100644
--- a/modules/organize/helpers/organize_theme.php
+++ b/modules/organize/helpers/organize_theme.php
@@ -22,7 +22,6 @@ class organize_theme {
// @tdo remove the addition css and organize.js (just here to test)
$theme->script("modules/organize/js/organize_init.js");
$theme->script("modules/organize/js/organize.js");
- return "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("modules/organize/css/organize.css") . "\" />";
+ $theme->css("modules/organize/css/organize.css");
}
}
diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php
index 3df57ee4..02f99690 100644
--- a/modules/server_add/helpers/server_add_theme.php
+++ b/modules/server_add/helpers/server_add_theme.php
@@ -27,8 +27,7 @@ class server_add_theme_Core {
static function admin_head($theme) {
$head = array();
if (strpos(Router::$current_uri, "admin/server_add") !== false) {
- $head[] = "<link media=\"screen, projection\" rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("lib/jquery.autocomplete.css") . "\" />";
+ $theme->css("lib/jquery.autocomplete.css");
$base = url::site("__ARGS__");
$csrf = access::csrf_token();
$head[] = "<script> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";