Version 14.91.1

This commit is contained in:
Antonio Cañas Vargas 2015-03-14 12:13:12 +01:00
parent 3508c419a0
commit cd8116f01d
5 changed files with 92 additions and 66 deletions

View File

@ -271,7 +271,7 @@ hr.YELLOW_SEPARA {height:0; border-top:0; border-bottom:#BD4815 dotted 1px;}
.FRAME10 .FRAME10
{ {
margin:4px 0; margin:4px 0;
padding:10px 0; padding:0;
background-color:white; background-color:white;
border-radius:4px; border-radius:4px;
box-shadow:1px 1px 1px #CCC; 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 .FRAME10_SHADOW
{ {
margin:4px 0 14px 0; margin:4px 0 14px 0;
padding:10px 0; padding:0;
background-color:rgba(255,255,255,0.95); background-color:rgba(255,255,255,0.95);
border-width:1px; border-width:1px;
border-style:solid; border-style:solid;
@ -295,7 +295,7 @@ hr.YELLOW_SEPARA {height:0; border-top:0; border-bottom:#BD4815 dotted 1px;}
} }
.TABLE10 .TABLE10
{ {
padding:0 10px; padding:10px;
width:100%; width:100%;
} }
.TIT_TBL_10 .TIT_TBL_10

View File

@ -103,11 +103,13 @@
/****************************** Public constants *****************************/ /****************************** 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: // 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 // 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) Version 14.91: Mar 14, 2015 Statistics for number of file views added to user figures. (182091 lines)
2 changes necessary in database: 2 changes necessary in database:
ALTER TABLE usr_figures ADD COLUMN NumFileViews INT NOT NULL DEFAULT -1 AFTER NumClicks; ALTER TABLE usr_figures ADD COLUMN NumFileViews INT NOT NULL DEFAULT -1 AFTER NumClicks;

View File

@ -10195,12 +10195,15 @@ static bool Brw_GetIfFolderHasPublicFiles (const char *Path)
unsigned Brw_GetNumFilesUsr (long UsrCod) unsigned Brw_GetNumFilesUsr (long UsrCod)
{ {
char Query[128]; char Query[256];
/***** Get number of posts from a user from database *****/ /***** Get current number of files published by a user from database *****/
sprintf (Query,"SELECT COUNT(*) FROM files WHERE PublisherUsrCod='%ld'", sprintf (Query,"SELECT COUNT(*) FROM files"
UsrCod); " WHERE PublisherUsrCod='%ld' AND FileType IN ('%u','%u')",
return (unsigned) DB_QueryCOUNT (Query,"can not number of files from a user"); 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) 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" sprintf (Query,"SELECT COUNT(*) FROM files"
" WHERE PublisherUsrCod='%ld' AND Public='Y'", " WHERE PublisherUsrCod='%ld' AND FileType IN ('%u','%u')"
UsrCod); " AND Public='Y'",
return (unsigned) DB_QueryCOUNT (Query,"can not number of public files from a user"); 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");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -185,6 +185,8 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role);
static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role); static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role);
static void Usr_ShowUserProfile (void); 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 void Usr_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures);
static unsigned long Usr_GetRankingNumClicks (long UsrCod); static unsigned long Usr_GetRankingNumClicks (long UsrCod);
static unsigned long Usr_GetNumUsrsWithNumClicks (void); static unsigned long Usr_GetNumUsrsWithNumClicks (void);
@ -7524,17 +7526,22 @@ static void Usr_ShowUserProfile (void)
fprintf (Gbl.F.Out,"<div style=\"margin:0 auto;\">" fprintf (Gbl.F.Out,"<div style=\"margin:0 auto;\">"
"<table style=\"margin:0 auto;\">" "<table style=\"margin:0 auto;\">"
"<tr>" "<tr>"
"<td style=\"text-align:right; vertical-align:top;\">"); "<td style=\"text-align:right;"
" vertical-align:top;\">");
/***** Common record *****/ /***** Common record *****/
Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"<td style=\"text-align:left; vertical-align:top; padding-left:4px;\">");
/***** Show details of user's profile *****/ /***** Show details of user's profile *****/
Usr_ShowDetailsUserProfile (&Gbl.Usrs.Other.UsrDat); Usr_ShowDetailsUserProfile (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>"
"<td style=\"text-align:left;"
" vertical-align:top; padding-left:4px;\">");
/***** Show historic user's profile *****/
Usr_ShowHistoricUserProfile (&Gbl.Usrs.Other.UsrDat);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>" "</tr>"
"</table>" "</table>"
@ -7587,7 +7594,7 @@ void Usr_ChangeProfileVisibility (void)
/********************** Show details of user's profile ***********************/ /********************** 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 *The_ClassFormul[The_NUM_THEMES];
// extern const char *Txt_Figures; // 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_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_course; extern const char *Txt_course;
extern const char *Txt_courses; 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_files; extern const char *Txt_files;
extern const char *Txt_public_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 NumCrssUsrIsTeacher;
unsigned NumCrssUsrIsStudent; unsigned NumCrssUsrIsStudent;
unsigned NumStds; unsigned NumStds;
@ -7624,15 +7614,15 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
unsigned NumPublicFiles; unsigned NumPublicFiles;
/***** Start table *****/ /***** Start table *****/
fprintf (Gbl.F.Out,"<table class=\"TABLE10 CELLS_PAD_2\">"); fprintf (Gbl.F.Out,"<table class=\"TABLE10 CELLS_PAD_2\">"
"<tr>");
/***** Number of courses in which the user is teacher or student *****/ /***** Number of courses in which the user is teacher or student *****/
if ((NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_ROLE_TEACHER))) if ((NumCrssUsrIsTeacher = Usr_GetNumCrssOfUsrWithARole (UsrDat->UsrCod,Rol_ROLE_TEACHER)))
{ {
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_TEACHER,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); NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_TEACHER,Rol_ROLE_STUDENT);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<td class=\"%s\""
"<td class=\"%s\""
" style=\"text-align:right; vertical-align:top;\">" " style=\"text-align:right; vertical-align:top;\">"
"%s" "%s"
"</td>" "</td>"
@ -7659,8 +7649,7 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
{ {
NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_TEACHER); NumTchs = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_TEACHER);
NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_STUDENT); NumStds = Usr_GetNumUsrsInCrssOfAUsr (UsrDat->UsrCod,Rol_ROLE_STUDENT,Rol_ROLE_STUDENT);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<td class=\"%s\""
"<td class=\"%s\""
" style=\"text-align:right; vertical-align:top;\">" " style=\"text-align:right; vertical-align:top;\">"
"%s" "%s"
"</td>" "</td>"
@ -7670,8 +7659,7 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
"%u&nbsp;%s<br />" "%u&nbsp;%s<br />"
"%u&nbsp;%s" "%u&nbsp;%s"
"</a>" "</a>"
"</td>" "</td>",
"</tr>",
The_ClassFormul[Gbl.Prefs.Theme], The_ClassFormul[Gbl.Prefs.Theme],
Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][UsrDat->Sex], Txt_ROLES_SINGUL_Abc[Rol_ROLE_STUDENT][UsrDat->Sex],
NumCrssUsrIsStudent, NumCrssUsrIsStudent,
@ -7685,6 +7673,59 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Txt_ROLES_PLURAL_abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]); 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,"<td class=\"%s\""
" style=\"text-align:right; vertical-align:top;\">"
"%s"
"</td>"
"<td class=\"DAT\""
" style=\"text-align:left; vertical-align:top;\">"
"%u&nbsp;%s<br />"
"%u&nbsp;%s"
"</a>"
"</td>",
The_ClassFormul[Gbl.Prefs.Theme],
Txt_Files,
NumFiles,Txt_files,
NumPublicFiles,Txt_public_FILES);
/***** End of table *****/
fprintf (Gbl.F.Out,"</tr>"
"</table>");
}
/*****************************************************************************/
/********************** 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,"<table class=\"TABLE10 CELLS_PAD_2\">");
/***** Get figures *****/ /***** Get figures *****/
Usr_GetUsrFigures (UsrDat->UsrCod,&UsrFigures); Usr_GetUsrFigures (UsrDat->UsrCod,&UsrFigures);
@ -7772,28 +7813,6 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
/***** Number of files published *****/
if ((NumFiles = Brw_GetNumFilesUsr (UsrDat->UsrCod)))
NumPublicFiles = Brw_GetNumPublicFilesUsr (UsrDat->UsrCod);
else
NumPublicFiles = 0;
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s\""
" style=\"text-align:right; vertical-align:top;\">"
"%s"
"</td>"
"<td class=\"DAT\""
" style=\"text-align:left; vertical-align:top;\">"
"%u&nbsp;%s<br />"
"%u&nbsp;%s"
"</a>"
"</td>"
"</tr>",
The_ClassFormul[Gbl.Prefs.Theme],
Txt_Files,
NumFiles,Txt_files,
NumPublicFiles,Txt_public_FILES);
/***** Number of file views *****/ /***** Number of file views *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s\"" "<td class=\"%s\""

View File

@ -327,7 +327,6 @@ void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role);
void Usr_RequestUserProfile (void); void Usr_RequestUserProfile (void);
void Usr_GetUsrCodAndShowUserProfile (void); void Usr_GetUsrCodAndShowUserProfile (void);
void Usr_ChangeProfileVisibility (void); void Usr_ChangeProfileVisibility (void);
void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat);
void Usr_CalculateFirstClickTime (void); void Usr_CalculateFirstClickTime (void);
void Usr_CalculateNumClicks (void); void Usr_CalculateNumClicks (void);
void Usr_CalculateNumFileViews (void); void Usr_CalculateNumFileViews (void);