From e01b75c00b55baea236a3b8a73b49ea646aa8726 Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Thu, 15 Sep 2016 19:03:33 +0200 Subject: implement archive upload datepicker. diff --git a/www/index.html b/www/index.html index b8fb88c..5395fc2 100644 --- a/www/index.html +++ b/www/index.html @@ -110,7 +110,7 @@
coming ~soon~.
- +
diff --git a/www/js/importer.js b/www/js/importer.js index 42cb174..5d047ef 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -30,6 +30,7 @@ Rdxport.Importer = function(username, token, rhimpordEndpoint) { this.rhimpordEndpoint = rhimpordEndpoint; this.$el = $('#uploadModal'); + this.$datepicker = null; this.listWebSocket = null; this.sessions = []; this.uploads = []; @@ -144,12 +145,15 @@ Rdxport.Importer.prototype.resetModal = function() { $('.nav-tabs li:first', this.$el).addClass('active'); $('.upload-tabs > div', self.$el).hide(); $('.upload-tabs div:first', self.$el).show(); + if (this.$datepicker) { + this.$datepicker.datepicker('remove'); + } }; Rdxport.Importer.prototype.openModal = function(group, groupView, cartNumber, useMetadata, multifiles) { this.resetModal(); - var $datepicker = $('.datepicker', this.$el).datepicker({ + this.$datepicker = $('.datepicker', this.$el).datepicker({ format: "dd.mm.yyyy", language: "de", startDate: '01/07/2014', @@ -168,10 +172,22 @@ Rdxport.Importer.prototype.openModal = function(group, groupView, cartNumber, us $('.upload-tabs .tab-' + tabName, self.$el).show(); $('#uploadModal-confirm', this.$el).attr('disabled','disabled').off('click'); if (tabName === 'archive') { - /*$('#uploadModal-confirm', this.$el).removeAttr('disabled').on('click', function() { - var date = $datepicker.datepicker('getDate') + self.$datepicker.on('changeDate', function() { + $('#uploadModal-confirm', this.$el).removeAttr('disabled').off().on('click', function() { + var date = self.$datepicker.datepicker('getDate'); + var spinnerVal = $spinner.val().split(':'); + var hours = spinnerVal[0]; + date.setHours(hours); + var sourceUri = dateToArchiveUri(date); + + var upload = new Rdxport.Upload(sourceUri, group, groupView, cartNumber, useMetadata); + upload.import(); + self.uploads.push(upload); - });*/ + self.$el.off('hide.bs.modal'); + self.$el.modal('hide'); + }); + }); } }); diff --git a/www/js/utils.js b/www/js/utils.js index e672570..a5629b2 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -44,6 +44,14 @@ Number.prototype.pad = function(size) { return s; }; +var dateToArchiveUri = function(date) { + return 'archiv://' + date.getFullYear().pad(4) + + '/' + (date.getMonth() + 1).pad(2) + + '/' + date.getDate().pad(2) + + '/' + date.getHours().pad(2) + + '/' + date.getMinutes().pad(2); +}; + var weekday = new Array(7); weekday[0] = 'Sonntag'; weekday[1] = 'Montag'; -- cgit v0.10.2