merge app into pandora

This commit is contained in:
j 2011-06-06 17:48:11 +02:00
parent 7081cd7544
commit 40b2ca0dff
35 changed files with 735 additions and 734 deletions

View file

@ -7,7 +7,7 @@
// fixme: sort=-director doesn't work // fixme: sort=-director doesn't work
// fixme: don't reload full right panel on sortSelect // fixme: don't reload full right panel on sortSelect
// fixme: clear items cache after login/logout // fixme: clear items cache after login/logout
// fixme: replace global app object with pandora.app or move to pandora itself
Ox.load('UI', { Ox.load('UI', {
debug: true, debug: true,
hideScreen: false, hideScreen: false,
@ -21,13 +21,16 @@ Ox.load('Geo', function() {
window.pandora = new Ox.App({url: '/api/'}).bindEvent({ window.pandora = new Ox.App({url: '/api/'}).bindEvent({
load: function(event, data) { load: function(event, data) {
pandora.ui = {}; $.extend(pandora, {
requests: {},
ui: {}
});
loadResources('/static/json/pandora.json', function() { loadResources('/static/json/pandora.json', function() {
Ox.print('Ox.App load', data); Ox.print('Ox.App load', data);
Ox.UI.hideLoadingScreen(); Ox.UI.hideLoadingScreen();
$.extend(app, { $.extend(pandora, {
$ui: { $ui: {
body: $('body'), body: $('body'),
document: $(document), document: $(document),
@ -36,12 +39,12 @@ Ox.load('Geo', function() {
.unload(unloadWindow) .unload(unloadWindow)
}, },
site: data.site, site: data.site,
ui: { user: data.user.level == 'guest' ? $.extend({}, data.site.user) : data.user
});
$.extend(pandora.site, {
findKeys: $.map(data.site.itemKeys, function(key, i) { findKeys: $.map(data.site.itemKeys, function(key, i) {
return key.find ? key : null; return key.find ? key : null;
}), }),
infoRatio: 16 / 9,
sectionElement: 'buttons',
sectionFolders: { sectionFolders: {
site: $.merge([ site: $.merge([
{id: 'site', title: 'Site', items: $.merge([ {id: 'site', title: 'Site', items: $.merge([
@ -66,16 +69,19 @@ Ox.load('Geo', function() {
{id: 'featured', title: 'Featured Lists', showBrowser: false} {id: 'featured', title: 'Featured Lists', showBrowser: false}
] ]
}, },
selectedMovies: [],
sortKeys: $.map(data.site.itemKeys, function(key, i) { sortKeys: $.map(data.site.itemKeys, function(key, i) {
return key.columnWidth ? key : null; return key.columnWidth ? key : null;
}) })
},
user: data.user.level == 'guest' ? $.extend({}, data.site.user) : data.user });
$.extend(pandora.user, {
infoRatio: 16 / 9,
sectionElement: 'buttons',
selectedMovies: []
}); });
if (data.user.level == 'guest' && $.browser.mozilla) { if (data.user.level == 'guest' && $.browser.mozilla) {
app.user.ui.theme = 'classic'; pandora.user.ui.theme = 'classic';
} }
pandora.URL.parse(); pandora.URL.parse();
@ -83,24 +89,19 @@ Ox.load('Geo', function() {
pandora.URL.update(); pandora.URL.update();
}; };
Ox.Theme(app.user.ui.theme); Ox.Theme(pandora.user.ui.theme);
app.$ui.appPanel = pandora.ui.appPanel().display(); pandora.$ui.appPanel = pandora.ui.appPanel().display();
Ox.Request.requests() && app.$ui.loadingIcon.start(); Ox.Request.requests() && pandora.$ui.loadingIcon.start();
app.$ui.body.ajaxStart(app.$ui.loadingIcon.start); pandora.$ui.body.ajaxStart(pandora.$ui.loadingIcon.start);
app.$ui.body.ajaxStop(app.$ui.loadingIcon.stop); pandora.$ui.body.ajaxStop(pandora.$ui.loadingIcon.stop);
app.ui.sectionButtonsWidth = app.$ui.sectionButtons.width() + 8; pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
window.pandora.app = app;
}, '/static/'); }, '/static/');
} }
}); });
app = {
requests: {}
};
function loadResources(json, callback, prefix) { function loadResources(json, callback, prefix) {
prefix = prefix || ''; prefix = prefix || '';
$.getJSON(json, function(files) { $.getJSON(json, function(files) {
@ -133,37 +134,37 @@ Ox.load('Geo', function() {
function resizeWindow() { function resizeWindow() {
pandora.resizeFolders(); pandora.resizeFolders();
if (!app.user.ui.item) { if (!pandora.user.ui.item) {
app.$ui.list.size(); pandora.$ui.list.size();
pandora.resizeGroups(app.$ui.rightPanel.width()); pandora.resizeGroups(pandora.$ui.rightPanel.width());
if (app.user.ui.listView == 'map') { if (pandora.user.ui.listView == 'map') {
app.$ui.map.resize(); pandora.$ui.map.resize();
} }
} else { } else {
//Ox.print('app.$ui.window.resize'); //Ox.print('pandora.$ui.window.resize');
app.$ui.browser.scrollToSelection(); pandora.$ui.browser.scrollToSelection();
app.user.ui.itemView == 'player' && app.$ui.player.options({ pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({
// fixme: duplicated // fixme: duplicated
height: app.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}); });
app.user.ui.itemView == 'timeline' && app.$ui.editor.options({ pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({
// fixme: duplicated // fixme: duplicated
height: app.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}); });
} }
} }
function unloadWindow() { function unloadWindow() {
// fixme: ajax request has to have async set to false for this to work // fixme: ajax request has to have async set to false for this to work
app.user.ui.section == 'items' && pandora.user.ui.section == 'items' &&
['player', 'timeline'].indexOf(app.user.ui.itemView) > -1 && ['player', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 &&
app.user.ui.item && pandora.user.ui.item &&
pandora.UI.set( pandora.UI.set(
'videoPosition|' + app.user.ui.item, 'videoPosition|' + pandora.user.ui.item,
app.$ui[ pandora.$ui[
app.user.ui.itemView == 'player' ? 'player' : 'editor' pandora.user.ui.itemView == 'player' ? 'player' : 'editor'
].options('position') ].options('position')
); );
} }

View file

@ -51,7 +51,7 @@ pandora.Query = (function() {
} else { } else {
kv = ((v.indexOf(':') > - 1 ? '' : ':') + v).split(':'); kv = ((v.indexOf(':') > - 1 ? '' : ':') + v).split(':');
if (kv[0] == 'list') { // fixme: this is just a hack if (kv[0] == 'list') { // fixme: this is just a hack
app.user.ui.listQuery = {conditions: [$.extend({ pandora.user.ui.listQuery = {conditions: [$.extend({
key: kv[0] key: kv[0]
}, parseValue(kv[1]))], operator: ''}; }, parseValue(kv[1]))], operator: ''};
} else { } else {
@ -93,20 +93,20 @@ pandora.Query = (function() {
query = Ox.unserialize(str.substr(1)), query = Ox.unserialize(str.substr(1)),
sort = []; sort = [];
if ('find' in query) { if ('find' in query) {
app.user.ui.listQuery = {conditions: [], operator: ''}; // fixme: hackish pandora.user.ui.listQuery = {conditions: [], operator: ''}; // fixme: hackish
app.user.ui.findQuery = parseFind(query.find); pandora.user.ui.findQuery = parseFind(query.find);
if (app.user.ui.listQuery.conditions.length) { if (pandora.user.ui.listQuery.conditions.length) {
list = app.user.ui.listQuery.conditions[0].value; list = pandora.user.ui.listQuery.conditions[0].value;
!app.user.ui.lists[list] && pandora.UI.set( !pandora.user.ui.lists[list] && pandora.UI.set(
['lists', list].join('|'), app.site.user.ui.lists[''] ['lists', list].join('|'), pandora.site.user.ui.lists['']
); );
} }
pandora.UI.set({list: list}); pandora.UI.set({list: list});
//Ox.print('user.ui.findQuery', app.user.ui.findQuery) //Ox.print('user.ui.findQuery', pandora.user.ui.findQuery)
} }
if ('sort' in query) { if ('sort' in query) {
sort = query.sort.split(','); sort = query.sort.split(',');
pandora.UI.set(['lists', app.user.ui.list, 'sort'].join('|'), $.map(query.sort.split(','), function(v, i) { pandora.UI.set(['lists', pandora.user.ui.list, 'sort'].join('|'), $.map(query.sort.split(','), function(v, i) {
var hasOperator = '+-'.indexOf(v[0]) > -1, var hasOperator = '+-'.indexOf(v[0]) > -1,
key = hasOperator ? query.sort.substr(1) : query.sort, key = hasOperator ? query.sort.substr(1) : query.sort,
operator = hasOperator ? v[0]/*.replace('+', '')*/ : pandora.getSortOperator(key); operator = hasOperator ? v[0]/*.replace('+', '')*/ : pandora.getSortOperator(key);
@ -117,26 +117,26 @@ pandora.Query = (function() {
})); }));
} }
if ('view' in query) { if ('view' in query) {
pandora.UI.set(['lists', app.user.ui.list, 'listView'].join('|'), query.view); pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), query.view);
} }
}, },
toObject: function(groupId) { toObject: function(groupId) {
//Ox.print('tO', app.user.ui.findQuery.conditions) //Ox.print('tO', pandora.user.ui.findQuery.conditions)
// the inner $.merge() creates a clone // the inner $.merge() creates a clone
var conditions = $.merge( var conditions = $.merge(
$.merge([], app.user.ui.listQuery.conditions), $.merge([], pandora.user.ui.listQuery.conditions),
app.user.ui.findQuery.conditions pandora.user.ui.findQuery.conditions
), ),
operator; operator;
$.merge(conditions, app.ui.groups ? $.map(app.ui.groups, function(v, i) { $.merge(conditions, pandora.user.queryGroups ? $.map(pandora.user.queryGroups, function(v, i) {
if (v.id != groupId && v.query.conditions.length) { if (v.id != groupId && v.query.conditions.length) {
return v.query.conditions.length == 1 ? return v.query.conditions.length == 1 ?
v.query.conditions : v.query; v.query.conditions : v.query;
} }
}) : []); }) : []);
operator = conditions.length < 2 ? '' : ','; // fixme: should be & operator = conditions.length < 2 ? '' : ','; // fixme: should be &
//Ox.print('>>', groupId, app.user.ui.find, conditions); //Ox.print('>>', groupId, pandora.user.ui.find, conditions);
return { return {
conditions: conditions, conditions: conditions,
operator: operator operator: operator
@ -144,14 +144,14 @@ pandora.Query = (function() {
}, },
toString: function() { toString: function() {
//Ox.print('tS', app.user.ui.find) //Ox.print('tS', pandora.user.ui.find)
var sort = app.user.ui.lists[app.user.ui.list].sort[0], var sort = pandora.user.ui.lists[pandora.user.ui.list].sort[0],
key = sort.key, key = sort.key,
operator = sort.operator; operator = sort.operator;
return '?' + Ox.serialize({ return '?' + Ox.serialize({
find: constructFind(pandora.Query.toObject()), find: constructFind(pandora.Query.toObject()),
sort: (operator == pandora.getSortOperator(key) ? '' : operator) + key, sort: (operator == pandora.getSortOperator(key) ? '' : operator) + key,
view: app.user.ui.lists[app.user.ui.list].listView view: pandora.user.ui.lists[pandora.user.ui.list].listView
}); });
} }

View file

@ -12,7 +12,7 @@ pandora.UI = (function() {
Ox.print('key', key, 'val', val); Ox.print('key', key, 'val', val);
var i = 0, var i = 0,
keys = key.split('|'), keys = key.split('|'),
old = app.user.ui; old = pandora.user.ui;
while (i < keys.length - 1) { while (i < keys.length - 1) {
old = old[keys[i]]; old = old[keys[i]];
i++; i++;

View file

@ -43,17 +43,17 @@ pandora.URL = (function() {
section: 'items', section: 'items',
item: '' item: ''
}); });
pandora.UI.set(['lists', app.user.ui.list, 'listView'].join('|'), url); pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), url);
}, },
'^[0-9A-Z]': function(url) { '^[0-9A-Z]': function(url) {
var split = url.split('/'), var split = url.split('/'),
item = split[0], item = split[0],
view = new RegExp( view = new RegExp(
'^(' + $.map(app.site.itemViews, function(v) { '^(' + $.map(pandora.site.itemViews, function(v) {
return v.id; return v.id;
}).join('|') + ')$' }).join('|') + ')$'
).exec(split[1]); ).exec(split[1]);
view = view ? view[0] : app.user.ui.itemView; view = view ? view[0] : pandora.user.ui.itemView;
pandora.UI.set({ pandora.UI.set({
section: 'items', section: 'items',
item: item, item: item,
@ -73,8 +73,8 @@ pandora.URL = (function() {
if (arguments.length == 1) { // fixme: remove later if (arguments.length == 1) { // fixme: remove later
url = title; url = title;
} }
history.pushState({}, app.site.site.name + (title ? ' - ' + title : ''), '/' + url); history.pushState({}, pandora.site.site.name + (title ? ' - ' + title : ''), '/' + url);
old.user.ui = $.extend({}, app.user.ui); // make a clone old.user.ui = $.extend({}, pandora.user.ui); // make a clone
this.update(); this.update();
}, },
@ -95,16 +95,16 @@ pandora.URL = (function() {
update: function() { update: function() {
this.parse(); this.parse();
if (app.user.ui.section != old.user.ui.section) { if (pandora.user.ui.section != old.user.ui.section) {
app.$ui.appPanel.replaceElement(1, app.$ui.mainPanel = pandora.ui.mainPanel()); pandora.$ui.appPanel.replaceElement(1, pandora.$ui.mainPanel = pandora.ui.mainPanel());
} else if (app.user.ui.sitePage != old.user.ui.sitePage) { } else if (pandora.user.ui.sitePage != old.user.ui.sitePage) {
app.$ui.mainPanel.replaceElement(1, app.$ui.rightPanel = pandora.ui.rightPanel()); pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
} else if (!app.user.ui.item || !old.user.ui.item) { } else if (!pandora.user.ui.item || !old.user.ui.item) {
app.$ui.mainPanel.replaceElement(1, app.$ui.rightPanel = pandora.ui.rightPanel()); pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
app.$ui.leftPanel.replaceElement(2, app.$ui.info = pandora.ui.info()); pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
} else { } else {
app.$ui.contentPanel.replaceElement(1, pandora.ui.item()); pandora.$ui.contentPanel.replaceElement(1, pandora.ui.item());
app.$ui.leftPanel.replaceElement(2, app.$ui.info = pandora.ui.info()); pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
} }
if ( if (
old.user.ui.item && old.user.ui.item &&
@ -112,7 +112,7 @@ pandora.URL = (function() {
) { ) {
pandora.UI.set( pandora.UI.set(
'videoPosition|' + old.user.ui.item, 'videoPosition|' + old.user.ui.item,
app.$ui[ pandora.$ui[
old.user.ui.itemView == 'player' ? 'player' : 'editor' old.user.ui.itemView == 'player' ? 'player' : 'editor'
].options('position') ].options('position')
); );

View file

@ -1,41 +1,41 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.enterFullscreen = function() { pandora.enterFullscreen = function() {
app.$ui.appPanel.size(0, 0); pandora.$ui.appPanel.size(0, 0);
app.user.ui.showSidebar && app.$ui.mainPanel.size(0, 0); pandora.user.ui.showSidebar && pandora.$ui.mainPanel.size(0, 0);
app.$ui.rightPanel.size(0, 0).size(2, 0); pandora.$ui.rightPanel.size(0, 0).size(2, 0);
!app.user.ui.showMovies && app.$ui.contentPanel.css({ !pandora.user.ui.showMovies && pandora.$ui.contentPanel.css({
top: (-112 - Ox.UI.SCROLLBAR_SIZE) + 'px' // fixme: rightPanel.size(0, 0) doesn't preserve negative top of browser top: (-112 - Ox.UI.SCROLLBAR_SIZE) + 'px' // fixme: rightPanel.size(0, 0) doesn't preserve negative top of browser
}); });
app.user.ui.showMovies && app.$ui.contentPanel.size(0, 0); pandora.user.ui.showMovies && pandora.$ui.contentPanel.size(0, 0);
app.$ui.player.options({ pandora.$ui.player.options({
height: app.$document.height() - 2, height: pandora.$document.height() - 2,
width: app.$document.width() - 2 width: pandora.$document.width() - 2
}) })
} }
pandora.exitFullscreen = function() { pandora.exitFullscreen = function() {
app.$ui.appPanel.size(0, 20); pandora.$ui.appPanel.size(0, 20);
app.user.ui.showSidebar && app.$ui.mainPanel.size(0, app.user.ui.sidebarSize); pandora.user.ui.showSidebar && pandora.$ui.mainPanel.size(0, pandora.user.ui.sidebarSize);
app.$ui.rightPanel.size(0, 24).size(2, 16); pandora.$ui.rightPanel.size(0, 24).size(2, 16);
!app.user.ui.showMovies && app.$ui.contentPanel.css({ !pandora.user.ui.showMovies && pandora.$ui.contentPanel.css({
top: 24 + (-112 - Ox.UI.SCROLLBAR_SIZE) + 'px' // fixme: rightPanel.size(0, 0) doesn't preserve negative top of browser top: 24 + (-112 - Ox.UI.SCROLLBAR_SIZE) + 'px' // fixme: rightPanel.size(0, 0) doesn't preserve negative top of browser
}); });
app.user.ui.showMovies && app.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE); pandora.user.ui.showMovies && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE);
} }
pandora.getFoldersHeight = function() { pandora.getFoldersHeight = function() {
var height = 48; var height = 48;
app.ui.sectionFolders[app.user.ui.section].forEach(function(folder, i) { pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) {
height += app.user.ui.showFolder[app.user.ui.section][folder.id] * ( height += pandora.user.ui.showFolder[pandora.user.ui.section][folder.id] * (
!!folder.showBrowser * 40 + folder.items * 16 !!folder.showBrowser * 40 + folder.items * 16
); );
Ox.print('h', height) Ox.print('h', height)
}); });
/* /*
$.each(app.user.ui.showFolder[app.user.ui.section], function(id, show) { $.each(pandora.user.ui.showFolder[pandora.user.ui.section], function(id, show) {
var i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id); var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
height += show * ( height += show * (
app.ui.sectionFolders[app.user.ui.section][i].showBrowser * 40 + pandora.site.sectionFolders[pandora.user.ui.section][i].showBrowser * 40 +
app.ui.sectionFolders[app.user.ui.section][i].items * 16 pandora.site.sectionFolders[pandora.user.ui.section][i].items * 16
); );
}); });
*/ */
@ -43,10 +43,10 @@ pandora.getFoldersHeight = function() {
} }
pandora.getFoldersWidth = function() { pandora.getFoldersWidth = function() {
var width = app.user.ui.sidebarSize; var width = pandora.user.ui.sidebarSize;
// fixme: don't use height(), look up in splitpanels // fixme: don't use height(), look up in splitpanels
Ox.print(pandora.getFoldersHeight(), '>', app.$ui.leftPanel.height() - 24 - 1 - app.$ui.info.height()) Ox.print(pandora.getFoldersHeight(), '>', pandora.$ui.leftPanel.height() - 24 - 1 - pandora.$ui.info.height())
if (pandora.getFoldersHeight() > app.$ui.leftPanel.height() - 24 - 1 - app.$ui.info.height()) { if (pandora.getFoldersHeight() > pandora.$ui.leftPanel.height() - 24 - 1 - pandora.$ui.info.height()) {
width -= Ox.UI.SCROLLBAR_SIZE; width -= Ox.UI.SCROLLBAR_SIZE;
} }
return width; return width;
@ -60,37 +60,37 @@ pandora.getGroupWidth = function(pos, panelWidth) { // fixme: don't pass panelWi
} }
pandora.getSortOperator = function(key) { // fixme: make static pandora.getSortOperator = function(key) { // fixme: make static
var type = Ox.getObjectById(app.site.itemKeys, key).type; var type = Ox.getObjectById(pandora.site.itemKeys, key).type;
return ['hue', 'string', 'text'].indexOf( return ['hue', 'string', 'text'].indexOf(
Ox.isArray(type) ? type[0] : type Ox.isArray(type) ? type[0] : type
) > -1 ? '+' : '-'; ) > -1 ? '+' : '-';
} }
pandora.login = function(data) { pandora.login = function(data) {
app.user = data.user; pandora.user = data.user;
Ox.Theme(app.user.ui.theme); Ox.Theme(pandora.user.ui.theme);
app.$ui.appPanel.reload(); pandora.$ui.appPanel.reload();
} }
pandora.logout = function(data) { pandora.logout = function(data) {
app.user = data.user; pandora.user = data.user;
Ox.Theme(app.site.user.ui.theme); Ox.Theme(pandora.site.user.ui.theme);
app.$ui.appPanel.reload(); pandora.$ui.appPanel.reload();
} }
pandora.reloadGroups = function(i) { pandora.reloadGroups = function(i) {
var query = pandora.Query.toObject(); var query = pandora.Query.toObject();
app.$ui.list.options({ pandora.$ui.list.options({
items: function(data, callback) { items: function(data, callback) {
return pandora.api.find($.extend(data, { return pandora.api.find($.extend(data, {
query: query query: query
}), callback); }), callback);
} }
}); });
$.each(app.ui.groups, function(i_, group_) { $.each(pandora.user.queryGroups, function(i_, group_) {
if (i_ != i) { if (i_ != i) {
//Ox.print('setting groups request', i, i_) //Ox.print('setting groups request', i, i_)
app.$ui.groups[i_].options({ pandora.$ui.groups[i_].options({
items: function(data, callback) { items: function(data, callback) {
delete data.keys; delete data.keys;
return pandora.api.find($.extend(data, { return pandora.api.find($.extend(data, {
@ -106,12 +106,12 @@ pandora.reloadGroups = function(i) {
pandora.getListData = function() { pandora.getListData = function() {
var data = {}; var data = {};
if (app.user.ui.list) { if (pandora.user.ui.list) {
var folder = app.$ui.folderList['personal'].options('selected')[0] == var folder = pandora.$ui.folderList['personal'].options('selected')[0] ==
app.user.ui.list ? 'personal' : 'featured'; pandora.user.ui.list ? 'personal' : 'featured';
data = app.$ui.folderList[folder].value(app.user.ui.list); data = pandora.$ui.folderList[folder].value(pandora.user.ui.list);
} }
data.editable = data.user == app.user.username && data.type == 'static'; data.editable = data.user == pandora.user.username && data.type == 'static';
return data; return data;
} }
@ -119,32 +119,32 @@ pandora.reloadList = function() {
Ox.print('reloadList') Ox.print('reloadList')
var listData = pandora.getListData(); var listData = pandora.getListData();
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.$ui.groups.forEach(function($group) { pandora.$ui.groups.forEach(function($group) {
$group.reloadList(); $group.reloadList();
}); });
app.$ui.list.bindEvent({ pandora.$ui.list.bindEvent({
init: function(event, data) { init: function(event, data) {
var folder = listData.status == 'private' ? 'personal' : listData.status; var folder = listData.status == 'private' ? 'personal' : listData.status;
app.$ui.folderList[folder].value(listData.id, 'items', data.items); pandora.$ui.folderList[folder].value(listData.id, 'items', data.items);
} }
}) })
.bindEventOnce({ .bindEventOnce({
load: function(event, data) { load: function(event, data) {
app.$ui.list.gainFocus(); pandora.$ui.list.gainFocus();
if (data) app.$ui.list.options({selected: [data.items]}); if (data) pandora.$ui.list.options({selected: [data.items]});
} }
}) })
.reloadList(); .reloadList();
} }
pandora.resizeGroups = function(width) { pandora.resizeGroups = function(width) {
var widths = $.map(app.ui.groups, function(v, i) { var widths = $.map(pandora.user.queryGroups, function(v, i) {
return pandora.getGroupWidth(i, width); return pandora.getGroupWidth(i, width);
}); });
//Ox.print('widths', widths); //Ox.print('widths', widths);
app.$ui.browser.size(0, widths[0].list).size(2, widths[4].list); pandora.$ui.browser.size(0, widths[0].list).size(2, widths[4].list);
app.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list); pandora.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list);
$.each(app.$ui.groups, function(i, list) { $.each(pandora.$ui.groups, function(i, list) {
list.resizeColumn('name', widths[i].column); list.resizeColumn('name', widths[i].column);
}); });
} }
@ -152,44 +152,44 @@ pandora.resizeGroups = function(width) {
pandora.resizeFolders = function() { pandora.resizeFolders = function() {
var width = pandora.getFoldersWidth(), var width = pandora.getFoldersWidth(),
columnWidth = {}; columnWidth = {};
if (app.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
columnWidth.title = width - 16; columnWidth.title = width - 16;
} else if (app.user.ui.section == 'items') { } else if (pandora.user.ui.section == 'items') {
columnWidth = {user: parseInt((width - 88) * 0.4)}; columnWidth = {user: parseInt((width - 88) * 0.4)};
columnWidth.name = (width - 88) - columnWidth.user; columnWidth.name = (width - 88) - columnWidth.user;
} }
//Ox.print('sectionsWidth', width) //Ox.print('sectionsWidth', width)
$.each(app.$ui.folderList, function(id, $list) { $.each(pandora.$ui.folderList, function(id, $list) {
var i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id); var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
app.$ui.folder[i].css({width: width + 'px'}); pandora.$ui.folder[i].css({width: width + 'px'});
$list.css({width: width + 'px'}); $list.css({width: width + 'px'});
Ox.print('...', id, $list.options()) Ox.print('...', id, $list.options())
if (app.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
$list.resizeColumn('title', columnWidth.title); $list.resizeColumn('title', columnWidth.title);
} else if (app.user.ui.section == 'items') { } else if (pandora.user.ui.section == 'items') {
if (app.ui.sectionFolders[app.user.ui.section][i].showBrowser) { if (pandora.site.sectionFolders[pandora.user.ui.section][i].showBrowser) {
$list.resizeColumn('user', columnWidth.user) $list.resizeColumn('user', columnWidth.user)
.resizeColumn('name', columnWidth.name); .resizeColumn('name', columnWidth.name);
} else { } else {
$list.resizeColumn(id == 'favorite' ? 'id' : 'name', width - 88); $list.resizeColumn(id == 'favorite' ? 'id' : 'name', width - 88);
} }
} }
if (!app.user.ui.showFolder[app.user.ui.section][id]) { if (!pandora.user.ui.showFolder[pandora.user.ui.section][id]) {
app.$ui.folder[i].update(); pandora.$ui.folder[i].update();
} }
}); });
} }
pandora.saveVideoPosition = function() { pandora.saveVideoPosition = function() {
//alert(JSON.stringify(['videoPosition|' + old.user.ui.item, app.$ui[old.user.ui.itemView == 'player' ? 'player' : 'editor'].options('position')])); //alert(JSON.stringify(['videoPosition|' + old.user.ui.item, pandora.$ui[old.user.ui.itemView == 'player' ? 'player' : 'editor'].options('position')]));
} }
pandora.selectList = function() { pandora.selectList = function() {
if (app.user.ui.list) { if (pandora.user.ui.list) {
pandora.api.findLists({ pandora.api.findLists({
keys: ['status', 'user'], keys: ['status', 'user'],
query: { query: {
conditions: [{key: 'id', value: app.user.ui.list, operator: '='}], conditions: [{key: 'id', value: pandora.user.ui.list, operator: '='}],
operator: '' operator: ''
}, },
range: [0, 1] range: [0, 1]
@ -198,14 +198,14 @@ pandora.selectList = function() {
if (result.data.items.length) { if (result.data.items.length) {
list = result.data.items[0]; list = result.data.items[0];
folder = list.status == 'featured' ? 'featured' : ( folder = list.status == 'featured' ? 'featured' : (
list.user == app.user.username ? 'personal' : 'favorite' list.user == pandora.user.username ? 'personal' : 'favorite'
); );
app.$ui.folderList[folder] pandora.$ui.folderList[folder]
.options('selected', [app.user.ui.list]) .options('selected', [pandora.user.ui.list])
.gainFocus(); .gainFocus();
} else { } else {
app.user.ui.list = ''; pandora.user.ui.list = '';
//app.user.ui.listQuery.conditions = []; // fixme: Query should read from pandora.ui.list, and not need pandora.ui.listQuery to be reset //pandora.user.ui.listQuery.conditions = []; // fixme: Query should read from pandora.ui.list, and not need pandora.ui.listQuery to be reset
//pandora.URL.set(pandora.Query.toString()); //pandora.URL.set(pandora.Query.toString());
} }
}) })

View file

@ -11,7 +11,7 @@ pandora.ui.accountDialog = function(action) {
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
var width = data.width - 32; var width = data.width - 32;
app.$ui.accountForm.items.forEach(function(item) { pandora.$ui.accountForm.items.forEach(function(item) {
item.options({width: width}); item.options({width: width});
}); });
} }
@ -21,7 +21,7 @@ pandora.ui.accountDialog = function(action) {
pandora.ui.accountDialogOptions = function(action, value) { pandora.ui.accountDialogOptions = function(action, value) {
//Ox.print('ACTION', action) //Ox.print('ACTION', action)
app.$ui.accountForm && app.$ui.accountForm.removeElement(); pandora.$ui.accountForm && pandora.$ui.accountForm.removeElement();
var buttons = { var buttons = {
login: ['register', 'reset'], login: ['register', 'reset'],
register: ['login'], register: ['login'],
@ -52,7 +52,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
id: 'cancel' + Ox.toTitleCase(action), id: 'cancel' + Ox.toTitleCase(action),
title: 'Cancel' title: 'Cancel'
}).bindEvent('click', function() { }).bindEvent('click', function() {
app.$ui.accountDialog.close(); pandora.$ui.accountDialog.close();
}); });
} else if (type == 'submit') { } else if (type == 'submit') {
return new Ox.Button({ return new Ox.Button({
@ -60,7 +60,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
id: 'submit' + Ox.toTitleCase(action), id: 'submit' + Ox.toTitleCase(action),
title: buttonTitle[action] title: buttonTitle[action]
}).bindEvent('click', function() { }).bindEvent('click', function() {
app.$ui.accountForm.submit(); pandora.$ui.accountForm.submit();
}); });
} else { } else {
return new Ox.Button({ return new Ox.Button({
@ -68,7 +68,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
title: buttonTitle[type] + '...' title: buttonTitle[type] + '...'
}).bindEvent('click', function() { }).bindEvent('click', function() {
//Ox.print('CLICK EVENT', type) //Ox.print('CLICK EVENT', type)
app.$ui.accountDialog.options(ui.accountDialogOptions(type)); pandora.$ui.accountDialog.options(ui.accountDialogOptions(type));
}); });
} }
} }
@ -86,7 +86,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
.html(dialogText[action] + '<br/><br/>') .html(dialogText[action] + '<br/><br/>')
) )
.append( .append(
app.$ui.accountForm = pandora.ui.accountForm(action, value) pandora.$ui.accountForm = pandora.ui.accountForm(action, value)
), ),
keys: { keys: {
enter: 'submit' + Ox.toTitleCase(action), enter: 'submit' + Ox.toTitleCase(action),
@ -97,8 +97,8 @@ pandora.ui.accountDialogOptions = function(action, value) {
}; };
pandora.ui.accountForm = function(action, value) { pandora.ui.accountForm = function(action, value) {
if (app.$ui.accountForm) { if (pandora.$ui.accountForm) {
app.$ui.accountForm.items.forEach(function(item) { pandora.$ui.accountForm.items.forEach(function(item) {
if (item.options('id') == 'usernameOrEmail') { if (item.options('id') == 'usernameOrEmail') {
//Ox.print('REMOVING') //Ox.print('REMOVING')
//Ox.Event.unbind('usernameOrEmailSelect') //Ox.Event.unbind('usernameOrEmailSelect')
@ -125,7 +125,7 @@ pandora.ui.accountForm = function(action, value) {
if (action == 'login') { if (action == 'login') {
pandora.api.signin(data, function(result) { pandora.api.signin(data, function(result) {
if (!result.data.errors) { if (!result.data.errors) {
app.$ui.accountDialog.close(); pandora.$ui.accountDialog.close();
pandora.login(result.data); pandora.login(result.data);
} else { } else {
callback([{id: 'password', message: 'Incorrect password'}]); callback([{id: 'password', message: 'Incorrect password'}]);
@ -134,7 +134,7 @@ pandora.ui.accountForm = function(action, value) {
} else if (action == 'register') { } else if (action == 'register') {
pandora.api.signup(data, function(result) { pandora.api.signup(data, function(result) {
if (!result.data.errors) { if (!result.data.errors) {
app.$ui.accountDialog.close(); pandora.$ui.accountDialog.close();
pandora.login(result.data); pandora.login(result.data);
pandora.ui.accountWelcomeDialog().open(); pandora.ui.accountWelcomeDialog().open();
} else { } else {
@ -148,7 +148,7 @@ pandora.ui.accountForm = function(action, value) {
data[key] = usernameOrEmail[1]; data[key] = usernameOrEmail[1];
pandora.api.requestToken(data, function(result) { pandora.api.requestToken(data, function(result) {
if (!result.data.errors) { if (!result.data.errors) {
app.$ui.accountDialog.options(ui.accountDialogOptions('resetAndLogin', result.data.username)); pandora.$ui.accountDialog.options(ui.accountDialogOptions('resetAndLogin', result.data.username));
} else { } else {
callback([{id: 'usernameOrEmail', message: 'Unknown ' + (key == 'username' ? 'username' : 'e-mail address')}]) callback([{id: 'usernameOrEmail', message: 'Unknown ' + (key == 'username' ? 'username' : 'e-mail address')}])
} }
@ -156,7 +156,7 @@ pandora.ui.accountForm = function(action, value) {
} else if (action == 'resetAndLogin') { } else if (action == 'resetAndLogin') {
pandora.api.resetPassword(data, function(result) { pandora.api.resetPassword(data, function(result) {
if (!result.data.errors) { if (!result.data.errors) {
app.$ui.accountDialog.close(); pandora.$ui.accountDialog.close();
pandora.login(result.data); pandora.login(result.data);
} else { } else {
callback([{id: 'code', message: 'Incorrect code'}]); callback([{id: 'code', message: 'Incorrect code'}]);
@ -170,7 +170,7 @@ pandora.ui.accountForm = function(action, value) {
}, },
validate: function(event, data) { validate: function(event, data) {
//Ox.print('FORM VALIDATE', data) //Ox.print('FORM VALIDATE', data)
app.$ui.accountDialog[ pandora.$ui.accountDialog[
(data.valid ? 'enable' : 'disable') + 'Button' (data.valid ? 'enable' : 'disable') + 'Button'
]('submit' + Ox.toTitleCase(action)); ]('submit' + Ox.toTitleCase(action));
} }
@ -262,7 +262,7 @@ pandora.ui.accountForm = function(action, value) {
return new Ox.FormElementGroup({ return new Ox.FormElementGroup({
id: 'usernameOrEmail', id: 'usernameOrEmail',
elements: [ elements: [
app.$ui.usernameOrEmailSelect = new Ox.Select({ pandora.$ui.usernameOrEmailSelect = new Ox.Select({
id: 'usernameOrEmailSelect', id: 'usernameOrEmailSelect',
items: [ items: [
{id: 'username', title: 'Username'}, {id: 'username', title: 'Username'},
@ -274,14 +274,14 @@ pandora.ui.accountForm = function(action, value) {
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
var selected = data.selected[0].id; var selected = data.selected[0].id;
app.$ui.usernameOrEmailInput.options({ pandora.$ui.usernameOrEmailInput.options({
autovalidate: selected == 'username' ? pandora.autovalidateUsername : autovalidateEmail, autovalidate: selected == 'username' ? pandora.autovalidateUsername : autovalidateEmail,
validate: validateUser(selected, true), validate: validateUser(selected, true),
value: '' value: ''
}).focus(); }).focus();
} }
}), }),
app.$ui.usernameOrEmailInput = new Ox.Input({ pandora.$ui.usernameOrEmailInput = new Ox.Input({
autovalidate: pandora.autovalidateUsername, autovalidate: pandora.autovalidateUsername,
id: 'usernameOrEmailInput', id: 'usernameOrEmailInput',
validate: pandora.validateUser('username', true), validate: pandora.validateUser('username', true),
@ -305,7 +305,7 @@ pandora.ui.accountLogoutDialog = function() {
title: 'Cancel' title: 'Cancel'
}).bindEvent('click', function() { }).bindEvent('click', function() {
that.close(); that.close();
app.$ui.mainMenu.getItem('loginlogout').toggleTitle(); pandora.$ui.mainMenu.getItem('loginlogout').toggleTitle();
}), }),
new Ox.Button({ new Ox.Button({
id: 'logout', id: 'logout',
@ -345,10 +345,10 @@ pandora.ui.accountWelcomeDialog = function() {
}) })
] ]
], ],
content: new Ox.Element().html('Welcome, ' + app.user.username + '!<br/><br/>Your account has been created.'), content: new Ox.Element().html('Welcome, ' + pandora.user.username + '!<br/><br/>Your account has been created.'),
height: 160, height: 160,
keys: {enter: 'close', escape: 'close'}, keys: {enter: 'close', escape: 'close'},
title: 'Welcome to ' + app.site.site.name, title: 'Welcome to ' + pandora.site.site.name,
width: 300 width: 300
}); });
return that; return that;

View file

@ -3,25 +3,25 @@ pandora.ui.appPanel = function() {
var that = new Ox.SplitPanel({ var that = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.mainMenu = pandora.ui.mainMenu(), element: pandora.$ui.mainMenu = pandora.ui.mainMenu(),
size: 20 size: 20
}, },
{ {
element: app.$ui.mainPanel = pandora.ui.mainPanel() element: pandora.$ui.mainPanel = pandora.ui.mainPanel()
} }
], ],
orientation: 'vertical' orientation: 'vertical'
}); });
that.display = function() { that.display = function() {
// fixme: move animation into Ox.App // fixme: move animation into Ox.App
app.$ui.body.css({opacity: 0}); pandora.$ui.body.css({opacity: 0});
that.appendTo(app.$ui.body); that.appendTo(pandora.$ui.body);
app.$ui.body.animate({opacity: 1}, 1000); pandora.$ui.body.animate({opacity: 1}, 1000);
return that; return that;
} }
that.reload = function() { that.reload = function() {
app.$ui.appPanel.removeElement(); pandora.$ui.appPanel.removeElement();
app.$ui.appPanel = pandora.ui.appPanel().appendTo(app.$ui.body); pandora.$ui.appPanel = pandora.ui.appPanel().appendTo(pandora.$ui.body);
return that; return that;
} }
return that; return that;

View file

@ -1,7 +1,7 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.backButton = function() { pandora.ui.backButton = function() {
var that = Ox.Button({ var that = Ox.Button({
title: 'Back to ' + app.site.itemName.plural, title: 'Back to ' + pandora.site.itemName.plural,
width: 96 width: 96
}).css({ }).css({
float: 'left', float: 'left',

View file

@ -1,20 +1,20 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.browser = function() { pandora.ui.browser = function() {
var that; var that;
if (!app.user.ui.item) { if (!pandora.user.ui.item) {
app.$ui.groups = pandora.ui.groups(); pandora.$ui.groups = pandora.ui.groups();
that = new Ox.SplitPanel({ that = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.groups[0], element: pandora.$ui.groups[0],
size: app.ui.groups[0].size size: pandora.user.queryGroups[0].size
}, },
{ {
element: app.$ui.groupsInnerPanel = pandora.ui.groupsInnerPanel() element: pandora.$ui.groupsInnerPanel = pandora.ui.groupsInnerPanel()
}, },
{ {
element: app.$ui.groups[4], element: pandora.$ui.groups[4],
size: app.ui.groups[4].size size: pandora.user.queryGroups[4].size
}, },
], ],
id: 'browser', id: 'browser',
@ -22,8 +22,8 @@ pandora.ui.browser = function() {
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
app.user.ui.groupsSize = data; pandora.user.ui.groupsSize = data;
$.each(app.$ui.groups, function(i, list) { $.each(pandora.$ui.groups, function(i, list) {
list.size(); list.size();
}); });
}, },
@ -32,7 +32,7 @@ pandora.ui.browser = function() {
}, },
toggle: function(event, data) { toggle: function(event, data) {
pandora.UI.set({showGroups: !data.collapsed}); pandora.UI.set({showGroups: !data.collapsed});
data.collapsed && app.$ui.list.gainFocus(); data.collapsed && pandora.$ui.list.gainFocus();
} }
}); });
} else { } else {
@ -61,9 +61,9 @@ pandora.ui.browser = function() {
max: 1, max: 1,
min: 1, min: 1,
orientation: 'horizontal', orientation: 'horizontal',
selected: [app.user.ui.item], selected: [pandora.user.ui.item],
size: 64, size: 64,
sort: app.user.ui.lists[app.user.ui.list].sort, sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
unique: 'id' unique: 'id'
}) })
.bindEvent({ .bindEvent({
@ -76,15 +76,15 @@ pandora.ui.browser = function() {
toggle: function(event, data) { toggle: function(event, data) {
pandora.UI.set({showMovies: !data.collapsed}); pandora.UI.set({showMovies: !data.collapsed});
if (data.collapsed) { if (data.collapsed) {
if (app.user.ui.itemView == 'timeline') { if (pandora.user.ui.itemView == 'timeline') {
app.$ui.editor.gainFocus(); pandora.$ui.editor.gainFocus();
} }
} }
} }
}); });
} }
that.update = function() { that.update = function() {
app.$ui.contentPanel.replaceElement(0, app.$ui.browser = pandora.ui.browser()); pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser());
} }
return that; return that;
}; };

View file

@ -1,27 +1,27 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.contentPanel = function() { pandora.ui.contentPanel = function() {
var that = new Ox.SplitPanel({ var that = new Ox.SplitPanel({
elements: app.user.ui.item == '' ? [ elements: pandora.user.ui.item == '' ? [
{ {
collapsed: !app.user.ui.showGroups, collapsed: !pandora.user.ui.showGroups,
collapsible: true, collapsible: true,
element: app.$ui.browser = pandora.ui.browser(), element: pandora.$ui.browser = pandora.ui.browser(),
resizable: true, resizable: true,
resize: [96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256], resize: [96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256],
size: app.user.ui.groupsSize size: pandora.user.ui.groupsSize
}, },
{ {
element: app.$ui.list = pandora.ui.list(app.user.ui.lists[app.user.ui.list].listView) element: pandora.$ui.list = pandora.ui.list(pandora.user.ui.lists[pandora.user.ui.list].listView)
} }
] : [ ] : [
{ {
collapsed: !app.user.ui.showMovies, collapsed: !pandora.user.ui.showMovies,
collapsible: true, collapsible: true,
element: app.$ui.browser = pandora.ui.browser(), element: pandora.$ui.browser = pandora.ui.browser(),
size: 112 + Ox.UI.SCROLLBAR_SIZE size: 112 + Ox.UI.SCROLLBAR_SIZE
}, },
{ {
element: app.$ui.item = pandora.ui.item(app.user.ui.item, app.user.ui.itemView) element: pandora.$ui.item = pandora.ui.item(pandora.user.ui.item, pandora.user.ui.itemView)
} }
], ],
orientation: 'vertical' orientation: 'vertical'

View file

@ -5,7 +5,7 @@ pandora.ui.annotations = function() {
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
app.user.ui.annotationsSize = data; pandora.user.ui.annotationsSize = data;
}, },
resizeend: function(event, data) { resizeend: function(event, data) {
pandora.UI.set({annotationsSize: data}); pandora.UI.set({annotationsSize: data});
@ -15,7 +15,7 @@ pandora.ui.annotations = function() {
} }
}), }),
$bins = []; $bins = [];
$.each(app.site.layers, function(i, layer) { $.each(pandora.site.layers, function(i, layer) {
var $bin = new Ox.CollapsePanel({ var $bin = new Ox.CollapsePanel({
id: layer.id, id: layer.id,
size: 16, size: 16,

View file

@ -1,7 +1,7 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.filter = function() { pandora.ui.filter = function() {
var that = new Ox.Filter({ var that = new Ox.Filter({
findKeys: Ox.map(app.site.itemKeys, function(key) { findKeys: Ox.map(pandora.site.itemKeys, function(key) {
return key.id == 'all' ? null : { return key.id == 'all' ? null : {
autocomplete: key.autocomplete, autocomplete: key.autocomplete,
autocompleteSortKey: key.autocompleteSortKey, autocompleteSortKey: key.autocompleteSortKey,
@ -9,12 +9,12 @@ pandora.ui.filter = function() {
id: key.id, id: key.id,
title: key.title, title: key.title,
type: key.type == 'layer' ? Ox.getObjectById( type: key.type == 'layer' ? Ox.getObjectById(
app.site.layers, key.id pandora.site.layers, key.id
).type : key.type ).type : key.type
}; };
}), }),
sortKeys: app.ui.sortKeys, sortKeys: pandora.site.sortKeys,
viewKeys: app.site.listViews viewKeys: pandora.site.listViews
}); });
return that; return that;
}; };

View file

@ -8,7 +8,7 @@ pandora.ui.filterDialog = function() {
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
alert(JSON.stringify(app.$ui.filter.options('query'))); alert(JSON.stringify(pandora.$ui.filter.options('query')));
} }
}), }),
new Ox.Button({ new Ox.Button({
@ -17,7 +17,7 @@ pandora.ui.filterDialog = function() {
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
app.$ui.filterDialog.close(); pandora.$ui.filterDialog.close();
} }
}), }),
new Ox.Button({ new Ox.Button({
@ -26,11 +26,11 @@ pandora.ui.filterDialog = function() {
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
app.$ui.filterDialog.close(); pandora.$ui.filterDialog.close();
} }
}) })
], ],
content: app.$ui.filter = new pandora.ui.filter(), content: pandora.$ui.filter = new pandora.ui.filter(),
height: 264, height: 264,
keys: {enter: 'save', escape: 'cancel'}, keys: {enter: 'save', escape: 'cancel'},
title: 'Advanced Find', title: 'Advanced Find',

View file

@ -2,15 +2,15 @@
pandora.ui.findElement = function() { pandora.ui.findElement = function() {
var findKey = '', var findKey = '',
findValue = ''; findValue = '';
if (app.user.ui.findQuery.conditions.length == 1) { if (pandora.user.ui.findQuery.conditions.length == 1) {
findKey = app.user.ui.findQuery.conditions[0].key; findKey = pandora.user.ui.findQuery.conditions[0].key;
findValue = app.user.ui.findQuery.conditions[0].value; findValue = pandora.user.ui.findQuery.conditions[0].value;
} }
var that = new Ox.FormElementGroup({ var that = new Ox.FormElementGroup({
elements: $.merge(app.user.ui.list ? [ elements: $.merge(pandora.user.ui.list ? [
app.$ui.findListSelect = new Ox.Select({ pandora.$ui.findListSelect = new Ox.Select({
items: [ items: [
{id: 'all', title: 'Find: All ' + app.site.itemName.plural}, {id: 'all', title: 'Find: All ' + pandora.site.itemName.plural},
{id: 'list', title: 'Find: This List'} {id: 'list', title: 'Find: This List'}
], ],
overlap: 'right', overlap: 'right',
@ -19,15 +19,15 @@ pandora.ui.findElement = function() {
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
var key = data.selected[0].id; var key = data.selected[0].id;
app.$ui.findInput.options({ pandora.$ui.findInput.options({
autocomplete: autocompleteFunction() autocomplete: autocompleteFunction()
}).focus(); }).focus();
} }
}), }),
] : [], [ ] : [], [
app.$ui.findSelect = new Ox.Select({ pandora.$ui.findSelect = new Ox.Select({
id: 'select', id: 'select',
items: $.merge($.map(app.ui.findKeys, items: $.merge($.map(pandora.site.findKeys,
function(key, i) { function(key, i) {
return { return {
id: key.id, id: key.id,
@ -45,21 +45,21 @@ pandora.ui.findElement = function() {
change: function(event, data) { change: function(event, data) {
var key = data.selected[0].id; var key = data.selected[0].id;
if (key == 'advanced') { if (key == 'advanced') {
app.$ui.filterDialog = pandora.ui.filterDialog().open(); pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
} else { } else {
if (!app.user.ui.findQuery.conditions.length) { // fixme: can this case happen at all? if (!pandora.user.ui.findQuery.conditions.length) { // fixme: can this case happen at all?
app.user.ui.findQuery.conditions = [{key: key, value: '', operator: ''}]; pandora.user.ui.findQuery.conditions = [{key: key, value: '', operator: ''}];
} else { } else {
app.user.ui.findQuery.conditions[0].key = key; pandora.user.ui.findQuery.conditions[0].key = key;
} }
app.$ui.mainMenu.checkItem('findMenu_find_' + key); pandora.$ui.mainMenu.checkItem('findMenu_find_' + key);
app.$ui.findInput.options({ pandora.$ui.findInput.options({
autocomplete: autocompleteFunction() autocomplete: autocompleteFunction()
}).focus(); }).focus();
} }
} }
}), }),
app.$ui.findInput = new Ox.Input({ pandora.$ui.findInput = new Ox.Input({
autocomplete: autocompleteFunction(), autocomplete: autocompleteFunction(),
autocompleteSelect: true, autocompleteSelect: true,
autocompleteSelectHighlight: true, autocompleteSelectHighlight: true,
@ -71,16 +71,16 @@ pandora.ui.findElement = function() {
}) })
.bindEvent({ .bindEvent({
submit: function(event, data) { submit: function(event, data) {
var key = app.user.ui.findQuery.conditions.length ? var key = pandora.user.ui.findQuery.conditions.length ?
app.user.ui.findQuery.conditions[0].key : ''; pandora.user.ui.findQuery.conditions[0].key : '';
if (app.user.ui.list && that.value()[0].id == 'all') { if (pandora.user.ui.list && that.value()[0].id == 'all') {
$.each(app.$ui.folderList, function(k, $list) { $.each(pandora.$ui.folderList, function(k, $list) {
$list.options({selected: []}); $list.options({selected: []});
}); });
pandora.UI.set({list: ''}); pandora.UI.set({list: ''});
app.user.ui.listQuery = {conditions: [], operator: ''}; pandora.user.ui.listQuery = {conditions: [], operator: ''};
} }
app.user.ui.findQuery.conditions = [{ pandora.user.ui.findQuery.conditions = [{
key: key == 'all' ? '' : key, key: key == 'all' ? '' : key,
value: data.value, value: data.value,
operator: '' operator: ''
@ -96,16 +96,16 @@ pandora.ui.findElement = function() {
margin: '4px' margin: '4px'
}); });
function autocompleteFunction() { function autocompleteFunction() {
return app.user.ui.findQuery.conditions.length ? function(value, callback) { return pandora.user.ui.findQuery.conditions.length ? function(value, callback) {
var elementValue = that.value(), var elementValue = that.value(),
key = elementValue[app.user.ui.list ? 1 : 0], key = elementValue[pandora.user.ui.list ? 1 : 0],
findKey = Ox.getObjectById(app.ui.findKeys, key); findKey = Ox.getObjectById(pandora.site.findKeys, key);
Ox.print('!!!!', key, findKey, 'autocomplete' in findKey && findKey.autocomplete) Ox.print('!!!!', key, findKey, 'autocomplete' in findKey && findKey.autocomplete)
value === '' && Ox.print('Warning: autocomplete function should never be called with empty value'); value === '' && Ox.print('Warning: autocomplete function should never be called with empty value');
if ('autocomplete' in findKey && findKey.autocomplete) { if ('autocomplete' in findKey && findKey.autocomplete) {
pandora.api.autocomplete({ pandora.api.autocomplete({
key: key, key: key,
query: elementValue[0].id == 'list' ? app.user.ui.listQuery : {conditions: [], operator: ''}, query: elementValue[0].id == 'list' ? pandora.user.ui.listQuery : {conditions: [], operator: ''},
range: [0, 20], range: [0, 20],
sort: [{ sort: [{
key: 'votes', key: 'votes',

View file

@ -7,7 +7,7 @@ pandora.ui.folderBrowser = function(id) {
size: 24 size: 24
}, },
{ {
element: app.$ui.folderList[id] = pandora.ui.folderBrowserList(id) element: pandora.$ui.folderList[id] = pandora.ui.folderBrowserList(id)
} }
], ],
orientation: 'vertical' orientation: 'vertical'

View file

@ -3,7 +3,7 @@ pandora.ui.folderBrowserBar = function(id) {
var that = new Ox.Bar({ var that = new Ox.Bar({
size: 24 size: 24
}); });
app.$ui.findListInput = new Ox.Input({ pandora.$ui.findListInput = new Ox.Input({
placeholder: 'Find User', placeholder: 'Find User',
width: 184 - Ox.UI.SCROLLBAR_SIZE width: 184 - Ox.UI.SCROLLBAR_SIZE
}) })

View file

@ -1,7 +1,7 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.folderBrowserList = function(id) { pandora.ui.folderBrowserList = function(id) {
var columnWidth = (app.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 88) / 2, var columnWidth = (pandora.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 88) / 2,
i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id), i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
that = new Ox.TextList({ that = new Ox.TextList({
columns: [ columns: [
{ {
@ -115,7 +115,7 @@ pandora.ui.folderBrowserList = function(id) {
columnsVisible: true, columnsVisible: true,
items: function(data, callback) { items: function(data, callback) {
var query = id == 'favorite' ? {conditions: [ var query = id == 'favorite' ? {conditions: [
{key: 'user', value: app.user.username, operator: '!'}, {key: 'user', value: pandora.user.username, operator: '!'},
{key: 'status', value: 'public', operator: '='} {key: 'status', value: 'public', operator: '='}
], operator: '&'} : {conditions: [ ], operator: '&'} : {conditions: [
{key: 'status', value: 'public', operator: '='}, {key: 'status', value: 'public', operator: '='},
@ -127,7 +127,7 @@ pandora.ui.folderBrowserList = function(id) {
}, },
pageLength: 1000, pageLength: 1000,
// fixme: select if previously selected // fixme: select if previously selected
// selected: app.user.ui.list ? [app.user.ui.list] : [], // selected: pandora.user.ui.list ? [pandora.user.ui.list] : [],
sort: [ sort: [
{key: 'name', operator: '+'} {key: 'name', operator: '+'}
] ]
@ -149,10 +149,10 @@ pandora.ui.folderBrowserList = function(id) {
status: that.value(data.id, 'status') == 'featured' ? 'public' : 'featured' status: that.value(data.id, 'status') == 'featured' ? 'public' : 'featured'
}, function(result) { }, function(result) {
Ox.print('result', result) Ox.print('result', result)
if (result.data.user == app.user.username || result.data.subscribed) { if (result.data.user == pandora.user.username || result.data.subscribed) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.$ui.folderList[ pandora.$ui.folderList[
result.data.user == app.user.username ? 'personal' : 'favorite' result.data.user == pandora.user.username ? 'personal' : 'favorite'
].reloadList(); ].reloadList();
} }
that.value(data.id, 'status', result.data.status); that.value(data.id, 'status', result.data.status);
@ -160,22 +160,22 @@ pandora.ui.folderBrowserList = function(id) {
} }
}, },
init: function(event, data) { init: function(event, data) {
app.ui.sectionFolders[app.user.ui.section][i].items = data.items; pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items;
app.$ui.folder[i].$content.css({ pandora.$ui.folder[i].$content.css({
height: 40 + data.items * 16 + 'px' height: 40 + data.items * 16 + 'px'
}); });
app.$ui.folderList[id].css({ pandora.$ui.folderList[id].css({
height: 16 + data.items * 16 + 'px' height: 16 + data.items * 16 + 'px'
}); });
pandora.resizeFolders(); pandora.resizeFolders();
}, },
paste: function(event, data) { paste: function(event, data) {
app.$ui.list.triggerEvent('paste', data); pandora.$ui.list.triggerEvent('paste', data);
}, },
select: function(event, data) { select: function(event, data) {
// fixme: duplicated // fixme: duplicated
if (data.ids.length) { if (data.ids.length) {
$.each(app.$ui.folderList, function(id_, $list) { $.each(pandora.$ui.folderList, function(id_, $list) {
id != id_ && $list.options('selected', []); id != id_ && $list.options('selected', []);
}); });
pandora.UI.set({list: data.ids[0]}); pandora.UI.set({list: data.ids[0]});
@ -190,9 +190,9 @@ pandora.ui.folderBrowserList = function(id) {
}; };
pandora.ui.folderList = function(id) { pandora.ui.folderList = function(id) {
var i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id), var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
that; that;
if (app.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
that = new Ox.TextList({ that = new Ox.TextList({
columns: [ columns: [
{ {
@ -212,15 +212,15 @@ pandora.ui.folderList = function(id) {
id: 'title', id: 'title',
operator: '+', operator: '+',
visible: true, visible: true,
width: app.user.ui.sidebarSize - 16 width: pandora.user.ui.sidebarSize - 16
} }
], ],
items: function(data, callback) { items: function(data, callback) {
var result = {data: {}}; var result = {data: {}};
if (!data.range) { if (!data.range) {
result.data.items = Ox.getObjectById(app.ui.sectionFolders.site, id).items.length; result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items.length;
} else { } else {
result.data.items = Ox.getObjectById(app.ui.sectionFolders.site, id).items; result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items;
} }
callback(result); callback(result);
}, },
@ -231,13 +231,13 @@ pandora.ui.folderList = function(id) {
.bindEvent({ .bindEvent({
select: function(event, data) { select: function(event, data) {
// fixme: duplicated // fixme: duplicated
$.each(app.$ui.folderList, function(id_, $list) { $.each(pandora.$ui.folderList, function(id_, $list) {
id != id_ && $list.options('selected', []); id != id_ && $list.options('selected', []);
}) })
pandora.URL.set((id == 'admin' ? 'admin/' : '' ) + data.ids[0]); pandora.URL.set((id == 'admin' ? 'admin/' : '' ) + data.ids[0]);
}, },
}); });
} else if (app.user.ui.section == 'items') { } else if (pandora.user.ui.section == 'items') {
that = new Ox.TextList({ that = new Ox.TextList({
columns: [ columns: [
{ {
@ -259,11 +259,11 @@ pandora.ui.folderList = function(id) {
operator: '+', operator: '+',
unique: true, unique: true,
visible: id == 'favorite', visible: id == 'favorite',
width: app.user.ui.sidebarWidth - 88 width: pandora.user.ui.sidebarWidth - 88
}, },
{ {
editable: function(data) { editable: function(data) {
return data.user == app.user.username; return data.user == pandora.user.username;
}, },
id: 'name', id: 'name',
input: { input: {
@ -271,7 +271,7 @@ pandora.ui.folderList = function(id) {
}, },
operator: '+', operator: '+',
visible: id != 'favorite', visible: id != 'favorite',
width: app.user.ui.sidebarWidth - 88 width: pandora.user.ui.sidebarWidth - 88
}, },
{ {
align: 'right', align: 'right',
@ -328,7 +328,7 @@ pandora.ui.folderList = function(id) {
var query; var query;
if (id == 'personal') { if (id == 'personal') {
query = {conditions: [ query = {conditions: [
{key: 'user', value: app.user.username, operator: '='}, {key: 'user', value: pandora.user.username, operator: '='},
{key: 'status', value: 'featured', operator: '!'} {key: 'status', value: 'featured', operator: '!'}
], operator: '&'}; ], operator: '&'};
} else if (id == 'favorite') { } else if (id == 'favorite') {
@ -349,12 +349,12 @@ pandora.ui.folderList = function(id) {
sort: [ sort: [
{key: 'position', operator: '+'} {key: 'position', operator: '+'}
], ],
sortable: id == 'personal' || id == 'favorite' || app.user.level == 'admin' sortable: id == 'personal' || id == 'favorite' || pandora.user.level == 'admin'
}) })
.css({ .css({
left: 0, left: 0,
top: 0, top: 0,
width: app.user.ui.sidebarWidth + 'px', width: pandora.user.ui.sidebarWidth + 'px',
}) })
.bind({ .bind({
dragenter: function(e) { dragenter: function(e) {
@ -363,9 +363,9 @@ pandora.ui.folderList = function(id) {
}) })
.bindEvent({ .bindEvent({
click: function(event, data) { click: function(event, data) {
var $list = app.$ui.folderList[id]; var $list = pandora.$ui.folderList[id];
if (data.key == 'type') { if (data.key == 'type') {
app.$ui.filterDialog = pandora.ui.filterDialog().open(); pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
} else if (data.key == 'status') { } else if (data.key == 'status') {
pandora.api.editList({ pandora.api.editList({
id: data.id, id: data.id,
@ -376,8 +376,8 @@ pandora.ui.folderList = function(id) {
} }
}, },
'delete': function(event, data) { 'delete': function(event, data) {
var $list = app.$ui.folderList[id]; var $list = pandora.$ui.folderList[id];
app.user.ui.listQuery.conditions = []; pandora.user.ui.listQuery.conditions = [];
pandora.URL.set(pandora.Query.toString()); pandora.URL.set(pandora.Query.toString());
$list.options({selected: []}); $list.options({selected: []});
if (id == 'personal') { if (id == 'personal') {
@ -385,8 +385,8 @@ pandora.ui.folderList = function(id) {
id: data.ids[0] id: data.ids[0]
}, function(result) { }, function(result) {
// fixme: is this the best way to delete a ui preference? // fixme: is this the best way to delete a ui preference?
delete app.user.ui.lists[data.ids[0]]; delete pandora.user.ui.lists[data.ids[0]];
pandora.UI.set({lists: app.user.ui.lists}); pandora.UI.set({lists: pandora.user.ui.lists});
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList(); $list.reloadList();
}); });
@ -397,16 +397,16 @@ pandora.ui.folderList = function(id) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList(); $list.reloadList();
}); });
} else if (id == 'featured' && app.user.level == 'admin') { } else if (id == 'featured' && pandora.user.level == 'admin') {
pandora.api.editList({ pandora.api.editList({
id: data.ids[0], id: data.ids[0],
status: 'public' status: 'public'
}, function(result) { }, function(result) {
// fixme: duplicated // fixme: duplicated
if (result.data.user == app.user.username || result.data.subscribed) { if (result.data.user == pandora.user.username || result.data.subscribed) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.$ui.folderList[ pandora.$ui.folderList[
result.data.user == app.user.username ? 'personal' : 'favorite' result.data.user == pandora.user.username ? 'personal' : 'favorite'
].reloadList(); ].reloadList();
} }
$list.reloadList(); $list.reloadList();
@ -414,11 +414,11 @@ pandora.ui.folderList = function(id) {
} }
}, },
init: function(event, data) { init: function(event, data) {
app.ui.sectionFolders[app.user.ui.section][i].items = data.items; pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items;
app.$ui.folder[i].$content.css({ pandora.$ui.folder[i].$content.css({
height: data.items * 16 + 'px' height: data.items * 16 + 'px'
}); });
app.$ui.folderList[id].css({ pandora.$ui.folderList[id].css({
height: data.items * 16 + 'px' height: data.items * 16 + 'px'
}); });
pandora.resizeFolders(); pandora.resizeFolders();
@ -426,7 +426,7 @@ pandora.ui.folderList = function(id) {
move: function(event, data) { move: function(event, data) {
/* /*
data.ids.forEach(function(id, pos) { data.ids.forEach(function(id, pos) {
app.user.ui.lists[id].position = pos; pandora.user.ui.lists[id].position = pos;
}); });
*/ */
pandora.api.sortLists({ pandora.api.sortLists({
@ -435,11 +435,11 @@ pandora.ui.folderList = function(id) {
}); });
}, },
paste: function(event, data) { paste: function(event, data) {
app.$ui.list.triggerEvent('paste', data); pandora.$ui.list.triggerEvent('paste', data);
}, },
select: function(event, data) { select: function(event, data) {
if (data.ids.length) { if (data.ids.length) {
$.each(app.$ui.folderList, function(id_, $list) { $.each(pandora.$ui.folderList, function(id_, $list) {
id != id_ && $list.options('selected', []); id != id_ && $list.options('selected', []);
}) })
pandora.URL.set('?find=list:' + data.ids[0]); pandora.URL.set('?find=list:' + data.ids[0]);
@ -452,8 +452,8 @@ pandora.ui.folderList = function(id) {
data_[data.key] = data.value; data_[data.key] = data.value;
pandora.api.editList(data_, function(result) { pandora.api.editList(data_, function(result) {
if (result.data.id != data.id) { if (result.data.id != data.id) {
app.$ui.folderList[id].value(data.id, 'name', result.data.name); pandora.$ui.folderList[id].value(data.id, 'name', result.data.name);
app.$ui.folderList[id].value(data.id, 'id', result.data.id); pandora.$ui.folderList[id].value(data.id, 'id', result.data.id);
pandora.URL.set('?find=list:' + result.data.id); pandora.URL.set('?find=list:' + result.data.id);
} }
}); });
@ -473,15 +473,15 @@ pandora.ui.folders = function() {
}); });
var counter = 0; var counter = 0;
//var $sections = []; //var $sections = [];
app.$ui.folder = []; pandora.$ui.folder = [];
app.$ui.folderBrowser = {}; pandora.$ui.folderBrowser = {};
app.$ui.folderList = {}; pandora.$ui.folderList = {};
if (app.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
$.each(app.ui.sectionFolders.site, function(i, folder) { $.each(pandora.site.sectionFolders.site, function(i, folder) {
var height = (Ox.getObjectById(app.ui.sectionFolders.site, folder.id).items.length * 16); var height = (Ox.getObjectById(pandora.site.sectionFolders.site, folder.id).items.length * 16);
app.$ui.folder[i] = new Ox.CollapsePanel({ pandora.$ui.folder[i] = new Ox.CollapsePanel({
id: folder.id, id: folder.id,
collapsed: !app.user.ui.showFolder.site[folder.id], collapsed: !pandora.user.ui.showFolder.site[folder.id],
size: 16, size: 16,
title: folder.title title: folder.title
}) })
@ -490,25 +490,25 @@ pandora.ui.folders = function() {
} }
}); });
//alert(JSON.stringify(Ox.getObjectById(app.ui.sectionFolders.site, folder.id))) //alert(JSON.stringify(Ox.getObjectById(pandora.site.sectionFolders.site, folder.id)))
app.$ui.folder[i].$content.css({ pandora.$ui.folder[i].$content.css({
height: height + 'px' height: height + 'px'
}) })
//.appendTo(that); //.appendTo(that);
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id) pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
.css({ .css({
height: height + 'px' height: height + 'px'
}) })
.appendTo(app.$ui.folder[i].$content); .appendTo(pandora.$ui.folder[i].$content);
app.$ui.folder.forEach(function($folder) { pandora.$ui.folder.forEach(function($folder) {
that.append($folder); that.append($folder);
}); });
}); });
//pandora.resizeFolders(); //pandora.resizeFolders();
} else if (app.user.ui.section == 'items') { } else if (pandora.user.ui.section == 'items') {
$.each(app.ui.sectionFolders.items, function(i, folder) { $.each(pandora.site.sectionFolders.items, function(i, folder) {
var extras = []; var extras = [];
if (folder.id == 'personal' && app.user.level != 'guest') { if (folder.id == 'personal' && pandora.user.level != 'guest') {
extras = [new Ox.Select({ extras = [new Ox.Select({
items: [ items: [
{ id: 'new', title: 'New List...' }, { id: 'new', title: 'New List...' },
@ -525,7 +525,7 @@ pandora.ui.folders = function() {
}) })
.bindEvent({ .bindEvent({
click: function(event, data) { click: function(event, data) {
var $list = app.$ui.folderList[folder.id], var $list = pandora.$ui.folderList[folder.id],
id; id;
if (data.id == 'new' || data.id == 'newsmart') { if (data.id == 'new' || data.id == 'newsmart') {
pandora.api.addList({ pandora.api.addList({
@ -534,7 +534,7 @@ pandora.ui.folders = function() {
type: data.id == 'new' ? 'static' : 'smart' type: data.id == 'new' ? 'static' : 'smart'
}, function(result) { }, function(result) {
id = result.data.id; id = result.data.id;
pandora.UI.set(['lists', id].join('|'), app.site.user.ui.lists['']); // fixme: necessary? pandora.UI.set(['lists', id].join('|'), pandora.site.user.ui.lists['']); // fixme: necessary?
pandora.URL.set('?find=list:' + id) pandora.URL.set('?find=list:' + id)
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList().bindEventOnce({ $list.reloadList().bindEventOnce({
@ -548,7 +548,7 @@ pandora.ui.folders = function() {
} }
} }
})]; })];
} else if (folder.id == 'favorite' && app.user.level != 'guest') { } else if (folder.id == 'favorite' && pandora.user.level != 'guest') {
extras = [new Ox.Button({ extras = [new Ox.Button({
selectable: true, selectable: true,
style: 'symbol', style: 'symbol',
@ -559,20 +559,20 @@ pandora.ui.folders = function() {
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser; pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
if (app.ui.sectionFolders.items[i].showBrowser) { if (pandora.site.sectionFolders.items[i].showBrowser) {
app.$ui.folderList.favorite.replaceWith( pandora.$ui.folderList.favorite.replaceWith(
app.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite') pandora.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite')
); );
} else { } else {
app.$ui.folderBrowser.favorite.replaceWith( pandora.$ui.folderBrowser.favorite.replaceWith(
app.$ui.folderList.favorite = pandora.ui.folderList('favorite') pandora.$ui.folderList.favorite = pandora.ui.folderList('favorite')
); );
} }
pandora.resizeFolders(); pandora.resizeFolders();
} }
})]; })];
} else if (folder.id == 'featured' && app.user.level == 'admin') { } else if (folder.id == 'featured' && pandora.user.level == 'admin') {
extras = [new Ox.Button({ extras = [new Ox.Button({
selectable: true, selectable: true,
style: 'symbol', style: 'symbol',
@ -583,22 +583,22 @@ pandora.ui.folders = function() {
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser; pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
if (app.ui.sectionFolders.items[i].showBrowser) { if (pandora.site.sectionFolders.items[i].showBrowser) {
app.$ui.folderList.featured.replaceWith( pandora.$ui.folderList.featured.replaceWith(
app.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured')); pandora.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured'));
} else { } else {
app.$ui.folderBrowser.featured.replaceWith( pandora.$ui.folderBrowser.featured.replaceWith(
app.$ui.folderList.featured = pandora.ui.folderList('featured') pandora.$ui.folderList.featured = pandora.ui.folderList('featured')
); );
} }
pandora.resizeFolders(); pandora.resizeFolders();
} }
})]; })];
} }
app.$ui.folder[i] = new Ox.CollapsePanel({ pandora.$ui.folder[i] = new Ox.CollapsePanel({
id: folder.id, id: folder.id,
collapsed: !app.user.ui.showFolder.items[folder.id], collapsed: !pandora.user.ui.showFolder.items[folder.id],
extras: extras, extras: extras,
size: 16, size: 16,
title: folder.title title: folder.title
@ -606,7 +606,7 @@ pandora.ui.folders = function() {
.bindEvent({ .bindEvent({
// fixme: duplicated // fixme: duplicated
click: function(event, data) { click: function(event, data) {
var $list = app.$ui.folderList[i], var $list = pandora.$ui.folderList[i],
hasFocus, id; hasFocus, id;
if (data.id == 'new' || data.id == 'newsmart') { if (data.id == 'new' || data.id == 'newsmart') {
pandora.api.addList({ pandora.api.addList({
@ -628,24 +628,24 @@ pandora.ui.folders = function() {
} else if (data.id == 'browse') { } else if (data.id == 'browse') {
alert('??') alert('??')
/* /*
app.$ui.sectionList[1].replaceWith(app.$ui.publicLists = pandora.ui.publicLists()); pandora.$ui.sectionList[1].replaceWith(pandora.$ui.publicLists = pandora.ui.publicLists());
app.ui.showAllPublicLists = true; pandora.site.showAllPublicLists = true;
*/ */
} }
}, },
toggle: function(event, data) { toggle: function(event, data) {
data.collapsed && app.$ui.folderList[folder.id].loseFocus(); data.collapsed && pandora.$ui.folderList[folder.id].loseFocus();
pandora.UI.set('showFolder|items|' + folder.id, !data.collapsed); pandora.UI.set('showFolder|items|' + folder.id, !data.collapsed);
pandora.resizeFolders(); pandora.resizeFolders();
} }
}); });
//$sections.push(app.$ui.section[i]); //$sections.push(pandora.$ui.section[i]);
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id) pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
.bindEventOnce({ .bindEventOnce({
init: function(event, data) { init: function(event, data) {
Ox.print('init', i, counter) Ox.print('init', i, counter)
if (++counter == 3) { if (++counter == 3) {
app.$ui.folder.forEach(function($folder) { pandora.$ui.folder.forEach(function($folder) {
that.append($folder); that.append($folder);
}); });
pandora.resizeFolders(); pandora.resizeFolders();
@ -653,7 +653,7 @@ pandora.ui.folders = function() {
} }
} }
}) })
.appendTo(app.$ui.folder[i].$content); .appendTo(pandora.$ui.folder[i].$content);
}); });
} }
that.toggle = function() { that.toggle = function() {

View file

@ -9,15 +9,15 @@ pandora.ui.folders = function() {
}); });
var counter = 0; var counter = 0;
//var $sections = []; //var $sections = [];
app.$ui.folder = []; pandora.$ui.folder = [];
app.$ui.folderBrowser = {}; pandora.$ui.folderBrowser = {};
app.$ui.folderList = {}; pandora.$ui.folderList = {};
if (app.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
$.each(app.ui.sectionFolders.site, function(i, folder) { $.each(pandora.site.sectionFolders.site, function(i, folder) {
var height = (Ox.getObjectById(app.ui.sectionFolders.site, folder.id).items.length * 16); var height = (Ox.getObjectById(pandora.site.sectionFolders.site, folder.id).items.length * 16);
app.$ui.folder[i] = new Ox.CollapsePanel({ pandora.$ui.folder[i] = new Ox.CollapsePanel({
id: folder.id, id: folder.id,
collapsed: !app.user.ui.showFolder.site[folder.id], collapsed: !pandora.user.ui.showFolder.site[folder.id],
size: 16, size: 16,
title: folder.title title: folder.title
}) })
@ -26,25 +26,25 @@ pandora.ui.folders = function() {
} }
}); });
//alert(JSON.stringify(Ox.getObjectById(app.ui.sectionFolders.site, folder.id))) //alert(JSON.stringify(Ox.getObjectById(pandora.site.sectionFolders.site, folder.id)))
app.$ui.folder[i].$content.css({ pandora.$ui.folder[i].$content.css({
height: height + 'px' height: height + 'px'
}) })
//.appendTo(that); //.appendTo(that);
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id) pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
.css({ .css({
height: height + 'px' height: height + 'px'
}) })
.appendTo(app.$ui.folder[i].$content); .appendTo(pandora.$ui.folder[i].$content);
app.$ui.folder.forEach(function($folder) { pandora.$ui.folder.forEach(function($folder) {
that.append($folder); that.append($folder);
}); });
}); });
//pandora.resizeFolders(); //pandora.resizeFolders();
} else if (app.user.ui.section == 'items') { } else if (pandora.user.ui.section == 'items') {
$.each(app.ui.sectionFolders.items, function(i, folder) { $.each(pandora.site.sectionFolders.items, function(i, folder) {
var extras = []; var extras = [];
if (folder.id == 'personal' && app.user.level != 'guest') { if (folder.id == 'personal' && pandora.user.level != 'guest') {
extras = [new Ox.Select({ extras = [new Ox.Select({
items: [ items: [
{ id: 'new', title: 'New List...' }, { id: 'new', title: 'New List...' },
@ -61,7 +61,7 @@ pandora.ui.folders = function() {
}) })
.bindEvent({ .bindEvent({
click: function(event, data) { click: function(event, data) {
var $list = app.$ui.folderList[folder.id], var $list = pandora.$ui.folderList[folder.id],
id; id;
if (data.id == 'new' || data.id == 'newsmart') { if (data.id == 'new' || data.id == 'newsmart') {
pandora.api.addList({ pandora.api.addList({
@ -70,7 +70,7 @@ pandora.ui.folders = function() {
type: data.id == 'new' ? 'static' : 'smart' type: data.id == 'new' ? 'static' : 'smart'
}, function(result) { }, function(result) {
id = result.data.id; id = result.data.id;
pandora.UI.set(['lists', id].join('|'), app.site.user.ui.lists['']); // fixme: necessary? pandora.UI.set(['lists', id].join('|'), pandora.site.user.ui.lists['']); // fixme: necessary?
pandora.URL.set('?find=list:' + id) pandora.URL.set('?find=list:' + id)
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList().bindEventOnce({ $list.reloadList().bindEventOnce({
@ -84,7 +84,7 @@ pandora.ui.folders = function() {
} }
} }
})]; })];
} else if (folder.id == 'favorite' && app.user.level != 'guest') { } else if (folder.id == 'favorite' && pandora.user.level != 'guest') {
extras = [new Ox.Button({ extras = [new Ox.Button({
selectable: true, selectable: true,
style: 'symbol', style: 'symbol',
@ -95,20 +95,20 @@ pandora.ui.folders = function() {
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser; pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
if (app.ui.sectionFolders.items[i].showBrowser) { if (pandora.site.sectionFolders.items[i].showBrowser) {
app.$ui.folderList.favorite.replaceWith( pandora.$ui.folderList.favorite.replaceWith(
app.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite') pandora.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite')
); );
} else { } else {
app.$ui.folderBrowser.favorite.replaceWith( pandora.$ui.folderBrowser.favorite.replaceWith(
app.$ui.folderList.favorite = pandora.ui.folderList('favorite') pandora.$ui.folderList.favorite = pandora.ui.folderList('favorite')
); );
} }
pandora.resizeFolders(); pandora.resizeFolders();
} }
})]; })];
} else if (folder.id == 'featured' && app.user.level == 'admin') { } else if (folder.id == 'featured' && pandora.user.level == 'admin') {
extras = [new Ox.Button({ extras = [new Ox.Button({
selectable: true, selectable: true,
style: 'symbol', style: 'symbol',
@ -119,22 +119,22 @@ pandora.ui.folders = function() {
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser; pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
if (app.ui.sectionFolders.items[i].showBrowser) { if (pandora.site.sectionFolders.items[i].showBrowser) {
app.$ui.folderList.featured.replaceWith( pandora.$ui.folderList.featured.replaceWith(
app.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured')); pandora.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured'));
} else { } else {
app.$ui.folderBrowser.featured.replaceWith( pandora.$ui.folderBrowser.featured.replaceWith(
app.$ui.folderList.featured = pandora.ui.folderList('featured') pandora.$ui.folderList.featured = pandora.ui.folderList('featured')
); );
} }
pandora.resizeFolders(); pandora.resizeFolders();
} }
})]; })];
} }
app.$ui.folder[i] = new Ox.CollapsePanel({ pandora.$ui.folder[i] = new Ox.CollapsePanel({
id: folder.id, id: folder.id,
collapsed: !app.user.ui.showFolder.items[folder.id], collapsed: !pandora.user.ui.showFolder.items[folder.id],
extras: extras, extras: extras,
size: 16, size: 16,
title: folder.title title: folder.title
@ -142,7 +142,7 @@ pandora.ui.folders = function() {
.bindEvent({ .bindEvent({
// fixme: duplicated // fixme: duplicated
click: function(event, data) { click: function(event, data) {
var $list = app.$ui.folderList[i], var $list = pandora.$ui.folderList[i],
hasFocus, id; hasFocus, id;
if (data.id == 'new' || data.id == 'newsmart') { if (data.id == 'new' || data.id == 'newsmart') {
pandora.api.addList({ pandora.api.addList({
@ -164,24 +164,24 @@ pandora.ui.folders = function() {
} else if (data.id == 'browse') { } else if (data.id == 'browse') {
alert('??') alert('??')
/* /*
app.$ui.sectionList[1].replaceWith(app.$ui.publicLists = pandora.ui.publicLists()); pandora.$ui.sectionList[1].replaceWith(pandora.$ui.publicLists = pandora.ui.publicLists());
app.ui.showAllPublicLists = true; pandora.site.showAllPublicLists = true;
*/ */
} }
}, },
toggle: function(event, data) { toggle: function(event, data) {
data.collapsed && app.$ui.folderList[folder.id].loseFocus(); data.collapsed && pandora.$ui.folderList[folder.id].loseFocus();
pandora.UI.set('showFolder|items|' + folder.id, !data.collapsed); pandora.UI.set('showFolder|items|' + folder.id, !data.collapsed);
pandora.resizeFolders(); pandora.resizeFolders();
} }
}); });
//$sections.push(app.$ui.section[i]); //$sections.push(pandora.$ui.section[i]);
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id) pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
.bindEventOnce({ .bindEventOnce({
init: function(event, data) { init: function(event, data) {
Ox.print('init', i, counter) Ox.print('init', i, counter)
if (++counter == 3) { if (++counter == 3) {
app.$ui.folder.forEach(function($folder) { pandora.$ui.folder.forEach(function($folder) {
that.append($folder); that.append($folder);
}); });
pandora.resizeFolders(); pandora.resizeFolders();
@ -189,7 +189,7 @@ pandora.ui.folders = function() {
} }
} }
}) })
.appendTo(app.$ui.folder[i].$content); .appendTo(pandora.$ui.folder[i].$content);
}); });
} }
that.toggle = function() { that.toggle = function() {

View file

@ -1,8 +1,8 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.folderList = function(id) { pandora.ui.folderList = function(id) {
var i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id), var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
that; that;
if (app.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
that = new Ox.TextList({ that = new Ox.TextList({
columns: [ columns: [
{ {
@ -22,15 +22,15 @@ pandora.ui.folderList = function(id) {
id: 'title', id: 'title',
operator: '+', operator: '+',
visible: true, visible: true,
width: app.user.ui.sidebarSize - 16 width: pandora.user.ui.sidebarSize - 16
} }
], ],
items: function(data, callback) { items: function(data, callback) {
var result = {data: {}}; var result = {data: {}};
if (!data.range) { if (!data.range) {
result.data.items = Ox.getObjectById(app.ui.sectionFolders.site, id).items.length; result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items.length;
} else { } else {
result.data.items = Ox.getObjectById(app.ui.sectionFolders.site, id).items; result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items;
} }
callback(result); callback(result);
}, },
@ -41,13 +41,13 @@ pandora.ui.folderList = function(id) {
.bindEvent({ .bindEvent({
select: function(event, data) { select: function(event, data) {
// fixme: duplicated // fixme: duplicated
$.each(app.$ui.folderList, function(id_, $list) { $.each(pandora.$ui.folderList, function(id_, $list) {
id != id_ && $list.options('selected', []); id != id_ && $list.options('selected', []);
}) })
pandora.URL.set((id == 'admin' ? 'admin/' : '' ) + data.ids[0]); pandora.URL.set((id == 'admin' ? 'admin/' : '' ) + data.ids[0]);
}, },
}); });
} else if (app.user.ui.section == 'items') { } else if (pandora.user.ui.section == 'items') {
that = new Ox.TextList({ that = new Ox.TextList({
columns: [ columns: [
{ {
@ -69,11 +69,11 @@ pandora.ui.folderList = function(id) {
operator: '+', operator: '+',
unique: true, unique: true,
visible: id == 'favorite', visible: id == 'favorite',
width: app.user.ui.sidebarWidth - 88 width: pandora.user.ui.sidebarWidth - 88
}, },
{ {
editable: function(data) { editable: function(data) {
return data.user == app.user.username; return data.user == pandora.user.username;
}, },
id: 'name', id: 'name',
input: { input: {
@ -81,7 +81,7 @@ pandora.ui.folderList = function(id) {
}, },
operator: '+', operator: '+',
visible: id != 'favorite', visible: id != 'favorite',
width: app.user.ui.sidebarWidth - 88 width: pandora.user.ui.sidebarWidth - 88
}, },
{ {
align: 'right', align: 'right',
@ -138,7 +138,7 @@ pandora.ui.folderList = function(id) {
var query; var query;
if (id == 'personal') { if (id == 'personal') {
query = {conditions: [ query = {conditions: [
{key: 'user', value: app.user.username, operator: '='}, {key: 'user', value: pandora.user.username, operator: '='},
{key: 'status', value: 'featured', operator: '!'} {key: 'status', value: 'featured', operator: '!'}
], operator: '&'}; ], operator: '&'};
} else if (id == 'favorite') { } else if (id == 'favorite') {
@ -159,12 +159,12 @@ pandora.ui.folderList = function(id) {
sort: [ sort: [
{key: 'position', operator: '+'} {key: 'position', operator: '+'}
], ],
sortable: id == 'personal' || id == 'favorite' || app.user.level == 'admin' sortable: id == 'personal' || id == 'favorite' || pandora.user.level == 'admin'
}) })
.css({ .css({
left: 0, left: 0,
top: 0, top: 0,
width: app.user.ui.sidebarWidth + 'px', width: pandora.user.ui.sidebarWidth + 'px',
}) })
.bind({ .bind({
dragenter: function(e) { dragenter: function(e) {
@ -173,9 +173,9 @@ pandora.ui.folderList = function(id) {
}) })
.bindEvent({ .bindEvent({
click: function(event, data) { click: function(event, data) {
var $list = app.$ui.folderList[id]; var $list = pandora.$ui.folderList[id];
if (data.key == 'type') { if (data.key == 'type') {
app.$ui.filterDialog = ui.filterDialog().open(); pandora.$ui.filterDialog = ui.filterDialog().open();
} else if (data.key == 'status') { } else if (data.key == 'status') {
pandora.api.editList({ pandora.api.editList({
id: data.id, id: data.id,
@ -186,8 +186,8 @@ pandora.ui.folderList = function(id) {
} }
}, },
'delete': function(event, data) { 'delete': function(event, data) {
var $list = app.$ui.folderList[id]; var $list = pandora.$ui.folderList[id];
app.user.ui.listQuery.conditions = []; pandora.user.ui.listQuery.conditions = [];
pandora.URL.set(pandora.Query.toString()); pandora.URL.set(pandora.Query.toString());
$list.options({selected: []}); $list.options({selected: []});
if (id == 'personal') { if (id == 'personal') {
@ -195,8 +195,8 @@ pandora.ui.folderList = function(id) {
id: data.ids[0] id: data.ids[0]
}, function(result) { }, function(result) {
// fixme: is this the best way to delete a ui preference? // fixme: is this the best way to delete a ui preference?
delete app.user.ui.lists[data.ids[0]]; delete pandora.user.ui.lists[data.ids[0]];
pandora.UI.set({lists: app.user.ui.lists}); pandora.UI.set({lists: pandora.user.ui.lists});
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList(); $list.reloadList();
}); });
@ -207,16 +207,16 @@ pandora.ui.folderList = function(id) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList(); $list.reloadList();
}); });
} else if (id == 'featured' && app.user.level == 'admin') { } else if (id == 'featured' && pandora.user.level == 'admin') {
pandora.api.editList({ pandora.api.editList({
id: data.ids[0], id: data.ids[0],
status: 'public' status: 'public'
}, function(result) { }, function(result) {
// fixme: duplicated // fixme: duplicated
if (result.data.user == app.user.username || result.data.subscribed) { if (result.data.user == pandora.user.username || result.data.subscribed) {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.$ui.folderList[ pandora.$ui.folderList[
result.data.user == app.user.username ? 'personal' : 'favorite' result.data.user == pandora.user.username ? 'personal' : 'favorite'
].reloadList(); ].reloadList();
} }
$list.reloadList(); $list.reloadList();
@ -224,11 +224,11 @@ pandora.ui.folderList = function(id) {
} }
}, },
init: function(event, data) { init: function(event, data) {
app.ui.sectionFolders[app.user.ui.section][i].items = data.items; pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items;
app.$ui.folder[i].$content.css({ pandora.$ui.folder[i].$content.css({
height: data.items * 16 + 'px' height: data.items * 16 + 'px'
}); });
app.$ui.folderList[id].css({ pandora.$ui.folderList[id].css({
height: data.items * 16 + 'px' height: data.items * 16 + 'px'
}); });
pandora.resizeFolders(); pandora.resizeFolders();
@ -236,7 +236,7 @@ pandora.ui.folderList = function(id) {
move: function(event, data) { move: function(event, data) {
/* /*
data.ids.forEach(function(id, pos) { data.ids.forEach(function(id, pos) {
app.user.ui.lists[id].position = pos; pandora.user.ui.lists[id].position = pos;
}); });
*/ */
pandora.api.sortLists({ pandora.api.sortLists({
@ -245,11 +245,11 @@ pandora.ui.folderList = function(id) {
}); });
}, },
paste: function(event, data) { paste: function(event, data) {
app.$ui.list.triggerEvent('paste', data); pandora.$ui.list.triggerEvent('paste', data);
}, },
select: function(event, data) { select: function(event, data) {
if (data.ids.length) { if (data.ids.length) {
$.each(app.$ui.folderList, function(id_, $list) { $.each(pandora.$ui.folderList, function(id_, $list) {
id != id_ && $list.options('selected', []); id != id_ && $list.options('selected', []);
}) })
pandora.URL.set('?find=list:' + data.ids[0]); pandora.URL.set('?find=list:' + data.ids[0]);
@ -262,8 +262,8 @@ pandora.ui.folderList = function(id) {
data_[data.key] = data.value; data_[data.key] = data.value;
pandora.api.editList(data_, function(result) { pandora.api.editList(data_, function(result) {
if (result.data.id != data.id) { if (result.data.id != data.id) {
app.$ui.folderList[id].value(data.id, 'name', result.data.name); pandora.$ui.folderList[id].value(data.id, 'name', result.data.name);
app.$ui.folderList[id].value(data.id, 'id', result.data.id); pandora.$ui.folderList[id].value(data.id, 'id', result.data.id);
pandora.URL.set('?find=list:' + result.data.id); pandora.URL.set('?find=list:' + result.data.id);
} }
}); });

View file

@ -7,9 +7,9 @@ pandora.ui.group = function(id, query) {
})); }));
*/ */
//alert(id + ' ' + JSON.stringify(pandora.Query.toObject(id))) //alert(id + ' ' + JSON.stringify(pandora.Query.toObject(id)))
var i = app.user.ui.groups.indexOf(id), var i = pandora.user.ui.groups.indexOf(id),
panelWidth = app.$ui.document.width() - (app.user.ui.showSidebar * app.user.ui.sidebarSize) - 1, panelWidth = pandora.$ui.document.width() - (pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize) - 1,
title = Ox.getObjectById(app.site.groups, id).title, title = Ox.getObjectById(pandora.site.groups, id).title,
width = pandora.getGroupWidth(i, panelWidth), width = pandora.getGroupWidth(i, panelWidth),
that = new Ox.TextList({ that = new Ox.TextList({
columns: [ columns: [
@ -55,12 +55,12 @@ pandora.ui.group = function(id, query) {
}) })
.bindEvent({ .bindEvent({
paste: function(event, data) { paste: function(event, data) {
app.$ui.list.triggerEvent('paste', data); pandora.$ui.list.triggerEvent('paste', data);
}, },
select: function(event, data) { select: function(event, data) {
var group = app.ui.groups[i], var group = pandora.user.queryGroups[i],
query; query;
app.ui.groups[i].query.conditions = $.map(data.ids, function(v) { pandora.user.queryGroups[i].query.conditions = $.map(data.ids, function(v) {
return { return {
key: id, key: id,
value: v, value: v,
@ -71,7 +71,7 @@ pandora.ui.group = function(id, query) {
} }
}); });
new Ox.Select({ new Ox.Select({
items: $.map(app.site.groups, function(v) { items: $.map(pandora.user.queryGroups, function(v) {
return { return {
checked: v.id == id, checked: v.id == id,
id: v.id, id: v.id,
@ -84,46 +84,46 @@ pandora.ui.group = function(id, query) {
}) })
.bindEvent('change', function(event, data) { .bindEvent('change', function(event, data) {
var id_ = data.selected[0].id, var id_ = data.selected[0].id,
i_ = app.user.ui.groups.indexOf(id_); i_ = pandora.user.ui.groups.indexOf(id_);
if (i_ == -1) { if (i_ == -1) {
// new group was not part of old group set // new group was not part of old group set
if (app.ui.groups[i].query.conditions.length) { if (pandora.user.queryGroups[i].query.conditions.length) {
// if group with selection gets replaced, reload // if group with selection gets replaced, reload
app.ui.groups[i].query.conditions = []; pandora.user.queryGroups[i].query.conditions = [];
pandora.reloadGroups(i); pandora.reloadGroups(i);
} }
app.ui.groups[i] = getGroupObject(id_); pandora.user.queryGroups[i] = getGroupObject(id_);
app.user.ui.groups[i] = id_; pandora.user.ui.groups[i] = id_;
pandora.UI.set({groups: app.user.ui.groups}); pandora.UI.set({groups: pandora.user.ui.groups});
replaceGroup(i, id_); replaceGroup(i, id_);
} else { } else {
// swap two existing groups // swap two existing groups
var group = $.extend({}, app.ui.groups[i]); var group = $.extend({}, pandora.user.queryGroups[i]);
app.ui.groups[i] = app.ui.groups[i_]; pandora.user.queryGroups[i] = pandora.user.queryGroups[i_];
app.ui.groups[i_] = group; pandora.user.queryGroups[i_] = group;
app.user.ui.groups[i] = id_; pandora.user.ui.groups[i] = id_;
app.user.ui.groups[i_] = id; pandora.user.ui.groups[i_] = id;
pandora.UI.set({groups: app.user.ui.groups}); pandora.UI.set({groups: pandora.user.ui.groups});
replaceGroup(i, id_, app.ui.groups[i].query); replaceGroup(i, id_, pandora.user.queryGroups[i].query);
replaceGroup(i_, id, app.ui.groups[i_].query); replaceGroup(i_, id, pandora.user.queryGroups[i_].query);
} }
function replaceGroup(i, id, query) { function replaceGroup(i, id, query) {
// if query is passed, selected items will be derived from it // if query is passed, selected items will be derived from it
var isOuter = i % 4 == 0; var isOuter = i % 4 == 0;
app.$ui[isOuter ? 'browser' : 'groupsInnerPanel'].replaceElement( pandora.$ui[isOuter ? 'browser' : 'groupsInnerPanel'].replaceElement(
isOuter ? i / 2 : i - 1, isOuter ? i / 2 : i - 1,
app.$ui.groups[i] = pandora.ui.group(id, query) pandora.$ui.groups[i] = pandora.ui.group(id, query)
); );
} }
}) })
.appendTo(that.$bar.$element); .appendTo(that.$bar.$element);
if (!query) { if (!query) {
// if query is set, group object has already been taken care of // if query is set, group object has already been taken care of
app.ui.groups[i] = getGroupObject(id); pandora.user.queryGroups[i] = getGroupObject(id);
} }
function getGroupObject(id) { function getGroupObject(id) {
var i = app.user.ui.groups.indexOf(id), var i = pandora.user.ui.groups.indexOf(id),
title = Ox.getObjectById(app.site.groups, id).title, title = Ox.getObjectById(pandora.site.groups, id).title,
width = pandora.getGroupWidth(i, panelWidth); width = pandora.getGroupWidth(i, panelWidth);
return { return {
id: id, id: id,
@ -141,8 +141,8 @@ pandora.ui.group = function(id, query) {
pandora.ui.groups = function() { pandora.ui.groups = function() {
var $groups = []; var $groups = [];
app.ui.groups = []; pandora.user.queryGroups = [];
app.user.ui.groups.forEach(function(id, i) { pandora.user.ui.groups.forEach(function(id, i) {
$groups[i] = pandora.ui.group(id); $groups[i] = pandora.ui.group(id);
}); });
return $groups; return $groups;
@ -152,15 +152,15 @@ pandora.ui.groupsInnerPanel = function() {
var that = new Ox.SplitPanel({ var that = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.groups[1], element: pandora.$ui.groups[1],
size: app.ui.groups[1].size size: pandora.user.queryGroups[1].size
}, },
{ {
element: app.$ui.groups[2], element: pandora.$ui.groups[2],
}, },
{ {
element: app.$ui.groups[3], element: pandora.$ui.groups[3],
size: app.ui.groups[3].size size: pandora.user.queryGroups[3].size
} }
], ],
orientation: 'horizontal' orientation: 'horizontal'

View file

@ -2,7 +2,7 @@
pandora.ui.info = function() { pandora.ui.info = function() {
var that = new Ox.Element() var that = new Ox.Element()
.append( .append(
app.$ui.infoStill = new Ox.Element() pandora.$ui.infoStill = new Ox.Element()
.css({ .css({
position: 'absolute', position: 'absolute',
left: 0, left: 0,
@ -11,7 +11,7 @@ pandora.ui.info = function() {
}) })
) )
.append( .append(
app.$ui.infoTimeline = new Ox.Element('<img>') pandora.$ui.infoTimeline = new Ox.Element('<img>')
.css({ .css({
position: 'absolute', position: 'absolute',
left: 0, left: 0,
@ -25,25 +25,25 @@ pandora.ui.info = function() {
pandora.resizeFolders(); pandora.resizeFolders();
} }
}); });
if(app.user.ui.item) { if(pandora.user.ui.item) {
pandora.api.getItem(app.user.ui.item, function(result) { pandora.api.getItem(pandora.user.ui.item, function(result) {
app.ui.infoRatio = result.data.stream.aspectRatio; pandora.user.infoRatio = result.data.stream.aspectRatio;
var width = that.width() || 256, var width = that.width() || 256,
height = width / app.ui.infoRatio + 16; height = width / pandora.user.infoRatio + 16;
app.$ui.infoStill.removeElement(); pandora.$ui.infoStill.removeElement();
app.$ui.infoStill = pandora.ui.flipbook(app.user.ui.item) pandora.$ui.infoStill = pandora.ui.flipbook(pandora.user.ui.item)
.appendTo(that.$element); .appendTo(that.$element);
app.$ui.infoStill.css({ pandora.$ui.infoStill.css({
'height': (height-16) + 'px' 'height': (height-16) + 'px'
}); });
that.css({ that.css({
height: height + 'px' height: height + 'px'
}); });
pandora.resizeFolders(); pandora.resizeFolders();
!app.user.ui.showInfo && app.$ui.leftPanel.css({bottom: -height}); !pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height});
app.$ui.leftPanel.size(2, height ); pandora.$ui.leftPanel.size(2, height );
}); });
app.$ui.infoTimeline.attr('src', '/'+app.user.ui.item+'/timeline.16.png'); pandora.$ui.infoTimeline.attr('src', '/'+pandora.user.ui.item+'/timeline.16.png');
} }
return that; return that;
}; };

View file

@ -1,22 +1,22 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.item = function() { pandora.ui.item = function() {
var that = new Ox.Element(); var that = new Ox.Element();
pandora.api.getItem(app.user.ui.item, function(result) { pandora.api.getItem(pandora.user.ui.item, function(result) {
if (result.status.code != 200) { if (result.status.code != 200) {
app.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
Ox.Element().html( Ox.Element().html(
'The '+app.site.itemName.singular+' you are looking for does not exist.')); 'The '+pandora.site.itemName.singular+' you are looking for does not exist.'));
} else if (app.user.ui.itemView == 'calendar') { } else if (pandora.user.ui.itemView == 'calendar') {
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Calendar')); pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Calendar'));
} else if (app.user.ui.itemView == 'clips') { } else if (pandora.user.ui.itemView == 'clips') {
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Clips')); pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Clips'));
} else if (app.user.ui.itemView == 'info') { } else if (pandora.user.ui.itemView == 'info') {
//Ox.print('result.data', result.data) //Ox.print('result.data', result.data)
if (app.user.level == 'admin') { if (pandora.user.level == 'admin') {
var $form, var $form,
$edit = new Ox.Element() $edit = new Ox.Element()
.append($form = new Ox.FormElementGroup({ .append($form = new Ox.FormElementGroup({
elements: Ox.map(app.site.itemKeys, function(key) { elements: Ox.map(pandora.site.itemKeys, function(key) {
return new Ox.Input({ return new Ox.Input({
id: key.id, id: key.id,
label: key.title, label: key.title,
@ -37,7 +37,7 @@ pandora.ui.item = function() {
click: function(event, data) { click: function(event, data) {
var values = $form.value(); var values = $form.value();
var changed = {}; var changed = {};
Ox.map(app.site.itemKeys, function(key, i) { Ox.map(pandora.site.itemKeys, function(key, i) {
if(values[i] && values[i] != ''+result.data[key.id]) { if(values[i] && values[i] != ''+result.data[key.id]) {
if(Ox.isArray(key.type) && key.type[0] == 'string') { if(Ox.isArray(key.type) && key.type[0] == 'string') {
changed[key.id] = values[i].split(', '); changed[key.id] = values[i].split(', ');
@ -47,48 +47,48 @@ pandora.ui.item = function() {
} }
}); });
if(changed) { if(changed) {
pandora.api.editItem(Ox.extend(changed, {id: app.user.ui.item}), function(result) { pandora.api.editItem(Ox.extend(changed, {id: pandora.user.ui.item}), function(result) {
//fixme just reload parts that need reloading //fixme just reload parts that need reloading
window.location.reload(); window.location.reload();
}); });
} }
} }
})); }));
app.$ui.contentPanel.replaceElement(1, app.$ui.item = $edit); pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.item = $edit);
} else { } else {
$.get('/static/html/itemInfo.html', {}, function(template) { $.get('/static/html/itemInfo.html', {}, function(template) {
//Ox.print(template); //Ox.print(template);
app.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
app.$ui.item = new Ox.Element() pandora.$ui.item = new Ox.Element()
.append($.tmpl(template, result.data)) .append($.tmpl(template, result.data))
); );
}); });
} }
} else if (app.user.ui.itemView == 'map') { } else if (pandora.user.ui.itemView == 'map') {
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Map')); pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Map'));
} else if (app.user.ui.itemView == 'player') { } else if (pandora.user.ui.itemView == 'player') {
var video = result.data.stream, var video = result.data.stream,
format = $.support.video.supportedFormat(video.formats); format = $.support.video.supportedFormat(video.formats);
video.height = video.profiles[0]; video.height = video.profiles[0];
video.width = parseInt(video.height * video.aspectRatio / 2) * 2; video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
video.url = video.baseUrl + '/' + video.height + 'p.' + format; video.url = video.baseUrl + '/' + video.height + 'p.' + format;
app.$ui.contentPanel.replaceElement(1, app.$ui.player = new Ox.VideoPanelPlayer({ pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = new Ox.VideoPanelPlayer({
annotationsSize: app.user.ui.annotationsSize, annotationsSize: pandora.user.ui.annotationsSize,
duration: video.duration, duration: video.duration,
height: app.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
position: app.user.ui.videoPosition[app.user.ui.item] || 0, position: pandora.user.ui.videoPosition[pandora.user.ui.item] || 0,
showAnnotations: app.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showControls: app.user.ui.showControls, showControls: pandora.user.ui.showControls,
subtitles: result.data.layers.subtitles.map(function(subtitle) { subtitles: result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value}; return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}), }),
videoHeight: video.height, videoHeight: video.height,
videoId: app.user.ui.item, videoId: pandora.user.ui.item,
videoWidth: video.width, videoWidth: video.width,
videoSize: app.user.ui.videoScreen, videoSize: pandora.user.ui.videoScreen,
videoURL: video.url, videoURL: video.url,
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
change: function(event, data) { change: function(event, data) {
// showAnnotations, showControls, videoScreen // showAnnotations, showControls, videoScreen
@ -99,14 +99,14 @@ pandora.ui.item = function() {
enterfullscreen: pandora.enterFullscreen, enterfullscreen: pandora.enterFullscreen,
exitfullscreen: pandora.exitFullscreen, exitfullscreen: pandora.exitFullscreen,
resize: function(event, data) { resize: function(event, data) {
app.$ui.player.options({ pandora.$ui.player.options({
height: data height: data
}); });
} }
})); }));
} else if (app.user.ui.itemView == 'statistics') { } else if (pandora.user.ui.itemView == 'statistics') {
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Statistics')); pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Statistics'));
} else if (app.user.ui.itemView == 'timeline') { } else if (pandora.user.ui.itemView == 'timeline') {
var layers = [], var layers = [],
video = result.data.stream, video = result.data.stream,
cuts = result.data.cuts || [], cuts = result.data.cuts || [],
@ -117,45 +117,45 @@ pandora.ui.item = function() {
video.profiles.forEach(function(profile) { video.profiles.forEach(function(profile) {
streams[profile] = video.baseUrl + '/' + profile + 'p.' + format; streams[profile] = video.baseUrl + '/' + profile + 'p.' + format;
}); });
$.each(app.site.layers, function(i, layer) { $.each(pandora.site.layers, function(i, layer) {
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]}); layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
}); });
app.$ui.contentPanel.replaceElement(1, app.$ui.editor = new Ox.VideoEditor({ pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = new Ox.VideoEditor({
annotationsSize: app.user.ui.annotationsSize, annotationsSize: pandora.user.ui.annotationsSize,
cuts: cuts, cuts: cuts,
duration: video.duration, duration: video.duration,
find: '', find: '',
getFrameURL: function(position) { getFrameURL: function(position) {
return '/' + app.user.ui.item + '/frame/' + video.width.toString() + '/' + position.toString() + '.jpg'; return '/' + pandora.user.ui.item + '/frame/' + video.width.toString() + '/' + position.toString() + '.jpg';
}, },
getLargeTimelineImageURL: function(i) { getLargeTimelineImageURL: function(i) {
return '/' + app.user.ui.item + '/timelines/timeline.64.' + i + '.png'; return '/' + pandora.user.ui.item + '/timelines/timeline.64.' + i + '.png';
}, },
getSmallTimelineImageURL: function(i) { getSmallTimelineImageURL: function(i) {
return '/' + app.user.ui.item + '/timelines/timeline.16.' + i + '.png'; return '/' + pandora.user.ui.item + '/timelines/timeline.16.' + i + '.png';
}, },
height: app.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
id: 'editor', id: 'editor',
'in': 0, 'in': 0,
layers: layers, layers: layers,
out: 0, out: 0,
position: app.user.ui.videoPosition[app.user.ui.item] || 0, position: pandora.user.ui.videoPosition[pandora.user.ui.item] || 0,
posterFrame: parseInt(video.duration / 2), posterFrame: parseInt(video.duration / 2),
showAnnotations: app.user.ui.showAnnotations, showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true, showLargeTimeline: true,
// fixme: layers have value, subtitles has text? // fixme: layers have value, subtitles has text?
subtitles: result.data.layers.subtitles.map(function(subtitle) { subtitles: result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value}; return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}), }),
videoHeight: video.height, videoHeight: video.height,
videoId: app.user.ui.item, videoId: pandora.user.ui.item,
videoWidth: video.width, videoWidth: video.width,
videoSize: app.user.ui.videoSize, videoSize: pandora.user.ui.videoSize,
video: streams, video: streams,
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
resize: function(event, data) { resize: function(event, data) {
app.$ui.editor.options({ pandora.$ui.editor.options({
height: data height: data
}); });
}, },
@ -164,16 +164,16 @@ pandora.ui.item = function() {
}, },
addAnnotation: function(event, data) { addAnnotation: function(event, data) {
Ox.print('addAnnotation', data); Ox.print('addAnnotation', data);
data.item = app.user.ui.item; data.item = pandora.user.ui.item;
data.value = 'Click to edit'; data.value = 'Click to edit';
pandora.api.addAnnotation(data, function(result) { pandora.api.addAnnotation(data, function(result) {
app.$ui.editor.addAnnotation(data.layer, result.data); pandora.$ui.editor.addAnnotation(data.layer, result.data);
}); });
}, },
removeAnnotations: function(event, data) { removeAnnotations: function(event, data) {
pandora.api.removeAnnotations(data, function(result) { pandora.api.removeAnnotations(data, function(result) {
//fixme: check for errors //fixme: check for errors
app.$ui.editor.removeAnnotations(data.layer, data.ids); pandora.$ui.editor.removeAnnotations(data.layer, data.ids);
}); });
}, },
updateAnnotation: function(event, data) { updateAnnotation: function(event, data) {
@ -184,27 +184,27 @@ pandora.ui.item = function() {
})); }));
that.bindEvent('resize', function(event, data) { that.bindEvent('resize', function(event, data) {
//Ox.print('resize item', data) //Ox.print('resize item', data)
app.$ui.editor.options({ pandora.$ui.editor.options({
height: data height: data
}); });
}); });
/* /*
app.$ui.rightPanel.bindEvent('resize', function(event, data) { pandora.$ui.rightPanel.bindEvent('resize', function(event, data) {
Ox.print('... rightPanel resize', data, app.$ui.timelinePanel.size(1)) Ox.print('... rightPanel resize', data, pandora.$ui.timelinePanel.size(1))
app.$ui.editor.options({ pandora.$ui.editor.options({
width: data - app.$ui.timelinePanel.size(1) - 1 width: data - pandora.$ui.timelinePanel.size(1) - 1
}); });
}); });
*/ */
} else if (app.user.ui.itemView == 'files') { } else if (pandora.user.ui.itemView == 'files') {
app.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
app.$ui.item = new Ox.FilesView({ pandora.$ui.item = new Ox.FilesView({
id: result.data.id id: result.data.id
}) })
); );
} }
var director = result.data.director?' ('+result.data.director.join(', ')+')':''; var director = result.data.director?' ('+result.data.director.join(', ')+')':'';
app.$ui.total.html(result.data.title + director); pandora.$ui.total.html(result.data.title + director);
}); });
return that; return that;
}; };

View file

@ -3,17 +3,17 @@ pandora.ui.leftPanel = function() {
var that = new Ox.SplitPanel({ var that = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.sectionbar = pandora.ui.sectionbar('buttons'), element: pandora.$ui.sectionbar = pandora.ui.sectionbar('buttons'),
size: 24 size: 24
}, },
{ {
element: app.$ui.folders = pandora.ui.folders() element: pandora.$ui.folders = pandora.ui.folders()
}, },
{ {
collapsed: !app.user.ui.showInfo, collapsed: !pandora.user.ui.showInfo,
collapsible: true, collapsible: true,
element: app.$ui.info = pandora.ui.info(), element: pandora.$ui.info = pandora.ui.info(),
size: app.user.ui.sidebarSize / app.ui.infoRatio + 16 size: pandora.user.ui.sidebarSize / pandora.user.infoRatio + 16
} }
], ],
id: 'leftPanel', id: 'leftPanel',
@ -21,19 +21,19 @@ pandora.ui.leftPanel = function() {
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
var infoSize = Math.round(data / app.ui.infoRatio) + 16; var infoSize = Math.round(data / pandora.user.infoRatio) + 16;
app.user.ui.sidebarSize = data; pandora.user.ui.sidebarSize = data;
if (data < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) { if (data < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
app.$ui.sectionButtons.removeElement(); pandora.$ui.sectionButtons.removeElement();
delete app.$ui.sectionButtons; delete pandora.$ui.sectionButtons;
app.$ui.sectionbar.append(app.$ui.sectionSelect = pandora.ui.sectionSelect()); pandora.$ui.sectionbar.append(pandora.$ui.sectionSelect = pandora.ui.sectionSelect());
} else if (data >= app.ui.sectionButtonsWidth && app.$ui.sectionSelect) { } else if (data >= pandora.site.sectionButtonsWidth && pandora.$ui.sectionSelect) {
app.$ui.sectionSelect.removeElement(); pandora.$ui.sectionSelect.removeElement();
delete app.$ui.sectionSelect; delete pandora.$ui.sectionSelect;
app.$ui.sectionbar.append(app.$ui.sectionButtons = pandora.ui.sectionButtons()); pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons());
} }
!app.user.ui.showInfo && app.$ui.leftPanel.css({bottom: -infoSize}); !pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoSize});
app.$ui.leftPanel.size(2, infoSize); pandora.$ui.leftPanel.size(2, infoSize);
pandora.resizeFolders(); pandora.resizeFolders();
}, },
resizeend: function(event, data) { resizeend: function(event, data) {
@ -42,7 +42,7 @@ pandora.ui.leftPanel = function() {
toggle: function(event, data) { toggle: function(event, data) {
pandora.UI.set({showSidebar: !data.collapsed}); pandora.UI.set({showSidebar: !data.collapsed});
if (data.collapsed) { if (data.collapsed) {
$.each(app.$ui.folderList, function(k, $list) { $.each(pandora.$ui.folderList, function(k, $list) {
$list.loseFocus(); $list.loseFocus();
}); });
} }

View file

@ -5,16 +5,16 @@ pandora.ui.list = function(view) { // fixme: remove view argument
if (view == 'list') { if (view == 'list') {
/* /*
keys = Ox.unique($.merge( keys = Ox.unique($.merge(
$.map(app.user.ui.lists[app.user.ui.list].columns, function(id) { $.map(pandora.user.ui.lists[pandora.user.ui.list].columns, function(id) {
return Ox.getObjectById(app.site.sortKeys, id); return Ox.getObjectById(pandora.site.sortKeys, id);
}), }),
app.site.sortKeys pandora.site.sortKeys
)); ));
Ox.print('$$$$', keys) Ox.print('$$$$', keys)
*/ */
that = new Ox.TextList({ that = new Ox.TextList({
columns: $.map(app.ui.sortKeys, function(key, i) { columns: $.map(pandora.site.sortKeys, function(key, i) {
var position = app.user.ui.lists[app.user.ui.list].columns.indexOf(key.id); var position = pandora.user.ui.lists[pandora.user.ui.list].columns.indexOf(key.id);
return { return {
align: ['string', 'text'].indexOf( align: ['string', 'text'].indexOf(
Ox.isArray(key.type) ? key.type[0]: key.type Ox.isArray(key.type) ? key.type[0]: key.type
@ -29,7 +29,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
type: key.type, type: key.type,
unique: key.id == 'id', unique: key.id == 'id',
visible: position > -1, visible: position > -1,
width: app.user.ui.lists[app.user.ui.list].columnWidth[key.id] || key.columnWidth width: pandora.user.ui.lists[pandora.user.ui.list].columnWidth[key.id] || key.columnWidth
}; };
}), }),
columnsMovable: true, columnsMovable: true,
@ -44,29 +44,29 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}), callback); }), callback);
}, },
scrollbarVisible: true, scrollbarVisible: true,
sort: app.user.ui.lists[app.user.ui.list].sort sort: pandora.user.ui.lists[pandora.user.ui.list].sort
}) })
.bindEvent({ .bindEvent({
columnchange: function(event, data) { columnchange: function(event, data) {
var columnWidth = {} var columnWidth = {}
pandora.UI.set(['lists', app.user.ui.list, 'columns'].join('|'), data.ids); pandora.UI.set(['lists', pandora.user.ui.list, 'columns'].join('|'), data.ids);
/* /*
data.ids.forEach(function(id) { data.ids.forEach(function(id) {
columnWidth[id] = columnWidth[id] =
app.user.ui.lists[app.user.ui.list].columnWidth[id] || pandora.user.ui.lists[pandora.user.ui.list].columnWidth[id] ||
Ox.getObjectById(app.ui.sortKeys, id).width Ox.getObjectById(pandora.site.sortKeys, id).width
}); });
pandora.UI.set(['lists', app.user.ui.list, 'columnWidth'].join('|'), columnWidth); pandora.UI.set(['lists', pandora.user.ui.list, 'columnWidth'].join('|'), columnWidth);
*/ */
}, },
columnresize: function(event, data) { columnresize: function(event, data) {
pandora.UI.set(['lists', app.user.ui.list, 'columnWidth', data.id].join('|'), data.width); pandora.UI.set(['lists', pandora.user.ui.list, 'columnWidth', data.id].join('|'), data.width);
}, },
resize: function(event, data) { // this is the resize event of the split panel resize: function(event, data) { // this is the resize event of the split panel
that.size(); that.size();
}, },
sort: function(event, data) { sort: function(event, data) {
pandora.UI.set(['lists', app.user.ui.list, 'sort'].join('|'), [data]); pandora.UI.set(['lists', pandora.user.ui.list, 'sort'].join('|'), [data]);
} }
}); });
} else if (view == 'icons') { } else if (view == 'icons') {
@ -92,15 +92,15 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}, },
keys: ['director', 'id', 'poster', 'title', 'year'], keys: ['director', 'id', 'poster', 'title', 'year'],
size: 128, size: 128,
sort: app.user.ui.lists[app.user.ui.list].sort, sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
unique: 'id' unique: 'id'
}) })
} else if (view == 'map') { } else if (view == 'map') {
that = new Ox.SplitPanel({ that = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.map = Ox.Map({ element: pandora.$ui.map = Ox.Map({
height: window.innerHeight - app.user.ui.showGroups * app.user.ui.groupsSize - 61, height: window.innerHeight - pandora.user.ui.showGroups * pandora.user.ui.groupsSize - 61,
places: function(data, callback) { places: function(data, callback) {
return pandora.api.findPlaces($.extend({ return pandora.api.findPlaces($.extend({
query: {conditions: [], operator: ''} query: {conditions: [], operator: ''}
@ -108,7 +108,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}, },
showTypes: true, showTypes: true,
toolbar: true, toolbar: true,
width: window.innerWidth - app.user.ui.showSidebar * app.user.ui.sidebarSize - 2 - 144 - Ox.UI.SCROLLBAR_SIZE, width: window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 2 - 144 - Ox.UI.SCROLLBAR_SIZE,
}) })
}, },
{ {
@ -120,13 +120,13 @@ pandora.ui.list = function(view) { // fixme: remove view argument
orientation: 'horizontal' orientation: 'horizontal'
}) })
.bindEvent('resize', function() { .bindEvent('resize', function() {
app.$ui.map.resizeMap(); pandora.$ui.map.resizeMap();
}); });
} else if (view == 'calendar') { } else if (view == 'calendar') {
that = new Ox.SplitPanel({ that = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.calendar = Ox.Calendar({ element: pandora.$ui.calendar = Ox.Calendar({
date: new Date(0), date: new Date(0),
events: [ events: [
{name: 'Thirty Years\' War', start: '1618', end: '1648', type: 'other'}, {name: 'Thirty Years\' War', start: '1618', end: '1648', type: 'other'},
@ -142,9 +142,9 @@ pandora.ui.list = function(view) { // fixme: remove view argument
{name: 'Iran-Iraq War', start: '1980-09-22', end: '1988-08-20', type: 'other'}, {name: 'Iran-Iraq War', start: '1980-09-22', end: '1988-08-20', type: 'other'},
{name: 'Gulf War', start: '1990-08-02', end: '1991-02-28', type: 'other'} {name: 'Gulf War', start: '1990-08-02', end: '1991-02-28', type: 'other'}
], ],
height: window.innerHeight - app.user.ui.showGroups * app.user.ui.groupsSize - 61, height: window.innerHeight - pandora.user.ui.showGroups * pandora.user.ui.groupsSize - 61,
range: [-5000, 5000], range: [-5000, 5000],
width: window.innerWidth - app.user.ui.showSidebar * app.user.ui.sidebarSize - 2 - 144 - Ox.UI.SCROLLBAR_SIZE, width: window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 2 - 144 - Ox.UI.SCROLLBAR_SIZE,
zoom: 4 zoom: 4
}) })
}, },
@ -170,41 +170,41 @@ pandora.ui.list = function(view) { // fixme: remove view argument
['list', 'icons'].indexOf(view) > -1 && that.bind({ ['list', 'icons'].indexOf(view) > -1 && that.bind({
dragstart: function(e) { dragstart: function(e) {
app.$ui.folderList.forEach(function($list, i) { pandora.$ui.folderList.forEach(function($list, i) {
$list.addClass('OxDrop'); $list.addClass('OxDrop');
}); });
}, },
dragend: function(e) { dragend: function(e) {
app.$ui.folderList.forEach(function($list, i) { pandora.$ui.folderList.forEach(function($list, i) {
$list.removeClass('OxDrop'); $list.removeClass('OxDrop');
}); });
}, },
}).bindEvent({ }).bindEvent({
closepreview: function(event, data) { closepreview: function(event, data) {
app.$ui.previewDialog.close(); pandora.$ui.previewDialog.close();
delete app.$ui.previewDialog; delete pandora.$ui.previewDialog;
}, },
copy: function(event, data) { copy: function(event, data) {
Ox.Clipboard.copy({ Ox.Clipboard.copy({
items: data.ids, items: data.ids,
text: $.map(data.ids, function(id) { text: $.map(data.ids, function(id) {
return app.$ui.list.value(id, 'title'); return pandora.$ui.list.value(id, 'title');
}).join('\n') }).join('\n')
}); });
}, },
'delete': function(event, data) { 'delete': function(event, data) {
pandora.getListData().editable && pandora.api.removeListItems({ pandora.getListData().editable && pandora.api.removeListItems({
list: app.user.ui.list, list: pandora.user.ui.list,
items: data.ids items: data.ids
}, pandora.reloadList); }, pandora.reloadList);
}, },
init: function(event, data) { init: function(event, data) {
app.$ui.total.html(pandora.ui.status('total', data)); pandora.$ui.total.html(pandora.ui.status('total', data));
data = []; data = [];
$.each(app.site.totals, function(i, v) { $.each(pandora.site.totals, function(i, v) {
data[v.id] = 0; data[v.id] = 0;
}); });
app.$ui.selected.html(pandora.ui.status('selected', data)); pandora.$ui.selected.html(pandora.ui.status('selected', data));
}, },
open: function(event, data) { open: function(event, data) {
var id = data.ids[0], var id = data.ids[0],
@ -212,8 +212,8 @@ pandora.ui.list = function(view) { // fixme: remove view argument
pandora.URL.set(title, id); pandora.URL.set(title, id);
}, },
openpreview: function(event, data) { openpreview: function(event, data) {
app.requests.preview && pandora.api.cancel(app.requests.preview); pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
app.requests.preview = pandora.api.find({ pandora.requests.preview = pandora.api.find({
keys: ['director', 'id', 'poster', 'title'], keys: ['director', 'id', 'poster', 'title'],
query: { query: {
conditions: $.map(data.ids, function(id, i) { conditions: $.map(data.ids, function(id, i) {
@ -226,27 +226,27 @@ pandora.ui.list = function(view) { // fixme: remove view argument
operator: '|' operator: '|'
} }
}, function(result) { }, function(result) {
var documentHeight = app.$ui.document.height(), var documentHeight = pandora.$ui.document.height(),
item = result.data.items[0], item = result.data.items[0],
title = item.title + (item.director ? ' (' + item.director + ')' : ''), title = item.title + (item.director ? ' (' + item.director + ')' : ''),
dialogHeight = documentHeight - 100, dialogHeight = documentHeight - 100,
dialogWidth; dialogWidth;
app.ui.previewRatio = item.poster.width / item.poster.height, pandora.site.previewRatio = item.poster.width / item.poster.height,
dialogWidth = parseInt((dialogHeight - 48) * app.ui.previewRatio); dialogWidth = parseInt((dialogHeight - 48) * pandora.site.previewRatio);
if ('previewDialog' in app.$ui) { if ('previewDialog' in pandora.$ui) {
app.$ui.previewDialog.options({ pandora.$ui.previewDialog.options({
title: title title: title
}); });
app.$ui.previewImage.animate({ pandora.$ui.previewImage.animate({
opacity: 0 opacity: 0
}, 100, function() { }, 100, function() {
app.$ui.previewDialog.size(dialogWidth, dialogHeight, function() { pandora.$ui.previewDialog.size(dialogWidth, dialogHeight, function() {
app.$ui.previewImage pandora.$ui.previewImage
.attr({ .attr({
src: item.poster.url src: item.poster.url
}) })
.one('load', function() { .one('load', function() {
app.$ui.previewImage pandora.$ui.previewImage
.css({ .css({
width: dialogWidth + 'px', width: dialogWidth + 'px',
height: (dialogHeight - 48 - 2) + 'px', // fixme: why -2 ? height: (dialogHeight - 48 - 2) + 'px', // fixme: why -2 ?
@ -258,9 +258,9 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}); });
}); });
}); });
//Ox.print(app.$ui.document.height(), dialogWidth, 'x', dialogHeight, dialogWidth / (dialogHeight - 48), item.poster.width, 'x', item.poster.height, item.poster.width / item.poster.height) //Ox.print(pandora.$ui.document.height(), dialogWidth, 'x', dialogHeight, dialogWidth / (dialogHeight - 48), item.poster.width, 'x', item.poster.height, item.poster.width / item.poster.height)
} else { } else {
app.$ui.previewImage = $('<img>') pandora.$ui.previewImage = $('<img>')
.attr({ .attr({
src: item.poster.url src: item.poster.url
}) })
@ -274,23 +274,23 @@ pandora.ui.list = function(view) { // fixme: remove view argument
bottom: 0, bottom: 0,
margin: 'auto', margin: 'auto',
}); });
app.$ui.previewDialog = new Ox.Dialog({ pandora.$ui.previewDialog = new Ox.Dialog({
buttons: [ buttons: [
new Ox.Button({ new Ox.Button({
title: 'Close', title: 'Close',
}).bindEvent({ }).bindEvent({
click: function() { click: function() {
app.$ui.previewDialog.close(); pandora.$ui.previewDialog.close();
delete app.$ui.previewDialog; delete pandora.$ui.previewDialog;
app.$ui.list.closePreview(); pandora.$ui.list.closePreview();
} }
}) })
], ],
content: app.$ui.previewImage, content: pandora.$ui.previewImage,
height: dialogHeight, height: dialogHeight,
id: 'previewDialog', id: 'previewDialog',
minHeight: app.ui.previewRatio >= 1 ? 128 / app.ui.previewRatio + 48 : 176, minHeight: pandora.site.previewRatio >= 1 ? 128 / pandora.site.previewRatio + 48 : 176,
minWidth: app.ui.previewRatio >= 1 ? 128 : 176 * app.ui.previewRatio, minWidth: pandora.site.previewRatio >= 1 ? 128 : 176 * pandora.site.previewRatio,
padding: 0, padding: 0,
title: title, title: title,
width: dialogWidth width: dialogWidth
@ -298,59 +298,59 @@ pandora.ui.list = function(view) { // fixme: remove view argument
.bindEvent('resize', function(event, data) { .bindEvent('resize', function(event, data) {
var dialogRatio = data.width / (data.height - 48), var dialogRatio = data.width / (data.height - 48),
height, width; height, width;
if (dialogRatio < app.ui.previewRatio) { if (dialogRatio < pandora.site.previewRatio) {
width = data.width; width = data.width;
height = width / app.ui.previewRatio; height = width / pandora.site.previewRatio;
} else { } else {
height = (data.height - 48 - 2); height = (data.height - 48 - 2);
width = height * app.ui.previewRatio; width = height * pandora.site.previewRatio;
} }
app.$ui.previewImage.css({ pandora.$ui.previewImage.css({
width: width + 'px', width: width + 'px',
height: height + 'px', // fixme: why -2 ? height: height + 'px', // fixme: why -2 ?
}) })
}) })
.open(); .open();
//app.$ui.previewImage = $image; //pandora.$ui.previewImage = $image;
//Ox.print(app.$document.height(), dialogWidth, 'x', dialogHeight, dialogWidth / (dialogHeight - 48), item.poster.width, 'x', item.poster.height, item.poster.width / item.poster.height) //Ox.print(pandora.$document.height(), dialogWidth, 'x', dialogHeight, dialogWidth / (dialogHeight - 48), item.poster.width, 'x', item.poster.height, item.poster.width / item.poster.height)
} }
}); });
}, },
paste: function(event, data) { paste: function(event, data) {
data.items && pandora.getListData().editable && pandora.api.addListItems({ data.items && pandora.getListData().editable && pandora.api.addListItems({
list: app.user.ui.list, list: pandora.user.ui.list,
items: data.items items: data.items
}, pandora.reloadList); }, pandora.reloadList);
}, },
select: function(event, data) { select: function(event, data) {
var $still, $timeline; var $still, $timeline;
app.ui.selectedMovies = data.ids; pandora.user.selectedMovies = data.ids;
if (data.ids.length) { if (data.ids.length) {
app.$ui.mainMenu.enableItem('copy'); pandora.$ui.mainMenu.enableItem('copy');
app.$ui.mainMenu.enableItem('openmovie'); pandora.$ui.mainMenu.enableItem('openmovie');
} else { } else {
app.$ui.mainMenu.disableItem('copy'); pandora.$ui.mainMenu.disableItem('copy');
app.$ui.mainMenu.disableItem('openmovie'); pandora.$ui.mainMenu.disableItem('openmovie');
} }
if (data.ids.length == 1) { if (data.ids.length == 1) {
pandora.api.getItem(data.ids[0], function(result) { pandora.api.getItem(data.ids[0], function(result) {
app.ui.infoRatio = result.data.stream.aspectRatio; pandora.user.infoRatio = result.data.stream.aspectRatio;
var height = app.$ui.info.width() / app.ui.infoRatio + 16; var height = pandora.$ui.info.width() / pandora.user.infoRatio + 16;
if(app.$ui.infoStill) app.$ui.infoStill.removeElement(); if(pandora.$ui.infoStill) pandora.$ui.infoStill.removeElement();
app.$ui.infoStill = pandora.ui.flipbook(data.ids[0]) pandora.$ui.infoStill = pandora.ui.flipbook(data.ids[0])
.appendTo(app.$ui.info.$element); .appendTo(pandora.$ui.info.$element);
app.$ui.infoStill.css({ pandora.$ui.infoStill.css({
'height': (height - 16) + 'px' 'height': (height - 16) + 'px'
}); });
!app.user.ui.showInfo && app.$ui.leftPanel.css({bottom: -height}); !pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height});
app.$ui.leftPanel.size(2, height); pandora.$ui.leftPanel.size(2, height);
app.$ui.info.animate({ pandora.$ui.info.animate({
height: height + 'px' height: height + 'px'
}, 250, function() { }, 250, function() {
pandora.resizeFolders(); pandora.resizeFolders();
}); });
}); });
app.$ui.infoTimeline.attr('src', '/'+data.ids[0]+'/timeline.16.png') pandora.$ui.infoTimeline.attr('src', '/'+data.ids[0]+'/timeline.16.png')
} }
pandora.api.find({ pandora.api.find({
query: { query: {
@ -364,26 +364,26 @@ pandora.ui.list = function(view) { // fixme: remove view argument
operator: '|' operator: '|'
} }
}, function(result) { }, function(result) {
app.$ui.selected.html(pandora.ui.status('selected', result.data)); pandora.$ui.selected.html(pandora.ui.status('selected', result.data));
}); });
}, },
sort: function(event, data) { sort: function(event, data) {
/* some magic has already set user.ui.sort /* some magic has already set user.ui.sort
Ox.print(':', user.ui.sort[0]) Ox.print(':', user.ui.sort[0])
if (data.key != user.ui.sort[0].key) { if (data.key != user.ui.sort[0].key) {
app.$ui.mainMenu.checkItem('sort_sortmovies_' + data.key); pandora.$ui.mainMenu.checkItem('sort_sortmovies_' + data.key);
} }
if (data.operator != user.ui.sort[0].operator) { if (data.operator != user.ui.sort[0].operator) {
app.$ui.mainMenu.checkItem('sort_ordermovies_' + data.operator === '' ? 'ascending' : 'descending'); pandora.$ui.mainMenu.checkItem('sort_ordermovies_' + data.operator === '' ? 'ascending' : 'descending');
} }
user.ui.sort[0] = data; user.ui.sort[0] = data;
*/ */
app.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + data.key); pandora.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + data.key);
app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (data.operator === '' ? 'ascending' : 'descending')); pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (data.operator === '' ? 'ascending' : 'descending'));
} }
}); });
that.display = function() { // fixme: used? that.display = function() { // fixme: used?
app.$ui.rightPanel.replaceElement(1, app.$ui.contentPanel = pandora.ui.contentPanel()); pandora.$ui.rightPanel.replaceElement(1, pandora.$ui.contentPanel = pandora.ui.contentPanel());
}; };
return that; return that;
}; };

View file

@ -4,14 +4,14 @@ pandora.ui.mainPanel = function() {
elements: [ elements: [
{ {
collapsible: true, collapsible: true,
collapsed: !app.user.ui.showSidebar, collapsed: !pandora.user.ui.showSidebar,
element: app.$ui.leftPanel = pandora.ui.leftPanel(), element: pandora.$ui.leftPanel = pandora.ui.leftPanel(),
resizable: true, resizable: true,
resize: [192, 256, 320, 384], resize: [192, 256, 320, 384],
size: app.user.ui.sidebarSize size: pandora.user.ui.sidebarSize
}, },
{ {
element: app.$ui.rightPanel = pandora.ui.rightPanel() element: pandora.$ui.rightPanel = pandora.ui.rightPanel()
} }
], ],
orientation: 'horizontal' orientation: 'horizontal'

View file

@ -1,20 +1,20 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.mainMenu = function() { pandora.ui.mainMenu = function() {
var isGuest = app.user.level == 'guest', var isGuest = pandora.user.level == 'guest',
that = new Ox.MainMenu({ that = new Ox.MainMenu({
extras: [ extras: [
$('<div>').html('beta').css({marginRight: '8px', color: 'rgb(128, 128, 128)'}), $('<div>').html('beta').css({marginRight: '8px', color: 'rgb(128, 128, 128)'}),
app.$ui.loadingIcon = new Ox.LoadingIcon({ pandora.$ui.loadingIcon = new Ox.LoadingIcon({
size: 'medium' size: 'medium'
}) })
], ],
id: 'mainMenu', id: 'mainMenu',
menus: [ menus: [
{ id: app.site.site.id + 'Menu', title: app.site.site.name, items: [ { id: pandora.site.site.id + 'Menu', title: pandora.site.site.name, items: [
{ id: 'home', title: 'Home' }, { id: 'home', title: 'Home' },
{}, {},
{ id: 'about', title: 'About ' + app.site.site.name }, { id: 'about', title: 'About ' + pandora.site.site.name },
{ id: 'news', title: app.site.site.name + ' News' }, { id: 'news', title: pandora.site.site.name + ' News' },
{ id: 'tour', title: 'Take a Tour' }, { id: 'tour', title: 'Take a Tour' },
{ id: 'faq', title: 'Frequently Asked Questions' }, { id: 'faq', title: 'Frequently Asked Questions' },
{ id: 'terms', title: 'Terms of Service' }, { id: 'terms', title: 'Terms of Service' },
@ -25,10 +25,10 @@ pandora.ui.mainMenu = function() {
{ id: 'report', title: 'Report a Bug' } { id: 'report', title: 'Report a Bug' }
] }, ] },
{}, {},
{ id: 'contact', title: 'Contact ' + app.site.site.name } { id: 'contact', title: 'Contact ' + pandora.site.site.name }
] }, ] },
{ id: 'userMenu', title: 'User', items: [ { id: 'userMenu', title: 'User', items: [
{ id: 'username', title: 'User: ' + (isGuest ? 'not logged in' : app.user.username), disabled: true }, { id: 'username', title: 'User: ' + (isGuest ? 'not logged in' : pandora.user.username), disabled: true },
{}, {},
{ id: 'preferences', title: 'Preferences...', disabled: isGuest, keyboard: 'control ,' }, { id: 'preferences', title: 'Preferences...', disabled: isGuest, keyboard: 'control ,' },
{}, {},
@ -37,7 +37,7 @@ pandora.ui.mainMenu = function() {
] }, ] },
{ id: 'listMenu', title: 'List', items: [ { id: 'listMenu', title: 'List', items: [
{ id: 'history', title: 'History', items: [ { id: 'history', title: 'History', items: [
{ id: 'allmovies', title: 'All ' + app.site.itemName.plural } { id: 'allmovies', title: 'All ' + pandora.site.itemName.plural }
] }, ] },
{ id: 'lists', title: 'View List', items: [ { id: 'lists', title: 'View List', items: [
{ id: 'favorites', title: 'Favorites' } { id: 'favorites', title: 'Favorites' }
@ -52,7 +52,7 @@ pandora.ui.mainMenu = function() {
{ id: 'newsmartlist', title: 'New Smart List...', keyboard: 'alt control n' }, { id: 'newsmartlist', title: 'New Smart List...', keyboard: 'alt control n' },
{ id: 'newsmartlistfromresults', title: 'New Smart List from Results...', keyboard: 'shift alt control n' }, { id: 'newsmartlistfromresults', title: 'New Smart List from Results...', keyboard: 'shift alt control n' },
{}, {},
{ id: 'addmovietolist', title: ['Add Selected ' + app.site.itemName.singular + ' to List...', 'Add Selected ' + app.site.itemName.plural + ' to List...'], disabled: true }, { id: 'addmovietolist', title: ['Add Selected ' + pandora.site.itemName.singular + ' to List...', 'Add Selected ' + pandora.site.itemName.plural + ' to List...'], disabled: true },
{}, {},
{ id: 'setposterframe', title: 'Set Poster Frame', disabled: true } { id: 'setposterframe', title: 'Set Poster Frame', disabled: true }
]}, ]},
@ -70,10 +70,10 @@ pandora.ui.mainMenu = function() {
{ id: 'invertselection', title: 'Invert Selection', disabled: true, keyboard: 'alt control a' } { id: 'invertselection', title: 'Invert Selection', disabled: true, keyboard: 'alt control a' }
] }, ] },
{ id: 'viewMenu', title: 'View', items: [ { id: 'viewMenu', title: 'View', items: [
{ id: 'movies', title: 'View ' + app.site.itemName.plural, items: [ { id: 'movies', title: 'View ' + pandora.site.itemName.plural, items: [
{ group: 'viewmovies', min: 0, max: 1, items: $.map(app.site.listViews, function(view, i) { { group: 'viewmovies', min: 0, max: 1, items: $.map(pandora.site.listViews, function(view, i) {
return $.extend({ return $.extend({
checked: app.user.ui.lists[app.user.ui.list].listView == view.id, checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
}, view); }, view);
}) }, }) },
]}, ]},
@ -87,10 +87,10 @@ pandora.ui.mainMenu = function() {
{ id: 'video', title: 'Video' } { id: 'video', title: 'Video' }
] }, ] },
{}, {},
{ id: 'openmovie', title: ['Open ' + app.site.itemName.singular, 'Open ' + app.site.itemName.plural], disabled: true, items: [ { id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], disabled: true, items: [
{ group: 'movieview', min: 0, max: 1, items: $.map(app.site.itemViews, function(view, i) { { group: 'movieview', min: 0, max: 1, items: $.map(pandora.site.itemViews, function(view, i) {
return $.extend({ return $.extend({
checked: app.user.ui.itemView == view.id, checked: pandora.user.ui.itemView == view.id,
}, view); }, view);
}) }, }) },
]}, ]},
@ -98,20 +98,20 @@ pandora.ui.mainMenu = function() {
{ id: 'lists', title: 'Hide Lists', keyboard: 'shift l' }, { id: 'lists', title: 'Hide Lists', keyboard: 'shift l' },
{ id: 'info', title: 'Hide Info', keyboard: 'shift i' }, { id: 'info', title: 'Hide Info', keyboard: 'shift i' },
{ id: 'groups', title: 'Hide Groups', keyboard: 'shift g' }, { id: 'groups', title: 'Hide Groups', keyboard: 'shift g' },
{ id: 'movies', title: 'Hide ' + app.site.itemName.plural, disabled: true, keyboard: 'shift m' } { id: 'movies', title: 'Hide ' + pandora.site.itemName.plural, disabled: true, keyboard: 'shift m' }
]}, ]},
{ id: 'sortMenu', title: 'Sort', items: [ { id: 'sortMenu', title: 'Sort', items: [
{ id: 'sortmovies', title: 'Sort ' + app.site.itemName.plural + ' by', items: [ { id: 'sortmovies', title: 'Sort ' + pandora.site.itemName.plural + ' by', items: [
{ group: 'sortmovies', min: 1, max: 1, items: $.map(app.ui.sortKeys, function(key, i) { { group: 'sortmovies', min: 1, max: 1, items: $.map(pandora.site.sortKeys, function(key, i) {
return $.extend({ return $.extend({
checked: app.user.ui.lists[app.user.ui.list].sort[0].key == key.id, checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id,
}, key); }, key);
}) } }) }
] }, ] },
{ id: 'ordermovies', title: 'Order ' + app.site.itemName.plural, items: [ { id: 'ordermovies', title: 'Order ' + pandora.site.itemName.plural, items: [
{ group: 'ordermovies', min: 1, max: 1, items: [ { group: 'ordermovies', min: 1, max: 1, items: [
{ id: 'ascending', title: 'Ascending', checked: app.user.ui.lists[app.user.ui.list].sort[0].operator === '' }, { id: 'ascending', title: 'Ascending', checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].operator === '' },
{ id: 'descending', title: 'Descending', checked: app.user.ui.lists[app.user.ui.list].sort[0].operator == '-' } { id: 'descending', title: 'Descending', checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].operator == '-' }
]} ]}
] }, ] },
{ id: 'advancedsort', title: 'Advanced Sort...', keyboard: 'shift control s' }, { id: 'advancedsort', title: 'Advanced Sort...', keyboard: 'shift control s' },
@ -120,11 +120,11 @@ pandora.ui.mainMenu = function() {
] }, ] },
{ id: 'findMenu', title: 'Find', items: [ { id: 'findMenu', title: 'Find', items: [
{ id: 'find', title: 'Find', items: [ { id: 'find', title: 'Find', items: [
{ group: 'find', min: 1, max: 1, items: $.map(app.ui.findKeys, function(key, i) { { group: 'find', min: 1, max: 1, items: $.map(pandora.site.findKeys, function(key, i) {
return $.extend({ return $.extend({
checked: app.user.ui.findQuery.conditions.length && checked: pandora.user.ui.findQuery.conditions.length &&
(app.user.ui.findQuery.conditions[0].key == key.id || (pandora.user.ui.findQuery.conditions[0].key == key.id ||
(app.user.ui.findQuery.conditions[0].key === '' && key.id == 'all')), (pandora.user.ui.findQuery.conditions[0].key === '' && key.id == 'all')),
}, key) }, key)
}) } }) }
] }, ] },
@ -149,7 +149,7 @@ pandora.ui.mainMenu = function() {
{ id: 'report', title: 'Report a Bug' }, { id: 'report', title: 'Report a Bug' },
] }, ] },
{ id: 'helpMenu', title: 'Help', items: [ { id: 'helpMenu', title: 'Help', items: [
{ id: 'help', title: app.site.site.name + ' Help', keyboard: 'shift ?' } { id: 'help', title: pandora.site.site.name + ' Help', keyboard: 'shift ?' }
] }, ] },
{ id: 'debugMenu', title: 'Debug', items: [ { id: 'debugMenu', title: 'Debug', items: [
{ id: 'query', title: 'Show pandora.Query' }, { id: 'query', title: 'Show pandora.Query' },
@ -167,7 +167,7 @@ pandora.ui.mainMenu = function() {
change: function(event, data) { change: function(event, data) {
if (data.id == 'find') { if (data.id == 'find') {
var id = data.checked[0].id; var id = data.checked[0].id;
app.$ui.findSelect.selectItem(id); pandora.$ui.findSelect.selectItem(id);
} else if (data.id == 'movieview') { } else if (data.id == 'movieview') {
var view = data.checked[0].id; var view = data.checked[0].id;
var id = document.location.pathname.split('/')[1]; var id = document.location.pathname.split('/')[1];
@ -177,13 +177,13 @@ pandora.ui.mainMenu = function() {
url(id); url(id);
} else if (data.id == 'ordermovies') { } else if (data.id == 'ordermovies') {
var id = data.checked[0].id; var id = data.checked[0].id;
app.$ui.list.sortList(app.user.ui.lists[app.user.ui.list].sort[0].key, id == 'ascending' ? '' : '-'); pandora.$ui.list.sortList(pandora.user.ui.lists[pandora.user.ui.list].sort[0].key, id == 'ascending' ? '' : '-');
} else if (data.id == 'sortmovies') { } else if (data.id == 'sortmovies') {
var id = data.checked[0].id, var id = data.checked[0].id,
operator = pandora.getSortOperator(id); operator = pandora.getSortOperator(id);
app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending')); pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
app.$ui.sortSelect.selectItem(id); pandora.$ui.sortSelect.selectItem(id);
app.$ui.list.sortList(id, operator); pandora.$ui.list.sortList(id, operator);
pandora.URL.set(pandora.Query.toString()); pandora.URL.set(pandora.Query.toString());
} else if (data.id == 'viewmovies') { } else if (data.id == 'viewmovies') {
var view = data.checked[0].id; var view = data.checked[0].id;
@ -221,16 +221,16 @@ pandora.ui.mainMenu = function() {
height: 498, height: 498,
id: 'home', id: 'home',
keys: {enter: 'close', escape: 'close'}, keys: {enter: 'close', escape: 'close'},
title: app.site.site.name, title: pandora.site.site.name,
width: 800 width: 800
}).open(); }).open();
} else if (data.id == 'register') { } else if (data.id == 'register') {
app.$ui.accountDialog = pandora.ui.accountDialog('register').open(); pandora.$ui.accountDialog = pandora.ui.accountDialog('register').open();
} else if (data.id == 'loginlogout') { } else if (data.id == 'loginlogout') {
app.$ui.accountDialog = (app.user.level == 'guest' ? pandora.$ui.accountDialog = (pandora.user.level == 'guest' ?
pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open(); pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open();
} else if (data.id == 'places') { } else if (data.id == 'places') {
app.$ui.placesDialog = pandora.ui.placesDialog().open(); pandora.$ui.placesDialog = pandora.ui.placesDialog().open();
/* /*
var $manage = new Ox.SplitPanel({ var $manage = new Ox.SplitPanel({
elements: [ elements: [
@ -243,9 +243,9 @@ pandora.ui.mainMenu = function() {
orientation: 'horizontal', orientation: 'horizontal',
size: 44 size: 44
}).append( }).append(
app.$ui.findPlacesElement = new Ox.FormElementGroup({ pandora.$ui.findPlacesElement = new Ox.FormElementGroup({
elements: [ elements: [
app.$ui.findPlacesSelect = new Ox.Select({ pandora.$ui.findPlacesSelect = new Ox.Select({
id: 'findPlacesSelect', id: 'findPlacesSelect',
items: [ items: [
{ id: 'name', title: 'Find: Name' }, { id: 'name', title: 'Find: Name' },
@ -257,13 +257,13 @@ pandora.ui.mainMenu = function() {
}) })
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
app.$ui.findPlacesSelect.loseFocus(); pandora.$ui.findPlacesSelect.loseFocus();
app.$ui.findPlacesInput.options({ pandora.$ui.findPlacesInput.options({
placeholder: data.selected[0].title placeholder: data.selected[0].title
}); });
} }
}), }),
app.$ui.findPlacesInput = new Ox.Input({ pandora.$ui.findPlacesInput = new Ox.Input({
clear: true, clear: true,
id: 'findPlacesInput', id: 'findPlacesInput',
placeholder: 'Find: Name', placeholder: 'Find: Name',
@ -277,7 +277,7 @@ pandora.ui.mainMenu = function() {
margin: '4px' margin: '4px'
}) })
).append( ).append(
app.$ui.sortPlacesSelect = new Ox.Select({ pandora.$ui.sortPlacesSelect = new Ox.Select({
id: 'sortPlacesSelect', id: 'sortPlacesSelect',
items: [ items: [
{ id: 'name', title: 'Sort by Name', checked: true }, { id: 'name', title: 'Sort by Name', checked: true },
@ -322,7 +322,7 @@ pandora.ui.mainMenu = function() {
orientation: 'horizontal', orientation: 'horizontal',
size: 24 size: 24
}).append( }).append(
app.$ui.labelsButton = new Ox.Button({ pandora.$ui.labelsButton = new Ox.Button({
id: 'labelsButton', id: 'labelsButton',
title: [ title: [
{id: 'show', title: 'Show Labels'}, {id: 'show', title: 'Show Labels'},
@ -335,7 +335,7 @@ pandora.ui.mainMenu = function() {
margin: '4px' margin: '4px'
}) })
).append( ).append(
app.$ui.findMapInput = new Ox.Input({ pandora.$ui.findMapInput = new Ox.Input({
clear: true, clear: true,
id: 'findMapInput', id: 'findMapInput',
placeholder: 'Find on Map', placeholder: 'Find on Map',
@ -347,23 +347,23 @@ pandora.ui.mainMenu = function() {
}) })
.bindEvent({ .bindEvent({
submit: function(event, data) { submit: function(event, data) {
app.$ui.map.find(data.value, function(location) { pandora.$ui.map.find(data.value, function(location) {
app.$ui.placeNameInput.options({ pandora.$ui.placeNameInput.options({
disabled: false, disabled: false,
value: location.name value: location.name
}); });
app.$ui.placeAliasesInput.options({ pandora.$ui.placeAliasesInput.options({
disabled: false disabled: false
}); });
app.$ui.placeGeonameLabel.options({ pandora.$ui.placeGeonameLabel.options({
disabled: false, disabled: false,
title: location.names.join(', ') title: location.names.join(', ')
}); });
app.$ui.removePlaceButton.options({ pandora.$ui.removePlaceButton.options({
disabled: false disabled: false
}); });
app.$ui.addPlaceButton.options({ pandora.$ui.addPlaceButton.options({
disabled: false disabled: false
}); });
@ -374,7 +374,7 @@ pandora.ui.mainMenu = function() {
size: 24 size: 24
}, },
{ {
element: app.$ui.map = new Ox.Map({ element: pandora.$ui.map = new Ox.Map({
places: ['Boston', 'Brussels', 'Barcelona', 'Berlin', 'Beirut', 'Bombay', 'Bangalore', 'Beijing'] places: ['Boston', 'Brussels', 'Barcelona', 'Berlin', 'Beirut', 'Bombay', 'Bangalore', 'Beijing']
}) })
.css({ .css({
@ -385,33 +385,33 @@ pandora.ui.mainMenu = function() {
}) })
.bindEvent({ .bindEvent({
select: function(event, location) { select: function(event, location) {
app.$ui.placeNameInput.options({ pandora.$ui.placeNameInput.options({
disabled: false, disabled: false,
value: location.name value: location.name
}); });
app.$ui.placeAliasesInput.options({ pandora.$ui.placeAliasesInput.options({
disabled: false disabled: false
}); });
app.$ui.placeGeonameLabel.options({ pandora.$ui.placeGeonameLabel.options({
disabled: false, disabled: false,
title: location.names.join(', ') title: location.names.join(', ')
}); });
app.$ui.removePlaceButton.options({ pandora.$ui.removePlaceButton.options({
disabled: false disabled: false
}); });
app.$ui.addPlaceButton.options({ pandora.$ui.addPlaceButton.options({
disabled: false disabled: false
}); });
} }
}) })
}, },
{ {
element: app.$ui.bottomBar = new Ox.Toolbar({ element: pandora.$ui.bottomBar = new Ox.Toolbar({
orientation: 'horizontal', orientation: 'horizontal',
size: 24 size: 24
}) })
.append( .append(
app.$ui.placeNameInput = new Ox.Input({ pandora.$ui.placeNameInput = new Ox.Input({
disabled: true, disabled: true,
id: 'placeName', id: 'placeName',
placeholder: 'Name', placeholder: 'Name',
@ -423,7 +423,7 @@ pandora.ui.mainMenu = function() {
}) })
) )
.append( .append(
app.$ui.placeAliasesInput = new Ox.Input({ pandora.$ui.placeAliasesInput = new Ox.Input({
disabled: true, disabled: true,
id: 'aliases', id: 'aliases',
placeholder: 'Aliases', placeholder: 'Aliases',
@ -435,11 +435,11 @@ pandora.ui.mainMenu = function() {
}) })
) )
.append( .append(
app.$ui.placeGeonameLabel = new Ox.Label({ pandora.$ui.placeGeonameLabel = new Ox.Label({
disabled: true, disabled: true,
id: 'placeGeoname', id: 'placeGeoname',
title: 'Geoname', title: 'Geoname',
width: parseInt(app.$ui.document.width() * 0.8) - 256 - 256 - 32 - 24 width: parseInt(pandora.$ui.document.width() * 0.8) - 256 - 256 - 32 - 24
}) })
.css({ .css({
float: 'left', float: 'left',
@ -447,7 +447,7 @@ pandora.ui.mainMenu = function() {
}) })
) )
.append( .append(
app.$ui.addPlaceButton = new Ox.Button({ pandora.$ui.addPlaceButton = new Ox.Button({
disabled: true, disabled: true,
id: 'addPlaceButton', id: 'addPlaceButton',
title: 'add', title: 'add',
@ -459,7 +459,7 @@ pandora.ui.mainMenu = function() {
}) })
) )
.append( .append(
app.$ui.removePlaceButton = new Ox.Button({ pandora.$ui.removePlaceButton = new Ox.Button({
disabled: true, disabled: true,
id: 'removePlaceButton', id: 'removePlaceButton',
title: 'remove', title: 'remove',
@ -493,13 +493,13 @@ pandora.ui.mainMenu = function() {
value: 'Close' value: 'Close'
} }
], ],
height: parseInt(app.$ui.document.height() * 0.8), height: parseInt(pandora.$ui.document.height() * 0.8),
id: 'places', id: 'places',
minHeight: 400, minHeight: 400,
minWidth: 600, minWidth: 600,
padding: 0, padding: 0,
title: 'Manage Places', title: 'Manage Places',
width: parseInt(app.$ui.document.width() * 0.8) width: parseInt(pandora.$ui.document.width() * 0.8)
}).css({ }).css({
overflow: 'hidden' overflow: 'hidden'
}).append($manage).open(); }).append($manage).open();
@ -519,8 +519,8 @@ pandora.ui.mainMenu = function() {
content: new Ox.Element() content: new Ox.Element()
.html([ .html([
'Query: ' + JSON.stringify(pandora.Query.toObject()), 'Query: ' + JSON.stringify(pandora.Query.toObject()),
'findQuery: ' + JSON.stringify(app.user.ui.findQuery), 'findQuery: ' + JSON.stringify(pandora.user.ui.findQuery),
'listQuery: ' + JSON.stringify(app.user.ui.listQuery) 'listQuery: ' + JSON.stringify(pandora.user.ui.listQuery)
].join('<br/><br/>')), ].join('<br/><br/>')),
height: 200, height: 200,
keys: {enter: 'close', escape: 'close'}, keys: {enter: 'close', escape: 'close'},
@ -528,7 +528,7 @@ pandora.ui.mainMenu = function() {
}).open(); }).open();
} else if (data.id == 'resetui') { } else if (data.id == 'resetui') {
pandora.api.resetUI({}, function() { pandora.api.resetUI({}, function() {
app.$ui.appPanel.reload(); pandora.$ui.appPanel.reload();
}); });
} }
} }

View file

@ -13,7 +13,7 @@ pandora.ui.placesDialog = function() {
} }
}) })
], ],
content: app.$ui.placesElement = new Ox.ListMap({ content: pandora.$ui.placesElement = new Ox.ListMap({
height: height - 48, height: height - 48,
places: function(data, callback) { places: function(data, callback) {
return pandora.api.findPlaces($.extend({ return pandora.api.findPlaces($.extend({

View file

@ -1,29 +1,29 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.rightPanel = function() { pandora.ui.rightPanel = function() {
var that; var that;
if (app.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
that = new Ox.Element() that = new Ox.Element()
.html(app.user.ui.sitePage) .html(pandora.user.ui.sitePage)
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
} }
}); });
pandora.api.getPage(app.user.ui.sitePage, function(result) { pandora.api.getPage(pandora.user.ui.sitePage, function(result) {
that.html(result.data.body).css({'overflow-y':'auto'}); that.html(result.data.body).css({'overflow-y':'auto'});
}); });
} else if (app.user.ui.section == 'items') { } else if (pandora.user.ui.section == 'items') {
that = new Ox.SplitPanel({ that = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.toolbar = pandora.ui.toolbar(), element: pandora.$ui.toolbar = pandora.ui.toolbar(),
size: 24 size: 24
}, },
{ {
element: app.$ui.contentPanel = pandora.ui.contentPanel() element: pandora.$ui.contentPanel = pandora.ui.contentPanel()
}, },
{ {
element: app.$ui.statusbar = pandora.ui.statusbar(), element: pandora.$ui.statusbar = pandora.ui.statusbar(),
size: 16 size: 16
} }
], ],
@ -33,18 +33,18 @@ pandora.ui.rightPanel = function() {
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
//Ox.print('???? resize rightPanel', event, data) //Ox.print('???? resize rightPanel', event, data)
if (!app.user.ui.item) { if (!pandora.user.ui.item) {
pandora.resizeGroups(data); pandora.resizeGroups(data);
app.$ui.list.size(); pandora.$ui.list.size();
if (app.user.ui.lists[app.user.ui.list].listView == 'map') { if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'map') {
app.$ui.map.resizeMap(); pandora.$ui.map.resizeMap();
} }
} else { } else {
app.$ui.browser.scrollToSelection(); pandora.$ui.browser.scrollToSelection();
app.user.ui.itemView == 'player' && app.$ui.player.options({ pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({
width: data width: data
}); });
app.user.ui.itemView == 'timeline' && app.$ui.editor.options({ pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({
width: data width: data
}); });
} }

View file

@ -2,10 +2,10 @@
pandora.ui.sectionButtons = function() { pandora.ui.sectionButtons = function() {
var that = new Ox.ButtonGroup({ var that = new Ox.ButtonGroup({
buttons: [ buttons: [
{id: 'site', selected: app.user.ui.section == 'site', title: app.site.site.name}, {id: 'site', selected: pandora.user.ui.section == 'site', title: pandora.site.site.name},
{id: 'items', selected: app.user.ui.section == 'items', title: app.site.itemName.plural}, {id: 'items', selected: pandora.user.ui.section == 'items', title: pandora.site.itemName.plural},
{id: 'texts', selected: app.user.ui.section == 'texts', title: 'Texts'}, {id: 'texts', selected: pandora.user.ui.section == 'texts', title: 'Texts'},
{id: 'admin', selected: app.user.ui.section == 'admin', title: 'Admin'} {id: 'admin', selected: pandora.user.ui.section == 'admin', title: 'Admin'}
], ],
id: 'sectionButtons', id: 'sectionButtons',
selectable: true selectable: true
@ -17,7 +17,7 @@ pandora.ui.sectionButtons = function() {
change: function(event, data) { change: function(event, data) {
var section = data.selected[0]; var section = data.selected[0];
if (section == 'site') { if (section == 'site') {
pandora.URL.set(app.user.ui.sitePage); pandora.URL.set(pandora.user.ui.sitePage);
} else if (section == 'items') { } else if (section == 'items') {
pandora.URL.set(pandora.Query.toString()); pandora.URL.set(pandora.Query.toString());
} else if (section == 'texts') { } else if (section == 'texts') {

View file

@ -4,10 +4,10 @@ pandora.ui.sectionSelect = function() {
var that = new Ox.Select({ var that = new Ox.Select({
id: 'sectionSelect', id: 'sectionSelect',
items: [ items: [
{checked: app.user.ui.section == 'site', id: 'site', title: app.site.site.name}, {checked: pandora.user.ui.section == 'site', id: 'site', title: pandora.site.site.name},
{checked: app.user.ui.section == 'items', id: 'items', title: app.site.itemName.plural}, {checked: pandora.user.ui.section == 'items', id: 'items', title: pandora.site.itemName.plural},
{checked: app.user.ui.section == 'texts', id: 'texts', title: 'Texts'}, {checked: pandora.user.ui.section == 'texts', id: 'texts', title: 'Texts'},
{checked: app.user.ui.section == 'admin', id: 'admin', title: 'Admin'} {checked: pandora.user.ui.section == 'admin', id: 'admin', title: 'Admin'}
] ]
}).css({ }).css({
float: 'left', float: 'left',

View file

@ -5,8 +5,8 @@ pandora.ui.sectionbar = function(mode) {
}) })
.append( .append(
mode == 'buttons' ? mode == 'buttons' ?
app.$ui.sectionButtons = pandora.ui.sectionButtons() : pandora.$ui.sectionButtons = pandora.ui.sectionButtons() :
app.$ui.sectionSelect = pandora.ui.sectionSelect() pandora.$ui.sectionSelect = pandora.ui.sectionSelect()
); );
that.toggle = function() { that.toggle = function() {

View file

@ -2,10 +2,10 @@
pandora.ui.sortSelect = function() { pandora.ui.sortSelect = function() {
var that = new Ox.Select({ var that = new Ox.Select({
id: 'sortSelect', id: 'sortSelect',
items: $.map(app.ui.sortKeys, function(key) { items: $.map(pandora.site.sortKeys, function(key) {
//Ox.print('????', app.user.ui.lists[app.user.ui.list].sort.key, key.id) //Ox.print('????', pandora.user.ui.lists[pandora.user.ui.list].sort.key, key.id)
return $.extend($.extend({}, key), { return $.extend($.extend({}, key), {
checked: app.user.ui.lists[app.user.ui.list].sort[0].key == key.id, checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id,
title: 'Sort by ' + key.title title: 'Sort by ' + key.title
}); });
}), }),
@ -20,14 +20,14 @@ pandora.ui.sortSelect = function() {
var id = data.selected[0].id, var id = data.selected[0].id,
operator = pandora.getSortOperator(id); operator = pandora.getSortOperator(id);
/* /*
app.user.ui.lists[app.user.ui.list].sort[0] = { pandora.user.ui.lists[pandora.user.ui.list].sort[0] = {
key: id, key: id,
operator: operator operator: operator
}; };
*/ */
app.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + id); pandora.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + id);
app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending')); pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
app.$ui.list.sortList(id, operator); pandora.$ui.list.sortList(id, operator);
pandora.URL.set(pandora.Query.toString()); pandora.URL.set(pandora.Query.toString());
} }
}); });

View file

@ -13,13 +13,13 @@ pandora.ui.statusbar = function() {
fontSize: '9px' fontSize: '9px'
}) })
.append( .append(
app.$ui.total = new Ox.Element('span') pandora.$ui.total = new Ox.Element('span')
) )
.append( .append(
new Ox.Element('span').html(' &mdash; ') new Ox.Element('span').html(' &mdash; ')
) )
.append( .append(
app.$ui.selected = new Ox.Element('span') pandora.$ui.selected = new Ox.Element('span')
) )
); );
return that; return that;

View file

@ -5,20 +5,20 @@ pandora.ui.toolbar = function() {
}).css({ }).css({
zIndex: 2 // fixme: remove later zIndex: 2 // fixme: remove later
}); });
app.user.ui.item && that.append( pandora.user.ui.item && that.append(
app.$ui.backButton = pandora.ui.backButton() pandora.$ui.backButton = pandora.ui.backButton()
); );
that.append( that.append(
app.$ui.viewSelect = pandora.ui.viewSelect() pandora.$ui.viewSelect = pandora.ui.viewSelect()
); );
!app.user.ui.item && that.append( !pandora.user.ui.item && that.append(
app.$ui.sortSelect = pandora.ui.sortSelect() pandora.$ui.sortSelect = pandora.ui.sortSelect()
); );
that.append( that.append(
app.$ui.findElement = pandora.ui.findElement() pandora.$ui.findElement = pandora.ui.findElement()
); );
that.display = function() { that.display = function() {
app.$ui.rightPanel.replaceElement(0, app.$ui.toolbar = pandora.ui.toolbar()); // fixme: remove later pandora.$ui.rightPanel.replaceElement(0, pandora.$ui.toolbar = pandora.ui.toolbar()); // fixme: remove later
} }
return that; return that;
}; };

View file

@ -2,34 +2,34 @@
pandora.ui.viewSelect = function() { pandora.ui.viewSelect = function() {
var that = new Ox.Select({ var that = new Ox.Select({
id: 'viewSelect', id: 'viewSelect',
items: !app.user.ui.item ? $.map(app.site.listViews, function(view) { items: !pandora.user.ui.item ? $.map(pandora.site.listViews, function(view) {
return $.extend($.extend({}, view), { return $.extend($.extend({}, view), {
checked: app.user.ui.lists[app.user.ui.list].listView == view.id, checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
title: 'View ' + view.title title: 'View ' + view.title
}); });
}) : $.map(app.site.itemViews, function(view) { }) : $.map(pandora.site.itemViews, function(view) {
return $.extend($.extend({}, view), { return $.extend($.extend({}, view), {
checked: app.user.ui.itemView == view.id, checked: pandora.user.ui.itemView == view.id,
title: 'View: ' + view.title title: 'View: ' + view.title
}); });
}), }),
width: !app.user.ui.item ? 144 : 128 width: !pandora.user.ui.item ? 144 : 128
}) })
.css({ .css({
float: 'left', float: 'left',
margin: '4px 0 0 4px' margin: '4px 0 0 4px'
}) })
.bindEvent({ .bindEvent({
change: !app.user.ui.item ? function(event, data) { change: !pandora.user.ui.item ? function(event, data) {
var id = data.selected[0].id; var id = data.selected[0].id;
app.$ui.mainMenu.checkItem('viewMenu_movies_' + id); pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + id);
pandora.UI.set(['lists', app.user.ui.list, 'listView'].join('|'), id); pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), id);
pandora.URL.set(pandora.Query.toString()); pandora.URL.set(pandora.Query.toString());
} : function(event, data) { } : function(event, data) {
var id = data.selected[0].id; var id = data.selected[0].id;
//pandora.UI.set({itemView: id}); //pandora.UI.set({itemView: id});
pandora.URL.set(app.user.ui.item + '/' + id); pandora.URL.set(pandora.user.ui.item + '/' + id);
// app.$ui.contentPanel.replaceElement(1, app.$ui.item = pandora.ui.item()); // pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.item = pandora.ui.item());
} }
}); });
return that; return that;