mirror of https://github.com/acanas/swad-core.git
Version 14.95.1
This commit is contained in:
parent
c981c8b8eb
commit
a523889228
|
@ -103,11 +103,12 @@
|
|||
/****************************** 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:
|
||||
// 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)
|
||||
1 change necessary in Makefile:
|
||||
Add swad_follow.o to list of object files
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "swad_database.h"
|
||||
#include "swad_follow.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_profile.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_;
|
||||
char Query[256];
|
||||
bool Error;
|
||||
|
||||
/***** Get user to be removed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -101,8 +103,14 @@ void Fol_FollowUsr (void)
|
|||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
DB_QueryREPLACE (Query,"can not follow user");
|
||||
}
|
||||
|
||||
/***** Show user's profile again *****/
|
||||
Error = !Prf_ShowUserProfile ();
|
||||
}
|
||||
else
|
||||
Error = true;
|
||||
|
||||
if (Error)
|
||||
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_;
|
||||
char Query[256];
|
||||
bool Error;
|
||||
|
||||
/***** Get user to be removed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -128,7 +137,13 @@ void Fol_UnfollowUsr (void)
|
|||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
DB_QueryREPLACE (Query,"can not unfollow user");
|
||||
}
|
||||
|
||||
/***** Show user's profile again *****/
|
||||
Error = !Prf_ShowUserProfile ();
|
||||
}
|
||||
else
|
||||
Error = true;
|
||||
|
||||
if (Error)
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
|
109
swad_profile.c
109
swad_profile.c
|
@ -33,6 +33,7 @@
|
|||
#include "swad_nickname.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_privacy.h"
|
||||
#include "swad_profile.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_text.h"
|
||||
#include "swad_theme.h"
|
||||
|
@ -76,7 +77,7 @@ extern struct Globals Gbl;
|
|||
|
||||
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_ShowHistoricUserProfile (const struct UsrData *UsrDat);
|
||||
|
||||
|
@ -179,7 +180,7 @@ void Prf_GetUsrCodAndShowUserProfile (void)
|
|||
Usr_GetParamOtherUsrCodEncrypted ();
|
||||
|
||||
/***** 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
|
||||
|
||||
static void Prf_ShowUserProfile (void)
|
||||
static void Prf_GetUsrDatAndShowUserProfile (void)
|
||||
{
|
||||
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 *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user
|
||||
{
|
||||
/***** 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>");
|
||||
}
|
||||
else
|
||||
Error = true;
|
||||
}
|
||||
/***** Show public profile *****/
|
||||
Error = !Prf_ShowUserProfile ();
|
||||
else
|
||||
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 ********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -779,7 +790,7 @@ void Prf_CalculateFirstClickTime (void)
|
|||
Prf_GetFirstClickFromLogAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Show user's profile again *****/
|
||||
Prf_ShowUserProfile ();
|
||||
Prf_GetUsrDatAndShowUserProfile ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -842,7 +853,7 @@ void Prf_CalculateNumClicks (void)
|
|||
Prf_GetNumClicksAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Show user's profile again *****/
|
||||
Prf_ShowUserProfile ();
|
||||
Prf_GetUsrDatAndShowUserProfile ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -890,7 +901,7 @@ void Prf_CalculateNumFileViews (void)
|
|||
Prf_GetNumFileViewsAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Show user's profile again *****/
|
||||
Prf_ShowUserProfile ();
|
||||
Prf_GetUsrDatAndShowUserProfile ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -936,7 +947,7 @@ void Prf_CalculateNumForPst (void)
|
|||
Prf_GetNumForPstAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Show user's profile again *****/
|
||||
Prf_ShowUserProfile ();
|
||||
Prf_GetUsrDatAndShowUserProfile ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -982,7 +993,7 @@ void Prf_CalculateNumMsgSnt (void)
|
|||
Prf_GetNumMsgSntAndStoreAsUsrFigure (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** Show user's profile again *****/
|
||||
Prf_ShowUserProfile ();
|
||||
Prf_GetUsrDatAndShowUserProfile ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba);
|
||||
void Prf_RequestUserProfile (void);
|
||||
void Prf_GetUsrCodAndShowUserProfile (void);
|
||||
bool Prf_ShowUserProfile (void);
|
||||
void Prf_ChangeProfileVisibility (void);
|
||||
void Prf_CalculateFirstClickTime (void);
|
||||
void Prf_CalculateNumClicks (void);
|
||||
|
|
|
@ -2016,10 +2016,12 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
extern const char *Txt_Admin_user;
|
||||
extern const char *Txt_ID;
|
||||
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_See_exams;
|
||||
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_Email;
|
||||
extern const char *Txt_Sex;
|
||||
|
@ -2332,15 +2334,14 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
else
|
||||
Msg_PutHiddenParamAnotherRecipient (UsrDat);
|
||||
sprintf (Gbl.Title,Txt_Write_a_message_to_X,UsrDat->FullName);
|
||||
Act_LinkFormSubmit (Gbl.Title,ClassData);
|
||||
Act_LinkFormSubmit (Txt_Write_a_message,ClassData);
|
||||
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >"
|
||||
"<img src=\"%s/msg16x16.gif\""
|
||||
" style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />"
|
||||
"</div>"
|
||||
"</a>",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Gbl.Title);
|
||||
Txt_Write_a_message);
|
||||
Act_FormEnd ();
|
||||
|
||||
/***** Button to follow / unfollow *****/
|
||||
|
@ -2351,28 +2352,28 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
{
|
||||
Act_FormStart (ActUnfUsr);
|
||||
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;\" >"
|
||||
"<img src=\"%s/unfollow16x16.gif\""
|
||||
" style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />"
|
||||
"</div>"
|
||||
"</a>",
|
||||
Gbl.Prefs.IconsURL,
|
||||
"Dejar de seguir");
|
||||
Txt_Unfollow);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Act_FormStart (ActFolUsr);
|
||||
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
Act_LinkFormSubmit ("Seguir",ClassData);
|
||||
Act_LinkFormSubmit (Txt_Follow,ClassData);
|
||||
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\" style=\"display:inline;\" >"
|
||||
"<img src=\"%s/follow16x16.gif\""
|
||||
" style=\"width:16px; height:16px; padding:0 2px;\" alt=\"%s\" />"
|
||||
"</div>"
|
||||
"</a>",
|
||||
Gbl.Prefs.IconsURL,
|
||||
"Seguir");
|
||||
Txt_Follow);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
}
|
||||
|
|
71
swad_text.c
71
swad_text.c
|
@ -11841,6 +11841,27 @@ const char *Txt_Folders_not_renamed =
|
|||
"Diretórios não renomeados";
|
||||
#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
|
||||
"Śledzić";
|
||||
#elif L==8
|
||||
"Seguir";
|
||||
#endif
|
||||
|
||||
const char *Txt_For_security_enter_your_password =
|
||||
#if L==0
|
||||
"Per a més seguretat, introdueixi la seva contrasenya";
|
||||
|
@ -45920,6 +45941,27 @@ const char *Txt_Undo =
|
|||
"Desfazer";
|
||||
#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é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 =
|
||||
#if L==0
|
||||
"assignatura desconeguda";
|
||||
|
@ -48002,9 +48044,30 @@ const char *Txt_WriBRters =
|
|||
"Escri-<br />tores";
|
||||
#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
|
||||
"Écrire un message";
|
||||
#elif L==5
|
||||
"Escribir un mensaje"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Scrivi un messaggio";
|
||||
#elif L==7
|
||||
"Napisz wiadomość";
|
||||
#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
|
||||
#if L==0
|
||||
"Escribir un mensaje a %s"; // Necessita traduccio
|
||||
"Escriu un missatge a %s";
|
||||
#elif L==1
|
||||
"Schreiben Sie %s eine Nachricht";
|
||||
#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
|
||||
"Escribir un mensaje a %s";
|
||||
#elif L==4
|
||||
"Write a message to %s"; // Besoin de traduction
|
||||
"Écrire un message à %s";
|
||||
#elif L==5
|
||||
"Escribir un mensaje a %s"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Scrivi un messaggio a %s";
|
||||
#elif L==7
|
||||
"Write a message to %s"; // Potrzebujesz tlumaczenie
|
||||
"Napisz wiadomość do %s";
|
||||
#elif L==8
|
||||
"Write a message to %s"; // Necessita de tradução
|
||||
"Escrever uma mensagem para %s";
|
||||
#endif
|
||||
|
||||
const char *Txt_WWW = // World Wide Web
|
||||
|
|
Loading…
Reference in New Issue