Version 16.220.3

This commit is contained in:
Antonio Cañas Vargas 2017-05-21 16:48:30 +02:00
parent f5b33ab1c1
commit 5cc60b192c
3 changed files with 57 additions and 49 deletions

View File

@ -233,13 +233,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.220.2 (2017-05-21)" #define Log_PLATFORM_VERSION "SWAD 16.220.3 (2017-05-21)"
#define CSS_FILE "swad16.209.3.css" #define CSS_FILE "swad16.209.3.css"
#define JS_FILE "swad16.206.3.js" #define JS_FILE "swad16.206.3.js"
// 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 16.220.3: May 21, 2017 Changes related with new role. Not finished. (219327 lines)
Version 16.220.2: May 21, 2017 Changes related with new role. Not finished. (219319 lines) Version 16.220.2: May 21, 2017 Changes related with new role. Not finished. (219319 lines)
Version 16.220.1: May 20, 2017 Changes related with new role. Not finished. (219332 lines) Version 16.220.1: May 20, 2017 Changes related with new role. Not finished. (219332 lines)
Version 16.220: May 19, 2017 Changes permission of actions after creating new role. Not finished. (219227 lines) Version 16.220: May 19, 2017 Changes permission of actions after creating new role. Not finished. (219227 lines)

View File

@ -1285,13 +1285,16 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year)
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Crs->NumUsrs[Rol_TCH]); TxtClassNormal,BgColor,
Crs->NumUsrs[Rol_TCH] +
Crs->NumUsrs[Rol_NED_TCH]);
/* Current number of students in this course */ /* Current number of students in this course */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Crs->NumUsrs[Rol_STD]); TxtClassNormal,BgColor,
Crs->NumUsrs[Rol_STD]);
/* Course status */ /* Course status */
StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status); StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status);
@ -1509,7 +1512,8 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
"%u" "%u"
"</td>", "</td>",
Crs->NumUsrs[Rol_TCH]); Crs->NumUsrs[Rol_TCH] +
Crs->NumUsrs[Rol_NED_TCH]);
/* Current number of students in this course */ /* Current number of students in this course */
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
@ -1987,9 +1991,10 @@ bool Crs_GetDataOfCourseByCod (struct Course *Crs)
Crs->RequesterUsrCod = -1L; Crs->RequesterUsrCod = -1L;
Crs->ShrtName[0] = '\0'; Crs->ShrtName[0] = '\0';
Crs->FullName[0] = '\0'; Crs->FullName[0] = '\0';
Crs->NumUsrs[Rol_UNK] = 0; Crs->NumUsrs[Rol_UNK ] =
Crs->NumUsrs[Rol_STD] = 0; Crs->NumUsrs[Rol_STD ] =
Crs->NumUsrs[Rol_TCH] = 0; Crs->NumUsrs[Rol_NED_TCH] =
Crs->NumUsrs[Rol_TCH ] = 0;
/***** Check if course code is correct *****/ /***** Check if course code is correct *****/
if (Crs->CrsCod > 0) if (Crs->CrsCod > 0)
@ -2050,15 +2055,13 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
Str_Copy (Crs->FullName,row[7], Str_Copy (Crs->FullName,row[7],
Hie_MAX_BYTES_FULL_NAME); Hie_MAX_BYTES_FULL_NAME);
/***** Get number of students *****/ /***** Get number of users *****/
Crs->NumUsrs[Rol_STD] = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod); Crs->NumUsrs[Rol_STD ] = Usr_GetNumUsrsInCrs (Rol_STD ,Crs->CrsCod);
Crs->NumUsrs[Rol_NED_TCH] = Usr_GetNumUsrsInCrs (Rol_NED_TCH,Crs->CrsCod);
/***** Get number of teachers *****/ Crs->NumUsrs[Rol_TCH ] = Usr_GetNumUsrsInCrs (Rol_TCH ,Crs->CrsCod);
Crs->NumUsrs[Rol_TCH] = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod); Crs->NumUsrs[Rol_UNK ] = Crs->NumUsrs[Rol_STD ] +
Crs->NumUsrs[Rol_NED_TCH] +
/***** Compute total of users in course *****/ Crs->NumUsrs[Rol_TCH ];
Crs->NumUsrs[Rol_UNK] = Crs->NumUsrs[Rol_STD] +
Crs->NumUsrs[Rol_TCH];
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2783,6 +2786,7 @@ void Crs_ContEditAfterChgCrs (void)
false); false);
break; break;
case Rol_STD: case Rol_STD:
case Rol_NED_TCH:
case Rol_TCH: case Rol_TCH:
if (Gbl.Degs.EditingCrs.CrsCod != Gbl.CurrentCrs.Crs.CrsCod) if (Gbl.Degs.EditingCrs.CrsCod != Gbl.CurrentCrs.Crs.CrsCod)
PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod, PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
@ -3158,8 +3162,9 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
Lay_ShowErrorAndExit ("Wrong code of course."); Lay_ShowErrorAndExit ("Wrong code of course.");
/***** Get number of teachers and students in this course *****/ /***** Get number of teachers and students in this course *****/
NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod); NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH ,CrsCod) +
NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod); Usr_GetNumUsrsInCrs (Rol_NED_TCH,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STD ,CrsCod);
if (NumTchs + NumStds) if (NumTchs + NumStds)
{ {
Style = "DAT_N"; Style = "DAT_N";
@ -3255,16 +3260,14 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
void Crs_UpdateCrsLast (void) void Crs_UpdateCrsLast (void)
{ {
char Query[256]; char Query[128];
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.LoggedRole >= Rol_STD) Gbl.Usrs.Me.LoggedRole >= Rol_STD)
{ {
/***** Update my last access to current course *****/ /***** Update my last access to current course *****/
sprintf (Query,"REPLACE INTO crs_last" sprintf (Query,"REPLACE INTO crs_last (CrsCod,LastTime)"
" (CrsCod,LastTime)" " VALUES (%ld,NOW())",
" VALUES"
" (%ld,NOW())",
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
DB_QueryUPDATE (Query,"can not update last access to current course"); DB_QueryUPDATE (Query,"can not update last access to current course");
} }

View File

@ -84,6 +84,7 @@ typedef enum
static void Deg_Configuration (bool PrintView); static void Deg_Configuration (bool PrintView);
static void Deg_PutIconsToPrintAndUpload (void); static void Deg_PutIconsToPrintAndUpload (void);
static void Deg_ShowNumUsrsInCrssOfDeg (Rol_Role_t Role);
static void Deg_ListDegreesForEdition (void); static void Deg_ListDegreesForEdition (void);
static bool Deg_CheckIfICanEditADegree (struct Degree *Deg); static bool Deg_CheckIfICanEditADegree (struct Degree *Deg);
@ -288,7 +289,6 @@ static void Deg_Configuration (bool PrintView)
extern const char *Txt_Courses; extern const char *Txt_Courses;
extern const char *Txt_Courses_of_DEGREE_X; extern const char *Txt_Courses_of_DEGREE_X;
extern const char *Txt_QR_code; extern const char *Txt_QR_code;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
unsigned NumCtr; unsigned NumCtr;
bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0]; bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0];
@ -514,31 +514,11 @@ static void Deg_Configuration (bool PrintView)
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
/***** Number of teachers *****/ /***** Number of users *****/
fprintf (Gbl.F.Out,"<tr>" Deg_ShowNumUsrsInCrssOfDeg (Rol_TCH);
"<td class=\"%s RIGHT_MIDDLE\">" Deg_ShowNumUsrsInCrssOfDeg (Rol_NED_TCH);
"%s:" Deg_ShowNumUsrsInCrssOfDeg (Rol_STD);
"</td>" Deg_ShowNumUsrsInCrssOfDeg (Rol_UNK);
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_TCH,Gbl.CurrentDeg.Deg.DegCod));
/***** Number of students *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Rol_STD,Gbl.CurrentDeg.Deg.DegCod));
} }
/***** End table *****/ /***** End table *****/
@ -565,6 +545,30 @@ static void Deg_PutIconsToPrintAndUpload (void)
Log_PutIconToChangeLogo (Sco_SCOPE_DEG); Log_PutIconToChangeLogo (Sco_SCOPE_DEG);
} }
/*****************************************************************************/
/***************** Number of users in courses of this degree *****************/
/*****************************************************************************/
static void Deg_ShowNumUsrsInCrssOfDeg (Rol_Role_t Role)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Users_in_courses;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
(Role == Rol_UNK) ? Txt_Users_in_courses :
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfDeg (Role,Gbl.CurrentDeg.Deg.DegCod));
}
/*****************************************************************************/ /*****************************************************************************/
/*************************** Write selector of degree ************************/ /*************************** Write selector of degree ************************/
/*****************************************************************************/ /*****************************************************************************/