From ec1265c0ec06464d3df6e9972f6fd9fd0f72ca12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 12 Dec 2015 02:01:20 +0100 Subject: [PATCH] Version 15.63 --- css/{swad15.60.7.css => swad15.63.css} | 44 +++++----- swad_account.c | 4 + swad_changelog.h | 13 ++- swad_follow.c | 46 +++++++---- swad_follow.h | 2 + swad_mail.c | 4 +- swad_profile.c | 106 +++++++------------------ swad_record.c | 2 +- swad_user.c | 3 +- 9 files changed, 104 insertions(+), 120 deletions(-) rename css/{swad15.60.7.css => swad15.63.css} (99%) diff --git a/css/swad15.60.7.css b/css/swad15.63.css similarity index 99% rename from css/swad15.60.7.css rename to css/swad15.63.css index 23b70062..c259cca0 100644 --- a/css/swad15.60.7.css +++ b/css/swad15.63.css @@ -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;} diff --git a/swad_account.c b/swad_account.c index 887a61f2..e1b8f39b 100644 --- a/swad_account.c +++ b/swad_account.c @@ -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); diff --git a/swad_changelog.h b/swad_changelog.h index 07026da8..b7d064bc 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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) diff --git a/swad_follow.c b/swad_follow.c index a3903d82..598d8c57 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -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,"" + fprintf (Gbl.F.Out,"
" + "
" ""); /***** Followed users *****/ @@ -115,7 +116,8 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat) /***** End table *****/ fprintf (Gbl.F.Out,"" - "
"); + "" + ""); } /*****************************************************************************/ @@ -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,""); - 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,""); @@ -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,""); - 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,""); @@ -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"); + } diff --git a/swad_follow.h b/swad_follow.h index 5b55f3bb..04e3621a 100644 --- a/swad_follow.h +++ b/swad_follow.h @@ -55,4 +55,6 @@ void Fol_GetAndShowRankingFollowers (void); void Fol_GetNotifFollower (char *SummaryStr,char **ContentStr); +void Fol_RemoveUsrFromUsrFollow (long UsrCod); + #endif diff --git a/swad_mail.c b/swad_mail.c index 0c587e94..39f1b20f 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -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); } /*****************************************************************************/ diff --git a/swad_profile.c b/swad_profile.c index e260d102..25578d3b 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -228,32 +228,15 @@ bool Prf_ShowUserProfile (void) true); } - fprintf (Gbl.F.Out,"" - "" - "" - "" - "" - "" - "" - "" - "" - "
"); - /***** Common record *****/ Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat); - fprintf (Gbl.F.Out,""); - /***** Show details of user's profile *****/ Prf_ShowDetailsUserProfile (&Gbl.Usrs.Other.UsrDat); - fprintf (Gbl.F.Out,"
"); - /***** Show following and followers *****/ Fol_ShowFollowingAndFollowers (&Gbl.Usrs.Other.UsrDat); - fprintf (Gbl.F.Out,"
"); - 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,""); + fprintf (Gbl.F.Out,"
" + "
" - "" "" - "", + "", 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,"" - "" - "" - "", + "", 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,"" - "" - "" - "", + "", 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,"" - "" - "" - ""); + fprintf (Gbl.F.Out,""); UsrIsBannedFromRanking = Usr_CheckIfUsrBanned (UsrDat->UsrCod); if (!UsrIsBannedFromRanking) { /* Number of clicks */ - fprintf (Gbl.F.Out,"" - "" - "" - ""); + fprintf (Gbl.F.Out,""); /***** Number of file views *****/ - fprintf (Gbl.F.Out,"" - "" - "" - ""); + fprintf (Gbl.F.Out,""); /***** Number of posts in forums *****/ - fprintf (Gbl.F.Out,"" - "" - "" - ""); + fprintf (Gbl.F.Out,""); /***** Number of messages sent *****/ - fprintf (Gbl.F.Out,"" - "" - "" - ""); + fprintf (Gbl.F.Out,""); } /***** End of table *****/ - fprintf (Gbl.F.Out,"
" + fprintf (Gbl.F.Out,"
  • " "\"%s\"" "
  • " "%u %s (%u %s + %u %s)" - "" - "
    " + fprintf (Gbl.F.Out,"
  • " "\"%s\"" - "
  • " "%u %s (%u %s + %u %s)" - "" - "
    " + fprintf (Gbl.F.Out,"
  • " "\"%s\"" - "
  • " "%u %s (%u %s)" - "" - "
    " + fprintf (Gbl.F.Out,"
  • " "\"%s\"" - "
  • ", + " 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,"
    " - "" + "\"%s\"" - "", + " 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,"
    " - "" + "\"%s\"" - "", + " 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,"
    " - "" + "\"%s\"" - "", + " 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,"
    " - "" + "\"%s\"" - "", + " 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,"
    "); + fprintf (Gbl.F.Out,"" + ""); } /*****************************************************************************/ diff --git a/swad_record.c b/swad_record.c index 6164db2a..cff98169 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2345,7 +2345,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, Act_LinkFormSubmit (Txt_Write_a_message,ClassData); fprintf (Gbl.F.Out,"
    " - "\"%s\"" "
    " diff --git a/swad_user.c b/swad_user.c index 198b8246..abf8a905 100644 --- a/swad_user.c +++ b/swad_user.c @@ -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"); } -