summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/js/jingles.js180
1 files changed, 89 insertions, 91 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js
index 112772d..810a03d 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -329,66 +329,55 @@ JingleCut.prototype.render = function() {
var Importer = function() {
this.$el = $('#uploadModal');
-
-
};
-Importer.prototype.importAddCut = function(cart, dz, file) {
- // todo: set additional parameters like DESCRIPTION here, when patch has been applied.
- rivendell.addCut(cart.number, function(cutXml) {
- var cutNumber = $(cutXml).find('cutNumber').text();
- dz.on('sending', function(file, xhr, formData) {
- formData.append('COMMAND', 2);
- formData.append('LOGIN_NAME', auth_username);
- formData.append('PASSWORD', auth_token);
- formData.append('CART_NUMBER', cart.number);
- formData.append('CUT_NUMBER', cutNumber);
- formData.append('CHANNELS', 2);
- formData.append('NORMALIZATION_LEVEL', cart.normlevel);
- formData.append('AUTOTRIM_LEVEL', cart.trimlevel);
- formData.append('USE_METADATA', 1);
- });
- dz.processQueue();
- }).fail(function(xhr, status, err) {
- self.importFileUploadError(cart, dz, file, err, xhr);
+Importer.prototype.showUploadModal = function(cart) {
+ var uploadModal = $('#uploadModal');
+ $('div.modal-header h3', uploadModal).text("Datei auswählen...");
+ var form = $('<form>');
+ $('.modal-body', uploadModal).empty().append(form).css("background-image", "url('/img/dz-backdrop.png')");
+ var self = this;
+ var dropzone = form.dropzone({
+ url: '/rd-bin/rdxport.cgi',
+ parallelUploads: 1,
+ maxFilesize: 2048,
+ paramName: 'FILENAME',
+ uploadMultiple: false, // todo: maybe enable this?
+ clickable: true,
+ createImageThumbnails: false,
+ acceptedFiles: '.flac,.wav,.ogg,.mp3',
+ autoProcessQueue: false,
+ init: function() {
+ this.on("addedfile", function(file) {
+ self.importFileAdded(this, file, cart);
+ });
+ this.on("error", function(file, msg) {
+ self.importFileSelectError(this, file, msg);
+ });
+ }
});
-};
-Importer.prototype.importCartCancel = function(cart, dz) {
- this.deleteCart(cart);
- dz.off("error");
- dz.disable();
-};
-
-Importer.prototype.importFileUploadError = function(cart, dz, file, msg, xhr) {
- //var error_row = jingles_newImportErrorEntry(cart, msg);
- //error_row.find('button').unbind('click').click(function() {
- //jingles_deleteCart(cart);
- //});
- //$('#show-cart-' + cart).replaceWith(error_row);
- //error_row.find('.file-name').text(file.name);
- dz.disable();
+ $('#uploadModal').modal({keyboard: true});
};
-Importer.prototype.importFileUploadSuccess = function(cart, dz, file) {
- //var command = { LOGIN_NAME: auth_username, PASSWORD: auth_token, DESCRIPTION: file. };
+Importer.prototype.importFileAdded = function(dropzone, file, cart) {
+ $(dropzone.getAcceptedFiles()).each(function(idx, elem) { dropzone.removeFile(elem); });
- //jingles_updateGroupCartInfo(cart);
- dz.disable();
- $(cart).trigger('add');
+ var uploadModal = $('#uploadModal');
+ $('div.modal-body', uploadModal).css("background-image", "url('/img/audio_file.png')");
+ $('div.modal-header h3', uploadModal).text(file.name);
+ var self = this;
+ $('#uploadModal-confirm', uploadModal).unbind('click').click(function() {
+ self.importCartConfirm(cart, dropzone);
+ }).removeAttr('disabled');
};
-Importer.prototype.importUpdateProgress = function(file, stats) {
- if(file.upload.progress < 99) {
- var bytes_str = Number((file.upload.bytesSent/1024)/1024).toFixed(1) + " von " +
- Number((file.upload.total/1024)/1024).toFixed(1) + " MB";
- stats.find('.file-bytes').text(bytes_str);
- stats.find('.progress .bar').css("width", file.upload.progress + "%");
- } else {
- stats.find('.file-bytes').text('importiere...');
- stats.find('.progress .bar').css('width', '100%');
- stats.find('.progress').addClass('progress-striped').addClass('active');
- }
+Importer.prototype.importFileSelectError = function(dropzone, file, msg) {
+ var uploadModal = $('#uploadModal');
+ $('div.modal-header h3', uploadModal).text("Datei auswählen...");
+ $('div.modal-body', uploadModal).css("background-image", "url('/img/dz-backdrop.png')");
+ $('#uploadModal-confirm', uploadModal).attr('disabled','disabled').unbind('click');
+ dropzone.removeFile(file);
};
Importer.prototype.importCartConfirm = function(cart, dz) {
@@ -414,51 +403,60 @@ Importer.prototype.importCartConfirm = function(cart, dz) {
this.importAddCut(cart, dz, files[0])
};
-Importer.prototype.importFileAdded = function(dropzone, file, cart) {
- $(dropzone.getAcceptedFiles()).each(function(idx, elem) { dropzone.removeFile(elem); });
+Importer.prototype.importUpdateProgress = function(file, stats) {
+ if(file.upload.progress < 99) {
+ var bytes_str = Number((file.upload.bytesSent/1024)/1024).toFixed(1) + " von " +
+ Number((file.upload.total/1024)/1024).toFixed(1) + " MB";
+ stats.find('.file-bytes').text(bytes_str);
+ stats.find('.progress .bar').css("width", file.upload.progress + "%");
+ } else {
+ stats.find('.file-bytes').text('importiere...');
+ stats.find('.progress .bar').css('width', '100%');
+ stats.find('.progress').addClass('progress-striped').addClass('active');
+ }
+};
- var uploadModal = $('#uploadModal');
- $('div.modal-body', uploadModal).css("background-image", "url('/img/audio_file.png')");
- $('div.modal-header h3', uploadModal).text(file.name);
- var self = this;
- $('#uploadModal-confirm', uploadModal).unbind('click').click(function() {
- self.importCartConfirm(cart, dropzone);
- }).removeAttr('disabled');
+Importer.prototype.importFileUploadSuccess = function(cart, dz, file) {
+ //var command = { LOGIN_NAME: auth_username, PASSWORD: auth_token, DESCRIPTION: file. };
+
+ //jingles_updateGroupCartInfo(cart);
+ dz.disable();
+ $(cart).trigger('add');
};
-Importer.prototype.importFileSelectError = function(dropzone, file, msg) {
- var uploadModal = $('#uploadModal');
- $('div.modal-header h3', uploadModal).text("Datei auswählen...");
- $('div.modal-body', uploadModal).css("background-image", "url('/img/dz-backdrop.png')");
- $('#uploadModal-confirm', uploadModal).attr('disabled','disabled').unbind('click');
- dropzone.removeFile(file);
+Importer.prototype.importFileUploadError = function(cart, dz, file, msg, xhr) {
+ //var error_row = jingles_newImportErrorEntry(cart, msg);
+ //error_row.find('button').unbind('click').click(function() {
+ //jingles_deleteCart(cart);
+ //});
+ //$('#show-cart-' + cart).replaceWith(error_row);
+ //error_row.find('.file-name').text(file.name);
+ dz.disable();
};
-Importer.prototype.showUploadModal = function(cart) {
- var uploadModal = $('#uploadModal');
- $('div.modal-header h3', uploadModal).text("Datei auswählen...");
- var form = $('<form>');
- $('.modal-body', uploadModal).empty().append(form).css("background-image", "url('/img/dz-backdrop.png')");
- var self = this;
- var dropzone = form.dropzone({
- url: '/rd-bin/rdxport.cgi',
- parallelUploads: 1,
- maxFilesize: 2048,
- paramName: 'FILENAME',
- uploadMultiple: false, // todo: maybe enable this?
- clickable: true,
- createImageThumbnails: false,
- acceptedFiles: '.flac,.wav,.ogg,.mp3',
- autoProcessQueue: false,
- init: function() {
- this.on("addedfile", function(file) {
- self.importFileAdded(this, file, cart);
- });
- this.on("error", function(file, msg) {
- self.importFileSelectError(this, file, msg);
- });
- }
+Importer.prototype.importAddCut = function(cart, dz, file) {
+ // todo: set additional parameters like DESCRIPTION here, when patch has been applied.
+ rivendell.addCut(cart.number, function(cutXml) {
+ var cutNumber = $(cutXml).find('cutNumber').text();
+ dz.on('sending', function(file, xhr, formData) {
+ formData.append('COMMAND', 2);
+ formData.append('LOGIN_NAME', auth_username);
+ formData.append('PASSWORD', auth_token);
+ formData.append('CART_NUMBER', cart.number);
+ formData.append('CUT_NUMBER', cutNumber);
+ formData.append('CHANNELS', 2);
+ formData.append('NORMALIZATION_LEVEL', cart.normlevel);
+ formData.append('AUTOTRIM_LEVEL', cart.trimlevel);
+ formData.append('USE_METADATA', 1);
+ });
+ dz.processQueue();
+ }).fail(function(xhr, status, err) {
+ self.importFileUploadError(cart, dz, file, err, xhr);
});
+};
- $('#uploadModal').modal({keyboard: true});
+Importer.prototype.importCartCancel = function(cart, dz) {
+ this.deleteCart(cart);
+ dz.off("error");
+ dz.disable();
};