add pandora.getSortKeys, update pandora.signin and pandora.signout

This commit is contained in:
rolux 2012-06-30 20:07:43 +00:00
parent 7c94d74156
commit 76f6a65a7f

View file

@ -759,19 +759,10 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
operator: '&' operator: '&'
} }
} : {}), function(result) { } : {}), function(result) {
//Ox.print('RESULT::::::', result)
var annotation, span; var annotation, span;
if (result.data.items.length) { if (result.data.items.length) {
span = result.data.items[0]; span = result.data.items[0];
annotation = span.id.split('/')[1]; annotation = span.id.split('/')[1];
/*
Ox.print("SETTING::::", {
annotation: annotation,
'in': span['in'],
out: span.out,
position: span['in']
});
*/
type == 'annotation' && pandora.UI.set('videoPoints.' + item, { type == 'annotation' && pandora.UI.set('videoPoints.' + item, {
annotation: annotation, annotation: annotation,
'in': span['in'], 'in': span['in'],
@ -818,6 +809,19 @@ pandora.getSortKeyData = function(key) {
|| Ox.getObjectById(pandora.site.clipKeys, key); || Ox.getObjectById(pandora.site.clipKeys, key);
} }
pandora.getSortKeys = function() {
return pandora.site.itemKeys.filter(function(key) {
return key.sort && (
!key.capability
|| pandora.site.capabilities[key.capability][pandora.user.level]
);
}).map(function(key) {
return Ox.extend(key, {
operator: pandora.getSortOperator(key.id)
});
});
};
pandora.getSortOperator = function(key) { pandora.getSortOperator = function(key) {
var data = pandora.getSortKeyData(key); var data = pandora.getSortKeyData(key);
return data.sortOperator || ['string', 'text'].indexOf( return data.sortOperator || ['string', 'text'].indexOf(
@ -982,14 +986,16 @@ pandora.logEvent = function(data, event, element) {
}; };
pandora.signin = function(data) { pandora.signin = function(data) {
pandora.user = data.user; // fixme: this is still voodoo
Ox.extend(pandora.user, { pandora.user = Ox.extend(data.user, {
sectionElement: 'buttons', sectionElement: 'buttons',
videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats) videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats)
}); });
pandora.user.ui._list = pandora.getListState(pandora.user.ui.find); // pandora.user.ui._list = pandora.getListState(pandora.user.ui.find);
pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find); // pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find);
pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find); // pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find);
pandora.site.sortKeys = pandora.getSortKeys();
pandora.URL.init();
Ox.Theme(pandora.user.ui.theme); Ox.Theme(pandora.user.ui.theme);
pandora.UI.set({find: pandora.user.ui.find}); pandora.UI.set({find: pandora.user.ui.find});
Ox.Request.clearCache(); Ox.Request.clearCache();
@ -997,10 +1003,13 @@ pandora.signin = function(data) {
}; };
pandora.signout = function(data) { pandora.signout = function(data) {
// fixme: this is still voodoo
pandora.user = data.user; pandora.user = data.user;
pandora.user.ui._list = pandora.getListState(pandora.user.ui.find); //pandora.user.ui._list = pandora.getListState(pandora.user.ui.find);
pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find); //pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find);
pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find); //pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find);
pandora.site.sortKeys = pandora.getSortKeys();
pandora.URL.init();
Ox.Theme(pandora.site.user.ui.theme); Ox.Theme(pandora.site.user.ui.theme);
pandora.UI.set({find: pandora.user.ui.find}); pandora.UI.set({find: pandora.user.ui.find});
Ox.Request.clearCache(); Ox.Request.clearCache();