Skip to content

Commit

Permalink
Temporary checkin to allow merge with trunk... don't integrate
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Almdal committed Jun 29, 2009
1 parent d90e30c commit 42c82ef
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
29 changes: 28 additions & 1 deletion modules/gallery/libraries/Theme_View.php
Expand Up @@ -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.
Expand Down Expand Up @@ -172,6 +173,10 @@ public function script($file) {
$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.
Expand Down Expand Up @@ -211,6 +216,21 @@ private function _combine_script() {
"\"></script>";
}

/**
* 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.
*/
Expand Down Expand Up @@ -256,8 +276,14 @@ public function __call($function, $args) {
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;
Expand All @@ -271,6 +297,7 @@ public function __call($function, $args) {
}

if ($function == "head" || $function == "admin_head") {
array_unshift($blocks, $this->_combine_css());
array_unshift($blocks, $this->_combine_script());
}

Expand Down
3 changes: 1 addition & 2 deletions modules/organize/helpers/organize_theme.php
Expand Up @@ -22,7 +22,6 @@ static function head($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");
}
}
3 changes: 1 addition & 2 deletions modules/server_add/helpers/server_add_theme.php
Expand Up @@ -27,8 +27,7 @@ static function head($theme) {
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>";
Expand Down
16 changes: 1 addition & 15 deletions themes/admin_default/views/admin.html.php
Expand Up @@ -6,21 +6,7 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title><?= t("Admin Dashboard") ?></title>
<link rel="shortcut icon" href="<?= url::file("themes/default/images/favicon.ico") ?>" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/reset-fonts-grids.css") ?>"
media="screen,projection" />
<link rel="stylesheet" type="text/css" type="text/css" href="<?= url::file("lib/themeroller/ui.base.css") ?>"
media="screen,projection" />
<link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>"
media="screen,projection" />
<link rel="stylesheet" type="text/css" href="<?= url::file("themes/default/css/screen.css") ?>"
media="screen,projection" />
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/screen.css") ?>"
media="screen,projection" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
<?= $theme->admin_head() ?>
<?= $theme->admin_head() ?>
</head>

<body <?= $theme->body_attributes() ?>>
Expand Down

0 comments on commit 42c82ef

Please sign in to comment.