diff options
Diffstat (limited to 'modules/gallery')
-rw-r--r-- | modules/gallery/helpers/album.php | 12 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_event.php | 10 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 17 | ||||
-rw-r--r-- | modules/gallery/module.info | 2 |
4 files changed, 31 insertions, 10 deletions
diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index 9cd746d7..eeeb7e52 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -166,12 +166,10 @@ class album_Core { * Return a structured set of all the possible sort orders. */ static function get_sort_order_options() { - return array("weight" => t("Manual"), - "captured" => t("Date captured"), - "created" => t("Date uploaded"), - "title" => t("Title"), - "updated" => t("Date modified"), - "view_count" => t("Number of views"), - "rand_key" => t("Random")); + $sort_order = (object)array("fields" => array()); + module::event("get_sort_fields", $sort_order); + asort($sort_order->fields); + + return $sort_order->fields; } } diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 64f2a9ff..446a8a91 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -53,4 +53,14 @@ class gallery_event_Core { $data[] = $item->name; $data[] = $item->title; } + + static function get_sort_fields($sort_order) { + $sort_order->fields = array_merge($sort_order->fields, + array("weight" => t("Manual"), + "created" => t("Date uploaded"), + "title" => t("Title"), + "updated" => t("Date modified"), + "view_count" => t("Number of views"), + "rand_key" => t("Random"))); + } } diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 6500482b..aebb7a32 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -68,7 +68,6 @@ class gallery_installer { $db->query("CREATE TABLE {items} ( `id` int(9) NOT NULL auto_increment, `album_cover_item_id` int(9) default NULL, - `captured` int(9) default NULL, `created` int(9) default NULL, `description` varchar(2048) default NULL, `height` int(9) default NULL, @@ -268,7 +267,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", 12); + module::set_version("gallery", 13); } static function upgrade($version) { @@ -364,6 +363,20 @@ class gallery_installer { $db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL"); module::set_version("gallery", $version = 12); } + + if ($version == 12) { + // remove the capture field if exif is not installed and it has no data + if (!module::is_active("exif")) { + $total_records = $db->query("SELECT COUNT(id) as total_records FROM {items}") + ->current()->total_records; + $count_null = $db->query("SELECT COUNT(id) as count_null FROM {items} where `captured`is NULL") + ->current()->count_null; + if ($total_records == $count_null) { + $db->query("ALTER TABLE {items} DROP COLUMN `captured`"); + } + } + module::set_version("gallery", $version = 13); + } } static function uninstall() { diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 70bd91e2..65a0691c 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 12 +version = 13 |