Version 14.100.2

This commit is contained in:
Antonio Cañas Vargas 2015-03-24 10:11:17 +01:00
parent ddbfedac4a
commit db259af342
3 changed files with 51 additions and 21 deletions

View File

@ -103,11 +103,13 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.100.1 (2015/03/24)"
#define Log_PLATFORM_VERSION "SWAD 14.100.2 (2015/03/24)"
// 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.100.2: Mar 24, 2015 Changes in profile.
Link to institution in record. (183752 lines)
Version 14.100.1: Mar 24, 2015 Only font-awesome icons for notifications. (183724 lines)
Version 14.100: Mar 23, 2015 Notification when a user gets a new follower. (183723 lines)
1 change necessary in database:

View File

@ -427,7 +427,7 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
if (UsrFigures.FirstClickTime.Date.Year)
{
Dat_WriteDate (UsrFigures.FirstClickTime.Date.YYYYMMDD);
if (UsrFigures.NumDays >= 0)
if (UsrFigures.NumDays > 0)
fprintf (Gbl.F.Out," (%d %s)",
UsrFigures.NumDays,
(UsrFigures.NumDays == 1) ? Txt_day :
@ -462,11 +462,11 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
UsrFigures.NumClicks,Txt_clicks);
Prf_ShowRanking (Prf_GetRankingFigure (UsrDat->UsrCod,"NumClicks"),
Prf_GetNumUsrsWithFigure ("NumClicks"));
if (UsrFigures.NumDays >= 0)
if (UsrFigures.NumDays > 0)
{
fprintf (Gbl.F.Out," (");
Str_WriteFloatNum ((float) UsrFigures.NumClicks /
(float) (UsrFigures.NumDays + 1));
(float) UsrFigures.NumDays);
fprintf (Gbl.F.Out," / %s ",Txt_day);
Prf_ShowRanking (Prf_GetRankingNumClicksPerDay (UsrDat->UsrCod),
Prf_GetNumUsrsWithNumClicksPerDay ());
@ -504,11 +504,11 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Txt_downloads);
Prf_ShowRanking (Prf_GetRankingFigure (UsrDat->UsrCod,"NumFileViews"),
Prf_GetNumUsrsWithFigure ("NumFileViews"));
if (UsrFigures.NumDays >= 0)
if (UsrFigures.NumDays > 0)
{
fprintf (Gbl.F.Out," (");
Str_WriteFloatNum ((float) UsrFigures.NumFileViews /
(float) (UsrFigures.NumDays + 1));
(float) UsrFigures.NumDays);
fprintf (Gbl.F.Out," / %s)",Txt_day);
}
}
@ -543,11 +543,11 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Txt_posts);
Prf_ShowRanking (Prf_GetRankingFigure (UsrDat->UsrCod,"NumForPst"),
Prf_GetNumUsrsWithFigure ("NumForPst"));
if (UsrFigures.NumDays >= 0)
if (UsrFigures.NumDays > 0)
{
fprintf (Gbl.F.Out," (");
Str_WriteFloatNum ((float) UsrFigures.NumForPst /
(float) (UsrFigures.NumDays + 1));
(float) UsrFigures.NumDays);
fprintf (Gbl.F.Out," / %s)",Txt_day);
}
}
@ -582,11 +582,11 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
Txt_messages);
Prf_ShowRanking (Prf_GetRankingFigure (UsrDat->UsrCod,"NumMsgSnt"),
Prf_GetNumUsrsWithFigure ("NumMsgSnt"));
if (UsrFigures.NumDays >= 0)
if (UsrFigures.NumDays > 0)
{
fprintf (Gbl.F.Out," (");
Str_WriteFloatNum ((float) UsrFigures.NumMsgSnt /
(float) (UsrFigures.NumDays + 1));
(float) UsrFigures.NumDays);
fprintf (Gbl.F.Out," / %s)",Txt_day);
}
}
@ -621,7 +621,7 @@ static void Prf_GetUsrFigures (long UsrCod,struct UsrFigures *UsrFigures)
/***** Get user's figures from database *****/
sprintf (Query,"SELECT DATE_FORMAT(FirstClickTime,'%%Y%%m%%d%%H%%i%%S'),"
"DATEDIFF(NOW(),FirstClickTime),"
"DATEDIFF(NOW(),FirstClickTime)+1,"
"NumClicks,NumFileViews,NumForPst,NumMsgSnt"
" FROM usr_figures WHERE UsrCod='%ld'",
UsrCod);
@ -1033,7 +1033,8 @@ static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigure
char Query[256];
/***** Create user's figures *****/
sprintf (Query,"INSERT INTO usr_figures (UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
sprintf (Query,"INSERT INTO usr_figures"
"(UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
" VALUES ('%ld','%s','%ld','%ld','%ld','%ld')",
UsrCod,
UsrFigures->FirstClickTime.YYYYMMDDHHMMSS, // 0 ==> unknown first click time or user never logged

View File

@ -51,7 +51,7 @@
/*****************************************************************************/
extern struct Globals Gbl;
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
/*****************************************************************************/
/***************************** Private constants *****************************/
@ -2015,6 +2015,7 @@ void Rec_ShowCommonRecordUnmodifiable (struct UsrData *UsrDat)
void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
struct UsrData *UsrDat)
{
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
extern const char *The_ClassFormul[The_NUM_THEMES];
extern const char *Txt_View_record_card;
extern const char *Txt_Admin_user;
@ -2073,11 +2074,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR ||
(TypeOfView == Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR &&
!(IAmLoggedAsTeacher && HeIsTeacherInAnyCourse))); // A teacher can not modify another teacher's data
bool GoToPublicProfileForm = (TypeOfView == Rec_RECORD_LIST ||
TypeOfView == Rec_RECORD_PUBLIC ||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
TypeOfView == Rec_OTHER_USR_COMMON_RECORD_CHECK);
bool CommandForms = GoToPublicProfileForm && Gbl.Usrs.Me.Logged;
bool PutFormLinks; // Put links (forms) inside record card
bool ShowEmail = (IAmLoggedAsDegAdm || IAmLoggedAsSysAdm || DataForm ||
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
@ -2190,6 +2187,9 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
break;
}
PutFormLinks = !Gbl.InsideForm && // Only if not inside another form
Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW; // Only in main window
/***** Start frame *****/
sprintf (StrRecordWidth,"%upx",RecordWidth);
Lay_StartRoundFrameTable10 (StrRecordWidth,2,NULL);
@ -2203,8 +2203,21 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
{
Ins.InsCod = UsrDat->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
/* Form to go to the institution */
if (PutFormLinks)
{
Act_FormGoToStart (ActSeeInsInf);
Ins_PutParamInsCod (Gbl.CurrentIns.Ins.InsCod);
Act_LinkFormSubmit (Gbl.CurrentIns.Ins.FullName,NULL);
}
Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName,
Rec_INSTITUTION_LOGO_SIZE,NULL,true);
if (PutFormLinks)
{
fprintf (Gbl.F.Out,"</a>");
Act_FormEnd ();
}
}
fprintf (Gbl.F.Out,"</td>"
"<td colspan=\"2\" class=\"%s\""
@ -2212,7 +2225,21 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
" text-align:left; vertical-align:middle;\">",
ClassHead,C2Width + C3Width,C1Width);
if (UsrDat->InsCod > 0)
{
/* Form to go to the institution */
if (PutFormLinks)
{
Act_FormGoToStart (ActSeeInsInf);
Ins_PutParamInsCod (Gbl.CurrentIns.Ins.InsCod);
Act_LinkFormSubmit (Gbl.CurrentIns.Ins.FullName,ClassHead);
}
fprintf (Gbl.F.Out,"%s",Ins.FullName);
if (PutFormLinks)
{
fprintf (Gbl.F.Out,"</a>");
Act_FormEnd ();
}
}
fprintf (Gbl.F.Out,"</td>");
/***** Photo *****/
@ -2239,7 +2266,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
"<td rowspan=\"%u\" style=\"width:%upx; vertical-align:top;\">",
CommandsRowspan,C1Width);
if (CommandForms)
if (PutFormLinks && Gbl.Usrs.Me.Logged)
{
fprintf (Gbl.F.Out,"<div style=\"width:20px; margin:6px auto;\">");
@ -2424,7 +2451,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
C2Width + C3Width);
if (UsrDat->Nickname[0])
{
if (GoToPublicProfileForm)
if (PutFormLinks)
{
/* Put form to go to public profile */
Act_FormStart (ActSeePubPrf);
@ -2432,7 +2459,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
Act_LinkFormSubmit (Txt_View_public_profile,"REC_NICK");
}
fprintf (Gbl.F.Out,"@%s",UsrDat->Nickname);
if (GoToPublicProfileForm)
if (PutFormLinks)
{
fprintf (Gbl.F.Out,"</a>");
Act_FormEnd ();