This commit is contained in:
rolux 2015-04-20 10:13:56 +02:00
parent 02552f3f83
commit c6c2a425cc
16 changed files with 224 additions and 73 deletions

View file

@ -18,7 +18,10 @@ pandora.ui.appearanceDialog = function() {
Ox.Select({
id: 'theme',
items: pandora.site.themes.map(function(theme) {
return {id: theme, title: Ox.Theme.getThemeData(theme).themeName}
return {
id: theme,
title: Ox.Theme.getThemeData(theme).themeName
};
}),
label: Ox._('Theme'),
labelWidth: 120,
@ -34,7 +37,10 @@ pandora.ui.appearanceDialog = function() {
Ox.Select({
id: 'locale',
items: pandora.site.languages.map(function(locale) {
return {id: locale, title: Ox.LOCALE_NAMES[locale]}
return {
id: locale,
title: Ox.LOCALE_NAMES[locale]
};
}),
label: Ox._('Language'),
labelWidth: 120,

View file

@ -5,6 +5,7 @@
pandora.ui.deleteDocumentDialog = function(files, callback) {
var string = Ox._(files.length == 1 ? 'Document' : 'Documents'),
that = pandora.ui.iconDialog({
buttons: [
Ox.Button({

View file

@ -5,6 +5,7 @@
pandora.ui.deleteEntityDialog = function(entities, callback) {
var string = Ox._(entities.length == 1 ? 'Entity' : 'Entities'),
that = pandora.ui.iconDialog({
buttons: [
Ox.Button({

View file

@ -36,12 +36,16 @@ pandora.ui.deleteListDialog = function(list) {
.bindEventOnce({
load: function() {
if (ui.section == 'items') {
pandora.UI.set('lists.' + listData.id, null);
pandora.UI.set(
'lists.' + listData.id, null
);
pandora.UI.set({
find: pandora.site.user.ui.find
});
} else {
pandora.UI.set(folderItem.toLowerCase(), '');
pandora.UI.set(
folderItem.toLowerCase(), ''
);
}
}
})
@ -50,8 +54,10 @@ pandora.ui.deleteListDialog = function(list) {
}
})
],
content: Ox._('Are you sure you want to delete the {0} "{1}"?',
[Ox._(folderItem.toLowerCase()), listData.name]),
content: Ox._(
'Are you sure you want to delete the {0} "{1}"?',
[Ox._(folderItem.toLowerCase()), listData.name]
),
keys: {enter: 'delete', escape: 'keep'},
title: Ox._('Delete {0}', [Ox._(folderItem)])
});

View file

@ -9,7 +9,8 @@ pandora.ui.documentsDialog = function() {
// FIXME: user may not have the manage entites capability
$switchButton = Ox.Button({
disabled: !pandora.site.entities.length || !pandora.site.capabilities.canManageEntities[pandora.user.level],
disabled: !pandora.site.entities.length
|| !pandora.site.capabilities.canManageEntities[pandora.user.level],
title: Ox._('Manage Entities...')
})
.bindEvent({

View file

@ -151,7 +151,9 @@ pandora.ui.importAnnotationsDialog = function(options) {
[annotations.length]
));
annotations = annotations.map(function(annotation) {
var value = Ox.sanitizeHTML(annotation.text ? annotation.text : annotation.value);
var value = Ox.sanitizeHTML(
annotation.text ? annotation.text : annotation.value
);
if (format == 'srt') {
value = value.replace(/<br[ /]*?>\n/g, '\n')
.replace(/\n\n/g, '<br>\n')

View file

@ -56,9 +56,11 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
range: [0, 1],
sort: [{key: 'id', operator: '+'}],
},
sites = [pandora.site.site].concat(pandora.site.sites).map(function(site) {
sites = [pandora.site.site].concat(pandora.site.sites).map(
function(site) {
return {id: site.url, title: site.url, https: site.https};
});
}
);
api.find(options, function(result) {
@ -76,8 +78,16 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
return getForm(id);
},
tabs: [
{id: 'basic', title: Ox._('Basic'), selected: !advanced},
{id: 'advanced', title: Ox._('Advanced'), selected: advanced}
{
id: 'basic',
title: Ox._('Basic'),
selected: !advanced
},
{
id: 'advanced',
title: Ox._('Advanced'),
selected: advanced
}
]
});
} else {
@ -124,8 +134,15 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
$input.protocol = Ox.Select({
items: [
{id: 'http', title: 'http'},
{id: 'https', title: 'https', disabled: !pandora.site.site.https}
{
id: 'http',
title: 'http'
},
{
id: 'https',
title: 'https',
disabled: !pandora.site.site.https
}
],
label: Ox._('Protocol'),
labelWidth: 128,
@ -141,7 +158,9 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
$input.site = Ox.SelectInput({
inputWidth: 128,
items: sites.concat([{id: 'other', title: Ox._('Other...')}]),
items: sites.concat(
[{id: 'other', title: Ox._('Other...')}]
),
label: Ox._('Site'),
labelWidth: 128,
placeholder: 'example.com',
@ -155,9 +174,11 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
if (data.value) {
var site = Ox.getObjectById(sites, data.value);
$input.protocol[
!site || site.https ? 'enableItem' : 'disableItem'
!site || site.https
? 'enableItem' : 'disableItem'
]('https').options({
value: !site || !site.https ? 'http' : 'https'
value: !site || !site.https
? 'http' : 'https'
});
updateAPI(data.value, formatURL);
}
@ -225,8 +246,10 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
$input.position.options({
value: limitPoint(
data.value,
hasInAndOut ? $input['in'].options('value') : 0,
hasInAndOut ? $input.out.options('value') : duration
hasInAndOut
? $input['in'].options('value') : 0,
hasInAndOut
? $input.out.options('value') : duration
)
});
}
@ -250,7 +273,9 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
value: limitPoint(data.value, 0, duration)
});
if ($input.out.options('value') === '') {
$input.out.options({value: Ox.formatDuration(duration)});
$input.out.options({
value: Ox.formatDuration(duration)
});
} else if (
Ox.parseDuration($input.out.options('value'))
< Ox.parseDuration(data.value)
@ -278,7 +303,9 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
value: limitPoint(data.value, 0, duration)
});
if ($input['in'].options('value') === '') {
$input['in'].options({value: Ox.formatDuration(0)});
$input['in'].options({
value: Ox.formatDuration(0)
});
} else if (
Ox.parseDuration($input['in'].options('value'))
> Ox.parseDuration(data.value)
@ -418,9 +445,11 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
options = Ox.serialize({
title: data.title || void 0,
showTimeline: data.showTimeline || void 0,
timeline: data.timeline && data.timeline != 'default' ? data.timeline : void 0,
timeline: data.timeline && data.timeline != 'default'
? data.timeline : void 0,
showAnnotations: data.showAnnotations || void 0,
showLayers: data.showAnnotations && data.showLayers ? data.showLayers : void 0,
showLayers: data.showAnnotations && data.showLayers
? data.showLayers : void 0,
//matchRatio: true
}, true)
.replace(/_/g, '%09').replace(/\s/g, '_')
@ -472,7 +501,10 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
query[condition.key] = condition.value;
});
}
(isSameItem ? Ox.noop : api.get)({id: id, keys: ['duration']}, function(result) {
(isSameItem ? Ox.noop : api.get)({
id: id,
keys: ['duration']
}, function(result) {
if (result && result.data) {
duration = result.data.duration;
item = id;
@ -494,7 +526,8 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
showTimeline: query.showTimeline || false,
timeline: query.timeline || 'default',
showAnnotations: query.showAnnotations || false,
showLayers: query.showLayers || pandora.site.layers.map(function(layer) {
showLayers: query.showLayers
|| pandora.site.layers.map(function(layer) {
return layer.id;
})
}, function(value, key) {

View file

@ -27,11 +27,17 @@ pandora.ui.makeListPrivateDialog = function(name, subscribers, callback) {
}
})
],
content: Ox._('Are you sure you want to make the {0} "{1}" private and lose its {2}?', [
content: Ox._(
'Are you sure you want to make the {0} "{1}" private'
+ ' and lose its {2}?',
[
folderItem.toLowerCase(),
name,
subscribers == 1 ? Ox._('subscriber') : Ox._('{0} subscribers', [subscribers])
]),
subscribers == 1
? Ox._('subscriber')
: Ox._('{0} subscribers', [subscribers])
]
),
keys: {enter: 'make', escape: 'keep'},
title: Ox._('Make {0} Private', [folderItem])
});

View file

@ -166,7 +166,10 @@ pandora.ui.metadataDialog = function(data) {
}
function getMetadata() {
pandora.api.getMetadata({id: data.imdbId, keys: keys.concat(['originalTitle'])}, function(result) {
pandora.api.getMetadata({
id: data.imdbId,
keys: keys.concat(['originalTitle'])
}, function(result) {
var $bar = Ox.Bar({size: 24}),
$data = Ox.Element()
.css({padding: '13px', overflowY: 'auto'}),
@ -219,7 +222,10 @@ pandora.ui.metadataDialog = function(data) {
title: getTitle(key),
width: formWidth
})
.css({display: 'inline-block', margin: '3px 3px 5px 3px'})
.css({
display: 'inline-block',
margin: '3px 3px 5px 3px'
})
.appendTo($data);
$input[key] = [data[key], imdb[key]].map(function(v, i) {
return Ox.InputGroup({
@ -251,7 +257,10 @@ pandora.ui.metadataDialog = function(data) {
})
],
separators: [
{title: [Ox._('Current'), Ox._('Update')][i], width: 64}
{
title: [Ox._('Current'), Ox._('Update')][i],
width: 64
}
]
})
.css({display: 'inline-block', margin: '3px'})

View file

@ -18,8 +18,16 @@ pandora.ui.namesDialog = function() {
change: function(data) {
var query = {
conditions: [
{key: 'name', value: data.value, operator: '='},
{key: 'sortname', value: data.value, operator: '='}
{
key: 'name',
operator: '=',
value: data.value
},
{
key: 'sortname',
operator: '=',
value: data.value
}
],
operator: '|'
};
@ -103,7 +111,9 @@ pandora.ui.namesDialog = function() {
pandora.UI.set({find: {
conditions: [{
key: 'name',
value: $list.value($list.options('selected'), 'name'),
value: $list.value(
$list.options('selected'), 'name'
),
operator: '='
}],
operator: '&'
@ -188,4 +198,3 @@ pandora.ui.namesDialog = function() {
return that;
};

View file

@ -8,7 +8,9 @@ pandora.ui.preferencesDialog = function() {
{id: 'appearance', title: Ox._('Appearance')},
{id: 'advanced', title: Ox._('Advanced')}
];
Ox.getObjectById(tabs, pandora.user.ui.part.preferences || 'account').selected = true;
Ox.getObjectById(
tabs, pandora.user.ui.part.preferences || 'account'
).selected = true;
var $tabPanel = Ox.TabPanel({
content: function(id) {
var $content = Ox.Element()
@ -91,7 +93,9 @@ pandora.ui.preferencesDialog = function() {
id: 'newsletter',
label: Ox._('Newsletter'),
labelWidth: 120,
title: pandora.user.newsletter ? Ox._('Subscribed') : Ox._('Unsubscribed'),
title: pandora.user.newsletter
? Ox._('Subscribed')
: Ox._('Unsubscribed'),
value: pandora.user.newsletter,
width: 320
})
@ -99,7 +103,9 @@ pandora.ui.preferencesDialog = function() {
change: function(data) {
pandora.user.newsletter = data.value;
this.options({
title: pandora.user.newsletter ? Ox._('Subscribed') : Ox._('Unsubscribed')
title: pandora.user.newsletter
? Ox._('Subscribed')
: Ox._('Unsubscribed')
});
pandora.api.editPreferences({
newsletter: pandora.user.newsletter
@ -118,7 +124,10 @@ pandora.ui.preferencesDialog = function() {
Ox.Select({
id: 'theme',
items: pandora.site.themes.map(function(theme) {
return {id: theme, title: Ox.Theme.getThemeData(theme).themeName}
return {
id: theme,
title: Ox.Theme.getThemeData(theme).themeName
};
}),
label: Ox._('Theme'),
labelWidth: 120,
@ -134,7 +143,10 @@ pandora.ui.preferencesDialog = function() {
Ox.Select({
id: 'locale',
items: pandora.site.languages.map(function(locale) {
return {id: locale, title: Ox.LOCALE_NAMES[locale]}
return {
id: locale,
title: Ox.LOCALE_NAMES[locale]
};
}),
label: Ox._('Language'),
labelWidth: 120,
@ -238,7 +250,9 @@ pandora.ui.preferencesDialog = function() {
},
'pandora_part.preferences': function(data) {
if (pandora.user.ui.page == 'preferences') {
$tabPanel.select(data.value == '' ? 'account' : data.value);
$tabPanel.select(
data.value == '' ? 'account' : data.value
);
}
}
});

View file

@ -9,6 +9,7 @@ pandora.ui.previewDialog = function() {
? pandora.site.posters.ratio
: ($list.value(item, 'posterRatio') || pandora.site.posters.ratio),
size = getSize(posterRatio),
that = Ox.Dialog({
closeButton: true,
content: Ox.Element(),
@ -58,7 +59,9 @@ pandora.ui.previewDialog = function() {
that.update = function() {
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
pandora.requests.preview = pandora.api.find({
keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys),
keys: [
'id', 'modified', 'posterRatio'
].concat(pandora.site.itemTitleKeys),
query: {
conditions: [{
key: 'id',

View file

@ -16,8 +16,16 @@ pandora.ui.titlesDialog = function() {
change: function(data) {
var query = {
conditions: [
{key: 'title', value: data.value, operator: '='},
{key: 'sorttitle', value: data.value, operator: '='}
{
key: 'title',
operator: '=',
value: data.value
},
{
key: 'sorttitle',
operator: '=',
value: data.value
}
],
operator: '|'
};
@ -92,7 +100,9 @@ pandora.ui.titlesDialog = function() {
pandora.UI.set({find: {
conditions: [{
key: 'title',
value: $list.value($list.options('selected'), 'title'),
value: $list.value(
$list.options('selected'), 'title'
),
operator: '='
}],
operator: '&'

View file

@ -70,7 +70,9 @@ pandora.ui.uploadDocumentDialog = function(files, callback) {
if (!Ox.every(extensions, function(extension) {
return Ox.contains(supportedExtensions, extension)
})) {
return errorDialog(Ox._('Supported file types are GIF, JPG, PNG and PDF.'));
return errorDialog(
Ox._('Supported file types are GIF, JPG, PNG and PDF.')
);
} else {
var valid = true;
Ox.parallelForEach(files, function(file, index, array, callback) {
@ -81,18 +83,29 @@ pandora.ui.uploadDocumentDialog = function(files, callback) {
pandora.api.findDocuments({
keys: ['id', 'user', 'name', 'extension'],
query: {
conditions: [{key: 'oshash', value: oshash, operator: '=='}],
conditions: [{
key: 'oshash',
operator: '==',
value: oshash
}],
operator: '&'
},
range: [0, 1],
sort: [{key: 'name', operator: '+'}]
}, function(result) {
if (result.data.items.length) {
var id = result.data.items[0].name + '.' + result.data.items[0].extension;
var id = result.data.items[0].name + '.'
+ result.data.items[0].extension;
valid && errorDialog(
filename == id
? Ox._('The file "{0}" already exists.', [filename])
: Ox._('The file "{0}" already exists as "{1}".', [filename, id])
? Ox._(
'The file "{0}" already exists.',
[filename]
)
: Ox._(
'The file "{0}" already exists as "{1}".',
[filename, id]
)
).open();
valid = false;
}
@ -151,7 +164,9 @@ pandora.ui.uploadDocumentDialog = function(files, callback) {
}
} else {
$message.html(Ox._('Upload failed.'))
$uploadDialog.options('buttons')[0].options({title: Ox._('Close')});
$uploadDialog.options('buttons')[0].options({
title: Ox._('Close')
});
}
},
progress: function(data) {

View file

@ -76,7 +76,9 @@ pandora.ui.uploadPDFDialog = function(options) {
done: function(data) {
if (data.progress == 1) {
Ox.Request.clearCache();
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.textPanel = pandora.ui.textPanel());
pandora.$ui.mainPanel.replaceElement(
1, pandora.$ui.textPanel = pandora.ui.textPanel()
);
that.close();
} else {
$content.html("failed: " + data.responseText);

View file

@ -8,8 +8,9 @@ pandora.ui.uploadVideoDialog = function(data) {
hasFirefogg = !(Ox.isUndefined(Firefogg)) && (
$.browser.version < '35' || Firefogg().version >= 334
),
itemView = pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]
? 'media' : 'info',
itemView = pandora.site.capabilities.canSeeExtraItemViews[
pandora.user.level
] ? 'media' : 'info',
selectFile,
$actionButton,
$closeButton,
@ -84,14 +85,20 @@ pandora.ui.uploadVideoDialog = function(data) {
disabled: false
}).bindEvent({
click: function() {
info.direct ? directUpload(data.files[0], info) : upload(data.files[0]);
info.direct
? directUpload(data.files[0], info)
: upload(data.files[0]);
}
});
$info.html(formatVideoInfo(info));
$status.html(
info.direct
? Ox._('Your video will be uploaded directly.')
: Ox._('Your video will be transcoded before uploading.')
? Ox._(
'Your video will be uploaded directly.'
)
: Ox._(
'Your video will be transcoded before uploading.'
)
);
});
//$closeButton.options('title', Ox._('Cancel'));
@ -164,7 +171,9 @@ pandora.ui.uploadVideoDialog = function(data) {
pandora.api.addMedia({
filename: info.name,
id: info.oshash,
item: pandora.site.itemRequiresVideo ? undefined : pandora.user.ui.item
item: pandora.site.itemRequiresVideo
? undefined
: pandora.user.ui.item
}, function(result) {
uploadStream(result.data.item, info, file);
});
@ -181,7 +190,9 @@ pandora.ui.uploadVideoDialog = function(data) {
filename: filename,
id: oshash,
info: info,
item: pandora.site.itemRequiresVideo ? undefined : pandora.user.ui.item
item: pandora.site.itemRequiresVideo
? undefined
: pandora.user.ui.item
}, function(result) {
item = result.data.item;
pandora.firefogg.encode(
@ -189,12 +200,19 @@ pandora.ui.uploadVideoDialog = function(data) {
function(result, file) {
result = JSON.parse(result);
if (result.progress != 1) {
$status.html(cancelled ? Ox._('Encoding cancelled.') : Ox._('Encoding failed.'));
$status.html(
cancelled
? Ox._('Encoding cancelled.')
: Ox._('Encoding failed.')
);
delete pandora.firefogg;
return;
}
setTimeout(function() {
$info.html('<b>' + filename + '</b><br>' + Ox._('uploading...'));
$info.html(
'<b>' + filename + '</b><br>'
+ Ox._('uploading...')
);
uploadStream(item, info, file);
});
},
@ -260,13 +278,17 @@ pandora.ui.uploadVideoDialog = function(data) {
resolution = getResolution(info);
pandora.$ui.upload = pandora.chunkupload({
file: file,
url: '/api/upload/?profile=' + resolution + 'p.' + format + '&id=' + oshash,
url: '/api/upload/?profile=' + resolution + 'p.'
+ format + '&id=' + oshash,
data: {}
}).bindEvent({
done: function(data) {
if (data.progress == 1) {
Ox.Request.clearCache();
if (pandora.user.ui.item == item && pandora.user.ui.itemView == itemView) {
if (
pandora.user.ui.item == item
&& pandora.user.ui.itemView == itemView
) {
pandora.$ui.item.reload();
} else {
pandora.UI.set({
@ -308,7 +330,9 @@ pandora.ui.uploadVideoDialog = function(data) {
pandora.api.addMedia({
filename: file.name,
id: oshash,
item: pandora.site.itemRequiresVideo ? undefined : pandora.user.ui.item
item: pandora.site.itemRequiresVideo
? undefined
: pandora.user.ui.item
}, function(result) {
var item = result.data.item;
pandora.$ui.upload = pandora.chunkupload({
@ -321,7 +345,10 @@ pandora.ui.uploadVideoDialog = function(data) {
done: function(data) {
if (data.progress == 1) {
Ox.Request.clearCache();
if (pandora.user.ui.item == item && pandora.user.ui.itemView == itemView) {
if (
pandora.user.ui.item == item
&& pandora.user.ui.itemView == itemView
) {
pandora.$ui.item.reload();
} else {
pandora.UI.set({
@ -331,7 +358,11 @@ pandora.ui.uploadVideoDialog = function(data) {
}
that.close();
} else {
$status.html(cancelled ? Ox._('Upload cancelled.') : Ox._('Upload failed.'));
$status.html(
cancelled
? Ox._('Upload cancelled.')
: Ox._('Upload failed.')
);
!cancelled && pandora.api.logError({
text: data.responseText,
url: '/' + item,
@ -340,7 +371,9 @@ pandora.ui.uploadVideoDialog = function(data) {
}
},
progress: function(data) {
$progress.options({progress: data.progress || 0});
$progress.options({
progress: data.progress || 0
});
}
});
});