summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-03-20 14:59:55 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-03-20 14:59:55 +0000
commit48c022e8cbcc027cec20aa0b6657a2c784df5ad8 (patch)
treebc061c16abe10d96f387394af44804857dbe8ed6
parentacfb81d940a50ec018613946e30f63c623b8c5db (diff)
Rather than moving the themeroller and all of its associated files
into each theme. I chose to create methods Theme_View::file($path) and Admin_View::file($path). These methods check for a theme override file in the theme and return a link to it if it exists. So to override the themeroller files. just create a lib/themeroller in the theme and the files will be picked up.
-rw-r--r--core/libraries/Admin_View.php5
-rw-r--r--core/libraries/Theme_View.php6
-rw-r--r--themes/admin_default/views/admin.html.php16
-rw-r--r--themes/default/views/login_page.html.php16
-rw-r--r--themes/default/views/page.html.php16
5 files changed, 34 insertions, 25 deletions
diff --git a/core/libraries/Admin_View.php b/core/libraries/Admin_View.php
index 9ca585d2..e88b01ee 100644
--- a/core/libraries/Admin_View.php
+++ b/core/libraries/Admin_View.php
@@ -45,6 +45,11 @@ class Admin_View_Core extends View {
return $absolute_url ? url::abs_file($arg) : url::file($arg);
}
+ public function file($path) {
+ $theme_path = "themes/{$this->theme_name}/$path";
+ return url::file(file_exists($theme_path) ? $theme_path : $path);
+ }
+
public function display($page_name, $view_class="View") {
return new $view_class($page_name);
}
diff --git a/core/libraries/Theme_View.php b/core/libraries/Theme_View.php
index 84d86b0b..fba61afe 100644
--- a/core/libraries/Theme_View.php
+++ b/core/libraries/Theme_View.php
@@ -46,7 +46,6 @@ class Theme_View_Core extends View {
if ($maintenance_mode) {
message::warning(t("This site is currently in maintenance mode"));
}
-
}
public function url($path, $absolute_url=false) {
@@ -54,6 +53,11 @@ class Theme_View_Core extends View {
return $absolute_url ? url::abs_file($arg) : url::file($arg);
}
+ public function file($path) {
+ $theme_path = "themes/{$this->theme_name}/$path";
+ return url::file(file_exists($theme_path) ? $theme_path : $path);
+ }
+
public function item() {
return $this->item;
}
diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php
index 55f0f884..d56015db 100644
--- a/themes/admin_default/views/admin.html.php
+++ b/themes/admin_default/views/admin.html.php
@@ -6,11 +6,11 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>G3: 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") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->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") ?>"
+ <link rel="stylesheet" type="text/css" type="text/css" href="<?= $theme->file("lib/themeroller/ui.base.css") ?>"
media="screen,projection" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->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" />
@@ -20,11 +20,11 @@
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
- <script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/gallery.dialog.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery.form.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/gallery.dialog.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/jquery.dropshadow.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/ui.init.js") ?>" type="text/javascript"></script>
<?= $theme->admin_head() ?>
diff --git a/themes/default/views/login_page.html.php b/themes/default/views/login_page.html.php
index 1bd76c18..933a8bc2 100644
--- a/themes/default/views/login_page.html.php
+++ b/themes/default/views/login_page.html.php
@@ -8,11 +8,11 @@
<?= t("Please Login to Gallery") ?>
</title>
<link rel="shortcut icon" href="<?= $theme->url("images/favicon.ico") ?>" type="image/x-icon" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/reset-fonts-grids.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->file("lib/yui/reset-fonts-grids.css") ?>"
media="screen,print,projection" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->file("lib/superfish/css/superfish.css") ?>"
media="screen" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/themeroller/ui.base.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->file("lib/themeroller/ui.base.css") ?>"
media="screen,print,projection" />
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/screen.css") ?>"
media="screen,print,projection" />
@@ -20,11 +20,11 @@
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
- <script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/gallery.dialog.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery.form.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/gallery.dialog.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/ui.init.js") ?>" type="text/javascript"></script>
<script>
$("#gLoginLink").ready(function() {
diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php
index 893e6f9b..076643d6 100644
--- a/themes/default/views/page.html.php
+++ b/themes/default/views/page.html.php
@@ -15,11 +15,11 @@
<? endif ?>
</title>
<link rel="shortcut icon" href="<?= $theme->url("images/favicon.ico") ?>" type="image/x-icon" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/reset-fonts-grids.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->file("lib/yui/reset-fonts-grids.css") ?>"
media="screen,print,projection" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->file("lib/superfish/css/superfish.css") ?>"
media="screen" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/themeroller/ui.base.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->file("lib/themeroller/ui.base.css") ?>"
media="screen,print,projection" />
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/screen.css") ?>"
media="screen,print,projection" />
@@ -27,11 +27,11 @@
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
- <script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/gallery.dialog.js") ?>" type="text/javascript"></script>
- <script src="<?= url::file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery.form.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/gallery.dialog.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/jquery.scrollTo.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/jquery.localscroll.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/ui.init.js") ?>" type="text/javascript"></script>