summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-11-14 11:51:20 -0800
committerBharat Mediratta <bharat@menalto.com>2009-11-14 11:51:20 -0800
commit594742b7d1c9960f08253411f3d7c08532bddd7f (patch)
treeaee12e2775ec7cd5b9e2b8e6e841793050e36b26
parentd12e3698e3e6a259f34ced2050e4343f54e130aa (diff)
parent670629fe10322ca3b996d2ec4206a1aa71ae449d (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
-rw-r--r--installer/install.sql14
-rw-r--r--modules/gallery/controllers/admin_sidebar.php4
-rw-r--r--modules/gallery/controllers/packager.php11
-rw-r--r--modules/gallery/helpers/block_manager.php20
-rw-r--r--modules/gallery/helpers/gallery_installer.php33
-rw-r--r--modules/gallery/libraries/Theme_View.php2
-rw-r--r--modules/gallery/module.info2
-rw-r--r--modules/gallery/views/simple_uploader.html.php15
8 files changed, 69 insertions, 32 deletions
diff --git a/installer/install.sql b/installer/install.sql
index 1f6014a7..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',17);
+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);
@@ -366,7 +366,7 @@ CREATE TABLE {vars} (
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY `module_name` (`module_name`,`name`)
-) AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=35 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:{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 (21,'gallery','time_format','H:i:s');
INSERT INTO {vars} VALUES (22,'gallery','show_credits','1');
INSERT INTO {vars} VALUES (23,'gallery','credits','Powered by <a href=\"%url\">Gallery %version</a>');
+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 (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: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 (15,'gallery','blocks_dashboard_center','a:3:{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\";}}');
+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:{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:{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 f0e35b2d..82c3c938 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -73,6 +73,17 @@ 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("dashboard_sidebar", "dashboard_center", "site_sidebar") as $key) {
+ $blocks = array();
+ foreach (unserialize(module::get_var("gallery", "blocks_{$key}")) as $rnd => $value) {
+ $blocks[++$i] = $value;
+ }
+ module::set_var("gallery", "blocks_{$key}", serialize($blocks));
+ }
+
$db = Database::instance();
$db->query("TRUNCATE {sessions}");
$db->query("TRUNCATE {logs}");
diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php
index 980d1db5..b003f1d8 100644
--- a/modules/gallery/helpers/block_manager.php
+++ b/modules/gallery/helpers/block_manager.php
@@ -28,7 +28,7 @@ class block_manager_Core {
static function add($location, $module_name, $block_id) {
$blocks = self::get_active($location);
- $blocks[md5("$module_name:$block_id")] = array($module_name, $block_id);
+ $blocks[rand()] = array($module_name, $block_id);
self::set_active($location, $blocks);
}
@@ -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);
}
}
}
@@ -49,21 +49,29 @@ class block_manager_Core {
self::set_active($location, $blocks);
}
+ static function remove_blocks_for_module($location, $module_name) {
+ $blocks = self::get_active($location);
+ foreach ($blocks as $key => $block) {
+ if ($block[0] == $module_name) {
+ unset($blocks[$key]);
+ }
+ }
+ self::set_active($location, $blocks);
+ }
+
static function deactivate_blocks($module_name) {
$block_class = "{$module_name}_block";
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("site.sidebar", md5("$module_name:$block_id"));
+ self::remove_blocks_for_module("site_sidebar", $module_name);
}
}
if (method_exists($block_class, "get_admin_list")) {
$blocks = call_user_func(array($block_class, "get_admin_list"));
foreach (array("dashboard_sidebar", "dashboard_center") as $location) {
- foreach (array_keys($blocks) as $block_id) {
- self::remove($location, md5("$module_name:$block_id"));
- }
+ self::remove_blocks_for_module($location, $module_name);
}
}
}
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 26cd14f5..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", 17);
+ 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,15 +400,36 @@ 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);
+ 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) {
$blocks = block_manager::get_active($location);
$new_blocks = array();
foreach ($blocks as $block) {
- $new_blocks[md5("{$block[0]}:{$block[1]}")] = $block;
+ $new_blocks[rand()] = $block;
}
block_manager::set_active($location, $new_blocks);
}
- module::set_version("gallery", $version = 17);
+ 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);
}
}
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 2a35b809..2dc62ecd 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 17
+version = 19
diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php
index 8f296ab2..10e748b6 100644
--- a/modules/gallery/views/simple_uploader.html.php
+++ b/modules/gallery/views/simple_uploader.html.php
@@ -15,8 +15,8 @@
cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>",
buttonText: <?= t("Select Photos ...")->for_js() ?>,
simUploadLimit: 10,
- wmode: "transparent",
- hideButton: true,
+ //wmode: "transparent",
+ hideButton: false, /* should be true */
auto: true,
multi: true,
onAllComplete: function(filesUploaded, errors, allbytesLoaded, speed) {
@@ -81,8 +81,8 @@
// @todo figure out how to actually get the offset or why it comes back 0 0
var offset = $("#g-add-photos-button").offset();
- $("#g-uploadifyUploader").css({top: "97px", position: "absolute", left: "198px"});
- $("#g-add-photos-button").height("40px").width("120px");
+ //$("#g-uploadifyUploader").css({top: "97px", position: "absolute", left: "198px"});
+ //$("#g-add-photos-button").height("40px").width("120px");
});
</script>
@@ -115,11 +115,8 @@
</div>
<div id="g-add-photos-canvas" style="text-align: center;">
- <a id="g-add-photos-button" class="ui-corner-all" style="padding-bottom: 1em;" href="#"><?= t("Select Photos...") ?></a>
-
- <div id="g-uploadify"></div>
-
-
+ <!-- a id="g-add-photos-button" class="ui-corner-all" style="padding-bottom: 1em;" href="#"><?= t("Select Photos...") ?></a -->
+ <span id="g-uploadify"></span>
</div>
<div id="g-add-photos-status" style="text-align: center;">
<ul>