fix manage files to load again and handle upper case extensions

This commit is contained in:
j 2013-04-28 17:57:24 +00:00
parent 70271b4649
commit 001e85eea7
3 changed files with 27 additions and 23 deletions

View file

@ -186,16 +186,6 @@ pandora.ui.filesDialog = function() {
}
}),
$itemLabel = Ox.Label({
textAlign: 'center',
title: 'No file selected',
width: getLabelWidth()
})
.css({
float: 'left',
margin: '4px'
}),
$closeButton = Ox.Button({
title: 'close',
tooltip: 'Close',
@ -293,6 +283,16 @@ pandora.ui.filesDialog = function() {
orientation: 'horizontal'
}),
$itemLabel = Ox.Label({
textAlign: 'center',
title: 'No file selected',
width: getLabelWidth()
})
.css({
float: 'left',
margin: '4px'
}),
that = Ox.Dialog({
buttons: [
Ox.Button({
@ -521,17 +521,17 @@ pandora.ui.filesDialog = function() {
pandora.ui.uploadFileDialog(data.files[0], function(file) {
Ox.Request.clearCache('findFiles');
pandora.api.findFiles({
ids: [file.id],
query: $list.options.query,
sort: $list.options.sort,
positions: [file.id],
query: $list.options('query'),
sort: $list.options('sort'),
}, function(data) {
$list.bindEventOnce({
load: function() {
list.options({selected: [file.id]});
$list.options({selected: [file.id]});
// selectFile(file.id);
}
});
if (data.positions[file.id] > -1) {
if (data.data.positions[file.id] > -1) {
$list.reloadList();
} else {
$list.options({

View file

@ -7,6 +7,11 @@ pandora.ui.uploadFileDialog = function(file, callback) {
extensions = ['gif', 'jpg', 'jpeg', 'pdf', 'png'],
filename = file.name.split('.').slice(0, -1).join('.') + '.'
+ (extension == 'jpeg' ? 'jpg' : extension),
id = pandora.user.username + ':' + filename,
upload,
$errorDialog,
@ -40,7 +45,9 @@ pandora.ui.uploadFileDialog = function(file, callback) {
if (title == 'Cancel Upload') {
upload.abort();
} else if (title == 'Done') {
callback();
callback({
id: id
});
}
}
})
@ -55,9 +62,7 @@ pandora.ui.uploadFileDialog = function(file, callback) {
open: function() {
upload = pandora.chunkupload({
data: {
filename: extension == 'jpeg'
? file.name.split('.').slice(0, -1).join('.') + '.jpg'
: file.name
filename: filename
},
file: file,
url: '/api/upload/file/',
@ -93,11 +98,10 @@ pandora.ui.uploadFileDialog = function(file, callback) {
range: [0, 1],
sort: [{key: 'name', operator: '+'}]
}, function(result) {
var id = pandora.user.name + ':' + file.name;
if (result.data.items.length) {
errorDialog(
'The file ' + id + ' already exists' + (
file.name == result.data.items[0].id
filename == result.data.items[0].id
? ''
: ' as ' + result.data.items[0].id
) + '.'