From f172ce3f0c85e843d0f02b0e821ba9875f39bdf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 4 Mar 2017 01:59:27 +0100 Subject: [PATCH] Version 16.146.5 --- swad_assignment.c | 26 +------------------------- swad_attendance.c | 26 +------------------------- swad_changelog.h | 3 ++- swad_message.c | 6 ++---- swad_survey.c | 26 +------------------------- swad_user.c | 33 +++++++++++++++++++++++++++++++++ swad_user.h | 2 ++ 7 files changed, 42 insertions(+), 80 deletions(-) diff --git a/swad_assignment.c b/swad_assignment.c index b3312ce0..56913d34 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -432,31 +432,7 @@ static void Asg_ShowOneAssignment (long AsgCod) static void Asg_WriteAsgAuthor (struct Assignment *Asg) { - bool ShowPhoto = false; - char PhotoURL[PATH_MAX + 1]; - struct UsrData UsrDat; - - /***** Initialize structure with user's data *****/ - Usr_UsrDataConstructor (&UsrDat); - - /***** Get data of author *****/ - UsrDat.UsrCod = Asg->UsrCod; - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) - ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); - - /***** Show photo *****/ - Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : - NULL, - "PHOTO15x20",Pho_ZOOM,false); - - /***** Write name *****/ - fprintf (Gbl.F.Out,"
%s
", - Asg->Hidden ? "AUTHOR_TXT_LIGHT" : - "AUTHOR_TXT", - UsrDat.FullName); - - /***** Free memory used for user's data *****/ - Usr_UsrDataDestructor (&UsrDat); + Usr_WriteAuthor1Line (Asg->UsrCod,Asg->Hidden); } /*****************************************************************************/ diff --git a/swad_attendance.c b/swad_attendance.c index 2548672f..da1e297b 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -472,31 +472,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt static void Att_WriteAttEventAuthor (struct AttendanceEvent *Att) { - bool ShowPhoto = false; - char PhotoURL[PATH_MAX + 1]; - struct UsrData UsrDat; - - /***** Initialize structure with user's data *****/ - Usr_UsrDataConstructor (&UsrDat); - - /***** Get data of author *****/ - UsrDat.UsrCod = Att->UsrCod; - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get of the database the data of the author - ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); - - /***** Show photo *****/ - Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : - NULL, - "PHOTO15x20",Pho_ZOOM,false); - - /***** Write name *****/ - fprintf (Gbl.F.Out,"
%s
", - Att->Hidden ? "AUTHOR_TXT_LIGHT" : - "AUTHOR_TXT", - UsrDat.FullName); - - /***** Free memory used for user's data *****/ - Usr_UsrDataDestructor (&UsrDat); + Usr_WriteAuthor1Line (Att->UsrCod,Att->Hidden); } /*****************************************************************************/ diff --git a/swad_changelog.h b/swad_changelog.h index b01ff6ad..328be68e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -197,13 +197,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.146.4 (2017-03-04)" +#define Log_PLATFORM_VERSION "SWAD 16.146.5 (2017-03-04)" #define CSS_FILE "swad16.146.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.146.5: Mar 03, 2017 Code refactoring related with author of assignments, attendance events and surveys. (216319 lines) Version 16.146.4: Mar 03, 2017 Changes in layout of surveys. (216349 lines) Version 16.146.3: Mar 04, 2017 Changes in layout of edition of institutions, centres and degrees. (216363 lines) Version 16.146.2: Mar 04, 2017 Changes in layout of authors. (216354 lines) diff --git a/swad_message.c b/swad_message.c index c84835cd..085139f0 100644 --- a/swad_message.c +++ b/swad_message.c @@ -3141,10 +3141,8 @@ void Msg_WriteMsgAuthor (struct UsrData *UsrDat, fprintf (Gbl.F.Out,""); - - /* Restrict length of firstname and surnames */ - fprintf (Gbl.F.Out,"
" + fprintf (Gbl.F.Out,"\">" + "
" "%s
" "%s", Style, diff --git a/swad_survey.c b/swad_survey.c index dc8d2b44..2a72dfc3 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -665,31 +665,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, static void Svy_WriteAuthor (struct Survey *Svy) { - bool ShowPhoto = false; - char PhotoURL[PATH_MAX + 1]; - struct UsrData UsrDat; - - /***** Initialize structure with user's data *****/ - Usr_UsrDataConstructor (&UsrDat); - - /***** Get data of author *****/ - UsrDat.UsrCod = Svy->UsrCod; - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get of the database the data of the author - ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); - - /***** Show photo *****/ - Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : - NULL, - "PHOTO15x20",Pho_ZOOM,false); - - /***** Write name *****/ - fprintf (Gbl.F.Out,"
%s
", - Svy->Status.Visible ? "AUTHOR_TXT" : - "AUTHOR_TXT_LIGHT", - UsrDat.FullName); - - /***** Free memory used for user's data *****/ - Usr_UsrDataDestructor (&UsrDat); + Usr_WriteAuthor1Line (Svy->UsrCod,!Svy->Status.Visible); } /*****************************************************************************/ diff --git a/swad_user.c b/swad_user.c index 2b1d3269..0d2b4301 100644 --- a/swad_user.c +++ b/swad_user.c @@ -8524,3 +8524,36 @@ void Usr_PrintUsrQRCode (void) else Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); } + +/*****************************************************************************/ +/********************* Write the author of an assignment *********************/ +/*****************************************************************************/ + +void Usr_WriteAuthor1Line (long UsrCod,bool Hidden) + { + bool ShowPhoto = false; + char PhotoURL[PATH_MAX + 1]; + struct UsrData UsrDat; + + /***** Initialize structure with user's data *****/ + Usr_UsrDataConstructor (&UsrDat); + + /***** Get data of author *****/ + UsrDat.UsrCod = UsrCod; + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) + ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); + + /***** Show photo *****/ + Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : + NULL, + "PHOTO15x20",Pho_ZOOM,false); + + /***** Write name *****/ + fprintf (Gbl.F.Out,"
%s
", + Hidden ? "AUTHOR_TXT_LIGHT" : + "AUTHOR_TXT", + UsrDat.FullName); + + /***** Free memory used for user's data *****/ + Usr_UsrDataDestructor (&UsrDat); + } diff --git a/swad_user.h b/swad_user.h index 081820a8..79a2fe6b 100644 --- a/swad_user.h +++ b/swad_user.h @@ -402,4 +402,6 @@ void Usr_RemoveUsrFromUsrBanned (long UsrCod); void Usr_PrintUsrQRCode (void); +void Usr_WriteAuthor1Line (long UsrCod,bool Hidden); + #endif