1
0

Update all head() and admin_head() theme calls to return the results of

the $theme->css() and $theme->script() calls so that if a theme does not
do script/css combining they'll still print out the appropriate <script>
and <link> elements.

See https://sourceforge.net/apps/trac/gallery/ticket/1611
This commit is contained in:
Bharat Mediratta 2011-01-15 13:31:02 -08:00
parent 48ef12f9ff
commit 13e0d4aea4
35 changed files with 79 additions and 77 deletions

View File

@ -20,7 +20,7 @@
class basket_theme_Core { class basket_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("basket.css"); return $theme->css("basket.css");
} }
static function header_top($theme) { static function header_top($theme) {

View File

@ -20,6 +20,6 @@
class calendarview_theme_Core { class calendarview_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("calendarview_menu.css"); return $theme->css("calendarview_menu.css");
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class downloadalbum_theme { class downloadalbum_theme {
static function head($theme) { static function head($theme) {
$theme->css("downloadalbum_menu.css"); return $theme->css("downloadalbum_menu.css");
} }
} }

View File

@ -20,7 +20,7 @@
class downloadfullsize_theme { class downloadfullsize_theme {
static function head($theme) { static function head($theme) {
if ($theme->item && access::can("view_full", $theme->item)) { if ($theme->item && access::can("view_full", $theme->item)) {
$theme->css("downloadfullsize_menu.css"); return $theme->css("downloadfullsize_menu.css");
} }
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class ecard_theme_Core { class ecard_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("ecard.css"); return $theme->css("ecard.css");
} }
} }

View File

@ -25,7 +25,7 @@ class editcreation_theme_Core {
} }
$item = $theme->item(); $item = $theme->item();
if ( $item && access::can("edit", $item) ) { if ( $item && access::can("edit", $item) ) {
$theme->css("editcreation.css"); return $theme->css("editcreation.css");
} }
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class exif_gps_theme_Core { class exif_gps_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("exif_gps_menu.css"); return $theme->css("exif_gps_menu.css");
} }
} }

View File

@ -19,8 +19,8 @@
*/ */
class favourites_theme_Core { class favourites_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("favourites.css"); return $theme->css("favourites.css")
$theme->script("favourites.js"); . $theme->script("favourites.js");
} }
static function header_top($theme) { static function header_top($theme) {

View File

@ -19,8 +19,8 @@
*/ */
class highroller_theme_Core { class highroller_theme_Core {
static function head($theme) { static function head($theme) {
$theme->script("highroller.js"); return $theme->script("highroller.js")
printf("<script type=\"text/javascript\"> var PICK_THEME_URL = '%s'; </script>", url::site("highroller/pick_theme")); . sprintf("<script type=\"text/javascript\"> var PICK_THEME_URL = '%s'; </script>", url::site("highroller/pick_theme"));
} }
static function header_top($theme) { static function header_top($theme) {

View File

@ -3,6 +3,6 @@
class Kbd_Nav_theme_Core { class Kbd_Nav_theme_Core {
static function head($theme) { static function head($theme) {
$theme->script("kbd_nav.js"); return $theme->script("kbd_nav.js");
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class language_flags_theme_Core { class language_flags_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("language_flags_sidebar.css"); return $theme->css("language_flags_sidebar.css");
} }
} }

View File

@ -36,8 +36,6 @@ class navcarousel_theme_Core {
}\n"; }\n";
} }
$thumbsize = module::get_var("navcarousel", "thumbsize", "50"); $thumbsize = module::get_var("navcarousel", "thumbsize", "50");
$theme->script("jquery.jcarousel.min.js");
$theme->css("skin.css");
$showelements = module::get_var("navcarousel", "showelements", "7"); $showelements = module::get_var("navcarousel", "showelements", "7");
$childcount = $theme->item->parent()->viewable()->children_count(); $childcount = $theme->item->parent()->viewable()->children_count();
$itemoffset = intval(floor($showelements / 2)); $itemoffset = intval(floor($showelements / 2));
@ -64,7 +62,10 @@ class navcarousel_theme_Core {
$onwinload = "});\n $onwinload = "});\n
$(window).load(function () {\n"; $(window).load(function () {\n";
} }
Return "\n<!-- Navcaoursel --> return
$theme->script("jquery.jcarousel.min.js")
. $theme->css("skin.css")
. "\n<!-- Navcarousel -->
<style type=\"text/css\">\n <style type=\"text/css\">\n
". $containerwidth ." ". $containerwidth ."
.jcarousel-skin-tango .jcarousel-clip-horizontal {\n .jcarousel-skin-tango .jcarousel-clip-horizontal {\n

View File

@ -19,14 +19,14 @@
*/ */
class photoannotation_theme_Core { class photoannotation_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("photoannotation.css"); $v = $theme->css("photoannotation.css");
if ($theme->page_subtype == "photo") { if ($theme->page_subtype == "photo") {
$theme->script("jquery.annotate.min.js"); $v .= $theme->script("jquery.annotate.min.js");
$noborder = module::get_var("photoannotation", "noborder", false); $noborder = module::get_var("photoannotation", "noborder", false);
$noclickablehover = module::get_var("photoannotation", "noclickablehover", false); $noclickablehover = module::get_var("photoannotation", "noclickablehover", false);
$nohover = module::get_var("photoannotation", "nohover", false); $nohover = module::get_var("photoannotation", "nohover", false);
$bordercolor = "#". module::get_var("photoannotation", "bordercolor", "000000"); $bordercolor = "#". module::get_var("photoannotation", "bordercolor", "000000");
$v = "<style type=\"text/css\">\n"; $v .= "<style type=\"text/css\">\n";
$v .= ".photoannotation-del-button {\n $v .= ".photoannotation-del-button {\n
border:1px solid ". $bordercolor ." !important;\n border:1px solid ". $bordercolor ." !important;\n
}\n"; }\n";
@ -73,8 +73,8 @@ class photoannotation_theme_Core {
static function admin_head($theme) { static function admin_head($theme) {
if (strpos($theme->content->kohana_filename, "admin_photoannotation.html.php")) { if (strpos($theme->content->kohana_filename, "admin_photoannotation.html.php")) {
$theme->css("colorpicker.css"); return $theme->css("colorpicker.css")
$theme->script("jquery.colorpicker.min.js"); . $theme->script("jquery.colorpicker.min.js");
} }
} }

View File

@ -19,9 +19,8 @@
*/ */
class sharephoto_theme_Core { class sharephoto_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("sharephoto.css"); return $theme->css("sharephoto.css") .
$theme->script("sharephoto.js"); $theme->script("sharephoto.js");
return "";
} }

View File

@ -19,7 +19,7 @@
*/ */
class tag_cloud_theme_Core { class tag_cloud_theme_Core {
static function head($theme) { static function head($theme) {
$theme->script("swfobject.js"); return $theme->script("swfobject.js")
$theme->script("tag_cloud.js"); . $theme->script("tag_cloud.js");
} }
} }

View File

@ -20,6 +20,6 @@
class tagsmap_theme_Core { class tagsmap_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("tagsmap_menu.css"); return $theme->css("tagsmap_menu.css");
} }
} }

View File

@ -19,9 +19,10 @@
*/ */
class videos_theme_Core { class videos_theme_Core {
static function head($theme) { static function head($theme) {
$buf = "";
if (identity::active_user()->admin) { if (identity::active_user()->admin) {
$theme->css("videos.css"); $buf .= $theme->css("videos.css");
$theme->script("videos.js"); $buf .= $theme->script("videos.js");
} }
$item = $theme->item(); $item = $theme->item();
@ -32,24 +33,24 @@ class videos_theme_Core {
if ($items_video->loaded()) { if ($items_video->loaded()) {
$view = new View("videos_display_js.html"); $view = new View("videos_display_js.html");
//$view->embed_code = addslashes($embedded_video->embed_code); //$view->embed_code = addslashes($embedded_video->embed_code);
return $view; return $buf . $view;
} }
} }
} }
static function admin_head($theme) { static function admin_head($theme) {
$head = array(); $buf = "";
if (strpos(Router::$current_uri, "admin/videos") !== false) { if (strpos(Router::$current_uri, "admin/videos") !== false) {
$theme->css("videos.css"); $buf .= $theme->css("videos.css");
$theme->css("jquery.autocomplete.css"); $buf .= $theme->css("jquery.autocomplete.css");
$base = url::site("__ARGS__"); $base = url::site("__ARGS__");
$csrf = access::csrf_token(); $csrf = access::csrf_token();
$head[] = "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>"; $buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
$theme->script("jquery.autocomplete.js"); $buf .= $theme->script("jquery.autocomplete.js");
$theme->script("admin_videos.js"); $buf .= $theme->script("admin_videos.js");
} }
return implode("\n", $head); return $buf;
} }
} }

View File

@ -20,7 +20,7 @@
class basket_theme_Core { class basket_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("basket.css"); return $theme->css("basket.css");
} }
static function header_top($theme) { static function header_top($theme) {
@ -37,7 +37,7 @@ class basket_theme_Core {
static function admin_head($theme) { static function admin_head($theme) {
if (strpos(Router::$current_uri, "admin/product_lines") !== false) { if (strpos(Router::$current_uri, "admin/product_lines") !== false) {
$theme->script("gallery.panel.js"); return $theme->script("gallery.panel.js");
} }
} }
static function photo_top($theme){ static function photo_top($theme){

View File

@ -19,6 +19,6 @@
*/ */
class bitly_theme_Core { class bitly_theme_Core {
static function head($theme) { static function head($theme) {
$theme->script("bitly.js"); return $theme->script("bitly.js");
} }
} }

View File

@ -20,6 +20,6 @@
class calendarview_theme_Core { class calendarview_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("calendarview_menu.css"); return $theme->css("calendarview_menu.css");
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class downloadalbum_theme { class downloadalbum_theme {
static function head($theme) { static function head($theme) {
$theme->css("downloadalbum_menu.css"); return $theme->css("downloadalbum_menu.css");
} }
} }

View File

@ -20,7 +20,7 @@
class downloadfullsize_theme { class downloadfullsize_theme {
static function head($theme) { static function head($theme) {
if ($theme->item && access::can("view_full", $theme->item)) { if ($theme->item && access::can("view_full", $theme->item)) {
$theme->css("downloadfullsize_menu.css"); return $theme->css("downloadfullsize_menu.css");
} }
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class ecard_theme_Core { class ecard_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("ecard.css"); return $theme->css("ecard.css");
} }
} }

View File

@ -25,7 +25,7 @@ class editcreation_theme_Core {
} }
$item = $theme->item(); $item = $theme->item();
if ( $item && access::can("edit", $item) ) { if ( $item && access::can("edit", $item) ) {
$theme->css("editcreation.css"); return $theme->css("editcreation.css");
} }
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class exif_gps_theme_Core { class exif_gps_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("exif_gps_menu.css"); return $theme->css("exif_gps_menu.css");
} }
} }

View File

@ -19,8 +19,8 @@
*/ */
class favourites_theme_Core { class favourites_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("favourites.css"); return $theme->css("favourites.css")
$theme->script("favourites.js"); . $theme->script("favourites.js");
} }
static function header_top($theme) { static function header_top($theme) {

View File

@ -19,8 +19,8 @@
*/ */
class highroller_theme_Core { class highroller_theme_Core {
static function head($theme) { static function head($theme) {
$theme->script("highroller.js"); return $theme->script("highroller.js")
printf("<script type=\"text/javascript\"> var PICK_THEME_URL = '%s'; </script>", url::site("highroller/pick_theme")); . sprintf("<script type=\"text/javascript\"> var PICK_THEME_URL = '%s'; </script>", url::site("highroller/pick_theme"));
} }
static function header_top($theme) { static function header_top($theme) {

View File

@ -3,6 +3,6 @@
class Kbd_Nav_theme_Core { class Kbd_Nav_theme_Core {
static function head($theme) { static function head($theme) {
$theme->script("kbd_nav.js"); return $theme->script("kbd_nav.js");
} }
} }

View File

@ -19,6 +19,6 @@
*/ */
class language_flags_theme_Core { class language_flags_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("language_flags_sidebar.css"); return $theme->css("language_flags_sidebar.css");
} }
} }

View File

@ -36,8 +36,6 @@ class navcarousel_theme_Core {
}\n"; }\n";
} }
$thumbsize = module::get_var("navcarousel", "thumbsize", "50"); $thumbsize = module::get_var("navcarousel", "thumbsize", "50");
$theme->script("jquery.jcarousel.min.js");
$theme->css("skin.css");
$showelements = module::get_var("navcarousel", "showelements", "7"); $showelements = module::get_var("navcarousel", "showelements", "7");
$childcount = $theme->item->parent()->viewable()->children_count(); $childcount = $theme->item->parent()->viewable()->children_count();
$itemoffset = intval(floor($showelements / 2)); $itemoffset = intval(floor($showelements / 2));
@ -64,7 +62,10 @@ class navcarousel_theme_Core {
$onwinload = "});\n $onwinload = "});\n
$(window).load(function () {\n"; $(window).load(function () {\n";
} }
Return "\n<!-- Navcaoursel --> return
$theme->script("jquery.jcarousel.min.js")
. $theme->css("skin.css")
. "\n<!-- Navcarousel -->
<style type=\"text/css\">\n <style type=\"text/css\">\n
". $containerwidth ." ". $containerwidth ."
.jcarousel-skin-tango .jcarousel-clip-horizontal {\n .jcarousel-skin-tango .jcarousel-clip-horizontal {\n

View File

@ -19,14 +19,14 @@
*/ */
class photoannotation_theme_Core { class photoannotation_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("photoannotation.css"); $v = $theme->css("photoannotation.css");
if ($theme->page_subtype == "photo") { if ($theme->page_subtype == "photo") {
$theme->script("jquery.annotate.min.js"); $v .= $theme->script("jquery.annotate.min.js");
$noborder = module::get_var("photoannotation", "noborder", false); $noborder = module::get_var("photoannotation", "noborder", false);
$noclickablehover = module::get_var("photoannotation", "noclickablehover", false); $noclickablehover = module::get_var("photoannotation", "noclickablehover", false);
$nohover = module::get_var("photoannotation", "nohover", false); $nohover = module::get_var("photoannotation", "nohover", false);
$bordercolor = "#". module::get_var("photoannotation", "bordercolor", "000000"); $bordercolor = "#". module::get_var("photoannotation", "bordercolor", "000000");
$v = "<style type=\"text/css\">\n"; $v .= "<style type=\"text/css\">\n";
$v .= ".photoannotation-del-button {\n $v .= ".photoannotation-del-button {\n
border:1px solid ". $bordercolor ." !important;\n border:1px solid ". $bordercolor ." !important;\n
}\n"; }\n";
@ -73,8 +73,8 @@ class photoannotation_theme_Core {
static function admin_head($theme) { static function admin_head($theme) {
if (strpos($theme->content->kohana_filename, "admin_photoannotation.html.php")) { if (strpos($theme->content->kohana_filename, "admin_photoannotation.html.php")) {
$theme->css("colorpicker.css"); return $theme->css("colorpicker.css")
$theme->script("jquery.colorpicker.min.js"); . $theme->script("jquery.colorpicker.min.js");
} }
} }

View File

@ -19,9 +19,8 @@
*/ */
class sharephoto_theme_Core { class sharephoto_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("sharephoto.css"); return $theme->css("sharephoto.css")
$theme->script("sharephoto.js"); . $theme->script("sharephoto.js");
return "";
} }

View File

@ -19,7 +19,7 @@
*/ */
class tag_cloud_theme_Core { class tag_cloud_theme_Core {
static function head($theme) { static function head($theme) {
$theme->script("swfobject.js"); return $theme->script("swfobject.js")
$theme->script("tag_cloud.js"); . $theme->script("tag_cloud.js");
} }
} }

View File

@ -20,6 +20,6 @@
class tagsmap_theme_Core { class tagsmap_theme_Core {
static function head($theme) { static function head($theme) {
$theme->css("tagsmap_menu.css"); return $theme->css("tagsmap_menu.css");
} }
} }

View File

@ -19,9 +19,10 @@
*/ */
class videos_theme_Core { class videos_theme_Core {
static function head($theme) { static function head($theme) {
$buf = "";
if (identity::active_user()->admin) { if (identity::active_user()->admin) {
$theme->css("videos.css"); $buf .= $theme->css("videos.css");
$theme->script("videos.js"); $buf .= $theme->script("videos.js");
} }
$item = $theme->item(); $item = $theme->item();
@ -32,24 +33,24 @@ class videos_theme_Core {
if ($items_video->loaded()) { if ($items_video->loaded()) {
$view = new View("videos_display_js.html"); $view = new View("videos_display_js.html");
//$view->embed_code = addslashes($embedded_video->embed_code); //$view->embed_code = addslashes($embedded_video->embed_code);
return $view; return $buf . $view;
} }
} }
} }
static function admin_head($theme) { static function admin_head($theme) {
$head = array(); $buf = "";
if (strpos(Router::$current_uri, "admin/videos") !== false) { if (strpos(Router::$current_uri, "admin/videos") !== false) {
$theme->css("videos.css"); $buf .= $theme->css("videos.css");
$theme->css("jquery.autocomplete.css"); $buf .= $theme->css("jquery.autocomplete.css");
$base = url::site("__ARGS__"); $base = url::site("__ARGS__");
$csrf = access::csrf_token(); $csrf = access::csrf_token();
$head[] = "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>"; $buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
$theme->script("jquery.autocomplete.js"); $buf .= $theme->script("jquery.autocomplete.js");
$theme->script("admin_videos.js"); $buf .= $theme->script("admin_videos.js");
} }
return implode("\n", $head); return $buf;
} }
} }