hide excessive logging with a trace flag
This commit is contained in:
parent
17337b22af
commit
715846626e
2 changed files with 26 additions and 23 deletions
|
@ -72,7 +72,7 @@ OC.Upload = {
|
|||
* cancels all uploads
|
||||
*/
|
||||
cancelUploads:function() {
|
||||
console.log('canceling uploads');
|
||||
this.log('canceling uploads');
|
||||
jQuery.each(this._uploads,function(i, jqXHR){
|
||||
jqXHR.abort();
|
||||
});
|
||||
|
@ -135,7 +135,7 @@ OC.Upload = {
|
|||
* @param data data
|
||||
*/
|
||||
onSkip:function(data){
|
||||
this.logStatus('skip', null, data);
|
||||
this.log('skip', null, data);
|
||||
this.deleteUpload(data);
|
||||
},
|
||||
/**
|
||||
|
@ -143,7 +143,7 @@ OC.Upload = {
|
|||
* @param data data
|
||||
*/
|
||||
onReplace:function(data){
|
||||
this.logStatus('replace', null, data);
|
||||
this.log('replace', null, data);
|
||||
data.data.append('resolution', 'replace');
|
||||
data.submit();
|
||||
},
|
||||
|
@ -152,7 +152,7 @@ OC.Upload = {
|
|||
* @param data data
|
||||
*/
|
||||
onAutorename:function(data){
|
||||
this.logStatus('autorename', null, data);
|
||||
this.log('autorename', null, data);
|
||||
if (data.data) {
|
||||
data.data.append('resolution', 'autorename');
|
||||
} else {
|
||||
|
@ -160,9 +160,12 @@ OC.Upload = {
|
|||
}
|
||||
data.submit();
|
||||
},
|
||||
logStatus:function(caption, e, data) {
|
||||
_trace:false, //TODO implement log handler for JS per class?
|
||||
log:function(caption, e, data) {
|
||||
if (this._trace) {
|
||||
console.log(caption);
|
||||
console.log(data);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* TODO checks the list of existing files prior to uploading and shows a simple dialog to choose
|
||||
|
@ -207,7 +210,7 @@ $(document).ready(function() {
|
|||
* @returns {Boolean}
|
||||
*/
|
||||
add: function(e, data) {
|
||||
OC.Upload.logStatus('add', e, data);
|
||||
OC.Upload.log('add', e, data);
|
||||
var that = $(this);
|
||||
|
||||
// we need to collect all data upload objects before starting the upload so we can check their existence
|
||||
|
@ -300,7 +303,7 @@ $(document).ready(function() {
|
|||
* @param e
|
||||
*/
|
||||
start: function(e) {
|
||||
OC.Upload.logStatus('start', e, null);
|
||||
OC.Upload.log('start', e, null);
|
||||
},
|
||||
submit: function(e, data) {
|
||||
OC.Upload.rememberUpload(data);
|
||||
|
@ -313,7 +316,7 @@ $(document).ready(function() {
|
|||
}
|
||||
},
|
||||
fail: function(e, data) {
|
||||
OC.Upload.logStatus('fail', e, data);
|
||||
OC.Upload.log('fail', e, data);
|
||||
if (typeof data.textStatus !== 'undefined' && data.textStatus !== 'success' ) {
|
||||
if (data.textStatus === 'abort') {
|
||||
$('#notification').text(t('files', 'Upload cancelled.'));
|
||||
|
@ -335,7 +338,7 @@ $(document).ready(function() {
|
|||
* @param data
|
||||
*/
|
||||
done:function(e, data) {
|
||||
OC.Upload.logStatus('done', e, data);
|
||||
OC.Upload.log('done', e, data);
|
||||
// handle different responses (json or body from iframe for ie)
|
||||
var response;
|
||||
if (typeof data.result === 'string') {
|
||||
|
@ -373,7 +376,7 @@ $(document).ready(function() {
|
|||
* @param data
|
||||
*/
|
||||
stop: function(e, data) {
|
||||
OC.Upload.logStatus('stop', e, data);
|
||||
OC.Upload.log('stop', e, data);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -385,7 +388,7 @@ $(document).ready(function() {
|
|||
|
||||
// add progress handlers
|
||||
fileupload.on('fileuploadadd', function(e, data) {
|
||||
OC.Upload.logStatus('progress handle fileuploadadd', e, data);
|
||||
OC.Upload.log('progress handle fileuploadadd', e, data);
|
||||
//show cancel button
|
||||
//if(data.dataType !== 'iframe') { //FIXME when is iframe used? only for ie?
|
||||
// $('#uploadprogresswrapper input.stop').show();
|
||||
|
@ -393,29 +396,29 @@ $(document).ready(function() {
|
|||
});
|
||||
// add progress handlers
|
||||
fileupload.on('fileuploadstart', function(e, data) {
|
||||
OC.Upload.logStatus('progress handle fileuploadstart', e, data);
|
||||
OC.Upload.log('progress handle fileuploadstart', e, data);
|
||||
$('#uploadprogresswrapper input.stop').show();
|
||||
$('#uploadprogressbar').progressbar({value:0});
|
||||
$('#uploadprogressbar').fadeIn();
|
||||
});
|
||||
fileupload.on('fileuploadprogress', function(e, data) {
|
||||
OC.Upload.logStatus('progress handle fileuploadprogress', e, data);
|
||||
OC.Upload.log('progress handle fileuploadprogress', e, data);
|
||||
//TODO progressbar in row
|
||||
});
|
||||
fileupload.on('fileuploadprogressall', function(e, data) {
|
||||
OC.Upload.logStatus('progress handle fileuploadprogressall', e, data);
|
||||
OC.Upload.log('progress handle fileuploadprogressall', e, data);
|
||||
var progress = (data.loaded / data.total) * 100;
|
||||
$('#uploadprogressbar').progressbar('value', progress);
|
||||
});
|
||||
fileupload.on('fileuploadstop', function(e, data) {
|
||||
OC.Upload.logStatus('progress handle fileuploadstop', e, data);
|
||||
OC.Upload.log('progress handle fileuploadstop', e, data);
|
||||
|
||||
$('#uploadprogresswrapper input.stop').fadeOut();
|
||||
$('#uploadprogressbar').fadeOut();
|
||||
|
||||
});
|
||||
fileupload.on('fileuploadfail', function(e, data) {
|
||||
OC.Upload.logStatus('progress handle fileuploadfail', e, data);
|
||||
OC.Upload.log('progress handle fileuploadfail', e, data);
|
||||
//if user pressed cancel hide upload progress bar and cancel button
|
||||
if (data.errorThrown === 'abort') {
|
||||
$('#uploadprogresswrapper input.stop').fadeOut();
|
||||
|
|
|
@ -652,7 +652,7 @@ $(document).ready(function(){
|
|||
var file_upload_start = $('#file_upload_start');
|
||||
|
||||
file_upload_start.on('fileuploaddrop', function(e, data) {
|
||||
OC.Upload.logStatus('filelist handle fileuploaddrop', e, data);
|
||||
OC.Upload.log('filelist handle fileuploaddrop', e, data);
|
||||
|
||||
var dropTarget = $(e.originalEvent.target).closest('tr');
|
||||
if(dropTarget && dropTarget.data('type') === 'dir') { // drag&drop upload to folder
|
||||
|
@ -681,7 +681,7 @@ $(document).ready(function(){
|
|||
|
||||
});
|
||||
file_upload_start.on('fileuploadadd', function(e, data) {
|
||||
OC.Upload.logStatus('filelist handle fileuploadadd', e, data);
|
||||
OC.Upload.log('filelist handle fileuploadadd', e, data);
|
||||
|
||||
//finish delete if we are uploading a deleted file
|
||||
if(FileList.deleteFiles && FileList.deleteFiles.indexOf(data.files[0].name)!==-1){
|
||||
|
@ -715,7 +715,7 @@ $(document).ready(function(){
|
|||
* update counter when uploading to sub folder
|
||||
*/
|
||||
file_upload_start.on('fileuploaddone', function(e, data) {
|
||||
OC.Upload.logStatus('filelist handle fileuploaddone', e, data);
|
||||
OC.Upload.log('filelist handle fileuploaddone', e, data);
|
||||
|
||||
var response;
|
||||
if (typeof data.result === 'string') {
|
||||
|
@ -781,7 +781,7 @@ $(document).ready(function(){
|
|||
}
|
||||
});
|
||||
file_upload_start.on('fileuploadstop', function(e, data) {
|
||||
OC.Upload.logStatus('filelist handle fileuploadstop', e, data);
|
||||
OC.Upload.log('filelist handle fileuploadstop', e, data);
|
||||
|
||||
//if user pressed cancel hide upload chrome
|
||||
if (data.errorThrown === 'abort') {
|
||||
|
@ -794,7 +794,7 @@ $(document).ready(function(){
|
|||
}
|
||||
});
|
||||
file_upload_start.on('fileuploadfail', function(e, data) {
|
||||
OC.Upload.logStatus('filelist handle fileuploadfail', e, data);
|
||||
OC.Upload.log('filelist handle fileuploadfail', e, data);
|
||||
|
||||
//if user pressed cancel hide upload chrome
|
||||
if (data.errorThrown === 'abort') {
|
||||
|
|
Loading…
Reference in a new issue