Permalink
Browse files

change the block_manager api so that the theme is passed into the get…

… method. convert info to the new sidebar block approach
  • Loading branch information...
1 parent 39a40e4 commit 19cb27c9a4489c357c0e516c69ebcb218f8832c1 @talmdal talmdal committed Sep 29, 2009
View
4 modules/gallery/helpers/block_manager.php
@@ -60,12 +60,12 @@ private static function _get_blocks($function) {
return $blocks;
}
- static function get_html($location) {
+ static function get_html($location, $theme) {
$active = self::get_active($location);
$result = "";
foreach ($active as $id => $desc) {
if (method_exists("$desc[0]_block", "get")) {
- $block = call_user_func(array("$desc[0]_block", "get"), $desc[1]);
+ $block = call_user_func(array("$desc[0]_block", "get"), $desc[1], $theme);
$block->id = $id;
$result .= $block;
}
View
3 modules/gallery/libraries/Theme_View.php
@@ -157,7 +157,7 @@ public function messages() {
* Print out the sidebar.
*/
public function sidebar_blocks() {
- return block_manager::get_html("site.sidebar");
+ return block_manager::get_html("site.sidebar", $this);
}
/**
@@ -183,7 +183,6 @@ public function __call($function, $args) {
case "photo_top":
case "resize_bottom":
case "resize_top":
- case "sidebar_blocks":
case "sidebar_bottom":
case "sidebar_top":
case "thumb_bottom":
View
2 modules/image_block/helpers/image_block_block.php
@@ -22,7 +22,7 @@ static function get_site_list() {
return array("random_image" => t("Random Image"));
}
- static function get($block_id) {
+ static function get($block_id, $theme) {
$block = new Block();
switch ($block_id) {
case "random_image":
View
39 modules/info/helpers/info_block.php
@@ -0,0 +1,39 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class info_block_Core {
+ static function get_site_list() {
+ return array("metadata" => t("Metadata"));
+ }
+
+ static function get($block_id, $theme) {
+ $block = new Block();
+ switch ($block_id) {
+ case "metadata":
+ if ($theme->item()) {
+ $block = new Block();
+ $block->css_id = "gMetadata";
+ $block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info");
+ $block->content = new View("info_block.html");
+ }
+ break;
+ }
+ return $block;
+ }
+}
View
32 modules/info/helpers/info_installer.php
@@ -0,0 +1,32 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class info_installer {
+ static function install() {
+ block_manager::add("site.sidebar", "info", "metadata");
+ module::set_version("info", 2);
+ }
+
+ static function upgrade($version) {
+ if ($version == 1) {
+ block_manager::add("site.sidebar", "info", "metadata");
+ module::set_version("info", 2);
+ }
+ }
+}
View
10 modules/info/helpers/info_theme.php
@@ -18,16 +18,6 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class info_theme_Core {
- static function sidebar_blocks($theme) {
- if ($theme->item()) {
- $block = new Block();
- $block->css_id = "gMetadata";
- $block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info");
- $block->content = new View("info_block.html");
- return $block;
- }
- }
-
static function thumb_info($theme, $item) {
$results = "";
if ($item->view_count) {
View
2 modules/info/module.info
@@ -1,3 +1,3 @@
name = "Info"
description = "Display extra information about photos and albums"
-version = 1
+version = 2

0 comments on commit 19cb27c

Please sign in to comment.