Make changes to fix printing
This commit is contained in:
parent
ff7217c38c
commit
62803f0e13
|
@ -24,9 +24,9 @@
|
||||||
</documentation>
|
</documentation>
|
||||||
<category>files</category>
|
<category>files</category>
|
||||||
<category>tools</category>
|
<category>tools</category>
|
||||||
<website>https://github.com/westberliner/owncloud-checksum/</website>
|
<website>https://github.com/e.alfred/nextcloud-printer/</website>
|
||||||
<bugs>https://github.com/westberliner/owncloud-checksum/issues</bugs>
|
<bugs>https://github.com/westberliner/nextcloud-printer/issues</bugs>
|
||||||
<screenshot>https://raw.githubusercontent.com/westberliner/owncloud-checksum/master/screenshots/checksum.gif</screenshot>
|
<screenshot>https://raw.githubusercontent.com/e-alfred/nextcloud-printer/master/screenshots/print.gif</screenshot>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="14" max-version="17" />
|
<nextcloud min-version="14" max-version="17" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -32,21 +32,17 @@
|
||||||
this._renderSelectList(this.$el);
|
this._renderSelectList(this.$el);
|
||||||
|
|
||||||
this.delegateEvents({
|
this.delegateEvents({
|
||||||
'change #choose-algorithm': '_onChangeEvent'
|
'change #choose-orientation': '_onChangeEvent'
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderSelectList: function($el) {
|
_renderSelectList: function($el) {
|
||||||
$el.html('<div class="get-checksum">'
|
$el.html('<div class="get-print">'
|
||||||
+ '<select id="choose-algorithm">'
|
+ '<select id="choose-orientation">'
|
||||||
+ '<option value="">' + t('checksum', 'Choose Algorithm') + '</option>'
|
+ '<option value="">' + t('printer', 'Choose orientation') + '</option>'
|
||||||
+ '<option value="md5">MD5</option>'
|
+ '<option value="landscape">Landscape</option>'
|
||||||
+ '<option value="sha1">SHA1</option>'
|
+ '<option value="portrait">Portrait</option>'
|
||||||
+ '<option value="sha256">SHA256</option>'
|
|
||||||
+ '<option value="sha384">SHA384</option>'
|
|
||||||
+ '<option value="sha512">SHA512</option>'
|
|
||||||
+ '<option value="crc32">CRC32</option>'
|
|
||||||
+ '</select></div>'
|
+ '</select></div>'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -68,7 +64,7 @@
|
||||||
/**
|
/**
|
||||||
* ajax callback for generating md5 hash
|
* ajax callback for generating md5 hash
|
||||||
*/
|
*/
|
||||||
check: function(fileInfo, algorithmType) {
|
check: function(fileInfo, orientation) {
|
||||||
// skip call if fileInfo is null
|
// skip call if fileInfo is null
|
||||||
if(null == fileInfo) {
|
if(null == fileInfo) {
|
||||||
_self.updateDisplay({
|
_self.updateDisplay({
|
||||||
|
@ -80,7 +76,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = OC.generateUrl('/apps/printer/printfile'),
|
var url = OC.generateUrl('/apps/printer/printfile'),
|
||||||
data = {source: fileInfo.getFullPath(), type: algorithmType},
|
data = {source: fileInfo.getFullPath(), type: orientation},
|
||||||
_self = this;
|
_self = this;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
@ -89,7 +85,7 @@
|
||||||
data: data,
|
data: data,
|
||||||
async: true,
|
async: true,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
_self.updateDisplay(data, algorithmType);
|
_self.updateDisplay(data, orientation);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -98,11 +94,11 @@
|
||||||
/**
|
/**
|
||||||
* display message from ajax callback
|
* display message from ajax callback
|
||||||
*/
|
*/
|
||||||
updateDisplay: function(data, algorithmType) {
|
updateDisplay: function(data, orientation) {
|
||||||
|
|
||||||
var msg = '';
|
var msg = '';
|
||||||
if('success' == data.response) {
|
if('success' == data.response) {
|
||||||
msg = algorithmType + ': ' + data.msg;
|
msg = orientation + ': ' + data.msg;
|
||||||
}
|
}
|
||||||
if('error' == data.response) {
|
if('error' == data.response) {
|
||||||
msg = data.msg;
|
msg = data.msg;
|
||||||
|
@ -114,7 +110,7 @@
|
||||||
'click #reload-checksum': '_onReloadEvent'
|
'click #reload-checksum': '_onReloadEvent'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$el.find('.get-checksum').html(msg);
|
this.$el.find('.get-print').html(msg);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -122,14 +118,14 @@
|
||||||
* changeHandler
|
* changeHandler
|
||||||
*/
|
*/
|
||||||
_onChangeEvent: function(ev) {
|
_onChangeEvent: function(ev) {
|
||||||
var algorithmType = $(ev.currentTarget).val();
|
var orientation = $(ev.currentTarget).val();
|
||||||
if(algorithmType != '') {
|
if(orientation != '') {
|
||||||
this.$el.html('<div style="text-align:center; word-wrap:break-word;" class="get-checksum"><p><img src="'
|
this.$el.html('<div style="text-align:center; word-wrap:break-word;" class="get-print"><p><img src="'
|
||||||
+ OC.imagePath('core','loading.gif')
|
+ OC.imagePath('core','loading.gif')
|
||||||
+ '"><br><br></p><p>'
|
+ '"><br><br></p><p>'
|
||||||
+ t('printer', 'Printing document ...')
|
+ t('printer', 'Printing document ...')
|
||||||
+ '</p></div>');
|
+ '</p></div>');
|
||||||
this.check(this.getFileInfo(), algorithmType);
|
this.check(this.getFileInfo(), orientation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue