From 6e3d73e6129bff1bf6e3c2dfb0b273e25d291cbe Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 12 Mar 2016 20:03:23 +0100 Subject: better json lib for perl diff --git a/README b/README index 9ed0d88..9e2e974 100644 --- a/README +++ b/README @@ -31,7 +31,7 @@ LICENSE Installation ============ -# sudo aptitude install apache2 libapache2-mpm-itk libapache2-mod-perl2 libconfig-inifiles-perl libdbd-mysql-perl libjson-pp-perl libxml-quote-perl librhrd-perl libjs-jquery libjs-bootstrap rivendell-server +# sudo aptitude install apache2 libapache2-mpm-itk libapache2-mod-perl2 libconfig-inifiles-perl libdbd-mysql-perl libjson-any-perl libxml-quote-perl librhrd-perl libjs-jquery libjs-bootstrap rivendell-server # sudo a2enmod ssl authnz_ldap perl proxy_wstunnel # sudo /etc/init.d/apache2 restart -- cgit v0.10.2 From 1b1e7df2067769dfcd7c2e01dd35e3d68b7a0bf1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 23 Mar 2016 17:31:42 +0100 Subject: removed indirect deps diff --git a/README b/README index 9e2e974..e076a7e 100644 --- a/README +++ b/README @@ -31,7 +31,7 @@ LICENSE Installation ============ -# sudo aptitude install apache2 libapache2-mpm-itk libapache2-mod-perl2 libconfig-inifiles-perl libdbd-mysql-perl libjson-any-perl libxml-quote-perl librhrd-perl libjs-jquery libjs-bootstrap rivendell-server +# sudo aptitude install apache2 libapache2-mpm-itk libapache2-mod-perl2 libjson-any-perl libxml-quote-perl librhrd-perl libjs-jquery libjs-bootstrap rivendell-server # sudo a2enmod ssl authnz_ldap perl proxy_wstunnel # sudo /etc/init.d/apache2 restart -- cgit v0.10.2 From 6d97994a199e2cf180321c5bc7c3e1282ef477cc Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 23 Mar 2016 20:38:14 +0100 Subject: fixed utf8 output for authtoken diff --git a/rh-bin/authtoken.json b/rh-bin/authtoken.json index 7b2fdba..9e4c332 100755 --- a/rh-bin/authtoken.json +++ b/rh-bin/authtoken.json @@ -59,4 +59,4 @@ $answer{'token'} = $token; print "Content-type: application/json; charset=UTF-8\n"; print "Status: $responsecode\n\n"; -print encode_json \%answer; +print JSON->new->encode(\%answer); -- cgit v0.10.2 From 2396977fd57fee58eec84ce0ac6fc91b1b0d1dc9 Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Thu, 24 Mar 2016 17:00:07 +0100 Subject: shows: fix renderUploading diff --git a/www/js/importer.js b/www/js/importer.js index 5f7db6f..cba7d23 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -113,6 +113,26 @@ Rivendell.Importer.prototype.removeUpload = function(upload) { }); }; +Rivendell.Importer.prototype.getUploadByCartId = function (cartNumber) { + var upload = null; + $.each(this.uploads, function(index, currentUpload){ + if (currentUpload.newCartNumber === cartNumber) { + upload = currentUpload; + } + }); + return upload; +}; + +Rivendell.Importer.prototype.hasUploadByCartId = function (cartNumber) { + var found = false; + $.each(this.uploads, function(index, currentUpload){ + if (currentUpload.newCartNumber === cartNumber) { + found = true; + } + }); + return found; +}; + Rivendell.Upload = function(group, groupView, createCart, newCartNumber, useMetadata, dropzone) { this.group = group; this.groupView = groupView; @@ -121,6 +141,11 @@ Rivendell.Upload = function(group, groupView, createCart, newCartNumber, useMeta this.useMetadata = useMetadata; this.dropzone = dropzone; + this.uploadprogress = { + progress: 0, + total: 0, + bytesSent: 0 + }; this.cart = null; this.cut = null; @@ -158,6 +183,7 @@ Rivendell.Upload.prototype.import = function() { var self = this; this.dropzone.off('uploadprogress').on('uploadprogress', function(file) { + self.uploadprogress = file.upload; self.groupView.uploadProgress(self, file); }); this.dropzone.off(Dropzone.SUCCESS).on(Dropzone.SUCCESS, function(file) { diff --git a/www/js/shows.js b/www/js/shows.js index 1ba86b9..b910bdb 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -203,7 +203,12 @@ Rivendell.ShowView.prototype.render = function() { if (cart) { var cartView = new Rivendell.ShowCartView(cart, self); self.cartViews.push(cartView); - cartView.render(); + var upload = null; + if ((upload = importer.getUploadByCartId(log.cartNumber)) !== null) { + cartView.renderUploading(upload); + } else { + cartView.render(); + } $('#app-shows table > tbody').append(cartView.$el); } else { @@ -230,11 +235,11 @@ Rivendell.ShowView.prototype.uploadProgress = function(upload, file) { $cart.addClass('uploading'); } - 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"; + if(upload.uploadprogress.progress < 99) { + var bytes_str = Number((upload.uploadprogress.bytesSent/1024)/1024).toFixed(1) + " von " + + Number((upload.uploadprogress.total/1024)/1024).toFixed(1) + " MB"; $cart.find('.file-bytes').text(bytes_str); - $cart.find('.progress .progress-bar').css("width", file.upload.progress + "%"); + $cart.find('.progress .progress-bar').css("width", upload.uploadprogress.progress + "%"); } else { $cart.find('.file-bytes').text('importiere...'); $cart.find('.progress .progress-bar').css('width', '100%'); @@ -313,6 +318,32 @@ Rivendell.ShowCartView.prototype.render = function() { .append($('').css('text-align', 'center').append($deleteButton)); }; +Rivendell.ShowCartView.prototype.renderUploading = function(upload) { + var $progressBar = $('.progressBarTemplate.shows').clone().removeClass('progressBarTemplate'); + $('.file-name', $progressBar).text(this.model.title); + $('.cart-number', $progressBar).text(this.model.number); + + this.$el.empty() + .html($progressBar.html()) + .attr('id', 'show-cart-' + this.model.number) + .addClass('uploading'); + + $('button', this.$el).on('click', function() { + upload.cancel(); + }); + + if(upload.uploadprogress.progress < 99) { + var bytes_str = Number((upload.uploadprogress.bytesSent/1024)/1024).toFixed(1) + " von " + + Number((upload.uploadprogress.total/1024)/1024).toFixed(1) + " MB"; + this.$el.find('.file-bytes').text(bytes_str); + this.$el.find('.progress .progress-bar').css("width", upload.uploadprogress.progress + "%"); + } else { + this.$el.find('.file-bytes').text('importiere...'); + this.$el.find('.progress .progress-bar').css('width', '100%'); + this.$el.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active'); + } +}; + Rivendell.ShowCartView.renderEmpty = function(group, groupView, cartNumber) { var $uploadButton = $(''); -- cgit v0.10.2 From d67d45412f398b074d3cb2762d98c4139b0ab9bd Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Thu, 24 Mar 2016 17:58:34 +0100 Subject: jingles, musicpools: fix renderUploading diff --git a/www/js/apps.js b/www/js/apps.js index e25c7d1..6de7da3 100644 --- a/www/js/apps.js +++ b/www/js/apps.js @@ -136,7 +136,6 @@ function apps_init() { window.onbeforeunload = function(e) { if (importer && importer.isUploading()) { return 'Achtung: Es laufen noch imports.'; - return; } }; } diff --git a/www/js/importer.js b/www/js/importer.js index cba7d23..7e190f2 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -113,24 +113,28 @@ Rivendell.Importer.prototype.removeUpload = function(upload) { }); }; -Rivendell.Importer.prototype.getUploadByCartId = function (cartNumber) { +Rivendell.Importer.prototype.getUploadByCartNumber = function (cartNumber) { var upload = null; $.each(this.uploads, function(index, currentUpload){ - if (currentUpload.newCartNumber === cartNumber) { + if (currentUpload.cart !== null && + currentUpload.cart.number === cartNumber ) { upload = currentUpload; } }); return upload; }; -Rivendell.Importer.prototype.hasUploadByCartId = function (cartNumber) { - var found = false; - $.each(this.uploads, function(index, currentUpload){ - if (currentUpload.newCartNumber === cartNumber) { - found = true; +Rivendell.Importer.prototype.getUploadByCartAndCutNumber = function (cartNumber, cutNumber) { + var upload = null; + $.each(this.uploads, function(index, currentUpload) { + if (currentUpload.cart !== null && + currentUpload.cart.number === cartNumber && + currentUpload.cut !== null && + currentUpload.cut.number === cutNumber) { + upload = currentUpload; } }); - return found; + return upload; }; Rivendell.Upload = function(group, groupView, createCart, newCartNumber, useMetadata, dropzone) { diff --git a/www/js/jingles.js b/www/js/jingles.js index 4748df8..7910b97 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -135,16 +135,7 @@ Rivendell.JingleGroupView.prototype.uploadProgress = function(upload, file) { $cut.addClass('uploading'); } - 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"; - $cut.find('.file-bytes').text(bytes_str); - $cut.find('.progress .progress-bar').css("width", file.upload.progress + "%"); - } else { - $cut.find('.file-bytes').text('importiere...'); - $cut.find('.progress .progress-bar').css('width', '100%'); - $cut.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active'); - } + updateProgressBar($cut, upload); }; Rivendell.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { @@ -208,7 +199,12 @@ Rivendell.JingleCutView = function(model) { this.$spinner = null; this.$el = null; - this.render(); + var upload = null; + if ((upload = importer.getUploadByCartAndCutNumber(this.model.cartNumber, this.model.number)) !== null) { + this.renderUploading(upload); + } else { + this.render(); + } }; Rivendell.JingleCutView.prototype.render = function() { @@ -259,6 +255,23 @@ Rivendell.JingleCutView.prototype.render = function() { ); }; +Rivendell.JingleCutView.prototype.renderUploading = function(upload) { + var $progressBar = $('.progressBarTemplate.jingles').clone().removeClass('progressBarTemplate'); + $('.file-name', $progressBar).text(this.model.name); + $('.cart-number', $progressBar).text(this.model.number); + + this.$el = $('') + .attr('id', 'jingle-' + this.model.cartNumber + '-' + this.model.number) + .html($progressBar.html()) + .addClass('uploading'); + + $('button', this.$el).on('click', function() { + upload.cancel(); + }); + + updateProgressBar(this.$el, upload); +}; + Rivendell.JingleCutView.prototype.move = function() { this.$el.find('td:first').html(this.$spinner); var self = this; diff --git a/www/js/musicpools.js b/www/js/musicpools.js index 1a2c78d..01331f6 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -170,16 +170,7 @@ Rivendell.MusicpoolView.prototype.uploadProgress = function(upload, file) { $cart.addClass('uploading'); } - 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"; - $cart.find('.file-bytes').text(bytes_str); - $cart.find('.progress .progress-bar').css("width", file.upload.progress + "%"); - } else { - $cart.find('.file-bytes').text('importiere...'); - $cart.find('.progress .progress-bar').css('width', '100%'); - $cart.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active'); - } + updateProgressBar($cart, upload); }; Rivendell.MusicpoolView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { @@ -219,7 +210,12 @@ Rivendell.MusicpoolCartView = function(model) { this.$spinner = null; this.$el = null; - this.render(); + var upload = null; + if ((upload = importer.getUploadByCartNumber(this.model.number)) !== null) { + this.renderUploading(upload); + } else { + this.render(); + } }; Rivendell.MusicpoolCartView.prototype.render = function() { @@ -263,6 +259,23 @@ Rivendell.MusicpoolCartView.prototype.render = function() { .append($('').addClass('text-center').append(deleteButton)); }; +Rivendell.MusicpoolCartView.prototype.renderUploading = function(upload) { + var $progressBar = $('.progressBarTemplate.musicpools').clone().removeClass('progressBarTemplate'); + $('.file-name', $progressBar).text(this.model.title); + $('.cart-number', $progressBar).text(this.model.number); + + this.$el = $('') + .attr('id', 'musicpool-' + this.model.number) + .html($progressBar.html()) + .addClass('uploading'); + + $('button', this.$el).on('click', function() { + upload.cancel(); + }); + + updateProgressBar(this.$el, upload); +}; + Rivendell.MusicpoolCartView.prototype.delete = function() { this.$el.find('td:last').html(this.$spinner); diff --git a/www/js/shows.js b/www/js/shows.js index b910bdb..0e5c776 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -204,7 +204,7 @@ Rivendell.ShowView.prototype.render = function() { var cartView = new Rivendell.ShowCartView(cart, self); self.cartViews.push(cartView); var upload = null; - if ((upload = importer.getUploadByCartId(log.cartNumber)) !== null) { + if ((upload = importer.getUploadByCartNumber(log.cartNumber)) !== null) { cartView.renderUploading(upload); } else { cartView.render(); @@ -235,16 +235,7 @@ Rivendell.ShowView.prototype.uploadProgress = function(upload, file) { $cart.addClass('uploading'); } - if(upload.uploadprogress.progress < 99) { - var bytes_str = Number((upload.uploadprogress.bytesSent/1024)/1024).toFixed(1) + " von " + - Number((upload.uploadprogress.total/1024)/1024).toFixed(1) + " MB"; - $cart.find('.file-bytes').text(bytes_str); - $cart.find('.progress .progress-bar').css("width", upload.uploadprogress.progress + "%"); - } else { - $cart.find('.file-bytes').text('importiere...'); - $cart.find('.progress .progress-bar').css('width', '100%'); - $cart.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active'); - } + updateProgressBar($cart, upload); }; Rivendell.ShowView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { @@ -324,6 +315,7 @@ Rivendell.ShowCartView.prototype.renderUploading = function(upload) { $('.cart-number', $progressBar).text(this.model.number); this.$el.empty() + .attr('id', 'show-cart-' + this.model.number) .html($progressBar.html()) .attr('id', 'show-cart-' + this.model.number) .addClass('uploading'); @@ -332,16 +324,7 @@ Rivendell.ShowCartView.prototype.renderUploading = function(upload) { upload.cancel(); }); - if(upload.uploadprogress.progress < 99) { - var bytes_str = Number((upload.uploadprogress.bytesSent/1024)/1024).toFixed(1) + " von " + - Number((upload.uploadprogress.total/1024)/1024).toFixed(1) + " MB"; - this.$el.find('.file-bytes').text(bytes_str); - this.$el.find('.progress .progress-bar').css("width", upload.uploadprogress.progress + "%"); - } else { - this.$el.find('.file-bytes').text('importiere...'); - this.$el.find('.progress .progress-bar').css('width', '100%'); - this.$el.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active'); - } + updateProgressBar(this.$el, upload); }; Rivendell.ShowCartView.renderEmpty = function(group, groupView, cartNumber) { diff --git a/www/js/utils.js b/www/js/utils.js index fab6736..97f06e7 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -140,3 +140,16 @@ jQuery.fn.brightness = function() { if (this.parent().length) return this.parent().brightness(); } }; + +function updateProgressBar($el, upload) { + if(upload.uploadprogress.progress < 99) { + var bytes_str = Number((upload.uploadprogress.bytesSent/1024)/1024).toFixed(1) + " von " + + Number((upload.uploadprogress.total/1024)/1024).toFixed(1) + " MB"; + $el.find('.file-bytes').text(bytes_str); + $el.find('.progress .progress-bar').css("width", upload.uploadprogress.progress + "%"); + } else { + $el.find('.file-bytes').text('importiere...'); + $el.find('.progress .progress-bar').css('width', '100%'); + $el.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active'); + } +} -- cgit v0.10.2