merge app into pandora
This commit is contained in:
parent
ca0ddbe4ff
commit
b3769316b3
35 changed files with 735 additions and 734 deletions
|
@ -7,7 +7,7 @@
|
|||
// fixme: sort=-director doesn't work
|
||||
// fixme: don't reload full right panel on sortSelect
|
||||
// fixme: clear items cache after login/logout
|
||||
// fixme: replace global app object with pandora.app or move to pandora itself
|
||||
|
||||
Ox.load('UI', {
|
||||
debug: true,
|
||||
hideScreen: false,
|
||||
|
@ -21,13 +21,16 @@ Ox.load('Geo', function() {
|
|||
window.pandora = new Ox.App({url: '/api/'}).bindEvent({
|
||||
|
||||
load: function(event, data) {
|
||||
pandora.ui = {};
|
||||
$.extend(pandora, {
|
||||
requests: {},
|
||||
ui: {}
|
||||
});
|
||||
loadResources('/static/json/pandora.json', function() {
|
||||
Ox.print('Ox.App load', data);
|
||||
|
||||
Ox.UI.hideLoadingScreen();
|
||||
|
||||
$.extend(app, {
|
||||
$.extend(pandora, {
|
||||
$ui: {
|
||||
body: $('body'),
|
||||
document: $(document),
|
||||
|
@ -36,46 +39,49 @@ Ox.load('Geo', function() {
|
|||
.unload(unloadWindow)
|
||||
},
|
||||
site: data.site,
|
||||
ui: {
|
||||
findKeys: $.map(data.site.itemKeys, function(key, i) {
|
||||
return key.find ? key : null;
|
||||
}),
|
||||
infoRatio: 16 / 9,
|
||||
sectionElement: 'buttons',
|
||||
sectionFolders: {
|
||||
site: $.merge([
|
||||
{id: 'site', title: 'Site', items: $.merge([
|
||||
{id: 'home', title: 'Home'}
|
||||
], $.merge(data.site.sitePages, [
|
||||
{id: 'software', title: 'Software'},
|
||||
{id: 'help', title: 'Help'}
|
||||
]))},
|
||||
{id: 'user', title: 'User', items: [
|
||||
{id: 'preferences', title: 'Preferences'},
|
||||
{id: 'archives', title: 'Archives'}
|
||||
]}
|
||||
], data.user.level == 'admin' ? [
|
||||
{id: 'admin', title: 'Admin', items: [
|
||||
{id: 'statistics', title: 'Statistics'},
|
||||
{id: 'users', title: 'Users'}
|
||||
]}
|
||||
] : []),
|
||||
items: [
|
||||
{id: 'personal', title: 'Personal Lists'},
|
||||
{id: 'favorite', title: 'Favorite Lists', showBrowser: false},
|
||||
{id: 'featured', title: 'Featured Lists', showBrowser: false}
|
||||
]
|
||||
},
|
||||
selectedMovies: [],
|
||||
sortKeys: $.map(data.site.itemKeys, function(key, i) {
|
||||
return key.columnWidth ? key : null;
|
||||
})
|
||||
},
|
||||
user: data.user.level == 'guest' ? $.extend({}, data.site.user) : data.user
|
||||
});
|
||||
$.extend(pandora.site, {
|
||||
findKeys: $.map(data.site.itemKeys, function(key, i) {
|
||||
return key.find ? key : null;
|
||||
}),
|
||||
sectionFolders: {
|
||||
site: $.merge([
|
||||
{id: 'site', title: 'Site', items: $.merge([
|
||||
{id: 'home', title: 'Home'}
|
||||
], $.merge(data.site.sitePages, [
|
||||
{id: 'software', title: 'Software'},
|
||||
{id: 'help', title: 'Help'}
|
||||
]))},
|
||||
{id: 'user', title: 'User', items: [
|
||||
{id: 'preferences', title: 'Preferences'},
|
||||
{id: 'archives', title: 'Archives'}
|
||||
]}
|
||||
], data.user.level == 'admin' ? [
|
||||
{id: 'admin', title: 'Admin', items: [
|
||||
{id: 'statistics', title: 'Statistics'},
|
||||
{id: 'users', title: 'Users'}
|
||||
]}
|
||||
] : []),
|
||||
items: [
|
||||
{id: 'personal', title: 'Personal Lists'},
|
||||
{id: 'favorite', title: 'Favorite Lists', showBrowser: false},
|
||||
{id: 'featured', title: 'Featured Lists', showBrowser: false}
|
||||
]
|
||||
},
|
||||
sortKeys: $.map(data.site.itemKeys, function(key, i) {
|
||||
return key.columnWidth ? key : null;
|
||||
})
|
||||
|
||||
});
|
||||
$.extend(pandora.user, {
|
||||
infoRatio: 16 / 9,
|
||||
sectionElement: 'buttons',
|
||||
selectedMovies: []
|
||||
});
|
||||
|
||||
if (data.user.level == 'guest' && $.browser.mozilla) {
|
||||
app.user.ui.theme = 'classic';
|
||||
pandora.user.ui.theme = 'classic';
|
||||
}
|
||||
|
||||
pandora.URL.parse();
|
||||
|
@ -83,24 +89,19 @@ Ox.load('Geo', function() {
|
|||
pandora.URL.update();
|
||||
};
|
||||
|
||||
Ox.Theme(app.user.ui.theme);
|
||||
app.$ui.appPanel = pandora.ui.appPanel().display();
|
||||
Ox.Theme(pandora.user.ui.theme);
|
||||
pandora.$ui.appPanel = pandora.ui.appPanel().display();
|
||||
|
||||
Ox.Request.requests() && app.$ui.loadingIcon.start();
|
||||
app.$ui.body.ajaxStart(app.$ui.loadingIcon.start);
|
||||
app.$ui.body.ajaxStop(app.$ui.loadingIcon.stop);
|
||||
Ox.Request.requests() && pandora.$ui.loadingIcon.start();
|
||||
pandora.$ui.body.ajaxStart(pandora.$ui.loadingIcon.start);
|
||||
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/');
|
||||
}
|
||||
});
|
||||
|
||||
app = {
|
||||
requests: {}
|
||||
};
|
||||
|
||||
function loadResources(json, callback, prefix) {
|
||||
prefix = prefix || '';
|
||||
$.getJSON(json, function(files) {
|
||||
|
@ -133,37 +134,37 @@ Ox.load('Geo', function() {
|
|||
|
||||
function resizeWindow() {
|
||||
pandora.resizeFolders();
|
||||
if (!app.user.ui.item) {
|
||||
app.$ui.list.size();
|
||||
pandora.resizeGroups(app.$ui.rightPanel.width());
|
||||
if (app.user.ui.listView == 'map') {
|
||||
app.$ui.map.resize();
|
||||
if (!pandora.user.ui.item) {
|
||||
pandora.$ui.list.size();
|
||||
pandora.resizeGroups(pandora.$ui.rightPanel.width());
|
||||
if (pandora.user.ui.listView == 'map') {
|
||||
pandora.$ui.map.resize();
|
||||
}
|
||||
} else {
|
||||
//Ox.print('app.$ui.window.resize');
|
||||
app.$ui.browser.scrollToSelection();
|
||||
app.user.ui.itemView == 'player' && app.$ui.player.options({
|
||||
//Ox.print('pandora.$ui.window.resize');
|
||||
pandora.$ui.browser.scrollToSelection();
|
||||
pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({
|
||||
// fixme: duplicated
|
||||
height: app.$ui.contentPanel.size(1),
|
||||
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1
|
||||
height: pandora.$ui.contentPanel.size(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
|
||||
height: app.$ui.contentPanel.size(1),
|
||||
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1
|
||||
height: pandora.$ui.contentPanel.size(1),
|
||||
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function unloadWindow() {
|
||||
// fixme: ajax request has to have async set to false for this to work
|
||||
app.user.ui.section == 'items' &&
|
||||
['player', 'timeline'].indexOf(app.user.ui.itemView) > -1 &&
|
||||
app.user.ui.item &&
|
||||
pandora.user.ui.section == 'items' &&
|
||||
['player', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 &&
|
||||
pandora.user.ui.item &&
|
||||
pandora.UI.set(
|
||||
'videoPosition|' + app.user.ui.item,
|
||||
app.$ui[
|
||||
app.user.ui.itemView == 'player' ? 'player' : 'editor'
|
||||
'videoPosition|' + pandora.user.ui.item,
|
||||
pandora.$ui[
|
||||
pandora.user.ui.itemView == 'player' ? 'player' : 'editor'
|
||||
].options('position')
|
||||
);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ pandora.Query = (function() {
|
|||
} else {
|
||||
kv = ((v.indexOf(':') > - 1 ? '' : ':') + v).split(':');
|
||||
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]
|
||||
}, parseValue(kv[1]))], operator: ''};
|
||||
} else {
|
||||
|
@ -93,20 +93,20 @@ pandora.Query = (function() {
|
|||
query = Ox.unserialize(str.substr(1)),
|
||||
sort = [];
|
||||
if ('find' in query) {
|
||||
app.user.ui.listQuery = {conditions: [], operator: ''}; // fixme: hackish
|
||||
app.user.ui.findQuery = parseFind(query.find);
|
||||
if (app.user.ui.listQuery.conditions.length) {
|
||||
list = app.user.ui.listQuery.conditions[0].value;
|
||||
!app.user.ui.lists[list] && pandora.UI.set(
|
||||
['lists', list].join('|'), app.site.user.ui.lists['']
|
||||
pandora.user.ui.listQuery = {conditions: [], operator: ''}; // fixme: hackish
|
||||
pandora.user.ui.findQuery = parseFind(query.find);
|
||||
if (pandora.user.ui.listQuery.conditions.length) {
|
||||
list = pandora.user.ui.listQuery.conditions[0].value;
|
||||
!pandora.user.ui.lists[list] && pandora.UI.set(
|
||||
['lists', list].join('|'), pandora.site.user.ui.lists['']
|
||||
);
|
||||
}
|
||||
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) {
|
||||
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,
|
||||
key = hasOperator ? query.sort.substr(1) : query.sort,
|
||||
operator = hasOperator ? v[0]/*.replace('+', '')*/ : pandora.getSortOperator(key);
|
||||
|
@ -117,26 +117,26 @@ pandora.Query = (function() {
|
|||
}));
|
||||
}
|
||||
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) {
|
||||
//Ox.print('tO', app.user.ui.findQuery.conditions)
|
||||
//Ox.print('tO', pandora.user.ui.findQuery.conditions)
|
||||
// the inner $.merge() creates a clone
|
||||
var conditions = $.merge(
|
||||
$.merge([], app.user.ui.listQuery.conditions),
|
||||
app.user.ui.findQuery.conditions
|
||||
$.merge([], pandora.user.ui.listQuery.conditions),
|
||||
pandora.user.ui.findQuery.conditions
|
||||
),
|
||||
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) {
|
||||
return v.query.conditions.length == 1 ?
|
||||
v.query.conditions : v.query;
|
||||
}
|
||||
}) : []);
|
||||
operator = conditions.length < 2 ? '' : ','; // fixme: should be &
|
||||
//Ox.print('>>', groupId, app.user.ui.find, conditions);
|
||||
//Ox.print('>>', groupId, pandora.user.ui.find, conditions);
|
||||
return {
|
||||
conditions: conditions,
|
||||
operator: operator
|
||||
|
@ -144,14 +144,14 @@ pandora.Query = (function() {
|
|||
},
|
||||
|
||||
toString: function() {
|
||||
//Ox.print('tS', app.user.ui.find)
|
||||
var sort = app.user.ui.lists[app.user.ui.list].sort[0],
|
||||
//Ox.print('tS', pandora.user.ui.find)
|
||||
var sort = pandora.user.ui.lists[pandora.user.ui.list].sort[0],
|
||||
key = sort.key,
|
||||
operator = sort.operator;
|
||||
return '?' + Ox.serialize({
|
||||
find: constructFind(pandora.Query.toObject()),
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ pandora.UI = (function() {
|
|||
Ox.print('key', key, 'val', val);
|
||||
var i = 0,
|
||||
keys = key.split('|'),
|
||||
old = app.user.ui;
|
||||
old = pandora.user.ui;
|
||||
while (i < keys.length - 1) {
|
||||
old = old[keys[i]];
|
||||
i++;
|
||||
|
|
|
@ -43,17 +43,17 @@ pandora.URL = (function() {
|
|||
section: 'items',
|
||||
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) {
|
||||
var split = url.split('/'),
|
||||
item = split[0],
|
||||
view = new RegExp(
|
||||
'^(' + $.map(app.site.itemViews, function(v) {
|
||||
'^(' + $.map(pandora.site.itemViews, function(v) {
|
||||
return v.id;
|
||||
}).join('|') + ')$'
|
||||
).exec(split[1]);
|
||||
view = view ? view[0] : app.user.ui.itemView;
|
||||
view = view ? view[0] : pandora.user.ui.itemView;
|
||||
pandora.UI.set({
|
||||
section: 'items',
|
||||
item: item,
|
||||
|
@ -73,8 +73,8 @@ pandora.URL = (function() {
|
|||
if (arguments.length == 1) { // fixme: remove later
|
||||
url = title;
|
||||
}
|
||||
history.pushState({}, app.site.site.name + (title ? ' - ' + title : ''), '/' + url);
|
||||
old.user.ui = $.extend({}, app.user.ui); // make a clone
|
||||
history.pushState({}, pandora.site.site.name + (title ? ' - ' + title : ''), '/' + url);
|
||||
old.user.ui = $.extend({}, pandora.user.ui); // make a clone
|
||||
this.update();
|
||||
},
|
||||
|
||||
|
@ -95,16 +95,16 @@ pandora.URL = (function() {
|
|||
|
||||
update: function() {
|
||||
this.parse();
|
||||
if (app.user.ui.section != old.user.ui.section) {
|
||||
app.$ui.appPanel.replaceElement(1, app.$ui.mainPanel = pandora.ui.mainPanel());
|
||||
} else if (app.user.ui.sitePage != old.user.ui.sitePage) {
|
||||
app.$ui.mainPanel.replaceElement(1, app.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
} else if (!app.user.ui.item || !old.user.ui.item) {
|
||||
app.$ui.mainPanel.replaceElement(1, app.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
app.$ui.leftPanel.replaceElement(2, app.$ui.info = pandora.ui.info());
|
||||
if (pandora.user.ui.section != old.user.ui.section) {
|
||||
pandora.$ui.appPanel.replaceElement(1, pandora.$ui.mainPanel = pandora.ui.mainPanel());
|
||||
} else if (pandora.user.ui.sitePage != old.user.ui.sitePage) {
|
||||
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
} else if (!pandora.user.ui.item || !old.user.ui.item) {
|
||||
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||
} else {
|
||||
app.$ui.contentPanel.replaceElement(1, pandora.ui.item());
|
||||
app.$ui.leftPanel.replaceElement(2, app.$ui.info = pandora.ui.info());
|
||||
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.item());
|
||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||
}
|
||||
if (
|
||||
old.user.ui.item &&
|
||||
|
@ -112,7 +112,7 @@ pandora.URL = (function() {
|
|||
) {
|
||||
pandora.UI.set(
|
||||
'videoPosition|' + old.user.ui.item,
|
||||
app.$ui[
|
||||
pandora.$ui[
|
||||
old.user.ui.itemView == 'player' ? 'player' : 'editor'
|
||||
].options('position')
|
||||
);
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.enterFullscreen = function() {
|
||||
app.$ui.appPanel.size(0, 0);
|
||||
app.user.ui.showSidebar && app.$ui.mainPanel.size(0, 0);
|
||||
app.$ui.rightPanel.size(0, 0).size(2, 0);
|
||||
!app.user.ui.showMovies && app.$ui.contentPanel.css({
|
||||
pandora.$ui.appPanel.size(0, 0);
|
||||
pandora.user.ui.showSidebar && pandora.$ui.mainPanel.size(0, 0);
|
||||
pandora.$ui.rightPanel.size(0, 0).size(2, 0);
|
||||
!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
|
||||
});
|
||||
app.user.ui.showMovies && app.$ui.contentPanel.size(0, 0);
|
||||
app.$ui.player.options({
|
||||
height: app.$document.height() - 2,
|
||||
width: app.$document.width() - 2
|
||||
pandora.user.ui.showMovies && pandora.$ui.contentPanel.size(0, 0);
|
||||
pandora.$ui.player.options({
|
||||
height: pandora.$document.height() - 2,
|
||||
width: pandora.$document.width() - 2
|
||||
})
|
||||
}
|
||||
|
||||
pandora.exitFullscreen = function() {
|
||||
app.$ui.appPanel.size(0, 20);
|
||||
app.user.ui.showSidebar && app.$ui.mainPanel.size(0, app.user.ui.sidebarSize);
|
||||
app.$ui.rightPanel.size(0, 24).size(2, 16);
|
||||
!app.user.ui.showMovies && app.$ui.contentPanel.css({
|
||||
pandora.$ui.appPanel.size(0, 20);
|
||||
pandora.user.ui.showSidebar && pandora.$ui.mainPanel.size(0, pandora.user.ui.sidebarSize);
|
||||
pandora.$ui.rightPanel.size(0, 24).size(2, 16);
|
||||
!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
|
||||
});
|
||||
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() {
|
||||
var height = 48;
|
||||
app.ui.sectionFolders[app.user.ui.section].forEach(function(folder, i) {
|
||||
height += app.user.ui.showFolder[app.user.ui.section][folder.id] * (
|
||||
pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) {
|
||||
height += pandora.user.ui.showFolder[pandora.user.ui.section][folder.id] * (
|
||||
!!folder.showBrowser * 40 + folder.items * 16
|
||||
);
|
||||
Ox.print('h', height)
|
||||
});
|
||||
/*
|
||||
$.each(app.user.ui.showFolder[app.user.ui.section], function(id, show) {
|
||||
var i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id);
|
||||
$.each(pandora.user.ui.showFolder[pandora.user.ui.section], function(id, show) {
|
||||
var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
|
||||
height += show * (
|
||||
app.ui.sectionFolders[app.user.ui.section][i].showBrowser * 40 +
|
||||
app.ui.sectionFolders[app.user.ui.section][i].items * 16
|
||||
pandora.site.sectionFolders[pandora.user.ui.section][i].showBrowser * 40 +
|
||||
pandora.site.sectionFolders[pandora.user.ui.section][i].items * 16
|
||||
);
|
||||
});
|
||||
*/
|
||||
|
@ -43,10 +43,10 @@ pandora.getFoldersHeight = 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
|
||||
Ox.print(pandora.getFoldersHeight(), '>', app.$ui.leftPanel.height() - 24 - 1 - app.$ui.info.height())
|
||||
if (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() > pandora.$ui.leftPanel.height() - 24 - 1 - pandora.$ui.info.height()) {
|
||||
width -= Ox.UI.SCROLLBAR_SIZE;
|
||||
}
|
||||
return width;
|
||||
|
@ -60,37 +60,37 @@ pandora.getGroupWidth = function(pos, panelWidth) { // fixme: don't pass panelWi
|
|||
}
|
||||
|
||||
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(
|
||||
Ox.isArray(type) ? type[0] : type
|
||||
) > -1 ? '+' : '-';
|
||||
}
|
||||
|
||||
pandora.login = function(data) {
|
||||
app.user = data.user;
|
||||
Ox.Theme(app.user.ui.theme);
|
||||
app.$ui.appPanel.reload();
|
||||
pandora.user = data.user;
|
||||
Ox.Theme(pandora.user.ui.theme);
|
||||
pandora.$ui.appPanel.reload();
|
||||
}
|
||||
|
||||
pandora.logout = function(data) {
|
||||
app.user = data.user;
|
||||
Ox.Theme(app.site.user.ui.theme);
|
||||
app.$ui.appPanel.reload();
|
||||
pandora.user = data.user;
|
||||
Ox.Theme(pandora.site.user.ui.theme);
|
||||
pandora.$ui.appPanel.reload();
|
||||
}
|
||||
|
||||
pandora.reloadGroups = function(i) {
|
||||
var query = pandora.Query.toObject();
|
||||
app.$ui.list.options({
|
||||
pandora.$ui.list.options({
|
||||
items: function(data, callback) {
|
||||
return pandora.api.find($.extend(data, {
|
||||
query: query
|
||||
}), callback);
|
||||
}
|
||||
});
|
||||
$.each(app.ui.groups, function(i_, group_) {
|
||||
$.each(pandora.user.queryGroups, function(i_, group_) {
|
||||
if (i_ != i) {
|
||||
//Ox.print('setting groups request', i, i_)
|
||||
app.$ui.groups[i_].options({
|
||||
pandora.$ui.groups[i_].options({
|
||||
items: function(data, callback) {
|
||||
delete data.keys;
|
||||
return pandora.api.find($.extend(data, {
|
||||
|
@ -106,12 +106,12 @@ pandora.reloadGroups = function(i) {
|
|||
|
||||
pandora.getListData = function() {
|
||||
var data = {};
|
||||
if (app.user.ui.list) {
|
||||
var folder = app.$ui.folderList['personal'].options('selected')[0] ==
|
||||
app.user.ui.list ? 'personal' : 'featured';
|
||||
data = app.$ui.folderList[folder].value(app.user.ui.list);
|
||||
if (pandora.user.ui.list) {
|
||||
var folder = pandora.$ui.folderList['personal'].options('selected')[0] ==
|
||||
pandora.user.ui.list ? 'personal' : 'featured';
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -119,32 +119,32 @@ pandora.reloadList = function() {
|
|||
Ox.print('reloadList')
|
||||
var listData = pandora.getListData();
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
app.$ui.groups.forEach(function($group) {
|
||||
pandora.$ui.groups.forEach(function($group) {
|
||||
$group.reloadList();
|
||||
});
|
||||
app.$ui.list.bindEvent({
|
||||
pandora.$ui.list.bindEvent({
|
||||
init: function(event, data) {
|
||||
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({
|
||||
load: function(event, data) {
|
||||
app.$ui.list.gainFocus();
|
||||
if (data) app.$ui.list.options({selected: [data.items]});
|
||||
pandora.$ui.list.gainFocus();
|
||||
if (data) pandora.$ui.list.options({selected: [data.items]});
|
||||
}
|
||||
})
|
||||
.reloadList();
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
//Ox.print('widths', widths);
|
||||
app.$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);
|
||||
$.each(app.$ui.groups, function(i, list) {
|
||||
pandora.$ui.browser.size(0, widths[0].list).size(2, widths[4].list);
|
||||
pandora.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list);
|
||||
$.each(pandora.$ui.groups, function(i, list) {
|
||||
list.resizeColumn('name', widths[i].column);
|
||||
});
|
||||
}
|
||||
|
@ -152,44 +152,44 @@ pandora.resizeGroups = function(width) {
|
|||
pandora.resizeFolders = function() {
|
||||
var width = pandora.getFoldersWidth(),
|
||||
columnWidth = {};
|
||||
if (app.user.ui.section == 'site') {
|
||||
if (pandora.user.ui.section == 'site') {
|
||||
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.name = (width - 88) - columnWidth.user;
|
||||
}
|
||||
//Ox.print('sectionsWidth', width)
|
||||
$.each(app.$ui.folderList, function(id, $list) {
|
||||
var i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id);
|
||||
app.$ui.folder[i].css({width: width + 'px'});
|
||||
$.each(pandora.$ui.folderList, function(id, $list) {
|
||||
var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
|
||||
pandora.$ui.folder[i].css({width: width + 'px'});
|
||||
$list.css({width: width + 'px'});
|
||||
Ox.print('...', id, $list.options())
|
||||
if (app.user.ui.section == 'site') {
|
||||
if (pandora.user.ui.section == 'site') {
|
||||
$list.resizeColumn('title', columnWidth.title);
|
||||
} else if (app.user.ui.section == 'items') {
|
||||
if (app.ui.sectionFolders[app.user.ui.section][i].showBrowser) {
|
||||
} else if (pandora.user.ui.section == 'items') {
|
||||
if (pandora.site.sectionFolders[pandora.user.ui.section][i].showBrowser) {
|
||||
$list.resizeColumn('user', columnWidth.user)
|
||||
.resizeColumn('name', columnWidth.name);
|
||||
} else {
|
||||
$list.resizeColumn(id == 'favorite' ? 'id' : 'name', width - 88);
|
||||
}
|
||||
}
|
||||
if (!app.user.ui.showFolder[app.user.ui.section][id]) {
|
||||
app.$ui.folder[i].update();
|
||||
if (!pandora.user.ui.showFolder[pandora.user.ui.section][id]) {
|
||||
pandora.$ui.folder[i].update();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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() {
|
||||
if (app.user.ui.list) {
|
||||
if (pandora.user.ui.list) {
|
||||
pandora.api.findLists({
|
||||
keys: ['status', 'user'],
|
||||
query: {
|
||||
conditions: [{key: 'id', value: app.user.ui.list, operator: '='}],
|
||||
conditions: [{key: 'id', value: pandora.user.ui.list, operator: '='}],
|
||||
operator: ''
|
||||
},
|
||||
range: [0, 1]
|
||||
|
@ -198,14 +198,14 @@ pandora.selectList = function() {
|
|||
if (result.data.items.length) {
|
||||
list = result.data.items[0];
|
||||
folder = list.status == 'featured' ? 'featured' : (
|
||||
list.user == app.user.username ? 'personal' : 'favorite'
|
||||
list.user == pandora.user.username ? 'personal' : 'favorite'
|
||||
);
|
||||
app.$ui.folderList[folder]
|
||||
.options('selected', [app.user.ui.list])
|
||||
pandora.$ui.folderList[folder]
|
||||
.options('selected', [pandora.user.ui.list])
|
||||
.gainFocus();
|
||||
} else {
|
||||
app.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.list = '';
|
||||
//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());
|
||||
}
|
||||
})
|
||||
|
|
|
@ -11,7 +11,7 @@ pandora.ui.accountDialog = function(action) {
|
|||
.bindEvent({
|
||||
resize: function(event, data) {
|
||||
var width = data.width - 32;
|
||||
app.$ui.accountForm.items.forEach(function(item) {
|
||||
pandora.$ui.accountForm.items.forEach(function(item) {
|
||||
item.options({width: width});
|
||||
});
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ pandora.ui.accountDialog = function(action) {
|
|||
|
||||
pandora.ui.accountDialogOptions = function(action, value) {
|
||||
//Ox.print('ACTION', action)
|
||||
app.$ui.accountForm && app.$ui.accountForm.removeElement();
|
||||
pandora.$ui.accountForm && pandora.$ui.accountForm.removeElement();
|
||||
var buttons = {
|
||||
login: ['register', 'reset'],
|
||||
register: ['login'],
|
||||
|
@ -52,7 +52,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
|||
id: 'cancel' + Ox.toTitleCase(action),
|
||||
title: 'Cancel'
|
||||
}).bindEvent('click', function() {
|
||||
app.$ui.accountDialog.close();
|
||||
pandora.$ui.accountDialog.close();
|
||||
});
|
||||
} else if (type == 'submit') {
|
||||
return new Ox.Button({
|
||||
|
@ -60,7 +60,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
|||
id: 'submit' + Ox.toTitleCase(action),
|
||||
title: buttonTitle[action]
|
||||
}).bindEvent('click', function() {
|
||||
app.$ui.accountForm.submit();
|
||||
pandora.$ui.accountForm.submit();
|
||||
});
|
||||
} else {
|
||||
return new Ox.Button({
|
||||
|
@ -68,7 +68,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
|||
title: buttonTitle[type] + '...'
|
||||
}).bindEvent('click', function() {
|
||||
//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/>')
|
||||
)
|
||||
.append(
|
||||
app.$ui.accountForm = pandora.ui.accountForm(action, value)
|
||||
pandora.$ui.accountForm = pandora.ui.accountForm(action, value)
|
||||
),
|
||||
keys: {
|
||||
enter: 'submit' + Ox.toTitleCase(action),
|
||||
|
@ -97,8 +97,8 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
|||
};
|
||||
|
||||
pandora.ui.accountForm = function(action, value) {
|
||||
if (app.$ui.accountForm) {
|
||||
app.$ui.accountForm.items.forEach(function(item) {
|
||||
if (pandora.$ui.accountForm) {
|
||||
pandora.$ui.accountForm.items.forEach(function(item) {
|
||||
if (item.options('id') == 'usernameOrEmail') {
|
||||
//Ox.print('REMOVING')
|
||||
//Ox.Event.unbind('usernameOrEmailSelect')
|
||||
|
@ -125,7 +125,7 @@ pandora.ui.accountForm = function(action, value) {
|
|||
if (action == 'login') {
|
||||
pandora.api.signin(data, function(result) {
|
||||
if (!result.data.errors) {
|
||||
app.$ui.accountDialog.close();
|
||||
pandora.$ui.accountDialog.close();
|
||||
pandora.login(result.data);
|
||||
} else {
|
||||
callback([{id: 'password', message: 'Incorrect password'}]);
|
||||
|
@ -134,7 +134,7 @@ pandora.ui.accountForm = function(action, value) {
|
|||
} else if (action == 'register') {
|
||||
pandora.api.signup(data, function(result) {
|
||||
if (!result.data.errors) {
|
||||
app.$ui.accountDialog.close();
|
||||
pandora.$ui.accountDialog.close();
|
||||
pandora.login(result.data);
|
||||
pandora.ui.accountWelcomeDialog().open();
|
||||
} else {
|
||||
|
@ -148,7 +148,7 @@ pandora.ui.accountForm = function(action, value) {
|
|||
data[key] = usernameOrEmail[1];
|
||||
pandora.api.requestToken(data, function(result) {
|
||||
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 {
|
||||
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') {
|
||||
pandora.api.resetPassword(data, function(result) {
|
||||
if (!result.data.errors) {
|
||||
app.$ui.accountDialog.close();
|
||||
pandora.$ui.accountDialog.close();
|
||||
pandora.login(result.data);
|
||||
} else {
|
||||
callback([{id: 'code', message: 'Incorrect code'}]);
|
||||
|
@ -170,7 +170,7 @@ pandora.ui.accountForm = function(action, value) {
|
|||
},
|
||||
validate: function(event, data) {
|
||||
//Ox.print('FORM VALIDATE', data)
|
||||
app.$ui.accountDialog[
|
||||
pandora.$ui.accountDialog[
|
||||
(data.valid ? 'enable' : 'disable') + 'Button'
|
||||
]('submit' + Ox.toTitleCase(action));
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ pandora.ui.accountForm = function(action, value) {
|
|||
return new Ox.FormElementGroup({
|
||||
id: 'usernameOrEmail',
|
||||
elements: [
|
||||
app.$ui.usernameOrEmailSelect = new Ox.Select({
|
||||
pandora.$ui.usernameOrEmailSelect = new Ox.Select({
|
||||
id: 'usernameOrEmailSelect',
|
||||
items: [
|
||||
{id: 'username', title: 'Username'},
|
||||
|
@ -274,14 +274,14 @@ pandora.ui.accountForm = function(action, value) {
|
|||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
var selected = data.selected[0].id;
|
||||
app.$ui.usernameOrEmailInput.options({
|
||||
pandora.$ui.usernameOrEmailInput.options({
|
||||
autovalidate: selected == 'username' ? pandora.autovalidateUsername : autovalidateEmail,
|
||||
validate: validateUser(selected, true),
|
||||
value: ''
|
||||
}).focus();
|
||||
}
|
||||
}),
|
||||
app.$ui.usernameOrEmailInput = new Ox.Input({
|
||||
pandora.$ui.usernameOrEmailInput = new Ox.Input({
|
||||
autovalidate: pandora.autovalidateUsername,
|
||||
id: 'usernameOrEmailInput',
|
||||
validate: pandora.validateUser('username', true),
|
||||
|
@ -305,7 +305,7 @@ pandora.ui.accountLogoutDialog = function() {
|
|||
title: 'Cancel'
|
||||
}).bindEvent('click', function() {
|
||||
that.close();
|
||||
app.$ui.mainMenu.getItem('loginlogout').toggleTitle();
|
||||
pandora.$ui.mainMenu.getItem('loginlogout').toggleTitle();
|
||||
}),
|
||||
new Ox.Button({
|
||||
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,
|
||||
keys: {enter: 'close', escape: 'close'},
|
||||
title: 'Welcome to ' + app.site.site.name,
|
||||
title: 'Welcome to ' + pandora.site.site.name,
|
||||
width: 300
|
||||
});
|
||||
return that;
|
||||
|
|
|
@ -3,25 +3,25 @@ pandora.ui.appPanel = function() {
|
|||
var that = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: app.$ui.mainMenu = pandora.ui.mainMenu(),
|
||||
element: pandora.$ui.mainMenu = pandora.ui.mainMenu(),
|
||||
size: 20
|
||||
},
|
||||
{
|
||||
element: app.$ui.mainPanel = pandora.ui.mainPanel()
|
||||
element: pandora.$ui.mainPanel = pandora.ui.mainPanel()
|
||||
}
|
||||
],
|
||||
orientation: 'vertical'
|
||||
});
|
||||
that.display = function() {
|
||||
// fixme: move animation into Ox.App
|
||||
app.$ui.body.css({opacity: 0});
|
||||
that.appendTo(app.$ui.body);
|
||||
app.$ui.body.animate({opacity: 1}, 1000);
|
||||
pandora.$ui.body.css({opacity: 0});
|
||||
that.appendTo(pandora.$ui.body);
|
||||
pandora.$ui.body.animate({opacity: 1}, 1000);
|
||||
return that;
|
||||
}
|
||||
that.reload = function() {
|
||||
app.$ui.appPanel.removeElement();
|
||||
app.$ui.appPanel = pandora.ui.appPanel().appendTo(app.$ui.body);
|
||||
pandora.$ui.appPanel.removeElement();
|
||||
pandora.$ui.appPanel = pandora.ui.appPanel().appendTo(pandora.$ui.body);
|
||||
return that;
|
||||
}
|
||||
return that;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.backButton = function() {
|
||||
var that = Ox.Button({
|
||||
title: 'Back to ' + app.site.itemName.plural,
|
||||
title: 'Back to ' + pandora.site.itemName.plural,
|
||||
width: 96
|
||||
}).css({
|
||||
float: 'left',
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.browser = function() {
|
||||
var that;
|
||||
if (!app.user.ui.item) {
|
||||
app.$ui.groups = pandora.ui.groups();
|
||||
if (!pandora.user.ui.item) {
|
||||
pandora.$ui.groups = pandora.ui.groups();
|
||||
that = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: app.$ui.groups[0],
|
||||
size: app.ui.groups[0].size
|
||||
element: pandora.$ui.groups[0],
|
||||
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],
|
||||
size: app.ui.groups[4].size
|
||||
element: pandora.$ui.groups[4],
|
||||
size: pandora.user.queryGroups[4].size
|
||||
},
|
||||
],
|
||||
id: 'browser',
|
||||
|
@ -22,8 +22,8 @@ pandora.ui.browser = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
resize: function(event, data) {
|
||||
app.user.ui.groupsSize = data;
|
||||
$.each(app.$ui.groups, function(i, list) {
|
||||
pandora.user.ui.groupsSize = data;
|
||||
$.each(pandora.$ui.groups, function(i, list) {
|
||||
list.size();
|
||||
});
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ pandora.ui.browser = function() {
|
|||
},
|
||||
toggle: function(event, data) {
|
||||
pandora.UI.set({showGroups: !data.collapsed});
|
||||
data.collapsed && app.$ui.list.gainFocus();
|
||||
data.collapsed && pandora.$ui.list.gainFocus();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -61,9 +61,9 @@ pandora.ui.browser = function() {
|
|||
max: 1,
|
||||
min: 1,
|
||||
orientation: 'horizontal',
|
||||
selected: [app.user.ui.item],
|
||||
selected: [pandora.user.ui.item],
|
||||
size: 64,
|
||||
sort: app.user.ui.lists[app.user.ui.list].sort,
|
||||
sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
|
||||
unique: 'id'
|
||||
})
|
||||
.bindEvent({
|
||||
|
@ -76,15 +76,15 @@ pandora.ui.browser = function() {
|
|||
toggle: function(event, data) {
|
||||
pandora.UI.set({showMovies: !data.collapsed});
|
||||
if (data.collapsed) {
|
||||
if (app.user.ui.itemView == 'timeline') {
|
||||
app.$ui.editor.gainFocus();
|
||||
if (pandora.user.ui.itemView == 'timeline') {
|
||||
pandora.$ui.editor.gainFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.contentPanel = function() {
|
||||
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,
|
||||
element: app.$ui.browser = pandora.ui.browser(),
|
||||
element: pandora.$ui.browser = pandora.ui.browser(),
|
||||
resizable: true,
|
||||
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,
|
||||
element: app.$ui.browser = pandora.ui.browser(),
|
||||
element: pandora.$ui.browser = pandora.ui.browser(),
|
||||
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'
|
||||
|
|
|
@ -5,7 +5,7 @@ pandora.ui.annotations = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
resize: function(event, data) {
|
||||
app.user.ui.annotationsSize = data;
|
||||
pandora.user.ui.annotationsSize = data;
|
||||
},
|
||||
resizeend: function(event, data) {
|
||||
pandora.UI.set({annotationsSize: data});
|
||||
|
@ -15,7 +15,7 @@ pandora.ui.annotations = function() {
|
|||
}
|
||||
}),
|
||||
$bins = [];
|
||||
$.each(app.site.layers, function(i, layer) {
|
||||
$.each(pandora.site.layers, function(i, layer) {
|
||||
var $bin = new Ox.CollapsePanel({
|
||||
id: layer.id,
|
||||
size: 16,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.filter = function() {
|
||||
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 : {
|
||||
autocomplete: key.autocomplete,
|
||||
autocompleteSortKey: key.autocompleteSortKey,
|
||||
|
@ -9,12 +9,12 @@ pandora.ui.filter = function() {
|
|||
id: key.id,
|
||||
title: key.title,
|
||||
type: key.type == 'layer' ? Ox.getObjectById(
|
||||
app.site.layers, key.id
|
||||
pandora.site.layers, key.id
|
||||
).type : key.type
|
||||
};
|
||||
}),
|
||||
sortKeys: app.ui.sortKeys,
|
||||
viewKeys: app.site.listViews
|
||||
sortKeys: pandora.site.sortKeys,
|
||||
viewKeys: pandora.site.listViews
|
||||
});
|
||||
return that;
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ pandora.ui.filterDialog = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
alert(JSON.stringify(app.$ui.filter.options('query')));
|
||||
alert(JSON.stringify(pandora.$ui.filter.options('query')));
|
||||
}
|
||||
}),
|
||||
new Ox.Button({
|
||||
|
@ -17,7 +17,7 @@ pandora.ui.filterDialog = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
app.$ui.filterDialog.close();
|
||||
pandora.$ui.filterDialog.close();
|
||||
}
|
||||
}),
|
||||
new Ox.Button({
|
||||
|
@ -26,11 +26,11 @@ pandora.ui.filterDialog = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
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,
|
||||
keys: {enter: 'save', escape: 'cancel'},
|
||||
title: 'Advanced Find',
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
pandora.ui.findElement = function() {
|
||||
var findKey = '',
|
||||
findValue = '';
|
||||
if (app.user.ui.findQuery.conditions.length == 1) {
|
||||
findKey = app.user.ui.findQuery.conditions[0].key;
|
||||
findValue = app.user.ui.findQuery.conditions[0].value;
|
||||
if (pandora.user.ui.findQuery.conditions.length == 1) {
|
||||
findKey = pandora.user.ui.findQuery.conditions[0].key;
|
||||
findValue = pandora.user.ui.findQuery.conditions[0].value;
|
||||
}
|
||||
var that = new Ox.FormElementGroup({
|
||||
elements: $.merge(app.user.ui.list ? [
|
||||
app.$ui.findListSelect = new Ox.Select({
|
||||
elements: $.merge(pandora.user.ui.list ? [
|
||||
pandora.$ui.findListSelect = new Ox.Select({
|
||||
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'}
|
||||
],
|
||||
overlap: 'right',
|
||||
|
@ -19,15 +19,15 @@ pandora.ui.findElement = function() {
|
|||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
var key = data.selected[0].id;
|
||||
app.$ui.findInput.options({
|
||||
pandora.$ui.findInput.options({
|
||||
autocomplete: autocompleteFunction()
|
||||
}).focus();
|
||||
}
|
||||
}),
|
||||
] : [], [
|
||||
app.$ui.findSelect = new Ox.Select({
|
||||
pandora.$ui.findSelect = new Ox.Select({
|
||||
id: 'select',
|
||||
items: $.merge($.map(app.ui.findKeys,
|
||||
items: $.merge($.map(pandora.site.findKeys,
|
||||
function(key, i) {
|
||||
return {
|
||||
id: key.id,
|
||||
|
@ -45,21 +45,21 @@ pandora.ui.findElement = function() {
|
|||
change: function(event, data) {
|
||||
var key = data.selected[0].id;
|
||||
if (key == 'advanced') {
|
||||
app.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||
} else {
|
||||
if (!app.user.ui.findQuery.conditions.length) { // fixme: can this case happen at all?
|
||||
app.user.ui.findQuery.conditions = [{key: key, value: '', operator: ''}];
|
||||
if (!pandora.user.ui.findQuery.conditions.length) { // fixme: can this case happen at all?
|
||||
pandora.user.ui.findQuery.conditions = [{key: key, value: '', operator: ''}];
|
||||
} else {
|
||||
app.user.ui.findQuery.conditions[0].key = key;
|
||||
pandora.user.ui.findQuery.conditions[0].key = key;
|
||||
}
|
||||
app.$ui.mainMenu.checkItem('findMenu_find_' + key);
|
||||
app.$ui.findInput.options({
|
||||
pandora.$ui.mainMenu.checkItem('findMenu_find_' + key);
|
||||
pandora.$ui.findInput.options({
|
||||
autocomplete: autocompleteFunction()
|
||||
}).focus();
|
||||
}
|
||||
}
|
||||
}),
|
||||
app.$ui.findInput = new Ox.Input({
|
||||
pandora.$ui.findInput = new Ox.Input({
|
||||
autocomplete: autocompleteFunction(),
|
||||
autocompleteSelect: true,
|
||||
autocompleteSelectHighlight: true,
|
||||
|
@ -71,16 +71,16 @@ pandora.ui.findElement = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
submit: function(event, data) {
|
||||
var key = app.user.ui.findQuery.conditions.length ?
|
||||
app.user.ui.findQuery.conditions[0].key : '';
|
||||
if (app.user.ui.list && that.value()[0].id == 'all') {
|
||||
$.each(app.$ui.folderList, function(k, $list) {
|
||||
var key = pandora.user.ui.findQuery.conditions.length ?
|
||||
pandora.user.ui.findQuery.conditions[0].key : '';
|
||||
if (pandora.user.ui.list && that.value()[0].id == 'all') {
|
||||
$.each(pandora.$ui.folderList, function(k, $list) {
|
||||
$list.options({selected: []});
|
||||
});
|
||||
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,
|
||||
value: data.value,
|
||||
operator: ''
|
||||
|
@ -96,16 +96,16 @@ pandora.ui.findElement = function() {
|
|||
margin: '4px'
|
||||
});
|
||||
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(),
|
||||
key = elementValue[app.user.ui.list ? 1 : 0],
|
||||
findKey = Ox.getObjectById(app.ui.findKeys, key);
|
||||
key = elementValue[pandora.user.ui.list ? 1 : 0],
|
||||
findKey = Ox.getObjectById(pandora.site.findKeys, key);
|
||||
Ox.print('!!!!', key, findKey, 'autocomplete' in findKey && findKey.autocomplete)
|
||||
value === '' && Ox.print('Warning: autocomplete function should never be called with empty value');
|
||||
if ('autocomplete' in findKey && findKey.autocomplete) {
|
||||
pandora.api.autocomplete({
|
||||
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],
|
||||
sort: [{
|
||||
key: 'votes',
|
||||
|
|
|
@ -7,7 +7,7 @@ pandora.ui.folderBrowser = function(id) {
|
|||
size: 24
|
||||
},
|
||||
{
|
||||
element: app.$ui.folderList[id] = pandora.ui.folderBrowserList(id)
|
||||
element: pandora.$ui.folderList[id] = pandora.ui.folderBrowserList(id)
|
||||
}
|
||||
],
|
||||
orientation: 'vertical'
|
||||
|
|
|
@ -3,7 +3,7 @@ pandora.ui.folderBrowserBar = function(id) {
|
|||
var that = new Ox.Bar({
|
||||
size: 24
|
||||
});
|
||||
app.$ui.findListInput = new Ox.Input({
|
||||
pandora.$ui.findListInput = new Ox.Input({
|
||||
placeholder: 'Find User',
|
||||
width: 184 - Ox.UI.SCROLLBAR_SIZE
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.folderBrowserList = function(id) {
|
||||
var columnWidth = (app.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 88) / 2,
|
||||
i = Ox.getPositionById(app.ui.sectionFolders[app.user.ui.section], id),
|
||||
var columnWidth = (pandora.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 88) / 2,
|
||||
i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
|
||||
that = new Ox.TextList({
|
||||
columns: [
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ pandora.ui.folderBrowserList = function(id) {
|
|||
columnsVisible: true,
|
||||
items: function(data, callback) {
|
||||
var query = id == 'favorite' ? {conditions: [
|
||||
{key: 'user', value: app.user.username, operator: '!'},
|
||||
{key: 'user', value: pandora.user.username, operator: '!'},
|
||||
{key: 'status', value: 'public', operator: '='}
|
||||
], operator: '&'} : {conditions: [
|
||||
{key: 'status', value: 'public', operator: '='},
|
||||
|
@ -127,7 +127,7 @@ pandora.ui.folderBrowserList = function(id) {
|
|||
},
|
||||
pageLength: 1000,
|
||||
// fixme: select if previously selected
|
||||
// selected: app.user.ui.list ? [app.user.ui.list] : [],
|
||||
// selected: pandora.user.ui.list ? [pandora.user.ui.list] : [],
|
||||
sort: [
|
||||
{key: 'name', operator: '+'}
|
||||
]
|
||||
|
@ -149,10 +149,10 @@ pandora.ui.folderBrowserList = function(id) {
|
|||
status: that.value(data.id, 'status') == 'featured' ? 'public' : 'featured'
|
||||
}, function(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
|
||||
app.$ui.folderList[
|
||||
result.data.user == app.user.username ? 'personal' : 'favorite'
|
||||
pandora.$ui.folderList[
|
||||
result.data.user == pandora.user.username ? 'personal' : 'favorite'
|
||||
].reloadList();
|
||||
}
|
||||
that.value(data.id, 'status', result.data.status);
|
||||
|
@ -160,22 +160,22 @@ pandora.ui.folderBrowserList = function(id) {
|
|||
}
|
||||
},
|
||||
init: function(event, data) {
|
||||
app.ui.sectionFolders[app.user.ui.section][i].items = data.items;
|
||||
app.$ui.folder[i].$content.css({
|
||||
pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items;
|
||||
pandora.$ui.folder[i].$content.css({
|
||||
height: 40 + data.items * 16 + 'px'
|
||||
});
|
||||
app.$ui.folderList[id].css({
|
||||
pandora.$ui.folderList[id].css({
|
||||
height: 16 + data.items * 16 + 'px'
|
||||
});
|
||||
pandora.resizeFolders();
|
||||
},
|
||||
paste: function(event, data) {
|
||||
app.$ui.list.triggerEvent('paste', data);
|
||||
pandora.$ui.list.triggerEvent('paste', data);
|
||||
},
|
||||
select: function(event, data) {
|
||||
// fixme: duplicated
|
||||
if (data.ids.length) {
|
||||
$.each(app.$ui.folderList, function(id_, $list) {
|
||||
$.each(pandora.$ui.folderList, function(id_, $list) {
|
||||
id != id_ && $list.options('selected', []);
|
||||
});
|
||||
pandora.UI.set({list: data.ids[0]});
|
||||
|
@ -190,9 +190,9 @@ pandora.ui.folderBrowserList = 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;
|
||||
if (app.user.ui.section == 'site') {
|
||||
if (pandora.user.ui.section == 'site') {
|
||||
that = new Ox.TextList({
|
||||
columns: [
|
||||
{
|
||||
|
@ -212,15 +212,15 @@ pandora.ui.folderList = function(id) {
|
|||
id: 'title',
|
||||
operator: '+',
|
||||
visible: true,
|
||||
width: app.user.ui.sidebarSize - 16
|
||||
width: pandora.user.ui.sidebarSize - 16
|
||||
}
|
||||
],
|
||||
items: function(data, callback) {
|
||||
var result = {data: {}};
|
||||
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 {
|
||||
result.data.items = Ox.getObjectById(app.ui.sectionFolders.site, id).items;
|
||||
result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items;
|
||||
}
|
||||
callback(result);
|
||||
},
|
||||
|
@ -231,13 +231,13 @@ pandora.ui.folderList = function(id) {
|
|||
.bindEvent({
|
||||
select: function(event, data) {
|
||||
// fixme: duplicated
|
||||
$.each(app.$ui.folderList, function(id_, $list) {
|
||||
$.each(pandora.$ui.folderList, function(id_, $list) {
|
||||
id != id_ && $list.options('selected', []);
|
||||
})
|
||||
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({
|
||||
columns: [
|
||||
{
|
||||
|
@ -259,11 +259,11 @@ pandora.ui.folderList = function(id) {
|
|||
operator: '+',
|
||||
unique: true,
|
||||
visible: id == 'favorite',
|
||||
width: app.user.ui.sidebarWidth - 88
|
||||
width: pandora.user.ui.sidebarWidth - 88
|
||||
},
|
||||
{
|
||||
editable: function(data) {
|
||||
return data.user == app.user.username;
|
||||
return data.user == pandora.user.username;
|
||||
},
|
||||
id: 'name',
|
||||
input: {
|
||||
|
@ -271,7 +271,7 @@ pandora.ui.folderList = function(id) {
|
|||
},
|
||||
operator: '+',
|
||||
visible: id != 'favorite',
|
||||
width: app.user.ui.sidebarWidth - 88
|
||||
width: pandora.user.ui.sidebarWidth - 88
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
|
@ -328,7 +328,7 @@ pandora.ui.folderList = function(id) {
|
|||
var query;
|
||||
if (id == 'personal') {
|
||||
query = {conditions: [
|
||||
{key: 'user', value: app.user.username, operator: '='},
|
||||
{key: 'user', value: pandora.user.username, operator: '='},
|
||||
{key: 'status', value: 'featured', operator: '!'}
|
||||
], operator: '&'};
|
||||
} else if (id == 'favorite') {
|
||||
|
@ -349,12 +349,12 @@ pandora.ui.folderList = function(id) {
|
|||
sort: [
|
||||
{key: 'position', operator: '+'}
|
||||
],
|
||||
sortable: id == 'personal' || id == 'favorite' || app.user.level == 'admin'
|
||||
sortable: id == 'personal' || id == 'favorite' || pandora.user.level == 'admin'
|
||||
})
|
||||
.css({
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: app.user.ui.sidebarWidth + 'px',
|
||||
width: pandora.user.ui.sidebarWidth + 'px',
|
||||
})
|
||||
.bind({
|
||||
dragenter: function(e) {
|
||||
|
@ -363,9 +363,9 @@ pandora.ui.folderList = function(id) {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function(event, data) {
|
||||
var $list = app.$ui.folderList[id];
|
||||
var $list = pandora.$ui.folderList[id];
|
||||
if (data.key == 'type') {
|
||||
app.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||
} else if (data.key == 'status') {
|
||||
pandora.api.editList({
|
||||
id: data.id,
|
||||
|
@ -376,8 +376,8 @@ pandora.ui.folderList = function(id) {
|
|||
}
|
||||
},
|
||||
'delete': function(event, data) {
|
||||
var $list = app.$ui.folderList[id];
|
||||
app.user.ui.listQuery.conditions = [];
|
||||
var $list = pandora.$ui.folderList[id];
|
||||
pandora.user.ui.listQuery.conditions = [];
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
$list.options({selected: []});
|
||||
if (id == 'personal') {
|
||||
|
@ -385,8 +385,8 @@ pandora.ui.folderList = function(id) {
|
|||
id: data.ids[0]
|
||||
}, function(result) {
|
||||
// fixme: is this the best way to delete a ui preference?
|
||||
delete app.user.ui.lists[data.ids[0]];
|
||||
pandora.UI.set({lists: app.user.ui.lists});
|
||||
delete pandora.user.ui.lists[data.ids[0]];
|
||||
pandora.UI.set({lists: pandora.user.ui.lists});
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
$list.reloadList();
|
||||
});
|
||||
|
@ -397,16 +397,16 @@ pandora.ui.folderList = function(id) {
|
|||
Ox.Request.clearCache(); // fixme: remove
|
||||
$list.reloadList();
|
||||
});
|
||||
} else if (id == 'featured' && app.user.level == 'admin') {
|
||||
} else if (id == 'featured' && pandora.user.level == 'admin') {
|
||||
pandora.api.editList({
|
||||
id: data.ids[0],
|
||||
status: 'public'
|
||||
}, function(result) {
|
||||
// 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
|
||||
app.$ui.folderList[
|
||||
result.data.user == app.user.username ? 'personal' : 'favorite'
|
||||
pandora.$ui.folderList[
|
||||
result.data.user == pandora.user.username ? 'personal' : 'favorite'
|
||||
].reloadList();
|
||||
}
|
||||
$list.reloadList();
|
||||
|
@ -414,11 +414,11 @@ pandora.ui.folderList = function(id) {
|
|||
}
|
||||
},
|
||||
init: function(event, data) {
|
||||
app.ui.sectionFolders[app.user.ui.section][i].items = data.items;
|
||||
app.$ui.folder[i].$content.css({
|
||||
pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items;
|
||||
pandora.$ui.folder[i].$content.css({
|
||||
height: data.items * 16 + 'px'
|
||||
});
|
||||
app.$ui.folderList[id].css({
|
||||
pandora.$ui.folderList[id].css({
|
||||
height: data.items * 16 + 'px'
|
||||
});
|
||||
pandora.resizeFolders();
|
||||
|
@ -426,7 +426,7 @@ pandora.ui.folderList = function(id) {
|
|||
move: function(event, data) {
|
||||
/*
|
||||
data.ids.forEach(function(id, pos) {
|
||||
app.user.ui.lists[id].position = pos;
|
||||
pandora.user.ui.lists[id].position = pos;
|
||||
});
|
||||
*/
|
||||
pandora.api.sortLists({
|
||||
|
@ -435,11 +435,11 @@ pandora.ui.folderList = function(id) {
|
|||
});
|
||||
},
|
||||
paste: function(event, data) {
|
||||
app.$ui.list.triggerEvent('paste', data);
|
||||
pandora.$ui.list.triggerEvent('paste', data);
|
||||
},
|
||||
select: function(event, data) {
|
||||
if (data.ids.length) {
|
||||
$.each(app.$ui.folderList, function(id_, $list) {
|
||||
$.each(pandora.$ui.folderList, function(id_, $list) {
|
||||
id != id_ && $list.options('selected', []);
|
||||
})
|
||||
pandora.URL.set('?find=list:' + data.ids[0]);
|
||||
|
@ -452,8 +452,8 @@ pandora.ui.folderList = function(id) {
|
|||
data_[data.key] = data.value;
|
||||
pandora.api.editList(data_, function(result) {
|
||||
if (result.data.id != data.id) {
|
||||
app.$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, 'name', result.data.name);
|
||||
pandora.$ui.folderList[id].value(data.id, 'id', result.data.id);
|
||||
pandora.URL.set('?find=list:' + result.data.id);
|
||||
}
|
||||
});
|
||||
|
@ -473,15 +473,15 @@ pandora.ui.folders = function() {
|
|||
});
|
||||
var counter = 0;
|
||||
//var $sections = [];
|
||||
app.$ui.folder = [];
|
||||
app.$ui.folderBrowser = {};
|
||||
app.$ui.folderList = {};
|
||||
if (app.user.ui.section == 'site') {
|
||||
$.each(app.ui.sectionFolders.site, function(i, folder) {
|
||||
var height = (Ox.getObjectById(app.ui.sectionFolders.site, folder.id).items.length * 16);
|
||||
app.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
pandora.$ui.folder = [];
|
||||
pandora.$ui.folderBrowser = {};
|
||||
pandora.$ui.folderList = {};
|
||||
if (pandora.user.ui.section == 'site') {
|
||||
$.each(pandora.site.sectionFolders.site, function(i, folder) {
|
||||
var height = (Ox.getObjectById(pandora.site.sectionFolders.site, folder.id).items.length * 16);
|
||||
pandora.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
id: folder.id,
|
||||
collapsed: !app.user.ui.showFolder.site[folder.id],
|
||||
collapsed: !pandora.user.ui.showFolder.site[folder.id],
|
||||
size: 16,
|
||||
title: folder.title
|
||||
})
|
||||
|
@ -490,25 +490,25 @@ pandora.ui.folders = function() {
|
|||
|
||||
}
|
||||
});
|
||||
//alert(JSON.stringify(Ox.getObjectById(app.ui.sectionFolders.site, folder.id)))
|
||||
app.$ui.folder[i].$content.css({
|
||||
//alert(JSON.stringify(Ox.getObjectById(pandora.site.sectionFolders.site, folder.id)))
|
||||
pandora.$ui.folder[i].$content.css({
|
||||
height: height + 'px'
|
||||
})
|
||||
//.appendTo(that);
|
||||
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
.css({
|
||||
height: height + 'px'
|
||||
})
|
||||
.appendTo(app.$ui.folder[i].$content);
|
||||
app.$ui.folder.forEach(function($folder) {
|
||||
.appendTo(pandora.$ui.folder[i].$content);
|
||||
pandora.$ui.folder.forEach(function($folder) {
|
||||
that.append($folder);
|
||||
});
|
||||
});
|
||||
//pandora.resizeFolders();
|
||||
} else if (app.user.ui.section == 'items') {
|
||||
$.each(app.ui.sectionFolders.items, function(i, folder) {
|
||||
} else if (pandora.user.ui.section == 'items') {
|
||||
$.each(pandora.site.sectionFolders.items, function(i, folder) {
|
||||
var extras = [];
|
||||
if (folder.id == 'personal' && app.user.level != 'guest') {
|
||||
if (folder.id == 'personal' && pandora.user.level != 'guest') {
|
||||
extras = [new Ox.Select({
|
||||
items: [
|
||||
{ id: 'new', title: 'New List...' },
|
||||
|
@ -525,7 +525,7 @@ pandora.ui.folders = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function(event, data) {
|
||||
var $list = app.$ui.folderList[folder.id],
|
||||
var $list = pandora.$ui.folderList[folder.id],
|
||||
id;
|
||||
if (data.id == 'new' || data.id == 'newsmart') {
|
||||
pandora.api.addList({
|
||||
|
@ -534,7 +534,7 @@ pandora.ui.folders = function() {
|
|||
type: data.id == 'new' ? 'static' : 'smart'
|
||||
}, function(result) {
|
||||
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)
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
$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({
|
||||
selectable: true,
|
||||
style: 'symbol',
|
||||
|
@ -559,20 +559,20 @@ pandora.ui.folders = function() {
|
|||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser;
|
||||
if (app.ui.sectionFolders.items[i].showBrowser) {
|
||||
app.$ui.folderList.favorite.replaceWith(
|
||||
app.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite')
|
||||
pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
|
||||
if (pandora.site.sectionFolders.items[i].showBrowser) {
|
||||
pandora.$ui.folderList.favorite.replaceWith(
|
||||
pandora.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite')
|
||||
);
|
||||
} else {
|
||||
app.$ui.folderBrowser.favorite.replaceWith(
|
||||
app.$ui.folderList.favorite = pandora.ui.folderList('favorite')
|
||||
pandora.$ui.folderBrowser.favorite.replaceWith(
|
||||
pandora.$ui.folderList.favorite = pandora.ui.folderList('favorite')
|
||||
);
|
||||
}
|
||||
pandora.resizeFolders();
|
||||
}
|
||||
})];
|
||||
} else if (folder.id == 'featured' && app.user.level == 'admin') {
|
||||
} else if (folder.id == 'featured' && pandora.user.level == 'admin') {
|
||||
extras = [new Ox.Button({
|
||||
selectable: true,
|
||||
style: 'symbol',
|
||||
|
@ -583,22 +583,22 @@ pandora.ui.folders = function() {
|
|||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser;
|
||||
if (app.ui.sectionFolders.items[i].showBrowser) {
|
||||
app.$ui.folderList.featured.replaceWith(
|
||||
app.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured'));
|
||||
pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
|
||||
if (pandora.site.sectionFolders.items[i].showBrowser) {
|
||||
pandora.$ui.folderList.featured.replaceWith(
|
||||
pandora.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured'));
|
||||
} else {
|
||||
app.$ui.folderBrowser.featured.replaceWith(
|
||||
app.$ui.folderList.featured = pandora.ui.folderList('featured')
|
||||
pandora.$ui.folderBrowser.featured.replaceWith(
|
||||
pandora.$ui.folderList.featured = pandora.ui.folderList('featured')
|
||||
);
|
||||
}
|
||||
pandora.resizeFolders();
|
||||
}
|
||||
})];
|
||||
}
|
||||
app.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
pandora.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
id: folder.id,
|
||||
collapsed: !app.user.ui.showFolder.items[folder.id],
|
||||
collapsed: !pandora.user.ui.showFolder.items[folder.id],
|
||||
extras: extras,
|
||||
size: 16,
|
||||
title: folder.title
|
||||
|
@ -606,7 +606,7 @@ pandora.ui.folders = function() {
|
|||
.bindEvent({
|
||||
// fixme: duplicated
|
||||
click: function(event, data) {
|
||||
var $list = app.$ui.folderList[i],
|
||||
var $list = pandora.$ui.folderList[i],
|
||||
hasFocus, id;
|
||||
if (data.id == 'new' || data.id == 'newsmart') {
|
||||
pandora.api.addList({
|
||||
|
@ -628,24 +628,24 @@ pandora.ui.folders = function() {
|
|||
} else if (data.id == 'browse') {
|
||||
alert('??')
|
||||
/*
|
||||
app.$ui.sectionList[1].replaceWith(app.$ui.publicLists = pandora.ui.publicLists());
|
||||
app.ui.showAllPublicLists = true;
|
||||
pandora.$ui.sectionList[1].replaceWith(pandora.$ui.publicLists = pandora.ui.publicLists());
|
||||
pandora.site.showAllPublicLists = true;
|
||||
*/
|
||||
}
|
||||
},
|
||||
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.resizeFolders();
|
||||
}
|
||||
});
|
||||
//$sections.push(app.$ui.section[i]);
|
||||
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
//$sections.push(pandora.$ui.section[i]);
|
||||
pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
.bindEventOnce({
|
||||
init: function(event, data) {
|
||||
Ox.print('init', i, counter)
|
||||
if (++counter == 3) {
|
||||
app.$ui.folder.forEach(function($folder) {
|
||||
pandora.$ui.folder.forEach(function($folder) {
|
||||
that.append($folder);
|
||||
});
|
||||
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() {
|
||||
|
|
|
@ -9,15 +9,15 @@ pandora.ui.folders = function() {
|
|||
});
|
||||
var counter = 0;
|
||||
//var $sections = [];
|
||||
app.$ui.folder = [];
|
||||
app.$ui.folderBrowser = {};
|
||||
app.$ui.folderList = {};
|
||||
if (app.user.ui.section == 'site') {
|
||||
$.each(app.ui.sectionFolders.site, function(i, folder) {
|
||||
var height = (Ox.getObjectById(app.ui.sectionFolders.site, folder.id).items.length * 16);
|
||||
app.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
pandora.$ui.folder = [];
|
||||
pandora.$ui.folderBrowser = {};
|
||||
pandora.$ui.folderList = {};
|
||||
if (pandora.user.ui.section == 'site') {
|
||||
$.each(pandora.site.sectionFolders.site, function(i, folder) {
|
||||
var height = (Ox.getObjectById(pandora.site.sectionFolders.site, folder.id).items.length * 16);
|
||||
pandora.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
id: folder.id,
|
||||
collapsed: !app.user.ui.showFolder.site[folder.id],
|
||||
collapsed: !pandora.user.ui.showFolder.site[folder.id],
|
||||
size: 16,
|
||||
title: folder.title
|
||||
})
|
||||
|
@ -26,25 +26,25 @@ pandora.ui.folders = function() {
|
|||
|
||||
}
|
||||
});
|
||||
//alert(JSON.stringify(Ox.getObjectById(app.ui.sectionFolders.site, folder.id)))
|
||||
app.$ui.folder[i].$content.css({
|
||||
//alert(JSON.stringify(Ox.getObjectById(pandora.site.sectionFolders.site, folder.id)))
|
||||
pandora.$ui.folder[i].$content.css({
|
||||
height: height + 'px'
|
||||
})
|
||||
//.appendTo(that);
|
||||
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
.css({
|
||||
height: height + 'px'
|
||||
})
|
||||
.appendTo(app.$ui.folder[i].$content);
|
||||
app.$ui.folder.forEach(function($folder) {
|
||||
.appendTo(pandora.$ui.folder[i].$content);
|
||||
pandora.$ui.folder.forEach(function($folder) {
|
||||
that.append($folder);
|
||||
});
|
||||
});
|
||||
//pandora.resizeFolders();
|
||||
} else if (app.user.ui.section == 'items') {
|
||||
$.each(app.ui.sectionFolders.items, function(i, folder) {
|
||||
} else if (pandora.user.ui.section == 'items') {
|
||||
$.each(pandora.site.sectionFolders.items, function(i, folder) {
|
||||
var extras = [];
|
||||
if (folder.id == 'personal' && app.user.level != 'guest') {
|
||||
if (folder.id == 'personal' && pandora.user.level != 'guest') {
|
||||
extras = [new Ox.Select({
|
||||
items: [
|
||||
{ id: 'new', title: 'New List...' },
|
||||
|
@ -61,7 +61,7 @@ pandora.ui.folders = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function(event, data) {
|
||||
var $list = app.$ui.folderList[folder.id],
|
||||
var $list = pandora.$ui.folderList[folder.id],
|
||||
id;
|
||||
if (data.id == 'new' || data.id == 'newsmart') {
|
||||
pandora.api.addList({
|
||||
|
@ -70,7 +70,7 @@ pandora.ui.folders = function() {
|
|||
type: data.id == 'new' ? 'static' : 'smart'
|
||||
}, function(result) {
|
||||
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)
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
$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({
|
||||
selectable: true,
|
||||
style: 'symbol',
|
||||
|
@ -95,20 +95,20 @@ pandora.ui.folders = function() {
|
|||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser;
|
||||
if (app.ui.sectionFolders.items[i].showBrowser) {
|
||||
app.$ui.folderList.favorite.replaceWith(
|
||||
app.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite')
|
||||
pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
|
||||
if (pandora.site.sectionFolders.items[i].showBrowser) {
|
||||
pandora.$ui.folderList.favorite.replaceWith(
|
||||
pandora.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite')
|
||||
);
|
||||
} else {
|
||||
app.$ui.folderBrowser.favorite.replaceWith(
|
||||
app.$ui.folderList.favorite = pandora.ui.folderList('favorite')
|
||||
pandora.$ui.folderBrowser.favorite.replaceWith(
|
||||
pandora.$ui.folderList.favorite = pandora.ui.folderList('favorite')
|
||||
);
|
||||
}
|
||||
pandora.resizeFolders();
|
||||
}
|
||||
})];
|
||||
} else if (folder.id == 'featured' && app.user.level == 'admin') {
|
||||
} else if (folder.id == 'featured' && pandora.user.level == 'admin') {
|
||||
extras = [new Ox.Button({
|
||||
selectable: true,
|
||||
style: 'symbol',
|
||||
|
@ -119,22 +119,22 @@ pandora.ui.folders = function() {
|
|||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
app.ui.sectionFolders.items[i].showBrowser = !app.ui.sectionFolders.items[i].showBrowser;
|
||||
if (app.ui.sectionFolders.items[i].showBrowser) {
|
||||
app.$ui.folderList.featured.replaceWith(
|
||||
app.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured'));
|
||||
pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
|
||||
if (pandora.site.sectionFolders.items[i].showBrowser) {
|
||||
pandora.$ui.folderList.featured.replaceWith(
|
||||
pandora.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured'));
|
||||
} else {
|
||||
app.$ui.folderBrowser.featured.replaceWith(
|
||||
app.$ui.folderList.featured = pandora.ui.folderList('featured')
|
||||
pandora.$ui.folderBrowser.featured.replaceWith(
|
||||
pandora.$ui.folderList.featured = pandora.ui.folderList('featured')
|
||||
);
|
||||
}
|
||||
pandora.resizeFolders();
|
||||
}
|
||||
})];
|
||||
}
|
||||
app.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
pandora.$ui.folder[i] = new Ox.CollapsePanel({
|
||||
id: folder.id,
|
||||
collapsed: !app.user.ui.showFolder.items[folder.id],
|
||||
collapsed: !pandora.user.ui.showFolder.items[folder.id],
|
||||
extras: extras,
|
||||
size: 16,
|
||||
title: folder.title
|
||||
|
@ -142,7 +142,7 @@ pandora.ui.folders = function() {
|
|||
.bindEvent({
|
||||
// fixme: duplicated
|
||||
click: function(event, data) {
|
||||
var $list = app.$ui.folderList[i],
|
||||
var $list = pandora.$ui.folderList[i],
|
||||
hasFocus, id;
|
||||
if (data.id == 'new' || data.id == 'newsmart') {
|
||||
pandora.api.addList({
|
||||
|
@ -164,24 +164,24 @@ pandora.ui.folders = function() {
|
|||
} else if (data.id == 'browse') {
|
||||
alert('??')
|
||||
/*
|
||||
app.$ui.sectionList[1].replaceWith(app.$ui.publicLists = pandora.ui.publicLists());
|
||||
app.ui.showAllPublicLists = true;
|
||||
pandora.$ui.sectionList[1].replaceWith(pandora.$ui.publicLists = pandora.ui.publicLists());
|
||||
pandora.site.showAllPublicLists = true;
|
||||
*/
|
||||
}
|
||||
},
|
||||
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.resizeFolders();
|
||||
}
|
||||
});
|
||||
//$sections.push(app.$ui.section[i]);
|
||||
app.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
//$sections.push(pandora.$ui.section[i]);
|
||||
pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
|
||||
.bindEventOnce({
|
||||
init: function(event, data) {
|
||||
Ox.print('init', i, counter)
|
||||
if (++counter == 3) {
|
||||
app.$ui.folder.forEach(function($folder) {
|
||||
pandora.$ui.folder.forEach(function($folder) {
|
||||
that.append($folder);
|
||||
});
|
||||
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() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
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;
|
||||
if (app.user.ui.section == 'site') {
|
||||
if (pandora.user.ui.section == 'site') {
|
||||
that = new Ox.TextList({
|
||||
columns: [
|
||||
{
|
||||
|
@ -22,15 +22,15 @@ pandora.ui.folderList = function(id) {
|
|||
id: 'title',
|
||||
operator: '+',
|
||||
visible: true,
|
||||
width: app.user.ui.sidebarSize - 16
|
||||
width: pandora.user.ui.sidebarSize - 16
|
||||
}
|
||||
],
|
||||
items: function(data, callback) {
|
||||
var result = {data: {}};
|
||||
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 {
|
||||
result.data.items = Ox.getObjectById(app.ui.sectionFolders.site, id).items;
|
||||
result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items;
|
||||
}
|
||||
callback(result);
|
||||
},
|
||||
|
@ -41,13 +41,13 @@ pandora.ui.folderList = function(id) {
|
|||
.bindEvent({
|
||||
select: function(event, data) {
|
||||
// fixme: duplicated
|
||||
$.each(app.$ui.folderList, function(id_, $list) {
|
||||
$.each(pandora.$ui.folderList, function(id_, $list) {
|
||||
id != id_ && $list.options('selected', []);
|
||||
})
|
||||
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({
|
||||
columns: [
|
||||
{
|
||||
|
@ -69,11 +69,11 @@ pandora.ui.folderList = function(id) {
|
|||
operator: '+',
|
||||
unique: true,
|
||||
visible: id == 'favorite',
|
||||
width: app.user.ui.sidebarWidth - 88
|
||||
width: pandora.user.ui.sidebarWidth - 88
|
||||
},
|
||||
{
|
||||
editable: function(data) {
|
||||
return data.user == app.user.username;
|
||||
return data.user == pandora.user.username;
|
||||
},
|
||||
id: 'name',
|
||||
input: {
|
||||
|
@ -81,7 +81,7 @@ pandora.ui.folderList = function(id) {
|
|||
},
|
||||
operator: '+',
|
||||
visible: id != 'favorite',
|
||||
width: app.user.ui.sidebarWidth - 88
|
||||
width: pandora.user.ui.sidebarWidth - 88
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
|
@ -138,7 +138,7 @@ pandora.ui.folderList = function(id) {
|
|||
var query;
|
||||
if (id == 'personal') {
|
||||
query = {conditions: [
|
||||
{key: 'user', value: app.user.username, operator: '='},
|
||||
{key: 'user', value: pandora.user.username, operator: '='},
|
||||
{key: 'status', value: 'featured', operator: '!'}
|
||||
], operator: '&'};
|
||||
} else if (id == 'favorite') {
|
||||
|
@ -159,12 +159,12 @@ pandora.ui.folderList = function(id) {
|
|||
sort: [
|
||||
{key: 'position', operator: '+'}
|
||||
],
|
||||
sortable: id == 'personal' || id == 'favorite' || app.user.level == 'admin'
|
||||
sortable: id == 'personal' || id == 'favorite' || pandora.user.level == 'admin'
|
||||
})
|
||||
.css({
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: app.user.ui.sidebarWidth + 'px',
|
||||
width: pandora.user.ui.sidebarWidth + 'px',
|
||||
})
|
||||
.bind({
|
||||
dragenter: function(e) {
|
||||
|
@ -173,9 +173,9 @@ pandora.ui.folderList = function(id) {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function(event, data) {
|
||||
var $list = app.$ui.folderList[id];
|
||||
var $list = pandora.$ui.folderList[id];
|
||||
if (data.key == 'type') {
|
||||
app.$ui.filterDialog = ui.filterDialog().open();
|
||||
pandora.$ui.filterDialog = ui.filterDialog().open();
|
||||
} else if (data.key == 'status') {
|
||||
pandora.api.editList({
|
||||
id: data.id,
|
||||
|
@ -186,8 +186,8 @@ pandora.ui.folderList = function(id) {
|
|||
}
|
||||
},
|
||||
'delete': function(event, data) {
|
||||
var $list = app.$ui.folderList[id];
|
||||
app.user.ui.listQuery.conditions = [];
|
||||
var $list = pandora.$ui.folderList[id];
|
||||
pandora.user.ui.listQuery.conditions = [];
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
$list.options({selected: []});
|
||||
if (id == 'personal') {
|
||||
|
@ -195,8 +195,8 @@ pandora.ui.folderList = function(id) {
|
|||
id: data.ids[0]
|
||||
}, function(result) {
|
||||
// fixme: is this the best way to delete a ui preference?
|
||||
delete app.user.ui.lists[data.ids[0]];
|
||||
pandora.UI.set({lists: app.user.ui.lists});
|
||||
delete pandora.user.ui.lists[data.ids[0]];
|
||||
pandora.UI.set({lists: pandora.user.ui.lists});
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
$list.reloadList();
|
||||
});
|
||||
|
@ -207,16 +207,16 @@ pandora.ui.folderList = function(id) {
|
|||
Ox.Request.clearCache(); // fixme: remove
|
||||
$list.reloadList();
|
||||
});
|
||||
} else if (id == 'featured' && app.user.level == 'admin') {
|
||||
} else if (id == 'featured' && pandora.user.level == 'admin') {
|
||||
pandora.api.editList({
|
||||
id: data.ids[0],
|
||||
status: 'public'
|
||||
}, function(result) {
|
||||
// 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
|
||||
app.$ui.folderList[
|
||||
result.data.user == app.user.username ? 'personal' : 'favorite'
|
||||
pandora.$ui.folderList[
|
||||
result.data.user == pandora.user.username ? 'personal' : 'favorite'
|
||||
].reloadList();
|
||||
}
|
||||
$list.reloadList();
|
||||
|
@ -224,11 +224,11 @@ pandora.ui.folderList = function(id) {
|
|||
}
|
||||
},
|
||||
init: function(event, data) {
|
||||
app.ui.sectionFolders[app.user.ui.section][i].items = data.items;
|
||||
app.$ui.folder[i].$content.css({
|
||||
pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items;
|
||||
pandora.$ui.folder[i].$content.css({
|
||||
height: data.items * 16 + 'px'
|
||||
});
|
||||
app.$ui.folderList[id].css({
|
||||
pandora.$ui.folderList[id].css({
|
||||
height: data.items * 16 + 'px'
|
||||
});
|
||||
pandora.resizeFolders();
|
||||
|
@ -236,7 +236,7 @@ pandora.ui.folderList = function(id) {
|
|||
move: function(event, data) {
|
||||
/*
|
||||
data.ids.forEach(function(id, pos) {
|
||||
app.user.ui.lists[id].position = pos;
|
||||
pandora.user.ui.lists[id].position = pos;
|
||||
});
|
||||
*/
|
||||
pandora.api.sortLists({
|
||||
|
@ -245,11 +245,11 @@ pandora.ui.folderList = function(id) {
|
|||
});
|
||||
},
|
||||
paste: function(event, data) {
|
||||
app.$ui.list.triggerEvent('paste', data);
|
||||
pandora.$ui.list.triggerEvent('paste', data);
|
||||
},
|
||||
select: function(event, data) {
|
||||
if (data.ids.length) {
|
||||
$.each(app.$ui.folderList, function(id_, $list) {
|
||||
$.each(pandora.$ui.folderList, function(id_, $list) {
|
||||
id != id_ && $list.options('selected', []);
|
||||
})
|
||||
pandora.URL.set('?find=list:' + data.ids[0]);
|
||||
|
@ -262,8 +262,8 @@ pandora.ui.folderList = function(id) {
|
|||
data_[data.key] = data.value;
|
||||
pandora.api.editList(data_, function(result) {
|
||||
if (result.data.id != data.id) {
|
||||
app.$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, 'name', result.data.name);
|
||||
pandora.$ui.folderList[id].value(data.id, 'id', result.data.id);
|
||||
pandora.URL.set('?find=list:' + result.data.id);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,9 +7,9 @@ pandora.ui.group = function(id, query) {
|
|||
}));
|
||||
*/
|
||||
//alert(id + ' ' + JSON.stringify(pandora.Query.toObject(id)))
|
||||
var i = app.user.ui.groups.indexOf(id),
|
||||
panelWidth = app.$ui.document.width() - (app.user.ui.showSidebar * app.user.ui.sidebarSize) - 1,
|
||||
title = Ox.getObjectById(app.site.groups, id).title,
|
||||
var i = pandora.user.ui.groups.indexOf(id),
|
||||
panelWidth = pandora.$ui.document.width() - (pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize) - 1,
|
||||
title = Ox.getObjectById(pandora.site.groups, id).title,
|
||||
width = pandora.getGroupWidth(i, panelWidth),
|
||||
that = new Ox.TextList({
|
||||
columns: [
|
||||
|
@ -55,12 +55,12 @@ pandora.ui.group = function(id, query) {
|
|||
})
|
||||
.bindEvent({
|
||||
paste: function(event, data) {
|
||||
app.$ui.list.triggerEvent('paste', data);
|
||||
pandora.$ui.list.triggerEvent('paste', data);
|
||||
},
|
||||
select: function(event, data) {
|
||||
var group = app.ui.groups[i],
|
||||
var group = pandora.user.queryGroups[i],
|
||||
query;
|
||||
app.ui.groups[i].query.conditions = $.map(data.ids, function(v) {
|
||||
pandora.user.queryGroups[i].query.conditions = $.map(data.ids, function(v) {
|
||||
return {
|
||||
key: id,
|
||||
value: v,
|
||||
|
@ -71,7 +71,7 @@ pandora.ui.group = function(id, query) {
|
|||
}
|
||||
});
|
||||
new Ox.Select({
|
||||
items: $.map(app.site.groups, function(v) {
|
||||
items: $.map(pandora.user.queryGroups, function(v) {
|
||||
return {
|
||||
checked: v.id == id,
|
||||
id: v.id,
|
||||
|
@ -84,46 +84,46 @@ pandora.ui.group = function(id, query) {
|
|||
})
|
||||
.bindEvent('change', function(event, data) {
|
||||
var id_ = data.selected[0].id,
|
||||
i_ = app.user.ui.groups.indexOf(id_);
|
||||
i_ = pandora.user.ui.groups.indexOf(id_);
|
||||
if (i_ == -1) {
|
||||
// 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
|
||||
app.ui.groups[i].query.conditions = [];
|
||||
pandora.user.queryGroups[i].query.conditions = [];
|
||||
pandora.reloadGroups(i);
|
||||
}
|
||||
app.ui.groups[i] = getGroupObject(id_);
|
||||
app.user.ui.groups[i] = id_;
|
||||
pandora.UI.set({groups: app.user.ui.groups});
|
||||
pandora.user.queryGroups[i] = getGroupObject(id_);
|
||||
pandora.user.ui.groups[i] = id_;
|
||||
pandora.UI.set({groups: pandora.user.ui.groups});
|
||||
replaceGroup(i, id_);
|
||||
} else {
|
||||
// swap two existing groups
|
||||
var group = $.extend({}, app.ui.groups[i]);
|
||||
app.ui.groups[i] = app.ui.groups[i_];
|
||||
app.ui.groups[i_] = group;
|
||||
app.user.ui.groups[i] = id_;
|
||||
app.user.ui.groups[i_] = id;
|
||||
pandora.UI.set({groups: app.user.ui.groups});
|
||||
replaceGroup(i, id_, app.ui.groups[i].query);
|
||||
replaceGroup(i_, id, app.ui.groups[i_].query);
|
||||
var group = $.extend({}, pandora.user.queryGroups[i]);
|
||||
pandora.user.queryGroups[i] = pandora.user.queryGroups[i_];
|
||||
pandora.user.queryGroups[i_] = group;
|
||||
pandora.user.ui.groups[i] = id_;
|
||||
pandora.user.ui.groups[i_] = id;
|
||||
pandora.UI.set({groups: pandora.user.ui.groups});
|
||||
replaceGroup(i, id_, pandora.user.queryGroups[i].query);
|
||||
replaceGroup(i_, id, pandora.user.queryGroups[i_].query);
|
||||
}
|
||||
function replaceGroup(i, id, query) {
|
||||
// if query is passed, selected items will be derived from it
|
||||
var isOuter = i % 4 == 0;
|
||||
app.$ui[isOuter ? 'browser' : 'groupsInnerPanel'].replaceElement(
|
||||
pandora.$ui[isOuter ? 'browser' : 'groupsInnerPanel'].replaceElement(
|
||||
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);
|
||||
if (!query) {
|
||||
// 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) {
|
||||
var i = app.user.ui.groups.indexOf(id),
|
||||
title = Ox.getObjectById(app.site.groups, id).title,
|
||||
var i = pandora.user.ui.groups.indexOf(id),
|
||||
title = Ox.getObjectById(pandora.site.groups, id).title,
|
||||
width = pandora.getGroupWidth(i, panelWidth);
|
||||
return {
|
||||
id: id,
|
||||
|
@ -141,8 +141,8 @@ pandora.ui.group = function(id, query) {
|
|||
|
||||
pandora.ui.groups = function() {
|
||||
var $groups = [];
|
||||
app.ui.groups = [];
|
||||
app.user.ui.groups.forEach(function(id, i) {
|
||||
pandora.user.queryGroups = [];
|
||||
pandora.user.ui.groups.forEach(function(id, i) {
|
||||
$groups[i] = pandora.ui.group(id);
|
||||
});
|
||||
return $groups;
|
||||
|
@ -152,15 +152,15 @@ pandora.ui.groupsInnerPanel = function() {
|
|||
var that = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: app.$ui.groups[1],
|
||||
size: app.ui.groups[1].size
|
||||
element: pandora.$ui.groups[1],
|
||||
size: pandora.user.queryGroups[1].size
|
||||
},
|
||||
{
|
||||
element: app.$ui.groups[2],
|
||||
element: pandora.$ui.groups[2],
|
||||
},
|
||||
{
|
||||
element: app.$ui.groups[3],
|
||||
size: app.ui.groups[3].size
|
||||
element: pandora.$ui.groups[3],
|
||||
size: pandora.user.queryGroups[3].size
|
||||
}
|
||||
],
|
||||
orientation: 'horizontal'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
pandora.ui.info = function() {
|
||||
var that = new Ox.Element()
|
||||
.append(
|
||||
app.$ui.infoStill = new Ox.Element()
|
||||
pandora.$ui.infoStill = new Ox.Element()
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
|
@ -11,7 +11,7 @@ pandora.ui.info = function() {
|
|||
})
|
||||
)
|
||||
.append(
|
||||
app.$ui.infoTimeline = new Ox.Element('<img>')
|
||||
pandora.$ui.infoTimeline = new Ox.Element('<img>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
|
@ -25,25 +25,25 @@ pandora.ui.info = function() {
|
|||
pandora.resizeFolders();
|
||||
}
|
||||
});
|
||||
if(app.user.ui.item) {
|
||||
pandora.api.getItem(app.user.ui.item, function(result) {
|
||||
app.ui.infoRatio = result.data.stream.aspectRatio;
|
||||
if(pandora.user.ui.item) {
|
||||
pandora.api.getItem(pandora.user.ui.item, function(result) {
|
||||
pandora.user.infoRatio = result.data.stream.aspectRatio;
|
||||
var width = that.width() || 256,
|
||||
height = width / app.ui.infoRatio + 16;
|
||||
app.$ui.infoStill.removeElement();
|
||||
app.$ui.infoStill = pandora.ui.flipbook(app.user.ui.item)
|
||||
height = width / pandora.user.infoRatio + 16;
|
||||
pandora.$ui.infoStill.removeElement();
|
||||
pandora.$ui.infoStill = pandora.ui.flipbook(pandora.user.ui.item)
|
||||
.appendTo(that.$element);
|
||||
app.$ui.infoStill.css({
|
||||
pandora.$ui.infoStill.css({
|
||||
'height': (height-16) + 'px'
|
||||
});
|
||||
that.css({
|
||||
height: height + 'px'
|
||||
});
|
||||
pandora.resizeFolders();
|
||||
!app.user.ui.showInfo && app.$ui.leftPanel.css({bottom: -height});
|
||||
app.$ui.leftPanel.size(2, height );
|
||||
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -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;
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.item = function() {
|
||||
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) {
|
||||
app.$ui.contentPanel.replaceElement(1,
|
||||
pandora.$ui.contentPanel.replaceElement(1,
|
||||
Ox.Element().html(
|
||||
'The '+app.site.itemName.singular+' you are looking for does not exist.'));
|
||||
} else if (app.user.ui.itemView == 'calendar') {
|
||||
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Calendar'));
|
||||
} else if (app.user.ui.itemView == 'clips') {
|
||||
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Clips'));
|
||||
} else if (app.user.ui.itemView == 'info') {
|
||||
'The '+pandora.site.itemName.singular+' you are looking for does not exist.'));
|
||||
} else if (pandora.user.ui.itemView == 'calendar') {
|
||||
pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Calendar'));
|
||||
} else if (pandora.user.ui.itemView == 'clips') {
|
||||
pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Clips'));
|
||||
} else if (pandora.user.ui.itemView == 'info') {
|
||||
//Ox.print('result.data', result.data)
|
||||
if (app.user.level == 'admin') {
|
||||
if (pandora.user.level == 'admin') {
|
||||
var $form,
|
||||
$edit = new Ox.Element()
|
||||
.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({
|
||||
id: key.id,
|
||||
label: key.title,
|
||||
|
@ -37,7 +37,7 @@ pandora.ui.item = function() {
|
|||
click: function(event, data) {
|
||||
var values = $form.value();
|
||||
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(Ox.isArray(key.type) && key.type[0] == 'string') {
|
||||
changed[key.id] = values[i].split(', ');
|
||||
|
@ -47,48 +47,48 @@ pandora.ui.item = function() {
|
|||
}
|
||||
});
|
||||
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
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
}));
|
||||
app.$ui.contentPanel.replaceElement(1, app.$ui.item = $edit);
|
||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.item = $edit);
|
||||
} else {
|
||||
$.get('/static/html/itemInfo.html', {}, function(template) {
|
||||
//Ox.print(template);
|
||||
app.$ui.contentPanel.replaceElement(1,
|
||||
app.$ui.item = new Ox.Element()
|
||||
pandora.$ui.contentPanel.replaceElement(1,
|
||||
pandora.$ui.item = new Ox.Element()
|
||||
.append($.tmpl(template, result.data))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
} else if (app.user.ui.itemView == 'map') {
|
||||
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Map'));
|
||||
} else if (app.user.ui.itemView == 'player') {
|
||||
} else if (pandora.user.ui.itemView == 'map') {
|
||||
pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Map'));
|
||||
} else if (pandora.user.ui.itemView == 'player') {
|
||||
var video = result.data.stream,
|
||||
format = $.support.video.supportedFormat(video.formats);
|
||||
video.height = video.profiles[0];
|
||||
video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
|
||||
video.url = video.baseUrl + '/' + video.height + 'p.' + format;
|
||||
app.$ui.contentPanel.replaceElement(1, app.$ui.player = new Ox.VideoPanelPlayer({
|
||||
annotationsSize: app.user.ui.annotationsSize,
|
||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = new Ox.VideoPanelPlayer({
|
||||
annotationsSize: pandora.user.ui.annotationsSize,
|
||||
duration: video.duration,
|
||||
height: app.$ui.contentPanel.size(1),
|
||||
position: app.user.ui.videoPosition[app.user.ui.item] || 0,
|
||||
showAnnotations: app.user.ui.showAnnotations,
|
||||
showControls: app.user.ui.showControls,
|
||||
height: pandora.$ui.contentPanel.size(1),
|
||||
position: pandora.user.ui.videoPosition[pandora.user.ui.item] || 0,
|
||||
showAnnotations: pandora.user.ui.showAnnotations,
|
||||
showControls: pandora.user.ui.showControls,
|
||||
subtitles: result.data.layers.subtitles.map(function(subtitle) {
|
||||
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
|
||||
}),
|
||||
videoHeight: video.height,
|
||||
videoId: app.user.ui.item,
|
||||
videoId: pandora.user.ui.item,
|
||||
videoWidth: video.width,
|
||||
videoSize: app.user.ui.videoScreen,
|
||||
videoSize: pandora.user.ui.videoScreen,
|
||||
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({
|
||||
change: function(event, data) {
|
||||
// showAnnotations, showControls, videoScreen
|
||||
|
@ -99,14 +99,14 @@ pandora.ui.item = function() {
|
|||
enterfullscreen: pandora.enterFullscreen,
|
||||
exitfullscreen: pandora.exitFullscreen,
|
||||
resize: function(event, data) {
|
||||
app.$ui.player.options({
|
||||
pandora.$ui.player.options({
|
||||
height: data
|
||||
});
|
||||
}
|
||||
}));
|
||||
} else if (app.user.ui.itemView == 'statistics') {
|
||||
app.$ui.contentPanel.replaceElement(1, Ox.Element().html('Statistics'));
|
||||
} else if (app.user.ui.itemView == 'timeline') {
|
||||
} else if (pandora.user.ui.itemView == 'statistics') {
|
||||
pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Statistics'));
|
||||
} else if (pandora.user.ui.itemView == 'timeline') {
|
||||
var layers = [],
|
||||
video = result.data.stream,
|
||||
cuts = result.data.cuts || [],
|
||||
|
@ -117,45 +117,45 @@ pandora.ui.item = function() {
|
|||
video.profiles.forEach(function(profile) {
|
||||
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]});
|
||||
});
|
||||
app.$ui.contentPanel.replaceElement(1, app.$ui.editor = new Ox.VideoEditor({
|
||||
annotationsSize: app.user.ui.annotationsSize,
|
||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = new Ox.VideoEditor({
|
||||
annotationsSize: pandora.user.ui.annotationsSize,
|
||||
cuts: cuts,
|
||||
duration: video.duration,
|
||||
find: '',
|
||||
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) {
|
||||
return '/' + app.user.ui.item + '/timelines/timeline.64.' + i + '.png';
|
||||
return '/' + pandora.user.ui.item + '/timelines/timeline.64.' + i + '.png';
|
||||
},
|
||||
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',
|
||||
'in': 0,
|
||||
layers: layers,
|
||||
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),
|
||||
showAnnotations: app.user.ui.showAnnotations,
|
||||
showAnnotations: pandora.user.ui.showAnnotations,
|
||||
showLargeTimeline: true,
|
||||
// fixme: layers have value, subtitles has text?
|
||||
subtitles: result.data.layers.subtitles.map(function(subtitle) {
|
||||
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
|
||||
}),
|
||||
videoHeight: video.height,
|
||||
videoId: app.user.ui.item,
|
||||
videoId: pandora.user.ui.item,
|
||||
videoWidth: video.width,
|
||||
videoSize: app.user.ui.videoSize,
|
||||
videoSize: pandora.user.ui.videoSize,
|
||||
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({
|
||||
resize: function(event, data) {
|
||||
app.$ui.editor.options({
|
||||
pandora.$ui.editor.options({
|
||||
height: data
|
||||
});
|
||||
},
|
||||
|
@ -164,16 +164,16 @@ pandora.ui.item = function() {
|
|||
},
|
||||
addAnnotation: function(event, data) {
|
||||
Ox.print('addAnnotation', data);
|
||||
data.item = app.user.ui.item;
|
||||
data.item = pandora.user.ui.item;
|
||||
data.value = 'Click to edit';
|
||||
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) {
|
||||
pandora.api.removeAnnotations(data, function(result) {
|
||||
//fixme: check for errors
|
||||
app.$ui.editor.removeAnnotations(data.layer, data.ids);
|
||||
pandora.$ui.editor.removeAnnotations(data.layer, data.ids);
|
||||
});
|
||||
},
|
||||
updateAnnotation: function(event, data) {
|
||||
|
@ -184,27 +184,27 @@ pandora.ui.item = function() {
|
|||
}));
|
||||
that.bindEvent('resize', function(event, data) {
|
||||
//Ox.print('resize item', data)
|
||||
app.$ui.editor.options({
|
||||
pandora.$ui.editor.options({
|
||||
height: data
|
||||
});
|
||||
});
|
||||
/*
|
||||
app.$ui.rightPanel.bindEvent('resize', function(event, data) {
|
||||
Ox.print('... rightPanel resize', data, app.$ui.timelinePanel.size(1))
|
||||
app.$ui.editor.options({
|
||||
width: data - app.$ui.timelinePanel.size(1) - 1
|
||||
pandora.$ui.rightPanel.bindEvent('resize', function(event, data) {
|
||||
Ox.print('... rightPanel resize', data, pandora.$ui.timelinePanel.size(1))
|
||||
pandora.$ui.editor.options({
|
||||
width: data - pandora.$ui.timelinePanel.size(1) - 1
|
||||
});
|
||||
});
|
||||
*/
|
||||
} else if (app.user.ui.itemView == 'files') {
|
||||
app.$ui.contentPanel.replaceElement(1,
|
||||
app.$ui.item = new Ox.FilesView({
|
||||
} else if (pandora.user.ui.itemView == 'files') {
|
||||
pandora.$ui.contentPanel.replaceElement(1,
|
||||
pandora.$ui.item = new Ox.FilesView({
|
||||
id: result.data.id
|
||||
})
|
||||
);
|
||||
}
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -3,17 +3,17 @@ pandora.ui.leftPanel = function() {
|
|||
var that = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: app.$ui.sectionbar = pandora.ui.sectionbar('buttons'),
|
||||
element: pandora.$ui.sectionbar = pandora.ui.sectionbar('buttons'),
|
||||
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,
|
||||
element: app.$ui.info = pandora.ui.info(),
|
||||
size: app.user.ui.sidebarSize / app.ui.infoRatio + 16
|
||||
element: pandora.$ui.info = pandora.ui.info(),
|
||||
size: pandora.user.ui.sidebarSize / pandora.user.infoRatio + 16
|
||||
}
|
||||
],
|
||||
id: 'leftPanel',
|
||||
|
@ -21,19 +21,19 @@ pandora.ui.leftPanel = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
resize: function(event, data) {
|
||||
var infoSize = Math.round(data / app.ui.infoRatio) + 16;
|
||||
app.user.ui.sidebarSize = data;
|
||||
if (data < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) {
|
||||
app.$ui.sectionButtons.removeElement();
|
||||
delete app.$ui.sectionButtons;
|
||||
app.$ui.sectionbar.append(app.$ui.sectionSelect = pandora.ui.sectionSelect());
|
||||
} else if (data >= app.ui.sectionButtonsWidth && app.$ui.sectionSelect) {
|
||||
app.$ui.sectionSelect.removeElement();
|
||||
delete app.$ui.sectionSelect;
|
||||
app.$ui.sectionbar.append(app.$ui.sectionButtons = pandora.ui.sectionButtons());
|
||||
var infoSize = Math.round(data / pandora.user.infoRatio) + 16;
|
||||
pandora.user.ui.sidebarSize = data;
|
||||
if (data < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
|
||||
pandora.$ui.sectionButtons.removeElement();
|
||||
delete pandora.$ui.sectionButtons;
|
||||
pandora.$ui.sectionbar.append(pandora.$ui.sectionSelect = pandora.ui.sectionSelect());
|
||||
} else if (data >= pandora.site.sectionButtonsWidth && pandora.$ui.sectionSelect) {
|
||||
pandora.$ui.sectionSelect.removeElement();
|
||||
delete pandora.$ui.sectionSelect;
|
||||
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons());
|
||||
}
|
||||
!app.user.ui.showInfo && app.$ui.leftPanel.css({bottom: -infoSize});
|
||||
app.$ui.leftPanel.size(2, infoSize);
|
||||
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoSize});
|
||||
pandora.$ui.leftPanel.size(2, infoSize);
|
||||
pandora.resizeFolders();
|
||||
},
|
||||
resizeend: function(event, data) {
|
||||
|
@ -42,7 +42,7 @@ pandora.ui.leftPanel = function() {
|
|||
toggle: function(event, data) {
|
||||
pandora.UI.set({showSidebar: !data.collapsed});
|
||||
if (data.collapsed) {
|
||||
$.each(app.$ui.folderList, function(k, $list) {
|
||||
$.each(pandora.$ui.folderList, function(k, $list) {
|
||||
$list.loseFocus();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,16 +5,16 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
if (view == 'list') {
|
||||
/*
|
||||
keys = Ox.unique($.merge(
|
||||
$.map(app.user.ui.lists[app.user.ui.list].columns, function(id) {
|
||||
return Ox.getObjectById(app.site.sortKeys, id);
|
||||
$.map(pandora.user.ui.lists[pandora.user.ui.list].columns, function(id) {
|
||||
return Ox.getObjectById(pandora.site.sortKeys, id);
|
||||
}),
|
||||
app.site.sortKeys
|
||||
pandora.site.sortKeys
|
||||
));
|
||||
Ox.print('$$$$', keys)
|
||||
*/
|
||||
that = new Ox.TextList({
|
||||
columns: $.map(app.ui.sortKeys, function(key, i) {
|
||||
var position = app.user.ui.lists[app.user.ui.list].columns.indexOf(key.id);
|
||||
columns: $.map(pandora.site.sortKeys, function(key, i) {
|
||||
var position = pandora.user.ui.lists[pandora.user.ui.list].columns.indexOf(key.id);
|
||||
return {
|
||||
align: ['string', 'text'].indexOf(
|
||||
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,
|
||||
unique: key.id == 'id',
|
||||
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,
|
||||
|
@ -44,29 +44,29 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
}), callback);
|
||||
},
|
||||
scrollbarVisible: true,
|
||||
sort: app.user.ui.lists[app.user.ui.list].sort
|
||||
sort: pandora.user.ui.lists[pandora.user.ui.list].sort
|
||||
})
|
||||
.bindEvent({
|
||||
columnchange: function(event, data) {
|
||||
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) {
|
||||
columnWidth[id] =
|
||||
app.user.ui.lists[app.user.ui.list].columnWidth[id] ||
|
||||
Ox.getObjectById(app.ui.sortKeys, id).width
|
||||
pandora.user.ui.lists[pandora.user.ui.list].columnWidth[id] ||
|
||||
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) {
|
||||
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
|
||||
that.size();
|
||||
},
|
||||
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') {
|
||||
|
@ -92,15 +92,15 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
},
|
||||
keys: ['director', 'id', 'poster', 'title', 'year'],
|
||||
size: 128,
|
||||
sort: app.user.ui.lists[app.user.ui.list].sort,
|
||||
sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
|
||||
unique: 'id'
|
||||
})
|
||||
} else if (view == 'map') {
|
||||
that = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: app.$ui.map = Ox.Map({
|
||||
height: window.innerHeight - app.user.ui.showGroups * app.user.ui.groupsSize - 61,
|
||||
element: pandora.$ui.map = Ox.Map({
|
||||
height: window.innerHeight - pandora.user.ui.showGroups * pandora.user.ui.groupsSize - 61,
|
||||
places: function(data, callback) {
|
||||
return pandora.api.findPlaces($.extend({
|
||||
query: {conditions: [], operator: ''}
|
||||
|
@ -108,7 +108,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
},
|
||||
showTypes: 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'
|
||||
})
|
||||
.bindEvent('resize', function() {
|
||||
app.$ui.map.resizeMap();
|
||||
pandora.$ui.map.resizeMap();
|
||||
});
|
||||
} else if (view == 'calendar') {
|
||||
that = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: app.$ui.calendar = Ox.Calendar({
|
||||
element: pandora.$ui.calendar = Ox.Calendar({
|
||||
date: new Date(0),
|
||||
events: [
|
||||
{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: '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],
|
||||
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
|
||||
})
|
||||
},
|
||||
|
@ -170,41 +170,41 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
|
||||
['list', 'icons'].indexOf(view) > -1 && that.bind({
|
||||
dragstart: function(e) {
|
||||
app.$ui.folderList.forEach(function($list, i) {
|
||||
pandora.$ui.folderList.forEach(function($list, i) {
|
||||
$list.addClass('OxDrop');
|
||||
});
|
||||
},
|
||||
dragend: function(e) {
|
||||
app.$ui.folderList.forEach(function($list, i) {
|
||||
pandora.$ui.folderList.forEach(function($list, i) {
|
||||
$list.removeClass('OxDrop');
|
||||
});
|
||||
},
|
||||
}).bindEvent({
|
||||
closepreview: function(event, data) {
|
||||
app.$ui.previewDialog.close();
|
||||
delete app.$ui.previewDialog;
|
||||
pandora.$ui.previewDialog.close();
|
||||
delete pandora.$ui.previewDialog;
|
||||
},
|
||||
copy: function(event, data) {
|
||||
Ox.Clipboard.copy({
|
||||
items: data.ids,
|
||||
text: $.map(data.ids, function(id) {
|
||||
return app.$ui.list.value(id, 'title');
|
||||
return pandora.$ui.list.value(id, 'title');
|
||||
}).join('\n')
|
||||
});
|
||||
},
|
||||
'delete': function(event, data) {
|
||||
pandora.getListData().editable && pandora.api.removeListItems({
|
||||
list: app.user.ui.list,
|
||||
list: pandora.user.ui.list,
|
||||
items: data.ids
|
||||
}, pandora.reloadList);
|
||||
},
|
||||
init: function(event, data) {
|
||||
app.$ui.total.html(pandora.ui.status('total', data));
|
||||
pandora.$ui.total.html(pandora.ui.status('total', data));
|
||||
data = [];
|
||||
$.each(app.site.totals, function(i, v) {
|
||||
$.each(pandora.site.totals, function(i, v) {
|
||||
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) {
|
||||
var id = data.ids[0],
|
||||
|
@ -212,8 +212,8 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
pandora.URL.set(title, id);
|
||||
},
|
||||
openpreview: function(event, data) {
|
||||
app.requests.preview && pandora.api.cancel(app.requests.preview);
|
||||
app.requests.preview = pandora.api.find({
|
||||
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
|
||||
pandora.requests.preview = pandora.api.find({
|
||||
keys: ['director', 'id', 'poster', 'title'],
|
||||
query: {
|
||||
conditions: $.map(data.ids, function(id, i) {
|
||||
|
@ -226,27 +226,27 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
operator: '|'
|
||||
}
|
||||
}, function(result) {
|
||||
var documentHeight = app.$ui.document.height(),
|
||||
var documentHeight = pandora.$ui.document.height(),
|
||||
item = result.data.items[0],
|
||||
title = item.title + (item.director ? ' (' + item.director + ')' : ''),
|
||||
dialogHeight = documentHeight - 100,
|
||||
dialogWidth;
|
||||
app.ui.previewRatio = item.poster.width / item.poster.height,
|
||||
dialogWidth = parseInt((dialogHeight - 48) * app.ui.previewRatio);
|
||||
if ('previewDialog' in app.$ui) {
|
||||
app.$ui.previewDialog.options({
|
||||
pandora.site.previewRatio = item.poster.width / item.poster.height,
|
||||
dialogWidth = parseInt((dialogHeight - 48) * pandora.site.previewRatio);
|
||||
if ('previewDialog' in pandora.$ui) {
|
||||
pandora.$ui.previewDialog.options({
|
||||
title: title
|
||||
});
|
||||
app.$ui.previewImage.animate({
|
||||
pandora.$ui.previewImage.animate({
|
||||
opacity: 0
|
||||
}, 100, function() {
|
||||
app.$ui.previewDialog.size(dialogWidth, dialogHeight, function() {
|
||||
app.$ui.previewImage
|
||||
pandora.$ui.previewDialog.size(dialogWidth, dialogHeight, function() {
|
||||
pandora.$ui.previewImage
|
||||
.attr({
|
||||
src: item.poster.url
|
||||
})
|
||||
.one('load', function() {
|
||||
app.$ui.previewImage
|
||||
pandora.$ui.previewImage
|
||||
.css({
|
||||
width: dialogWidth + 'px',
|
||||
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 {
|
||||
app.$ui.previewImage = $('<img>')
|
||||
pandora.$ui.previewImage = $('<img>')
|
||||
.attr({
|
||||
src: item.poster.url
|
||||
})
|
||||
|
@ -274,23 +274,23 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
bottom: 0,
|
||||
margin: 'auto',
|
||||
});
|
||||
app.$ui.previewDialog = new Ox.Dialog({
|
||||
pandora.$ui.previewDialog = new Ox.Dialog({
|
||||
buttons: [
|
||||
new Ox.Button({
|
||||
title: 'Close',
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
app.$ui.previewDialog.close();
|
||||
delete app.$ui.previewDialog;
|
||||
app.$ui.list.closePreview();
|
||||
pandora.$ui.previewDialog.close();
|
||||
delete pandora.$ui.previewDialog;
|
||||
pandora.$ui.list.closePreview();
|
||||
}
|
||||
})
|
||||
],
|
||||
content: app.$ui.previewImage,
|
||||
content: pandora.$ui.previewImage,
|
||||
height: dialogHeight,
|
||||
id: 'previewDialog',
|
||||
minHeight: app.ui.previewRatio >= 1 ? 128 / app.ui.previewRatio + 48 : 176,
|
||||
minWidth: app.ui.previewRatio >= 1 ? 128 : 176 * app.ui.previewRatio,
|
||||
minHeight: pandora.site.previewRatio >= 1 ? 128 / pandora.site.previewRatio + 48 : 176,
|
||||
minWidth: pandora.site.previewRatio >= 1 ? 128 : 176 * pandora.site.previewRatio,
|
||||
padding: 0,
|
||||
title: title,
|
||||
width: dialogWidth
|
||||
|
@ -298,59 +298,59 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
.bindEvent('resize', function(event, data) {
|
||||
var dialogRatio = data.width / (data.height - 48),
|
||||
height, width;
|
||||
if (dialogRatio < app.ui.previewRatio) {
|
||||
if (dialogRatio < pandora.site.previewRatio) {
|
||||
width = data.width;
|
||||
height = width / app.ui.previewRatio;
|
||||
height = width / pandora.site.previewRatio;
|
||||
} else {
|
||||
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',
|
||||
height: height + 'px', // fixme: why -2 ?
|
||||
})
|
||||
})
|
||||
.open();
|
||||
//app.$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)
|
||||
//pandora.$ui.previewImage = $image;
|
||||
//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) {
|
||||
data.items && pandora.getListData().editable && pandora.api.addListItems({
|
||||
list: app.user.ui.list,
|
||||
list: pandora.user.ui.list,
|
||||
items: data.items
|
||||
}, pandora.reloadList);
|
||||
},
|
||||
select: function(event, data) {
|
||||
var $still, $timeline;
|
||||
app.ui.selectedMovies = data.ids;
|
||||
pandora.user.selectedMovies = data.ids;
|
||||
if (data.ids.length) {
|
||||
app.$ui.mainMenu.enableItem('copy');
|
||||
app.$ui.mainMenu.enableItem('openmovie');
|
||||
pandora.$ui.mainMenu.enableItem('copy');
|
||||
pandora.$ui.mainMenu.enableItem('openmovie');
|
||||
} else {
|
||||
app.$ui.mainMenu.disableItem('copy');
|
||||
app.$ui.mainMenu.disableItem('openmovie');
|
||||
pandora.$ui.mainMenu.disableItem('copy');
|
||||
pandora.$ui.mainMenu.disableItem('openmovie');
|
||||
}
|
||||
if (data.ids.length == 1) {
|
||||
pandora.api.getItem(data.ids[0], function(result) {
|
||||
app.ui.infoRatio = result.data.stream.aspectRatio;
|
||||
var height = app.$ui.info.width() / app.ui.infoRatio + 16;
|
||||
if(app.$ui.infoStill) app.$ui.infoStill.removeElement();
|
||||
app.$ui.infoStill = pandora.ui.flipbook(data.ids[0])
|
||||
.appendTo(app.$ui.info.$element);
|
||||
app.$ui.infoStill.css({
|
||||
pandora.user.infoRatio = result.data.stream.aspectRatio;
|
||||
var height = pandora.$ui.info.width() / pandora.user.infoRatio + 16;
|
||||
if(pandora.$ui.infoStill) pandora.$ui.infoStill.removeElement();
|
||||
pandora.$ui.infoStill = pandora.ui.flipbook(data.ids[0])
|
||||
.appendTo(pandora.$ui.info.$element);
|
||||
pandora.$ui.infoStill.css({
|
||||
'height': (height - 16) + 'px'
|
||||
});
|
||||
!app.user.ui.showInfo && app.$ui.leftPanel.css({bottom: -height});
|
||||
app.$ui.leftPanel.size(2, height);
|
||||
app.$ui.info.animate({
|
||||
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height});
|
||||
pandora.$ui.leftPanel.size(2, height);
|
||||
pandora.$ui.info.animate({
|
||||
height: height + 'px'
|
||||
}, 250, function() {
|
||||
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({
|
||||
query: {
|
||||
|
@ -364,26 +364,26 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
|||
operator: '|'
|
||||
}
|
||||
}, 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) {
|
||||
/* some magic has already set user.ui.sort
|
||||
Ox.print(':', user.ui.sort[0])
|
||||
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) {
|
||||
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;
|
||||
*/
|
||||
app.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + data.key);
|
||||
app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (data.operator === '' ? 'ascending' : 'descending'));
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + data.key);
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (data.operator === '' ? 'ascending' : 'descending'));
|
||||
}
|
||||
});
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -4,14 +4,14 @@ pandora.ui.mainPanel = function() {
|
|||
elements: [
|
||||
{
|
||||
collapsible: true,
|
||||
collapsed: !app.user.ui.showSidebar,
|
||||
element: app.$ui.leftPanel = pandora.ui.leftPanel(),
|
||||
collapsed: !pandora.user.ui.showSidebar,
|
||||
element: pandora.$ui.leftPanel = pandora.ui.leftPanel(),
|
||||
resizable: true,
|
||||
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'
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.mainMenu = function() {
|
||||
var isGuest = app.user.level == 'guest',
|
||||
var isGuest = pandora.user.level == 'guest',
|
||||
that = new Ox.MainMenu({
|
||||
extras: [
|
||||
$('<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'
|
||||
})
|
||||
],
|
||||
id: 'mainMenu',
|
||||
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: 'about', title: 'About ' + app.site.site.name },
|
||||
{ id: 'news', title: app.site.site.name + ' News' },
|
||||
{ id: 'about', title: 'About ' + pandora.site.site.name },
|
||||
{ id: 'news', title: pandora.site.site.name + ' News' },
|
||||
{ id: 'tour', title: 'Take a Tour' },
|
||||
{ id: 'faq', title: 'Frequently Asked Questions' },
|
||||
{ id: 'terms', title: 'Terms of Service' },
|
||||
|
@ -25,10 +25,10 @@ pandora.ui.mainMenu = function() {
|
|||
{ 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: '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 ,' },
|
||||
{},
|
||||
|
@ -37,7 +37,7 @@ pandora.ui.mainMenu = function() {
|
|||
] },
|
||||
{ id: 'listMenu', title: 'List', 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: 'favorites', title: 'Favorites' }
|
||||
|
@ -52,7 +52,7 @@ pandora.ui.mainMenu = function() {
|
|||
{ id: 'newsmartlist', title: 'New Smart List...', keyboard: '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 }
|
||||
]},
|
||||
|
@ -70,10 +70,10 @@ pandora.ui.mainMenu = function() {
|
|||
{ id: 'invertselection', title: 'Invert Selection', disabled: true, keyboard: 'alt control a' }
|
||||
] },
|
||||
{ id: 'viewMenu', title: 'View', items: [
|
||||
{ id: 'movies', title: 'View ' + app.site.itemName.plural, items: [
|
||||
{ group: 'viewmovies', min: 0, max: 1, items: $.map(app.site.listViews, function(view, i) {
|
||||
{ id: 'movies', title: 'View ' + pandora.site.itemName.plural, items: [
|
||||
{ group: 'viewmovies', min: 0, max: 1, items: $.map(pandora.site.listViews, function(view, i) {
|
||||
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);
|
||||
}) },
|
||||
]},
|
||||
|
@ -87,10 +87,10 @@ pandora.ui.mainMenu = function() {
|
|||
{ id: 'video', title: 'Video' }
|
||||
] },
|
||||
{},
|
||||
{ id: 'openmovie', title: ['Open ' + app.site.itemName.singular, 'Open ' + app.site.itemName.plural], disabled: true, items: [
|
||||
{ group: 'movieview', min: 0, max: 1, items: $.map(app.site.itemViews, function(view, i) {
|
||||
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], disabled: true, items: [
|
||||
{ group: 'movieview', min: 0, max: 1, items: $.map(pandora.site.itemViews, function(view, i) {
|
||||
return $.extend({
|
||||
checked: app.user.ui.itemView == view.id,
|
||||
checked: pandora.user.ui.itemView == view.id,
|
||||
}, view);
|
||||
}) },
|
||||
]},
|
||||
|
@ -98,20 +98,20 @@ pandora.ui.mainMenu = function() {
|
|||
{ id: 'lists', title: 'Hide Lists', keyboard: 'shift l' },
|
||||
{ id: 'info', title: 'Hide Info', keyboard: 'shift i' },
|
||||
{ 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: 'sortmovies', title: 'Sort ' + app.site.itemName.plural + ' by', items: [
|
||||
{ group: 'sortmovies', min: 1, max: 1, items: $.map(app.ui.sortKeys, function(key, i) {
|
||||
{ id: 'sortmovies', title: 'Sort ' + pandora.site.itemName.plural + ' by', items: [
|
||||
{ group: 'sortmovies', min: 1, max: 1, items: $.map(pandora.site.sortKeys, function(key, i) {
|
||||
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);
|
||||
}) }
|
||||
] },
|
||||
{ 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: [
|
||||
{ id: 'ascending', title: 'Ascending', checked: app.user.ui.lists[app.user.ui.list].sort[0].operator === '' },
|
||||
{ id: 'descending', title: 'Descending', 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: pandora.user.ui.lists[pandora.user.ui.list].sort[0].operator == '-' }
|
||||
]}
|
||||
] },
|
||||
{ id: 'advancedsort', title: 'Advanced Sort...', keyboard: 'shift control s' },
|
||||
|
@ -120,11 +120,11 @@ pandora.ui.mainMenu = function() {
|
|||
] },
|
||||
{ id: 'findMenu', 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({
|
||||
checked: app.user.ui.findQuery.conditions.length &&
|
||||
(app.user.ui.findQuery.conditions[0].key == key.id ||
|
||||
(app.user.ui.findQuery.conditions[0].key === '' && key.id == 'all')),
|
||||
checked: pandora.user.ui.findQuery.conditions.length &&
|
||||
(pandora.user.ui.findQuery.conditions[0].key == key.id ||
|
||||
(pandora.user.ui.findQuery.conditions[0].key === '' && key.id == 'all')),
|
||||
}, key)
|
||||
}) }
|
||||
] },
|
||||
|
@ -149,7 +149,7 @@ pandora.ui.mainMenu = function() {
|
|||
{ id: 'report', title: 'Report a Bug' },
|
||||
] },
|
||||
{ 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: 'query', title: 'Show pandora.Query' },
|
||||
|
@ -167,7 +167,7 @@ pandora.ui.mainMenu = function() {
|
|||
change: function(event, data) {
|
||||
if (data.id == 'find') {
|
||||
var id = data.checked[0].id;
|
||||
app.$ui.findSelect.selectItem(id);
|
||||
pandora.$ui.findSelect.selectItem(id);
|
||||
} else if (data.id == 'movieview') {
|
||||
var view = data.checked[0].id;
|
||||
var id = document.location.pathname.split('/')[1];
|
||||
|
@ -177,13 +177,13 @@ pandora.ui.mainMenu = function() {
|
|||
url(id);
|
||||
} else if (data.id == 'ordermovies') {
|
||||
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') {
|
||||
var id = data.checked[0].id,
|
||||
operator = pandora.getSortOperator(id);
|
||||
app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
|
||||
app.$ui.sortSelect.selectItem(id);
|
||||
app.$ui.list.sortList(id, operator);
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
|
||||
pandora.$ui.sortSelect.selectItem(id);
|
||||
pandora.$ui.list.sortList(id, operator);
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
} else if (data.id == 'viewmovies') {
|
||||
var view = data.checked[0].id;
|
||||
|
@ -221,16 +221,16 @@ pandora.ui.mainMenu = function() {
|
|||
height: 498,
|
||||
id: 'home',
|
||||
keys: {enter: 'close', escape: 'close'},
|
||||
title: app.site.site.name,
|
||||
title: pandora.site.site.name,
|
||||
width: 800
|
||||
}).open();
|
||||
} 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') {
|
||||
app.$ui.accountDialog = (app.user.level == 'guest' ?
|
||||
pandora.$ui.accountDialog = (pandora.user.level == 'guest' ?
|
||||
pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open();
|
||||
} else if (data.id == 'places') {
|
||||
app.$ui.placesDialog = pandora.ui.placesDialog().open();
|
||||
pandora.$ui.placesDialog = pandora.ui.placesDialog().open();
|
||||
/*
|
||||
var $manage = new Ox.SplitPanel({
|
||||
elements: [
|
||||
|
@ -243,9 +243,9 @@ pandora.ui.mainMenu = function() {
|
|||
orientation: 'horizontal',
|
||||
size: 44
|
||||
}).append(
|
||||
app.$ui.findPlacesElement = new Ox.FormElementGroup({
|
||||
pandora.$ui.findPlacesElement = new Ox.FormElementGroup({
|
||||
elements: [
|
||||
app.$ui.findPlacesSelect = new Ox.Select({
|
||||
pandora.$ui.findPlacesSelect = new Ox.Select({
|
||||
id: 'findPlacesSelect',
|
||||
items: [
|
||||
{ id: 'name', title: 'Find: Name' },
|
||||
|
@ -257,13 +257,13 @@ pandora.ui.mainMenu = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
app.$ui.findPlacesSelect.loseFocus();
|
||||
app.$ui.findPlacesInput.options({
|
||||
pandora.$ui.findPlacesSelect.loseFocus();
|
||||
pandora.$ui.findPlacesInput.options({
|
||||
placeholder: data.selected[0].title
|
||||
});
|
||||
}
|
||||
}),
|
||||
app.$ui.findPlacesInput = new Ox.Input({
|
||||
pandora.$ui.findPlacesInput = new Ox.Input({
|
||||
clear: true,
|
||||
id: 'findPlacesInput',
|
||||
placeholder: 'Find: Name',
|
||||
|
@ -277,7 +277,7 @@ pandora.ui.mainMenu = function() {
|
|||
margin: '4px'
|
||||
})
|
||||
).append(
|
||||
app.$ui.sortPlacesSelect = new Ox.Select({
|
||||
pandora.$ui.sortPlacesSelect = new Ox.Select({
|
||||
id: 'sortPlacesSelect',
|
||||
items: [
|
||||
{ id: 'name', title: 'Sort by Name', checked: true },
|
||||
|
@ -322,7 +322,7 @@ pandora.ui.mainMenu = function() {
|
|||
orientation: 'horizontal',
|
||||
size: 24
|
||||
}).append(
|
||||
app.$ui.labelsButton = new Ox.Button({
|
||||
pandora.$ui.labelsButton = new Ox.Button({
|
||||
id: 'labelsButton',
|
||||
title: [
|
||||
{id: 'show', title: 'Show Labels'},
|
||||
|
@ -335,7 +335,7 @@ pandora.ui.mainMenu = function() {
|
|||
margin: '4px'
|
||||
})
|
||||
).append(
|
||||
app.$ui.findMapInput = new Ox.Input({
|
||||
pandora.$ui.findMapInput = new Ox.Input({
|
||||
clear: true,
|
||||
id: 'findMapInput',
|
||||
placeholder: 'Find on Map',
|
||||
|
@ -347,23 +347,23 @@ pandora.ui.mainMenu = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
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,
|
||||
value: location.name
|
||||
});
|
||||
app.$ui.placeAliasesInput.options({
|
||||
pandora.$ui.placeAliasesInput.options({
|
||||
disabled: false
|
||||
});
|
||||
app.$ui.placeGeonameLabel.options({
|
||||
pandora.$ui.placeGeonameLabel.options({
|
||||
disabled: false,
|
||||
title: location.names.join(', ')
|
||||
});
|
||||
app.$ui.removePlaceButton.options({
|
||||
pandora.$ui.removePlaceButton.options({
|
||||
disabled: false
|
||||
});
|
||||
app.$ui.addPlaceButton.options({
|
||||
pandora.$ui.addPlaceButton.options({
|
||||
disabled: false
|
||||
});
|
||||
|
||||
|
@ -374,7 +374,7 @@ pandora.ui.mainMenu = function() {
|
|||
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']
|
||||
})
|
||||
.css({
|
||||
|
@ -385,33 +385,33 @@ pandora.ui.mainMenu = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
select: function(event, location) {
|
||||
app.$ui.placeNameInput.options({
|
||||
pandora.$ui.placeNameInput.options({
|
||||
disabled: false,
|
||||
value: location.name
|
||||
});
|
||||
app.$ui.placeAliasesInput.options({
|
||||
pandora.$ui.placeAliasesInput.options({
|
||||
disabled: false
|
||||
});
|
||||
app.$ui.placeGeonameLabel.options({
|
||||
pandora.$ui.placeGeonameLabel.options({
|
||||
disabled: false,
|
||||
title: location.names.join(', ')
|
||||
});
|
||||
app.$ui.removePlaceButton.options({
|
||||
pandora.$ui.removePlaceButton.options({
|
||||
disabled: false
|
||||
});
|
||||
app.$ui.addPlaceButton.options({
|
||||
pandora.$ui.addPlaceButton.options({
|
||||
disabled: false
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
element: app.$ui.bottomBar = new Ox.Toolbar({
|
||||
element: pandora.$ui.bottomBar = new Ox.Toolbar({
|
||||
orientation: 'horizontal',
|
||||
size: 24
|
||||
})
|
||||
.append(
|
||||
app.$ui.placeNameInput = new Ox.Input({
|
||||
pandora.$ui.placeNameInput = new Ox.Input({
|
||||
disabled: true,
|
||||
id: 'placeName',
|
||||
placeholder: 'Name',
|
||||
|
@ -423,7 +423,7 @@ pandora.ui.mainMenu = function() {
|
|||
})
|
||||
)
|
||||
.append(
|
||||
app.$ui.placeAliasesInput = new Ox.Input({
|
||||
pandora.$ui.placeAliasesInput = new Ox.Input({
|
||||
disabled: true,
|
||||
id: 'aliases',
|
||||
placeholder: 'Aliases',
|
||||
|
@ -435,11 +435,11 @@ pandora.ui.mainMenu = function() {
|
|||
})
|
||||
)
|
||||
.append(
|
||||
app.$ui.placeGeonameLabel = new Ox.Label({
|
||||
pandora.$ui.placeGeonameLabel = new Ox.Label({
|
||||
disabled: true,
|
||||
id: 'placeGeoname',
|
||||
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({
|
||||
float: 'left',
|
||||
|
@ -447,7 +447,7 @@ pandora.ui.mainMenu = function() {
|
|||
})
|
||||
)
|
||||
.append(
|
||||
app.$ui.addPlaceButton = new Ox.Button({
|
||||
pandora.$ui.addPlaceButton = new Ox.Button({
|
||||
disabled: true,
|
||||
id: 'addPlaceButton',
|
||||
title: 'add',
|
||||
|
@ -459,7 +459,7 @@ pandora.ui.mainMenu = function() {
|
|||
})
|
||||
)
|
||||
.append(
|
||||
app.$ui.removePlaceButton = new Ox.Button({
|
||||
pandora.$ui.removePlaceButton = new Ox.Button({
|
||||
disabled: true,
|
||||
id: 'removePlaceButton',
|
||||
title: 'remove',
|
||||
|
@ -493,13 +493,13 @@ pandora.ui.mainMenu = function() {
|
|||
value: 'Close'
|
||||
}
|
||||
],
|
||||
height: parseInt(app.$ui.document.height() * 0.8),
|
||||
height: parseInt(pandora.$ui.document.height() * 0.8),
|
||||
id: 'places',
|
||||
minHeight: 400,
|
||||
minWidth: 600,
|
||||
padding: 0,
|
||||
title: 'Manage Places',
|
||||
width: parseInt(app.$ui.document.width() * 0.8)
|
||||
width: parseInt(pandora.$ui.document.width() * 0.8)
|
||||
}).css({
|
||||
overflow: 'hidden'
|
||||
}).append($manage).open();
|
||||
|
@ -519,8 +519,8 @@ pandora.ui.mainMenu = function() {
|
|||
content: new Ox.Element()
|
||||
.html([
|
||||
'Query: ' + JSON.stringify(pandora.Query.toObject()),
|
||||
'findQuery: ' + JSON.stringify(app.user.ui.findQuery),
|
||||
'listQuery: ' + JSON.stringify(app.user.ui.listQuery)
|
||||
'findQuery: ' + JSON.stringify(pandora.user.ui.findQuery),
|
||||
'listQuery: ' + JSON.stringify(pandora.user.ui.listQuery)
|
||||
].join('<br/><br/>')),
|
||||
height: 200,
|
||||
keys: {enter: 'close', escape: 'close'},
|
||||
|
@ -528,7 +528,7 @@ pandora.ui.mainMenu = function() {
|
|||
}).open();
|
||||
} else if (data.id == 'resetui') {
|
||||
pandora.api.resetUI({}, function() {
|
||||
app.$ui.appPanel.reload();
|
||||
pandora.$ui.appPanel.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
places: function(data, callback) {
|
||||
return pandora.api.findPlaces($.extend({
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||
pandora.ui.rightPanel = function() {
|
||||
var that;
|
||||
if (app.user.ui.section == 'site') {
|
||||
if (pandora.user.ui.section == 'site') {
|
||||
that = new Ox.Element()
|
||||
.html(app.user.ui.sitePage)
|
||||
.html(pandora.user.ui.sitePage)
|
||||
.bindEvent({
|
||||
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'});
|
||||
});
|
||||
} else if (app.user.ui.section == 'items') {
|
||||
} else if (pandora.user.ui.section == 'items') {
|
||||
that = new Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: app.$ui.toolbar = pandora.ui.toolbar(),
|
||||
element: pandora.$ui.toolbar = pandora.ui.toolbar(),
|
||||
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
|
||||
}
|
||||
],
|
||||
|
@ -33,18 +33,18 @@ pandora.ui.rightPanel = function() {
|
|||
.bindEvent({
|
||||
resize: function(event, data) {
|
||||
//Ox.print('???? resize rightPanel', event, data)
|
||||
if (!app.user.ui.item) {
|
||||
if (!pandora.user.ui.item) {
|
||||
pandora.resizeGroups(data);
|
||||
app.$ui.list.size();
|
||||
if (app.user.ui.lists[app.user.ui.list].listView == 'map') {
|
||||
app.$ui.map.resizeMap();
|
||||
pandora.$ui.list.size();
|
||||
if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'map') {
|
||||
pandora.$ui.map.resizeMap();
|
||||
}
|
||||
} else {
|
||||
app.$ui.browser.scrollToSelection();
|
||||
app.user.ui.itemView == 'player' && app.$ui.player.options({
|
||||
pandora.$ui.browser.scrollToSelection();
|
||||
pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({
|
||||
width: data
|
||||
});
|
||||
app.user.ui.itemView == 'timeline' && app.$ui.editor.options({
|
||||
pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({
|
||||
width: data
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
pandora.ui.sectionButtons = function() {
|
||||
var that = new Ox.ButtonGroup({
|
||||
buttons: [
|
||||
{id: 'site', selected: app.user.ui.section == 'site', title: app.site.site.name},
|
||||
{id: 'items', selected: app.user.ui.section == 'items', title: app.site.itemName.plural},
|
||||
{id: 'texts', selected: app.user.ui.section == 'texts', title: 'Texts'},
|
||||
{id: 'admin', selected: app.user.ui.section == 'admin', title: 'Admin'}
|
||||
{id: 'site', selected: pandora.user.ui.section == 'site', title: pandora.site.site.name},
|
||||
{id: 'items', selected: pandora.user.ui.section == 'items', title: pandora.site.itemName.plural},
|
||||
{id: 'texts', selected: pandora.user.ui.section == 'texts', title: 'Texts'},
|
||||
{id: 'admin', selected: pandora.user.ui.section == 'admin', title: 'Admin'}
|
||||
],
|
||||
id: 'sectionButtons',
|
||||
selectable: true
|
||||
|
@ -17,7 +17,7 @@ pandora.ui.sectionButtons = function() {
|
|||
change: function(event, data) {
|
||||
var section = data.selected[0];
|
||||
if (section == 'site') {
|
||||
pandora.URL.set(app.user.ui.sitePage);
|
||||
pandora.URL.set(pandora.user.ui.sitePage);
|
||||
} else if (section == 'items') {
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
} else if (section == 'texts') {
|
||||
|
|
|
@ -4,10 +4,10 @@ pandora.ui.sectionSelect = function() {
|
|||
var that = new Ox.Select({
|
||||
id: 'sectionSelect',
|
||||
items: [
|
||||
{checked: app.user.ui.section == 'site', id: 'site', title: app.site.site.name},
|
||||
{checked: app.user.ui.section == 'items', id: 'items', title: app.site.itemName.plural},
|
||||
{checked: app.user.ui.section == 'texts', id: 'texts', title: 'Texts'},
|
||||
{checked: app.user.ui.section == 'admin', id: 'admin', title: 'Admin'}
|
||||
{checked: pandora.user.ui.section == 'site', id: 'site', title: pandora.site.site.name},
|
||||
{checked: pandora.user.ui.section == 'items', id: 'items', title: pandora.site.itemName.plural},
|
||||
{checked: pandora.user.ui.section == 'texts', id: 'texts', title: 'Texts'},
|
||||
{checked: pandora.user.ui.section == 'admin', id: 'admin', title: 'Admin'}
|
||||
]
|
||||
}).css({
|
||||
float: 'left',
|
||||
|
|
|
@ -5,8 +5,8 @@ pandora.ui.sectionbar = function(mode) {
|
|||
})
|
||||
.append(
|
||||
mode == 'buttons' ?
|
||||
app.$ui.sectionButtons = pandora.ui.sectionButtons() :
|
||||
app.$ui.sectionSelect = pandora.ui.sectionSelect()
|
||||
pandora.$ui.sectionButtons = pandora.ui.sectionButtons() :
|
||||
pandora.$ui.sectionSelect = pandora.ui.sectionSelect()
|
||||
);
|
||||
that.toggle = function() {
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
pandora.ui.sortSelect = function() {
|
||||
var that = new Ox.Select({
|
||||
id: 'sortSelect',
|
||||
items: $.map(app.ui.sortKeys, function(key) {
|
||||
//Ox.print('????', app.user.ui.lists[app.user.ui.list].sort.key, key.id)
|
||||
items: $.map(pandora.site.sortKeys, function(key) {
|
||||
//Ox.print('????', pandora.user.ui.lists[pandora.user.ui.list].sort.key, key.id)
|
||||
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
|
||||
});
|
||||
}),
|
||||
|
@ -20,14 +20,14 @@ pandora.ui.sortSelect = function() {
|
|||
var id = data.selected[0].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,
|
||||
operator: operator
|
||||
};
|
||||
*/
|
||||
app.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + id);
|
||||
app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
|
||||
app.$ui.list.sortList(id, operator);
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + id);
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
|
||||
pandora.$ui.list.sortList(id, operator);
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,13 +13,13 @@ pandora.ui.statusbar = function() {
|
|||
fontSize: '9px'
|
||||
})
|
||||
.append(
|
||||
app.$ui.total = new Ox.Element('span')
|
||||
pandora.$ui.total = new Ox.Element('span')
|
||||
)
|
||||
.append(
|
||||
new Ox.Element('span').html(' — ')
|
||||
)
|
||||
.append(
|
||||
app.$ui.selected = new Ox.Element('span')
|
||||
pandora.$ui.selected = new Ox.Element('span')
|
||||
)
|
||||
);
|
||||
return that;
|
||||
|
|
|
@ -5,20 +5,20 @@ pandora.ui.toolbar = function() {
|
|||
}).css({
|
||||
zIndex: 2 // fixme: remove later
|
||||
});
|
||||
app.user.ui.item && that.append(
|
||||
app.$ui.backButton = pandora.ui.backButton()
|
||||
pandora.user.ui.item && that.append(
|
||||
pandora.$ui.backButton = pandora.ui.backButton()
|
||||
);
|
||||
that.append(
|
||||
app.$ui.viewSelect = pandora.ui.viewSelect()
|
||||
pandora.$ui.viewSelect = pandora.ui.viewSelect()
|
||||
);
|
||||
!app.user.ui.item && that.append(
|
||||
app.$ui.sortSelect = pandora.ui.sortSelect()
|
||||
!pandora.user.ui.item && that.append(
|
||||
pandora.$ui.sortSelect = pandora.ui.sortSelect()
|
||||
);
|
||||
that.append(
|
||||
app.$ui.findElement = pandora.ui.findElement()
|
||||
pandora.$ui.findElement = pandora.ui.findElement()
|
||||
);
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -2,34 +2,34 @@
|
|||
pandora.ui.viewSelect = function() {
|
||||
var that = new Ox.Select({
|
||||
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), {
|
||||
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
|
||||
});
|
||||
}) : $.map(app.site.itemViews, function(view) {
|
||||
}) : $.map(pandora.site.itemViews, function(view) {
|
||||
return $.extend($.extend({}, view), {
|
||||
checked: app.user.ui.itemView == view.id,
|
||||
checked: pandora.user.ui.itemView == view.id,
|
||||
title: 'View: ' + view.title
|
||||
});
|
||||
}),
|
||||
width: !app.user.ui.item ? 144 : 128
|
||||
width: !pandora.user.ui.item ? 144 : 128
|
||||
})
|
||||
.css({
|
||||
float: 'left',
|
||||
margin: '4px 0 0 4px'
|
||||
})
|
||||
.bindEvent({
|
||||
change: !app.user.ui.item ? function(event, data) {
|
||||
change: !pandora.user.ui.item ? function(event, data) {
|
||||
var id = data.selected[0].id;
|
||||
app.$ui.mainMenu.checkItem('viewMenu_movies_' + id);
|
||||
pandora.UI.set(['lists', app.user.ui.list, 'listView'].join('|'), id);
|
||||
pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + id);
|
||||
pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), id);
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
} : function(event, data) {
|
||||
var id = data.selected[0].id;
|
||||
//pandora.UI.set({itemView: id});
|
||||
pandora.URL.set(app.user.ui.item + '/' + id);
|
||||
// app.$ui.contentPanel.replaceElement(1, app.$ui.item = pandora.ui.item());
|
||||
pandora.URL.set(pandora.user.ui.item + '/' + id);
|
||||
// pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.item = pandora.ui.item());
|
||||
}
|
||||
});
|
||||
return that;
|
||||
|
|
Loading…
Reference in a new issue