improve namesDialog and titlesDialog

This commit is contained in:
rolux 2011-10-11 16:01:33 +00:00
parent d13f2f094c
commit 30651bac46
4 changed files with 88 additions and 257 deletions

View file

@ -150,11 +150,11 @@ pandora.ui.mainMenu = function() {
{ id: 'places', title: 'Manage Places...', disabled: isGuest },
{ id: 'events', title: 'Manage Events...', disabled: isGuest },
{},
{ id: 'users', title: 'Manage Users...', disabled: !isAdmin },
{ id: 'users', title: 'Manage Users...', disabled: !isAdmin }/*,
{ id: 'lists', title: 'Manage Lists...', disabled: !isAdmin },
{},
{ id: 'news', title: 'Manage News...', disabled: !isAdmin },
{ id: 'tour', title: 'Manage Tour...', disabled: !isAdmin }
{ id: 'tour', title: 'Manage Tour...', disabled: !isAdmin }*/
] },
{ id: 'helpMenu', title: 'Help', items: [
{ id: 'help', title: pandora.site.site.name + ' Help', keyboard: 'shift ?' }

View file

@ -2,7 +2,7 @@
pandora.ui.namesDialog = function() {
var height = Math.round((window.innerHeight - 48) * 0.9),
width = Math.round(window.innerWidth * 0.9),
width = 576 + Ox.UI.SCROLLBAR_SIZE,
numberOfNames = 0,
$status = Ox.Label({
@ -57,6 +57,7 @@ pandora.ui.namesDialog = function() {
title: 'ID',
unique: true,
visible: false,
width: 0
},
{
id: 'name',
@ -64,33 +65,32 @@ pandora.ui.namesDialog = function() {
removable: false,
title: 'Name',
visible: true,
width: 250
width: 256
},
{
id: 'nameSort',
editable: true,
id: 'sortname',
operator: '+',
title: 'Sort Name',
tooltip: 'Edit Sort Name',
visible: true,
width: 250
width: 256
},
{
id: 'numberofnames',
align: 'right',
operator: '-',
title: 'Number of Names',
title: 'Names',
visible: true,
width: 60
width: 64
},
],
columnsRemovable: true,
columnsVisible: true,
items: pandora.api.findNames,
keys: [],
max: 1,
scrollbarVisible: true,
sort: [
{key: 'name', operator: '+'}
]
sort: [{key: 'sortname', operator: '+'}]
})
.bindEvent({
init: function(data) {
@ -100,30 +100,14 @@ pandora.ui.namesDialog = function() {
+ ' name' + (numberOfNames == 1 ? '' : 's')
});
},
select: function(data) {
var values;
$name.empty();
if (data.ids.length) {
values = $list.value(data.ids[0]);
$nameLabel.options({
title: values.name + ' <' + values.nameSort + '>'
});
$name.append(renderNameForm(values))
} else {
$nameLabel.options({title: 'No name selected'});
}
submit: function(data) {
pandora.api.editName({
id: data.id,
sortname: data.sortname
});
}
}),
$nameLabel = Ox.Label({
textAlign: 'center',
title: 'No name selected',
width: 248
})
.css({margin: '4px'}),
$name = Ox.Element({}),
that = Ox.Dialog({
buttons: [
Ox.Button({
@ -139,41 +123,18 @@ pandora.ui.namesDialog = function() {
content: Ox.SplitPanel({
elements: [
{
element: Ox.SplitPanel({
elements: [
{
element: Ox.Bar({size: 24})
.append($status)
.append(
$findElement
),
size: 24
},
{
element: $list
}
],
orientation: 'vertical'
})
element: Ox.Bar({size: 24})
.append($status)
.append(
$findElement
),
size: 24
},
{
element: Ox.SplitPanel({
elements: [
{
element: Ox.Bar({size: 24})
.append($nameLabel),
size: 24
},
{
element: $name
}
],
orientation: 'vertical'
}),
size: 256
element: $list
}
],
orientation: 'horizontal'
orientation: 'vertical'
}),
height: height,
maximizeButton: true,
@ -184,50 +145,6 @@ pandora.ui.namesDialog = function() {
width: width
});
function renderNameForm(nameData) {
var $checkbox;
return Ox.Form({
items: [
Ox.Input({
id: 'name',
label: 'Name',
labelWidth: 80,
value: nameData.name,
width: 240
})
.bindEvent({
submit: function(data) {
}
}),
Ox.Input({
id: 'nameSort',
label: 'Sort Name',
labelWidth: 80,
value: nameData.nameSort,
width: 240
})
.bindEvent({
submit: function(data) {
}
}),
],
width: 240
})
.css({margin: '8px'})
.bindEvent({
change: function(event) {
var data = {id: nameData.id}, key, value;
data[event.id] = event.data.value;
$list.value(nameData.id, event.id, data[event.id]);
pandora.api.editName(data, function(result) {
Ox.Request.clearCache('findNames');
});
}
});
}
function updateList(key, value) {
var query = {
conditions: [{key: 'name', value: value, operator: '='}],

View file

@ -2,7 +2,7 @@
pandora.ui.titlesDialog = function() {
var height = Math.round((window.innerHeight - 48) * 0.9),
width = Math.round(window.innerWidth * 0.9),
width = 512 + Ox.UI.SCROLLBAR_SIZE,
numberOfTitles = 0,
$status = Ox.Label({
@ -64,14 +64,15 @@ pandora.ui.titlesDialog = function() {
removable: false,
title: 'Title',
visible: true,
width: 250
width: 256
},
{
id: 'titleSort',
editable: true,
id: 'sorttitle',
operator: '+',
title: 'Sort Title',
visible: true,
width: 250
width: 256
},
],
columnsRemovable: true,
@ -80,9 +81,7 @@ pandora.ui.titlesDialog = function() {
keys: [],
max: 1,
scrollbarVisible: true,
sort: [
{key: 'title', operator: '+'}
]
sort: [{key: 'sorttitle', operator: '+'}]
})
.bindEvent({
init: function(data) {
@ -92,30 +91,14 @@ pandora.ui.titlesDialog = function() {
+ ' title' + (numberOfTitles == 1 ? '' : 's')
});
},
select: function(data) {
var values;
$title.empty();
if (data.ids.length) {
values = $list.value(data.ids[0]);
$titleLabel.options({
title: values.title + ' <' + values.titleSort + '>'
});
$title.append(renderTitleForm(values))
} else {
$titleLabel.options({title: 'No title selected'});
}
submit: function(data) {
pandora.api.editTitle({
id: data.id,
sortname: data.sortname
});
}
}),
$titleLabel = Ox.Label({
textAlign: 'center',
title: 'No title selected',
width: 248
})
.css({margin: '4px'}),
$title = Ox.Element({}),
that = Ox.Dialog({
buttons: [
Ox.Button({
@ -131,41 +114,18 @@ pandora.ui.titlesDialog = function() {
content: Ox.SplitPanel({
elements: [
{
element: Ox.SplitPanel({
elements: [
{
element: Ox.Bar({size: 24})
.append($status)
.append(
$findElement
),
size: 24
},
{
element: $list
}
],
orientation: 'vertical'
})
element: Ox.Bar({size: 24})
.append($status)
.append(
$findElement
),
size: 24
},
{
element: Ox.SplitPanel({
elements: [
{
element: Ox.Bar({size: 24})
.append($titleLabel),
size: 24
},
{
element: $title
}
],
orientation: 'vertical'
}),
size: 256
element: $list
}
],
orientation: 'horizontal'
orientation: 'vertical'
}),
height: height,
maximizeButton: true,
@ -176,50 +136,6 @@ pandora.ui.titlesDialog = function() {
width: width
});
function renderTitleForm(titleData) {
var $checkbox;
return Ox.Form({
items: [
Ox.Input({
id: 'title',
label: 'Title',
labelWidth: 80,
value: titleData.title,
width: 240
})
.bindEvent({
submit: function(data) {
}
}),
Ox.Input({
id: 'titleSort',
label: 'Sort Title',
labelWidth: 80,
value: titleData.titleSort,
width: 240
})
.bindEvent({
submit: function(data) {
}
}),
],
width: 240
})
.css({margin: '8px'})
.bindEvent({
change: function(event) {
var data = {id: titleData.id}, key, value;
data[event.id] = event.data.value;
$list.value(titleData.id, event.id, data[event.id]);
pandora.api.editTitle(data, function(result) {
Ox.Request.clearCache('findTitles');
});
}
});
}
function updateList(key, value) {
var query = {
conditions: [{key: 'title', value: value, operator: '='}],

View file

@ -18,44 +18,6 @@ pandora.ui.usersDialog = function() {
})
.css({float: 'left', margin: '4px'}),
$exportButton = Ox.Button({
title: 'Export E-Mail Addresses'
})
.css({margin: '4px 4px 4px 0'})
.bindEvent({
click: function() {
pandora.api.findUsers({
query: {conditions: [], operator: '&'},
keys: ['email', 'username'],
range: [0, numberOfUsers],
sort: [{key: 'username', operator: '+'}]
}, function(result) {
var $dialog = Ox.Dialog({
buttons: [
Ox.Button({
title: 'Close'
})
.bindEvent({
click: function() {
$dialog.close();
}
})
],
content: Ox.Element()
.addClass('OxSelectable')
.css({margin: '16px'})
.html(
result.data.items.map(function(item) {
return item.username + ' <' + item.email + '>'
}).join(', ')
),
title: 'E-Mail Addresses'
})
.open()
})
}
}),
$findSelect = Ox.Select({
items: [
{id: 'all', title: 'Find: All', checked: true},
@ -297,13 +259,50 @@ pandora.ui.usersDialog = function() {
that = Ox.Dialog({
buttons: [
Ox.Button({
id: 'done',
title: 'Done'
}).bindEvent({
click: function() {
that.close();
}
})
title: 'Export E-Mail Addresses'
})
.css({margin: '4px 4px 4px 0'})
.bindEvent({
click: function() {
pandora.api.findUsers({
query: {conditions: [], operator: '&'},
keys: ['email', 'username'],
range: [0, numberOfUsers],
sort: [{key: 'username', operator: '+'}]
}, function(result) {
var $dialog = Ox.Dialog({
buttons: [
Ox.Button({
title: 'Close'
})
.bindEvent({
click: function() {
$dialog.close();
}
})
],
content: Ox.Element()
.addClass('OxSelectable')
.css({margin: '16px'})
.html(
result.data.items.map(function(item) {
return item.username + ' <' + item.email + '>'
}).join(', ')
),
title: 'E-Mail Addresses'
})
.open()
})
}
}),
Ox.Button({
id: 'done',
title: 'Done'
}).bindEvent({
click: function() {
that.close();
}
})
],
closeButton: true,
content: Ox.SplitPanel({
@ -314,7 +313,6 @@ pandora.ui.usersDialog = function() {
{
element: Ox.Bar({size: 24})
.append($status)
.append($exportButton)
.append(
$findElement
),