Browse Source

UI improvements in groups & messages & social network see CT#190

Julio Montoya 15 years ago
parent
commit
8c4de053ba

+ 3 - 8
main/auth/profile.php

@@ -29,7 +29,7 @@ if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user[
 }
 
 $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
-$htmlHeadXtra[] = '<script src="../inc/lib/javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>'; //jQuery
+$htmlHeadXtra[] = '<script src="../inc/lib/javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
 $htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
 
 
@@ -697,11 +697,11 @@ if (isset($_GET['show'])) {
 
 	if ((api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') || (api_get_setting('allow_social_tool') == 'true')) {
 
-		$interbreadcrumb[] = array ('url' => 'javascript: void(0);', 'name' => get_lang('SocialNetwork'));
+		//$interbreadcrumb[] = array ('url' => 'javascript: void(0);', 'name' => get_lang('SocialNetwork'));
 
 	} elseif ((api_get_setting('allow_social_tool') == 'false' && api_get_setting('allow_message_tool') == 'true')) {
 
-		$interbreadcrumb[] = array('url' => 'javascript: void(0);', 'name' => get_lang('MessageTool'));
+		//$interbreadcrumb[] = array('url' => 'javascript: void(0);', 'name' => get_lang('MessageTool'));
 	}
 }
 
@@ -722,23 +722,18 @@ if (api_get_setting('extended_profile') == 'true') {
 		echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
 	}	
 	$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
-	
-	//echo '<span style="float:right; padding-top:7px;">';
 				 
 	if (isset($_GET['type']) && $_GET['type'] == 'extended') {
 		echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
 	} else {
 		echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).'&nbsp;'.get_lang('EditExtendProfile').'</a>';
 	}
-	//echo '</span>';
 
 	echo '</div>';
 }
 
 if (!empty($file_deleted)) {
-
 	Display :: display_confirmation_message(get_lang('FileDeleted'), false);
-
 } elseif (!empty($update_success)) {
 	$message = get_lang('ProfileReg');
 

+ 18 - 5
main/css/blue_lagoon/default.css

@@ -2729,7 +2729,7 @@ a.unread {
 	-moz-border-radius-bottomright:8px;
 	-moz-border-radius-topleft:8px;
 	-moz-border-radius-topright:8px;
-	background:#eee none repeat scroll 0 0;
+	background:#F5F5F5 none repeat scroll 0 0;
 	margin:0 0 5px;
 	padding:10px;
 }
@@ -2742,7 +2742,7 @@ a.unread {
 	-moz-border-radius-bottomright:8px;
 	-moz-border-radius-topleft:8px;
 	-moz-border-radius-topright:8px;
-	background:#ccc none repeat scroll 0 0;
+	background:#E6EEFB  none repeat scroll 0 0;
 	margin:0 0 5px;
 	padding:10px;
 
@@ -2780,9 +2780,7 @@ a.unread {
 	vertical-align:middle;
 }
 
-.actions-title {
-
-	
+.actions-title {	
 	background:#efefef;
 	border:1px solid #ccc;
 	padding:4px;
@@ -2792,3 +2790,18 @@ a.unread {
 	vertical-align:middle;
 }
 
+#group_description {
+	margin: 5px 0px 5px 0px;
+}
+
+#group_privacy {
+	margin: 5px 0px 5px 0px;
+}
+
+#group_permissions ul {
+	list-style-image:none;
+	list-style-position:outside;
+	list-style-type:none;
+	margin:0;
+	padding:0;
+}

+ 23 - 14
main/inc/lib/group_portal_manager.lib.php

@@ -1117,8 +1117,7 @@ class GroupPortalManager
 		echo '<style> 		
 				#group_members { width:233px; height:300px; overflow-x:none; overflow-y: auto;}
 				.group_member_item { width:98px; height:86px; float:left; margin:5px 5px 15px 5px; }
-				.group_member_picture { display:block;
-				
+				.group_member_picture { display:block;				
 					margin:0;
 					overflow:hidden; }; 
 		</style>';
@@ -1166,13 +1165,13 @@ class GroupPortalManager
 			echo '</div>';
 		}
 			
-		//Compose message link
+		/*//Compose message link
 		if (in_array($my_group_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR, GROUP_USER_PERMISSION_READER))) {	 
 			echo '<div id="actions" style="margin:10px">';
 			echo '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'" class="thickbox" title="'.get_lang('ComposeMessage').'">'.Display :: return_icon('message_new.png', get_lang('NewTopic')).'&nbsp;'.get_lang('NewTopic').'</a>';
 			//echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
 			echo '</div>';
-		}
+		}*/
 		
 		//Members
 		echo get_lang('Members').' : ';	
@@ -1196,33 +1195,43 @@ class GroupPortalManager
 		
 		//loading group permission
 		
-		echo '<div id="group_permissions">';	
+		echo '<div id="group_permissions">';
+		echo '<ul>';
+		
 		switch ($my_group_role) {
 			case GROUP_USER_PERMISSION_READER:
 				// I'm just a reader
-				echo '<a href="groups.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.get_lang('LeaveGroup').'</a>';
-				echo '<a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a>';
+				echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'" class="thickbox" title="'.get_lang('ComposeMessage').'">'.Display :: return_icon('message_new.png', get_lang('NewTopic')).'&nbsp;'.get_lang('NewTopic').'</a></li>';
+				echo '<li><a href="groups.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.get_lang('LeaveGroup').'</a></li>';
+				echo '<li><a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a></li>';
 					
 				break;
 			case GROUP_USER_PERMISSION_ADMIN:
 				echo 'Im the admin/';
-				echo '<a href="group_edit.php?id='.$group_id.'">'.get_lang('EditGroup').'</a>';
-				echo '<a href="group_members.php?id='.$group_id.'">'.get_lang('MemberList').'</a>';
-				echo '<a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a>';
+				echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'" class="thickbox" title="'.get_lang('ComposeMessage').'">'.Display :: return_icon('message_new.png', get_lang('NewTopic')).'&nbsp;'.get_lang('NewTopic').'</a></li>';
+	
+				echo '<li><a href="group_edit.php?id='.$group_id.'">'.get_lang('EditGroup').'</a>';
+				echo '<li><a href="group_members.php?id='.$group_id.'">'.get_lang('MemberList').'</a>';
+				echo '<li><a href="group_waiting_list.php?id='.$group_id.'">'.get_lang('WaitingList').'</a></li>';
+				echo '<li><a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a></li>';
 				break;
 			case GROUP_USER_PERMISSION_PENDING_INVITATION:				
-				echo '<a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang(YouHaveBeenInvitedJoinNow).'</a>';
+				echo '<li><a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang(YouHaveBeenInvitedJoinNow).'</a></li>';
 				break;
 			case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER:
 				echo get_lang('WaitingForAdminResponse');
 				break;
 			case GROUP_USER_PERMISSION_MODERATOR:
-				echo '<a href="group_members.php?id='.$group_id.'">'.get_lang('MemberList').'</a>';
-				echo '<a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a>';
+				echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'" class="thickbox" title="'.get_lang('ComposeMessage').'">'.Display :: return_icon('message_new.png', get_lang('NewTopic')).'&nbsp;'.get_lang('NewTopic').'</a></li>';
+		
+				echo '<li><a href="group_members.php?id='.$group_id.'">'.get_lang('MemberList').'</a></li>';
+				echo '<li><a href="group_waiting_list.php?id='.$group_id.'">'.get_lang('WaitingList').'</a></li>';
+				echo '<li><a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a></li>';
 				break;
 			case GROUP_USER_PERMISSION_ANONYMOUS:
-				echo '<a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>';
+				echo '<li><a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a></li>';
 		}
+		echo '</ul>';
 		echo '</div>'; // end layout permissions
 		
 	

+ 4 - 1
main/inc/lib/message.lib.php

@@ -755,7 +755,10 @@ class MessageManager
 				$html.= '<div class="'.$message_item.'" id="message-item-'.$count.'" style="margin-left: '.$indent.'px;">';
 					
 					//if (!isset($message['children'])) {
-					$html.= '<div id="message-reply-link"><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$message['id'].'" class="thickbox" title="'.api_xml_http_response_encode(get_lang('Reply')).'">'.Display :: return_icon('forumthread_new.gif', api_xml_http_response_encode(get_lang('Reply'))).'&nbsp;'.api_xml_http_response_encode(get_lang('Reply')).'</a></div>';
+					//only for admins
+					$html.= '<div id="message-reply-link"><a href="'.api_get_path(WEB_CODE_PATH).'social/groups.php?action=delete_message&group_id='.$group_id.'&message_id='.$message['id'].'">'.Display :: return_icon('delete.gif', get_lang('Delete')).'&nbsp;'.get_lang('Delete').'</a></div>';
+					$html.= '<div id="message-reply-link"><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$message['id'].'" class="thickbox" title="'.get_lang('Reply').'">'.Display :: return_icon('forumthread_new.gif', get_lang('Reply')).'&nbsp;'.get_lang('Reply').'</a></div>';
+
 						//echo '<a href="/main/messages/new_message.php?group_id='.$group_id.'&message_id='.$message['id'].'">'.Display::return_icon('forumthread_new.gif',api_xml_http_response_encode(get_lang('Reply'))).'&nbsp;'.api_xml_http_response_encode(get_lang('Reply')).'</a>';
 					//}
 					

+ 0 - 122
main/messages/cookies.js

@@ -1,122 +0,0 @@
-
-function Set_Cookie( name, value, expires, path, domain, secure ) {
-	// set time, it's in milliseconds
-	var today = new Date();
-	today.setTime( today.getTime() );
-	// if the expires variable is set, make the correct expires time, the
-	// current script below will set it for x number of days, to make it
-	// for hours, delete * 24, for minutes, delete * 60 * 24
-	if ( expires )
-	{
-		expires = expires * 1000 * 60 * 60 * 24;
-	}
-	//alert( 'today ' + today.toGMTString() );// this is for testing purpose only
-	var expires_date = new Date( today.getTime() + (expires) );
-	//alert('expires ' + expires_date.toGMTString());// this is for testing purposes only
-
-	document.cookie = name + "=" +escape( value ) +
-		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
-		( ( path ) ? ";path=" + path : "" ) +
-		( ( domain ) ? ";domain=" + domain : "" ) +
-		( ( secure ) ? ";secure" : "" );
-}
-
-function Get_Cookie( name ) {
-	var start = document.cookie.indexOf( name + "=" );
-	var len = start + name.length + 1;
-	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
-	{
-		return null;
-	}
-	if ( start == -1 ) return null;
-	var end = document.cookie.indexOf( ";", len );
-	if ( end == -1 ) end = document.cookie.length;
-	return unescape( document.cookie.substring( len, end ) );
-}
-
-var xmlHttp=null;
-var url=null
-function set_url(ref)
-{
-	url=ref;
-}
-function mostrar_aviso()
-{
-
-	document.getElementById("box").style.visibility="visible";
-
-}
-
-function ocultar_aviso()
-{
-	document.getElementById("box").style.visibility="hidden";
-
-}
-
-function notificar()
-{
-	vernuevos()
-	setTimeout("notificar()",60000)
-}
-
-function vernuevos()
-{
-
-	xmlHttp=GetXmlHttpObject(stateChanged)
-	xmlHttp.open("GET", url , true)
-	xmlHttp.send(null)
-}
-
-function stateChanged()
-{
-
-	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
-	{
-		document.getElementById("nuevos").innerHTML=xmlHttp.responseText
-		if(Get_Cookie("nuevos")==null || xmlHttp.responseText-Get_Cookie("nuevos")>0 )
-		{
-
-			mostrar_aviso()
-			setTimeout("ocultar_aviso()",7000);
-		}
-		Set_Cookie( "nuevos", xmlHttp.responseText, 0, "/",'','')
-	}
-}
-
-	function GetXmlHttpObject(handler)
-{
-	var objXmlHttp=null
-	if (navigator.userAgent.indexOf("Opera")>=0)
-	{
-		objXmlHttp=new XMLHttpRequest()
-		objXmlHttp.onload=handler
-		objXmlHttp.onerror=handler
-		return objXmlHttp
-	}
-	if (navigator.userAgent.indexOf("MSIE")>=0)
-	{
-		var strName="Msxml2.XMLHTTP"
-		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
-		{
-			strName="Microsoft.XMLHTTP"
-		}
-		try
-		{
-			objXmlHttp=new ActiveXObject(strName)
-			objXmlHttp.onreadystatechange=handler
-			return objXmlHttp
-		}
-		catch(e)
-		{
-		alert("Error. Scripting for ActiveX might be disabled")
-		return
-		}
-	}
-	if (navigator.userAgent.indexOf("Mozilla")>=0)
-	{
-		objXmlHttp=new XMLHttpRequest()
-		objXmlHttp.onload=handler
-		objXmlHttp.onerror=handler
-		return objXmlHttp
-	}
-}

+ 2 - 12
main/messages/inbox.php

@@ -10,7 +10,7 @@ require_once api_get_path(LIBRARY_PATH).'message.lib.php';
 api_block_anonymous_users();
 if (isset($_GET['messages_page_nr'])) {
 	if (api_get_setting('allow_social_tool')=='true' &&  api_get_setting('allow_message_tool')=='true') {
-		header('Location:../social/index.php?pager="'.Security::remove_XSS($_GET['messages_page_nr']).'"&remote=2#remote-tab-2');
+		header('Location:inbox.php');
 	}
 }
 if (api_get_setting('allow_message_tool')!='true'){
@@ -153,17 +153,7 @@ if ($_GET['f']=='social') {
 	if (api_get_setting('allow_message_tool') == 'true') {
 		echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
 	}	
-	$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
-	
-	//echo '<span style="float:right; padding-top:7px;">';
-				 
-	if (isset($_GET['type']) && $_GET['type'] == 'extended') {
-		echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
-	} else {
-		echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).'&nbsp;'.get_lang('EditExtendProfile').'</a>';
-	}
-	//echo '</span>';
-
+	echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?type=reduced">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
 	echo '</div>';
 
 

+ 0 - 2
main/messages/index.php

@@ -13,8 +13,6 @@ if (api_get_setting('allow_message_tool')!='true'){
 /* This page should be deleted */
  
 if(api_get_user_id()!=0) {
-	//echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'messages/cookies.js"> </script> ';
-	//echo '<script language="javascript" type="text/javascript">set_url("'.api_get_path(WEB_CODE_PATH).'messages/notify.php") ; notificar()</script> ';
 	$number_of_new_messages = MessageManager::get_new_messages();
 	
 	if(is_null($number_of_new_messages)) {

+ 83 - 66
main/messages/new_message.php

@@ -50,31 +50,24 @@ function validate(form,list)
 
 </script>';
 $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
+
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
+$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
+
 $htmlHeadXtra[] = '<script type="text/javascript">
-$(document).ready(function (){
-	cont=0;
-      $("#id_text_name").bind("keyup", function(){
-      	name=$("#id_text_name").get(0).value;
-		$.ajax({
-				contentType: "application/x-www-form-urlencoded",
-				beforeSend: function(objeto) {
-				/*$("#id_div_search").html("Searching...");*/ },
-				type: "POST",
-				url: "../social/select_options.php",
-				data: "search="+name,
-				success: function(datos){
-				$("#id_div_search").html(datos)
-				$("#id_search_name").bind("click", function(){
-					name_option=$("select#id_search_name option:selected").text();
-					code_option=$("select#id_search_name option:selected").val();
-					 $("#user_list").attr("value", code_option);
-					 $("#id_text_name").attr("value", name_option);
-					 $("#id_div_search").html("");
-					 cont++;
-				 });
-				}
-		});
-      });
+$(document).ready(function (){		
+		
+      		$("#users").fcbkcomplete({
+	            json_url: "'.api_get_path(WEB_PATH).'main/social/select_options.php?",
+	            cache: false,
+	            filter_case: true,
+	            filter_hide: true,
+				firstselected: true,
+	            //onremove: "testme",
+				//onselect: "testme",
+	            filter_selected: true,
+	            newel: true        
+          	});	
 });
 		
 var counter_image = 1;	
@@ -96,7 +89,7 @@ function add_image_form() {
 		
 </script>';
 
-$nameTools = api_xml_http_response_encode(get_lang('ComposeMessage'));
+$nameTools = get_lang('ComposeMessage');
 
 /*
 ==============================================================================
@@ -147,19 +140,47 @@ function manage_form ($default, $select_from_user_list = null) {
 	$message_id = intval($_GET['message_id']);
 
 	$form = new FormValidator('compose_message',null,null,null,array('enctype'=>'multipart/form-data'));	
-	if (empty($group_id)) {	
+	if (empty($group_id)) {
 		if (isset($select_from_user_list)) {
 			$form->add_textfield('id_text_name', get_lang('SendMessageTo'),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px'));
 			$form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required');
 			$form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>');
 			$form->addElement('hidden','user_list',0,array('id'=>'user_list'));
 		} else {
-			if ($default['user_list']==0) {
-				$form->add_textfield('id_text_name', get_lang('SendMessageTo'),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px'));
-				$form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required');
-				$form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>');
+			if (count($default['users'])==0) {
+				
+				//the magic should be here		
+			$pre_html = '<div class="row">
+						<div class="label">'.get_lang('SendTo').'</div>
+						<div class="formw">';
+			$post = '</div></div>';
+			
+						
+			$multi_select = '<select id="users" name="users">
+      						 </select>';			
+			$form->addElement('html',$pre_html.$multi_select.$post );
+			$url = api_get_path(WEB_CODE_PATH).'user';
+			//if cache is set to true the jquery will be called 1 time
+			$jquery_ready_content.= <<<EOF
+      		$("#extra_$field_details[1]").fcbkcomplete({
+	            json_url: "$url/$field_details[1].php?field_id=$field_details[0]",
+	            cache: false,
+	            filter_case: true,
+	            filter_hide: true,
+				firstselected: true,
+	            //onremove: "testme",
+				//onselect: "testme",
+	            filter_selected: true,
+	            newel: true        
+          	});	
+EOF;
+				
+		
+			//	$form->add_textfield('id_text_name', get_lang('SendMessageTo'),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px'));
+//				$form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required');
+	//			$form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>');
 			}
-			$form->addElement('hidden','user_list',0,array('id'=>'user_list'));
+			//$form->addElement('hidden','user_list',0,array('id'=>'user_list'));
 		}
 	} else {		
 		$group_info = GroupPortalManager::get_group_data($group_id);
@@ -167,8 +188,11 @@ function manage_form ($default, $select_from_user_list = null) {
 		$form->addElement('hidden','group_id',$group_id);
 		$form->addElement('hidden','parent_id',$message_id);		
 	}
-	$form->add_textfield('title', api_xml_http_response_encode(get_lang('Title')));	
-	$form->add_html_editor('content', '', false, false, array('ToolbarSet' => 'Messages', 'Width' => '95%', 'Height' => '250'));
+	$form->add_textfield('title', api_xml_http_response_encode(get_lang('Title')));
+		
+	//$form->add_html_editor('content', '', false, false, array('ToolbarSet' => 'Messages', 'Width' => '95%', 'Height' => '250'));
+	$form->addElement('textarea','content', get_lang('Message'), array('cols' => 75,'rows'=>5));
+	
 	if (isset($_GET['re_id'])) {
 		$form->addElement('hidden','re_id',Security::remove_XSS($_GET['re_id']));
 		$form->addElement('hidden','save_form','save_form');
@@ -190,17 +214,23 @@ function manage_form ($default, $select_from_user_list = null) {
 		$default['title']=get_lang('Re:').api_html_entity_decode($message_info['title'],ENT_QUOTES,$charset);		
 	}		
 	$form->setDefaults($default);
-	if ($form->validate()) {				
-		$values = $form->exportValues();				
-		$receiver_user_id = $values['user_list'];
-		$title = $values['title'];
-		$content = $values['content'];
+	if ($form->validate()) {
+		$values = $default;
+
+		$user_list = $values['users'];
 		$file_comments = $_POST['legend'];
-		$group_id = $values['group_id'];
-		$parent_id = $values['parent_id'];
-		//all is well, send the message
-		MessageManager::send_message($receiver_user_id, $title, $content, $_FILES, $file_comments, $group_id, $parent_id);		
-		MessageManager::display_success_message($receiver_user_id);	
+		$title 		= $values['title'];
+		$content 	= $values['content'];
+		
+		$group_id	= $values['group_id'];
+		$parent_id 	= $values['parent_id'];
+		if (is_array($user_list) && count($user_list)> 0) {
+			//all is well, send the message
+			foreach ($user_list as $user) {				
+				MessageManager::send_message($user, $title, $content, $_FILES, $file_comments, $group_id, $parent_id);
+				MessageManager::display_success_message($user);	
+			}			
+		}			
 	} else {
 		$form->display();
 	}
@@ -219,6 +249,7 @@ if ($_GET['f']=='social') {
 	$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
 	$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));
 }
+
 Display::display_header('');
 
 
@@ -230,8 +261,7 @@ if ($group_id != 0) {
 	echo '<a href="'.api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id.'">'.Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('BackToGroup')).'</a>';
 	echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
 	echo '</div>';
-} else {
-	
+} else {	
 	if ($_GET['f']=='social') {
 		require_once api_get_path(LIBRARY_PATH).'social.lib.php';
 		SocialManager::show_social_menu();
@@ -247,16 +277,8 @@ if ($group_id != 0) {
 		if (api_get_setting('allow_message_tool') == 'true') {
 			echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
 		}	
-		$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
-		
-		//echo '<span style="float:right; padding-top:7px;">';
-					 
-		if (isset($_GET['type']) && $_GET['type'] == 'extended') {
-			echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
-		} else {
-			echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).'&nbsp;'.get_lang('EditExtendProfile').'</a>';
-		}
-		//echo '</span>';
+		echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?type=reduced">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
+
 		echo '</div>';
 	}
 	
@@ -291,12 +313,10 @@ echo '<div id="inbox-wrapper">';
 				show_compose_to_any($_user['user_id']);
 		  	}
 		  	
-		} else {
-			
-			$restrict = false;
-			
-			if (isset($_POST['id_text_name'])) {
-				$restrict = $_POST['id_text_name'];
+		} else {			
+			$restrict = false;			
+			if (isset($_POST['users'])) {
+				$restrict = $_POST['users'];
 			} else if (isset($_POST['group_id'])) {
 				$restrict = $_POST['group_id'];
 			} 
@@ -304,15 +324,12 @@ echo '<div id="inbox-wrapper">';
 			if (isset($_GET['re_id'])) {
 				$default['title'] = api_xml_http_response_encode($_POST['title']);
 				$default['content'] = api_xml_http_response_encode($_POST['content']);
-				//$default['user_list'] = $_POST['user_list'];
 				manage_form($default);
-			} else {
-				var_dump($restrict);
+			} else {			
 				if ($restrict) {
 					$default['title'] = api_xml_http_response_encode($_POST['title']);			
 					if (!isset($_POST['group_id'])) {
-						$default['id_text_name'] = api_xml_http_response_encode($_POST['id_text_name']);
-						$default['user_list'] = $_POST['user_list'];
+						$default['users']	 = $_POST['users'];
 					} else {
 						$default['group_id'] = $_POST['group_id'];
 					}

+ 2 - 12
main/messages/outbox.php

@@ -14,7 +14,7 @@ require_once api_get_path(LIBRARY_PATH).'message.lib.php';
 api_block_anonymous_users();
 if (isset($_GET['messages_page_nr'])) {
 	if (api_get_setting('allow_social_tool')=='true' &&  api_get_setting('allow_message_tool')=='true') {
-		header('Location:../social/index.php?pager="'.Security::remove_XSS($_GET['messages_page_nr']).'"&remote=3#remote-tab-3');
+		header('Location:outbox.php?pager="'.Security::remove_XSS($_GET['messages_page_nr']).'"&remote=3#remote-tab-3');
 	}
 }
 if (api_get_setting('allow_message_tool')!='true'){
@@ -87,17 +87,7 @@ if ($_GET['f']=='social') {
 		if (api_get_setting('allow_message_tool') == 'true') {
 			echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
 		}	
-		$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
-		
-		//echo '<span style="float:right; padding-top:7px;">';
-					 
-		if (isset($_GET['type']) && $_GET['type'] == 'extended') {
-			echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
-		} else {
-			echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).'&nbsp;'.get_lang('EditExtendProfile').'</a>';
-		}
-		//echo '</span>';
-		
+		echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?type=reduced">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
 		echo '</div>';
 	}
 }

+ 3 - 1
main/social/friends.php

@@ -6,6 +6,7 @@
  */
 
 $language_file = array('userInfo');
+$cidReset=true;
 require '../inc/global.inc.php';
 require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
 require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
@@ -109,7 +110,8 @@ function clear_form () {
 }
 </script>';
 
-$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
+$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
+$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Friends'));
 
 Display :: display_header($tool_name, 'Groups');
 SocialManager::show_social_menu();

+ 1 - 1
main/social/group_invitation.php

@@ -559,7 +559,7 @@ function makepost(select){
 $members = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION));
 if (is_array($members) && count($members)>0) {
 	echo get_lang('UsersAlreadyInvited');
-	Display::display_sortable_grid('search_users', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true));
+	Display::display_sortable_grid('search_users', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true));
 }
 
 

+ 114 - 0
main/social/group_waiting_list.php

@@ -0,0 +1,114 @@
+<?php
+/* For licensing terms, see /chamilo_license.txt */
+/**
+ * @package dokeos.social
+ * @author Julio Montoya <gugli100@gmail.com>
+ */
+ 
+$language_file = array('userInfo');
+require '../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'social.lib.php';
+
+$this_section = SECTION_SOCIAL;
+
+$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
+
+api_block_anonymous_users();
+
+$group_id	= intval($_GET['id']);
+
+//todo @this validation could be in a function in group_portal_manager
+if (empty($group_id)) {
+	api_not_allowed();
+} else {
+	$group_info = GroupPortalManager::get_group_data($group_id);
+	if (empty($group_info)) {
+		api_not_allowed();
+	}
+	//only admin or moderator can do that
+	$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
+	if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
+		api_not_allowed();		
+	}
+}
+
+
+Display :: display_header($tool_name, 'Groups');
+SocialManager::show_social_menu();
+echo '<div class="actions-title">';
+echo get_lang('GroupWaitingList');
+echo '</div>'; 
+
+// Group information
+$admins		= GroupPortalManager::get_users_by_group($group_id, true,array(GROUP_USER_PERMISSION_ADMIN));
+$show_message = ''; 
+
+if (isset($_GET['action']) && $_GET['action']=='accept') {
+	// we add a user only if is a open group
+	$user_join = intval($_GET['u']);
+	//if i'm a moderator		
+	if (GroupPortalManager::is_group_moderator(api_get_user_id())) {
+		GroupPortalManager::update_user_role($user_join, $group_id);
+		$show_message = get_lang('UserAdded');
+	}	
+}
+
+if (isset($_GET['action']) && $_GET['action']=='deny') {	
+	// we add a user only if is a open group
+	$user_join = intval($_GET['u']);
+	//if i'm a moderator		
+	if (GroupPortalManager::is_group_moderator(api_get_user_id())) {
+		GroupPortalManager::delete_user_rel_group($user_join, $group_id); 
+		$show_message = get_lang('UserDeleted');
+	}
+}
+
+
+if (isset($_GET['action']) && $_GET['action']=='set_moderator') {	
+	// we add a user only if is a open group
+	$user_moderator= intval($_GET['u']);
+	//if i'm the admin		
+	if (GroupPortalManager::is_group_admin(api_get_user_id())) {
+		GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR); 
+		$show_message = get_lang('UserChangeToModerator');
+	}
+}
+
+
+
+if (! empty($show_message)){
+	Display :: display_normal_message($show_message);
+}
+
+$users	= GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER));
+$new_member_list = array();
+
+
+	//Shows left column
+	echo GroupPortalManager::show_group_column_information($group_id, api_get_user_id());	
+	
+	//-- Show message groups	
+	echo '<div id="layout_right" style="margin-left: 282px;">';	
+		
+	// Display form
+	foreach($users as $user) {	 
+		switch ($user['relation_type']) {			
+			case  GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER:
+			$user['link'] = '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=accept">'.Display::return_icon('add_user.gif', get_lang('Accept')).'</a>';
+			$user['link'] .= '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_moderator">'.Display::return_icon('add_teacher_big.gif', get_lang('Moderator')).'</a>';
+			$user['link'] .='<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=deny">'.Display::return_icon('delete.gif', get_lang('Deny')).'</a>';
+			break;				
+		}
+		$new_member_list[] = $user;
+	}
+	
+	if (count($new_member_list) > 0) {			
+		Display::display_sortable_grid('search_users', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true,false,true,true));		
+	}
+	
+	echo '</div>'; // end layout right
+	
+Display :: display_footer();
+?>

+ 4 - 4
main/social/groups.php

@@ -4,7 +4,7 @@
  * @package dokeos.social
  * @author Julio Montoya <gugli100@gmail.com>
  */
- 
+$cidReset=true;
 $language_file = array('userInfo');
 require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
@@ -63,7 +63,8 @@ function add_image_form() {
 			
 	</script>';
 
-$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
+$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
+$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Groups'));
 Display :: display_header($tool_name, 'Groups');
 
 // save message group
@@ -83,7 +84,6 @@ echo '</div>';
 
 // getting group information
 $group_id	= intval($_GET['id']);
-
 	
 if ($group_id != 0 ) {
 	//Loading group information
@@ -108,7 +108,7 @@ if ($group_id != 0 ) {
 			if ($group_info['visibility'] == GROUP_PERMISSION_OPEN) {
 				GroupPortalManager::add_user_to_group($user_join, $group_id);				
 			} else {
-				GroupPortalManager::add_user_to_group($user_join, $group_id, GROUP_USER_PERMISSION_PENDING_INVITATION);
+				GroupPortalManager::add_user_to_group($user_join, $group_id, GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER);
 			}				
 		}
 	}

+ 3 - 1
main/social/invitations.php

@@ -5,6 +5,7 @@
  * @author Julio Montoya <gugli100@gmail.com>
  */
 $language_file = array('messages','userInfo');
+$cidReset=true;
 require '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'image.lib.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
@@ -13,7 +14,8 @@ require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
 
 $this_section = SECTION_SOCIAL;
 
-$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
+$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
+$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Invitations'));
 
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
 $htmlHeadXtra[] = '

+ 5 - 9
main/social/profile.php

@@ -184,22 +184,18 @@ function register_friend(element_input) {
 
 </script>';
 if (isset($_GET['shared'])) {
-	$my_link='../social/index.php';
+	$my_link='../social/profile.php';
 	$link_shared='shared='.Security::remove_XSS($_GET['shared']);
 } else {
-	$my_link='../auth/profile.php';
+	$my_link='../social/profile.php';
 	$link_shared='';
 }
-$interbreadcrumb[]= array ('url' =>$my_link,'name' => get_lang('ModifyProfile') );
-
-$interbreadcrumb[]= array (
-	'url' => '../social/profile.php?'.$link_shared.'#remote-tab-1',
-	'name' => get_lang('ViewMySharedProfile')
-);
+$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social') );
+//$interbreadcrumb[]= array ('url' => '../social/profile.php?'.$link_shared.'#remote-tab-1','name' => get_lang('ViewMySharedProfile'));
 
 if (isset($_GET['u']) && is_numeric($_GET['u'])) {
 	$info_user=api_get_user_info($_GET['u']);
-	$interbreadcrumb[]= array ('url' => 'javascript: void(0);','name' => api_get_person_name($info_user['firstName'], $info_user['lastName']));
+	$interbreadcrumb[]= array ('url' => '#','name' => api_get_person_name($info_user['firstName'], $info_user['lastName']));
 }
 if (isset($_GET['u'])) {
 	$param_user='u='.Security::remove_XSS($_GET['u']);

+ 2 - 1
main/social/search.php

@@ -7,6 +7,7 @@
  
 // name of the language file that needs to be included
 $language_file = array('registration','admin','userInfo');
+$cidReset = true;
 require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'social.lib.php';
@@ -16,7 +17,7 @@ api_block_anonymous_users();
 
 $this_section = SECTION_SOCIAL;
 $tool_name = get_lang('Search');
-$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
+$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
 
 Display :: display_header($tool_name);
 //show the action menu

+ 13 - 4
main/social/select_options.php

@@ -34,10 +34,19 @@ if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_messa
 	 WHERE DATE_ADD(login_date,INTERVAL "'.$valid.'" MINUTE) >= "'.$current_date.'" AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") ';
 }
 
-$res=Database::query($sql,__FILE__,__LINE__);
+$result=Database::query($sql,__FILE__,__LINE__);/*
 while ($row=Database::fetch_array($res,'ASSOC')) {
 	$html_form.='<option value="'.$row['id'].'">'.api_xml_http_response_encode($row['name']).'</option>';
-}
-$html_form.='</select>';
-echo $html_form;
+}*/
+
+if (Database::num_rows($result)>0) {
+		while ($row = Database::fetch_array($result,'ASSOC')) {
+		$return[] = array('caption'=>$row['name'], 'value'=>$row['id']);
+	}
+}		
+
+$return =  json_encode($return);
+
+
+echo $return;
 ?>