2010-06-25 15:55:25 +00:00
|
|
|
$(function() {
|
|
|
|
Ox.theme("modern");
|
|
|
|
var $body = $("body"),
|
2010-06-30 15:49:49 +00:00
|
|
|
$document = $(document),
|
2010-06-25 15:55:25 +00:00
|
|
|
app = new Ox.App({
|
2010-06-30 21:41:27 +00:00
|
|
|
// requestURL: "http://blackbook.local:8000/api/"
|
|
|
|
requestURL: "http://lion.oil21.org:8000/api/"
|
2010-06-25 15:55:25 +00:00
|
|
|
}),
|
2010-06-30 15:49:49 +00:00
|
|
|
groups = [
|
|
|
|
{
|
|
|
|
id: "director",
|
|
|
|
title: "Director"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "country",
|
|
|
|
title: "Country"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "year",
|
|
|
|
title: "Year"
|
|
|
|
},
|
|
|
|
/*
|
|
|
|
{
|
|
|
|
id: "language",
|
|
|
|
title: "Language"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "genre",
|
|
|
|
title: "Genre"
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
],
|
2010-06-30 18:47:10 +00:00
|
|
|
$group = [],
|
2010-06-30 15:49:49 +00:00
|
|
|
elements = [],
|
2010-07-01 12:26:32 +00:00
|
|
|
rightPanelWidth = $document.width() - 256;
|
2010-06-30 15:49:49 +00:00
|
|
|
$.each(groups, function(i, v) {
|
2010-07-01 12:26:32 +00:00
|
|
|
var size = rightPanelWidth / 3 + (rightPanelWidth % 3 > i);
|
2010-06-30 18:47:10 +00:00
|
|
|
$group[i] = new Ox.TextList({
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
align: "left",
|
|
|
|
id: "name",
|
|
|
|
operator: v.id == "year" ? "-" : "+",
|
|
|
|
title: v.title,
|
|
|
|
unique: true,
|
|
|
|
visible: true,
|
2010-06-30 21:41:27 +00:00
|
|
|
width: size - 60 - ($.browser.mozilla ? 16 : 12)
|
2010-06-30 15:49:49 +00:00
|
|
|
},
|
2010-06-30 18:47:10 +00:00
|
|
|
{
|
|
|
|
align: "right",
|
|
|
|
id: "items",
|
|
|
|
operator: "-",
|
|
|
|
title: "Items",
|
|
|
|
visible: true,
|
2010-06-30 21:41:27 +00:00
|
|
|
width: 60
|
2010-06-30 18:47:10 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
id: "group_" + v.id,
|
|
|
|
request: function(options) {
|
|
|
|
delete options.keys;
|
|
|
|
app.request("find", $.extend(options, {
|
|
|
|
group: v.id,
|
|
|
|
query: {
|
|
|
|
conditions: [
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
key: "director",
|
2010-06-30 18:47:10 +00:00
|
|
|
value: "",
|
|
|
|
operator: ""
|
|
|
|
}
|
|
|
|
],
|
|
|
|
operator: ""
|
2010-06-30 15:49:49 +00:00
|
|
|
}
|
2010-06-30 18:47:10 +00:00
|
|
|
}), options.callback);
|
|
|
|
},
|
|
|
|
sort: [
|
|
|
|
{
|
|
|
|
key: "name",
|
|
|
|
operator: "+"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
elements.push({
|
|
|
|
element: $group[i],
|
2010-06-30 21:41:27 +00:00
|
|
|
resizable: true,
|
2010-06-30 15:49:49 +00:00
|
|
|
size: size
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Ox.print("elements", elements)
|
2010-07-01 12:26:32 +00:00
|
|
|
|
|
|
|
var $groupsPanel = new Ox.SplitPanel({
|
2010-06-30 15:49:49 +00:00
|
|
|
elements: elements,
|
|
|
|
orientation: "horizontal"
|
|
|
|
}),
|
2010-07-01 12:26:32 +00:00
|
|
|
|
2010-06-25 15:55:25 +00:00
|
|
|
$list = new Ox.TextList({
|
|
|
|
columns: [
|
2010-06-29 21:24:07 +00:00
|
|
|
{
|
|
|
|
align: "left",
|
|
|
|
id: "id",
|
|
|
|
operator: "+",
|
|
|
|
title: "ID",
|
2010-06-30 18:47:10 +00:00
|
|
|
unique: true,
|
2010-06-30 10:39:49 +00:00
|
|
|
visible: true,
|
2010-06-29 21:24:07 +00:00
|
|
|
width: 80
|
|
|
|
},
|
2010-06-25 15:55:25 +00:00
|
|
|
{
|
|
|
|
align: "left",
|
|
|
|
id: "title",
|
|
|
|
operator: "+",
|
|
|
|
title: "Title",
|
2010-06-28 09:16:36 +00:00
|
|
|
visible: true,
|
2010-06-25 15:55:25 +00:00
|
|
|
width: 160
|
|
|
|
},
|
|
|
|
{
|
|
|
|
align: "left",
|
|
|
|
id: "director",
|
|
|
|
operator: "+",
|
|
|
|
title: "Director",
|
2010-06-28 09:16:36 +00:00
|
|
|
visible: true,
|
2010-06-25 15:55:25 +00:00
|
|
|
width: 160
|
|
|
|
},
|
2010-06-28 09:16:36 +00:00
|
|
|
{
|
|
|
|
align: "left",
|
|
|
|
id: "country",
|
|
|
|
operator: "+",
|
|
|
|
title: "Country",
|
|
|
|
visible: true,
|
|
|
|
width: 120
|
|
|
|
},
|
2010-06-25 15:55:25 +00:00
|
|
|
{
|
|
|
|
align: "right",
|
|
|
|
id: "year",
|
|
|
|
operator: "-",
|
|
|
|
title: "Year",
|
2010-06-28 09:16:36 +00:00
|
|
|
visible: true,
|
2010-07-01 15:06:04 +00:00
|
|
|
width: 60
|
2010-06-28 09:16:36 +00:00
|
|
|
},
|
2010-06-30 09:02:13 +00:00
|
|
|
{
|
|
|
|
align: "left",
|
|
|
|
id: "language",
|
|
|
|
operator: "+",
|
|
|
|
title: "Language",
|
|
|
|
visible: true,
|
|
|
|
width: 120
|
|
|
|
},
|
2010-07-01 15:18:33 +00:00
|
|
|
{
|
|
|
|
align: "right",
|
|
|
|
id: "runtime",
|
|
|
|
operator: "-",
|
|
|
|
title: "Runtime",
|
|
|
|
visible: true,
|
|
|
|
width: 80
|
|
|
|
},
|
2010-06-30 09:02:13 +00:00
|
|
|
{
|
|
|
|
align: "left",
|
|
|
|
id: "genre",
|
|
|
|
operator: "+",
|
|
|
|
title: "Genre",
|
|
|
|
visible: true,
|
|
|
|
width: 120
|
|
|
|
},
|
|
|
|
{
|
|
|
|
align: "right",
|
|
|
|
id: "rating",
|
|
|
|
operator: "-",
|
|
|
|
title: "Rating",
|
|
|
|
width: 80
|
|
|
|
},
|
|
|
|
{
|
|
|
|
align: "right",
|
|
|
|
id: "votes",
|
|
|
|
operator: "-",
|
|
|
|
title: "Votes",
|
|
|
|
width: 80
|
2010-06-25 15:55:25 +00:00
|
|
|
}
|
|
|
|
],
|
2010-06-30 09:27:02 +00:00
|
|
|
id: "list",
|
2010-06-25 15:55:25 +00:00
|
|
|
request: function(options) {
|
|
|
|
app.request("find", $.extend(options, {
|
|
|
|
query: {
|
|
|
|
conditions: [
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
key: "director",
|
2010-06-29 12:57:42 +00:00
|
|
|
value: "",
|
2010-06-25 15:55:25 +00:00
|
|
|
operator: ""
|
|
|
|
}
|
|
|
|
],
|
|
|
|
operator: ""
|
|
|
|
}
|
|
|
|
}), options.callback);
|
|
|
|
},
|
2010-06-28 09:16:36 +00:00
|
|
|
sort: [
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
key: "director",
|
|
|
|
operator: "+"
|
2010-06-28 09:16:36 +00:00
|
|
|
}
|
|
|
|
]
|
2010-06-29 13:22:39 +00:00
|
|
|
}),
|
2010-07-01 12:26:32 +00:00
|
|
|
|
|
|
|
$toolBar = Ox.Bar({
|
2010-07-01 15:06:04 +00:00
|
|
|
size: 24
|
|
|
|
}),
|
|
|
|
|
|
|
|
$button = Ox.Button({
|
|
|
|
id: "groupsButton",
|
|
|
|
value: ["Show Groups", "Hide Groups"]
|
|
|
|
}).css({
|
|
|
|
float: "left",
|
|
|
|
margin: "4px"
|
|
|
|
}).width(80).appendTo($toolBar),
|
2010-07-01 12:26:32 +00:00
|
|
|
|
|
|
|
$select = Ox.Select({
|
2010-07-01 15:06:04 +00:00
|
|
|
id: "viewSelect",
|
2010-07-01 12:26:32 +00:00
|
|
|
items: [
|
|
|
|
{
|
|
|
|
checked: true,
|
|
|
|
id: "list",
|
2010-07-01 15:06:04 +00:00
|
|
|
title: "View as List"
|
2010-07-01 12:26:32 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "icons",
|
2010-07-01 15:06:04 +00:00
|
|
|
title: "View as Icons"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "clips",
|
|
|
|
title: "View with Clips"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "timelines",
|
|
|
|
title: "View with Timelines"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "timelines",
|
|
|
|
title: "View with Maps"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "timelines",
|
|
|
|
title: "View with Calendars"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "timelines",
|
|
|
|
title: "View as Clips"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "timelines",
|
|
|
|
title: "View on Map"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "timelines",
|
|
|
|
title: "View on Calendar"
|
|
|
|
},
|
2010-07-01 12:26:32 +00:00
|
|
|
]
|
|
|
|
}).css({
|
2010-07-01 15:06:04 +00:00
|
|
|
float: "left",
|
2010-07-01 12:26:32 +00:00
|
|
|
margin: "4px"
|
2010-07-01 15:06:04 +00:00
|
|
|
}).width(120).appendTo($toolBar);
|
|
|
|
|
|
|
|
$input = new Ox.Input({
|
|
|
|
autocomplete: {
|
|
|
|
"Find: All": [],
|
|
|
|
"Find: Title": [
|
|
|
|
"A bout de souffle",
|
|
|
|
"Casino",
|
|
|
|
"Diaries, Notes and Sketches",
|
|
|
|
"L'age d'or",
|
|
|
|
"Far From Heaven",
|
|
|
|
"In girum imus nocte et consumimur igni",
|
|
|
|
"It Felt Like a Kiss",
|
|
|
|
"Mulholland Dr.",
|
|
|
|
"Querelle",
|
|
|
|
"Vertigo"
|
|
|
|
],
|
|
|
|
"Find: Director": [
|
|
|
|
"Luis Buñuel",
|
|
|
|
"Adam Curtis",
|
|
|
|
"Guy Debord",
|
|
|
|
"Rainer Werner Fassbinder",
|
|
|
|
"Jean-Luc Godard",
|
|
|
|
"Todd Haynes",
|
|
|
|
"Alfred Hitchcock",
|
|
|
|
"David Lynch",
|
|
|
|
"Jonas Mekas",
|
|
|
|
"Martin Scorsese"
|
|
|
|
],
|
|
|
|
"Find: Country": [
|
|
|
|
"Austria",
|
|
|
|
"Canada",
|
|
|
|
"France",
|
|
|
|
"Germany",
|
|
|
|
"Italy",
|
|
|
|
"Japan",
|
|
|
|
"Spain",
|
|
|
|
"Switzerland",
|
|
|
|
"UK",
|
|
|
|
"USA"
|
|
|
|
],
|
|
|
|
"Find: Cinematographer": []
|
|
|
|
},
|
|
|
|
clear: true,
|
|
|
|
highlight: false,
|
|
|
|
id: "find",
|
|
|
|
label: [
|
|
|
|
"Find: All",
|
|
|
|
"Find: Title",
|
|
|
|
"Find: Director",
|
|
|
|
"Find: Country",
|
|
|
|
"Find: Year",
|
|
|
|
"Find: Language",
|
|
|
|
"Find: Writer",
|
|
|
|
"Find: Producer",
|
|
|
|
"Find: Cinematographer",
|
|
|
|
"Find: Editor",
|
|
|
|
"Find: Actor",
|
|
|
|
"Find: Character",
|
|
|
|
"Find: Name",
|
2010-07-01 15:18:33 +00:00
|
|
|
"Find: Genre",
|
2010-07-01 15:06:04 +00:00
|
|
|
"Find: Keyword",
|
|
|
|
"Find: Summary",
|
|
|
|
"Find: Dialog",
|
|
|
|
],
|
|
|
|
labelWidth: 85
|
|
|
|
}).css({
|
|
|
|
float: "right",
|
|
|
|
margin: "4px"
|
|
|
|
}).width(300).appendTo($toolBar);
|
2010-07-01 12:26:32 +00:00
|
|
|
|
|
|
|
$contentPanel = new Ox.SplitPanel({
|
2010-06-30 15:49:49 +00:00
|
|
|
elements: [
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
element: $groupsPanel,
|
2010-06-30 15:49:49 +00:00
|
|
|
size: 128
|
|
|
|
},
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
element: $list
|
|
|
|
}
|
|
|
|
],
|
|
|
|
orientation: "vertical"
|
|
|
|
}),
|
|
|
|
|
|
|
|
$statusBar = new Ox.Bar({
|
|
|
|
size: 16
|
|
|
|
}).attr({
|
|
|
|
id: "statusBar"
|
|
|
|
}),
|
|
|
|
|
|
|
|
$totals = new Ox.Element().attr({
|
|
|
|
id: "totals"
|
|
|
|
}).appendTo($statusBar);
|
|
|
|
|
|
|
|
$leftPanel = new Ox.Container(),
|
|
|
|
|
|
|
|
$rightPanel = new Ox.SplitPanel({
|
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
element: $toolBar,
|
2010-06-30 15:49:49 +00:00
|
|
|
size: 24
|
|
|
|
},
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
element: $contentPanel
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: $statusBar,
|
|
|
|
size: 16
|
2010-06-30 15:49:49 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
orientation: "vertical"
|
2010-07-01 12:26:32 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
$mainMenu = new Ox.MainMenu({
|
|
|
|
menus: [
|
|
|
|
{
|
|
|
|
id: "demo",
|
|
|
|
title: "Demo",
|
|
|
|
items: [
|
|
|
|
{ id: "about", title: "About" }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "sort",
|
|
|
|
title: "Sort",
|
|
|
|
items: [
|
|
|
|
{ id: "sort_movies", title: "Sort Movies by", items: [
|
|
|
|
{ checked: false, group: "sort_movies", id: "title", title: "Title"},
|
|
|
|
{ checked: false, group: "sort_movies", id: "director", title: "Director" },
|
|
|
|
{ checked: false, group: "sort_movies", id: "country", title: "Country" },
|
|
|
|
{ checked: true, group: "sort_movies", id: "year", title: "Year" },
|
|
|
|
{ checked: false, group: "sort_movies", id: "language", title: "Language" },
|
2010-07-01 15:18:33 +00:00
|
|
|
{ checked: false, group: "sort_movies", id: "runtime", title: "Runtime" },
|
2010-07-01 12:26:32 +00:00
|
|
|
{ checked: false, group: "sort_movies", id: "genre", title: "Genre" },
|
|
|
|
] },
|
|
|
|
{ id: "order_movies", title: "Order Movies", items: [
|
|
|
|
{ checked: false, group: "order_movies", id: "ascending", title: "Ascending"},
|
|
|
|
{ checked: true, group: "order_movies", id: "descending", title: "Descending" },
|
|
|
|
] }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
],
|
2010-07-01 15:06:04 +00:00
|
|
|
size: "medium"
|
2010-07-01 12:26:32 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
$mainPanel = new Ox.SplitPanel({
|
2010-06-29 13:22:39 +00:00
|
|
|
elements: [
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
element: $leftPanel,
|
|
|
|
size: 256
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: $rightPanel
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
|
|
|
|
$appPanel = Ox.SplitPanel({
|
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
element: $mainMenu,
|
2010-07-01 15:06:04 +00:00
|
|
|
size: 20
|
2010-06-29 13:22:39 +00:00
|
|
|
},
|
|
|
|
{
|
2010-07-01 12:26:32 +00:00
|
|
|
element: $mainPanel
|
2010-06-29 13:22:39 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
orientation: "vertical"
|
2010-06-25 15:55:25 +00:00
|
|
|
}).appendTo($body);
|
2010-07-01 12:26:32 +00:00
|
|
|
|
2010-06-30 18:47:10 +00:00
|
|
|
$.each(groups, function(i, group) {
|
|
|
|
Ox.Event.bind(null, "select_group_" + group.id, function(event, data) {
|
|
|
|
$list.options({
|
|
|
|
request: function(options) {
|
2010-06-30 21:41:27 +00:00
|
|
|
return app.request("find", $.extend(options, {
|
2010-06-30 18:47:10 +00:00
|
|
|
query: {
|
|
|
|
conditions: $.map(data.ids, function(v, j) {
|
|
|
|
return {
|
|
|
|
key: group.id,
|
|
|
|
value: v,
|
|
|
|
operator: "="
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
operator: "|"
|
|
|
|
}
|
|
|
|
}), options.callback);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$.each(groups, function(i_, group_) {
|
|
|
|
if (i_ != i) {
|
|
|
|
$group[i_].options({
|
|
|
|
request: function(options) {
|
|
|
|
delete options.keys;
|
2010-06-30 21:41:27 +00:00
|
|
|
return app.request("find", $.extend(options, {
|
2010-06-30 18:47:10 +00:00
|
|
|
group: group_.id,
|
|
|
|
query: {
|
|
|
|
conditions: $.map(data.ids, function(v, j) {
|
|
|
|
return {
|
|
|
|
key: group.id,
|
|
|
|
value: v,
|
|
|
|
operator: "="
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
operator: "|"
|
|
|
|
}
|
|
|
|
}), options.callback);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2010-06-30 21:41:27 +00:00
|
|
|
Ox.Event.bind(null, "change_sort_movies", function(event, data) {
|
|
|
|
|
2010-07-01 12:26:32 +00:00
|
|
|
});
|
|
|
|
Ox.Event.bind(null, "load_list", function(event, data) {
|
2010-07-01 15:06:04 +00:00
|
|
|
Ox.print("data", data)
|
|
|
|
var html = [
|
2010-07-01 12:26:32 +00:00
|
|
|
data.items + " movie" + (data.items != 1 ? "s" : ""),
|
2010-07-01 15:06:04 +00:00
|
|
|
Ox.formatDuration(data.runtime, "long"),
|
|
|
|
Ox.formatDuration(data.runtime, "medium"),
|
|
|
|
Ox.formatDuration(data.runtime, 3, "short"),
|
|
|
|
data.files + " file" + (data.files != 1 ? "s" : ""),
|
|
|
|
Ox.formatDuration(data.duration, "short"),
|
|
|
|
Ox.formatValue(data.size, "B"),
|
2010-07-01 12:26:32 +00:00
|
|
|
Ox.formatValue(data.pixels, "px")
|
|
|
|
];
|
|
|
|
$totals.html(html.join(", "));
|
2010-06-30 21:41:27 +00:00
|
|
|
});
|
|
|
|
Ox.Event.bind(null, "sort_list", function(event, data) {
|
|
|
|
|
|
|
|
});
|
2010-06-25 15:55:25 +00:00
|
|
|
});
|