new UI/URL handling (intermediate state)

This commit is contained in:
rolux 2011-09-23 10:44:54 +00:00
commit 41134b5eb1
30 changed files with 1213 additions and 741 deletions

View file

@ -61,6 +61,7 @@ Ox.load({
findKeys: Ox.map(data.site.itemKeys, function(key) {
return key.find ? key : null;
}),
itemsSection: pandora.site.itemName.plural.toLowerCase(),
sectionFolders: {
items: [
{id: 'personal', title: 'Personal Lists'},
@ -79,22 +80,32 @@ Ox.load({
{id: 'featured', title: 'Featured Texts', showBrowser: false}
]
},
sortKeys: Ox.map(data.site.itemKeys, function(key) {
sortKeys: Ox.map(pandora.site.itemKeys, function(key) {
return key.columnWidth ? Ox.extend(key, {
operator: pandora._getSortOperator(key.type)
}) : null;
})
});
pandora.site.listSettings = {};
Ox.map(pandora.site.user.ui, function(val, key) {
if (/^list[A-Z]/.test(key)) {
pandora.site.listSettings[key] = key[0].toLowerCase() + key.substr(1);
}
});
if (Ox.isEmpty(pandora.user.ui.lists)) {
var listSettings = {};
Ox.forEach(pandora.site.listSettings, function(listSetting, setting) {
listSettings[listSetting] = pandora.site.user.ui[setting];
});
pandora.UI.set('lists|', listSettings);
}
Ox.extend(pandora.user, {
sectionElement: 'buttons',
selectedMovies: [],
selectedMovies: [], // fixme: used for what?
videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats)
});
// fixme: this should not happen
if (!pandora.user.ui.lists[pandora.user.ui.list]) {
Ox.print('THIS SHOULD NOT HAPPEN', pandora.site.user.ui.lists[''])
pandora.user.ui.lists[pandora.user.ui.list] = pandora.site.user.ui.lists[''];
}
if (data.user.level == 'guest' && $.browser.mozilla) {
pandora.user.ui.theme = 'classic';
@ -106,78 +117,7 @@ Ox.load({
// set up url controller
var itemsName = pandora.site.itemName.plural.toLowerCase(),
sortKeys = {}, spanType = {}, views = {};
views[itemsName] = {
list: Ox.merge(
// 'grid' is the default view
['grid'],
Ox.map(pandora.site.listViews, function(view) {
return view.id == 'grid' ? null : view.id;
})
),
item: Ox.merge(
// 'info' is the default view, pandora.user.ui.videoView
// is the default view if there is a duration
['info', pandora.user.ui.videoView],
pandora.site.itemViews.map(function(view) {
return [
'info', pandora.user.ui.videoView
].indexOf(view.id) > -1 ? null : view.id;
})
)
};
sortKeys[itemsName] = {list: {}, item: {}};
views[itemsName].list.forEach(function(view) {
sortKeys[itemsName].list[view] = Ox.merge(
pandora.isClipView(view) ? Ox.clone(pandora.site.clipKeys) : [],
// 'director' is the default sort key
[Ox.getObjectById(pandora.site.sortKeys, 'director')],
Ox.map(pandora.site.sortKeys, function(key) {
return key.id == 'director' ? null : key;
})
);
});
views[itemsName].item.forEach(function(view) {
if (pandora.isClipView(view, true)) {
sortKeys[itemsName].item[view] = Ox.merge(
// 'clip:position' is the default sort key
[Ox.getObjectById(pandora.site.clipKeys, 'clip:position')],
Ox.map(pandora.site.clipKeys, function(key) {
return key.id == 'clip:position' ? null : key;
})
);
}
});
spanType[itemsName] = {
list: {
map: 'location',
calendar: 'date'
},
item: {
video: 'duration',
timeline: 'duration',
map: 'location',
calendar: 'date'
}
};
pandora._URL = Ox.URL({
findKeys: pandora.site.findKeys,
getItem: pandora.getItemByIdOrTitle,
getSpan: pandora.getMetadataByIdOrName,
pages: [
'about', 'contact', 'faq', 'help', 'home', 'news',
'preferences', 'signin', 'signout', 'signup',
'software', 'terms', 'tour'
],
sortKeys: sortKeys,
spanType: spanType,
types: [pandora.site.itemName.plural.toLowerCase(), 'edits', 'texts'],
views: views
});
pandora.URL.parse(function() {
pandora.URL.init().parse(function() {
Ox.UI.hideLoadingScreen();