From cd8116f01d8af18f60d56ab3285e69094760beb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 14 Mar 2015 12:13:12 +0100 Subject: [PATCH] Version 14.91.1 --- css/swad_desktop.css | 6 +-- swad_changelog.h | 4 +- swad_file_browser.c | 26 ++++++---- swad_user.c | 121 +++++++++++++++++++++++++------------------ swad_user.h | 1 - 5 files changed, 92 insertions(+), 66 deletions(-) diff --git a/css/swad_desktop.css b/css/swad_desktop.css index 9cec0e7c0..b1c1b643d 100644 --- a/css/swad_desktop.css +++ b/css/swad_desktop.css @@ -271,7 +271,7 @@ hr.YELLOW_SEPARA {height:0; border-top:0; border-bottom:#BD4815 dotted 1px;} .FRAME10 { margin:4px 0; - padding:10px 0; + padding:0; background-color:white; border-radius:4px; box-shadow:1px 1px 1px #CCC; @@ -282,7 +282,7 @@ hr.YELLOW_SEPARA {height:0; border-top:0; border-bottom:#BD4815 dotted 1px;} .FRAME10_SHADOW { margin:4px 0 14px 0; - padding:10px 0; + padding:0; background-color:rgba(255,255,255,0.95); border-width:1px; border-style:solid; @@ -295,7 +295,7 @@ hr.YELLOW_SEPARA {height:0; border-top:0; border-bottom:#BD4815 dotted 1px;} } .TABLE10 { - padding:0 10px; + padding:10px; width:100%; } .TIT_TBL_10 diff --git a/swad_changelog.h b/swad_changelog.h index 98f708f72..f25b84426 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,11 +103,13 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.91 (2015/03/14)" +#define Log_PLATFORM_VERSION "SWAD 14.91.1 (2015/03/14)" // 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 14.91.1: Mar 14, 2015 Current figures separated from historic figures in layout of public user profile. + Show only number of files, not folder or links. (182112 lines) Version 14.91: Mar 14, 2015 Statistics for number of file views added to user figures. (182091 lines) 2 changes necessary in database: ALTER TABLE usr_figures ADD COLUMN NumFileViews INT NOT NULL DEFAULT -1 AFTER NumClicks; diff --git a/swad_file_browser.c b/swad_file_browser.c index 8dcf19f10..98704f966 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -10195,12 +10195,15 @@ static bool Brw_GetIfFolderHasPublicFiles (const char *Path) unsigned Brw_GetNumFilesUsr (long UsrCod) { - char Query[128]; + char Query[256]; - /***** 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"); + /***** Get current number of files published by a user from database *****/ + sprintf (Query,"SELECT COUNT(*) FROM files" + " WHERE PublisherUsrCod='%ld' AND FileType IN ('%u','%u')", + UsrCod, + (unsigned) Brw_IS_FILE, + (unsigned) Brw_IS_UNKNOWN); // Unknown entries are counted as files + return (unsigned) DB_QueryCOUNT (Query,"can not get number of files from a user"); } /*****************************************************************************/ @@ -10209,13 +10212,16 @@ unsigned Brw_GetNumFilesUsr (long UsrCod) unsigned Brw_GetNumPublicFilesUsr (long UsrCod) { - char Query[128]; + char Query[256]; - /***** Get number of posts from a user from database *****/ + /***** Get current number of public files published by a user from database *****/ sprintf (Query,"SELECT COUNT(*) FROM files" - " WHERE PublisherUsrCod='%ld' AND Public='Y'", - UsrCod); - return (unsigned) DB_QueryCOUNT (Query,"can not number of public files from a user"); + " WHERE PublisherUsrCod='%ld' AND FileType IN ('%u','%u')" + " AND Public='Y'", + UsrCod, + (unsigned) Brw_IS_FILE, + (unsigned) Brw_IS_UNKNOWN); // Unknown entries are counted as files + return (unsigned) DB_QueryCOUNT (Query,"can not get number of public files from a user"); } /*****************************************************************************/ diff --git a/swad_user.c b/swad_user.c index eee745f98..f93faf2f4 100644 --- a/swad_user.c +++ b/swad_user.c @@ -185,6 +185,8 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role); static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role); static void Usr_ShowUserProfile (void); +static void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat); +static void Usr_ShowHistoricUserProfile (const struct UsrData *UsrDat); static void Usr_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures); static unsigned long Usr_GetRankingNumClicks (long UsrCod); static unsigned long Usr_GetNumUsrsWithNumClicks (void); @@ -7524,17 +7526,22 @@ static void Usr_ShowUserProfile (void) 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 *****/ Usr_ShowDetailsUserProfile (&Gbl.Usrs.Other.UsrDat); + fprintf (Gbl.F.Out,""); + + /***** Show historic user's profile *****/ + Usr_ShowHistoricUserProfile (&Gbl.Usrs.Other.UsrDat); + fprintf (Gbl.F.Out,"
" @@ -7587,7 +7594,7 @@ void Usr_ChangeProfileVisibility (void) /********************** Show details of user's profile ***********************/ /*****************************************************************************/ -void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) +static void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) { extern const char *The_ClassFormul[The_NUM_THEMES]; // extern const char *Txt_Figures; @@ -7596,26 +7603,9 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_course; extern const char *Txt_courses; - extern const char *Txt_From_TIME; - extern const char *Txt_day; - extern const char *Txt_days; - extern const char *Txt_Calculate; - extern const char *Txt_Clicks; - extern const char *Txt_of_PART_OF_A_TOTAL; - extern const char *Txt_clicks; extern const char *Txt_Files; extern const char *Txt_files; extern const char *Txt_public_FILES; - extern const char *Txt_Downloads; - extern const char *Txt_download; - extern const char *Txt_downloads; - extern const char *Txt_Forums; - extern const char *Txt_post; - extern const char *Txt_posts; - extern const char *Txt_Messages; - extern const char *Txt_message; - extern const char *Txt_messages; - struct UsrFigures UsrFigures; unsigned NumCrssUsrIsTeacher; unsigned NumCrssUsrIsStudent; unsigned NumStds; @@ -7624,15 +7614,15 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) unsigned NumPublicFiles; /***** Start table *****/ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,"
" + ""); /***** Number of courses in which the user is teacher or student *****/ if ((NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_ROLE_TEACHER))) { NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_TEACHER,Rol_ROLE_TEACHER); NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_TEACHER,Rol_ROLE_STUDENT); - fprintf (Gbl.F.Out,"" - "" @@ -7659,8 +7649,7 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) { NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_TEACHER); NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_STUDENT); - fprintf (Gbl.F.Out,"" - "" @@ -7670,8 +7659,7 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) "%u %s
" "%u %s" "" - "" - "", + "", The_ClassFormul[Gbl.Prefs.Theme], Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][UsrDat->Sex], NumCrssUsrIsStudent, @@ -7685,6 +7673,59 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) Txt_ROLES_PLURAL_abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]); } + /***** Number of files currently published *****/ + if ((NumFiles = Brw_GetNumFilesUsr (UsrDat->UsrCod))) + NumPublicFiles = Brw_GetNumPublicFilesUsr (UsrDat->UsrCod); + else + NumPublicFiles = 0; + fprintf (Gbl.F.Out,"" + "", + The_ClassFormul[Gbl.Prefs.Theme], + Txt_Files, + NumFiles,Txt_files, + NumPublicFiles,Txt_public_FILES); + + /***** End of table *****/ + fprintf (Gbl.F.Out,"" + "
" "%s" "
" "%s" "
" + "%s" + "" + "%u %s
" + "%u %s" + "" + "
"); + } + +/*****************************************************************************/ +/********************** Show details of user's profile ***********************/ +/*****************************************************************************/ + +static void Usr_ShowHistoricUserProfile (const struct UsrData *UsrDat) + { + extern const char *The_ClassFormul[The_NUM_THEMES]; + extern const char *Txt_From_TIME; + extern const char *Txt_day; + extern const char *Txt_days; + extern const char *Txt_Calculate; + extern const char *Txt_Clicks; + extern const char *Txt_of_PART_OF_A_TOTAL; + extern const char *Txt_clicks; + extern const char *Txt_Downloads; + extern const char *Txt_download; + extern const char *Txt_downloads; + extern const char *Txt_Forums; + extern const char *Txt_post; + extern const char *Txt_posts; + extern const char *Txt_Messages; + extern const char *Txt_message; + extern const char *Txt_messages; + struct UsrFigures UsrFigures; + + /***** Start table *****/ + fprintf (Gbl.F.Out,""); + /***** Get figures *****/ Usr_GetUsrFigures (UsrDat->UsrCod,&UsrFigures); @@ -7772,28 +7813,6 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) fprintf (Gbl.F.Out,"" ""); - /***** Number of files published *****/ - if ((NumFiles = Brw_GetNumFilesUsr (UsrDat->UsrCod))) - NumPublicFiles = Brw_GetNumPublicFilesUsr (UsrDat->UsrCod); - else - NumPublicFiles = 0; - fprintf (Gbl.F.Out,"" - "" - "" - "", - The_ClassFormul[Gbl.Prefs.Theme], - Txt_Files, - NumFiles,Txt_files, - NumPublicFiles,Txt_public_FILES); - /***** Number of file views *****/ fprintf (Gbl.F.Out,"" "
" - "%s" - "" - "%u %s
" - "%u %s" - "" - "