1 Reply Latest reply on Sep 17, 2008 5:55 AM by ilya_shaikovsky

    extending fileupload progress label

    reinhard.graf

      hi,

      I want to extend the fileupload progress label with values for
      upload speed and remaining time.
      I unpacked the richfaces-ui-3.2.1.GA.jar and added some code
      to fileUpload.js but without success.

      ProgressData = Class.create();
      Object.extend(ProgressData.prototype, {
       size: null,
      
       startTime: null,
      
       initialize: function(size) {
       this.size = size;
       this.startTime = parseInt((new Date().getTime())/1000);
       },
      
       ss: function () {
       return parseInt((this.time - this.startTime) % 60) + "";
       },
      
       mm: function () {
       return parseInt((this.time - this.startTime)/60)+ "";
       },
      
       hh: function () {
       return parseInt((this.time - this.startTime)/3600) + "";
       },
      
       B: function () {
       return this.size;
       },
      
       KB: function () {
       alert('KB');
       return parseInt(this.size/1024);
       },
      
       MB: function () {
       return parseInt(this.size/(1024*1024));
       },
      
       BW: function () {
       return parseInt(this.()/(this.time-this.startTime));
       },
      
       getContext: function (p) {
       var context = {};
       this.time = parseInt((new Date().getTime())/1000);
       context['B'] = this.B();
       context['KB'] = this.KB();
       context['MB'] = this.MB();
       context['ss'] = this.ss();
       context['mm'] = this.mm();
       context['hh'] = this.hh();
       var s = this.size;
       this.size = (this.size * p)/100;
       context['_B'] = this.B();
       context['_KB'] = this.KB();
       context['_MB'] = this.MB();
       context['BW'] = this.BW();
       this.size = s;
       return context;
       }
      
      });
      


      Can somebody tellm me what's wrong ?

      regards

      Reinhard