add boolean 'sort' property to itemKeys (before, columnWidth implied sort=true, which didn't accommodate sort by random)

This commit is contained in:
rolux 2012-03-08 12:33:20 +01:00
parent 05a96c4671
commit ca0f5c7e1e
3 changed files with 149 additions and 72 deletions

View File

@ -85,13 +85,14 @@
capability: A capability required to see this key
columnRequired: If true, the column can't be removed
columnWidth: Default column width in px
find: If true, will appear as a find option
filter: if true, one can filter results by this key
filter: If true, one can filter results by this key
find: If true, this key will appear as a find option
format: {type: "...", args: [...]}, for special formatting
(Ox.formatType(args) will be called)
sort: special sort rule (title, person)
sort: If true, one can sort results by this key
sortOperator: sort operator (+, -), in case it differs from the
default for the key's type (+ for strings, - for numbers)
sortType: special sort type (title, person)
value: {key: "...", type: "..."}, for keys that are derived
from other keys (like number of actors), or "capability"
*/
@ -112,7 +113,8 @@
"columnRequired": true,
"columnWidth": 180,
"find": true,
"sort": "title"
"sort": true,
"sortType": "title"
},
{
"id": "director",
@ -124,7 +126,8 @@
"columnWidth": 180,
"filter": true,
"find": true,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "country",
@ -133,7 +136,8 @@
"autocomplete": true,
"columnWidth": 120,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "year",
@ -143,7 +147,8 @@
"autocomplete": true,
"columnWidth": 60,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "language",
@ -151,15 +156,17 @@
"type": ["string"],
"autocomplete": true,
"columnWidth": 120,
"filter": true,
"find": true,
"filter": true
"sort": true
},
{
"id": "runtime",
"title": "Runtime",
"type": "time",
"columnWidth": 60,
"format": {"type": "duration", "args": [0, "short"]}
"format": {"type": "duration", "args": [0, "short"]},
"sort": true
},
{
"id": "writer",
@ -169,7 +176,8 @@
"columnWidth": 180,
"filter": true,
"find": true,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "producer",
@ -179,7 +187,8 @@
"columnWidth": 180,
"filter": true,
"find": true,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "cinematographer",
@ -189,7 +198,8 @@
"columnWidth": 180,
"filter": true,
"find": true,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "editor",
@ -199,7 +209,8 @@
"columnWidth": 180,
"filter": true,
"find": true,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "actor",
@ -208,13 +219,14 @@
"autocomplete": true,
"filter": true,
"find": true,
"sort": "person"
"sortType": "person"
},
{
"id": "numberofactors",
"title": "Number of Actors",
"type": "integer",
"columnWidth": 60,
"sort": true,
"value": {"key": "actor", "type": "length"}
},
{
@ -223,7 +235,7 @@
"type": ["string"],
"autocomplete": true,
"find": true,
"sort": "string"
"sortType": "string"
},
{
"id": "name",
@ -244,7 +256,8 @@
"autocomplete": true,
"columnWidth": 120,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "keyword",
@ -270,48 +283,55 @@
"title": "Release Date",
"type": "date",
"columnWidth": 120,
"format": {"type": "date", "args": ["%a, %b %e, %Y"]}
"format": {"type": "date", "args": ["%a, %b %e, %Y"]},
"sort": true
},
{
"id": "budget",
"title": "Budget",
"type": "integer",
"columnWidth": 90,
"format": {"type": "unit", "args": ["$"]}
"format": {"type": "unit", "args": ["$"]},
"sort": true
},
{
"id": "gross",
"title": "Gross",
"type": "integer",
"columnWidth": 90,
"format": {"type": "unit", "args": ["$"]}
"format": {"type": "unit", "args": ["$"]},
"sort": true
},
{
"id": "profit",
"title": "Profit",
"type": "integer",
"columnWidth": 90,
"format": {"type": "unit", "args": ["$"]}
"format": {"type": "unit", "args": ["$"]},
"sort": true
},
{
"id": "rating",
"title": "Rating",
"type": "float",
"columnWidth": 60,
"format": {"type": "unit", "args": ["%", 0]}
"format": {"type": "unit", "args": ["%", 0]},
"sort": true
},
{
"id": "votes",
"title": "Votes",
"type": "float",
"columnWidth": 60,
"format": {"type": "unit", "args": ["%", 2]}
"format": {"type": "unit", "args": ["%", 2]},
"sort": true
},
{
"id": "id",
"title": "ID",
"type": "string",
"columnWidth": 90
"columnWidth": 90,
"sort": true
},
{
"id": "subtitles",
@ -324,7 +344,8 @@
"title": "Duration",
"type": "float",
"columnWidth": 90,
"format": {"type": "duration", "args": []}
"format": {"type": "duration", "args": []},
"sort": true
},
{
"id": "resolution",
@ -332,14 +353,16 @@
"type": ["integer"],
"capability": "canSeeFiles",
"columnWidth": 90,
"format": {"type": "resolution", "args": ["px"]}
"format": {"type": "resolution", "args": ["px"]},
"sort": true
},
{
"id": "aspectratio",
"title": "Aspect Ratio",
"type": "float",
"columnWidth": 90,
"format": {"type": "unit", "args": [":1"]}
"format": {"type": "unit", "args": [":1"]},
"sort": true
},
{
"id": "pixels",
@ -347,7 +370,8 @@
"type": "integer",
"capability": "canSeeFiles",
"columnWidth": 90,
"format": {"type": "value", "args": ["px"]}
"format": {"type": "value", "args": ["px"]},
"sort": true
},
{
"id": "hue",
@ -355,6 +379,7 @@
"type": "float",
"columnWidth": 90,
"format": {"type": "color", "args": ["hue"]},
"sort": true,
"sortOperator": "+"
},
{
@ -362,20 +387,23 @@
"title": "Saturation",
"type": "float",
"columnWidth": 90,
"format": {"type": "color", "args": ["saturation"]}
"format": {"type": "color", "args": ["saturation"]},
"sort": true
},
{
"id": "lightness",
"title": "Lightness",
"type": "float",
"columnWidth": 90,
"format": {"type": "color", "args": ["lightness"]}
"format": {"type": "color", "args": ["lightness"]},
"sort": true
},
{
"id": "volume",
"title": "Volume",
"type": "float",
"columnWidth": 60
"columnWidth": 60,
"sort": true
},
{
"id": "numberofcuts",
@ -383,6 +411,7 @@
"type": "integer",
"columnWidth": 60,
"format": {"type": "number", "args": []},
"sort": true,
"value": {"key": "cuts", "type": "length"}
},
{
@ -390,6 +419,7 @@
"title": "Cuts per Minute",
"type": "float",
"columnWidth": 60,
"sort": true,
"value": {"key": "cuts", "type": "lengthperminute"}
},
{
@ -398,6 +428,7 @@
"type": "integer",
"columnWidth": 60,
"format": {"type": "number", "args": []},
"sort": true,
"value": {"layer": "subtitles", "type": "words"}
},
{
@ -406,6 +437,7 @@
"type": "float",
"columnWidth": 60,
"format": {"type": "unit", "args": ["wpm"]},
"sort": true,
"value": {"layer": "subtitles", "type": "wordsperminute"}
},
{
@ -414,7 +446,8 @@
"type": "integer",
"capability": "canSeeFiles",
"columnWidth": 60,
"format": {"type": "value", "args": ["B"]}
"format": {"type": "value", "args": ["B"]},
"sort": true
},
{
"id": "bitrate",
@ -422,14 +455,16 @@
"type": "integer",
"capability": "canSeeFiles",
"columnWidth": 60,
"format": {"type": "unit", "args": ["kbps", 0, 0.001]}
"format": {"type": "unit", "args": ["kbps", 0, 0.001]},
"sort": true
},
{
"id": "parts",
"title": "Number of Parts",
"type": "integer",
"capability": "canSeeFiles",
"columnWidth": 60
"columnWidth": 60,
"sort": true
},
{
"id": "numberoffiles",
@ -437,6 +472,7 @@
"type": "integer",
"capability": "canSeeFiles",
"columnWidth": 60,
"sort": true,
"value": {"key": "files", "type": "length"}
},
{
@ -451,27 +487,31 @@
"title": "Date Created",
"type": "date",
"columnWidth": 150,
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]}
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]},
"sort": true
},
{
"id": "modified",
"title": "Last Modified",
"type": "date",
"columnWidth": 150,
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]}
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]},
"sort": true
},
{
"id": "accessed",
"title": "Last Accessed",
"type": "date",
"columnWidth": 150,
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]}
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]},
"sort": true
},
{
"id": "timesaccessed",
"title": "Times Accessed",
"type": "integer",
"columnWidth": 60
"columnWidth": 60,
"sort": true
},
{
"id": "rightslevel",
@ -481,6 +521,7 @@
"format": {"type": "ColorLevel", "args": [
["Public", "Relaxed", "Regular", "Restricted", "Private"]
]},
"sort": true,
"sortOperator": "+",
"values": ["Public", "Relaxed", "Regular", "Restricted", "Private", "Unknown"]
},
@ -499,7 +540,8 @@
{
"id": "random",
"title": "Random",
"type": "integer"
"type": "integer",
"sort": true
}
],
/*
@ -709,4 +751,4 @@
"previewRatio": 1.7777777778,
"resolutions": [96]
}
}
}

View File

@ -81,13 +81,14 @@
capability: A capability required to see this key
columnRequired: If true, the column can't be removed
columnWidth: Default column width in px
find: If true, will appear as a find option
filter: if true, one can filter results by this key
find: If true, this key will appear as a find option
format: {type: "...", args: [...]}, for special formatting
(Ox.formatType(args) will be called)
sort: special sort rule (title, person)
sort: If true, one can sort results by this key
sortOperator: sort operator (+, -), in case it differs from the
default for the key's type (+ for strings, - for numbers)
sortType: special sort type (title, person)
value: {key: "...", type: "..."}, for keys that are derived
from other keys (like number of actors), or "capability"
*/
@ -107,7 +108,8 @@
"columnRequired": true,
"columnWidth": 180,
"find": true,
"sort": "title"
"sort": true,
"sortType": "title"
},
{
"id": "source",
@ -117,7 +119,8 @@
"description": true,
"columnWidth": 180,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "project",
@ -127,7 +130,8 @@
"description": true,
"columnWidth": 120,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "topic",
@ -136,7 +140,8 @@
"autocomplete": true,
"columnWidth": 180,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "name",
@ -152,7 +157,8 @@
"autocomplete": true,
"columnRequired": true,
"columnWidth": 180,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "cinematographer",
@ -160,7 +166,8 @@
"type": ["string"],
"autocomplete": true,
"columnWidth": 180,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "featuring",
@ -170,7 +177,8 @@
"columnRequired": true,
"columnWidth": 180,
"filter": true,
"sort": "person"
"sort": true,
"sortType": "person"
},
{
"id": "language",
@ -179,7 +187,8 @@
"autocomplete": true,
"columnWidth": 120,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "location",
@ -188,14 +197,16 @@
"autocomplete": true,
"columnWidth": 180,
"filter": true,
"find": true
"find": true,
"sort": true
},
{
"id": "date",
"title": "Date",
"type": "string",
"columnWidth": 120
//"format": {"type": "date", "args": ["%a, %b %e, %Y"]}
"columnWidth": 120,
//"format": {"type": "date", "args": ["%a, %b %e, %Y"]},
"sort": true
},
{
"id": "summary",
@ -207,7 +218,8 @@
"id": "id",
"title": "ID",
"type": "string",
"columnWidth": 90
"columnWidth": 90,
"sort": true
},
{
"id": "annotations",
@ -249,62 +261,72 @@
"id": "numberofannotations",
"title": "Annotations",
"type": "integer",
"columnWidth": 60
"columnWidth": 60,
"sort": true
},
{
"id": "duration",
"title": "Duration",
"type": "float",
"columnWidth": 90,
"format": {"type": "duration", "args": [0, "short"]}
"format": {"type": "duration", "args": [0, "short"]},
"sort": true
},
{
"id": "resolution",
"title": "Resolution",
"type": ["integer"],
"columnWidth": 90,
"format": {"type": "resolution", "args": ["px"]}
"format": {"type": "resolution", "args": ["px"]},
"sort": true
},
{
"id": "aspectratio",
"title": "Aspect Ratio",
"type": "float",
"columnWidth": 90,
"format": {"type": "unit", "args": [":1"]}
"format": {"type": "unit", "args": [":1"]},
"sort": true
},
{
"id": "pixels",
"title": "Pixels",
"type": "integer",
"columnWidth": 90,
"format": {"type": "value", "args": ["px"]}
"format": {"type": "value", "args": ["px"]},
"sort": true
},
{
"id": "hue",
"title": "Hue",
"type": "hue",
"columnWidth": 90,
"format": {"type": "color", "args": ["hue"]}
"format": {"type": "color", "args": ["hue"]},
"sort": true,
"sortOperator": "+"
},
{
"id": "saturation",
"title": "Saturation",
"type": "float",
"columnWidth": 90,
"format": {"type": "color", "args": ["saturation"]}
"format": {"type": "color", "args": ["saturation"]},
"sort": true
},
{
"id": "lightness",
"title": "Lightness",
"type": "float",
"columnWidth": 90,
"format": {"type": "color", "args": ["lightness"]}
"format": {"type": "color", "args": ["lightness"]},
"sort": true
},
{
"id": "volume",
"title": "Volume",
"type": "float",
"columnWidth": 60
"columnWidth": 60,
"sort": true
},
{
"id": "numberofcuts",
@ -312,6 +334,7 @@
"type": "integer",
"columnWidth": 60,
"format": {"type": "number", "args": []},
"sort": true,
"value": {"key": "cuts", "type": "length"}
},
{
@ -319,6 +342,7 @@
"title": "Cuts per Minute",
"type": "float",
"columnWidth": 60,
"sort": true,
"value": {"key": "cuts", "type": "lengthperminute"}
},
{
@ -327,6 +351,7 @@
"type": "integer",
"columnWidth": 60,
"format": {"type": "number", "args": []},
"sort": true,
"value": {"layer": "subtitles", "type": "words"}
},
{
@ -334,6 +359,7 @@
"title": "Words per Minute",
"type": "float",
"columnWidth": 60,
"sort": true,
"value": {"layer": "subtitles", "type": "wordsperminute"}
},
{
@ -342,14 +368,16 @@
"type": "integer",
"capability": "canSeeFiles",
"columnWidth": 60,
"format": {"type": "value", "args": ["B"]}
"format": {"type": "value", "args": ["B"]},
"sort": true
},
{
"id": "bitrate",
"title": "Bitrate",
"type": "integer",
"columnWidth": 60,
"format": {"type": "unit", "args": ["kbps"]}
"format": {"type": "unit", "args": ["kbps"]},
"sort": true
},
{
"id": "numberoffiles",
@ -357,6 +385,7 @@
"type": "integer",
"capability": "canSeeFiles",
"columnWidth": 60,
"sort": true,
"value": {"key": "files", "type": "length"}
},
{
@ -378,33 +407,38 @@
"title": "Date Created",
"type": "date",
"columnWidth": 120,
"format": {"type": "date", "args": ["%a, %b %e, %Y"]}
"format": {"type": "date", "args": ["%a, %b %e, %Y"]},
"sort": true
},
{
"id": "modified",
"title": "Date Modified",
"type": "date",
"columnWidth": 90
"columnWidth": 90,
"sort": true
},
{
"id": "accessed",
"title": "Date Accessed",
"type": "date",
"columnWidth": 90,
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]}
"format": {"type": "date", "args": ["%Y-%m-%d %H:%M:%S"]},
"sort": true
},
{
"id": "timesaccessed",
"title": "Times Accessed",
"type": "integer",
"columnWidth": 60
"columnWidth": 60,
"sort": true
},
{
"id": "license",
"title": "License",
"type": ["string"],
"columnWidth": 120,
"filter": true
"filter": true,
"sort": true
},
{
"id": "rightslevel",
@ -414,6 +448,7 @@
"format": {"type": "ColorLevel", "args": [
["Public", "Restricted", "Private"]
]},
"sort": true,
"sortOperator": "+",
"values": ["Public", "Restricted", "Private", "Unknown"]
},
@ -421,7 +456,7 @@
"id": "random",
"title": "Random",
"type": "integer",
"columnWidth": 60
"sort": true
}
],
"itemName": {
@ -634,4 +669,4 @@
"previewRatio": 1.3333333333,
"resolutions": [480, 240, 96]
}
}
}

View File

@ -269,7 +269,7 @@ appPanel
]
},
sortKeys: Ox.map(pandora.site.itemKeys, function(key) {
return key.columnWidth ? Ox.extend(key, {
return key.sort ? Ox.extend(key, {
operator: pandora.getSortOperator(key.id)
}) : null;
})