Julio Montoya 15 år sedan
förälder
incheckning
e5feb97f3b

+ 3 - 3
main/admin/user_list.php

@@ -450,7 +450,7 @@ function modify_filter($user_id,$url_params,$row)
 	$is_admin = in_array($user_id,$_admins_list);
 	$statusname = api_get_status_langvars();
 	$user_is_anonymous = false;
-	if ($row['6'] == $statusname[ANONYMOUS]) {
+	if ($row['7'] == $statusname[ANONYMOUS]) {
 		$user_is_anonymous =true;
 	}
 	if (!$user_is_anonymous) {
@@ -471,7 +471,7 @@ function modify_filter($user_id,$url_params,$row)
 	}
 
     //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins)
-    if (api_is_platform_admin() || (api_is_session_admin() && $row['6'] == $statusname[STUDENT])) {
+    if (api_is_platform_admin() || (api_is_session_admin() && $row['7'] == $statusname[STUDENT])) {
     	if (!$user_is_anonymous) {
         	$result .= '<a href="user_list.php?action=login_as&amp;user_id='.$user_id.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon('login_as.gif', get_lang('LoginAs')).'</a>&nbsp;&nbsp;';
     	} else {
@@ -480,7 +480,7 @@ function modify_filter($user_id,$url_params,$row)
     } else {
     	$result .= Display::return_icon('login_as_na.gif', get_lang('LoginAs')).'&nbsp;&nbsp;';
     }
-	if ($row['6'] != $statusname[STUDENT]) {
+	if ($row['7'] != $statusname[STUDENT]) {
 		$result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).'&nbsp;&nbsp;';
 	} else {
 		$result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;&nbsp;';

+ 11 - 10
main/inc/lib/group_portal_manager.lib.php

@@ -349,7 +349,7 @@ class GroupPortalManager
 			$user_profile = UserManager::get_picture_user($row['user_id'], $image_path['file'], 60, 'medium_');
 			if ($with_image == true) {
 				$picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],$image_conf['height'],$image_conf['size']);						
-				$row['image'] = '<img src="'.$user_profile['file'].'"  '.$picture['style'].'  width="60" height="60"/>';
+				$row['image'] = '<img src="'.$user_profile['file'].'"  '.$picture['style'].'  />';
 			}
 			$array[$row['user_id']] = $row;			
 		}
@@ -1071,11 +1071,11 @@ class GroupPortalManager
 		
 		//@todo this must be move to default.css for dev use only
 		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_members { width:270px; height:300px; overflow-x:none; overflow-y: auto;}
+				.group_member_item { width:100px; height:130px; float:left; margin:5px 5px 15px 5px; }
 				.group_member_picture { display:block;				
 					margin:0;
-					overflow:hidden; }; 
+					overflow:hidden; };
 		</style>';
 		echo '<div id="layout-left" style="float: left; width: 270px; height: 100%;">';
 	
@@ -1185,14 +1185,15 @@ class GroupPortalManager
 				if (in_array($member['relation_type'] , array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER,GROUP_USER_PERMISSION_MODERATOR))) {
 					//add icons		
 					if ($member['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
-						$member['lastname'].= Display::return_icon('admin_star.png', get_lang('Admin'));
-					}
-					if ($member['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
-						$member['lastname'].= Display::return_icon('moderator_star.png', get_lang('Moderator'));
-					}					
+						$icon= Display::return_icon('admin_star.png', get_lang('Admin'));
+					}elseif ($member['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
+						$icon= Display::return_icon('moderator_star.png', get_lang('Moderator'));
+					} else{
+						$icon= '';
+					}			
 					echo '<div class="group_member_item"><a href="profile.php?u='.$member['user_id'].'">';
 					echo '<div class="group_member_picture">'.$member['image'].'</div>';
-					echo api_get_person_name($member['firstname'], $member['lastname']).'</a></div>';
+					echo api_get_person_name(cut($member['firstname'],15),cut($member['lastname'],15)).'<br />'.$icon.'</a></div>';
 				}
 			}
 			if (count($members) > 15) { 

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

@@ -213,7 +213,10 @@ class MessageManager
 			}
 		}
 		
-		if ($total_filesize > intval(api_get_setting('message_max_upload_filesize'))) {			
+		// validating fields
+		if (empty($subject)) {
+			return get_lang('YouShouldWriteASubject');
+		} else if ($total_filesize > intval(api_get_setting('message_max_upload_filesize'))) {			
 			return sprintf(get_lang("FilesSizeExceedsX"),format_file_size(api_get_setting('message_max_upload_filesize')));
 		}
 		

+ 3 - 3
main/inc/lib/social.lib.php

@@ -443,7 +443,7 @@ class SocialManager extends UserManager {
 	    foreach ($feeds as $url) {
 		if (empty($url)) { continue; }
 
-	        $rss = fetch_rss($url);
+	        $rss = @fetch_rss($url);
 	    	$res .= '<h2>'.$rss->channel['title'].'</h2>';
 	        $res .= '<div class="social-rss-channel-items">';
 	        $i = 1;
@@ -712,7 +712,7 @@ class SocialManager extends UserManager {
 				// reduce image
 				$name = api_get_person_name($user_info['firstName'], $user_info['lastName']);
 				$table_row[] = '<a href="'.$url.'"><img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'" '.$friends_profile['style'].' border="1"></a>';
-				$table_row[] = '<a href="'.$url.'" style="font-size:10px;">'.api_get_person_name($user_info['firstName'], $user_info['lastName']).'</a>';
+				$table_row[] = '<a href="'.$url.'" style="font-size:10px;">'.api_get_person_name(cut($user_info['firstName'],15), cut($user_info['lastName'],15)).'</a>';
 				
 	
 				//$table_row[] = '<a href="'.$url.'">'.$user_info['lastName'].'</a>';
@@ -818,7 +818,7 @@ class SocialManager extends UserManager {
 				echo '<dt><div class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div></dt>';
 				echo '<dd>'.$user_object->teach.'</dd>';;
 			}
-			display_productions($user_object->user_id);
+			SocialManager::display_productions($user_object->user_id);
 			if ($user_object->openarea) {
 				echo '<dt><div class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div></dt>';
 				echo '<dd>'.$user_object->openarea.'</dd>';

+ 6 - 7
main/messages/send_message.php

@@ -49,15 +49,14 @@ if ($panel_id == 2 || $panel_id == 4 )  {
 	<dd><a href="javascript:void(0)" onclick="change_panel('1','<?php echo $user_id; ?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage'));?></a></dd>
 </dl>
 <?php
-}elseif($panel_id == 5 && empty($content_message)) {
+}elseif($panel_id == 5 && empty($subject_message)) {
 ?>
 	 <div id="display_response_id" style="height:200px;">
 	 <?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>			  		 
 	 <br />
-	 <br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
-	 <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="4" cols="40"></textarea>
-	 <?php echo api_xml_http_response_encode(get_lang('YouShouldWriteAMessage'));  ?><br />
-	 <br />
+	 <br /><span style="color:red">*</span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
+	 <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="3" cols="40"></textarea>	 
+	 <?php echo Display::display_error_message(api_xml_http_response_encode(get_lang('YouShouldWriteASubject')));  ?>	 
 	 <button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $user_id;?>')">
 	 <?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
 	 </div>
@@ -68,7 +67,7 @@ if ($panel_id==4 && !empty($content_message)) {
 		$subject_message=null;
 	}	
 	SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
-} elseif ($panel_id==5 && !empty($content_message) ) {
+} elseif ($panel_id==5 && !empty($subject_message) ) {
 	SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
 }
-?>
+?>

+ 5 - 5
main/messages/send_message_to_userfriend.inc.php

@@ -49,10 +49,11 @@ if ( isset($_REQUEST['user_friend']) ) {
 		   		 <div id="display_response_id" style="height:200px;">
 			  		 <?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>			  		 
 			  		 <br />
-			 		 <br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
-			   		 <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="4" cols="40"></textarea>
+			 		 <br /><span style="color:red">*</span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
+			   		 <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="3" cols="40"></textarea>			   		 
+			   		 <div><span style="color:red">*</span><?php echo get_lang('FieldRequired') ?></div>
 			   		 <br />
-			   		 <button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $userfriend_id;?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
+			   		 <button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $userfriend_id;?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>			   		 
 		   		 </div>
 <?php
 			} else {
@@ -64,8 +65,7 @@ if ( isset($_REQUEST['user_friend']) ) {
  					<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')); ?>" onclick="action_database_panel('4','<?php echo $userfriend_id;?>')" >
  					<?php echo api_xml_http_response_encode(get_lang('SendInvitation')) ?></button>
  				</div>
-<?php
-				}
+<?php			}
 			}
 ?>
 			</dl>

+ 10 - 2
main/social/groups.php

@@ -60,6 +60,14 @@ function add_image_form() {
 	}
 }
 
+function validate_text_empty (str,msg) {
+	var str = str.replace(/^\s*|\s*$/g,"");
+	if (str.length == 0) {		 		
+		alert(msg);
+		return true;			
+	}			
+}
+
 jQuery(document).ready(function() {
    $(".head").click(function() {   			
 		$(this).next().next().slideToggle("fast");
@@ -82,7 +90,6 @@ jQuery(document).ready(function() {
 		return false;
  	}).next().next().hide();
 });
-
 	</script>';
 
 $interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
@@ -108,7 +115,8 @@ if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) {
 		} else {		
 			$res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id);	
 		}
-						
+		
+		// display error messages 						
 		if (is_string($res)) {			
 			Display::display_error_message($res);
 		}		

+ 4 - 3
main/social/message_for_group_form.inc.php

@@ -72,7 +72,7 @@ if (!empty($group_id) && $allowed_action) {
 		   		$user_info=api_get_user_info($userfriend_id);
 		  		echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode($to_group); ?>
 		  		<br />
-		 		<br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
+		 		<br /><span style="color:red">*</span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
 		 		<input id="txt_subject_id" name="title" type="text" style="width:450px;" value="<?php echo $subject ?>"><br/>
 		   		<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br />		   		
 		   		<?php
@@ -86,9 +86,10 @@ if (!empty($group_id) && $allowed_action) {
 		   		?>		   		
 		   		<br /><br /><?php echo api_xml_http_response_encode(get_lang('AttachmentFiles')); ?> :<br />
 				<span id="filepaths"><div id="filepath_1"><input type="file" name="attach_1" size="20" /></div></span>
-				<div id="link-more-attach"><a href="javascript://" onclick="return add_image_form()"><?php echo get_lang('AddOneMoreFile') ?></a>&nbsp;(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)</div>		   		
+				<div id="link-more-attach"><a href="javascript://" onclick="return add_image_form()"><?php echo get_lang('AddOneMoreFile') ?></a>&nbsp;(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)</div>		   				   				   		
 		   		<br />
-		   		<button class="save" type="submit" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
+		   		<button class="save" onclick="if(validate_text_empty(this.form.title.value,'<?php echo get_lang('YouShouldWriteASubject')?>')){return false;}" type="submit" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
+		   		<div><span style="color:red">*</span><?php echo get_lang('FieldRequired') ?></div>
 	<?php } ?>
 	</dl>
 </td>