From 8f1e90d837f7704e5b8ca97f3ca6817bbc932e8c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 8 Mar 2009 19:10:08 +0000 Subject: 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) --- core/helpers/album.php | 10 ++++++---- core/helpers/core_installer.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'core/helpers') 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`), -- cgit v1.2.3