Browse Source

[svn r18884] logic changes - added restriction, when message tool is active -(partial FS#3751)

Isaac Flores 16 years ago
parent
commit
c34042d8b3

+ 10 - 3
main/auth/profile.php

@@ -1,4 +1,4 @@
-<?php // $Id: profile.php 18843 2009-03-09 00:55:20Z iflorespaz $
+<?php // $Id: profile.php 18884 2009-03-09 18:15:49Z iflorespaz $
 /* For licensing terms, see /dokeos_license.txt */
 /**
 ==============================================================================
@@ -696,10 +696,17 @@ if (!empty($_SESSION['production_uploaded']))
 }
 
 if (isset($_GET['show'])) {
-	$interbreadcrumb[]= array (
+	if ((api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') ||(api_get_setting('allow_social_tool')=='true') && api_get_user_id()<>2 && api_get_user_id()<>0) {
+		$interbreadcrumb[]= array (
 		'url' => '../social/'.$_SESSION['social_dest'].'?#remote-tab-1',
 		'name' => get_lang('SocialNetwork')
-	);
+		);
+	} elseif ((api_get_setting('allow_social_tool')=='false' && api_get_setting('allow_message_tool')=='true')) {
+		$interbreadcrumb[]= array (
+		'url' => '../social/'.$_SESSION['social_dest'].'?#remote-tab-1',
+		'name' => get_lang('MessageTool')
+		);	
+	}
 }
 
 /*

+ 7 - 1
main/messages/send_message_to_userfriend.inc.php

@@ -31,7 +31,7 @@ include_once(api_get_path(LIBRARY_PATH).'/usermanager.lib.php');
 include_once(api_get_path(LIBRARY_PATH).'/message.lib.php');
 include_once(api_get_path(LIBRARY_PATH).'/social.lib.php');
 api_block_anonymous_users();
-if (api_get_setting('allow_message_tool')!='true'){
+if (api_get_setting('allow_message_tool')<>'true' && api_get_setting('allow_social_tool')<>'true'){
 	api_not_allowed();
 }
 ?>
@@ -78,8 +78,14 @@ if (api_get_setting('allow_message_tool')!='true'){
 				<dd><a href="javascript:void(0)" onclick="change_panel('2','<?php echo $userfriend_id; ?>')"><?php echo get_lang('SocialAddToContact')?></a></dd>
 <?php
 			}
+?>
+<?php       
+			if (api_get_setting('allow_message_tool')=='true') {
 ?>
 				<dd><a href="javascript:void(0)" onclick="change_panel('1','<?php echo $userfriend_id; ?>')"><?php echo get_lang('SocialSendMessage');?></a></dd>
+<?php
+			}
+?>
 <?php
 			if (!isset($_REQUEST['view'])) {
 ?>

+ 4 - 2
main/social/data_personal.inc.php

@@ -88,8 +88,10 @@ if (isset($_POST['load_ajax'])) {
 } else {
 	// normal behavior
 	echo '<div id="actions" class="actions">';
-		echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.mb_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>&nbsp;&nbsp;';
-		echo '<a href="../social/profile.php">'.Display::return_icon('edit.gif').'&nbsp;'.mb_convert_encoding(get_lang('ViewSharedProfile'),'UTF-8',$charset).'</a>';
+	echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.mb_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>&nbsp;&nbsp;';
+	if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
+		echo '<a href="../social/profile.php">'.Display::return_icon('edit.gif').'&nbsp;'.mb_convert_encoding(get_lang('ViewSharedProfile'),'UTF-8',$charset).'</a>';	
+	}
 	echo '</div>';
 	
 	echo '<div id="profile_container" style="width:550px;display:block;">';

+ 6 - 1
main/social/group_contact.inc.php

@@ -62,7 +62,12 @@ if (count($list_path_friends)!=0) {
 			if ($list_friends_file[$j]<>"") {
 				$user_info=api_get_user_info($list_friends_id[$j]);
 				$name_user=$user_info['firstName'].' '.$user_info['lastName'];
-				$friend_html.='&nbsp;<div class="image-social-content" id=div_'.$list_friends_id[$j].' style="float:left" ><a href="javascript:void(0)" onclick=load_thick("'.$list_friends_dir[$j].'big_'.$list_friends_file[$j].'","'.urlencode($name_user).'") title="" class="thickbox"><img src="'.$list_friends_dir[$j].$list_friends_file[$j].'" width="90" height="110" style="margin-left:3px ;margin-rigth:3px;margin-top:10px;margin-bottom:3px;" id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" /></a></div>&nbsp;';	
+				if($list_friends_file[$j]==='unknown.jpg') {
+					$big='';
+				} else {
+					$big='big_';
+				}
+				$friend_html.='&nbsp;<div class="image-social-content" id=div_'.$list_friends_id[$j].' style="float:left" ><a href="javascript:void(0)" onclick=load_thick("'.$list_friends_dir[$j].$big.$list_friends_file[$j].'","'.urlencode($name_user).'") title="" class="thickbox"><img src="'.$list_friends_dir[$j].$list_friends_file[$j].'" width="90" height="110" style="margin-left:3px ;margin-rigth:3px;margin-top:10px;margin-bottom:3px;" id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" /></a></div>&nbsp;';	
 			}
 			$j++;
 		}

+ 10 - 2
main/social/index.php

@@ -405,10 +405,18 @@ $interbreadcrumb[]= array (
 	'url' => '#',
 	'name' => get_lang('ModifyProfile')
 );
-$interbreadcrumb[]= array (
+if ((api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') ||(api_get_setting('allow_social_tool')=='true') && api_get_user_id()<>2 && api_get_user_id()<>0) {
+	$interbreadcrumb[]= array (
 	'url' => 'index.php?#remote-tab-1',
 	'name' => get_lang('SocialNetwork')
-);
+	);
+} elseif ((api_get_setting('allow_social_tool')=='false' && api_get_setting('allow_message_tool')=='true')) {
+	$interbreadcrumb[]= array (
+	'url' => 'index.php?#remote-tab-1',
+	'name' => get_lang('MessageTool')
+	);	
+}
+
 Display :: display_header('');
 if (isset($_GET['sendform'])) {
 	$form_reply=array();

+ 24 - 4
main/social/profile.php

@@ -183,6 +183,25 @@ function hide_display_message () {
 		$("#txt_area_invite").val("");
 	}
 }	
+function register_friend(element_input) {
+ if(confirm("'.get_lang('AddToContacts').'")) {
+		name_button=$(element_input).attr("id");
+		name_div_id="id_"+name_button.substring(13);
+		user_id=name_div_id.split("_");
+		user_friend_id=user_id[1];
+		 $.ajax({
+			contentType: "application/x-www-form-urlencoded",
+			beforeSend: function(objeto) {
+			$("#id_response").html("'.get_lang('Loading').'"); },
+			type: "POST",
+			url: "../social/register_friend.php",
+			data: "friend_id="+user_friend_id,
+			success: function(datos) {
+			 $("div#id_response").html(datos);
+			}
+		});
+ }
+}
 </script>';
 $interbreadcrumb[]= array ('url' => '#','name' => get_lang('ModifyProfile') );
 $interbreadcrumb[]= array (
@@ -500,8 +519,8 @@ echo '<div id="social-profile-wrapper">';
 			$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id($user_id);
 			$count_pending_invitations = count($pending_invitations);
 			echo '<div class="clear"></div><br />';		
-				
-			echo '<div id="social-profile-invitations" style="width:240px;" >';
+				//javascript:register_friend(this)
+			/*echo '<div id="social-profile-invitations" style="width:240px;" >';
 			if ($count_pending_invitations > 0) {
 			
 				api_display_tool_title(get_lang('PendingInvitations'));
@@ -514,13 +533,14 @@ echo '<div id="social-profile-wrapper">';
 						echo '<div style="padding-left:70px;">';
 							echo ' '.substr($pending_invitations[$i]['content'],19);
 							echo '<br />';
-							echo '<a href="">'.get_lang('AddToFriends').'</a>';
+							echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('AddToFriends').'</a>';
+							echo '<div id="id_response">&nbsp;</div>';
 						echo '</div>';
 					echo '</div>';
 					echo '<div class="clear"></div>';
 				}
 			}
-			echo '</div>';			
+			echo '</div>';	*/		
 			echo '<div class="clear"></div><br />';			
 			
 			//--Productions			

+ 5 - 5
whoisonline.php

@@ -1,4 +1,4 @@
-<?php // $Id: whoisonline.php 18878 2009-03-09 16:58:15Z iflorespaz $
+<?php // $Id: whoisonline.php 18884 2009-03-09 18:15:49Z iflorespaz $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -68,7 +68,7 @@ function change_panel (mypanel_id,myuser_id) {
 			beforeSend: function(objeto) {
 			$("#id_content_panel").html("'.get_lang('Loading').'"); },
 			type: "POST",
-			url: "./main/messages/send_message.php",
+			url: "main/messages/send_message.php",
 			data: "panel_id="+mypanel_id+"&user_id="+myuser_id,
 			success: function(datos) {
 			 $("div#id_content_panel_init").html(datos);
@@ -94,7 +94,7 @@ function action_database_panel(option_id,myuser_id) {
 		beforeSend: function(objeto) {
 		$("#display_response_id").html("'.get_lang('Loading').'"); },
 		type: "POST",
-		url: "./main/messages/send_message.php",
+		url: "main/messages/send_message.php",
 		data: "panel_id="+option_id+"&user_id="+myuser_id+"&txt_subject="+my_txt_subject+"&txt_content="+my_txt_content,
 		success: function(datos) {
 		 $("#display_response_id").html(datos);
@@ -162,7 +162,7 @@ function display_user_list($user_list, $_plugins)
 				$table_row[] = Display::encrypted_mailto_link($user_info['mail']);
 			}
 			
-			if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
+			if (api_get_setting('allow_social_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
 				if ($user_info['user_id'] != api_get_user_id()) {
 					$user_relation=UserFriend::get_relation_between_contacts(api_get_user_id(),$user_info['user_id']);
 					if ($user_relation==0 || $user_relation==6) {
@@ -189,7 +189,7 @@ function display_user_list($user_list, $_plugins)
 			$table_header[] = array(get_lang('Email'),true);
 		}
 
-		if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
+		if (api_get_setting('allow_social_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
 			$table_header[] = array(get_lang('Friends'),true,'width="100"');
 		}		
 		/*this feature is deprecated