diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-20 20:59:18 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-20 20:59:18 -0700 |
| commit | a00619b812393cf73d1c188af7961af820d36185 (patch) | |
| tree | d19e6bf187c56bfc0a4c72db2adfb5e9560aa154 /modules/g2_import/helpers | |
| parent | 09f998e7a5a58720636c7b1140279b5efbdb33c6 (diff) | |
* Move the captured field into the exif module where it is created and populated.
* Create a new API event get_sort_fields that allows modules to contribute new sort fields that they manage. the only condition is that the module needs to add it to the item table.
* Changed g2_import to call this api to get the allowable sort fields
* Changed album::get_edit_form to call this new api to get the available sort fields
Partial fix for ticket #627, as the Capture date is not available until the exif module is installed.
Diffstat (limited to 'modules/g2_import/helpers')
| -rw-r--r-- | modules/g2_import/helpers/g2_import.php | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 7e5c6f75..4686b23d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -23,6 +23,7 @@ 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"); @@ -313,7 +314,6 @@ class g2_import_Core { return $message; } - /** * Import a single album. */ @@ -357,16 +357,26 @@ class g2_import_Core { $album->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); $album->created = $g2_album->getCreationTimestamp(); - $order_map = array( - "originationTimestamp" => "captured", - "creationTimestamp" => "created", - "description" => "description", - "modificationTimestamp" => "updated", - "orderWeight" => "weight", - "pathComponent" => "name", - "summary" => "description", - "title" => "title", - "viewCount" => "view_count"); + 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]); + } + } + } + $direction_map = array( ORDER_ASCENDING => "asc", ORDER_DESCENDING => "desc"); |
