diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-21 13:56:52 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-21 13:56:52 -0700 |
commit | dd31b1d39f9a342afc82cc7e446e36454a882cf9 (patch) | |
tree | c7e1e4f4e9ce747c275da3143ae735c6a2b8b97a | |
parent | ed6dfbc0e8eabf7662d128fd4241a92fa3a140b8 (diff) |
Revert "* Move the captured field into the exif module where it is created and populated."
This reverts commit a00619b812393cf73d1c188af7961af820d36185.
-rw-r--r-- | modules/exif/helpers/exif_event.php | 4 | ||||
-rw-r--r-- | modules/exif/helpers/exif_installer.php | 10 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 32 | ||||
-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 | ||||
-rw-r--r-- | modules/info/views/info_block.html.php | 2 |
8 files changed, 23 insertions, 66 deletions
diff --git a/modules/exif/helpers/exif_event.php b/modules/exif/helpers/exif_event.php index c5c48bdc..826ec959 100644 --- a/modules/exif/helpers/exif_event.php +++ b/modules/exif/helpers/exif_event.php @@ -27,8 +27,4 @@ class exif_event_Core { static function item_deleted($item) { Database::instance()->delete("exif_records", array("item_id" => $item->id)); } - - static function get_sort_fields($sort_order) { - $sort_order->fields["captured"] = t("Date captured"); - } } diff --git a/modules/exif/helpers/exif_installer.php b/modules/exif/helpers/exif_installer.php index b826224a..66226061 100644 --- a/modules/exif/helpers/exif_installer.php +++ b/modules/exif/helpers/exif_installer.php @@ -29,12 +29,6 @@ class exif_installer { PRIMARY KEY (`id`), KEY(`item_id`)) DEFAULT CHARSET=utf8;"); - - - $item_fields = $db->list_fields("items"); - if (empty($item_fields["captured"])) { - $db->query("ALTER TABLE {items} ADD COLUMN `captured` int(9) default NULL"); - } module::set_version("exif", 1); } @@ -47,8 +41,6 @@ class exif_installer { } static function uninstall() { - $db = Database::instance(); - $db->query("DROP TABLE IF EXISTS {exif_records};"); - $db->query("ALTER TABLE {items} DROP COLUMN `captured`"); + Database::instance()->query("DROP TABLE IF EXISTS {exif_records};"); } } diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 4686b23d..7e5c6f75 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -23,7 +23,6 @@ class g2_import_Core { public static $map = array(); private static $current_g2_item = null; - private static $order_map = false; static function is_configured() { return module::get_var("g2_import", "embed_path"); @@ -314,6 +313,7 @@ class g2_import_Core { return $message; } + /** * Import a single album. */ @@ -357,26 +357,16 @@ class g2_import_Core { $album->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); $album->created = $g2_album->getCreationTimestamp(); - if (self::$order_map === false) { - self::$order_map = array( - "originationTimestamp" => "captured", - "creationTimestamp" => "created", - "description" => "description", - "modificationTimestamp" => "updated", - "orderWeight" => "weight", - "pathComponent" => "name", - "summary" => "description", - "title" => "title", - "viewCount" => "view_count"); - $sort_order = (object)array("fields" => array()); - module::event("get_sort_fields", $sort_order); - foreach (self::$order_map as $g2_sort_key => $g3_sort_key) { - if (empty($sort_order->fields[$g3_sort_key])) { - unset(self::$order_map[$g2_sort_key]); - } - } - } - + $order_map = array( + "originationTimestamp" => "captured", + "creationTimestamp" => "created", + "description" => "description", + "modificationTimestamp" => "updated", + "orderWeight" => "weight", + "pathComponent" => "name", + "summary" => "description", + "title" => "title", + "viewCount" => "view_count"); $direction_map = array( ORDER_ASCENDING => "asc", ORDER_DESCENDING => "desc"); diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index eeeb7e52..9cd746d7 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -166,10 +166,12 @@ class album_Core { * Return a structured set of all the possible sort orders. */ static function get_sort_order_options() { - $sort_order = (object)array("fields" => array()); - module::event("get_sort_fields", $sort_order); - asort($sort_order->fields); - - return $sort_order->fields; + 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")); } } diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 446a8a91..64f2a9ff 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -53,14 +53,4 @@ 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 aebb7a32..6500482b 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -68,6 +68,7 @@ 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, @@ -267,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", 13); + module::set_version("gallery", 12); } static function upgrade($version) { @@ -363,20 +364,6 @@ 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 65a0691c..70bd91e2 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 13 +version = 12 diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index 1142bbd4..d8f36984 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -16,7 +16,7 @@ <?= html::clean($item->name) ?> </li> <? endif ?> - <? if (module::is_active("exif") && $item->captured): ?> + <? if ($item->captured): ?> <li> <strong class="caption"><?= t("Captured:") ?></strong> <?= date("M j, Y H:i:s", $item->captured)?> |