summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/importer.js24
-rw-r--r--www/js/utils.js8
2 files changed, 28 insertions, 4 deletions
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';