From aa5e76d859ca61d47b5686bcba23cc6b453261f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 9 Mar 2015 19:26:58 +0100 Subject: [PATCH] Version 14.81.2 --- swad_changelog.h | 5 +++-- swad_file_browser.c | 14 ++++++++++++++ swad_file_browser.h | 1 + swad_user.c | 17 +++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 276a185c2..f928814b5 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,12 +103,13 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.81.2 (2015/03/09)" +#define Log_PLATFORM_VERSION "SWAD 14.81.3 (2015/03/09)" // 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 | tail -1 /* - Version 14.81.2: Mar 09, 2015 Information about number of courses in user's public profile. (? lines) + Version 14.81.3: Mar 09, 2015 Information about number of files in user's public profile. (? lines) + Version 14.81.2: Mar 09, 2015 Information about number of courses in user's public profile. (179641 lines) Version 14.81.1: Mar 09, 2015 Information about number of messages sent in user's public profile. (179545 lines) Version 14.81: Mar 09, 2015 Information about number of forum posts in user's public profile. (179512 lines) Version 14.80.19: Mar 09, 2015 Fixed bug in web service, reported by Juan Miguel Boyero Corral. (179482 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index fa7620b14..0cb667ed5 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -10144,6 +10144,20 @@ static bool Brw_GetIfFolderHasPublicFiles (const char *Path) return (DB_QueryCOUNT (Query,"can not check if a folder contains public files") != 0); } +/*****************************************************************************/ +/*********************** Get number of files from a user *********************/ +/*****************************************************************************/ + +unsigned Brw_GetNumFilesUsr (long UsrCod) + { + char Query[128]; + + /***** Get number of posts from a user from database *****/ + sprintf (Query,"SELECT COUNT(*) FROM files WHERE PublisherUsrCod='%ld'", + UsrCod); + return (unsigned) DB_QueryCOUNT (Query,"can not number of files from a user"); + } + /*****************************************************************************/ /***************** Change hiddeness of file in the database ******************/ /*****************************************************************************/ diff --git a/swad_file_browser.h b/swad_file_browser.h index 2a213850f..f638303ae 100644 --- a/swad_file_browser.h +++ b/swad_file_browser.h @@ -186,6 +186,7 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata); bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata); void Brw_GetAndUpdateFileViews (struct FileMetadata *FileMetadata); void Brw_UpdateMyFileViews (long FilCod); +unsigned Brw_GetNumFilesUsr (long UsrCod); long Brw_GetCodForFiles (void); void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod, diff --git a/swad_user.c b/swad_user.c index b29352547..290235494 100644 --- a/swad_user.c +++ b/swad_user.c @@ -7558,6 +7558,7 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) extern const char *Txt_Courses_as_a_ROLE; extern const char *Txt_ROLES_SINGULAR_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; + extern const char *Txt_Files; extern const char *Txt_Forum_posts; extern const char *Txt_Messages_sent; unsigned NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_ROLE_TEACHER); @@ -7626,6 +7627,22 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) Txt_ROLES_PLURAL_abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN]); } + /***** Number of files published *****/ + fprintf (Gbl.F.Out,"" + "" + "%s:" + "" + "" + "%u" + "" + "" + "", + The_ClassFormul[Gbl.Prefs.Theme], + Txt_Files, + Brw_GetNumFilesUsr (UsrDat->UsrCod)); + /***** Number of posts in forums *****/ fprintf (Gbl.F.Out,"" "