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 = -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

View File

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

View File

@ -106,7 +106,7 @@ void Ann_ShowAllAnnouncements (void)
" FROM announcements"
" WHERE (Roles&%u)<>0 "
" 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
/* Select only active announcements for unknown users */
@ -223,7 +223,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
" (SELECT AnnCod FROM ann_seen WHERE UsrCod='%ld')"
" ORDER BY AnnCod DESC", // Newest first
(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);
NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements");

View File

@ -187,13 +187,17 @@
/****************************** 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 JS_FILE "swad16.101.js"
// 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 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.
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)

View File

@ -4822,7 +4822,7 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
row = mysql_fetch_row (mysql_res);
if (row[0] == NULL)
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.");
}
else

View File

@ -1371,15 +1371,16 @@ static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod)
/*****************************************************************************/
/************ 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)
{
char Query[128];
MYSQL_RES *mysql_res;
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'",
CrsCod);
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_Create_email_message;
unsigned NumUsr;
unsigned NumStdsWithEmail = 0;
unsigned NumAcceptedStdsWithEmail = 0;
unsigned NumStdsWithEmail;
unsigned NumAcceptedStdsWithEmail;
char StrAddresses[Mai_MAX_LENGTH_STR_ADDR+1];
unsigned int LengthStrAddr = 0;
struct UsrData UsrDat;
@ -865,7 +865,8 @@ void Mai_ListEmails (void)
/***** List the students' email addresses *****/
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++)
{

View File

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

View File

@ -68,129 +68,187 @@ const char *Mnu_MenuIcons[Mnu_NUM_MENUS] =
// Actions not initialized are 0 by default
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,
ActSeeCty,
ActSeePen,
ActReqRemOldCrs,
ActSeeDegTyp,
ActSeeMai,
ActSeeBan,
ActSeeLnk,
ActLstPlg,
ActSetUp,
ActSysReqSch, // 0
ActSeeCty, // 1
ActSeePen, // 2
ActReqRemOldCrs, // 3
ActSeeDegTyp, // 4
ActSeeMai, // 5
ActSeeBan, // 6
ActSeeLnk, // 7
ActLstPlg, // 8
ActSetUp, // 9
0, // 10
},
// TabCty **********
// TabCty *******************
{
ActCtyReqSch,
ActSeeCtyInf,
ActSeeIns,
ActCtyReqSch, // 0
ActSeeCtyInf, // 1
ActSeeIns, // 2
0, // 3
0, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
},
// TabIns **********
// TabIns *******************
{
ActInsReqSch,
ActSeeInsInf,
ActSeeCtr,
ActSeeDpt,
ActSeePlc,
ActSeeHld,
ActSeeAdmDocIns,
ActAdmShaIns,
ActInsReqSch, // 0
ActSeeInsInf, // 1
ActSeeCtr, // 2
ActSeeDpt, // 3
ActSeePlc, // 4
ActSeeHld, // 5
ActSeeAdmDocIns, // 6
ActAdmShaIns, // 7
0, // 8
0, // 9
0, // 10
},
// TabCtr **********
// TabCtr *******************
{
ActCtrReqSch,
ActSeeCtrInf,
ActSeeDeg,
ActSeeAdmDocCtr,
ActAdmShaCtr,
ActCtrReqSch, // 0
ActSeeCtrInf, // 1
ActSeeDeg, // 2
ActSeeAdmDocCtr, // 3
ActAdmShaCtr, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
},
// TabDeg **********
// TabDeg *******************
{
ActDegReqSch,
ActSeeDegInf,
ActSeeCrs,
ActSeeAdmDocDeg,
ActAdmShaDeg,
ActDegReqSch, // 0
ActSeeDegInf, // 1
ActSeeCrs, // 2
ActSeeAdmDocDeg, // 3
ActAdmShaDeg, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
},
// TabCrs **********
// TabCrs *******************
{
ActCrsReqSch,
ActSeeCrsInf,
ActSeeTchGui,
ActSeeSyl,
ActSeeAdmDocCrsGrp,
ActAdmTchCrsGrp,
ActAdmShaCrsGrp,
ActSeeCrsTT,
ActSeeBib,
ActSeeFAQ,
ActSeeCrsLnk,
ActCrsReqSch, // 0
ActSeeCrsInf, // 1
ActSeeTchGui, // 2
ActSeeSyl, // 3
ActSeeAdmDocCrsGrp, // 4
ActAdmTchCrsGrp, // 5
ActAdmShaCrsGrp, // 6
ActSeeCrsTT, // 7
ActSeeBib, // 8
ActSeeFAQ, // 9
ActSeeCrsLnk, // 10
},
// TabAss **********
// TabAss *******************
{
ActSeeAss,
ActSeeAsg,
ActAdmAsgWrkUsr,
ActReqAsgWrkCrs,
ActReqTst,
ActSeeCal,
ActSeeAllExaAnn,
ActSeeAdmMrk,
ActSeeAss, // 0
ActSeeAsg, // 1
ActAdmAsgWrkUsr, // 2
ActReqAsgWrkCrs, // 3
ActReqTst, // 4
ActSeeCal, // 5
ActSeeAllExaAnn, // 6
ActSeeAdmMrk, // 7
0, // 8
0, // 9
0, // 10
},
// TabUsr **********
// TabUsr *******************
{
ActReqSelGrp,
ActLstStd,
ActLstTch,
ActLstOth,
ActSeeAtt,
ActReqSignUp,
ActSeeSignUpReq,
ActLstCon,
ActReqSelGrp, // 0
ActLstStd, // 1
ActLstTch, // 2
ActLstOth, // 3
ActSeeAtt, // 4
ActReqSignUp, // 5
ActSeeSignUpReq, // 6
ActLstCon, // 7
0, // 8
0, // 9
0, // 10
},
// TabSoc **********
// TabSoc *******************
{
ActSeeSocTmlGbl,
ActSeeSocPrf,
ActSeeFor,
ActSeeChtRms,
ActSeeSocTmlGbl, // 0
ActSeeSocPrf, // 1
ActSeeFor, // 2
ActSeeChtRms, // 3
0, // 4
0, // 5
0, // 6
0, // 7
0, // 8
0, // 9
0, // 10
},
// TabMsg **********
// TabMsg *******************
{
ActSeeNtf,
ActSeeAnn,
ActSeeAllNot,
ActReqMsgUsr,
ActSeeRcvMsg,
ActSeeSntMsg,
ActMaiStd,
ActSeeNtf, // 0
ActSeeAnn, // 1
ActSeeAllNot, // 2
ActReqMsgUsr, // 3
ActSeeRcvMsg, // 4
ActSeeSntMsg, // 5
ActMaiStd, // 6
0, // 7
0, // 8
0, // 9
0, // 10
},
// TabSta **********
// TabSta *******************
{
ActSeeAllSvy,
ActReqUseGbl,
ActSeePhoDeg,
ActReqStaCrs,
ActReqAccGbl,
ActReqMyUsgRep,
ActMFUAct,
ActSeeAllSvy, // 0
ActReqUseGbl, // 1
ActSeePhoDeg, // 2
ActReqStaCrs, // 3
ActReqAccGbl, // 4
ActReqMyUsgRep, // 5
ActMFUAct, // 6
0, // 7
0, // 8
0, // 9
0, // 10
},
// TabPrf **********
// TabPrf *******************
{
ActFrmLogIn,
ActFrmRolSes,
ActMyCrs,
ActSeeMyTT,
ActSeeMyAgd,
ActFrmMyAcc,
ActReqEdiRecCom,
ActEdiPrf,
ActAdmBrf,
ActFrmLogIn, // 0
ActFrmRolSes, // 1
ActMyCrs, // 2
ActSeeMyTT, // 3
ActSeeMyAgd, // 4
ActFrmMyAcc, // 5
ActReqEdiRecCom, // 6
ActEdiPrf, // 7
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]) */
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.");
/* Get number of groups (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.");
/* Get number of users (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.");
/* 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 *****/
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.MaxRole : // ...set current logged role to maximum role in database
Gbl.Usrs.Me.RoleFromSession; // Get logged role from session