some bit shuffling that seems to make item views return to lists views with proper selection

This commit is contained in:
rlx 2011-08-17 09:29:42 +00:00
parent 4d321f1376
commit 81764c2b94
8 changed files with 28 additions and 19 deletions

View file

@ -504,7 +504,7 @@
"icons": "posters", "icons": "posters",
"infoIconSize": 256, "infoIconSize": 256,
"item": "", "item": "",
"itemView": "timeline", "itemView": "info",
"list": "", "list": "",
"listQuery": {"conditions": [], "operator": ""}, "listQuery": {"conditions": [], "operator": ""},
"lists": { "lists": {

View file

@ -162,8 +162,6 @@ Ox.load('Geo', function() {
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}); });
//pandora.user.ui.itemView == 'frames' && pandora.$ui.item.resize();
//pandora.user.ui.itemView == 'posters' && pandora.$ui.item.resize();
} }
} }

View file

@ -104,9 +104,11 @@ pandora.URL = (function() {
} else if (pandora.user.ui.sitePage != oldUserUI.sitePage) { } else if (pandora.user.ui.sitePage != oldUserUI.sitePage) {
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel()); pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
} else if (!pandora.user.ui.item || !oldUserUI.item) { } else if (!pandora.user.ui.item || !oldUserUI.item) {
// list to list, list to item, item to list
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info()); pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel()); pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
} else { } else {
// item to items
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info()); pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.item()); pandora.$ui.contentPanel.replaceElement(1, pandora.ui.item());
} }
@ -115,11 +117,12 @@ pandora.URL = (function() {
oldUserUI.item && oldUserUI.item &&
['player', 'timeline'].indexOf(oldUserUI.itemView) > -1 ['player', 'timeline'].indexOf(oldUserUI.itemView) > -1
) { ) {
pandora.UI.set( var $item = pandora.$ui[
'videoPosition|' + oldUserUI.item,
pandora.$ui[
oldUserUI.itemView == 'player' ? 'player' : 'editor' oldUserUI.itemView == 'player' ? 'player' : 'editor'
].options('position') ];
$item && pandora.UI.set(
'videoPosition|' + oldUserUI.item,
$item.options('position')
); );
} }
} }

View file

@ -56,7 +56,6 @@ pandora.ui.browser = function() {
}; };
}, },
items: function(data, callback) { items: function(data, callback) {
//Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject())
pandora.api.find($.extend(data, { pandora.api.find($.extend(data, {
query: pandora.Query.toObject() query: pandora.Query.toObject()
}), callback); }), callback);
@ -75,6 +74,7 @@ pandora.ui.browser = function() {
that.scrollToSelection(); that.scrollToSelection();
}, },
select: function(event, data) { select: function(event, data) {
pandora.UI.set('lists|' + pandora.user.ui.list + '|selected', data.ids);
pandora.URL.set(data.ids[0]); pandora.URL.set(data.ids[0]);
}, },
toggle: function(event, data) { toggle: function(event, data) {

View file

@ -11,7 +11,7 @@ pandora.ui.contentPanel = function() {
size: pandora.user.ui.groupsSize size: pandora.user.ui.groupsSize
}, },
{ {
element: pandora.$ui.list = pandora.ui.list(pandora.user.ui.lists[pandora.user.ui.list].listView) element: pandora.$ui.list = pandora.ui.list()
} }
] : [ ] : [
{ {
@ -21,7 +21,7 @@ pandora.ui.contentPanel = function() {
size: 112 + Ox.UI.SCROLLBAR_SIZE size: 112 + Ox.UI.SCROLLBAR_SIZE
}, },
{ {
element: pandora.$ui.item = pandora.ui.item(pandora.user.ui.item, pandora.user.ui.itemView) element: pandora.$ui.item = pandora.ui.item()
} }
], ],
orientation: 'vertical' orientation: 'vertical'

View file

@ -14,6 +14,7 @@ pandora.ui.infoView = function(data) {
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio), iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio), iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio),
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0, iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
borderRadius = pandora.user.ui.icons == 'posters' ? 0 : iconSize / 8,
edit = false, edit = false,
that = Ox.Element(), that = Ox.Element(),
uid = Ox.uid(), uid = Ox.uid(),
@ -47,6 +48,7 @@ pandora.ui.infoView = function(data) {
top: margin + 'px', top: margin + 'px',
width: iconWidth + 'px', width: iconWidth + 'px',
height: iconHeight + 'px', height: iconHeight + 'px',
borderRadius: borderRadius + 'px',
cursor: 'pointer' cursor: 'pointer'
}) })
.bindEvent({ .bindEvent({
@ -74,7 +76,8 @@ pandora.ui.infoView = function(data) {
position: 'absolute', position: 'absolute',
left: iconLeft + 'px', left: iconLeft + 'px',
width: iconWidth + 'px', width: iconWidth + 'px',
height: iconHeight + 'px' height: iconHeight + 'px',
borderRadius: borderRadius + 'px'
}) })
.appendTo($reflection), .appendTo($reflection),
$reflectionGradient = $('<div>') $reflectionGradient = $('<div>')
@ -462,10 +465,12 @@ pandora.ui.infoView = function(data) {
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio); iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio);
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio); iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio);
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0, iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
borderRadius = pandora.user.ui.icons == 'posters' ? 0 : iconSize / 8;
$icon.animate({ $icon.animate({
left: margin + iconLeft + 'px', left: margin + iconLeft + 'px',
width: iconWidth + 'px', width: iconWidth + 'px',
height: iconHeight + 'px' height: iconHeight + 'px',
borderRadius: borderRadius + 'px'
}, 250); }, 250);
$reflection.animate({ $reflection.animate({
top: margin + iconHeight + 'px', top: margin + iconHeight + 'px',
@ -476,6 +481,7 @@ pandora.ui.infoView = function(data) {
left: iconLeft + 'px', left: iconLeft + 'px',
width: iconWidth + 'px', width: iconWidth + 'px',
height: iconHeight + 'px', height: iconHeight + 'px',
borderRadius: borderRadius + 'px'
}, 250); }, 250);
$reflectionGradient.animate({ $reflectionGradient.animate({
width: iconSize + 'px', width: iconSize + 'px',
@ -495,7 +501,7 @@ pandora.ui.infoView = function(data) {
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;
iconRatio = pandora.user.ui.icons == 'posters' iconRatio = pandora.user.ui.icons == 'posters'
? data.poster.width / data.poster.height : 1, ? data.poster.width / data.poster.height : 1;
toggleIconSize(); toggleIconSize();
pandora.user.level == 'admin' && $list.replaceWith($list = renderList()); pandora.user.level == 'admin' && $list.replaceWith($list = renderList());
}; };

View file

@ -1,8 +1,9 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript // vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.list = function(view) { // fixme: remove view argument pandora.ui.list = function() { // fixme: remove view argument
var that, $map, var that, $map,
preview = false; view = pandora.user.ui.lists[pandora.user.ui.list].listView,
preview = false
//Ox.print('constructList', view); //Ox.print('constructList', view);
if (view == 'list') { if (view == 'list') {
/* /*
@ -72,6 +73,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
} }
}); });
} else if (view == 'icons') { } else if (view == 'icons') {
//alert(JSON.stringify(pandora.user.ui.lists[pandora.user.ui.list].selected))
that = Ox.IconList({ that = Ox.IconList({
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
id: 'list', id: 'list',
@ -97,6 +99,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}), callback); }), callback);
}, },
keys: ['director', 'id', 'poster', 'title', 'year'], keys: ['director', 'id', 'poster', 'title', 'year'],
selected: pandora.user.ui.lists[pandora.user.ui.list].selected,
size: 128, size: 128,
sort: pandora.user.ui.lists[pandora.user.ui.list].sort, sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
unique: 'id' unique: 'id'
@ -410,7 +413,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}, },
select: function(event, data) { select: function(event, data) {
var $still, $timeline; var $still, $timeline;
pandora.user.selectedMovies = data.ids; pandora.user.ui.lists[pandora.user.ui.list].selected = data.ids;
if (data.ids.length) { if (data.ids.length) {
pandora.$ui.mainMenu.enableItem('copy'); pandora.$ui.mainMenu.enableItem('copy');
pandora.$ui.mainMenu.enableItem('openmovie'); pandora.$ui.mainMenu.enableItem('openmovie');

View file

@ -1,4 +1,5 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript // vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.rightPanel = function() { pandora.ui.rightPanel = function() {
var that; var that;
if (pandora.user.ui.section == 'site') { if (pandora.user.ui.section == 'site') {
@ -10,8 +11,7 @@ pandora.ui.rightPanel = function() {
} }
}); });
} else { } else {
that = Ox.Element() that = Ox.Element().css({padding: '8px'});
.css({padding: '8px'});
pandora.api.getPage(pandora.user.ui.sitePage, function(result) { pandora.api.getPage(pandora.user.ui.sitePage, function(result) {
that.html(result.data.body).css({overflowY: 'auto'}); that.html(result.data.body).css({overflowY: 'auto'});
}); });
@ -36,7 +36,6 @@ pandora.ui.rightPanel = function() {
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
//Ox.print('???? resize rightPanel', event, data)
if (!pandora.user.ui.item) { if (!pandora.user.ui.item) {
pandora.resizeGroups(data); pandora.resizeGroups(data);
pandora.$ui.list.size(); pandora.$ui.list.size();