Version 15.63

This commit is contained in:
Antonio Cañas Vargas 2015-12-12 02:01:20 +01:00
parent c02c7f76d0
commit ec1265c0ec
9 changed files with 104 additions and 120 deletions

View File

@ -1749,11 +1749,34 @@ a:hover img.CENTRE_PHOTO_SHOW
}
/***************************** Public user's profile *************************/
#prf_fig_container
{
text-align:center;
}
#prf_fig_list
{
display:inline-block;
list-style-type:none;
padding:0;
margin:0;
text-align:left;
vertical-align:middle;
}
.PRF_ICON
{
box-sizing:border-box;
margin-right:4px;
width:20px;
height:20px;
vertical-align:middle;
opacity:0.33;
}
.FOLLOW
{
color:#C0C0C0;
color:#404040;
font-size:30pt;
font-weight:bold;
opacity:0.5;
}
.FOLLOW_B
{
@ -1761,25 +1784,6 @@ a:hover img.CENTRE_PHOTO_SHOW
font-size:30pt;
font-weight:bold;
}
.PRF_ICON_CONTAINER
{
box-sizing:border-box;
width:25px;
}
.PRF_ICON
{
display:block;
box-sizing:border-box;
margin:auto;
width:20px;
height:20px;
opacity:0.33;
}
.PRF_FIG
{
text-align:left;
vertical-align:middle;
}
.CON {color:#B8D070; font-size:11pt; line-height:110%; white-space:nowrap;}
.CON_CRS {color:#398000; font-size:11pt; line-height:110%; white-space:nowrap;}

View File

@ -32,6 +32,7 @@
#include "swad_calendar.h"
#include "swad_database.h"
#include "swad_enrollment.h"
#include "swad_follow.h"
#include "swad_global.h"
#include "swad_ID.h"
#include "swad_notification.h"
@ -784,6 +785,9 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
/***** Remove user's figures *****/
Prf_RemoveUsrFigures (UsrDat->UsrCod);
/***** Remove user from table of followers *****/
Fol_RemoveUsrFromUsrFollow (UsrDat->UsrCod);
/***** Remove the user from the list of users without photo *****/
Pho_RemoveUsrFromTableClicksWithoutPhoto (UsrDat->UsrCod);

View File

@ -107,6 +107,9 @@
// TODO: When teacher clicks in attendance of a student (button in her/his record),
// only (the groups he/she should have attend) union (the groups he/she really attended)
// should be shown.
// TODO: By default, profile and photo should be visible by users who share course
// TODO: When page is refreshed in course works, prevent users to be duplicated
// TODO: Fix bug at the end of ranking (number too low) when a course is selected
// TODO: Reply to one user, suggested by Francisco Ocaña Lara
// TODO: Reply to all
@ -114,12 +117,18 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.62 (2015/12/09)"
#define CSS_FILE "swad15.60.7.css"
#define Log_PLATFORM_VERSION "SWAD 15.63 (2015/12/12)"
#define CSS_FILE "swad15.63.css"
// 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 15.63: Dec 12, 2015 New layout for user's public profile.
Fixed bug when removing user's account. (186932 lines)
2 changes necessary in database:
DELETE FROM usr_follow WHERE FollowerCod NOT IN (SELECT UsrCod FROM usr_data);
DELETE FROM usr_follow WHERE FollowedCod NOT IN (SELECT UsrCod FROM usr_data);
Version 15.62: Dec 09, 2015 Changes in data of centres. (186949 lines)
Version 15.61: Dec 09, 2015 Bug fixing and lot of changes in data of countries and institutions. (186852 lines)
Version 15.60.6: Dec 08, 2015 Changed icons in login. (186592 lines)

View File

@ -70,7 +70,7 @@ static void Fol_ShowNumberOfFollowingOrFollowers (const struct UsrData *UsrDat,
const char *Title);
static unsigned Fol_GetNumFollowing (long UsrCod);
static unsigned Fol_GetNumFollowers (long UsrCod);
static void Fol_ShowFollowedOrFollowed (const struct UsrData *UsrDat);
static void Fol_ShowFollowedOrFollower (const struct UsrData *UsrDat);
/*****************************************************************************/
/*************** Check if a user is a follower of another user ***************/
@ -100,7 +100,8 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat)
extern const char *Txt_Followers;
/***** Start table *****/
fprintf (Gbl.F.Out,"<table style=\"margin:0 auto 5px auto;\">"
fprintf (Gbl.F.Out,"<section id=\"follow\">"
"<table style=\"margin:0 auto;\">"
"<tr>");
/***** Followed users *****/
@ -115,7 +116,8 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat)
/***** End table *****/
fprintf (Gbl.F.Out,"</tr>"
"</table>");
"</table>"
"</section>");
}
/*****************************************************************************/
@ -139,8 +141,8 @@ static void Fol_ShowNumberOfFollowingOrFollowers (const struct UsrData *UsrDat,
"FOLLOW");
if (NumUsrs)
{
/* Form to list followed users */
Act_FormStart (Action);
/* Form to list users */
Act_FormStartAnchor (Action,"follow");
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit (Title,
(Gbl.CurrentAct == Action) ? "FOLLOW_B" :
@ -160,8 +162,8 @@ static void Fol_ShowNumberOfFollowingOrFollowers (const struct UsrData *UsrDat,
The_ClassForm[Gbl.Prefs.Theme]);
if (NumUsrs)
{
/* Form to list followed users */
Act_FormStart (Action);
/* Form to list users */
Act_FormStartAnchor (Action,"follow");
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit (Title,
(Gbl.CurrentAct == Action) ? The_ClassFormBold[Gbl.Prefs.Theme] :
@ -212,7 +214,6 @@ static unsigned Fol_GetNumFollowers (long UsrCod)
void Fol_ListFollowing (void)
{
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
extern const char *Txt_Following;
char Query[256];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -244,17 +245,17 @@ void Fol_ListFollowing (void)
NumUsr < NumUsrs;
NumUsr++)
{
/***** Get user and number of clicks *****/
/***** Get user *****/
row = mysql_fetch_row (mysql_res);
/* Get user's code (row[0]) */
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
/***** Show user *****/
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
fprintf (Gbl.F.Out,"<tr>");
Fol_ShowFollowedOrFollowed (&UsrDat);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
Fol_ShowFollowedOrFollower (&UsrDat);
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
NumUsr == NumUsrs - 1)
fprintf (Gbl.F.Out,"</tr>");
@ -284,7 +285,6 @@ void Fol_ListFollowing (void)
void Fol_ListFollowers (void)
{
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
extern const char *Txt_Followers;
char Query[256];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -326,12 +326,12 @@ void Fol_ListFollowers (void)
/* Get user's code (row[0]) */
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
/***** Show user *****/
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
fprintf (Gbl.F.Out,"<tr>");
Fol_ShowFollowedOrFollowed (&UsrDat);
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
Fol_ShowFollowedOrFollower (&UsrDat);
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
NumUsr == NumUsrs - 1)
fprintf (Gbl.F.Out,"</tr>");
@ -360,10 +360,10 @@ void Fol_ListFollowers (void)
}
/*****************************************************************************/
/************** Show user's photo and nickname in ranking list ***************/
/************************* Show followed or follower *************************/
/*****************************************************************************/
static void Fol_ShowFollowedOrFollowed (const struct UsrData *UsrDat)
static void Fol_ShowFollowedOrFollower (const struct UsrData *UsrDat)
{
extern const char *Txt_View_public_profile;
extern const char *Txt_Unfollow;
@ -619,3 +619,17 @@ void Fol_GetNotifFollower (char *SummaryStr,char **ContentStr)
if ((*ContentStr = (char *) malloc (1)))
strcpy (*ContentStr,"");
}
/*****************************************************************************/
/*********************** Remove user from user follow ************************/
/*****************************************************************************/
void Fol_RemoveUsrFromUsrFollow (long UsrCod)
{
char Query[128];
sprintf (Query,"DELETE FROM usr_follow"
" WHERE FollowerCod='%ld' OR FollowedCod='%ld'",
UsrCod,UsrCod);
DB_QueryDELETE (Query,"can not remove user from followers and followed");
}

View File

@ -55,4 +55,6 @@ void Fol_GetAndShowRankingFollowers (void);
void Fol_GetNotifFollower (char *SummaryStr,char **ContentStr);
void Fol_RemoveUsrFromUsrFollow (long UsrCod);
#endif

View File

@ -920,13 +920,13 @@ void Mai_PutLinkToChangeOtherUsrEmail (void)
/***** Link for changing the password *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
Act_PutContextualLink (ActFrmUsrAcc,NULL,
"msg16x16.gif",Txt_Change_email);
"msg64x64.gif",Txt_Change_email);
else // Not me
Act_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActFrmMaiStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActFrmMaiTch :
ActFrmMaiOth),
Usr_PutParamOtherUsrCodEncrypted,
"msg16x16.gif",Txt_Change_email);
"msg64x64.gif",Txt_Change_email);
}
/*****************************************************************************/

View File

@ -228,32 +228,15 @@ bool Prf_ShowUserProfile (void)
true);
}
fprintf (Gbl.F.Out,"<table style=\"margin:0 auto;\">"
"<tr>"
"<td rowspan=\"2\" class=\"CENTER_TOP\">");
/***** Common record *****/
Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"<td class=\"LEFT_TOP\">");
/***** Show details of user's profile *****/
Prf_ShowDetailsUserProfile (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"</tr>"
"<tr>"
"</td>"
"<td class=\"CENTER_BOTTOM\">");
/***** Show following and followers *****/
Fol_ShowFollowingAndFollowers (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"</tr>"
"</table>");
return true;
}
return false;
@ -328,24 +311,22 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
// char StrTimeGenerationInMicroseconds[64];
/***** Start table *****/
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\" style=\"margin:0 12px;\">");
fprintf (Gbl.F.Out,"<div id=\"prf_fig_container\">"
"<ul id=\"prf_fig_list\" class=\"DAT\">");
/***** Number of courses in which the user is teacher or student *****/
if ((NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_TEACHER)))
{
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TEACHER,Rol_TEACHER);
NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_TEACHER,Rol_STUDENT);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/tch64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">"
"%u&nbsp;%s&nbsp;(%u&nbsp;%s&nbsp;+&nbsp;%u&nbsp;%s)"
"</a>"
"</td>"
"</tr>",
"</li>",
Gbl.Prefs.IconsURL,
Txt_ROLES_SINGUL_Abc[Rol_TEACHER][UsrDat->Sex],
Txt_ROLES_SINGUL_Abc[Rol_TEACHER][UsrDat->Sex],
@ -361,17 +342,12 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
{
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STUDENT,Rol_TEACHER);
NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_STUDENT,Rol_STUDENT);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/std64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">"
"%u&nbsp;%s&nbsp;(%u&nbsp;%s&nbsp;+&nbsp;%u&nbsp;%s)"
"</a>"
"</td>"
"</tr>",
"</li>",
Gbl.Prefs.IconsURL,
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][UsrDat->Sex],
Txt_ROLES_SINGUL_Abc[Rol_STUDENT][UsrDat->Sex],
@ -389,17 +365,12 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
NumPublicFiles = Brw_GetNumPublicFilesUsr (UsrDat->UsrCod);
else
NumPublicFiles = 0;
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/file64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">"
"%u&nbsp;%s&nbsp;(%u&nbsp;%s)"
"</a>"
"</td>"
"</tr>",
"</li>",
Gbl.Prefs.IconsURL,
Txt_Files,
Txt_Files,
@ -412,13 +383,10 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Prf_GetUsrFigures (UsrDat->UsrCod,&UsrFigures);
/* First click time */
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/clock64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">",
" class=\"PRF_ICON\" />",
Gbl.Prefs.IconsURL,
Txt_From_TIME,
Txt_From_TIME);
@ -444,20 +412,16 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Lay_PutCalculateIconWithText (Txt_Calculate,Txt_Calculate);
Act_FormEnd ();
}
fprintf (Gbl.F.Out,"</td>"
"</tr>");
fprintf (Gbl.F.Out,"</li>");
UsrIsBannedFromRanking = Usr_CheckIfUsrBanned (UsrDat->UsrCod);
if (!UsrIsBannedFromRanking)
{
/* Number of clicks */
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
"<img src=\"%s/click64x64.gif\""
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/click64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">",
" class=\"PRF_ICON\" />",
Gbl.Prefs.IconsURL,
Txt_Clicks,
Txt_Clicks);
@ -488,17 +452,13 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Lay_PutCalculateIconWithText (Txt_Calculate,Txt_Calculate);
Act_FormEnd ();
}
fprintf (Gbl.F.Out,"</td>"
"</tr>");
fprintf (Gbl.F.Out,"</li>");
/***** Number of file views *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
"<img src=\"%s/download64x64.gif\""
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/download64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">",
" class=\"PRF_ICON\" />",
Gbl.Prefs.IconsURL,
Txt_Downloads,
Txt_Downloads);
@ -527,17 +487,13 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Lay_PutCalculateIconWithText (Txt_Calculate,Txt_Calculate);
Act_FormEnd ();
}
fprintf (Gbl.F.Out,"</td>"
"</tr>");
fprintf (Gbl.F.Out,"</li>");
/***** Number of posts in forums *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
"<img src=\"%s/forum64x64.gif\""
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/forum64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">",
" class=\"PRF_ICON\" />",
Gbl.Prefs.IconsURL,
Txt_Forums,
Txt_Forums);
@ -566,17 +522,13 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Lay_PutCalculateIconWithText (Txt_Calculate,Txt_Calculate);
Act_FormEnd ();
}
fprintf (Gbl.F.Out,"</td>"
"</tr>");
fprintf (Gbl.F.Out,"</li>");
/***** Number of messages sent *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"PRF_ICON_CONTAINER\">"
"<img src=\"%s/msg64x64.gif\""
fprintf (Gbl.F.Out,"<li>"
"<img src=\"%s/msg64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"PRF_ICON\" />"
"</td>"
"<td class=\"PRF_FIG DAT\">",
" class=\"PRF_ICON\" />",
Gbl.Prefs.IconsURL,
Txt_Messages,
Txt_Messages);
@ -605,12 +557,12 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Lay_PutCalculateIconWithText (Txt_Calculate,Txt_Calculate);
Act_FormEnd ();
}
fprintf (Gbl.F.Out,"</td>"
"</tr>");
fprintf (Gbl.F.Out,"</li>");
}
/***** End of table *****/
fprintf (Gbl.F.Out,"</table>");
fprintf (Gbl.F.Out,"</ul>"
"</div>");
}
/*****************************************************************************/

View File

@ -2345,7 +2345,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
Act_LinkFormSubmit (Txt_Write_a_message,ClassData);
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\""
" style=\"display:inline;\" >"
"<img src=\"%s/msg16x16.gif\""
"<img src=\"%s/msg64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON16x16\" />"
"</div>"

View File

@ -7795,7 +7795,7 @@ bool Usr_CheckIfUsrBanned (long UsrCod)
}
/*****************************************************************************/
/****************** Check if a user is banned in ranking *********************/
/**************** Remove user from banned users in ranking *******************/
/*****************************************************************************/
void Usr_RemoveUsrFromUsrBanned (long UsrCod)
@ -7806,4 +7806,3 @@ void Usr_RemoveUsrFromUsrBanned (long UsrCod)
UsrCod);
DB_QueryDELETE (Query,"can not remove user from users banned");
}