Index: /trunk/contactcenter/inc/class.bo_shared_people_manager.inc.php
===================================================================
--- /trunk/contactcenter/inc/class.bo_shared_people_manager.inc.php	(revision 752)
+++ /trunk/contactcenter/inc/class.bo_shared_people_manager.inc.php	(revision 1496)
@@ -50,10 +50,10 @@
 			$array_map = array();
 			$rules_inicio = $rules;
-			
+	
 			foreach($relacionados as $uid_relacionado => $tipo_relacionamento) {
 				$aclTemp = CreateObject("phpgwapi.acl",$uid_relacionado); 
 				$aclTemp->read();
 				$perms_relacao = $aclTemp->get_specific_rights($GLOBALS['phpgw_info']['user']['account_id'],'contactcenter'); //Preciso verificar as permissões que o contato relacionado deu para o atual
-							
+				
 				if(!($perms_relacao&1)) //Se não tiver permissão de leitura, nem se preocupe em listá-los
 					continue;
@@ -931,5 +931,5 @@
 			@return integer $id The Contact ID
 		*/	
-		function add_single_entry ( $data )
+		function add_single_entry ( $data , $owner)
 		{
 			$permissions = $this->security->get_permissions();
@@ -1054,5 +1054,9 @@
 			if ($altered)
 			{
-				$contact->set_field('id_owner',$GLOBALS['phpgw_info']['user']['account_id']);
+				if ($owner)
+				{	
+					$contact->set_field('id_owner',$owner);
+				}else
+					$contact->set_field('id_owner',$GLOBALS['phpgw_info']['user']['account_id']);
 				return $contact->commit();
 			}
Index: /trunk/contactcenter/inc/class.ui_api.inc.php
===================================================================
--- /trunk/contactcenter/inc/class.ui_api.inc.php	(revision 1494)
+++ /trunk/contactcenter/inc/class.ui_api.inc.php	(revision 1496)
@@ -41,4 +41,5 @@
 			$template->set_var('cc_msg_err_timeout',lang('Operation Timed Out.'));
 			$template->set_var('cc_msg_err_serialize_data_unknown',lang('Data to be serialized is of unknown type!'));
+			$template->set_var('cc_msg_err_shared',lang('No shared catalog that has permission to add.'));
 			/* End Messages */
 
@@ -229,4 +230,7 @@
 			$template->set_var('emails_telephones', lang("E-Mails and Telephones"));
 			$template->set_var('cc_default', lang("Default"));
+
+                        $template->set_var('cc_contact_shared',lang('Add to catalog'));
+                        $template->set_var('cc_contact_shared_types',lang('Choose in wich catalog you would like to add...'));
 
 			/* End Contact */
Index: /trunk/contactcenter/inc/class.ui_data.inc.php
===================================================================
--- /trunk/contactcenter/inc/class.ui_data.inc.php	(revision 1419)
+++ /trunk/contactcenter/inc/class.ui_data.inc.php	(revision 1496)
@@ -123,4 +123,5 @@
 			
 			$GLOBALS['phpgw']->template->set_var('cc_full_add_button',lang('Full Add'));
+			$GLOBALS['phpgw']->template->set_var('cc_full_add_button_sh',lang('Full Add Shared'));
 			$GLOBALS['phpgw']->template->set_var('cc_reset',lang('Reset'));
 			
@@ -175,4 +176,5 @@
 			$GLOBALS['phpgw']->template->set_var('cc_msg_group',lang('Group'));
 			$GLOBALS['phpgw']->template->set_var('cc_msg_contact_full',lang('Contact [Full]'));
+			$GLOBALS['phpgw']->template->set_var('cc_msg_contact_sh',lang('Contact [Shared]'));
 			$GLOBALS['phpgw']->template->set_var('cc_msg_contact_qa',lang('Contact [Quick Add]'));
 			$GLOBALS['phpgw']->template->set_var('cc_contact_title',lang('Contact Center').' - '.lang('Contacts'));
@@ -320,4 +322,7 @@
 					return $this->post_full_add();
 
+				case 'post_full_add_shared' :
+					return $this->post_full_add_shared();
+
 				case 'post_photo':
 					return $this->post_photo((int) $_GET['id'] ? (int) $_GET['id'] : '_new_');
@@ -586,5 +591,4 @@
 				unset($ids);
 				$this->page_info['changed'] = false;
-
 				switch ($this->page_info['actual_catalog']['class'])
 				{
@@ -592,5 +596,4 @@
 					case 'bo_people_catalog':
 						$field_name = 'id_contact';
-
 						if ($letter !== 'number')
 						{
@@ -602,5 +605,51 @@
 								)								
 							);
-							if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog'){								
+
+							//Tratamento de permissão de escrita no compartilhamento de catalogo
+                                			$so_contact = CreateObject('contactcenter.so_contact',  $GLOBALS['phpgw_info']['user']['account_id']);
+                                			$relacionados = $so_contact->get_relations();
+							
+							$perms_relacao = array();				
+
+                        				foreach($relacionados as $uid_relacionado => $tipo_relacionamento) {
+								$aclTemp = CreateObject("phpgwapi.acl",$uid_relacionado);
+                                				$aclTemp->read();
+                                				$perms_relacao[$uid_relacionado] = $aclTemp->get_specific_rights($GLOBALS['phpgw_info']['user']['account_id'],'contactcenter'); //Preciso verificar as permissões que o contato relacionado deu para o atual
+							}
+
+							$validos = array();
+							$count = 0;
+							foreach($perms_relacao as $uid_relacionado => $val){
+								if ($perms_relacao[$uid_relacionado]&2)
+								{
+									$validos[$uid_relacionado] = $perms_relacao[$uid_relacionado];
+									$count++;
+								}
+							}
+							$prop_names = array();
+							if($validos) {
+                	                        		$filtro = "(|";
+                        	                		foreach($validos as $i => $prop) {
+                                	                		$filtro .= "(uidNumber=".$i.")";
+                                        			}
+                                       	 			$filtro .= ")";
+
+                                        			if(!$this->bo->catalog->src_info) {
+                                                			$ldaps = CreateObject('contactcenter.bo_ldap_manager');
+                                                			$this->bo->catalog->src_info = $ldaps->srcs[1];
+                                        			}
+                                        			$s = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false);
+                                        			$n=$this->bo->catalog->src_info['dn'];
+                                        			$apenasThese = array("cn","uidnumber","uid");
+                                        			$r = ldap_search($s,$n, $filtro,$apenasThese);                                        
+                                        			$infos = ldap_get_entries($s, $r);
+                                        			ldap_close($s);                                                                       
+                                        			for($z = 0; $z < $infos['count']; $z++) {
+                                                			$prop_names[$infos[$z]['uidnumber'][0]] = array("cn" => $infos[$z]['cn'][0], "uid" => $infos[$z]['uid'][0]);
+                                        			}
+                                			}
+							//--------------------------------------------------------------------------------
+							if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog')
+							{
 								$find_restric[0][1] = array(
 										'field' => 'contact.id_owner',
@@ -963,7 +1012,6 @@
 
 				}
-				
+
 				$result = $this->bo->find($find_field[0],$find_restric[0],$find_other[0]);
-				
 				$n_entries = count($result);
 				
@@ -1084,6 +1132,6 @@
 				foreach($this->page_info['actual_entries'] as $key=>$tmp){
 						$array_temp[] = $tmp;				
-				}	
-				
+				}
+			
 				for($i = $id_i; $i < $id_f and $i < $n_entries; $i++)
 				{
@@ -1098,5 +1146,4 @@
 				}
 				
-				
 				// Carrega o nome completo dos donos dos objetos (contatos e grupos);
 				$owner_names = array();
@@ -1108,5 +1155,5 @@
 					}
 					$filter .= ")";
-					
+
 					if(!$this->bo->catalog->src_info) {
 						$ldap = CreateObject('contactcenter.bo_ldap_manager');
@@ -1129,5 +1176,4 @@
 				//}
 				///
-				
 				$fields = $this->bo->catalog->get_fields(false);
 				if( $this->typeContact == 'groups' || $this->typeContact == 'shared_groups') {
@@ -1288,5 +1334,8 @@
 				$lnk_compose = "location.href=('../expressoMail1_2/index.php?to=";
 				$final[5] = '<span class="link" onclick="'.$lnk_compose;
-
+				$final[6] = $prop_names;
+				$final[7] = $validos;
+				$final[8] = $this->page_info['actual_catalog']['class'];
+				$final[9] = $count;
 
 				$this->page_info['actual_letter'] = $letter;
@@ -2002,4 +2051,282 @@
 		}
 
+
+		function post_full_add_shared()
+		{
+			$data =  $_POST['data'];
+			// Exceptions!!! utf8 special chars. 
+			$data = preg_replace("/\%u2(\d+)(\d+)(\d+)/","-",$data);
+			$data = unserialize(str_replace('\\"', '"', $data));
+			$this -> bo -> catalog = CreateObject('contactcenter.bo_shared_people_manager');
+
+			if (!is_array($data))
+			{
+				echo serialize(array(
+					'msg' => lang('<p>Some problem receiving data from browser. This is probably a bug in ContactCenter<br>'.
+				                  'Please go to eGroupWare Bug Reporting page and report this bug.<br>'.
+						          'Sorry for the inconvenient!<br><br>'.
+						          '<b><i>ContactCenter Developer Team</i></b></p>'),
+					'status' => 'fatal'
+				));
+				return;
+			}
+//			print_r($data);
+//			echo '<br><br>';
+
+			$replacer = $data['commercialAnd'];
+			unset($data['commercialAnd']);
+			if (!is_string($replacer) or strpos($replacer, "'") or strpos($replacer, '"'))
+			{
+				echo serialize(array(
+					'msg' => lang('Invalid \'&\' replacer! This may be an attempt to bypass Security! Action aborted!'),
+					'status' => 'fatal'
+				));
+				
+				return;
+			}
+
+			if ($data['id_contact'])
+			{
+				$id = $data['id_contact'];
+				$id_photo = $id;
+				unset($data['id_contact']);
+			}
+			else
+			{
+				$id_photo = '_new_';
+			}
+
+			if ($data['owner'])
+			{
+				$owner = $data['owner'];
+				unset($data['owner']);
+			}
+			/* 
+			 * Process Photo, if available 
+			 */
+			$sleep_count = 0;
+			$photo_ok = $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter');
+			while($photo_ok[0]{0} !== 'o' and $photo_ok[1]{0} === 'y')
+			{
+				sleep(1);
+				$photo_ok = $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter');
+				$sleep_count++;
+
+				if ($sleep_count > 35)
+				{
+					// TODO
+					return;
+				}
+			}
+			$GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'n'));
+			
+			if (isset($this->page_info['photos'][$id_photo]))
+			{
+				if (array_search($this->page_info['photos'][$id_photo]['status'], array('changed', 'sync')) === false)
+				{
+					echo serialize(array(
+						'msg' => $this->page_info['photos'][$id_photo]['msg'],
+						'status' => $this->page_info['photos'][$id_photo]['status']
+					));
+
+					return;
+				}
+
+				$data['photo'] = $this->page_info['photos'][$id_photo]['content'];
+				unset($this->page_info['photos'][$id_photo]);
+				$this->save_session();
+			}
+			
+			/*
+			 * Arrange Date so it gets inserted correctly
+			 */
+			 
+			$dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+		
+			$j = 0;
+			for ($i = 0; $i < 5; $i+=2)
+			{
+				switch($dateformat{$i})
+				{
+					case 'Y':
+						$date[$j]['size'] = 4;
+						$date[$j]['digit'] = 'Y';
+						break;
+
+					case 'm':
+					case 'M':
+						$date[$j]['size'] = 2;
+						$date[$j]['digit'] = 'M';
+						break;
+
+					case 'd':
+						$date[$j]['size'] = 2;
+						$date[$j]['digit'] = 'D';
+				}
+				$j++;
+			}
+			$datecount = 0;
+
+			/* Verify Data and performs insertion/update */
+			foreach($data as $field => &$value)
+			{
+				if ($value == '' or is_null($value))
+				{
+					unset($data[$field]);
+					continue;
+				}
+				
+				switch($field)
+				{
+					case 'alias':
+					case 'given_names':
+					case 'family_names':
+					case 'names_ordered':
+					case 'pgp_key':
+					case 'notes':
+					case 'photo':
+						$value = urldecode( $value );
+						/* Do Nothing. This is just to make sure no invalid field is passed */
+						break;
+					
+					case 'id_status':
+					case 'id_prefix':
+					case 'id_suffix':
+						if ($data[$field] == 0)
+						{
+							unset($data[$field]);
+						}
+						break;
+					
+					case 'birthdate_0':
+					case 'birthdate_1':
+					case 'birthdate_2':
+					
+						switch($date[$datecount]['digit'])
+						{
+							case 'Y':
+								$date['value'][2] = (int) $data[$field];
+								break;
+
+							case 'M':
+								$date['value'][0] = (int) $data[$field];
+								break;
+
+							case 'D':
+								$date['value'][1] = (int) $data[$field];
+								break;
+						}
+						unset($data[$field]);
+						$datecount++;
+
+						if ($datecount != 3)
+						{
+							break;
+						}
+						
+						if (!checkdate($date['value'][0], $date['value'][1], $date['value'][2]))
+						{
+							echo serialize(array(
+								'msg' => lang('Invalid Date'),
+								'status' => 'invalid_data'
+							));
+							return;
+						}
+						
+						$data['birthdate'] = $date['value'][2].'-'.$date['value'][0].'-'.$date['value'][1];
+						break;
+
+					case 'sex':
+						if ($data[$field] !== 'M' and $data[$field] !== 'F')
+						{
+							echo serialize(array(
+								'msg' => lang('Invalid Sex'),
+								'status' => 'invalid_data'
+							));
+							return;
+						}
+						break;
+
+
+					case 'addresses':
+						/* Insert new cities/states */
+						if (isset($value['new_states']))
+						{
+							foreach($value['new_states'] as $type => $state_info)
+							{
+								$index = 'address'.$type;
+								
+								$id_state = $this->bo->catalog->add_state($state_info);
+								$data['addresses'][$index]['id_state'] = $id_state;
+
+								if ($value['new_cities'][$type])
+								{
+									$value['new_cities'][$type]['id_state'] = $id_state;
+								}
+							}
+
+							unset($data['addresses']['new_states']);
+						}
+
+						if (isset($value['new_cities']))
+						{
+							foreach($value['new_cities'] as $type => $city_info)
+							{
+								$index = 'address'.$type;
+								
+								$id_city = $this->bo->catalog->add_city($city_info);
+								$data['addresses'][$index]['id_city'] = $id_city;
+							}
+
+							unset($data['addresses']['new_cities']);
+						}
+
+					break;
+
+					case 'connections':
+						/* Does nothing... */
+						break;
+
+					default:
+						echo serialize(array(
+							'msg' => lang('Invalid field: ').$field,
+							'status' => 'invalid_data'
+						));
+						return;
+				}
+			}
+
+			$code = '$id = $this->bo->catalog->';
+
+			if (!is_null($id) and $id !== '')
+			{
+				$code .= $code.'update_single_info($id, $data);';
+				$result = array(
+					'msg' => lang('Updated Successfully!'),
+					'status' => 'ok'
+				);
+			}
+			else
+			{
+				$code .= 'add_single_entry($data,'.$owner.');';
+				$result = array(
+					'msg' => lang('Entry Added Successfully!'),
+					'status' => 'ok'
+				);
+			}
+			
+			eval($code);
+
+			if (!($id))
+			{
+				$result = array(
+					'msg' => lang('Some problem occured when trying to insert/update contact information.<br>'.
+				                   'Report the problem to the Administrator.'),
+					'status' => 'fail'
+				);
+			}
+
+			echo serialize($result);
+}
 		/*!
 		
Index: /trunk/contactcenter/js/ccQuickAddContact.js
===================================================================
--- /trunk/contactcenter/js/ccQuickAddContact.js	(revision 285)
+++ /trunk/contactcenter/js/ccQuickAddContact.js	(revision 1496)
@@ -45,5 +45,6 @@
 				}				
 			}
-			
+
+
 			el.innerHTML +='<div id="ccQAFuncitons" style="border: 0px solid black; width: 220px; height: 20px">' +
 				'<input title="' + Element('cc_qa_save').value + '"  type="button" onclick="ccQuickAddContact.send(\'' + id + '\');" value="' + Element('cc_qa_save').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 75px; width: 60px" />' +
Index: /trunk/contactcenter/js/cc.js
===================================================================
--- /trunk/contactcenter/js/cc.js	(revision 1280)
+++ /trunk/contactcenter/js/cc.js	(revision 1496)
@@ -38,4 +38,8 @@
 \***********************************************/
 
+var owners = new Array();
+var flag_compartilhado = false;
+var qtd_compartilhado = 0;
+
 var CC_visual = 'table';
 /* Cards Variables */
@@ -172,4 +176,48 @@
 	Element("cc_conn_type_sel").disabled = true;
 	Element("cc_conn_type_sel").selectedIndex = 0;
+	Element("cc_contact_sharing").style.display = 'none';
+}
+
+function openFullAddShared(){
+	if (flag_compartilhado)
+	{
+		if(!fullAddWin && !is_ie)
+			__f();
+
+		resetFullAdd();
+		populateFullAddConst();
+		fullAddWin.open();
+		tabs._showTab('cc_contact_tab_0');
+		Element("cc_conn_type_1").checked = false;
+		Element("cc_conn_type_2").checked = false;
+		Element("cc_conn_type_sel").disabled = true;
+		Element("cc_conn_type_sel").selectedIndex = 0;
+		Element("cc_contact_sharing").align = 'center';
+		Element("cc_contact_sharing").style.display = 'block';
+		Element("cc_contact_shared_types").disabled = true;
+		populateSharingSelect();
+	} else
+	{
+		if(qtd_compartilhado != 0)
+		{
+			ccTree.select(0.2);
+			ccTree.setCatalog(0.2);
+			if(!fullAddWin && !is_ie)
+				__f();
+			resetFullAdd();
+			populateFullAddConst();
+			fullAddWin.open();
+			tabs._showTab('cc_contact_tab_0');
+			Element("cc_conn_type_1").checked = false;
+			Element("cc_conn_type_2").checked = false;
+			Element("cc_conn_type_sel").disabled = true;
+			Element("cc_conn_type_sel").selectedIndex = 0;
+			Element("cc_contact_sharing").aling = 'center';
+			Element("cc_contact_sharing").style.display = 'block';
+			Element("cc_contact_shared_types").disabled = true;
+			populateSharingSelect();
+		} else
+			showMessage(Element('cc_msg_err_shared').value);
+	}
 }
 
@@ -180,4 +228,7 @@
 function newContact(){
 	openFullAdd();
+}
+function newSharedContact(){
+	openFullAddShared();
 }
 /************ Edit Contact *************/
@@ -202,6 +253,46 @@
 	Updates all the constant fields in the
 	full add window, like Prefixes, Suffixes,
-	Countries and Types
+	Countries, Types and Shared catalogs
 */
+
+function populateSharingSelect()
+{
+        var handler = function(responseText)
+        {
+                var data = unserialize(responseText);
+		var sharers = Element('cc_contact_shared_types');
+
+	        if (typeof(data) != 'object')
+                {
+                        showMessage(Element('cc_msg_err_contacting_server').value);
+                        return;
+                }
+		
+		if (typeof(data[3]) == 'object')
+                {
+			sharers.disabled = false;
+			var i = 1;
+			if (data[6].length != 0)
+			{
+				for (var j in data[6])
+				{
+					sharers.options[i] = new Option(data[6][j]['cn'], j);
+					owners[i] = j;
+					i++;
+				}
+			} else
+				sharers.disabled = true;
+			return;
+                } else
+		{
+			showMessage(Element('cc_msg_err_contacting_server').value);
+			fullAddWin.close();
+			return;
+		}
+
+        };
+	Connector.newRequest('populateSharingSelect', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cards_data', 'POST', handler);
+}
+
 function populateFullAddConst()
 {
@@ -442,6 +533,8 @@
 		CC_full_add_photo = true;
 	}
-
-	setTimeout('postFullAddInfo()', 100);
+	if (Element('cc_contact_sharing').style.display == 'none')
+		setTimeout('postFullAddInfo()', 100);
+	else
+		setTimeout('postFullAddInfoShared()', 100);
 }
 
@@ -467,6 +560,28 @@
 		updateCards();
 	};
-
 	Connector.newRequest('postFullAddInfo', CC_url+'post_full_add', 'POST', handler, getFullAddData());
+}
+
+function postFullAddInfoShared()
+{
+	var handler = function (responseText)
+	{
+		var data = unserialize(responseText);
+		if (typeof(data) != 'object')
+		{
+			showMessage(Element('cc_msg_err_contacting_server').value);
+			return;
+		}
+
+		if (data['status'] != 'ok')
+		{
+			showMessage(data['msg']);
+			return;
+		}
+
+		fullAddWin.close();
+		updateCards();
+	};
+	Connector.newRequest('postFullAddInfoShared', CC_url+'post_full_add_shared', 'POST', handler, getFullAddData());
 }
 
@@ -476,5 +591,5 @@
 	var empty = true;
 	var replacer = '__##AND##__';
-	
+
 	data['commercialAnd'] = replacer;
 	
@@ -484,5 +599,13 @@
 		data.length++;
 	}
-
+	
+	/* Owner do contato (Para o caso de adicao de contato compartilhado) */
+	if (Element('cc_contact_sharing').style.display == 'block')
+	{
+		var index = Element('cc_contact_shared_types').selectedIndex;
+		data['owner'] = replaceComAnd(owners[index], replacer); 
+		data.length++;
+	}
+	
 	/* Status: Full Added */
 	data['id_status'] = CC_STATUS_FULL_ADD;
@@ -580,4 +703,5 @@
 	}
 
+	var serial = serialize(data);
 	return 'data=' + escape(serialize(data));
 }
@@ -585,6 +709,22 @@
 function checkFullAdd()
 {
+
+	/* Checa se o listbox esta desativado ou é nulo, ou seja, não existe catálogos compartilhados com o user atual */
+
+	if (!(Element('cc_contact_sharing').style.display == 'none' ))
+	{
+		if (Element('cc_contact_shared_types').disabled == true)
+		{	
+			showMessage('Nenhum catálogo compartilhado existente');
+			return false;
+		}
+		if (Element('cc_contact_shared_types').selectedIndex == 0)
+		{
+			showMessage('Nenhum catálogo selecionado');
+			return false;
+		}
+	}
+	
 	/* Check Personal Data */
-
 	if (Element('cc_pd_given_names').value == '')
 	{
@@ -1633,5 +1773,5 @@
 		return;
 	}
-	
+
 	var handler = function (responseText)
 	{
@@ -1914,6 +2054,6 @@
 									Element(id+':'+data[2][k]).innerHTML = data[3][pos][k];
 								}
-								if(data[3][pos][9])
-									Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][9]+"</i></font></span>";	
+								if(data[3][pos][9]){
+									Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][9]+"</i></font></span>";	}
 								break;
 							
@@ -2337,5 +2477,5 @@
 {
 	var data  = new Array();
-
+	flag_compartilhado = false;
 	if ( letter != CC_actual_letter )
 	{
@@ -2360,4 +2500,5 @@
 		return;
 	}
+
 
 	var handler = function (responseText)
@@ -2390,4 +2531,13 @@
 		if (typeof(data[3]) == 'object')
 		{
+			if (data[8] == 'bo_shared_people_manager')
+			{
+				flag_compartilhado = true;
+			}
+			else
+			{
+				flag_compartilhado = false;
+			}
+			qtd_compartilhado = data[9];
 			CC_npages = parseInt(data[0]);
 			CC_actual_page = parseInt(data[1]);			
Index: /trunk/contactcenter/js/ccMain.js
===================================================================
--- /trunk/contactcenter/js/ccMain.js	(revision 575)
+++ /trunk/contactcenter/js/ccMain.js	(revision 1496)
@@ -91,7 +91,7 @@
 		submenu = [];
 		textmenu = [];
-			
-		textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_group"]
-		textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_add_group_button"];		
+
+		textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_contact_sh","cc_msg_group"];
+		textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_full_add_button_sh", "cc_add_group_button"];
 		function show(){
 			clearTimeout(_timeout);
@@ -104,4 +104,5 @@
 			
 		if(document.getElementById) {
+
 			menu = document.getElementById("Layer1");
 				
@@ -126,5 +127,6 @@
 		ccAddGroup.associateAsButton(Element('cc_add_group_button'));
 		Element("cc_full_add_button").onclick = newContact;
-			 
+		Element("cc_full_add_button_sh").onclick = newSharedContact;
+
 			
 		ccQuickAdd.afterSave = function ()
Index: /trunk/contactcenter/templates/default/api_common.tpl
===================================================================
--- /trunk/contactcenter/templates/default/api_common.tpl	(revision 1494)
+++ /trunk/contactcenter/templates/default/api_common.tpl	(revision 1496)
@@ -15,4 +15,5 @@
 <input id="cc_msg_err_timeout" type="hidden" value="{cc_msg_err_timeout}" />
 <input id="cc_msg_err_serialize_data_unknown" type="hidden" value="{cc_msg_err_serialize_data_unknown}" />
+<input id="cc_msg_err_shared" type="hidden" type="hidden" value="{cc_msg_err_shared}" />
 
 <input id="cc_msg_err_empty_field" type="hidden" value="{cc_msg_err_empty_field}" />
Index: /trunk/contactcenter/templates/default/index.tpl
===================================================================
--- /trunk/contactcenter/templates/default/index.tpl	(revision 1494)
+++ /trunk/contactcenter/templates/default/index.tpl	(revision 1496)
@@ -21,4 +21,5 @@
 <input id="cc_msg_group" type="hidden" value="{cc_msg_group}">
 <input id="cc_msg_contact_full" type="hidden" value="{cc_msg_contact_full}">
+<input id="cc_msg_contact_sh" type="hidden" value="{cc_msg_contact_sh}">
 <input id="cc_msg_contact_qa" type="hidden" value="{cc_msg_contact_qa}">
 <input id="cc_msg_card_remove" type="hidden" value="{cc_msg_card_remove}">
Index: /trunk/contactcenter/templates/default/full_add.tpl
===================================================================
--- /trunk/contactcenter/templates/default/full_add.tpl	(revision 1158)
+++ /trunk/contactcenter/templates/default/full_add.tpl	(revision 1496)
@@ -162,5 +162,15 @@
 </div>
 <!-- _BOTTOM BUTTONS -->
-<div align="center" id="cc_contact_tab_buttons" style="position: absolute; visibility: hidden; top: 250px; left: 0px; width: 498px; height: 32px; border: 0px solid black">	
+<div align="center" id="cc_contact_tab_buttons" style="position: absolute; visibility: hidden; top: 250px; left: 0px; width: 498px; height: 64px; border: 0px solid black">
+	<table class="row_off" align="center" width="498px" cellpadding="2" cellspacing="0" border="0">
+		<tr class="row_off" id="cc_contact_sharing">
+			<td >{cc_contact_shared}: </td>
+			<td colspan="2">
+					<select id="cc_contact_shared_types" name="{cc_contact_shared}" style="width: 390px;">
+                                       		<option value="_NONE_">{cc_contact_shared_types}</option>
+                                	</select>
+			</td>
+		</tr>
+	</table>
 	<table class="row_off" align="center" width="498px" cellpadding="2" cellspacing="0" border="0">
 		<tr>
@@ -223,5 +233,5 @@
 					 'win_class': 'row_off',
 					 'width': '500px',
-					 'height': '273px',
+					 'height': '295px',
 					 'title_color': '#3978d6',
 					 'title': Element('cc_contact_title').value,
@@ -246,5 +256,4 @@
 			Element('cc_pd_select_photo_b').style.display='none';			
 		}
-		
 	};
 
Index: /trunk/preferences/inc/class.uiaclprefs.inc.php
===================================================================
--- /trunk/preferences/inc/class.uiaclprefs.inc.php	(revision 1409)
+++ /trunk/preferences/inc/class.uiaclprefs.inc.php	(revision 1496)
@@ -200,5 +200,4 @@
 			
 			if($acl_app=='contactcenter') {
-				$this->template->set_var("add_invisible", "style='display:none'");
 				$this->template->set_var("private_invisible", "style='display:none'");				
 			}
