Index: /trunk/prototype/modules/mail/templates/quickAddContact.ejs
===================================================================
--- /trunk/prototype/modules/mail/templates/quickAddContact.ejs	(revision 5878)
+++ /trunk/prototype/modules/mail/templates/quickAddContact.ejs	(revision 6677)
@@ -1,21 +1,39 @@
-<div style="text-align:right;margin: 5px;">
-	<div>
-		<span><%=get_lang('Nickname')%>:</span>
-		<input type="text" value="<%=data.nick%>" maxlength="50" id="quickAddOne_nickName" />
-	</div>
-	
-	<div>
-		<span><%=get_lang('First Name')%>:</span>
-		<input type="text" value="<%=data.fname%>" maxlength="50" id="quickAddOne_firstName" />
-	</div>
-	
-	<div>
-		<span><%=get_lang('Last Name')%>:</span>
-		<input type="text" value="<%=data.lname%>" maxlength="50" id="quickAddOne_lastName" />
-	</div>
-	
-	<div>
-		<span><%=get_lang('Email')%>:</span>
-		<input type="text" value="<%=data.email%>" maxlength="50" id="quickAddOne_email" />
-	</div>
+<div style="width:auto;">	
+	<table>
+		<tr>
+			<td>
+				<span><%=get_lang('Nickname')%>:</span>
+			</td>
+			<td>
+				<input type="text" value="<%=data.nick%>" maxlength="50" id="quickAddOne_nickName" style="width:205px;"/>
+			</td>
+		</tr>
+		
+		<tr>
+			<td>
+				<span><%=get_lang('First Name')%>:</span>
+			</td>
+			<td>
+				<input type="text" value="<%=data.fname%>" maxlength="50" id="quickAddOne_firstName" style="width:205px;" class="required-field"/>
+			</td>
+		</tr>
+		
+		<tr>
+			<td>
+				<span><%=get_lang('Last Name')%>:</span>
+			</td>
+			<td>
+				<input type="text" value="<%=data.lname%>" maxlength="50" id="quickAddOne_lastName" style="width:205px;"/>
+			</td>
+		</tr>
+		
+		<tr>
+			<td>
+				<span><%=get_lang('Email')%>:</span>
+			</td>
+			<td>
+				<input type="text" value="<%=data.email%>" maxlength="50" id="quickAddOne_email" style="width:205px;" class="required-field"/>
+			</td>
+		</tr>
+	</table>
 </div>
Index: /trunk/expressoMail1_2/js/ccQuickAdd.js
===================================================================
--- /trunk/expressoMail1_2/js/ccQuickAdd.js	(revision 6650)
+++ /trunk/expressoMail1_2/js/ccQuickAdd.js	(revision 6677)
@@ -1,71 +1,16 @@
-	function cQuickAddContact ()
-	{
-		this.xtools  	= new xtools('../expressoMail1_2/templates/');
-	}
-
-	cQuickAddContact.prototype.showList = function(data)
-	{
-		var	cc_data = ((typeof data) == 'object' ) ? data : data.split(',');
-
-		var quickContact = $("#quickAddContact");
-		quickContact.html( DataLayer.render( BASE_PATH + "modules/mail/templates/quickAddContact.ejs",{ nick : cc_data[0], fname : cc_data[1], lname : cc_data[2], email : cc_data[3] }));
-		quickContact.dialog(
-		{
-				height		: 200,
-				width		: 300,
-				resizable	: false,
-				title		: get_lang("Quick Add"),			
-				modal		: true,
-				buttons		: [
-								{
-									text: get_lang("Cancel"),
-									click: function()
-									{
-										$(this).dialog("close");
-									} 
-								},
-								{
-									text: get_lang("Save"),
-									click: function()
-									{
-										data = '';
-										data = data + $(this).find('#quickAddOne_nickName').val() + ',';
-										data = data + $(this).find('#quickAddOne_firstName').val() + ',';
-										data = data + $(this).find('#quickAddOne_lastName').val() + ',,';
-										data = data + $(this).find('#quickAddOne_email').val();
-										if(ccQuickAddOne.send(data))
-											$(this).dialog("close");
-									}
-								}
-				]
-		});
-		
-		quickContact.next().css("background-color", "#E0EEEE");		
-	}
-	
-	cQuickAddContact.prototype.send = function (data)
-	{
-		var sdata 		= data.split(",");
-		var email		= trim(sdata[4]);
-		var full_name	= trim(sdata[1]) + ' ' + trim(sdata[2]);
-		var _this 		= this;
-
+/* Build the Object */
+var	ccQuickAddOne = {
+	send : function(data){
+		var email = data[4];
 		var handler = function (responseText)
 		{
-			
 			var data = responseText;
-			console.log(data);
-			if (!data || typeof(data) != 'object')
-			{
+			if (!data || typeof(data) != 'object'){
 				write_msg("Problema ao contactar servidor");
 				return;
-			}
-			else if (data['status'] == 'alreadyExists')
-			{
+			}else if (data['status'] == 'alreadyExists'){
 				alert(data['msg']);
 				return;
-			}
-			else if (data['status'] != 'ok')
-			{
+			}else if (data['status'] != 'ok'){
 				return;
 			}
@@ -84,43 +29,67 @@
 				write_msg(get_lang("Contact added successfully."));
 			}			
-
-			if ( _this.afterSave )
-			{
-				switch ( typeof(_this.afterSave) )
-				{
-					case 'function':
-						_this.afterSave();
-						break;
-
-					case 'string':
-						eval(_this.afterSave);
-						break;
-				}
-			}
-			
-			
 		};
-        if( email == '' )
-		{
-			alert( get_lang("QuickAddEmptyMail",email) );
-			return false;
-		}
 		
-		if( !validateEmail(email) )
-		{
-			alert( get_lang("QuickAddInvalidMail", email) );
-			return false;
-		}
-
-		var sdata	= 'add='+escape(connector.serialize(sdata));
+		var data2 = new Array();
+		for( var i in data )
+			data2[ data2.length ] = data[i];
+		
+		var sdata	= 'add='+escape(connector.serialize(data2));
 		var CC_url	= '../index.php?menuaction=contactcenter.ui_data.data_manager&method=';
-		
 		connector.newRequest('cQuickAdd.Send', CC_url+'quick_add', 'POST', handler, sdata);
-		
 		updateDynamicPersonalContacts();
 		cache = new Array();
 		return true;
+	},
+	showList: function(data){
+		var	cc_data = ((typeof data) == 'object' ) ? data : data.split(',');
+		quickContact = $("#quickAddContact").html( DataLayer.render( BASE_PATH + "modules/mail/templates/quickAddContact.ejs",{ nick : cc_data[0], fname : cc_data[1], lname : cc_data[2], email : cc_data[3] }));
+		quickContact.dialog({
+			resizable	: false,
+			title		: get_lang("Quick Add"),
+			modal		: true,
+			buttons		: [
+				{
+					text: get_lang("Cancel"),
+					click: function()
+					{
+						$(this).dialog("close");
+					} 
+				},
+				{
+					text: get_lang("Save"),
+					click: function()
+					{
+						data = {
+							nick: $(this).find('#quickAddOne_nickName').val(),
+							name:  $(this).find('#quickAddOne_firstName').val(),
+							last: $(this).find('#quickAddOne_lastName').val(),
+							telefone: "",
+							email: $(this).find('#quickAddOne_email').val()
+						};
+						$(this).find('input').removeClass("required-fail");
+						if(data.name ==""){
+							$(this).find('#quickAddOne_firstName').addClass("required-fail");
+							return false;
+						}else if(data.email ==""){
+							$(this).find('#quickAddOne_email').addClass("required-fail");
+							return false;
+						}else if(!validateEmail(data.email)){
+							$(this).find('#quickAddOne_email').addClass("required-fail");
+							new $.Zebra_Dialog(get_lang("QuickAddInvalidMail", data.email),{
+								'buttons':  false,
+								'modal': false,
+								'position': ['right - 20', 'top + 20'],
+								'auto_close': 3000
+							});
+							return false;
+						}
+						if(ccQuickAddOne.send(data))
+							$(this).dialog("close");
+					}
+				}
+			]
+		});
+		quickContact.next().css("background-color", "#E0EEEE").find("button").addClass("button").addClass("small");
 	}
-	
-/* Build the Object */
-var	ccQuickAddOne = new cQuickAddContact();
+};
