summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-04-05 16:57:51 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-04-05 16:57:51 +0000
commitf1eec57221f9bca047ff8d422ade1e26df0fa233 (patch)
tree8d271693657c7383be277742caaeaa9a81ccde9d /core/helpers
parent15fc9b9399ede22879c5f5a6ff95d058986d0278 (diff)
Add a weight column to the items model. Change the album ordering to
use this as the default instead of id. This prepares the way for manual reordering in the organize functionality.
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/album.php4
-rw-r--r--core/helpers/core_installer.php3
-rw-r--r--core/helpers/movie.php2
-rw-r--r--core/helpers/photo.php2
4 files changed, 6 insertions, 5 deletions
diff --git a/core/helpers/album.php b/core/helpers/album.php
index ecb8b5ff..db816470 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -46,7 +46,7 @@ class album_Core {
$album->thumb_dirty = 1;
$album->resize_dirty = 1;
$album->rand_key = ((float)mt_rand()) / (float)mt_getrandmax();
- $album->sort_column = "id";
+ $album->sort_column = "weight";
$album->sort_order = "ASC";
while (ORM::factory("item")
@@ -93,7 +93,7 @@ class album_Core {
$sort_order->dropdown("column", array("id" => "gAlbumSortColumn"))
->label(t("Sort by"))
- ->options(array("id" => t("select a column"),
+ ->options(array("weight" => t("Default"),
"created" => t("Creation Date"),
"title" => t("Title"),
"updated" => t("Updated Date"),
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php
index ef1afa19..7bdcd376 100644
--- a/core/helpers/core_installer.php
+++ b/core/helpers/core_installer.php
@@ -76,6 +76,7 @@ class core_installer {
`rand_key` float default NULL,
`sort_column` varchar(64) default NULL,
`sort_order` char(4) default 'ASC',
+ `weight` int(9) NOT NULL default 0,
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`),
KEY `type` (`type`),
@@ -201,7 +202,7 @@ class core_installer {
$root->level = 1;
$root->thumb_dirty = 1;
$root->resize_dirty = 1;
- $root->sort_column = "id";
+ $root->sort_column = "weight";
$root->sort_order = "ASC";
$root->save();
access::add_item($root);
diff --git a/core/helpers/movie.php b/core/helpers/movie.php
index 59258dd9..658bc185 100644
--- a/core/helpers/movie.php
+++ b/core/helpers/movie.php
@@ -63,7 +63,7 @@ class movie_Core {
$movie->mime_type = strtolower($pi["extension"]) == "mp4" ? "video/mp4" : "video/x-flv";
$movie->thumb_dirty = 1;
$movie->resize_dirty = 1;
- $movie->sort_column = "id";
+ $movie->sort_column = "weight";
$movie->rand_key = ((float)mt_rand()) / (float)mt_getrandmax();
// Randomize the name if there's a conflict
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index 72e43419..a3f88ecb 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -63,7 +63,7 @@ class photo_Core {
$photo->mime_type = empty($image_info['mime']) ? "application/unknown" : $image_info['mime'];
$photo->thumb_dirty = 1;
$photo->resize_dirty = 1;
- $photo->sort_column = "id";
+ $photo->sort_column = "weight";
$photo->rand_key = ((float)mt_rand()) / (float)mt_getrandmax();
// Randomize the name if there's a conflict