From 60d35b89929d9029c794f72d6a9c38b676e282f6 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 30 Sep 2009 07:31:11 -0700 Subject: Use the block_manager to manage site sidebar panels. Fixes ticket #110. * Extend block_manager to handle sidebar blocks. get_available has become get_available_admin_blocks, get_list becomes get_admin_list. * Create new functions get_available_site_blocks which will look for gallery_block get_available_site_blocks. * Refactor sidebar_blocks into a separate function and then call block_manager::get_html(site.sidebar). Convert image_block to use block management instead of theme::sidebar_blocks * Change the block_manager api so that the theme is passed into the get method. convert info to the new sidebar block approach * Convert the user module to use the new sidebar block structure. remove the installers for info and image_block modules. * Convert tag and rss modules to the new sidebar framework. reset the version number to 1 for info and image_block modules. * Change the get_html method to ignore empty blocks and change the individual handlers to return an empty string if no block is generated * Add a warning message if no sidebar blocks are active and provide a link to the admin page that configures the sidebar. --- modules/gallery/controllers/admin_sidebar.php | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 modules/gallery/controllers/admin_sidebar.php (limited to 'modules/gallery/controllers/admin_sidebar.php') diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php new file mode 100644 index 00000000..7e71426a --- /dev/null +++ b/modules/gallery/controllers/admin_sidebar.php @@ -0,0 +1,28 @@ +content = new View("admin_sidebar.html"); + print $view; + } + +} + -- cgit v1.2.3 From 4de412e72270587cbd656ebafe08892344055a4d Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 30 Sep 2009 14:25:33 -0700 Subject: Enable the administration screen for the sidebar. Fix for ticket #110. --- modules/gallery/controllers/admin_sidebar.php | 39 ++++++++++++++++++ modules/gallery/helpers/gallery_event.php | 6 ++- modules/gallery/views/admin_sidebar.html.php | 47 +++++++++++++++++++--- .../gallery/views/admin_sidebar_blocks.html.php | 5 +++ themes/admin_wind/css/screen.css | 28 +++++++++++++ 5 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 modules/gallery/views/admin_sidebar_blocks.html.php (limited to 'modules/gallery/controllers/admin_sidebar.php') diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index 7e71426a..f029d259 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -21,8 +21,47 @@ class Admin_Sidebar_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->content = new View("admin_sidebar.html"); + $view->content->csrf = access::csrf_token(); + $view->content->available = new View("admin_sidebar_blocks.html"); + $view->content->active = new View("admin_sidebar_blocks.html"); + list($view->content->available->blocks, $view->content->active->blocks) = $this->_get_blocks(); print $view; } + public function update() { + access::verify_csrf(); + + $available_blocks = block_manager::get_available_site_blocks(); + + $active_blocks = array(); + foreach ($this->input->get("block", array()) as $block_id) { + $active_blocks[] = explode(":", (string) $block_id); + } + block_manager::set_active("site.sidebar", $active_blocks); + + $result = array("result" => "success"); + list($available, $active) = $this->_get_blocks(); + $v = new View("admin_sidebar_blocks.html"); + $v->blocks = $available; + $result["available"] = $v->render(); + $v = new View("admin_sidebar_blocks.html"); + $v->blocks = $active; + $result["active"] = $v->render(); + + print json_encode($result); + } + + private function _get_blocks() { + $active_blocks = array(); + $available_blocks = block_manager::get_available_site_blocks(); + 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]; + unset($available_blocks[$id]); + } + } + return array($available_blocks, $active_blocks); + } } diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 9305580f..69458e74 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -171,7 +171,11 @@ class gallery_event_Core { ->append(Menu::factory("link") ->id("theme_options") ->label(t("Theme Options")) - ->url(url::site("admin/theme_options")))) + ->url(url::site("admin/theme_options"))) + ->append(Menu::factory("link") + ->id("sidebar") + ->label(t("Manage Sidebar")) + ->url(url::site("admin/sidebar")))) ->append(Menu::factory("submenu") ->id("statistics_menu") ->label(t("Statistics"))) diff --git a/modules/gallery/views/admin_sidebar.html.php b/modules/gallery/views/admin_sidebar.html.php index 32386f5d..62b59ac1 100644 --- a/modules/gallery/views/admin_sidebar.html.php +++ b/modules/gallery/views/admin_sidebar.html.php @@ -1,9 +1,46 @@ - -

+ +

- -
-
\ No newline at end of file +
"> +
+

+
+
    + +
+
+
+
+

+
+
    + +
+
+
+
diff --git a/modules/gallery/views/admin_sidebar_blocks.html.php b/modules/gallery/views/admin_sidebar_blocks.html.php new file mode 100644 index 00000000..a1a71743 --- /dev/null +++ b/modules/gallery/views/admin_sidebar_blocks.html.php @@ -0,0 +1,5 @@ + + + $text): ?> +
  • + diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index 737c5939..c733b482 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -656,6 +656,34 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser { background: #ffc; } +/* admin/sidebar ~~~~~~~~~~~~~~~~~~~~~~~~~ */ +.gAdminBlocksList { + float: left; + height: 300px; + margin-left: 20px; + width: 30%; +} + +.gAdminBlocksList div:last-child { + border: .1em solid; + height: 100%; + overflow-y: auto; +} + +.gAdminBlocksList ul { + margin: .1em .1em; + padding: .1em; +} + +.gAdminBlocksList ul li { + background-color: #e8e8e8; + font-size: 1em; + font-weight: bold; + margin: .5em; + padding: .3em .8em; +} + + /** ******************************************************************* * 5) Navigation and menus *********************************************************************/ -- cgit v1.2.3 From 367e6a8983a6d0fbd76fd36b6627e8adc35332da Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Thu, 22 Oct 2009 22:06:36 -0600 Subject: Standardize message markup, make the update block status message translatable. --- modules/gallery/controllers/admin_sidebar.php | 3 ++- modules/gallery/views/admin_sidebar.html.php | 8 +++++--- modules/tag/js/tag.js | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'modules/gallery/controllers/admin_sidebar.php') diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index f029d259..c83b5a37 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -47,7 +47,8 @@ class Admin_Sidebar_Controller extends Admin_Controller { $v = new View("admin_sidebar_blocks.html"); $v->blocks = $active; $result["active"] = $v->render(); - + $message = t("Updated sidebar blocks"); + $result["message"] = (string) $message; print json_encode($result); } diff --git a/modules/gallery/views/admin_sidebar.html.php b/modules/gallery/views/admin_sidebar.html.php index 67752f75..7c97270c 100644 --- a/modules/gallery/views/admin_sidebar.html.php +++ b/modules/gallery/views/admin_sidebar.html.php @@ -21,10 +21,12 @@ if (data.result == "success") { $("ul#g-available-blocks").html(data.available); $("ul#g-active-blocks").html(data.active); - var message = for_js() ?>; $("#g-action-status").remove(); - $("#g-block-admin").before("
    • " + message + "
    "); - $("#g-action-status").fadeTo(1000,1).fadeTo(2000,0); + var message = "
      "; + message += "
    • " + data.message + "
    • "; + message += "
    "; + $("#g-block-admin").before(message); + $("#g-action-status li").gallery_show_message(); } }); } diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index ed977480..8cb4e571 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -72,7 +72,10 @@ function editInPlace(element) { $("#g-rename-tag-form #name") .addClass("g-error") .focus(); - $("#g-tag-admin").before("

    " + data.message + "

    "); + var message = "
      "; + message += "
    • " + data.message + "
    • "; + message += "
    "; + $("#g-tag-admin").before(message); } } }); -- cgit v1.2.3 From a5a8cfd1bc7cd03c224c731c3ff433eec033457d Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 12 Nov 2009 13:08:29 -0800 Subject: Re-generate the install.sql so that the keys of the block lists are an md5 hash of the module_name:block_id. Also change the packager so we delete the _cache variable for the module gallery not core. --- installer/install.sql | 10 +++++----- modules/comment/helpers/comment_installer.php | 1 - modules/gallery/controllers/admin_sidebar.php | 2 +- modules/gallery/controllers/packager.php | 14 ++------------ 4 files changed, 8 insertions(+), 19 deletions(-) (limited to 'modules/gallery/controllers/admin_sidebar.php') diff --git a/installer/install.sql b/installer/install.sql index 617d89ff..1f6014a7 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -366,7 +366,7 @@ CREATE TABLE {vars} ( `value` text, PRIMARY KEY (`id`), UNIQUE KEY `module_name` (`module_name`,`name`) -) AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; INSERT INTO {vars} VALUES (1,'gallery','active_site_theme','wind'); INSERT INTO {vars} VALUES (2,'gallery','active_admin_theme','admin_wind'); @@ -376,15 +376,15 @@ INSERT INTO {vars} VALUES (5,'gallery','resize_size','640'); INSERT INTO {vars} VALUES (6,'gallery','default_locale','en_US'); INSERT INTO {vars} VALUES (7,'gallery','image_quality','75'); INSERT INTO {vars} VALUES (8,'gallery','image_sharpen','15'); -INSERT INTO {vars} VALUES (10,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}'); +INSERT INTO {vars} VALUES (10,'gallery','blocks_dashboard_sidebar','a:4:{s:32:\"ea6daed3baa18234bb574af71ab42250\";a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}s:32:\"f566a858e4b0238c0429d7b03b9f136f\";a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}s:32:\"4a3e6ed692f52ff14fbc0bfb94a1a130\";a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}s:32:\"53c72b14ba93d7f23d0efb72cc4d7cd1\";a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}'); INSERT INTO {vars} VALUES (22,'gallery','show_credits','1'); INSERT INTO {vars} VALUES (23,'gallery','credits','Powered by Gallery %version'); INSERT INTO {vars} VALUES (20,'gallery','date_time_format','Y-M-d H:i:s'); INSERT INTO {vars} VALUES (21,'gallery','time_format','H:i:s'); -INSERT INTO {vars} VALUES (15,'gallery','blocks_dashboard_center','a:4:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}i:9;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'); +INSERT INTO {vars} VALUES (15,'gallery','blocks_dashboard_center','a:3:{s:32:\"0fb54e06307c0ec68ff9494082191235\";a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}s:32:\"f76ac022796947436740be2144b6d776\";a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}s:32:\"42a3ca45d2397f2d3e59dacae4caf3e0\";a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}'); INSERT INTO {vars} VALUES (18,'gallery','choose_default_tookit','1'); INSERT INTO {vars} VALUES (19,'gallery','date_format','Y-M-d'); INSERT INTO {vars} VALUES (26,'user','mininum_password_length','5'); +INSERT INTO {vars} VALUES (27,'comment','spam_caught','0'); INSERT INTO {vars} VALUES (25,'gallery','identity_provider','user'); -INSERT INTO {vars} VALUES (28,'comment','spam_caught','0'); -INSERT INTO {vars} VALUES (30,'gallery','blocks_site.sidebar','a:3:{s:32:\"6e901fd82a43b0e07ebbd7123b5ee349\";a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}s:32:\"c07f62cf746316b111a61681fe49ad39\";a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}s:32:\"2eef3fd349091e4e1cee9e27072bff39\";a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); +INSERT INTO {vars} VALUES (29,'gallery','blocks_site.sidebar','a:3:{s:32:\"6e901fd82a43b0e07ebbd7123b5ee349\";a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}s:32:\"c07f62cf746316b111a61681fe49ad39\";a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}s:32:\"2eef3fd349091e4e1cee9e27072bff39\";a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php index 80594c16..707a98d1 100644 --- a/modules/comment/helpers/comment_installer.php +++ b/modules/comment/helpers/comment_installer.php @@ -46,7 +46,6 @@ class comment_installer { PRIMARY KEY (`id`)) DEFAULT CHARSET=utf8;"); - block_manager::add("dashboard_center", "comment", "recent_comments"); module::set_var("comment", "spam_caught", 0); module::set_version("comment", 2); } diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index c83b5a37..6c8d15f1 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -35,7 +35,7 @@ class Admin_Sidebar_Controller extends Admin_Controller { $active_blocks = array(); foreach ($this->input->get("block", array()) as $block_id) { - $active_blocks[] = explode(":", (string) $block_id); + $active_blocks[md5($block_id)] = explode(":", (string) $block_id); } block_manager::set_active("site.sidebar", $active_blocks); diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php index ae87d74b..f0e35b2d 100644 --- a/modules/gallery/controllers/packager.php +++ b/modules/gallery/controllers/packager.php @@ -62,6 +62,7 @@ class Packager_Controller extends Controller { srand(0); gallery_installer::install(true); + module::load_modules(); foreach (array("user", "comment", "organize", "info", "rss", @@ -72,21 +73,10 @@ class Packager_Controller extends Controller { } private function _dump_database() { - // 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("blocks_dashboard_sidebar", "blocks_dashboard_center") as $key) { - $blocks = array(); - foreach (unserialize(module::get_var("gallery", $key)) as $rnd => $value) { - $blocks[++$i] = $value; - } - module::set_var("gallery", $key, serialize($blocks)); - } - $db = Database::instance(); $db->query("TRUNCATE {sessions}"); $db->query("TRUNCATE {logs}"); - $db->query("DELETE FROM {vars} WHERE `module_name` = 'core' AND `name` = '_cache'"); + $db->query("DELETE FROM {vars} WHERE `module_name` = 'gallery' AND `name` = '_cache'"); $db->update("users", array("password" => ""), array("id" => 1)); $db->update("users", array("password" => ""), array("id" => 2)); -- cgit v1.2.3 From 0fe32a61f6c55e1302e45358375bf69a161ccdd4 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 13 Nov 2009 13:56:05 -0800 Subject: Standardize the name of the blocks. --- installer/install.sql | 4 ++-- modules/gallery/controllers/admin_sidebar.php | 4 ++-- modules/gallery/controllers/packager.php | 2 +- modules/gallery/helpers/block_manager.php | 4 ++-- modules/gallery/helpers/gallery_installer.php | 30 +++++++++++++++++---------- modules/gallery/libraries/Theme_View.php | 2 +- modules/gallery/module.info | 2 +- 7 files changed, 28 insertions(+), 20 deletions(-) (limited to 'modules/gallery/controllers/admin_sidebar.php') diff --git a/installer/install.sql b/installer/install.sql index 0fd3601a..38851eff 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -228,7 +228,7 @@ CREATE TABLE {modules} ( UNIQUE KEY `name` (`name`) ) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO {modules} VALUES (1,1,'gallery',18); +INSERT INTO {modules} VALUES (1,1,'gallery',19); INSERT INTO {modules} VALUES (2,1,'user',2); INSERT INTO {modules} VALUES (3,1,'comment',2); INSERT INTO {modules} VALUES (4,1,'organize',1); @@ -387,4 +387,4 @@ INSERT INTO {vars} VALUES (18,'gallery','choose_default_tookit','1'); INSERT INTO {vars} VALUES (26,'user','mininum_password_length','5'); INSERT INTO {vars} VALUES (27,'comment','spam_caught','0'); INSERT INTO {vars} VALUES (25,'gallery','identity_provider','user'); -INSERT INTO {vars} VALUES (29,'gallery','blocks_site.sidebar','a:3:{i:9;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:10;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:11;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); +INSERT INTO {vars} VALUES (29,'gallery','blocks_site_sidebar','a:3:{i:9;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:10;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:11;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); 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 Gallery %version"); - 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 -- cgit v1.2.3