summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPeter Grassberger <petertheone@gmail.com>2016-09-15 17:03:33 (GMT)
committerPeter Grassberger <petertheone@gmail.com>2016-09-15 17:03:33 (GMT)
commite01b75c00b55baea236a3b8a73b49ea646aa8726 (patch)
treea4a04f992c5c8ba82400ceb57304a57775149b70 /www
parent375417e2e35a7c14d2ce1fa1718a5572e16c1e74 (diff)
implement archive upload datepicker.
Diffstat (limited to 'www')
-rw-r--r--www/index.html2
-rw-r--r--www/js/importer.js24
-rw-r--r--www/js/utils.js8
3 files changed, 29 insertions, 5 deletions
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 @@
<div class="tab-archive">
coming ~soon~.
<div class="datepicker"></div>
- <input class="spinner" name="spinner" value="" />
+ <input class="spinner" name="spinner" value="" placeholder="00:00" />
</div>
<div class="tab-external">
<form>
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';