Browse Source

Minor - deleting unused files

Julio Montoya 13 years ago
parent
commit
fa3a63c951

+ 15 - 1
main/inc/ajax/message.ajax.php

@@ -3,12 +3,26 @@
 /**
  * Responses to AJAX calls
  */
+
+$language_file = array('messages','userInfo');
+
 require_once '../global.inc.php';
+
 $action = $_GET['a'];
 
 switch ($action) {
+    case 'send_message':        
+        $result = MessageManager::send_message($_REQUEST['user_id'], $_REQUEST['subject'], $_REQUEST['content']);
+        if ($result) {
+            echo Display::display_confirmation_message(get_lang('MessageHasBeenSent'));
+        } else {
+            echo Display::display_error_message(get_lang('ErrorSendingMessage'));
+        }
+        break;
+    case 'send_invitation':
+        SocialManager::send_invitation_friend_user($_REQUEST['user_id'], $_REQUEST['subject'], $_REQUEST['content']);                
+        break;
 	case 'find_users':
-
 		if (api_is_anonymous()) {
 			echo '';
 			break;

+ 1 - 2
main/messages/index.php

@@ -12,5 +12,4 @@ if (api_get_setting('allow_social_tool')=='true' &&  api_get_setting('allow_mess
 } elseif ( api_get_setting('allow_message_tool')=='true') {
 	header('Location:inbox.php');
 }
-exit;
-?>
+exit;

+ 0 - 75
main/messages/send_message.php

@@ -1,75 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
-*	@package chamilo.messages
-*/
-/**
- * Code
- */
-$language_file = array('registration','messages','userInfo','admin');
-$cidReset = true;
-require_once '../inc/global.inc.php';
-
-if (api_is_anonymous()) {
-	api_not_allowed();
-}
-
-$user_id	= intval($_POST['user_id']);
-$panel_id	= intval($_POST['panel_id']);
-
-$content_message = $_POST['txt_content'];
-$subject_message = $_POST['txt_subject'];
-
-$user_info = array();
-$user_info = api_get_user_info($user_id);
-
-if ($panel_id == 2 || $panel_id == 4 )  {
-	if (empty($content_message)) {
-?>
-      <div id="display_response_id" style="height:200px;">    
-		<?php echo api_xml_http_response_encode(get_lang('AddPersonalMessage'));  ?> :<br /><br />				
-		<textarea id="txt_area_invite" rows="5" class="span5" ></textarea><br />
-		 <?php echo api_xml_http_response_encode(get_lang('YouShouldWriteAMessage'));  ?><br /><br />
-		<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')); ?>" onclick="action_database_panel('4','<?php echo $user_id;?>')" >
-		<?php echo api_xml_http_response_encode(get_lang('SendInvitation')) ?></button>
-	</div>
-<?php
-	}
-} elseif ($panel_id==1) {
-	if (empty($content_message) || empty($subject_message)) {
-?>
-    <td height="20"><?php echo api_xml_http_response_encode(get_lang('To')); ?> &nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?></td>
-    <td height="20"><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br/><input id="txt_subject_id" type="text" style="width:200px;"></td>
-    <td height="20"><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br/><textarea id="txt_area_invite" rows="3" class="span5" ></textarea></td>
-    <td height="20"><input type="button" value="<?php echo api_xml_http_response_encode(get_lang('NewMessage')); ?>" onclick="hide_display_message()" />&nbsp;&nbsp;&nbsp; <input type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $user_id;?>')" /></td>
-<?php
-	}
-}elseif ($panel_id==3) {
-?>
-<dl>
-	<dd><a href="javascript:void(0)" onclick="change_panel('2','<?php echo $user_id; ?>')"><?php echo api_xml_http_response_encode(get_lang('SendInviteMessage')); ?></a></dd>
-	<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($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 /><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" class="span5" ></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>
-<?php
-}
-
-if ($panel_id==4 && !empty($content_message)) {
-	if ($subject_message=='clear') {
-		$subject_message=null;
-	}	
-	SocialManager::send_invitation_friend_user($user_id, $subject_message, $content_message);
-} elseif ($panel_id==5 && !empty($subject_message) ) {
-	SocialManager::send_invitation_friend_user($user_id, $subject_message, $content_message);
-}

+ 0 - 58
main/messages/send_message_to_userfriend.inc.php

@@ -1,58 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
-*	@package chamilo.messages
-*/
-/**
- * Code
- */
-$language_file = array('registration','messages','userInfo','admin');
-$cidReset = true;
-require_once '../inc/global.inc.php';
-
-if (api_is_anonymous()) {
-	api_not_allowed();
-}
-if (api_get_setting('allow_message_tool') != 'true' && api_get_setting('allow_social_tool') != 'true'){
-	api_not_allowed();
-}
-if (isset($_REQUEST['user_friend']) ) {
-	$info_user_friend=array();	
- 	$userfriend_id=intval($_REQUEST['user_friend']);
- 	// panel=1  send message
- 	// panel=2  send invitation
- 	$panel=intval($_REQUEST['view_panel']);
- 	$info_user_friend=api_get_user_info($userfriend_id); 	
-}
-
-?>
-<div id="id_content_panel_init">
-<?php
-if (api_get_setting('allow_message_tool')=='true') {
-    if ($panel == 1) {
-        //normal message
-   		$user_info=api_get_user_info($userfriend_id);
-        echo '<div id="display_response_id">';
-        $form = new FormValidator('add_user', null, null, null, array('class'=>'form-vertical'));
-        //$username = api_xml_http_response_encode(get_lang('To')).api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
-        $form->addElement('label', get_lang('To'), api_get_person_name($user_info['firstName'], $user_info['lastName']));        
-        ////$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
-        $form->addElement('text', 'subject', get_lang('Subject'), array('id'=>'txt_subject_id','class'=>'span4'));        
-        $form->addElement('textarea', 'message', get_lang('Message'), array('id'=>'txt_area_invite','class'=>'span4'));        
-        $form->addElement('style_submit_button', 'send', get_lang('SendMessage'), array('onclick'=>"action_database_panel('5','".$userfriend_id."')"));
-        $form->display();
-        echo '</div>';
-	} else {
-        // friend invitation message
-        ?>
-        <div id="display_response_id" style="height:200px;">
-			<?php echo api_xml_http_response_encode(get_lang('AddPersonalMessage'));  ?> :<br /><br />				
-			<textarea id="txt_area_invite" rows="5" class="span5" ></textarea><br /><br />
-			<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			
-        }
-    } 
-?>
-</div>

+ 0 - 38
whoisonline.php

@@ -40,45 +40,7 @@ $(document).ready(function (){
 		}
 	});
 });
-function change_panel (mypanel_id,myuser_id) {
-		$.ajax({
-			contentType: "application/x-www-form-urlencoded",
-			beforeSend: function(objeto) {
-			$("#id_content_panel").html("'.get_lang('Loading', '').'"); },
-			type: "POST",
-			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);
-			 $("div#display_response_id").html("");
-			}
-		});
-}
-function action_database_panel(option_id,myuser_id) {
 
-	if (option_id==5) {
-		my_txt_subject=$("#txt_subject_id").val();
-	} else {
-		my_txt_subject="clear";
-	}
-	my_txt_content=$("#txt_area_invite").val();
-	if (my_txt_content.length==0 || my_txt_subject.length==0) {
-		$("#display_response_id").html("&nbsp;&nbsp;&nbsp;'.get_lang('MessageEmptyMessageOrSubject', '').'");
-		setTimeout("message_information_display()",3000);
-		return false;
-	}
-	$.ajax({
-		contentType: "application/x-www-form-urlencoded",
-		beforeSend: function(objeto) {
-		$("#display_response_id").html("'.get_lang('Loading', '').'"); },
-		type: "POST",
-		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);
-		}
-	});
-}
 function display_hide () {
 		setTimeout("hide_display_message()",3000);
 }