Version 14.95.1

This commit is contained in:
Antonio Cañas Vargas 2015-03-18 02:11:23 +01:00
parent c981c8b8eb
commit a523889228
6 changed files with 154 additions and 62 deletions

View File

@ -103,11 +103,12 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.95 (2015/03/18)" #define Log_PLATFORM_VERSION "SWAD 14.95.1 (2015/03/18)"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 14.95.1: Mar 18, 2015 Show user's profile after followin or unfollowing. (182985 lines)
Version 14.95: Mar 18, 2015 New module swad_follow for follow users. (182903 lines) Version 14.95: Mar 18, 2015 New module swad_follow for follow users. (182903 lines)
1 change necessary in Makefile: 1 change necessary in Makefile:
Add swad_follow.o to list of object files Add swad_follow.o to list of object files

View File

@ -31,6 +31,7 @@
#include "swad_database.h" #include "swad_database.h"
#include "swad_follow.h" #include "swad_follow.h"
#include "swad_global.h" #include "swad_global.h"
#include "swad_profile.h"
#include "swad_user.h" #include "swad_user.h"
/*****************************************************************************/ /*****************************************************************************/
@ -86,6 +87,7 @@ void Fol_FollowUsr (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
char Query[256]; char Query[256];
bool Error;
/***** Get user to be removed *****/ /***** Get user to be removed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
@ -101,8 +103,14 @@ void Fol_FollowUsr (void)
Gbl.Usrs.Other.UsrDat.UsrCod); Gbl.Usrs.Other.UsrDat.UsrCod);
DB_QueryREPLACE (Query,"can not follow user"); DB_QueryREPLACE (Query,"can not follow user");
} }
/***** Show user's profile again *****/
Error = !Prf_ShowUserProfile ();
} }
else else
Error = true;
if (Error)
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
} }
@ -114,6 +122,7 @@ void Fol_UnfollowUsr (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
char Query[256]; char Query[256];
bool Error;
/***** Get user to be removed *****/ /***** Get user to be removed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
@ -128,7 +137,13 @@ void Fol_UnfollowUsr (void)
Gbl.Usrs.Other.UsrDat.UsrCod); Gbl.Usrs.Other.UsrDat.UsrCod);
DB_QueryREPLACE (Query,"can not unfollow user"); DB_QueryREPLACE (Query,"can not unfollow user");
} }
/***** Show user's profile again *****/
Error = !Prf_ShowUserProfile ();
} }
else else
Error = true;
if (Error)
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
} }

View File

@ -33,6 +33,7 @@
#include "swad_nickname.h" #include "swad_nickname.h"
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_privacy.h" #include "swad_privacy.h"
#include "swad_profile.h"
#include "swad_role.h" #include "swad_role.h"
#include "swad_text.h" #include "swad_text.h"
#include "swad_theme.h" #include "swad_theme.h"
@ -76,7 +77,7 @@ extern struct Globals Gbl;
static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickname); static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickname);
static void Prf_ShowUserProfile (void); static void Prf_GetUsrDatAndShowUserProfile (void);
static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat); static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat);
static void Prf_ShowHistoricUserProfile (const struct UsrData *UsrDat); static void Prf_ShowHistoricUserProfile (const struct UsrData *UsrDat);
@ -179,7 +180,7 @@ void Prf_GetUsrCodAndShowUserProfile (void)
Usr_GetParamOtherUsrCodEncrypted (); Usr_GetParamOtherUsrCodEncrypted ();
/***** Show user's profile *****/ /***** Show user's profile *****/
Prf_ShowUserProfile (); Prf_GetUsrDatAndShowUserProfile ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -187,53 +188,15 @@ void Prf_GetUsrCodAndShowUserProfile (void)
/*****************************************************************************/ /*****************************************************************************/
// If error, Nickname is used to fill the form to request another nickname // If error, Nickname is used to fill the form to request another nickname
static void Prf_ShowUserProfile (void) static void Prf_GetUsrDatAndShowUserProfile (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool Error = false; bool Error;
/***** Check if user exists and get his data *****/ /***** Check if user exists and get his data *****/
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user
{ /***** Show public profile *****/
/***** Check if I can see the public profile *****/ Error = !Prf_ShowUserProfile ();
if (Pri_ShowIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility,Gbl.Usrs.Other.UsrDat.UsrCod))
{
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{
/* Get user's role in current course */
Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod);
/* Get if user has accepted enrollment in current course */
Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod);
}
fprintf (Gbl.F.Out,"<div style=\"margin:0 auto;\">"
"<table style=\"margin:0 auto;\">"
"<tr>"
"<td style=\"text-align:right;"
" vertical-align:top;\">");
/***** Common record *****/
Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat);
/***** Show details of user's profile *****/
Prf_ShowDetailsUserProfile (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"<td style=\"text-align:left;"
" vertical-align:top; padding-left:4px;\">");
/***** Show historic user's profile *****/
Prf_ShowHistoricUserProfile (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"</tr>"
"</table>"
"</div>");
}
else
Error = true;
}
else else
Error = true; Error = true;
@ -247,6 +210,54 @@ static void Prf_ShowUserProfile (void)
} }
} }
/*****************************************************************************/
/*************************** Show a user's profile ***************************/
/*****************************************************************************/
// Return false on error
bool Prf_ShowUserProfile (void)
{
/***** Check if I can see the public profile *****/
if (Pri_ShowIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility,Gbl.Usrs.Other.UsrDat.UsrCod))
{
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{
/* Get user's role in current course */
Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod);
/* Get if user has accepted enrollment in current course */
Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod);
}
fprintf (Gbl.F.Out,"<div style=\"margin:0 auto;\">"
"<table style=\"margin:0 auto;\">"
"<tr>"
"<td style=\"text-align:right;"
" vertical-align:top;\">");
/***** Common record *****/
Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat);
/***** Show details of user's profile *****/
Prf_ShowDetailsUserProfile (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"<td style=\"text-align:left;"
" vertical-align:top; padding-left:4px;\">");
/***** Show historic user's profile *****/
Prf_ShowHistoricUserProfile (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"</tr>"
"</table>"
"</div>");
return true;
}
return false;
}
/*****************************************************************************/ /*****************************************************************************/
/******************** Change my public profile visibility ********************/ /******************** Change my public profile visibility ********************/
/*****************************************************************************/ /*****************************************************************************/
@ -779,7 +790,7 @@ void Prf_CalculateFirstClickTime (void)
Prf_GetFirstClickFromLogAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod); Prf_GetFirstClickFromLogAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
/***** Show user's profile again *****/ /***** Show user's profile again *****/
Prf_ShowUserProfile (); Prf_GetUsrDatAndShowUserProfile ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -842,7 +853,7 @@ void Prf_CalculateNumClicks (void)
Prf_GetNumClicksAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod); Prf_GetNumClicksAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
/***** Show user's profile again *****/ /***** Show user's profile again *****/
Prf_ShowUserProfile (); Prf_GetUsrDatAndShowUserProfile ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -890,7 +901,7 @@ void Prf_CalculateNumFileViews (void)
Prf_GetNumFileViewsAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod); Prf_GetNumFileViewsAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
/***** Show user's profile again *****/ /***** Show user's profile again *****/
Prf_ShowUserProfile (); Prf_GetUsrDatAndShowUserProfile ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -936,7 +947,7 @@ void Prf_CalculateNumForPst (void)
Prf_GetNumForPstAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod); Prf_GetNumForPstAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
/***** Show user's profile again *****/ /***** Show user's profile again *****/
Prf_ShowUserProfile (); Prf_GetUsrDatAndShowUserProfile ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -982,7 +993,7 @@ void Prf_CalculateNumMsgSnt (void)
Prf_GetNumMsgSntAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod); Prf_GetNumMsgSntAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
/***** Show user's profile again *****/ /***** Show user's profile again *****/
Prf_ShowUserProfile (); Prf_GetUsrDatAndShowUserProfile ();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -42,6 +42,7 @@
char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba); char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba);
void Prf_RequestUserProfile (void); void Prf_RequestUserProfile (void);
void Prf_GetUsrCodAndShowUserProfile (void); void Prf_GetUsrCodAndShowUserProfile (void);
bool Prf_ShowUserProfile (void);
void Prf_ChangeProfileVisibility (void); void Prf_ChangeProfileVisibility (void);
void Prf_CalculateFirstClickTime (void); void Prf_CalculateFirstClickTime (void);
void Prf_CalculateNumClicks (void); void Prf_CalculateNumClicks (void);

View File

@ -2016,10 +2016,12 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
extern const char *Txt_Admin_user; extern const char *Txt_Admin_user;
extern const char *Txt_ID; extern const char *Txt_ID;
extern const char *Txt_Nickname; extern const char *Txt_Nickname;
extern const char *Txt_Write_a_message_to_X; extern const char *Txt_Write_a_message;
extern const char *Txt_View_works; extern const char *Txt_View_works;
extern const char *Txt_See_exams; extern const char *Txt_See_exams;
extern const char *Txt_Attendance; extern const char *Txt_Attendance;
extern const char *Txt_Unfollow;
extern const char *Txt_Follow;
extern const char *Txt_View_public_profile; extern const char *Txt_View_public_profile;
extern const char *Txt_Email; extern const char *Txt_Email;
extern const char *Txt_Sex; extern const char *Txt_Sex;
@ -2332,15 +2334,14 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
else else
Msg_PutHiddenParamAnotherRecipient (UsrDat); Msg_PutHiddenParamAnotherRecipient (UsrDat);
sprintf (Gbl.Title,Txt_Write_a_message_to_X,UsrDat->FullName); Act_LinkFormSubmit (Txt_Write_a_message,ClassData);
Act_LinkFormSubmit (Gbl.Title,ClassData);
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >" fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >"
"<img src=\"%s/msg16x16.gif\"" "<img src=\"%s/msg16x16.gif\""
" style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />" " style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />"
"</div>" "</div>"
"</a>", "</a>",
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
Gbl.Title); Txt_Write_a_message);
Act_FormEnd (); Act_FormEnd ();
/***** Button to follow / unfollow *****/ /***** Button to follow / unfollow *****/
@ -2351,28 +2352,28 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
{ {
Act_FormStart (ActUnfUsr); Act_FormStart (ActUnfUsr);
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit ("Dejar de seguir",ClassData); Act_LinkFormSubmit (Txt_Unfollow,ClassData);
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >" fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >"
"<img src=\"%s/unfollow16x16.gif\"" "<img src=\"%s/unfollow16x16.gif\""
" style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />" " style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />"
"</div>" "</div>"
"</a>", "</a>",
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
"Dejar de seguir"); Txt_Unfollow);
Act_FormEnd (); Act_FormEnd ();
} }
else else
{ {
Act_FormStart (ActFolUsr); Act_FormStart (ActFolUsr);
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit ("Seguir",ClassData); Act_LinkFormSubmit (Txt_Follow,ClassData);
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >" fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >"
"<img src=\"%s/follow16x16.gif\"" "<img src=\"%s/follow16x16.gif\""
" style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />" " style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />"
"</div>" "</div>"
"</a>", "</a>",
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
"Seguir"); Txt_Follow);
Act_FormEnd (); Act_FormEnd ();
} }
} }

View File

@ -11841,6 +11841,27 @@ const char *Txt_Folders_not_renamed =
"Diret&oacute;rios n&atilde;o renomeados"; "Diret&oacute;rios n&atilde;o renomeados";
#endif #endif
const char *Txt_Follow =
#if L==0
"Seguir";
#elif L==1
"Folgen";
#elif L==2
"Follow";
#elif L==3
"Seguir";
#elif L==4
"Suivre";
#elif L==5
"Seguir"; // Okoteve traducción
#elif L==6
"Seguire";
#elif L==7
"&Sacute;ledzi&cacute;";
#elif L==8
"Seguir";
#endif
const char *Txt_For_security_enter_your_password = const char *Txt_For_security_enter_your_password =
#if L==0 #if L==0
"Per a m&eacute;s seguretat, introdueixi la seva contrasenya"; "Per a m&eacute;s seguretat, introdueixi la seva contrasenya";
@ -45920,6 +45941,27 @@ const char *Txt_Undo =
"Desfazer"; "Desfazer";
#endif #endif
const char *Txt_Unfollow =
#if L==0
"Deixar de seguir";
#elif L==1
"Entfolgen";
#elif L==2
"Unfollow";
#elif L==3
"Dejar de seguir";
#elif L==4
"Se d&eacute;sabonner";
#elif L==5
"Dejar de seguir"; // Okoteve traducción
#elif L==6
"Smetti";
#elif L==7
"Nie obserwuj";
#elif L==8
"Deixar de seguir";
#endif
const char *Txt_unknown_course = const char *Txt_unknown_course =
#if L==0 #if L==0
"assignatura desconeguda"; "assignatura desconeguda";
@ -48002,9 +48044,30 @@ const char *Txt_WriBRters =
"Escri-<br />tores"; "Escri-<br />tores";
#endif #endif
const char *Txt_Write_a_message =
#if L==0
"Escriu un missatge";
#elif L==1
"Schreiben eine Nachricht";
#elif L==2
"Write a message";
#elif L==3
"Escribir un mensaje";
#elif L==4
"&Eacute;crire un message";
#elif L==5
"Escribir un mensaje"; // Okoteve traducción
#elif L==6
"Scrivi un messaggio";
#elif L==7
"Napisz wiadomo&sacute;&cacute;";
#elif L==8
"Escrever uma mensagem";
#endif
const char *Txt_Write_a_message_to_X = // Warning: it is very important to include %s in the following sentences const char *Txt_Write_a_message_to_X = // Warning: it is very important to include %s in the following sentences
#if L==0 #if L==0
"Escribir un mensaje a %s"; // Necessita traduccio "Escriu un missatge a %s";
#elif L==1 #elif L==1
"Schreiben Sie %s eine Nachricht"; "Schreiben Sie %s eine Nachricht";
#elif L==2 #elif L==2
@ -48012,15 +48075,15 @@ const char *Txt_Write_a_message_to_X = // Warning: it is very important to inclu
#elif L==3 #elif L==3
"Escribir un mensaje a %s"; "Escribir un mensaje a %s";
#elif L==4 #elif L==4
"Write a message to %s"; // Besoin de traduction "&Eacute;crire un message &agrave; %s";
#elif L==5 #elif L==5
"Escribir un mensaje a %s"; // Okoteve traducción "Escribir un mensaje a %s"; // Okoteve traducción
#elif L==6 #elif L==6
"Scrivi un messaggio a %s"; "Scrivi un messaggio a %s";
#elif L==7 #elif L==7
"Write a message to %s"; // Potrzebujesz tlumaczenie "Napisz wiadomo&sacute;&cacute; do %s";
#elif L==8 #elif L==8
"Write a message to %s"; // Necessita de tradução "Escrever uma mensagem para %s";
#endif #endif
const char *Txt_WWW = // World Wide Web const char *Txt_WWW = // World Wide Web