cablegates/static/js/pandora/ui/menu.js

782 lines
44 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-05-25 19:42:45 +00:00
pandora.ui.mainMenu = function() {
2011-06-06 15:48:11 +00:00
var isGuest = pandora.user.level == 'guest',
2011-06-19 17:49:25 +00:00
that = Ox.MainMenu({
2011-05-25 19:42:45 +00:00
extras: [
$('<div>').html('beta').css({marginRight: '8px', color: 'rgb(128, 128, 128)'}),
2011-06-19 17:49:25 +00:00
pandora.$ui.loadingIcon = Ox.LoadingIcon({
2011-05-25 19:42:45 +00:00
size: 'medium'
})
],
id: 'mainMenu',
menus: [
2011-06-06 15:48:11 +00:00
{ id: pandora.site.site.id + 'Menu', title: pandora.site.site.name, items: [
2011-05-25 19:42:45 +00:00
{ id: 'home', title: 'Home' },
{},
2011-06-06 15:48:11 +00:00
{ id: 'about', title: 'About ' + pandora.site.site.name },
{ id: 'news', title: pandora.site.site.name + ' News' },
2011-05-25 19:42:45 +00:00
{ id: 'tour', title: 'Take a Tour' },
{ id: 'faq', title: 'Frequently Asked Questions' },
{ id: 'terms', title: 'Terms of Service' },
2011-08-16 17:03:14 +00:00
{ id: 'contact', title: 'Contact ' + pandora.site.site.name },
2011-05-25 19:42:45 +00:00
{},
2011-08-16 17:03:14 +00:00
{ id: 'software', title: 'Software' }
2011-05-25 19:42:45 +00:00
] },
{ id: 'userMenu', title: 'User', items: [
2011-06-06 15:48:11 +00:00
{ id: 'username', title: 'User: ' + (isGuest ? 'not logged in' : pandora.user.username), disabled: true },
2011-05-25 19:42:45 +00:00
{},
{ id: 'preferences', title: 'Preferences...', disabled: isGuest, keyboard: 'control ,' },
2011-08-16 17:03:14 +00:00
{ id: 'archives', title: 'Archives...', disabled: isGuest },
2011-05-25 19:42:45 +00:00
{},
{ id: 'register', title: 'Register...', disabled: !isGuest },
{ id: 'loginlogout', title: isGuest ? 'Login...' : 'Logout...' }
] },
{ id: 'listMenu', title: 'List', items: [
{ id: 'history', title: 'History', items: [
2011-06-06 15:48:11 +00:00
{ id: 'allmovies', title: 'All ' + pandora.site.itemName.plural }
2011-05-25 19:42:45 +00:00
] },
{ id: 'lists', title: 'View List', items: [
{ id: 'favorites', title: 'Favorites' }
] },
{ id: 'features', title: 'View Feature', items: [
{ id: 'situationistfilm', title: 'Situationist Film' },
{ id: 'timelines', title: 'Timelines' }
] },
{},
{ id: 'newlist', title: 'New List...', keyboard: 'control n' },
{ id: 'newlistfromselection', title: 'New List from Selection...', disabled: true, keyboard: 'shift control n' },
{ id: 'newsmartlist', title: 'New Smart List...', keyboard: 'alt control n' },
{ id: 'newsmartlistfromresults', title: 'New Smart List from Results...', keyboard: 'shift alt control n' },
{},
2011-06-06 15:48:11 +00:00
{ id: 'addmovietolist', title: ['Add Selected ' + pandora.site.itemName.singular + ' to List...', 'Add Selected ' + pandora.site.itemName.plural + ' to List...'], disabled: true },
2011-05-25 19:42:45 +00:00
{},
{ id: 'setposterframe', title: 'Set Poster Frame', disabled: true }
]},
{ id: 'editMenu', title: 'Edit', items: [
{ id: 'undo', title: 'Undo', disabled: true, keyboard: 'control z' },
{ id: 'redo', title: 'Redo', disabled: true, keyboard: 'shift control z' },
{},
{ id: 'cut', title: 'Cut', disabled: true, keyboard: 'control x' },
{ id: 'copy', title: 'Copy', disabled: true, keyboard: 'control c' },
{ id: 'paste', title: 'Paste', disabled: true, keyboard: 'control v' },
{ id: 'delete', title: 'Delete', disabled: true, keyboard: 'delete' },
{},
{ id: 'selectall', title: 'Select All', disabled: true, keyboard: 'control a' },
{ id: 'selectnone', title: 'Select None', disabled: true, keyboard: 'shift control a' },
{ id: 'invertselection', title: 'Invert Selection', disabled: true, keyboard: 'alt control a' }
] },
{ id: 'viewMenu', title: 'View', items: [
2011-06-06 15:48:11 +00:00
{ id: 'movies', title: 'View ' + pandora.site.itemName.plural, items: [
2011-08-06 18:00:15 +00:00
{ group: 'viewmovies', min: 1, max: 1, items: $.map(pandora.site.listViews, function(view, i) {
return Ox.extend({
checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
2011-05-25 19:42:45 +00:00
}, view);
}) },
]},
{ id: 'icons', title: 'Icons', items: [
2011-08-06 18:00:15 +00:00
{ group: 'viewicons', min: 1, max: 1, items: ['posters', 'frames'].map(function(icons) {
return {id: icons, title: Ox.toTitleCase(icons), checked: pandora.user.ui.icons == icons};
2011-08-21 08:17:10 +00:00
}) },
{},
{ id: 'usesiteposter', title: 'Always Use ' + pandora.site.site.name + ' Poster' }
2011-05-25 19:42:45 +00:00
] },
{},
2011-08-19 06:40:19 +00:00
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [
2011-08-06 18:00:15 +00:00
{ group: 'movieview', min: 1, max: 1, items: $.map(pandora.site.itemViews, function(view, i) {
return Ox.extend({
2011-06-06 15:48:11 +00:00
checked: pandora.user.ui.itemView == view.id,
2011-05-25 19:42:45 +00:00
}, view);
}) },
]},
2011-08-19 06:40:19 +00:00
{ id: 'openvideo', title: 'Open Video Links', items: [
{ group: 'videoview', min: 1, max: 1, items: ['player', 'editor'].map(function(view) {
return {id: view, title: Ox.toTitleCase(view), checked: pandora.user.ui.videoView == view};
}) }
] },
2011-05-25 19:42:45 +00:00
{},
{ id: 'lists', title: 'Hide Lists', keyboard: 'shift l' },
{ id: 'info', title: 'Hide Info', keyboard: 'shift i' },
{ id: 'groups', title: 'Hide Groups', keyboard: 'shift g' },
2011-06-06 15:48:11 +00:00
{ id: 'movies', title: 'Hide ' + pandora.site.itemName.plural, disabled: true, keyboard: 'shift m' }
2011-05-25 19:42:45 +00:00
]},
{ id: 'sortMenu', title: 'Sort', items: [
2011-06-06 15:48:11 +00:00
{ 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 Ox.extend({
checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id
2011-05-25 19:42:45 +00:00
}, key);
}) }
] },
2011-06-06 15:48:11 +00:00
{ id: 'ordermovies', title: 'Order ' + pandora.site.itemName.plural, items: [
2011-05-25 19:42:45 +00:00
{ group: 'ordermovies', min: 1, max: 1, items: [
2011-08-18 07:54:46 +00:00
{ 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 == '-' }
2011-05-25 19:42:45 +00:00
]}
] },
{ id: 'advancedsort', title: 'Advanced Sort...', keyboard: 'shift control s' },
{},
{ id: 'groupsstuff', title: 'Groups Stuff' }
] },
{ id: 'findMenu', title: 'Find', items: [
{ id: 'find', title: 'Find', items: [
2011-08-18 07:54:46 +00:00
{ group: 'find', min: 1, max: 1, items: pandora.site.findKeys.map(function(key, i) {
var index = pandora.user.ui.find.index;
return Ox.extend({
checked: index > -1 && pandora.user.ui.query.conditions[index].key
? pandora.user.ui.query.conditions[index].key == key.id
: key.id == 'all'
2011-08-18 07:54:46 +00:00
}, key);
2011-05-25 19:42:45 +00:00
}) }
] },
{ id: 'advancedfind', title: 'Advanced Find...', keyboard: 'shift control f' }
] },
{ id: 'dataMenu', title: 'Data', items: [
{ id: 'titles', title: 'Manage Titles...' },
{ id: 'names', title: 'Manage Names...' },
{},
{ id: 'places', title: 'Manage Places...' },
{ id: 'events', title: 'Manage Events...' },
{},
{ id: 'users', title: 'Manage Users...' },
{ id: 'lists', title: 'Manage Lists...' },
] },
{ id: 'helpMenu', title: 'Help', items: [
2011-06-06 15:48:11 +00:00
{ id: 'help', title: pandora.site.site.name + ' Help', keyboard: 'shift ?' }
2011-05-25 19:42:45 +00:00
] },
{ id: 'debugMenu', title: 'Debug', items: [
{ id: 'query', title: 'Show pandora.Query' },
2011-08-11 17:28:44 +00:00
{ id: 'resetui', title: 'Reset UI Settings'},
{ id: 'clearcache', title: 'Clear cache'}
2011-05-25 19:42:45 +00:00
] }
]
})
.bindEvent({
change: function(event, data) {
2011-08-07 18:30:14 +00:00
var value = data.checked[0].id;
2011-05-25 19:42:45 +00:00
if (data.id == 'find') {
2011-08-07 18:30:14 +00:00
pandora.$ui.findSelect.selectItem(value);
2011-05-25 19:42:45 +00:00
} else if (data.id == 'movieview') {
var id = document.location.pathname.split('/')[1];
2011-08-07 18:30:14 +00:00
if (value == 'info')
2011-05-25 19:42:45 +00:00
url(id + '/info');
else
url(id);
} else if (data.id == 'ordermovies') {
2011-08-18 07:54:46 +00:00
var key = pandora.user.ui.lists[pandora.user.ui.list].sort[0].key,
operator = value == 'ascending' ? '+' : '-';
pandora.$ui.list.options({
sort: [{key: key, operator: operator}]
});
pandora.UI.set(['lists', pandora.user.ui.list, 'sort'].join('|'), [{key: key, operator: operator}]);
//pandora.user.ui.lists[pandora.user.ui.list].sort[0] = {key: key, operator: operator};
pandora.URL.push(pandora.Query.toString());
2011-05-25 19:42:45 +00:00
} else if (data.id == 'sortmovies') {
2011-08-07 18:30:14 +00:00
var operator = pandora.getSortOperator(value);
2011-08-18 07:54:46 +00:00
pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator == '+' ? 'ascending' : 'descending'));
2011-08-07 18:30:14 +00:00
pandora.$ui.sortSelect.selectItem(value);
2011-08-18 07:54:46 +00:00
pandora.$ui.list.options({
sort: [{key: value, operator: operator}]
});
pandora.UI.set(['lists', pandora.user.ui.list, 'sort'].join('|'), [{key: value, operator: operator}]);
//pandora.user.ui.lists[pandora.user.ui.list].sort[0] = {key: key, operator: operator};
pandora.URL.push(pandora.Query.toString());
2011-08-07 18:30:14 +00:00
} else if (data.id == 'viewicons') {
2011-08-07 20:25:33 +00:00
var $list;
pandora.UI.set({icons: value});
if (pandora.user.ui.item) {
2011-08-07 22:15:08 +00:00
if (pandora.user.ui.itemView == 'info') {
pandora.$ui.item.reload();
}
2011-08-07 20:25:33 +00:00
$list = pandora.$ui.browser;
} else if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'icons') {
2011-08-07 20:25:33 +00:00
$list = pandora.$ui.list
}
$list && $list.options({
borderRadius: value == 'posters' ? 0 : pandora.user.ui.item ? 8 : 16,
2011-08-07 20:25:33 +00:00
defaultRatio: value == 'posters' ? 5/8 : 1
2011-08-07 22:15:08 +00:00
}).reloadList(true);
2011-05-25 19:42:45 +00:00
} else if (data.id == 'viewmovies') {
2011-08-07 18:30:14 +00:00
url('#view=' + value);
2011-05-25 19:42:45 +00:00
}
},
click: function(event, data) {
if (data.id == 'about') {
2011-08-17 14:59:11 +00:00
var tabs = [
{id: 'about', title: 'About', selected: true},
{id: 'news', title: 'News'},
{id: 'tour', title: 'Take a Tour'},
{id: 'faq', title: 'Frequently Asked Questions'},
{id: 'tos', title: 'Terms of Service'},
{id: 'contact', title: 'Contact'},
{id: 'software', title: 'Software'}
];
var $tabPanel = Ox.TabPanel({
content: function(id) {
return Ox.SplitPanel({
elements: [
{
element: Ox.Element()
.css({padding: '16px'})
.append(
$('<img>')
.attr({src: '/static/png/logo256.png'})
.css({width: '128px'})
),
size: 144
},
{
element: Ox.Element()
.css({padding: '16px', overflowY: 'auto'})
.html(Ox.repeat(Ox.getObjectById(tabs, id).title + ' ', 200))
}
],
orientation: 'horizontal'
});
},
tabs: tabs
})
.bindEvent({
change: function(data) {
$dialog.options({
title: Ox.getObjectById(tabs, data.selected).title
});
}
});
2011-06-19 17:49:25 +00:00
var $dialog = Ox.Dialog({
2011-05-25 19:42:45 +00:00
buttons: [
2011-06-19 17:49:25 +00:00
Ox.Button({
2011-05-25 19:42:45 +00:00
id: 'close',
title: 'Close'
}).bindEvent({
click: function() {
$dialog.close();
}
})
],
2011-08-17 14:59:11 +00:00
//closeButton: true,
content: $tabPanel,
height: Math.round((window.innerHeight - 24) * 0.75),
//maximizeButton: true,
minHeight: 256,
minWidth: 640,
title: 'About',
width: Math.round(window.innerWidth * 0.75),
2011-05-25 19:42:45 +00:00
}).open();
} else if (data.id == 'home') {
2011-06-04 06:42:38 +00:00
var $screen = $('<div>')
.attr({id: 'screen'})
.css({
position: 'absolute',
width: '100%',
height: '100%',
background: 'rgb(32, 32, 32)',
opacity: 0,
zIndex: 1000
})
.appendTo(Ox.UI.$body),
2011-06-04 08:20:40 +00:00
$reflectionImage = $('<img>')
.attr({
src: '/static/png/logo256.png'
})
.css({
position: 'absolute',
left: 0,
top: '160px',
right: 0,
bottom: 0,
width: '320px',
margin: 'auto',
opacity: 0,
MozTransform: 'scaleY(-1)',
WebkitTransform: 'scaleY(-1)'
})
.appendTo($screen),
$reflectionGradient = $('<div>')
.css({
position: 'absolute',
left: 0,
top: '160px',
right: 0,
bottom: 0,
width: '320px',
height: '160px',
margin: 'auto',
backgroundImage: '-webkit-linear-gradient(top, rgba(32, 32, 32, 0.8), rgba(32, 32, 32, 1), rgba(32, 32, 32, 1))'
})
.appendTo($screen),
2011-06-04 06:42:38 +00:00
$logo = $('<img>')
.attr({
2011-06-04 08:20:40 +00:00
id: 'logo',
2011-06-04 06:42:38 +00:00
src: '/static/png/logo256.png'
})
.css({
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: '160px',
width: window.innerWidth + 'px',
margin: 'auto'
})
.bind({
click: function() {
2011-06-04 08:20:40 +00:00
$screen.find(':not(#logo)').remove();
2011-06-04 06:42:38 +00:00
$logo.animate({
width: window.innerWidth + 'px'
}, 500)
$screen.animate({opacity: 0}, 500, function() {
$screen.remove();
});
}
})
2011-06-04 08:20:40 +00:00
.appendTo($screen),
2011-06-04 06:42:38 +00:00
$input = Ox.Input({
width: 156
})
.css({
position: 'absolute',
left: 0,
top: '48px',
right: '164px',
bottom: 0,
margin: 'auto',
opacity: 0
})
.click(function(e) {
e.stopPropagation();
})
2011-06-04 07:19:49 +00:00
.appendTo($screen)
.focusInput(),
2011-06-04 06:42:38 +00:00
$findButton = Ox.Button({
title: 'Find',
width: 74
})
.css({
position: 'absolute',
left: '82px',
top: '48px',
right: 0,
bottom: 0,
margin: 'auto',
opacity: 0
})
.appendTo($screen),
$browseButton = Ox.Button({
title: 'Browse',
width: 74
})
.css({
position: 'absolute',
left: '246px',
top: '48px',
right: 0,
bottom: 0,
margin: 'auto',
opacity: 0
})
2011-06-04 07:19:49 +00:00
.appendTo($screen),
2011-06-04 06:42:38 +00:00
$signupButton = Ox.Button({
title: 'Sign Up',
width: 74
})
.css({
position: 'absolute',
left: 0,
top: '112px',
right: '246px',
bottom: 0,
margin: 'auto',
opacity: 0
})
2011-06-04 07:19:49 +00:00
.appendTo($screen),
2011-06-04 06:42:38 +00:00
$signinButton = Ox.Button({
title: 'Sign In',
width: 74
})
.css({
position: 'absolute',
left: 0,
top: '112px',
right: '82px',
bottom: 0,
margin: 'auto',
opacity: 0
})
2011-06-04 07:19:49 +00:00
.appendTo($screen),
2011-06-04 06:42:38 +00:00
$aboutButton = Ox.Button({
2011-06-06 15:55:37 +00:00
title: 'About ' + pandora.site.site.name,
2011-06-04 06:42:38 +00:00
width: 156
})
.css({
position: 'absolute',
left: '164px',
top: '112px',
right: 0,
bottom: 0,
margin: 'auto',
opacity: 0
})
2011-06-04 07:19:49 +00:00
.appendTo($screen),
$text = $('<div>')
.html('A Movie Database. \u2620 2007-2011 0x2620. All Open Source.')
.css({
position: 'absolute',
left: 0,
top: '176px',
right: 0,
bottom: 0,
width: '360px',
height: '16px',
margin: 'auto',
opacity: 0,
textAlign: 'center'
})
.appendTo($screen)
2011-06-04 06:42:38 +00:00
$screen.animate({opacity: 1}, 500, function() {
2011-06-04 08:20:40 +00:00
$screen.find(':not(#logo)').animate({opacity: 1}, 250)
2011-06-04 06:42:38 +00:00
});
$logo.animate({width: '320px'}, 500);
/*
2011-06-19 17:49:25 +00:00
var $dialog = Ox.Dialog({
2011-05-25 19:42:45 +00:00
buttons: [
2011-06-19 17:49:25 +00:00
Ox.Button({
2011-05-25 19:42:45 +00:00
id: 'close',
title: 'Close'
}).bindEvent({
click: function() {
$dialog.close();
}
})
],
height: 498,
id: 'home',
keys: {enter: 'close', escape: 'close'},
2011-06-06 15:48:11 +00:00
title: pandora.site.site.name,
2011-05-25 19:42:45 +00:00
width: 800
}).open();
2011-06-04 06:42:38 +00:00
*/
2011-05-25 19:42:45 +00:00
} else if (data.id == 'register') {
2011-06-06 15:48:11 +00:00
pandora.$ui.accountDialog = pandora.ui.accountDialog('register').open();
2011-05-25 19:42:45 +00:00
} else if (data.id == 'loginlogout') {
2011-06-06 15:48:11 +00:00
pandora.$ui.accountDialog = (pandora.user.level == 'guest' ?
2011-05-25 19:42:45 +00:00
pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open();
2011-08-04 14:49:16 +00:00
} else if (data.id == 'stills') {
var id = pandora.user.ui.item || pandora.user.ui.listItem;
pandora.$ui.postersDialog = pandora.ui.framesDialog(id).open();
2011-06-06 12:23:59 +00:00
} else if (data.id == 'posters') {
2011-08-01 16:55:18 +00:00
var id = pandora.user.ui.item || pandora.user.ui.listItem;
pandora.$ui.postersDialog = pandora.ui.postersDialog(id).open();
2011-05-25 19:42:45 +00:00
} else if (data.id == 'places') {
2011-06-06 15:48:11 +00:00
pandora.$ui.placesDialog = pandora.ui.placesDialog().open();
2011-05-25 19:42:45 +00:00
/*
2011-06-19 17:49:25 +00:00
var $manage = Ox.SplitPanel({
2011-05-25 19:42:45 +00:00
elements: [
{
collapsible: true,
2011-06-19 17:49:25 +00:00
element: Ox.SplitPanel({
2011-05-25 19:42:45 +00:00
elements: [
{
2011-06-19 17:49:25 +00:00
element: Ox.Toolbar({
2011-05-25 19:42:45 +00:00
orientation: 'horizontal',
size: 44
}).append(
2011-06-19 17:49:25 +00:00
pandora.$ui.findPlacesElement = Ox.FormElementGroup({
2011-05-25 19:42:45 +00:00
elements: [
2011-06-19 17:49:25 +00:00
pandora.$ui.findPlacesSelect = Ox.Select({
2011-05-25 19:42:45 +00:00
id: 'findPlacesSelect',
items: [
{ id: 'name', title: 'Find: Name' },
{ id: 'region', title: 'Find: Region' },
{ id: 'user', title: 'Find: User' }
],
overlap: 'right',
type: 'image'
})
.bindEvent({
change: function(event, data) {
2011-06-06 15:48:11 +00:00
pandora.$ui.findPlacesSelect.loseFocus();
pandora.$ui.findPlacesInput.options({
2011-05-25 19:42:45 +00:00
placeholder: data.selected[0].title
});
}
}),
2011-06-19 17:49:25 +00:00
pandora.$ui.findPlacesInput = Ox.Input({
2011-05-25 19:42:45 +00:00
clear: true,
id: 'findPlacesInput',
placeholder: 'Find: Name',
width: 234
})
],
id: 'findPlacesElement'
})
.css({
float: 'left',
margin: '4px'
})
).append(
2011-06-19 17:49:25 +00:00
pandora.$ui.sortPlacesSelect = Ox.Select({
2011-05-25 19:42:45 +00:00
id: 'sortPlacesSelect',
items: [
{ id: 'name', title: 'Sort by Name', checked: true },
{ id: 'region', title: 'Sort by Region' },
{ id: 'size', title: 'Sort by Size' },
{ id: 'latitude', title: 'Sort by Latitude' },
{ id: 'longitude', title: 'Sort by Longitude' },
{ id: 'clips', title: 'Sort by Number of Clips' },
{ id: 'user', title: 'Sort by User' },
{ id: 'datecreated', title: 'Sort by Date Added' },
{ id: 'datemodified', title: 'Sort by Date Modified' }
],
width: 246
})
.css({
float: 'left',
margin: '0 4px 4px 4px'
})
),
size: 44
},
{
2011-06-19 17:49:25 +00:00
element: Ox.Element('div')
2011-05-25 19:42:45 +00:00
},
{
2011-06-19 17:49:25 +00:00
element: Ox.Toolbar({
2011-05-25 19:42:45 +00:00
orientation: 'horizontal',
size: 16
}),
size: 16
}
],
orientation: 'vertical'
}),
size: 256
},
{
2011-06-19 17:49:25 +00:00
element: Ox.SplitPanel({
2011-05-25 19:42:45 +00:00
elements: [
{
2011-06-19 17:49:25 +00:00
element: Ox.Toolbar({
2011-05-25 19:42:45 +00:00
orientation: 'horizontal',
size: 24
}).append(
2011-06-19 17:49:25 +00:00
pandora.$ui.labelsButton = Ox.Button({
2011-05-25 19:42:45 +00:00
id: 'labelsButton',
title: [
{id: 'show', title: 'Show Labels'},
{id: 'hide', title: 'Hide Labels'}
],
width: 96
})
.css({
float: 'left',
margin: '4px'
})
).append(
2011-06-19 17:49:25 +00:00
pandora.$ui.findMapInput = Ox.Input({
2011-05-25 19:42:45 +00:00
clear: true,
id: 'findMapInput',
placeholder: 'Find on Map',
width: 192
})
.css({
float: 'right',
margin: '4px'
})
.bindEvent({
submit: function(event, data) {
2011-06-06 15:48:11 +00:00
pandora.$ui.map.find(data.value, function(location) {
2011-05-25 19:42:45 +00:00
2011-06-06 15:48:11 +00:00
pandora.$ui.placeNameInput.options({
2011-05-25 19:42:45 +00:00
disabled: false,
value: location.name
});
2011-06-06 15:48:11 +00:00
pandora.$ui.placeAliasesInput.options({
2011-05-25 19:42:45 +00:00
disabled: false
});
2011-06-06 15:48:11 +00:00
pandora.$ui.placeGeonameLabel.options({
2011-05-25 19:42:45 +00:00
disabled: false,
title: location.names.join(', ')
});
2011-06-06 15:48:11 +00:00
pandora.$ui.removePlaceButton.options({
2011-05-25 19:42:45 +00:00
disabled: false
});
2011-06-06 15:48:11 +00:00
pandora.$ui.addPlaceButton.options({
2011-05-25 19:42:45 +00:00
disabled: false
});
});
}
})
),
size: 24
},
{
2011-06-19 17:49:25 +00:00
element: pandora.$ui.map = Ox.Map({
2011-05-25 19:42:45 +00:00
places: ['Boston', 'Brussels', 'Barcelona', 'Berlin', 'Beirut', 'Bombay', 'Bangalore', 'Beijing']
})
.css({
left: 0,
top: 0,
right: 0,
bottom: 0
})
.bindEvent({
select: function(event, location) {
2011-06-06 15:48:11 +00:00
pandora.$ui.placeNameInput.options({
2011-05-25 19:42:45 +00:00
disabled: false,
value: location.name
});
2011-06-06 15:48:11 +00:00
pandora.$ui.placeAliasesInput.options({
2011-05-25 19:42:45 +00:00
disabled: false
});
2011-06-06 15:48:11 +00:00
pandora.$ui.placeGeonameLabel.options({
2011-05-25 19:42:45 +00:00
disabled: false,
title: location.names.join(', ')
});
2011-06-06 15:48:11 +00:00
pandora.$ui.removePlaceButton.options({
2011-05-25 19:42:45 +00:00
disabled: false
});
2011-06-06 15:48:11 +00:00
pandora.$ui.addPlaceButton.options({
2011-05-25 19:42:45 +00:00
disabled: false
});
}
})
},
{
2011-06-19 17:49:25 +00:00
element: pandora.$ui.bottomBar = Ox.Toolbar({
2011-05-25 19:42:45 +00:00
orientation: 'horizontal',
size: 24
})
.append(
2011-06-19 17:49:25 +00:00
pandora.$ui.placeNameInput = Ox.Input({
2011-05-25 19:42:45 +00:00
disabled: true,
id: 'placeName',
placeholder: 'Name',
width: 128
})
.css({
float: 'left',
margin: '4px 0 0 4px'
})
)
.append(
2011-06-19 17:49:25 +00:00
pandora.$ui.placeAliasesInput = Ox.Input({
2011-05-25 19:42:45 +00:00
disabled: true,
id: 'aliases',
placeholder: 'Aliases',
width: 128
})
.css({
float: 'left',
margin: '4px 0 0 4px'
})
)
.append(
2011-06-19 17:49:25 +00:00
pandora.$ui.placeGeonameLabel = Ox.Label({
2011-05-25 19:42:45 +00:00
disabled: true,
id: 'placeGeoname',
title: 'Geoname',
2011-06-06 15:48:11 +00:00
width: parseInt(pandora.$ui.document.width() * 0.8) - 256 - 256 - 32 - 24
2011-05-25 19:42:45 +00:00
})
.css({
float: 'left',
margin: '4px 0 0 4px'
})
)
.append(
2011-06-19 17:49:25 +00:00
pandora.$ui.addPlaceButton = Ox.Button({
2011-05-25 19:42:45 +00:00
disabled: true,
id: 'addPlaceButton',
title: 'add',
type: 'image'
})
.css({
float: 'right',
margin: '4px 4px 0 0'
})
)
.append(
2011-06-19 17:49:25 +00:00
pandora.$ui.removePlaceButton = Ox.Button({
2011-05-25 19:42:45 +00:00
disabled: true,
id: 'removePlaceButton',
title: 'remove',
type: 'image'
})
.css({
float: 'right',
margin: '4px 4px 0 0'
})
),
size: 24
}
],
orientation: 'vertical'
})
}
],
orientation: 'horizontal'
}).css({
top: '24px',
bottom: '24px',
}),
2011-06-19 17:49:25 +00:00
$dialog = Ox.Dialog({
2011-05-25 19:42:45 +00:00
buttons: [
{
click: function() {
$dialog.close();
},
id: 'close',
title: 'Close',
value: 'Close'
}
],
2011-06-06 15:48:11 +00:00
height: parseInt(pandora.$ui.document.height() * 0.8),
2011-05-25 19:42:45 +00:00
id: 'places',
minHeight: 400,
minWidth: 600,
padding: 0,
title: 'Manage Places',
2011-06-06 15:48:11 +00:00
width: parseInt(pandora.$ui.document.width() * 0.8)
2011-05-25 19:42:45 +00:00
}).css({
overflow: 'hidden'
}).append($manage).open();
*/
} else if (data.id == 'query') {
2011-06-19 17:49:25 +00:00
var $dialog = Ox.Dialog({
2011-05-25 19:42:45 +00:00
buttons: [
2011-06-19 17:49:25 +00:00
Ox.Button({
2011-05-25 19:42:45 +00:00
id: 'close',
title: 'Close'
}).bindEvent({
click: function() {
$dialog.close();
}
})
],
2011-06-19 17:49:25 +00:00
content: Ox.Element()
2011-08-17 11:39:55 +00:00
.css({padding: '16px'})
2011-05-25 19:42:45 +00:00
.html([
'Query: ' + JSON.stringify(pandora.Query.toObject()),
2011-06-06 15:48:11 +00:00
'findQuery: ' + JSON.stringify(pandora.user.ui.findQuery),
'listQuery: ' + JSON.stringify(pandora.user.ui.listQuery)
2011-05-25 19:42:45 +00:00
].join('<br/><br/>')),
2011-08-17 11:39:55 +00:00
height: 192,
2011-05-25 19:42:45 +00:00
keys: {enter: 'close', escape: 'close'},
2011-08-17 11:39:55 +00:00
title: 'Query',
width: 384
2011-05-25 19:42:45 +00:00
}).open();
} else if (data.id == 'resetui') {
pandora.api.resetUI({}, function() {
2011-06-06 15:48:11 +00:00
pandora.$ui.appPanel.reload();
2011-05-25 19:42:45 +00:00
});
2011-08-11 17:28:44 +00:00
} else if (data.id == 'clearcache') {
Ox.Request.clearCache();
2011-05-25 19:42:45 +00:00
}
}
});
return that;
};