diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-08 19:10:08 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-08 19:10:08 +0000 |
commit | 8f1e90d837f7704e5b8ca97f3ca6817bbc932e8c (patch) | |
tree | 6f4adfab5f172f206c46ea9e3a217f10a1b2ab5b /core/helpers | |
parent | 39954ad0b77800b3d4935430794adf18c2625148 (diff) |
Update sort order processing per Bharat's feedback
* Remove mime type and type as sortable fields
* Change the internal representation to serialized array
* Shorten the database field to varchar(64)
Diffstat (limited to 'core/helpers')
-rw-r--r-- | core/helpers/album.php | 10 | ||||
-rw-r--r-- | core/helpers/core_installer.php | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/core/helpers/album.php b/core/helpers/album.php index d93840c1..72008cd5 100644 --- a/core/helpers/album.php +++ b/core/helpers/album.php @@ -87,8 +87,12 @@ class album_Core { $group->textarea("description")->label(t("Description"))->value($parent->description); $sort_order = $group->group("sort_order", array("id" => "gAlbumSortOrder")) ->label(t("Sort Order")); - if (empty($parent->sort_order)) { - list ($sort_column, $sort_direction) = explode(" ", $parent->sort_column); + $sort_column = $parent->sort_column; + if (!empty($sort_column)) { + $sort_column = unserialize($sort_column); + $columns = array_keys($sort_column); + $sort_direction = $sort_column[$columns[0]]; + $sort_column = $columns[0]; } else { list ($sort_column, $sort_direction) = array("", "ASC"); } @@ -96,9 +100,7 @@ class album_Core { ->label(t("Sort by")) ->options(array("" => t("select a column"), "created" => t("Creation Date"), - "mime_type" => t("Mime Type"), "title" => t("Title"), - "type" => t("Type"), "updated" => t("Updated Date"), "view_count" => t("Number of views"), "rand_key" => t("Random"))) diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php index 3a1013e0..06cd8d91 100644 --- a/core/helpers/core_installer.php +++ b/core/helpers/core_installer.php @@ -78,7 +78,7 @@ class core_installer { `view_count` int(9) default 0, `width` int(9) default NULL, `rand_key` float default NULL, - `sort_column` varchar(255) default NULL, + `sort_column` varchar(64) default NULL, PRIMARY KEY (`id`), KEY `parent_id` (`parent_id`), KEY `type` (`type`), |