person.js 3.23 KB
function c_person (personId, photographerId, ownerId, firstname, surname,
	company, email, url, cameraId, wmWidth, wmHeight, wmXPos, wmYPos)
{
	this.personId       = this._personId       = personId;
	this.photographerId = this._photographerId = photographerId;
	this.ownerId        = this._ownerId        = ownerId;
	this.firstname      = this._firstname      = firstname;
	this.surname        = this._surname        = surname;
	this.company        = this._company        = company;
	this.email          = this._company        = email;
	this.url            = this._url            = url;
	this.cameraId       = this._cameraId       = cameraId;
	this.wmWidth        = this._wmWidth        = wmWidth;
	this.wmHeight       = this._wmHeight       = wmHeight;
	this.wmXPos         = this._wmXPos         = wmXPos;
	this.wmYPos         = this._wmYPos         = wmYPos;

	this.personForm = null;

	this.connect = function (personForm)
	{
		this.personForm = personForm;
	}

	this.empty = function ()
	{
		if (this.personId != -1)
		{
			this.personId       = this._personId       = -1;
			this.photographerId = this._photographerId = -1;
			this.ownerId        = this._ownerId        = -1;
			this.firstname      = this._firstname      = '';
			this.surname        = this._surname        = '';
			this.company        = this._company        = '';
			this.email          = this._email          = '';
			this.url            = this._url            = '';
			this.cameraId       = this._cameraId       = -1;
			this.wmWidth        = this._wmWidth        = '';
			this.wmHeight       = this._wmHeight       = '';
			this.wmXPos         = this._wmXPos         = '';
			this.wmYPos         = this._wmYPos         = '';

			if (this.personForm != null)
				this.personForm.updateForm ();
		}
	}

	this.reset = function ()
	{
		this.personId       = this._personId;
		this.photographerId = this._photographerId;
		this.ownerId        = this._ownerId;
		this.firstname      = this._firstname;
		this.surname        = this._surname;
		this.company        = this._company;
		this.email          = this._email;
		this.url            = this._url;
		this.cameraId       = this._cameraId;
		this.wmWidth        = this._wmWidth;
		this.wmHeight       = this._wmHeight;
		this.wmXPos         = this._wmXPos;
		this.wmYPos         = this._wmYPos;

		if (this.personForm != null)
			this.personForm.updateForm ();
	}

	this.update = function (p)
	{
		if (this.personId != p.personId)
		{
			this.personId       = this._personId       = p.personId;
			this.photographerId = this._photographerId = p.photographerId;
			this.ownerId        = this._ownerId        = p.ownerId;
			this.firstname      = this._firstname      = p.firstname;
			this.surname        = this._surname        = p.surname;
			this.company        = this._company        = p.company;
			this.email          = this._email          = p.email;
			this.url            = this._url            = p.url;
			this.cameraId       = this._cameraId       = p.cameraId;
			this.wmWidth        = this._wmWidth        = p.wmWidth;
			this.wmHeight       = this._wmHeight       = p.wmHeight;
			this.wmXPos         = this._wmXPos         = p.wmXPos;
			this.wmYPos         = this._wmYPos         = p.wmYPos;

			if (this.personForm != null)
				this.personForm.updateForm ();
		}
	}
}