From 6f916e49d5b431c2c1961a13d1a61fef8c02d628 Mon Sep 17 00:00:00 2001 From: Andy Lindeman Date: Fri, 22 Apr 2011 18:15:17 -0400 Subject: Allow timezone to be configurable * Fixes #1637 * New advanced setting gallery/timezone * Default setting comes from PHP --- modules/gallery/config/locale.php | 8 ++------ modules/gallery/helpers/gallery_installer.php | 7 +++++++ modules/gallery/module.info | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'modules') diff --git a/modules/gallery/config/locale.php b/modules/gallery/config/locale.php index 0509e45f..13de9098 100644 --- a/modules/gallery/config/locale.php +++ b/modules/gallery/config/locale.php @@ -29,14 +29,10 @@ $config['language'] = array('en_US', 'English_United States'); /** - * Locale timezone. Defaults to use the server timezone. + * Locale timezone. Set in 'Advanced' settings, falling back to the server's zone. * @see http://php.net/timezones */ -$config['timezone'] = ini_get('date.timezone'); -if (empty($config['timezone'])) { - // This is a required field. Pick something as a default. - $config['timezone'] = "America/Los_Angeles"; -} +$config['timezone'] = module::get_var("gallery", "timezone", date_default_timezone_get()); // i18n settings diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 20de1fea..2cb04356 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -683,6 +683,13 @@ class gallery_installer { module::set_var("gallery", "apple_touch_icon_url", "lib/images/apple-touch-icon.png"); module::set_version("gallery", $version = 47); } + + if ($version == 47) { + // Add configuration variable to set timezone. Defaults to the currently + // used timezone (from PHP configuration). + module::set_var("gallery", "timezone", Kohana::config('locale.timezone')); + module::set_version("gallery", $version = 48); + } } static function uninstall() { diff --git a/modules/gallery/module.info b/modules/gallery/module.info index aa1dc341..807d08fd 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 47 +version = 48 -- cgit v1.2.3 From c2a38087dcd77bf8c1e7a5ff81692502bdb3ff59 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 22 Apr 2011 16:52:48 -0700 Subject: A few more fixes for #1637: - Update gallery_installer::install() to set the version to 48 and set the timezone - Rebuild installer.sql --- installer/install.sql | 143 +++++++++++++------------- modules/gallery/helpers/gallery_installer.php | 5 +- 2 files changed, 75 insertions(+), 73 deletions(-) (limited to 'modules') diff --git a/installer/install.sql b/installer/install.sql index ff29e1a0..de5250d1 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -1,6 +1,6 @@ DROP TABLE IF EXISTS {access_caches}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {access_caches} ( `id` int(9) NOT NULL AUTO_INCREMENT, `item_id` int(9) DEFAULT NULL, @@ -13,11 +13,11 @@ CREATE TABLE {access_caches} ( PRIMARY KEY (`id`), KEY `item_id` (`item_id`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0'); DROP TABLE IF EXISTS {access_intents}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {access_intents} ( `id` int(9) NOT NULL AUTO_INCREMENT, `item_id` int(9) DEFAULT NULL, @@ -31,11 +31,11 @@ CREATE TABLE {access_intents} ( `add_2` binary(1) DEFAULT NULL, PRIMARY KEY (`id`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {access_intents} VALUES (1,1,'1','1','0','0','1','1','0','0'); DROP TABLE IF EXISTS {caches}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {caches} ( `id` int(9) NOT NULL AUTO_INCREMENT, `key` varchar(255) NOT NULL, @@ -46,10 +46,10 @@ CREATE TABLE {caches} ( UNIQUE KEY `key` (`key`), KEY `tags` (`tags`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {comments}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {comments} ( `author_id` int(9) DEFAULT NULL, `created` int(9) NOT NULL, @@ -75,10 +75,10 @@ CREATE TABLE {comments} ( `updated` int(9) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {failed_auths}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {failed_auths} ( `id` int(9) NOT NULL AUTO_INCREMENT, `count` int(9) NOT NULL, @@ -86,10 +86,10 @@ CREATE TABLE {failed_auths} ( `time` int(9) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {graphics_rules}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {graphics_rules} ( `id` int(9) NOT NULL AUTO_INCREMENT, `active` tinyint(1) DEFAULT '0', @@ -100,12 +100,12 @@ CREATE TABLE {graphics_rules} ( `target` varchar(32) NOT NULL, PRIMARY KEY (`id`) ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'thumb'); INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:640;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'resize'); DROP TABLE IF EXISTS {groups}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {groups} ( `id` int(9) NOT NULL AUTO_INCREMENT, `name` char(64) DEFAULT NULL, @@ -113,25 +113,25 @@ CREATE TABLE {groups} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {groups} VALUES (1,'Everybody',1); INSERT INTO {groups} VALUES (2,'Registered Users',1); DROP TABLE IF EXISTS {groups_users}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {groups_users} ( `group_id` int(9) NOT NULL, `user_id` int(9) NOT NULL, PRIMARY KEY (`group_id`,`user_id`), UNIQUE KEY `user_id` (`user_id`,`group_id`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {groups_users} VALUES (1,1); INSERT INTO {groups_users} VALUES (1,2); INSERT INTO {groups_users} VALUES (2,2); DROP TABLE IF EXISTS {incoming_translations}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {incoming_translations} ( `id` int(9) NOT NULL AUTO_INCREMENT, `key` char(32) NOT NULL, @@ -143,10 +143,10 @@ CREATE TABLE {incoming_translations} ( UNIQUE KEY `key` (`key`,`locale`), KEY `locale_key` (`locale`,`key`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {items}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {items} ( `id` int(9) NOT NULL AUTO_INCREMENT, `album_cover_item_id` int(9) DEFAULT NULL, @@ -188,11 +188,11 @@ CREATE TABLE {items} ( KEY `weight` (`weight`), KEY `left_ptr` (`left_ptr`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1'); DROP TABLE IF EXISTS {items_tags}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {items_tags} ( `id` int(9) NOT NULL AUTO_INCREMENT, `item_id` int(9) NOT NULL, @@ -201,10 +201,10 @@ CREATE TABLE {items_tags} ( KEY `tag_id` (`tag_id`,`id`), KEY `item_id` (`item_id`,`id`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {logs}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {logs} ( `id` int(9) NOT NULL AUTO_INCREMENT, `category` varchar(64) DEFAULT NULL, @@ -217,10 +217,10 @@ CREATE TABLE {logs} ( `user_id` int(9) DEFAULT '0', PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {messages}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {messages} ( `id` int(9) NOT NULL AUTO_INCREMENT, `key` varchar(255) DEFAULT NULL, @@ -229,10 +229,10 @@ CREATE TABLE {messages} ( PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {modules}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {modules} ( `id` int(9) NOT NULL AUTO_INCREMENT, `active` tinyint(1) DEFAULT '0', @@ -243,8 +243,8 @@ CREATE TABLE {modules} ( UNIQUE KEY `name` (`name`), KEY `weight` (`weight`) ) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; -INSERT INTO {modules} VALUES (1,1,'gallery',47,1); +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO {modules} VALUES (1,1,'gallery',48,1); INSERT INTO {modules} VALUES (2,1,'user',3,2); INSERT INTO {modules} VALUES (3,1,'comment',4,3); INSERT INTO {modules} VALUES (4,1,'organize',4,4); @@ -254,8 +254,8 @@ INSERT INTO {modules} VALUES (7,1,'search',1,7); INSERT INTO {modules} VALUES (8,1,'slideshow',2,8); INSERT INTO {modules} VALUES (9,1,'tag',3,9); DROP TABLE IF EXISTS {outgoing_translations}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {outgoing_translations} ( `id` int(9) NOT NULL AUTO_INCREMENT, `base_revision` int(9) DEFAULT NULL, @@ -267,10 +267,10 @@ CREATE TABLE {outgoing_translations} ( UNIQUE KEY `key` (`key`,`locale`), KEY `locale_key` (`locale`,`key`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {permissions}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {permissions} ( `id` int(9) NOT NULL AUTO_INCREMENT, `display_name` varchar(64) DEFAULT NULL, @@ -278,14 +278,14 @@ CREATE TABLE {permissions} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {permissions} VALUES (1,'View','view'); INSERT INTO {permissions} VALUES (2,'View full size','view_full'); INSERT INTO {permissions} VALUES (3,'Edit','edit'); INSERT INTO {permissions} VALUES (4,'Add','add'); DROP TABLE IF EXISTS {search_records}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {search_records} ( `id` int(9) NOT NULL AUTO_INCREMENT, `item_id` int(9) DEFAULT NULL, @@ -295,21 +295,21 @@ CREATE TABLE {search_records} ( KEY `item_id` (`item_id`), FULLTEXT KEY `data` (`data`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {search_records} VALUES (1,1,0,' Gallery'); DROP TABLE IF EXISTS {sessions}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {sessions} ( `session_id` varchar(127) NOT NULL, `data` text NOT NULL, `last_activity` int(10) unsigned NOT NULL, PRIMARY KEY (`session_id`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {tags}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {tags} ( `id` int(9) NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, @@ -317,10 +317,10 @@ CREATE TABLE {tags} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {tasks}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {tasks} ( `id` int(9) NOT NULL AUTO_INCREMENT, `callback` varchar(128) DEFAULT NULL, @@ -335,10 +335,10 @@ CREATE TABLE {tasks} ( PRIMARY KEY (`id`), KEY `owner_id` (`owner_id`) ) DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {themes}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {themes} ( `id` int(9) NOT NULL AUTO_INCREMENT, `name` varchar(64) DEFAULT NULL, @@ -346,12 +346,12 @@ CREATE TABLE {themes} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {themes} VALUES (1,'wind',1); INSERT INTO {themes} VALUES (2,'admin_wind',1); DROP TABLE IF EXISTS {users}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {users} ( `id` int(9) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, @@ -369,12 +369,12 @@ CREATE TABLE {users} ( UNIQUE KEY `name` (`name`), UNIQUE KEY `hash` (`hash`) ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {users} VALUES (1,'guest','Guest User','',0,0,NULL,0,1,NULL,NULL,NULL); INSERT INTO {users} VALUES (2,'admin','Gallery Administrator','',0,0,'unknown@unknown.com',1,0,NULL,NULL,NULL); DROP TABLE IF EXISTS {vars}; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE {vars} ( `id` int(9) NOT NULL AUTO_INCREMENT, `module_name` varchar(64) NOT NULL, @@ -382,8 +382,8 @@ CREATE TABLE {vars} ( `value` text, PRIMARY KEY (`id`), UNIQUE KEY `module_name` (`module_name`,`name`) -) AUTO_INCREMENT=42 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +) AUTO_INCREMENT=43 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind'); INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind'); INSERT INTO {vars} VALUES (NULL,'gallery','page_size','9'); @@ -413,6 +413,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','email_line_length','70'); INSERT INTO {vars} VALUES (NULL,'gallery','email_header_separator','s:1:\"\n\";'); INSERT INTO {vars} VALUES (NULL,'gallery','show_user_profiles_to','registered_users'); INSERT INTO {vars} VALUES (NULL,'gallery','extra_binary_paths','/usr/local/bin:/opt/local/bin:/opt/bin'); +INSERT INTO {vars} VALUES (NULL,'gallery','timezone','PST8PDT'); INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:10;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:11;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:12;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:13;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user'); INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5'); diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 2cb04356..83c5ed71 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -311,8 +311,9 @@ class gallery_installer { module::set_var("gallery", "email_header_separator", serialize("\n")); module::set_var("gallery", "show_user_profiles_to", "registered_users"); module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin"); + module::set_var("gallery", "timezone", Kohana::config("locale.timezone")); - module::set_version("gallery", 47); + module::set_version("gallery", 48); } static function upgrade($version) { @@ -687,7 +688,7 @@ class gallery_installer { if ($version == 47) { // Add configuration variable to set timezone. Defaults to the currently // used timezone (from PHP configuration). - module::set_var("gallery", "timezone", Kohana::config('locale.timezone')); + module::set_var("gallery", "timezone", Kohana::config("locale.timezone")); module::set_version("gallery", $version = 48); } } -- cgit v1.2.3 From fa4fb20f8036745a4999d05ccb2fe285a891f3a8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 23 Apr 2011 06:50:47 -0700 Subject: If we've cleared out the last group in a combine_queue for a given type, unset the combine_queue for that type entirely. This way future calls to css() and script() emit an element until there's a new call to start_combining(). Fixes 1685. --- modules/gallery/libraries/Gallery_View.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules') diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 77e3d204..1395686c 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -136,6 +136,9 @@ class Gallery_View_Core extends View { } unset($this->combine_queue[$type][$group]); + if (empty($this->combine_queue[$type])) { + unset($this->combine_queue[$type]); + } if ($type == "css") { return html::stylesheet("combined/css/$key", "screen,print,projection", true); -- cgit v1.2.3 From 80af9f0f17ce5ac10ceefc9d3d0736b3d4c1c2aa Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 23 Apr 2011 07:05:15 -0700 Subject: Inline admin JS into admin_server_add.html.php. Fixes #1686. --- modules/server_add/helpers/server_add_theme.php | 16 --- modules/server_add/js/admin.js | 8 -- modules/server_add/js/server_add.js | 125 --------------------- modules/server_add/views/admin_server_add.html.php | 24 +++- 4 files changed, 22 insertions(+), 151 deletions(-) delete mode 100644 modules/server_add/js/admin.js delete mode 100644 modules/server_add/js/server_add.js (limited to 'modules') diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php index 50c050a8..cfca5901 100644 --- a/modules/server_add/helpers/server_add_theme.php +++ b/modules/server_add/helpers/server_add_theme.php @@ -24,20 +24,4 @@ class server_add_theme_Core { . $theme->script("server_add.js"); } } - - static function admin_head($theme) { - $buf = ""; - if (strpos(Router::$current_uri, "admin/server_add") !== false) { - $buf .= $theme->css("server_add.css") - . $theme->css("jquery.autocomplete.css"); - $base = url::site("__ARGS__"); - $csrf = access::csrf_token(); - $buf .= ""; - - $buf .= $theme->script("jquery.autocomplete.js") - . $theme->script("admin.js"); - } - - return $buf; - } } \ No newline at end of file diff --git a/modules/server_add/js/admin.js b/modules/server_add/js/admin.js deleted file mode 100644 index 9d7bd181..00000000 --- a/modules/server_add/js/admin.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Set up autocomplete on the server path list - * - */ -$("document").ready(function() { - $("#g-path").autocomplete( - base_url.replace("__ARGS__", "admin/server_add/autocomplete"), {max: 256}); -}); diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js deleted file mode 100644 index 02dda4c0..00000000 --- a/modules/server_add/js/server_add.js +++ /dev/null @@ -1,125 +0,0 @@ -(function($) { - $.widget("ui.gallery_server_add", { - _init: function() { - var self = this; - $("#g-server-add-add-button", this.element).click(function(event) { - event.preventDefault(); - $(".g-progress-bar", this.element). - progressbar(). - progressbar("value", 0); - $("#g-server-add-progress", this.element).slideDown("fast", function() { self.start_add(); }); - }); - $("#g-server-add-pause-button", this.element).click(function(event) { - self.pause = true; - $("#g-server-add-pause-button", this.element).hide(); - $("#g-server-add-continue-button", this.element).show(); - }); - $("#g-server-add-continue-button", this.element).click(function(event) { - self.pause = false; - $("#g-server-add-pause-button", this.element).show(); - $("#g-server-add-continue-button", this.element).hide(); - self.run_add(); - }); - $("#g-server-add-close-button", this.element).click(function(event) { - $("#g-dialog").dialog("close"); - window.location.reload(); - }); - $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) { - self.open_dir(event); - }); - $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) { - self.select_file(event); - }); - $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) { - self.open_dir(event); - }); - $("#g-dialog").bind("dialogclose", function(event, ui) { - window.location.reload(); - }); - }, - - taskURL: null, - pause: false, - - start_add: function() { - var self = this; - var paths = []; - $.each($("span.selected", self.element), function () { - paths.push($(this).attr("ref")); - }); - - $("#g-server-add-add-button", this.element).hide(); - $("#g-server-add-pause-button", this.element).show(); - - $.ajax({ - url: START_URL, - type: "POST", - async: false, - data: { "paths[]": paths }, - dataType: "json", - success: function(data, textStatus) { - $("#g-status").html(data.status); - $(".g-progress-bar", self.element).progressbar("value", data.percent_complete); - self.taskURL = data.url; - setTimeout(function() { self.run_add(); }, 25); - } - }); - return false; - }, - - run_add: function () { - var self = this; - $.ajax({ - url: self.taskURL, - async: false, - dataType: "json", - success: function(data, textStatus) { - $("#g-status").html(data.status); - $(".g-progress-bar", self.element).progressbar("value", data.percent_complete); - if (data.done) { - $("#g-server-add-progress", this.element).slideUp(); - $("#g-server-add-add-button", this.element).show(); - $("#g-server-add-pause-button", this.element).hide(); - $("#g-server-add-continue-button", this.element).hide(); - } else { - if (!self.pause) { - setTimeout(function() { self.run_add(); }, 25); - } - } - } - }); - }, - - /** - * Load a new directory - */ - open_dir: function(event) { - var self = this; - var path = $(event.target).attr("ref"); - $.ajax({ - url: GET_CHILDREN_URL.replace("__PATH__", path), - success: function(data, textStatus) { - $("#g-server-add-tree", self.element).html(data); - $("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) { - self.open_dir(event); - }); - $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) { - self.select_file(event); - }); - } - }); - }, - - /** - * Manage file selection state. - */ - select_file: function (event) { - $(event.target).toggleClass("selected"); - if ($("#g-server-add span.selected").length) { - $("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled"); - } else { - $("#g-server-add-add-button").enable(false).addClass("ui-state-disabled"); - } - } - }); -})(jQuery); diff --git a/modules/server_add/views/admin_server_add.html.php b/modules/server_add/views/admin_server_add.html.php index 933ab7f8..d921a8a4 100644 --- a/modules/server_add/views/admin_server_add.html.php +++ b/modules/server_add/views/admin_server_add.html.php @@ -1,4 +1,19 @@ +css("server_add.css") ?> +css("jquery.autocomplete.css") ?> +script("jquery.autocomplete.js") ?> +script("admin.js") ?> + +

@@ -8,12 +23,17 @@
  • + $path): ?>
  • - " + ") ?>" id="icon_" - class="g-remove-dir g-button"> + class="g-remove-dir g-button"> + + + +
  • -- cgit v1.2.3 From efa3466a75856a219e4c282f21037aa186a806b0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 23 Apr 2011 07:13:55 -0700 Subject: Oops, forgot to remove the reference to admin.js. Follow-on for #1686. --- modules/server_add/views/admin_server_add.html.php | 1 - 1 file changed, 1 deletion(-) (limited to 'modules') diff --git a/modules/server_add/views/admin_server_add.html.php b/modules/server_add/views/admin_server_add.html.php index d921a8a4..474ad428 100644 --- a/modules/server_add/views/admin_server_add.html.php +++ b/modules/server_add/views/admin_server_add.html.php @@ -2,7 +2,6 @@ css("server_add.css") ?> css("jquery.autocomplete.css") ?> script("jquery.autocomplete.js") ?> -script("admin.js") ?> +

    -- cgit v1.2.3