AnonSec Team
Server IP : 10.2.73.233  /  Your IP : 216.73.216.59
Web Server : Apache/2.4.59 (Debian)
System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : www-data ( 33)
PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0777) :  /home/ifk/web/assets/54b90d07/prado/activefileupload/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/ifk/web/assets/54b90d07/prado/activefileupload/activefileupload.js
Prado.WebUI.TActiveFileUpload = Class.create(Prado.WebUI.Control,
{
	onInit : function(options)
	{
		this.options = options || {};
		Prado.WebUI.TActiveFileUpload.register(this);
		
		this.input = $(options.inputID);
		this.flag = $(options.flagID);
		this.form = $(options.formID);
		
		this.indicator = $(options.indicatorID);
		this.complete = $(options.completeID);
		this.error = $(options.errorID);
		
		// set up events
		if (options.autoPostBack){
			this.observe(this.input,"change",this.fileChanged.bind(this));
		}
	},
	
	fileChanged : function(){
		// show the upload indicator, and hide the complete and error indicators (if they areSn't already).
		this.flag.value = '1';
		this.complete.style.display = 'none';
		this.error.style.display = 'none';
		this.indicator.style.display = '';

		// set the form to submit in the iframe, submit it, and then reset it.
		this.oldtargetID = this.form.target;
		this.oldFormAction = this.form.action;
		this.oldFormMethod = this.form.method;
		this.oldFormEnctype = this.form.enctype;

		this.form.action += (this.form.action.indexOf('?')!=-1 ? '&' : '?')+'TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_TargetId='+this.options.targetID;
		this.form.target = this.options.targetID;
		this.form.method = 'POST';
		this.form.enctype = 'multipart/form-data';
		this.form.submit();

		this.form.action = this.oldFormAction;
		this.form.target = this.oldtargetID;
		this.form.method = this.oldFormMethod;
		this.form.enctype = this.oldFormEnctype;
	},
	
	finishUpload : function(options){

		if (this.options.targetID == options.targetID)
         		{
				this.finishoptions = options;
         			var e = this;
         			var callback =
         			{
         				'CallbackParameter' : options || '',
         				'onSuccess' : function() { e.finishCallBack(true); },
					'onFailure' : function() { e.finishCallBack(false); }
         			};

         			Object.extend(callback, this.options);

         			var request = new Prado.CallbackRequest(this.options.EventTarget, callback);
         			request.dispatch();
         		}
		else
			this.finishCallBack(true);

	},

	finishCallBack : function(success){
		// hide the display indicator.
		this.flag.value = '';
		this.indicator.style.display = 'none';
       		// show the complete indicator.
       		if ((this.finishoptions.errorCode == 0) && (success)) {
       			this.complete.style.display = '';
       			this.input.value = '';
       		} else {
       			this.error.style.display = '';
       		}
	}

});

Object.extend(Prado.WebUI.TActiveFileUpload, 
{
	//class methods

	controls : {},

	register : function(control)
	{
		Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control;
	},
	
	onFileUpload : function(options)
	{
		Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options);
	},
	
	fileChanged : function(controlID){
		Prado.WebUI.TActiveFileUpload.controls[controlID].fileChanged();
	}
});

AnonSec - 2021