diff --git a/static/js/pandora/ui/eventsDialog.js b/static/js/pandora/ui/eventsDialog.js index a32be08f..a68671ff 100644 --- a/static/js/pandora/ui/eventsDialog.js +++ b/static/js/pandora/ui/eventsDialog.js @@ -1,4 +1,5 @@ // vim: et:ts=4:sw=4:sts=4:ft=javascript + pandora.ui.eventsDialog = function() { var height = Math.round((window.innerHeight - 48) * 0.9), width = Math.round(window.innerWidth * 0.9), @@ -14,44 +15,7 @@ pandora.ui.eventsDialog = function() { }) ], closeButton: true, - content: pandora.$ui.eventsElement = Ox.TextList({ - columns: [ - { - id: 'id', - title: 'ID', - operator: '+', - unique: true, - visible: false, - width: 16 - }, - { - id: 'name', - title: 'Name', - operator: '+', - visible: true, - width: 256 - }, - { - id: 'start', - operator: '+', - visible: true, - width: 256 - }, - { - id: 'end', - operator: '+', - visible: true, - width: 256 - } - ], - items: function(data, callback) { - pandora.api.findEvents(data, callback); - }, - keys: ['name', 'start', 'end'], - sort: [ - {key: 'name', operator: '+'} - ] - }), + content: Ox.Element(), height: height, maximizeButton: true, minHeight: 256, @@ -60,6 +24,26 @@ pandora.ui.eventsDialog = function() { title: 'Manage Events', width: width }); + + pandora.api.findEvents({ + query: {conditions: [], operator: '&'} + }, function(result) { + pandora.api.findEvents({ + query: {conditions: [], operator: '&'}, + keys: [], + range: [0, result.data.items], + sort: [{key: 'name', operator: '+'}] + }, function(result) { + that.options({ + content: Ox.ListCalendar({ + height: height - 48, + events: result.data.items, + width: width + }) + }); + }) + }) + return that; }; diff --git a/static/js/pandora/ui/placesDialog.js b/static/js/pandora/ui/placesDialog.js index 2743437b..a9e7668f 100644 --- a/static/js/pandora/ui/placesDialog.js +++ b/static/js/pandora/ui/placesDialog.js @@ -1,4 +1,5 @@ // vim: et:ts=4:sw=4:sts=4:ft=javascript + pandora.ui.placesDialog = function() { var height = Math.round((window.innerHeight - 48) * 0.9), width = Math.round(window.innerWidth * 0.9), @@ -14,7 +15,7 @@ pandora.ui.placesDialog = function() { }) ], closeButton: true, - content: pandora.$ui.placesElement = Ox.ListMap({ + content: Ox.ListMap({ height: height - 48, places: function(data, callback) { return pandora.api.findPlaces(Ox.extend({ diff --git a/static/js/pandora/ui/usersDialog.js b/static/js/pandora/ui/usersDialog.js index fc1a91f5..3074c879 100644 --- a/static/js/pandora/ui/usersDialog.js +++ b/static/js/pandora/ui/usersDialog.js @@ -4,10 +4,11 @@ pandora.ui.usersDialog = function() { var height = Math.round((window.innerHeight - 48) * 0.9), width = Math.round(window.innerWidth * 0.9), levelColors = { - 'member': [128, 128, 0], - 'friend': [0, 128, 0], - 'staff': [0, 128, 128], - 'admin': [0, 0, 128] + 'guest': [64, 0, 0], + 'member': [64, 64, 0], + 'friend': [0, 64, 0], + 'staff': [0, 64, 64], + 'admin': [0, 0, 64] }, numberOfUsers = 0, userLevels = ['member', 'friend', 'staff', 'admin'], @@ -100,8 +101,8 @@ pandora.ui.usersDialog = function() { $list = Ox.TextList({ columns: [ { - clickable: true, format: function(value) { + Ox.print('&&', value) return $('') .attr({ src: Ox.UI.getImageURL('symbolCheck') @@ -153,22 +154,24 @@ pandora.ui.usersDialog = function() { { align: 'center', format: function(value) { + var dark = 'rgb(' + levelColors[value].map(function(color) { + return color.toString() + }).join(', ') + ')', + light = 'rgb(' + levelColors[value].map(function(color) { + return (color + 128).toString() + }).join(', ') + ')'; return $('
') .css({ borderRadius: '4px', padding: '0 3px 1px 3px', - background: 'rgb(' + levelColors[value].map(function(color) { - return color.toString() - }).join(', ') + ')', + background: pandora.user.ui.theme == 'classic' ? light : dark, textAlign: 'center', - color: 'rgb(' + levelColors[value].map(function(color) { - return (color + 128).toString() - }).join(', ') + ')' + color: pandora.user.ui.theme == 'classic' ? dark : light }) .html(Ox.toTitleCase(value)) }, id: 'level', - operator: '+', + operator: '-', title: 'Level', visible: true, width: 60 @@ -215,7 +218,7 @@ pandora.ui.usersDialog = function() { { align: 'right', id: 'ip', - operator: '-', + operator: '+', title: 'IP Address', visible: true, width: 120 @@ -238,7 +241,7 @@ pandora.ui.usersDialog = function() { }, { id: 'useragent', - operator: '-', + operator: '+', title: 'User Agent', visible: true, width: 810 @@ -255,14 +258,12 @@ pandora.ui.usersDialog = function() { ] }) .bindEvent({ - click: function(data) { - // ... - }, init: function(data) { numberOfUsers = data.items; $status.options({ title: Ox.formatNumber(numberOfUsers) + ' user' + (numberOfUsers == 1 ? '' : 's') + + ' (' + Ox.formatNumber(numberOfUsers) + ' registered, 0 guests)' }); }, select: function(data) { @@ -350,12 +351,13 @@ pandora.ui.usersDialog = function() { width: width }); - function renderUserForm(data) { + function renderUserForm(userData) { var $checkbox; return Ox.Form({ items: [ $checkbox = Ox.Checkbox({ - checked: !data.disabled, + checked: !userData.disabled, + id: 'status', label: 'Status', labelWidth: 80, title: 'Enabled', @@ -364,13 +366,14 @@ pandora.ui.usersDialog = function() { .bindEvent({ change: function(data) { // fixme: it would be really nice to have "this" here - $checkbox.options({title: data.checked ? 'Enabled' : 'Disabled'}) + $checkbox.options({title: userData.checked ? 'Enabled' : 'Disabled'}) } }), Ox.Input({ + id: 'username', label: 'Username', labelWidth: 80, - value: data.username, + value: userData.username, width: 240 }) .bindEvent({ @@ -379,9 +382,10 @@ pandora.ui.usersDialog = function() { } }), Ox.Input({ + id: 'email', label: 'E-Mail', labelWidth: 80, - value: data.email, + value: userData.email, width: 240 }) .bindEvent({ @@ -390,9 +394,10 @@ pandora.ui.usersDialog = function() { } }), Ox.Select({ + id: 'level', items: userLevels.map(function(level) { return { - checked: level == data.level, + checked: level == userData.level, id: level, title: Ox.toTitleCase(level) }; @@ -408,16 +413,32 @@ pandora.ui.usersDialog = function() { */ Ox.Input({ height: 120, + id: 'notes', placeholder: 'Notes', type: 'textarea', + value: userData.notes, width: 240 }) .css({height: '240px'}) ], width: 240 }) - .css({margin: '8px'}); - + .css({margin: '8px'}) + .bindEvent({ + change: function(event) { + var data = {id: userData.username}, key, value; + if (event.id == 'status') { + data.disabled = !event.data.checked; + } else if (event.id == 'level') { + data.level = event.data.selected[0].id; + } else { + data[event.id] = event.data.value; + } + pandora.api.editUser(data, function(result) { + // ... + }); + } + }); } function updateList(key, value) {