diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-13 13:56:05 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-13 13:56:05 -0800 |
commit | 0fe32a61f6c55e1302e45358375bf69a161ccdd4 (patch) | |
tree | 96bed6d9a9aac02d700acb1e8932cfdaaf147718 /modules | |
parent | def88149ccf8b542b376b96dd25c52f2ec6920e1 (diff) |
Standardize the name of the blocks.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/controllers/admin_sidebar.php | 4 | ||||
-rw-r--r-- | modules/gallery/controllers/packager.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/block_manager.php | 4 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 30 | ||||
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 2 | ||||
-rw-r--r-- | modules/gallery/module.info | 2 |
6 files changed, 26 insertions, 18 deletions
diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index 6c8d15f1..77e83bc2 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -37,7 +37,7 @@ class Admin_Sidebar_Controller extends Admin_Controller { foreach ($this->input->get("block", array()) as $block_id) { $active_blocks[md5($block_id)] = explode(":", (string) $block_id); } - block_manager::set_active("site.sidebar", $active_blocks); + block_manager::set_active("site_sidebar", $active_blocks); $result = array("result" => "success"); list($available, $active) = $this->_get_blocks(); @@ -55,7 +55,7 @@ class Admin_Sidebar_Controller extends Admin_Controller { private function _get_blocks() { $active_blocks = array(); $available_blocks = block_manager::get_available_site_blocks(); - foreach (block_manager::get_active("site.sidebar") as $block) { + foreach (block_manager::get_active("site_sidebar") as $block) { $id = "{$block[0]}:{$block[1]}"; if (!empty($available_blocks[$id])) { $active_blocks[$id] = $available_blocks[$id]; diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php index b2550603..82c3c938 100644 --- a/modules/gallery/controllers/packager.php +++ b/modules/gallery/controllers/packager.php @@ -76,7 +76,7 @@ class Packager_Controller extends Controller { // We now have a clean install with just the packages that we want. Make sure that the // database is clean too. $i = 1; - foreach (array("dashboard_sidebar", "dashboard_center", "site.sidebar") as $key) { + foreach (array("dashboard_sidebar", "dashboard_center", "site_sidebar") as $key) { $blocks = array(); foreach (unserialize(module::get_var("gallery", "blocks_{$key}")) as $rnd => $value) { $blocks[++$i] = $value; diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php index d513abd9..b003f1d8 100644 --- a/modules/gallery/helpers/block_manager.php +++ b/modules/gallery/helpers/block_manager.php @@ -38,7 +38,7 @@ class block_manager_Core { if (method_exists($block_class, "get_site_list")) { $blocks = call_user_func(array($block_class, "get_site_list")); foreach (array_keys($blocks) as $block_id) { - self::add("site.sidebar", $module_name, $block_id); + self::add("site_sidebar", $module_name, $block_id); } } } @@ -64,7 +64,7 @@ class block_manager_Core { if (method_exists($block_class, "get_site_list")) { $blocks = call_user_func(array($block_class, "get_site_list")); foreach (array_keys($blocks) as $block_id) { - self::remove_blocks_for_module("site.sidebar", $module_name); + self::remove_blocks_for_module("site_sidebar", $module_name); } } diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 2d4a1e04..470c54cf 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -268,7 +268,7 @@ class gallery_installer { module::set_var("gallery", "show_credits", 1); // @todo this string needs to be picked up by l10n_scanner module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); - module::set_version("gallery", 18); + module::set_version("gallery", 19); } static function upgrade($version) { @@ -383,13 +383,13 @@ class gallery_installer { } if ($version == 14) { - $sidebar_blocks = block_manager::get_active("site.sidebar"); + $sidebar_blocks = block_manager::get_active("site_sidebar"); if (empty($sidebar_blocks)) { $available_blocks = block_manager::get_available_site_blocks(); foreach (array_keys(block_manager::get_available_site_blocks()) as $id) { $sidebar_blocks[] = explode(":", $id); } - block_manager::set_active("site.sidebar", $sidebar_blocks); + block_manager::set_active("site_sidebar", $sidebar_blocks); } module::set_version("gallery", $version = 15); } @@ -400,20 +400,18 @@ class gallery_installer { } if ($version == 16) { - foreach (array("dashboard_sidebar", "dashboard_center", "site.sidebar") as $location) { - $blocks = block_manager::get_active($location); - $new_blocks = array(); - foreach ($blocks as $block) { - $new_blocks[md5("{$block[0]}:{$block[1]}")] = $block; - } - block_manager::set_active($location, $new_blocks); + $blocks = block_manager::get_active($location); + $new_blocks = array(); + foreach ($blocks as $block) { + $new_blocks[md5("{$block[0]}:{$block[1]}")] = $block; } + block_manager::set_active($location, $new_blocks); module::set_version("gallery", $version = 17); } if ($version == 17) { // Once published we can't go back so reset the keys to a random to allow duplicates - foreach (array("dashboard_sidebar", "dashboard_center", "site.sidebar") as $location) { + foreach (array("dashboard_sidebar", "dashboard_center", "site_sidebar") as $location) { $blocks = block_manager::get_active($location); $new_blocks = array(); foreach ($blocks as $block) { @@ -423,6 +421,16 @@ class gallery_installer { } module::set_version("gallery", $version = 18); } + + if ($version == 18) { + // Once published we can't go back so reset the keys to a random to allow duplicates + foreach (array("dashboard_sidebar", "dashboard_center", "site_sidebar") as $location) { + $blocks = block_manager::get_active("site.sidebar"); + block_manager::set_active("site_sidebar", $blocks); + module::clear_var("gallery", "blocks_site.sidebar"); + } + module::set_version("gallery", $version = 19); + } } static function uninstall() { diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index f8fae0f7..7e6a0b2e 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -165,7 +165,7 @@ class Theme_View_Core extends Gallery_View { * Print out the sidebar. */ public function sidebar_blocks() { - $sidebar = block_manager::get_html("site.sidebar", $this); + $sidebar = block_manager::get_html("site_sidebar", $this); if (empty($sidebar) && identity::active_user()->admin) { $sidebar = new View("no_sidebar.html"); } diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 3a5d68b2..2dc62ecd 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 18 +version = 19 |