From a4e30e209f8062c11bf1a24cec74589566dee8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 1 Mar 2017 14:53:18 +0100 Subject: [PATCH] Version 16.144 --- css/{swad16.139.6.css => swad16.144.css} | 20 ++-- js/{swad16.143.2.js => swad16.144.js} | 4 +- swad_changelog.h | 9 +- swad_country.c | 8 +- swad_country.h | 2 +- swad_photo.c | 53 +++++----- swad_record.c | 3 +- swad_user.c | 117 +++++++++++++---------- swad_user.h | 1 + 9 files changed, 118 insertions(+), 99 deletions(-) rename css/{swad16.139.6.css => swad16.144.css} (99%) rename js/{swad16.143.2.js => swad16.144.js} (99%) diff --git a/css/swad16.139.6.css b/css/swad16.144.css similarity index 99% rename from css/swad16.139.6.css rename to css/swad16.144.css index c1bbe832..a0ac437d 100644 --- a/css/swad16.139.6.css +++ b/css/swad16.144.css @@ -1714,10 +1714,14 @@ a:hover img.CENTRE_PHOTO_SHOW border-radius:6px; box-shadow:2px 5px 15px #888; } -.ZOOM_TXT +.ZOOM_TXT_LINE { - color:#202020; - font-size:12pt; + display:block; + width:186px; + white-space:nowrap; + overflow:hidden; + text-overflow:ellipsis; + margin:0 auto; } .NO_BR {white-space:nowrap;} @@ -1881,9 +1885,9 @@ a:hover img.CENTRE_PHOTO_SHOW .LST_EDIT_REC {color:#008000; font-weight:bold; font-size:11pt; height:20px; padding-top:0; padding-bottom:0; margin-top:-1px; margin-bottom:-1px; border-width:1px; border-style:solid; border-color:#ECE9D8;} .LST_EDIT_REC_HID {color:#89BE87; font-weight:bold; font-size:11pt; height:20px; padding-top:0; padding-bottom:0; margin-top:-1px; margin-bottom:-1px; border-width:1px; border-style:solid; border-color:#ECE9D8;} -.DAT {color:#404040; font-size:13pt;} -.DAT_NOBR {color:#404040; font-size:13pt; white-space:nowrap;} -.DAT_BOLD {color:#404040; font-size:13pt; font-weight:bold;} +.DAT {color:#606060; font-size:13pt;} +.DAT_NOBR {color:#606060; font-size:13pt; white-space:nowrap;} +.DAT_BOLD {color:#606060; font-size:13pt; font-weight:bold;} .DAT_GREEN {color:#008000; font-size:13pt;} .DAT_LIGHT {color:#A0A0A0; font-size:13pt;} .DAT_N {color:black; font-size:13pt;} @@ -1899,9 +1903,9 @@ a:hover img.CENTRE_PHOTO_SHOW border-width:1px; } -.DAT_SMALL {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#707070; font-size:12pt;} +.DAT_SMALL {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#606060; font-size:12pt;} .DAT_SMALL_LIGHT {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#A0A0A0; font-size:12pt;} -.DAT_SMALL_NOBR {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#707070; font-size:12pt; white-space:nowrap;} +.DAT_SMALL_NOBR {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#606060; font-size:12pt; white-space:nowrap;} .DAT_SMALL_N {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt;} .DAT_SMALL_NOBR_N {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:black; font-size:12pt; white-space:nowrap;} diff --git a/js/swad16.143.2.js b/js/swad16.144.js similarity index 99% rename from js/swad16.143.2.js rename to js/swad16.144.js index b74e6f99..9c393cd3 100644 --- a/js/swad16.143.2.js +++ b/js/swad16.144.js @@ -725,9 +725,7 @@ function zoom (img,urlPhoto,idCaption) { document.getElementById('zoomLyr').style.left = xPos + 'px'; document.getElementById('zoomLyr').style.top = yPos + 'px'; document.getElementById('zoomImg').src = urlPhoto; - document.getElementById('zoomTxt').innerHTML = '' + - document.getElementById(idCaption).innerHTML + - ''; + document.getElementById('zoomTxt').innerHTML = document.getElementById(idCaption).innerHTML; } // Exit from zooming a user's photograph diff --git a/swad_changelog.h b/swad_changelog.h index e3323f97..0917fdc0 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -192,21 +192,20 @@ // TODO: En los detalles de asistencia debería salir la fecha de cada sesión // TODO: System admin should view link "Visits to course" -// TODO: Bajo la foto de cada usuario el país - // TODO: Un administrador de institución, ¿debería poder cambiar la contraseña de un usuario de esa institución? No lo tengo claro. /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.143.4 (2017-03-01)" -#define CSS_FILE "swad16.139.6.css" -#define JS_FILE "swad16.143.2.js" +#define Log_PLATFORM_VERSION "SWAD 16.144 (2017-03-01)" +#define CSS_FILE "swad16.144.css" +#define JS_FILE "swad16.144.js" // 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 16.144: Mar 01, 2017 Label with the user's country under her/his enlarged photo. (213265 lines) Version 16.143.4: Mar 01, 2017 New place for QR icon in user's record card. (213249 lines) Version 16.143.3: Feb 28, 2017 Changes in layout of page head. (213238 lines) Version 16.143.2: Feb 28, 2017 Fixed bug in user timeline. (213237 lines) diff --git a/swad_country.c b/swad_country.c index 326cd17e..083fdf19 100644 --- a/swad_country.c +++ b/swad_country.c @@ -1200,13 +1200,15 @@ void Cty_WriteSelectorOfCountry (void) /*****************************************************************************/ /**************************** Get country full name **************************/ /*****************************************************************************/ +// If ClassLink == NULL ==> do not put link -void Cty_WriteCountryName (long CtyCod,const char *Class) +void Cty_WriteCountryName (long CtyCod,const char *ClassLink) { extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS]; char CtyName[Cty_MAX_BYTES_COUNTRY_NAME + 1]; char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1]; - bool PutForm = !Gbl.Form.Inside && // Only if not inside another form + bool PutForm = ClassLink && + !Gbl.Form.Inside && // Only if not inside another form Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window /***** Get country name *****/ @@ -1218,7 +1220,7 @@ void Cty_WriteCountryName (long CtyCod,const char *Class) Act_FormStart (ActSeeCtyInf); Cty_PutParamCtyCod (CtyCod); Act_LinkFormSubmit (Act_GetActionTextFromDB (Act_Actions[ActSeeCtyInf].ActCod,ActTxt), - Class,NULL); + ClassLink,NULL); fprintf (Gbl.F.Out,"%s",CtyName); Act_FormEnd (); } diff --git a/swad_country.h b/swad_country.h index 263ecb1c..3d35c44c 100644 --- a/swad_country.h +++ b/swad_country.h @@ -94,7 +94,7 @@ void Cty_EditCountries (void); void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData); void Cty_FreeListCountries (void); void Cty_WriteSelectorOfCountry (void); -void Cty_WriteCountryName (long CtyCod,const char *Class); +void Cty_WriteCountryName (long CtyCod,const char *ClassLink); bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraData); void Cty_GetCountryName (long CtyCod,char CtyName[Cty_MAX_BYTES_COUNTRY_NAME + 1]); void Cty_PutParamCtyCod (long CtyCod); diff --git a/swad_photo.c b/swad_photo.c index a983fb1c..e44f1e46 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -1111,9 +1111,6 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, bool FormUnique) { extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS]; - char FullName [Usr_MAX_BYTES_FULL_NAME + 1]; - char ShortName[Usr_MAX_BYTES_FULL_NAME + 1]; - char Surnames [Usr_MAX_BYTES_SURNAMES + 1]; bool PhotoExists; bool PutLinkToPublicProfile = !Gbl.Form.Inside && // Only if not inside another form Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window @@ -1140,35 +1137,35 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, } /***** Hidden div to pass user's name to Javascript *****/ - Str_Copy (FullName,UsrDat->FullName, - Usr_MAX_BYTES_FULL_NAME); if (PutZoomCode) { - Str_Copy (ShortName,UsrDat->FirstName, - Usr_MAX_BYTES_FULL_NAME); - Str_LimitLengthHTMLStr (ShortName,23); - Surnames[0] = '\0'; - if (UsrDat->Surname1[0]) - Str_Copy (Surnames,UsrDat->Surname1, - Usr_MAX_BYTES_SURNAMES); - if (UsrDat->Surname2[0]) - { - Str_Concat (Surnames," ", - Usr_MAX_BYTES_SURNAMES); - Str_Concat (Surnames,UsrDat->Surname2, - Usr_MAX_BYTES_SURNAMES); - } - Str_LimitLengthHTMLStr (Surnames,23); - Str_Concat (ShortName,"
", - Usr_MAX_BYTES_FULL_NAME); - Str_Concat (ShortName,Surnames, - Usr_MAX_BYTES_FULL_NAME); - Act_SetUniqueId (IdCaption); - fprintf (Gbl.F.Out,"
" + fprintf (Gbl.F.Out,"
", + IdCaption); + + /* First name */ + fprintf (Gbl.F.Out,"
" "%s" "
", - IdCaption,ShortName); + UsrDat->FirstName); + + /* Surnames */ + fprintf (Gbl.F.Out,"
%s", + UsrDat->Surname1); + if (UsrDat->Surname2[0]) + fprintf (Gbl.F.Out," %s",UsrDat->Surname2); + fprintf (Gbl.F.Out,"
"); + + /* Country */ + if (UsrDat->CtyCod > 0) + { + fprintf (Gbl.F.Out,"
"); + Cty_WriteCountryName (UsrDat->CtyCod, + NULL); // Don't put link to country + fprintf (Gbl.F.Out,"
"); + } + + fprintf (Gbl.F.Out,"
"); } /***** Start image *****/ @@ -1183,7 +1180,7 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, fprintf (Gbl.F.Out,"%s/usr_bl.jpg",Gbl.Prefs.IconsURL); fprintf (Gbl.F.Out,"\" alt=\"%s\" title=\"%s\"" " class=\"%s\"", - FullName,FullName, + UsrDat->FullName,UsrDat->FullName, ClassPhoto); /***** Image zoom *****/ diff --git a/swad_record.c b/swad_record.c index 62134e7a..06f19e0e 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2674,7 +2674,8 @@ static void Rec_ShowCountryInHead (struct UsrData *UsrDat,bool ShowData) fprintf (Gbl.F.Out,""); if (ShowData && UsrDat->CtyCod > 0) /* Link to see country information */ - Cty_WriteCountryName (UsrDat->CtyCod,"REC_DAT_BOLD"); + Cty_WriteCountryName (UsrDat->CtyCod, + "REC_DAT_BOLD"); // Put link to country fprintf (Gbl.F.Out,""); } diff --git a/swad_user.c b/swad_user.c index abbf28ae..a0cd7d2a 100644 --- a/swad_user.c +++ b/swad_user.c @@ -3969,6 +3969,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role, "usr_data.Sex," "usr_data.Photo," "usr_data.PhotoVisibility," + "usr_data.CtyCod," "usr_data.InsCod," "crs_usr.Role," "crs_usr.Accepted"; @@ -3982,9 +3983,10 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role, row[ 6]: usr_data.Sex row[ 7]: usr_data.Photo row[ 8]: usr_data.PhotoVisibility - row[ 9]: usr_data.InsCod - row[10]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) - row[11]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) + row[ 9]: usr_data.CtyCod + row[10]: usr_data.InsCod + row[11]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) + row[12]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) */ /***** If there are no groups selected, don't do anything *****/ @@ -4143,6 +4145,7 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope) "usr_data.Sex," "usr_data.Photo," "usr_data.PhotoVisibility," + "usr_data.CtyCod," "usr_data.InsCod"; /* row[ 0]: usr_data.UsrCod @@ -4154,9 +4157,10 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope) row[ 6]: usr_data.Sex row[ 7]: usr_data.Photo row[ 8]: usr_data.PhotoVisibility - row[ 9]: usr_data.InsCod - row[10]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) - row[11]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) + row[ 9]: usr_data.CtyCod + row[10]: usr_data.InsCod + row[11]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) + row[12]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) */ /***** Build query *****/ @@ -4267,7 +4271,7 @@ void Usr_GetListUsrs (Rol_Role_t Role,Sco_Scope_t Scope) } /*****************************************************************************/ -/********* Search list of users with a given role in current scope ***********/ +/*********** Search for users with a given role in current scope *************/ /*****************************************************************************/ void Usr_SearchListUsrs (Rol_Role_t Role) @@ -4283,6 +4287,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role) "usr_data.Sex," "usr_data.Photo," "usr_data.PhotoVisibility," + "usr_data.CtyCod," "usr_data.InsCod"; /* row[ 0]: usr_data.UsrCod @@ -4294,9 +4299,10 @@ void Usr_SearchListUsrs (Rol_Role_t Role) row[ 6]: usr_data.Sex row[ 7]: usr_data.Photo row[ 8]: usr_data.PhotoVisibility - row[ 9]: usr_data.InsCod - row[10]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) - row[11]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) + row[ 9]: usr_data.CtyCod + row[10]: usr_data.InsCod + row[11]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) + row[12]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) */ const char *OrderQuery = "candidate_users.UsrCod=usr_data.UsrCod" " ORDER BY " @@ -4565,18 +4571,20 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope) "Sex," "Photo," "PhotoVisibility," + "CtyCod," "InsCod"; /* - row[0]: usr_data.UsrCod - row[1]: usr_data.EncryptedUsrCod - row[2]: usr_data.Password - row[3]: usr_data.Surname1 - row[4]: usr_data.Surname2 - row[5]: usr_data.FirstName - row[6]: usr_data.Sex - row[7]: usr_data.Photo - row[8]: usr_data.PhotoVisibility - row[9]: usr_data.InsCod + row[ 0]: usr_data.UsrCod + row[ 1]: usr_data.EncryptedUsrCod + row[ 2]: usr_data.Password + row[ 3]: usr_data.Surname1 + row[ 4]: usr_data.Surname2 + row[ 5]: usr_data.FirstName + row[ 6]: usr_data.Sex + row[ 7]: usr_data.Photo + row[ 8]: usr_data.PhotoVisibility + row[ 9]: usr_data.CtyCod + row[10]: usr_data.InsCod */ /***** Build query *****/ @@ -4726,18 +4734,20 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope) "Sex," "Photo," "PhotoVisibility," + "CtyCod," "InsCod"; /* - row[0]: usr_data.UsrCod - row[1]: usr_data.EncryptedUsrCod - row[2]: usr_data.Password - row[3]: usr_data.Surname1 - row[4]: usr_data.Surname2 - row[5]: usr_data.FirstName - row[6]: usr_data.Sex - row[7]: usr_data.Photo - row[8]: usr_data.PhotoVisibility - row[9]: usr_data.InsCod + row[ 0]: usr_data.UsrCod + row[ 1]: usr_data.EncryptedUsrCod + row[ 2]: usr_data.Password + row[ 3]: usr_data.Surname1 + row[ 4]: usr_data.Surname2 + row[ 5]: usr_data.FirstName + row[ 6]: usr_data.Sex + row[ 7]: usr_data.Photo + row[ 8]: usr_data.PhotoVisibility + row[ 9]: usr_data.CtyCod + row[10]: usr_data.InsCod */ /***** Build query *****/ @@ -4799,18 +4809,20 @@ void Usr_GetUnorderedStdsCodesInDeg (long DegCod) "usr_data.Sex," "usr_data.Photo," "usr_data.PhotoVisibility," + "usr_data.CtyCod," "usr_data.InsCod"; /* - row[0]: usr_data.UsrCod - row[1]: usr_data.EncryptedUsrCod - row[2]: usr_data.Password - row[3]: usr_data.Surname1 - row[4]: usr_data.Surname2 - row[5]: usr_data.FirstName - row[6]: usr_data.Sex - row[7]: usr_data.Photo - row[8]: usr_data.PhotoVisibility - row[9]: usr_data.InsCod + row[ 0]: usr_data.UsrCod + row[ 1]: usr_data.EncryptedUsrCod + row[ 2]: usr_data.Password + row[ 3]: usr_data.Surname1 + row[ 4]: usr_data.Surname2 + row[ 5]: usr_data.FirstName + row[ 6]: usr_data.Sex + row[ 7]: usr_data.Photo + row[ 8]: usr_data.PhotoVisibility + row[ 9]: usr_data.CtyCod + row[10]: usr_data.InsCod */ Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs = 0; @@ -4879,9 +4891,10 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop row[ 6]: usr_data.Sex row[ 7]: usr_data.Photo row[ 8]: usr_data.PhotoVisibility - row[ 9]: usr_data.InsCod - row[10]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) - row[11]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) + row[ 9]: usr_data.CtyCod + row[10]: usr_data.InsCod + row[11]: crs_usr.Role (only if Scope == Sco_SCOPE_CRS) + row[12]: crs_usr.Accepted (only if Scope == Sco_SCOPE_CRS) */ UsrInList = &Gbl.Usrs.LstUsrs[Role].Lst[NumUsr]; @@ -4918,11 +4931,14 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop /* Get user's photo visibility (row[8]) */ UsrInList->PhotoVisibility = Pri_GetVisibilityFromStr (row[8]); - /* Get user's institution code (row[9]) */ - UsrInList->InsCod = Str_ConvertStrCodToLongCod (row[9]); + /* Get user's country code (row[9]) */ + UsrInList->CtyCod = Str_ConvertStrCodToLongCod (row[9]); + + /* Get user's institution code (row[10]) */ + UsrInList->InsCod = Str_ConvertStrCodToLongCod (row[10]); /* Get user's role and acceptance of enrollment in course(s) - (row[10], row[11] if Scope == Sco_SCOPE_CRS) */ + (row[11], row[12] if Scope == Sco_SCOPE_CRS) */ switch (Role) { case Rol_UNKNOWN: // Here Rol_UNKNOWN means any user @@ -4949,8 +4965,8 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop break; case Sco_SCOPE_CRS: // Course // Query result has a column with the acceptation - UsrInList->RoleInCurrentCrsDB = Rol_ConvertUnsignedStrToRole (row[10]); - UsrInList->Accepted = (row[11][0] == 'Y'); + UsrInList->RoleInCurrentCrsDB = Rol_ConvertUnsignedStrToRole (row[11]); + UsrInList->Accepted = (row[12][0] == 'Y'); break; } break; @@ -4979,8 +4995,8 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop break; case Sco_SCOPE_CRS: // Course // Query result has a column with the acceptation - UsrInList->RoleInCurrentCrsDB = Rol_ConvertUnsignedStrToRole (row[10]); - UsrInList->Accepted = (row[11][0] == 'Y'); + UsrInList->RoleInCurrentCrsDB = Rol_ConvertUnsignedStrToRole (row[11]); + UsrInList->Accepted = (row[12][0] == 'Y'); break; } break; @@ -5021,6 +5037,7 @@ void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList Str_Copy (UsrDat->Photo,UsrInList->Photo, Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64); UsrDat->PhotoVisibility = UsrInList->PhotoVisibility; + UsrDat->CtyCod = UsrInList->CtyCod; UsrDat->InsCod = UsrInList->InsCod; UsrDat->RoleInCurrentCrsDB = UsrInList->RoleInCurrentCrsDB; UsrDat->Accepted = UsrInList->Accepted; diff --git a/swad_user.h b/swad_user.h index 5050192a..081820a8 100644 --- a/swad_user.h +++ b/swad_user.h @@ -193,6 +193,7 @@ struct UsrInList Usr_Sex_t Sex; char Photo[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Name of public link to photo Pri_Visibility_t PhotoVisibility; // Who can see user's photo + long CtyCod; // Country long InsCod; // Institution Rol_Role_t RoleInCurrentCrsDB; // Role in current course in database bool Accepted; // User has accepted joining to one/all courses?