This commit is contained in:
rolux 2014-09-17 15:25:48 +02:00
parent 8b69ef1e47
commit 72fce725d7

View file

@ -9,7 +9,7 @@ pandora.ui.importAnnotationsDialog = function(data) {
languages = Ox.sortBy(Ox.LANGUAGES.map(function(language) { languages = Ox.sortBy(Ox.LANGUAGES.map(function(language) {
return {id: language.code, title: language.name}; return {id: language.code, title: language.name};
}, 'title')), }), 'title'),
$content = Ox.Element() $content = Ox.Element()
.css({margin: '16px'}), .css({margin: '16px'}),
@ -17,7 +17,7 @@ pandora.ui.importAnnotationsDialog = function(data) {
$layerSelect = Ox.Select({ $layerSelect = Ox.Select({
items: layers, items: layers,
label: Ox._('Layer'), label: Ox._('Layer'),
labelWidth: 128 labelWidth: 128,
width: 384 width: 384
}) })
.css({ .css({
@ -26,9 +26,9 @@ pandora.ui.importAnnotationsDialog = function(data) {
.appendTo($content), .appendTo($content),
$languageSelect = Ox.Select({ $languageSelect = Ox.Select({
items: layers, items: languages,
label: Ox._('Language'), label: Ox._('Language'),
labelWidth: 128 labelWidth: 128,
width: 384 width: 384
}) })
.css({ .css({
@ -37,7 +37,7 @@ pandora.ui.importAnnotationsDialog = function(data) {
.appendTo($content), .appendTo($content),
$fileInput = Ox.FileInput({ $fileInput = Ox.FileInput({
max: 1, maxFiles: 1,
width: 384 width: 384
}) })
.css({ .css({
@ -45,8 +45,9 @@ pandora.ui.importAnnotationsDialog = function(data) {
}) })
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
if (data.files.length) { var reader;
var reader = new FileReader(); if (data.value.length) {
reader = new FileReader();
reader.onloadend = function(event) { reader.onloadend = function(event) {
srt = parseSRT(this.result); srt = parseSRT(this.result);
total = srt.length; total = srt.length;
@ -60,7 +61,7 @@ pandora.ui.importAnnotationsDialog = function(data) {
+ (total == 1 ? '' : 's') + '.', [total]) + (total == 1 ? '' : 's') + '.', [total])
); );
}; };
reader.readAsText(data.files[0]); reader.readAsText(data.value[0]);
} else { } else {
srt = []; srt = [];
total = 0; total = 0;