Uwd.System.User = function(data) {
	/* Array (
		[id] => 0
		[name] => cwa
		[password] => ae025a369be4128a85230137a5219a60
		[email] => cwa@uwd.ch
		[dateRegister] => 2008-09-07 19:06:06
		[lastLogin] => 2008-09-07 19:24:34
		[notes] => Test User for logins
	) */
	config = {
		data: data
	};
	
	Ext.apply(this, config);
	
	
	Uwd.System.User.superclass.constructor.call(this);
	
	this.emailChanged = false;
	this.passChanged = false;
	this.newPass = null;
	this.existentPass = null;
};

Ext.extend(Uwd.System.User, Ext.util.Observable, {
	
	
	getId : function() {
		return this.data.id;
	},
	
	getName : function() {
		return this.data.name;
	},
	
	getThemeId : function() {
		return this.data.themeId;
	},
	
	getThemeName : function() {
		return this.data.themeName;
	},
	
	setThemeId : function(id) {
		this.data.themeId = id;
	},
	
	setThemeName : function(name) {
		this.data.themeName = name;
	},
	
	getEncryptedPasswort : function() {
		return this.data.password;
	},
	
	setEncryptedPasswort : function(hash) {
		this.data.password = hash;
		return  true;
	},
	
	setNewPassword : function(plainNewPass, plainExistentPass) {
		this.passChanged = true;
		this.newPass = plainNewPass;
		this.existentPass = plainExistentPass;
		return  true;
	},
	
	getEmail : function() {
		return this.data.email;
	},
	
	setEmail : function(email) {
		this.emailChanged = true;
		this.data.email = email;
		return  true;
	},
	
	getIsRoot : function() {
		return this.data.isRoot == true;
	},
	
	getDateRegister : function() {
		return this.data.dateRegister;
	},
	
	getLastLogin : function() {
		return this.data.lastLogin;
	},
	
	getNotes : function() {
		return this.data.notes;
	},
	
	clearAll : function() {
		this.emailChanged = false;
		this.passChanged = false;
		this.newPass = null;
		this.existentPass = null;
	},
	
	getChanged : function() {
		var ret = {};
		if (this.emailChanged === true) {
			ret.email = this.data.email;
		}
		if (this.passChanged === true) {
			ret.existentPass = this.existentPass;
			ret.newPass = this.newPass;
		}
		return ret;
	},
	
	getMenuType : function() {
		return this.data.menuType;
	},
	
	setMenuType : function(type) {
		type = type !== 1 ? 0 : 1;
		
		this.menuTypeChanged = true;
		this.data.menuType = type;
		if (type === 0) {
			window.system.setProgramMenu();
		} else {
			window.system.setFisheyeMenu();
		}
		return  true;
	},
	
	getPassword : function() {
		return this.data.plainPass;	
	}
	
	
});


