add volumes folder

This commit is contained in:
rolux 2011-09-01 04:46:44 +00:00
parent 1ef359c6ae
commit ae19191014
10 changed files with 329 additions and 229 deletions

View file

@ -499,7 +499,6 @@
"site": { "site": {
"id": "{{settings.SITEID}}", "id": "{{settings.SITEID}}",
"name": "{{settings.SITENAME}}", "name": "{{settings.SITENAME}}",
"sectionName": "{{settings.SITENAME}}",
"url": "{{settings.URL}}" "url": "{{settings.URL}}"
}, },
"sitePages": [ "sitePages": [
@ -572,15 +571,11 @@
"showInfo": true, "showInfo": true,
"showMovies": true, "showMovies": true,
"showFolder": { "showFolder": {
"site": {
"site": true,
"user": true,
"admin": true
},
"items": { "items": {
"personal": true, "personal": true,
"favorite": true, "favorite": true,
"featured": true "featured": true,
"volumes": true
} }
}, },
"showSidebar": true, "showSidebar": true,
@ -594,7 +589,10 @@
"videoView": "player", "videoView": "player",
"videoVolume": 1 "videoVolume": 1
}, },
"username": "" "username": "",
"volumes": [
{"name": "Movies A-Z", "path": "", "items": 1234}
]
}, },
"userLevels": ["guest", "member", "staff", "admin"], "userLevels": ["guest", "member", "staff", "admin"],
"video": { "video": {

View file

@ -48,28 +48,22 @@ Ox.load('Geo', function() {
return key.find ? key : null; return key.find ? key : null;
}), }),
sectionFolders: { 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: [ items: [
{id: 'personal', title: 'Personal Lists'}, {id: 'personal', title: 'Personal Lists'},
{id: 'favorite', title: 'Favorite Lists', showBrowser: false}, {id: 'favorite', title: 'Favorite Lists', showBrowser: false},
{id: 'featured', title: 'Featured Lists', showBrowser: false} {id: 'featured', title: 'Featured Lists', showBrowser: false},
] {id: 'volumes', title: 'Local Volumes'}
],
edits: [
{id: 'personal', title: 'Personal Edits'},
{id: 'favorite', title: 'Favorite Edits', showBrowser: false},
{id: 'featured', title: 'Featured Edits', showBrowser: false}
],
texts: [
{id: 'personal', title: 'Personal Texts'},
{id: 'favorite', title: 'Favorite Texts', showBrowser: false},
{id: 'featured', title: 'Featured Texts', showBrowser: false}
]
}, },
sortKeys: $.map(data.site.itemKeys, function(key, i) { sortKeys: $.map(data.site.itemKeys, function(key, i) {
return key.columnWidth ? key : null; return key.columnWidth ? key : null;

View file

@ -25,9 +25,9 @@ pandora.exitFullscreen = function() {
}; };
pandora.getFoldersHeight = function() { pandora.getFoldersHeight = function() {
var height = 48; var height = 0;
pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) { pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) {
height += pandora.user.ui.showFolder[pandora.user.ui.section][folder.id] * ( height += 16 + pandora.user.ui.showFolder[pandora.user.ui.section][folder.id] * (
!!folder.showBrowser * 40 + folder.items * 16 !!folder.showBrowser * 40 + folder.items * 16
); );
Ox.print('h', height); Ox.print('h', height);
@ -212,11 +212,9 @@ pandora.resizeGroups = function(width) {
pandora.resizeFolders = function() { pandora.resizeFolders = function() {
var width = pandora.getFoldersWidth(), var width = pandora.getFoldersWidth(),
columnWidth = {}; columnWidth = {};
if (pandora.user.ui.section == 'site') { if (pandora.user.ui.section == 'items') {
columnWidth.title = width - 16; columnWidth = {user: parseInt((width - 96) * 0.4)};
} else if (pandora.user.ui.section == 'items') { columnWidth.name = (width - 96) - columnWidth.user;
columnWidth = {user: parseInt((width - 88) * 0.4)};
columnWidth.name = (width - 88) - columnWidth.user;
} }
//Ox.print('sectionsWidth', width) //Ox.print('sectionsWidth', width)
$.each(pandora.$ui.folderList, function(id, $list) { $.each(pandora.$ui.folderList, function(id, $list) {
@ -224,14 +222,12 @@ pandora.resizeFolders = function() {
pandora.$ui.folder[i].css({width: width + 'px'}); pandora.$ui.folder[i].css({width: width + 'px'});
$list.css({width: width + 'px'}); $list.css({width: width + 'px'});
Ox.print('...', width, id, $list.options()) Ox.print('...', width, id, $list.options())
if (pandora.user.ui.section == 'site') { if (pandora.user.ui.section == 'items') {
$list.resizeColumn('title', columnWidth.title);
} else if (pandora.user.ui.section == 'items') {
if (pandora.site.sectionFolders[pandora.user.ui.section][i].showBrowser) { if (pandora.site.sectionFolders[pandora.user.ui.section][i].showBrowser) {
$list.resizeColumn('user', columnWidth.user) $list.resizeColumn('user', columnWidth.user)
.resizeColumn('name', columnWidth.name); .resizeColumn('name', columnWidth.name);
} else { } else {
$list.resizeColumn(id == 'favorite' ? 'id' : 'name', width - 88); $list.resizeColumn(id == 'favorite' ? 'id' : 'name', width - 96);
} }
} }
if (!pandora.user.ui.showFolder[pandora.user.ui.section][id]) { if (!pandora.user.ui.showFolder[pandora.user.ui.section][id]) {

View file

@ -330,7 +330,7 @@ pandora.ui.accountSignoutDialog = function() {
.css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'})
) )
.append( .append(
Ox.Element() $('<div>')
.css({position: 'absolute', left: '96px', top: '16px', width: '192px'}) .css({position: 'absolute', left: '96px', top: '16px', width: '192px'})
.html('Are you sure you want to sign out?') .html('Are you sure you want to sign out?')
), ),

View file

@ -1,6 +1,8 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript // vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.folderBrowserList = function(id) { pandora.ui.folderBrowserList = function(id) {
var columnWidth = (pandora.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 88) / 2, // fixme: user and name are set to the same width here,
// but resizeFolders will set them to different widths
var columnWidth = (pandora.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 96) / 2,
i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id), i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
that = Ox.TextList({ that = Ox.TextList({
columns: [ columns: [
@ -43,10 +45,11 @@ pandora.ui.folderBrowserList = function(id) {
{ {
align: 'right', align: 'right',
id: 'items', id: 'items',
format: {type: 'number'},
operator: '-', operator: '-',
title: 'Items', title: 'Items',
visible: true, visible: true,
width: 40 width: 48
}, },
{ {
clickable: function(data) { clickable: function(data) {
@ -68,7 +71,7 @@ pandora.ui.folderBrowserList = function(id) {
operator: '+', operator: '+',
title: $('<img>') title: $('<img>')
.attr({ .attr({
src: Ox.UI.getImageURL('symbolFind') src: Ox.UI.getImageURL('symbolEdit')
}) })
.css({ .css({
width: '10px', width: '10px',
@ -89,7 +92,7 @@ pandora.ui.folderBrowserList = function(id) {
return $('<img>') return $('<img>')
.attr({ .attr({
src: Ox.UI.getImageURL( src: Ox.UI.getImageURL(
'symbol' + (id == 'favorite' ? 'Check' : 'Star') 'symbol' + (id == 'favorite' ? 'Like' : 'Star')
) )
}) })
.css({ .css({
@ -106,7 +109,7 @@ pandora.ui.folderBrowserList = function(id) {
title: $('<img>') title: $('<img>')
.attr({ .attr({
src: Ox.UI.getImageURL( src: Ox.UI.getImageURL(
'symbol' + (id == 'favorite' ? 'Check' : 'Star') 'symbol' + (id == 'favorite' ? 'Like' : 'Star')
) )
}) })
.css({ .css({

View file

@ -12,125 +12,130 @@ pandora.ui.folders = function() {
pandora.$ui.folder = []; pandora.$ui.folder = [];
pandora.$ui.folderBrowser = {}; pandora.$ui.folderBrowser = {};
pandora.$ui.folderList = {}; pandora.$ui.folderList = {};
if (pandora.user.ui.section == 'site') { if (pandora.user.ui.section == 'items') {
pandora.site.sectionFolders.site.forEach(function(folder, i) {
var height = (Ox.getObjectById(pandora.site.sectionFolders.site, folder.id).items.length * 16);
pandora.$ui.folder[i] = Ox.CollapsePanel({
id: folder.id,
collapsed: !pandora.user.ui.showFolder.site[folder.id],
size: 16,
title: folder.title
})
.bindEvent({
toggle: function(event, data) {
}
});
//alert(JSON.stringify(Ox.getObjectById(pandora.site.sectionFolders.site, folder.id)))
pandora.$ui.folder[i].$content.css({
height: height + 'px'
})
//.appendTo(that);
pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id)
.css({
height: height + 'px'
})
.appendTo(pandora.$ui.folder[i].$content);
pandora.$ui.folder.forEach(function($folder) {
that.append($folder);
});
});
//pandora.resizeFolders();
} else if (pandora.user.ui.section == 'items') {
pandora.site.sectionFolders.items.forEach(function(folder, i) { pandora.site.sectionFolders.items.forEach(function(folder, i) {
var extras = []; var extras;
if (folder.id == 'personal' && pandora.user.level != 'guest') { if (folder.id == 'personal') {
extras = [Ox.Select({ if (pandora.user.level == 'guest') {
items: [ extras = [infoButton('Personal Lists', 'To create and publish your own lists of movies, please sign up or sign in.')];
{ id: 'new', title: 'New List...' }, } else {
{ id: 'newfromselection', title: 'New List from Current Selection...', disabled: true }, extras = [Ox.Select({
{ id: 'newsmart', title: 'New Smart List...' }, items: [
{ id: 'newfromresults', title: 'New Smart List from Current Results...', disabled: true }, { id: 'new', title: 'New List...' },
{}, { id: 'newfromselection', title: 'New List from Current Selection...', disabled: true },
{ id: 'addselection', title: 'Add Selection to List...' } { id: 'newsmart', title: 'New Smart List...' },
], { id: 'newfromresults', title: 'New Smart List from Current Results...', disabled: true },
max: 0, {},
min: 0, { id: 'addselection', title: 'Add Selection to List...' }
selectable: false, ],
type: 'image' max: 0,
}) min: 0,
.bindEvent({ selectable: false,
click: function(event, data) { type: 'image'
var $list = pandora.$ui.folderList[folder.id], })
id; .bindEvent({
if (data.id == 'new' || data.id == 'newsmart') { click: function(event, data) {
pandora.api.addList({ var $list = pandora.$ui.folderList[folder.id],
name: 'Untitled', id;
status: 'private', if (data.id == 'new' || data.id == 'newsmart') {
type: data.id == 'new' ? 'static' : 'smart' pandora.api.addList({
}, function(result) { name: 'Untitled',
id = result.data.id; status: 'private',
pandora.UI.set(['lists', id].join('|'), pandora.site.user.ui.lists['']); // fixme: necessary? type: data.id == 'new' ? 'static' : 'smart'
pandora.URL.set('?find=list:' + id) }, function(result) {
Ox.Request.clearCache(); // fixme: remove id = result.data.id;
$list.reloadList().bindEventOnce({ pandora.UI.set(['lists', id].join('|'), pandora.site.user.ui.lists['']); // fixme: necessary?
load: function(event, data) { pandora.URL.set('?find=list:' + id)
$list.gainFocus() Ox.Request.clearCache(); // fixme: remove
.options({selected: [id]}) $list.reloadList().bindEventOnce({
.editCell(id, 'name'); load: function(event, data) {
} $list.gainFocus()
.options({selected: [id]})
.editCell(id, 'name');
}
});
}); });
}); }
} }
} })];
})]; }
} else if (folder.id == 'favorite' && pandora.user.level != 'guest') { } else if (folder.id == 'favorite') {
extras = [Ox.Button({ if (pandora.user.level == 'guest') {
selectable: true, extras = [infoButton('Favorite Lists', 'To browse and subscribe to shared lists from other users, please sign up or sign in.')];
style: 'symbol', } else {
title: 'Edit', extras = [Ox.Button({
tooltip: 'Manage Favorite Lists', selectable: true,
type: 'image' style: 'symbol',
}) title: 'Edit',
.bindEvent({ tooltip: 'Manage Favorite Lists',
change: function(event, data) { type: 'image'
Ox.Request.clearCache(); // fixme: remove })
pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser; .bindEvent({
if (pandora.site.sectionFolders.items[i].showBrowser) { change: function(event, data) {
pandora.$ui.folderList.favorite.replaceWith( Ox.Request.clearCache(); // fixme: remove
pandora.$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) {
} else { pandora.$ui.folderList.favorite.replaceWith(
pandora.$ui.folderBrowser.favorite.replaceWith( pandora.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite')
pandora.$ui.folderList.favorite = pandora.ui.folderList('favorite') );
); } else {
pandora.$ui.folderBrowser.favorite.replaceWith(
pandora.$ui.folderList.favorite = pandora.ui.folderList('favorite')
);
}
pandora.resizeFolders();
} }
pandora.resizeFolders(); })];
} }
})]; } else if (folder.id == 'featured') {
} else if (folder.id == 'featured' && pandora.user.level == 'admin') { if (pandora.user.level != 'admin') {
extras = [Ox.Button({ extras = [infoButton('Featured Lists', 'Featured lists are selected public lists, picked by the ' + pandora.site.site.name + ' staff.')];
selectable: true, } else {
style: 'symbol', extras = [Ox.Button({
title: 'Edit', selectable: true,
tooltip: 'Manage Featured Lists', style: 'symbol',
type: 'image' title: 'Edit',
}) tooltip: 'Manage Featured Lists',
.bindEvent({ type: 'image'
change: function(event, data) { })
Ox.Request.clearCache(); // fixme: remove .bindEvent({
pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser; change: function(event, data) {
if (pandora.site.sectionFolders.items[i].showBrowser) { Ox.Request.clearCache(); // fixme: remove
pandora.$ui.folderList.featured.replaceWith( pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser;
pandora.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured')); if (pandora.site.sectionFolders.items[i].showBrowser) {
} else { pandora.$ui.folderList.featured.replaceWith(
pandora.$ui.folderBrowser.featured.replaceWith( pandora.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured'));
pandora.$ui.folderList.featured = pandora.ui.folderList('featured') } else {
); pandora.$ui.folderBrowser.featured.replaceWith(
pandora.$ui.folderList.featured = pandora.ui.folderList('featured')
);
}
pandora.resizeFolders();
} }
pandora.resizeFolders(); })];
} }
})]; } else if (folder.id == 'volumes') {
if (pandora.user.level == 'guest') {
extras = [infoButton('Local Volumes', 'To import movies from a local disk, please sign up or sign in.')];
} else {
extras = [Ox.Select({
items: [
{ id: 'add', title: 'Add Volume...' },
{ id: 'scan', title: 'Scan Selected Volume...' },
{ id: 'remove', title: 'Remove Selected Volume...' },
{},
{ id: 'import', title: 'Import Movies...' }
],
max: 0,
min: 0,
selectable: false,
type: 'image'
})
.bindEvent({
click: function(data) {
}
})];
}
} }
pandora.$ui.folder[i] = Ox.CollapsePanel({ pandora.$ui.folder[i] = Ox.CollapsePanel({
id: folder.id, id: folder.id,
@ -180,7 +185,7 @@ pandora.ui.folders = function() {
.bindEventOnce({ .bindEventOnce({
init: function(event, data) { init: function(event, data) {
Ox.print('init', i, counter) Ox.print('init', i, counter)
if (++counter == 3) { if (++counter == 4) {
pandora.$ui.folder.forEach(function($folder) { pandora.$ui.folder.forEach(function($folder) {
that.append($folder); that.append($folder);
}); });
@ -192,6 +197,53 @@ pandora.ui.folders = function() {
.appendTo(pandora.$ui.folder[i].$content); .appendTo(pandora.$ui.folder[i].$content);
}); });
} }
function infoButton(title, text) {
return Ox.Button({
style: 'symbol',
title: 'info',
type: 'image'
}).bindEvent({
click: function() {
var $dialog = Ox.Dialog({
buttons: Ox.merge([
Ox.Button({title: 'Close'}).bindEvent({
click: function() {
$dialog.close();
}
})
], title != 'Featured Lists' ? [
Ox.Button({title: 'Sign Up'}).bindEvent({
click: function() {
$dialog.close();
pandora.$ui.accountDialog = pandora.ui.accountDialog('signup').open();
}
}),
Ox.Button({title: 'Sign In'}).bindEvent({
click: function() {
$dialog.close();
pandora.$ui.accountDialog = pandora.ui.accountDialog('signin').open();
}
})
] : []),
content: Ox.Element()
.append(
$('<img>')
.attr({src: '/static/png/icon64.png'})
.css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'})
)
.append(
$('<div>')
.css({position: 'absolute', left: '96px', top: '16px', width: '192px'})
.html(text)
),
fixedSize: true,
height: 128,
width: 304,
title: title
}).open();
}
});
}
that.toggle = function() { that.toggle = function() {
}; };

View file

@ -2,59 +2,116 @@
pandora.ui.folderList = function(id) { pandora.ui.folderList = function(id) {
var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id), var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
that; that;
if (pandora.user.ui.section == 'site') { if (pandora.user.ui.section == 'items') {
that = Ox.TextList({ var columns, items;
columns: [ if (id == 'volumes') {
columns = [
{ {
format: function() { format: function() {
return $('<img>') return $('<img>').attr({
.attr({ src: Ox.UI.getImageURL('symbolVolume')
src: Ox.UI.PATH + 'png/icon16.png' }).css({
}) width: '10px',
height: '10px',
padding: '3px 1px 1px 3px'
});
}, },
id: 'id', id: 'user',
operator: '+', operator: '+',
unique: true,
visible: true, visible: true,
width: 16 width: 16
}, },
{ {
id: 'title', editable: true,
id: 'name',
operator: '+', operator: '+',
tooltip: 'Edit Title',
unique: true,
visible: true, visible: true,
width: pandora.user.ui.sidebarSize - 16 width: pandora.user.ui.sidebarWidth - 96
},
{
align: 'right',
id: 'items',
format: {type: 'number'},
operator: '-',
visible: true,
width: 48
},
{
clickable: function(data) {
return data.mounted;
},
format: function(value, data) {
return $('<img>')
.attr({
src: Ox.UI.getImageURL(data.mounted ? 'symbolScan' : 'symbolEdit')
})
.css({
width: '10px',
height: '10px',
padding: '3px 2px 1px 2px'
});
},
id: 'path',
operator: '+',
tooltip: function(data) {
return data.mounted ? 'Scan Volume' : 'Edit Path';
},
visible: true,
width: 16
},
{
clickable: true,
format: function(value, data) {
return $('<img>')
.attr({
src: Ox.UI.getImageURL('symbolMount')
})
.css({
width: '10px',
height: '10px',
padding: '3px 2px 1px 2px',
opacity: data.mounted ? 1 : 0.25
});
},
id: 'mounted',
operator: '+',
tooltip: function(data) {
return data.mounted ? 'Unmount Volume' : 'Mount Volume';
},
visible: true,
width: 16
} }
], ];
items: function(data, callback) { items = function(data, callback) {
var result = {data: {}}; var volumes = pandora.user.volumes || [
if (!data.range) { {"name": "Movies A-M", "path": "/Volumes/Movies A-M", "items": 1234},
result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items.length; {"name": "Movies N-Z", "path": "/Volumes/Movies N-Z", "items": 987}
];
if (!data.keys) {
data = {items: volumes.length};
} else { } else {
result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items; data = {items: volumes.map(function(volume) {
return Ox.extend({id: volume.name, user: pandora.user.username, mounted: false}, volume);
})};
} }
callback(result); // fixme: ridiculous (we're binding to init too late)
}, setTimeout(function() {
max: 1, callback({data: data});
min: 1, }, 1000);
sort: [{key: '', operator: ''}] };
}) } else {
.bindEvent({ columns = [
select: function(event, data) {
// fixme: duplicated
$.each(pandora.$ui.folderList, function(id_, $list) {
id != id_ && $list.options('selected', []);
})
pandora.URL.set((id == 'admin' ? 'admin/' : '' ) + data.ids[0]);
},
});
} else if (pandora.user.ui.section == 'items') {
that = Ox.TextList({
columns: [
{ {
format: function() { format: function() {
return $('<img>').attr({ return $('<img>').attr({
src: Ox.UI.PATH + 'png/icon16.png' src: Ox.UI.getImageURL('symbolIcon')
}); }).css({
width: '10px',
height: '10px',
padding: '3px 1px 1px 3px'
});
}, },
id: 'user', id: 'user',
operator: '+', operator: '+',
@ -69,7 +126,9 @@ pandora.ui.folderList = function(id) {
operator: '+', operator: '+',
unique: true, unique: true,
visible: id == 'favorite', visible: id == 'favorite',
width: pandora.user.ui.sidebarWidth - 88 // fixme: user and name are set to the same width here,
// but resizeFolders will set them to different widths
width: pandora.user.ui.sidebarWidth - 96
}, },
{ {
editable: function(data) { editable: function(data) {
@ -82,14 +141,15 @@ pandora.ui.folderList = function(id) {
operator: '+', operator: '+',
tooltip: id == 'personal' ? 'Edit Title' : null, tooltip: id == 'personal' ? 'Edit Title' : null,
visible: id != 'favorite', visible: id != 'favorite',
width: pandora.user.ui.sidebarWidth - 88 width: pandora.user.ui.sidebarWidth - 96
}, },
{ {
align: 'right', align: 'right',
id: 'items', id: 'items',
format: {type: 'number'},
operator: '-', operator: '-',
visible: true, visible: true,
width: 40 width: 48
}, },
{ {
clickable: function(data) { clickable: function(data) {
@ -120,11 +180,11 @@ pandora.ui.folderList = function(id) {
{ {
clickable: id == 'personal', clickable: id == 'personal',
format: function(value) { format: function(value) {
//var symbols = {private: 'Publish', public: 'Publish', featured: 'Star'}; var symbols = {personal: 'Publish', favorite: 'Like', featured: 'Star'};
return $('<img>') return $('<img>')
.attr({ .attr({
src: Ox.UI.getImageURL( src: Ox.UI.getImageURL(
'symbol' + (value == 'featured' ? 'Star' : 'Publish') 'symbol' + symbols[id]
) )
}) })
.css({ .css({
@ -142,8 +202,8 @@ pandora.ui.folderList = function(id) {
visible: true, visible: true,
width: 16 width: 16
} }
], ];
items: function(data, callback) { items = function(data, callback) {
var query; var query;
if (id == 'personal') { if (id == 'personal') {
query = {conditions: [ query = {conditions: [
@ -161,25 +221,22 @@ pandora.ui.folderList = function(id) {
return pandora.api.findLists(Ox.extend(data, { return pandora.api.findLists(Ox.extend(data, {
query: query query: query
}), callback); }), callback);
}, };
}
that = Ox.TextList({
columns: columns,
items: items,
max: 1, max: 1,
min: 0, min: 0,
pageLength: 1000, pageLength: 1000,
sort: [ sort: [{key: 'position', operator: '+'}],
{key: 'position', operator: '+'} sortable: id != 'featured' || pandora.user.level == 'admin'
],
sortable: id == 'personal' || id == 'favorite' || pandora.user.level == 'admin'
}) })
.css({ .css({
left: 0, left: 0,
top: 0, top: 0,
width: pandora.user.ui.sidebarWidth + 'px', width: pandora.user.ui.sidebarWidth + 'px',
}) })
.bind({
dragenter: function(e) {
//Ox.print('DRAGENTER', e)
}
})
.bindEvent({ .bindEvent({
click: function(event, data) { click: function(event, data) {
var $list = pandora.$ui.folderList[id]; var $list = pandora.$ui.folderList[id];
@ -192,6 +249,10 @@ pandora.ui.folderList = function(id) {
}, function(result) { }, function(result) {
$list.value(result.data.id, 'status', result.data.status); $list.value(result.data.id, 'status', result.data.status);
}); });
} else if (data.key == 'path') {
} else if (data.key == 'mounted') {
alert(JSON.stringify(data));
} }
}, },
'delete': function(event, data) { 'delete': function(event, data) {
@ -203,7 +264,6 @@ pandora.ui.folderList = function(id) {
id: data.ids[0] id: data.ids[0]
}, function(result) { }, function(result) {
pandora.UI.set(['lists', data.ids[0]].join('|'), null); pandora.UI.set(['lists', data.ids[0]].join('|'), null);
Ox.print('SHOULD BE DELETED:', pandora.user.ui.lists)
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList(); $list.reloadList();
}); });
@ -259,7 +319,7 @@ pandora.ui.folderList = function(id) {
$.each(pandora.$ui.folderList, function(id_, $list) { $.each(pandora.$ui.folderList, function(id_, $list) {
id != id_ && $list.options('selected', []); id != id_ && $list.options('selected', []);
}) })
pandora.URL.set('?find=list:' + data.ids[0]); pandora.URL.set('?find=' + (id == 'volumes' ? 'volume' : 'list') + ':' + data.ids[0]);
} else { } else {
pandora.URL.set('?find='); pandora.URL.set('?find=');
} }

View file

@ -459,6 +459,7 @@ pandora.ui.list = function() { // fixme: remove view argument
var $tooltip = Ox.Tooltip({ var $tooltip = Ox.Tooltip({
animate: false animate: false
}).css({ }).css({
fontSize: '11px',
textAlign: 'center' textAlign: 'center'
}); });
@ -500,7 +501,7 @@ pandora.ui.list = function() { // fixme: remove view argument
dragover: function(e) { dragover: function(e) {
$tooltip.options({ $tooltip.options({
title: getTitle(e, ids.length == 1 ? item : items, data.id.split('/').pop()) title: getTitle(e, ids.length == 1 ? item : items, data.id.split('/').pop())
+ (editable && e.shiftKey && result.data.items + (editable && e.metaKey && result.data.items
? '<br/>and remove ' + result.data.items + ' ' ? '<br/>and remove ' + result.data.items + ' '
+ pandora.site.itemName[result.data.items == 1 ? 'singular' : 'plural'].toLowerCase() + pandora.site.itemName[result.data.items == 1 ? 'singular' : 'plural'].toLowerCase()
+ '<br/>from the list "' + pandora.user.ui.list.split('/').pop() + '"' + '<br/>from the list "' + pandora.user.ui.list.split('/').pop() + '"'
@ -516,7 +517,7 @@ pandora.ui.list = function() { // fixme: remove view argument
drop: function(e) { drop: function(e) {
Ox.print('DROP', data); Ox.print('DROP', data);
var $this = $(this), folder, listData; var $this = $(this), folder, listData;
if (editable && e.shiftKey) { if (editable && e.metaKey) {
pandora.api.removeListItems({ pandora.api.removeListItems({
list: pandora.user.ui.list, list: pandora.user.ui.list,
items: ids items: ids
@ -563,7 +564,7 @@ pandora.ui.list = function() { // fixme: remove view argument
} }
}); });
function getTitle(e, item, list) { function getTitle(e, item, list) {
return (editable && e.shiftKey ? 'Move' : 'Copy') + ' ' return (editable && e.metaKey ? 'Move' : 'Copy') + ' '
+ (Ox.isString(item) ? '"' + item + '"' : item + ' ' + pandora.site.itemName[item == 1 ? 'singular' : 'plural'].toLowerCase()) + (Ox.isString(item) ? '"' + item + '"' : item + ' ' + pandora.site.itemName[item == 1 ? 'singular' : 'plural'].toLowerCase())
+ (list ? '<br/>to the list "' + list + '"' : ''); + (list ? '<br/>to the list "' + list + '"' : '');
} }

View file

@ -2,10 +2,9 @@
pandora.ui.sectionButtons = function() { pandora.ui.sectionButtons = function() {
var that = Ox.ButtonGroup({ var that = Ox.ButtonGroup({
buttons: [ buttons: [
{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: 'items', selected: pandora.user.ui.section == 'items', title: pandora.site.itemName.plural},
{id: 'texts', selected: pandora.user.ui.section == 'texts', title: 'Texts'}, {id: 'edits', selected: pandora.user.ui.section == 'edits', title: 'Edits'},
{id: 'admin', selected: pandora.user.ui.section == 'admin', title: 'Admin'} {id: 'texts', selected: pandora.user.ui.section == 'texts', title: 'Texts'}
], ],
id: 'sectionButtons', id: 'sectionButtons',
selectable: true selectable: true
@ -16,14 +15,12 @@ pandora.ui.sectionButtons = function() {
.bindEvent({ .bindEvent({
change: function(event, data) { change: function(event, data) {
var section = data.selected[0]; var section = data.selected[0];
if (section == 'site') { if (section == 'items') {
pandora.URL.set(pandora.user.ui.sitePage);
} else if (section == 'items') {
pandora.URL.set(pandora.Query.toString()); pandora.URL.set(pandora.Query.toString());
} else if (section == 'clips') {
pandora.URL.set('clips');
} else if (section == 'texts') { } else if (section == 'texts') {
pandora.URL.set('texts'); pandora.URL.set('texts');
} else if (section == 'admin') {
pandora.URL.set('admin');
} }
} }
}); });

View file

@ -4,10 +4,9 @@ pandora.ui.sectionSelect = function() {
var that = Ox.Select({ var that = Ox.Select({
id: 'sectionSelect', id: 'sectionSelect',
items: [ items: [
{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 == 'items', id: 'items', title: pandora.site.itemName.plural},
{checked: pandora.user.ui.section == 'texts', id: 'texts', title: 'Texts'}, {checked: pandora.user.ui.section == 'edits', id: 'edits', title: 'Edits'},
{checked: pandora.user.ui.section == 'admin', id: 'admin', title: 'Admin'} {checked: pandora.user.ui.section == 'texts', id: 'texts', title: 'Texts'}
] ]
}).css({ }).css({
float: 'left', float: 'left',