Version 16.102

This commit is contained in:
Antonio Cañas Vargas 2016-12-15 02:22:47 +01:00
parent d42ab47768
commit bb19d4d89f
12 changed files with 491 additions and 286 deletions

View File

@ -65,7 +65,7 @@ CC = gcc
# LIBS when using MariaDB (also valid with MySQL): # LIBS when using MariaDB (also valid with MySQL):
LIBS = -lssl -lcrypto -lpthread -lrt -lmysqlclient -lz -L/usr/lib64/mysql -lm -lgsoap LIBS = -lssl -lcrypto -lpthread -lrt -lmysqlclient -lz -L/usr/lib64/mysql -lm -lgsoap
CFLAGS = -Wall -Wextra -mtune=native -O2 -s CFLAGS = -Wall -Wextra -pedantic -mtune=native -O2 -s
all: swad_ca swad_de swad_en swad_es swad_fr swad_gn swad_it swad_pl swad_pt all: swad_ca swad_de swad_en swad_es swad_fr swad_gn swad_it swad_pl swad_pt

View File

@ -82,7 +82,7 @@ extern struct Globals Gbl;
/************************ Internal global variables **************************/ /************************ Internal global variables **************************/
/*****************************************************************************/ /*****************************************************************************/
/* /*
1239 actions in one CGI: 1242 actions in one CGI:
0. ActAll Any action (used for statistics) 0. ActAll Any action (used for statistics)
1. ActUnk Unknown action 1. ActUnk Unknown action
2. ActHom Show home menu 2. ActHom Show home menu

View File

@ -106,7 +106,7 @@ void Ann_ShowAllAnnouncements (void)
" FROM announcements" " FROM announcements"
" WHERE (Roles&%u)<>0 " " WHERE (Roles&%u)<>0 "
" ORDER BY AnnCod DESC", " ORDER BY AnnCod DESC",
Gbl.Usrs.Me.UsrDat.Roles); // All my roles in different courses (unsigned) Gbl.Usrs.Me.UsrDat.Roles); // All my roles in different courses
} }
else // No user logged else // No user logged
/* Select only active announcements for unknown users */ /* Select only active announcements for unknown users */
@ -223,7 +223,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
" (SELECT AnnCod FROM ann_seen WHERE UsrCod='%ld')" " (SELECT AnnCod FROM ann_seen WHERE UsrCod='%ld')"
" ORDER BY AnnCod DESC", // Newest first " ORDER BY AnnCod DESC", // Newest first
(unsigned) Ann_ACTIVE_ANNOUNCEMENT, (unsigned) Ann_ACTIVE_ANNOUNCEMENT,
Gbl.Usrs.Me.UsrDat.Roles, // All my roles in different courses (unsigned) Gbl.Usrs.Me.UsrDat.Roles, // All my roles in different courses
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements"); NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements");

View File

@ -187,13 +187,17 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.101 (2016-12-14)" #define Log_PLATFORM_VERSION "SWAD 16.102 (2016-12-15)"
#define CSS_FILE "swad16.97.css" #define CSS_FILE "swad16.97.css"
#define JS_FILE "swad16.101.js" #define JS_FILE "swad16.101.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.102: Dec 15, 2016 Fixed bug in mail to students, reported by GitHub user raistmaj.
Fixed bug in file of marks, reported by GitHub user raistmaj.
Fixed bug in course indicators, reported by GitHub user raistmaj.
Fixed bug related with user roles, reported by GitHub user raistmaj. (211011 lines)
Version 16.101: Dec 14, 2016 Interval in range of times is 5 minutes when no seconds needed. Version 16.101: Dec 14, 2016 Interval in range of times is 5 minutes when no seconds needed.
Code refactoring related to start and end date-time. (210806 lines) Code refactoring related to start and end date-time. (210806 lines)
Version 16.100.1: Dec 13, 2016 Fixed bugs checking if users share courses. (210828 lines) Version 16.100.1: Dec 13, 2016 Fixed bugs checking if users share courses. (210828 lines)

View File

@ -4822,7 +4822,7 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
if (row[0] == NULL) if (row[0] == NULL)
Gbl.Usrs.Me.TimeLastAccToThisFileBrowser = 0; Gbl.Usrs.Me.TimeLastAccToThisFileBrowser = 0;
else if (sscanf (row[0],"%lu",&Gbl.Usrs.Me.TimeLastAccToThisFileBrowser) != 1) else if (sscanf (row[0],"%ld",&Gbl.Usrs.Me.TimeLastAccToThisFileBrowser) != 1)
Lay_ShowErrorAndExit ("Error when reading date-time of last access to a file browser."); Lay_ShowErrorAndExit ("Error when reading date-time of last access to a file browser.");
} }
else else

View File

@ -1371,15 +1371,16 @@ static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod)
/*****************************************************************************/ /*****************************************************************************/
/************ Get number of indicators of a course from database *************/ /************ Get number of indicators of a course from database *************/
/*****************************************************************************/ /*****************************************************************************/
// This function returns -1 if number of indicators is not yet calculated
int Ind_GetNumIndicatorsCrsFromDB (long CrsCod) int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
{ {
char Query[128]; char Query[128];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
int NumIndicatorsFromDB; int NumIndicatorsFromDB = -1; // -1 means not yet calculated
/***** Get number of files in document zones of a course from database *****/ /***** Get number of indicators of a course from database *****/
sprintf (Query,"SELECT NumIndicators FROM courses WHERE CrsCod='%ld'", sprintf (Query,"SELECT NumIndicators FROM courses WHERE CrsCod='%ld'",
CrsCod); CrsCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get number of indicators")) if (DB_QuerySELECT (Query,&mysql_res,"can not get number of indicators"))

View File

@ -836,8 +836,8 @@ void Mai_ListEmails (void)
extern const char *Txt_X_students_who_have_accepted_and_who_have_email; extern const char *Txt_X_students_who_have_accepted_and_who_have_email;
extern const char *Txt_Create_email_message; extern const char *Txt_Create_email_message;
unsigned NumUsr; unsigned NumUsr;
unsigned NumStdsWithEmail = 0; unsigned NumStdsWithEmail;
unsigned NumAcceptedStdsWithEmail = 0; unsigned NumAcceptedStdsWithEmail;
char StrAddresses[Mai_MAX_LENGTH_STR_ADDR+1]; char StrAddresses[Mai_MAX_LENGTH_STR_ADDR+1];
unsigned int LengthStrAddr = 0; unsigned int LengthStrAddr = 0;
struct UsrData UsrDat; struct UsrData UsrDat;
@ -865,7 +865,8 @@ void Mai_ListEmails (void)
/***** List the students' email addresses *****/ /***** List the students' email addresses *****/
fprintf (Gbl.F.Out,"<div class=\"DAT_SMALL LEFT_MIDDLE\">"); fprintf (Gbl.F.Out,"<div class=\"DAT_SMALL LEFT_MIDDLE\">");
for (NumUsr = 0; for (NumUsr = 0, NumStdsWithEmail = 0, NumAcceptedStdsWithEmail = 0,
StrAddresses[0] = '\0';
NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumUsr++) NumUsr++)
{ {

View File

@ -829,19 +829,22 @@ void Mrk_GetNotifMyMarks (char *SummaryStr,char **ContentStr,
{ {
strcpy (*ContentStr,"<![CDATA["); strcpy (*ContentStr,"<![CDATA[");
if ((FileUsrMarks = fopen (FileNameUsrMarks,"rb"))) if ((FileUsrMarks = fopen (FileNameUsrMarks,"rb")))
{
for (Ptr = (*ContentStr) + 9, i = 0; for (Ptr = (*ContentStr) + 9, i = 0;
i < SizeOfMyMarks; i < SizeOfMyMarks;
i++) i++)
Ptr[i] = (char) fgetc (FileUsrMarks); Ptr[i] = (char) fgetc (FileUsrMarks);
fclose (FileUsrMarks);
}
strcpy ((*ContentStr)+9+SizeOfMyMarks,"]]>"); strcpy ((*ContentStr)+9+SizeOfMyMarks,"]]>");
} }
} }
else else
{ {
fclose (FileUsrMarks);
if ((*ContentStr = (char *) malloc (9+strlen (Gbl.Message)+3+1))) if ((*ContentStr = (char *) malloc (9+strlen (Gbl.Message)+3+1)))
sprintf (*ContentStr,"<![CDATA[%s]]>",Gbl.Message); sprintf (*ContentStr,"<![CDATA[%s]]>",Gbl.Message);
} }
fclose (FileUsrMarks);
} }
else else
{ {

View File

@ -68,129 +68,187 @@ const char *Mnu_MenuIcons[Mnu_NUM_MENUS] =
// Actions not initialized are 0 by default // Actions not initialized are 0 by default
const Act_Action_t Mnu_MenuActions[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = const Act_Action_t Mnu_MenuActions[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
{ {
// TabUnk ********** // TabUnk *******************
{ {
0, // 0
0, // 1
0, // 2
0, // 3
0, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabSys ********** // TabSys *******************
{ {
ActSysReqSch, ActSysReqSch, // 0
ActSeeCty, ActSeeCty, // 1
ActSeePen, ActSeePen, // 2
ActReqRemOldCrs, ActReqRemOldCrs, // 3
ActSeeDegTyp, ActSeeDegTyp, // 4
ActSeeMai, ActSeeMai, // 5
ActSeeBan, ActSeeBan, // 6
ActSeeLnk, ActSeeLnk, // 7
ActLstPlg, ActLstPlg, // 8
ActSetUp, ActSetUp, // 9
0, // 10
}, },
// TabCty ********** // TabCty *******************
{ {
ActCtyReqSch, ActCtyReqSch, // 0
ActSeeCtyInf, ActSeeCtyInf, // 1
ActSeeIns, ActSeeIns, // 2
0, // 3
0, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabIns ********** // TabIns *******************
{ {
ActInsReqSch, ActInsReqSch, // 0
ActSeeInsInf, ActSeeInsInf, // 1
ActSeeCtr, ActSeeCtr, // 2
ActSeeDpt, ActSeeDpt, // 3
ActSeePlc, ActSeePlc, // 4
ActSeeHld, ActSeeHld, // 5
ActSeeAdmDocIns, ActSeeAdmDocIns, // 6
ActAdmShaIns, ActAdmShaIns, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabCtr ********** // TabCtr *******************
{ {
ActCtrReqSch, ActCtrReqSch, // 0
ActSeeCtrInf, ActSeeCtrInf, // 1
ActSeeDeg, ActSeeDeg, // 2
ActSeeAdmDocCtr, ActSeeAdmDocCtr, // 3
ActAdmShaCtr, ActAdmShaCtr, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabDeg ********** // TabDeg *******************
{ {
ActDegReqSch, ActDegReqSch, // 0
ActSeeDegInf, ActSeeDegInf, // 1
ActSeeCrs, ActSeeCrs, // 2
ActSeeAdmDocDeg, ActSeeAdmDocDeg, // 3
ActAdmShaDeg, ActAdmShaDeg, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabCrs ********** // TabCrs *******************
{ {
ActCrsReqSch, ActCrsReqSch, // 0
ActSeeCrsInf, ActSeeCrsInf, // 1
ActSeeTchGui, ActSeeTchGui, // 2
ActSeeSyl, ActSeeSyl, // 3
ActSeeAdmDocCrsGrp, ActSeeAdmDocCrsGrp, // 4
ActAdmTchCrsGrp, ActAdmTchCrsGrp, // 5
ActAdmShaCrsGrp, ActAdmShaCrsGrp, // 6
ActSeeCrsTT, ActSeeCrsTT, // 7
ActSeeBib, ActSeeBib, // 8
ActSeeFAQ, ActSeeFAQ, // 9
ActSeeCrsLnk, ActSeeCrsLnk, // 10
}, },
// TabAss ********** // TabAss *******************
{ {
ActSeeAss, ActSeeAss, // 0
ActSeeAsg, ActSeeAsg, // 1
ActAdmAsgWrkUsr, ActAdmAsgWrkUsr, // 2
ActReqAsgWrkCrs, ActReqAsgWrkCrs, // 3
ActReqTst, ActReqTst, // 4
ActSeeCal, ActSeeCal, // 5
ActSeeAllExaAnn, ActSeeAllExaAnn, // 6
ActSeeAdmMrk, ActSeeAdmMrk, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabUsr ********** // TabUsr *******************
{ {
ActReqSelGrp, ActReqSelGrp, // 0
ActLstStd, ActLstStd, // 1
ActLstTch, ActLstTch, // 2
ActLstOth, ActLstOth, // 3
ActSeeAtt, ActSeeAtt, // 4
ActReqSignUp, ActReqSignUp, // 5
ActSeeSignUpReq, ActSeeSignUpReq, // 6
ActLstCon, ActLstCon, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabSoc ********** // TabSoc *******************
{ {
ActSeeSocTmlGbl, ActSeeSocTmlGbl, // 0
ActSeeSocPrf, ActSeeSocPrf, // 1
ActSeeFor, ActSeeFor, // 2
ActSeeChtRms, ActSeeChtRms, // 3
0, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabMsg ********** // TabMsg *******************
{ {
ActSeeNtf, ActSeeNtf, // 0
ActSeeAnn, ActSeeAnn, // 1
ActSeeAllNot, ActSeeAllNot, // 2
ActReqMsgUsr, ActReqMsgUsr, // 3
ActSeeRcvMsg, ActSeeRcvMsg, // 4
ActSeeSntMsg, ActSeeSntMsg, // 5
ActMaiStd, ActMaiStd, // 6
0, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabSta ********** // TabSta *******************
{ {
ActSeeAllSvy, ActSeeAllSvy, // 0
ActReqUseGbl, ActReqUseGbl, // 1
ActSeePhoDeg, ActSeePhoDeg, // 2
ActReqStaCrs, ActReqStaCrs, // 3
ActReqAccGbl, ActReqAccGbl, // 4
ActReqMyUsgRep, ActReqMyUsgRep, // 5
ActMFUAct, ActMFUAct, // 6
0, // 7
0, // 8
0, // 9
0, // 10
}, },
// TabPrf ********** // TabPrf *******************
{ {
ActFrmLogIn, ActFrmLogIn, // 0
ActFrmRolSes, ActFrmRolSes, // 1
ActMyCrs, ActMyCrs, // 2
ActSeeMyTT, ActSeeMyTT, // 3
ActSeeMyAgd, ActSeeMyAgd, // 4
ActFrmMyAcc, ActFrmMyAcc, // 5
ActReqEdiRecCom, ActReqEdiRecCom, // 6
ActEdiPrf, ActEdiPrf, // 7
ActAdmBrf, ActAdmBrf, // 8
0, // 9
0, // 10
}, },
}; };

View File

@ -6328,17 +6328,17 @@ static void Sta_GetSizeOfFileZoneFromDB (Sco_Scope_t Scope,
/* Get number of courses (row[0]) */ /* Get number of courses (row[0]) */
if (row[0]) if (row[0])
if (sscanf (row[0],"%u",&(SizeOfFileZones->NumCrss)) != 1) if (sscanf (row[0],"%d",&(SizeOfFileZones->NumCrss)) != 1)
Lay_ShowErrorAndExit ("Error when getting number of courses."); Lay_ShowErrorAndExit ("Error when getting number of courses.");
/* Get number of groups (row[1]) */ /* Get number of groups (row[1]) */
if (row[1]) if (row[1])
if (sscanf (row[1],"%u",&(SizeOfFileZones->NumGrps)) != 1) if (sscanf (row[1],"%d",&(SizeOfFileZones->NumGrps)) != 1)
Lay_ShowErrorAndExit ("Error when getting number of groups."); Lay_ShowErrorAndExit ("Error when getting number of groups.");
/* Get number of users (row[2]) */ /* Get number of users (row[2]) */
if (row[2]) if (row[2])
if (sscanf (row[2],"%u",&(SizeOfFileZones->NumUsrs)) != 1) if (sscanf (row[2],"%d",&(SizeOfFileZones->NumUsrs)) != 1)
Lay_ShowErrorAndExit ("Error when getting number of users."); Lay_ShowErrorAndExit ("Error when getting number of users.");
/* Get maximum number of levels (row[3]) */ /* Get maximum number of levels (row[3]) */

File diff suppressed because it is too large Load Diff

View File

@ -2741,7 +2741,7 @@ static void Usr_SetUsrRoleAndPrefs (void)
/***** Set the user's role I am logged *****/ /***** Set the user's role I am logged *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got
Gbl.Usrs.Me.MaxRole = Rol_GetMaxRole (Gbl.Usrs.Me.UsrDat.Roles); Gbl.Usrs.Me.MaxRole = Rol_GetMaxRole ((unsigned) Gbl.Usrs.Me.UsrDat.Roles);
Gbl.Usrs.Me.LoggedRole = (Gbl.Usrs.Me.RoleFromSession == Rol_UNKNOWN) ? // If no logged role retrieved from session... Gbl.Usrs.Me.LoggedRole = (Gbl.Usrs.Me.RoleFromSession == Rol_UNKNOWN) ? // If no logged role retrieved from session...
Gbl.Usrs.Me.MaxRole : // ...set current logged role to maximum role in database Gbl.Usrs.Me.MaxRole : // ...set current logged role to maximum role in database
Gbl.Usrs.Me.RoleFromSession; // Get logged role from session Gbl.Usrs.Me.RoleFromSession; // Get logged role from session