Version 16.18

This commit is contained in:
Antonio Cañas Vargas 2016-10-09 22:22:47 +02:00
parent e0b2173811
commit 179107db58
19 changed files with 224 additions and 1544 deletions

View File

@ -37,7 +37,7 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_announcement.o \
swad_file.o swad_file_browser.o swad_follow.o swad_forum.o \
swad_global.o swad_group.o \
swad_help.o swad_holiday.o \
swad_icon.o swad_ID.o swad_image.o swad_import.o swad_indicator.o \
swad_icon.o swad_ID.o swad_image.o swad_indicator.o \
swad_info.o swad_institution.o \
swad_layout.o swad_link.o swad_logo.o \
swad_mail.o swad_main.o swad_mark.o swad_menu.o swad_message.o \

View File

@ -575,41 +575,6 @@ CREATE TABLE IF NOT EXISTS holidays (
INDEX(InsCod),
INDEX(PlcCod));
--
-- Table imported_groups: stores the external groups in a course imported from an external service
--
CREATE TABLE IF NOT EXISTS imported_groups (
GrpCod INT NOT NULL AUTO_INCREMENT,
SessionId CHAR(43) NOT NULL,
ExternalCrsCod CHAR(7) NOT NULL,
DegName VARCHAR(127) NOT NULL,
CrsName VARCHAR(127) NOT NULL,
GrpName VARCHAR(255) NOT NULL,
GrpType VARCHAR(255) NOT NULL,
UNIQUE INDEX(GrpCod),
INDEX(SessionId));
--
-- Table imported_sessions: stores the session data from external service
--
CREATE TABLE IF NOT EXISTS imported_sessions (
SessionId CHAR(43) NOT NULL,
UsrCod INT NOT NULL,
ImportedUsrId CHAR(255) NOT NULL,
ImportedSessionId CHAR(255) NOT NULL,
ImportedRole TINYINT NOT NULL DEFAULT 0,
UNIQUE INDEX(SessionId));
--
-- Table imported_students: stores the data of students imported from external service
--
CREATE TABLE IF NOT EXISTS imported_students (
GrpCod INT NOT NULL AUTO_INCREMENT,
UsrID CHAR(16) NOT NULL,
Surname1 VARCHAR(32) NOT NULL,
Surname2 VARCHAR(32) NOT NULL,
FirstName VARCHAR(32) NOT NULL,
Sex ENUM('unknown','female','male') NOT NULL DEFAULT 'unknown',
E_mail VARCHAR(127) NOT NULL,
INDEX(GrpCod));
--
-- Table institutions: stores the institutions (for example, universities)
--
CREATE TABLE IF NOT EXISTS institutions (

View File

@ -918,8 +918,6 @@ Users:
760. ActRenGrp Request renaming of a group of students
761. ActChgMaxStdGrp Request change in the number máximo of students of a group
762. ActGetExtLstStd Get external lists of students
763. ActLstGst List main data of administrators
764. ActPrnGstPho Show the class photo of guests ready to be printed
@ -1329,7 +1327,6 @@ Profile:
1138. ActAutUsrInt Authentify user internally (directly from the platform)
NEW. ActAutUsrNew Authentify user internally (directly from the platform, only if user has not password)
1139. ActAutUsrExt Authentify user externally (remotely from an external site)
1140. ActAutUsrChgLan Change language to my language just after authentication
1141. ActAnnSee Mark announcement as seen
1142. ActChgMyRol Change type of logged user
@ -2306,8 +2303,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActRenGrp */{ 121,-1,TabUsr,ActReqSelGrp ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Grp_RenameGroup ,NULL},
/* ActChgMaxStdGrp */{ 106,-1,TabUsr,ActReqSelGrp ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Grp_ChangeMaxStdsGrp ,NULL},
/* ActGetExtLstStd */{ 796,-1,TabUsr,ActLstStd ,0x110,0x110,0x110,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Imp_ListMyImpGrpsAndStdsNoForm ,NULL},
/* ActLstGst */{ 587,-1,TabUsr,ActLstOth ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Usr_SeeGuests ,NULL},
/* ActPrnGstPho */{1190,-1,TabUsr,ActLstStd ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_NEW_WINDOW ,NULL ,Usr_SeeGstClassPhotoPrn ,NULL},
@ -2762,7 +2757,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActAutUsrInt */{ 6,-1,TabPrf,ActFrmRolSes ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Usr_WelcomeUsr ,NULL},
/* ActAutUsrNew */{1585,-1,TabPrf,ActFrmRolSes ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Usr_WelcomeUsr ,NULL},
/* ActAutUsrExt */{ 794,-1,TabPrf,ActFrmRolSes ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Usr_WelcomeUsr ,NULL},
/* ActAutUsrChgLan */{1077,-1,TabPrf,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Usr_WelcomeUsr ,NULL},
/* ActAnnSee */{1234,-1,TabPrf,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ann_MarkAnnouncementAsSeen ,NULL},
/* ActChgMyRol */{ 589,-1,TabPrf,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Rol_ChangeMyRole ,Usr_ShowFormsLogoutAndRole ,NULL},
@ -3647,9 +3641,9 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActRcvURLTchGui, // #791
ActAdmAsgWrkUsr, // #792
-1, // #793 (obsolete action)
ActAutUsrExt, // #794
-1, // #794 (obsolete action)
-1, // #795 (obsolete action)
ActGetExtLstStd, // #796
-1, // #796 (obsolete action)
-1, // #797 (obsolete action)
-1, // #798 (obsolete action)
-1, // #799 (obsolete action)

View File

@ -72,7 +72,7 @@ typedef enum
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+246+186+156+172+36+30+87)
#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+246+186+155+172+36+30+86)
#define Act_MAX_ACTION_COD 1586
@ -951,154 +951,152 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
#define ActRenGrp (ActChgNumRowFooGrp+ 26)
#define ActChgMaxStdGrp (ActChgNumRowFooGrp+ 27)
#define ActGetExtLstStd (ActChgNumRowFooGrp+ 28)
#define ActLstGst (ActChgNumRowFooGrp+ 28)
#define ActLstGst (ActChgNumRowFooGrp+ 29)
#define ActPrnGstPho (ActChgNumRowFooGrp+ 29)
#define ActPrnStdPho (ActChgNumRowFooGrp+ 30)
#define ActPrnTchPho (ActChgNumRowFooGrp+ 31)
#define ActLstGstAll (ActChgNumRowFooGrp+ 32)
#define ActLstStdAll (ActChgNumRowFooGrp+ 33)
#define ActLstTchAll (ActChgNumRowFooGrp+ 34)
#define ActPrnGstPho (ActChgNumRowFooGrp+ 30)
#define ActPrnStdPho (ActChgNumRowFooGrp+ 31)
#define ActPrnTchPho (ActChgNumRowFooGrp+ 32)
#define ActLstGstAll (ActChgNumRowFooGrp+ 33)
#define ActLstStdAll (ActChgNumRowFooGrp+ 34)
#define ActLstTchAll (ActChgNumRowFooGrp+ 35)
#define ActSeeRecOneStd (ActChgNumRowFooGrp+ 35)
#define ActSeeRecOneTch (ActChgNumRowFooGrp+ 36)
#define ActSeeRecSevGst (ActChgNumRowFooGrp+ 37)
#define ActSeeRecSevStd (ActChgNumRowFooGrp+ 38)
#define ActSeeRecSevTch (ActChgNumRowFooGrp+ 39)
#define ActPrnRecSevGst (ActChgNumRowFooGrp+ 40)
#define ActPrnRecSevStd (ActChgNumRowFooGrp+ 41)
#define ActPrnRecSevTch (ActChgNumRowFooGrp+ 42)
#define ActRcvRecOthUsr (ActChgNumRowFooGrp+ 43)
#define ActEdiRecFie (ActChgNumRowFooGrp+ 44)
#define ActNewFie (ActChgNumRowFooGrp+ 45)
#define ActReqRemFie (ActChgNumRowFooGrp+ 46)
#define ActRemFie (ActChgNumRowFooGrp+ 47)
#define ActRenFie (ActChgNumRowFooGrp+ 48)
#define ActChgRowFie (ActChgNumRowFooGrp+ 49)
#define ActChgVisFie (ActChgNumRowFooGrp+ 50)
#define ActRcvRecCrs (ActChgNumRowFooGrp+ 51)
#define ActSeeRecOneStd (ActChgNumRowFooGrp+ 36)
#define ActSeeRecOneTch (ActChgNumRowFooGrp+ 37)
#define ActSeeRecSevGst (ActChgNumRowFooGrp+ 38)
#define ActSeeRecSevStd (ActChgNumRowFooGrp+ 39)
#define ActSeeRecSevTch (ActChgNumRowFooGrp+ 40)
#define ActPrnRecSevGst (ActChgNumRowFooGrp+ 41)
#define ActPrnRecSevStd (ActChgNumRowFooGrp+ 42)
#define ActPrnRecSevTch (ActChgNumRowFooGrp+ 43)
#define ActRcvRecOthUsr (ActChgNumRowFooGrp+ 44)
#define ActEdiRecFie (ActChgNumRowFooGrp+ 45)
#define ActNewFie (ActChgNumRowFooGrp+ 46)
#define ActReqRemFie (ActChgNumRowFooGrp+ 47)
#define ActRemFie (ActChgNumRowFooGrp+ 48)
#define ActRenFie (ActChgNumRowFooGrp+ 49)
#define ActChgRowFie (ActChgNumRowFooGrp+ 50)
#define ActChgVisFie (ActChgNumRowFooGrp+ 51)
#define ActRcvRecCrs (ActChgNumRowFooGrp+ 52)
#define ActReqEnrSevStd (ActChgNumRowFooGrp+ 52)
#define ActReqEnrSevTch (ActChgNumRowFooGrp+ 53)
#define ActReqEnrSevStd (ActChgNumRowFooGrp+ 53)
#define ActReqEnrSevTch (ActChgNumRowFooGrp+ 54)
#define ActReqLstStdAtt (ActChgNumRowFooGrp+ 54)
#define ActSeeLstMyAtt (ActChgNumRowFooGrp+ 55)
#define ActPrnLstMyAtt (ActChgNumRowFooGrp+ 56)
#define ActSeeLstStdAtt (ActChgNumRowFooGrp+ 57)
#define ActPrnLstStdAtt (ActChgNumRowFooGrp+ 58)
#define ActFrmNewAtt (ActChgNumRowFooGrp+ 59)
#define ActEdiOneAtt (ActChgNumRowFooGrp+ 60)
#define ActNewAtt (ActChgNumRowFooGrp+ 61)
#define ActChgAtt (ActChgNumRowFooGrp+ 62)
#define ActReqRemAtt (ActChgNumRowFooGrp+ 63)
#define ActRemAtt (ActChgNumRowFooGrp+ 64)
#define ActHidAtt (ActChgNumRowFooGrp+ 65)
#define ActShoAtt (ActChgNumRowFooGrp+ 66)
#define ActSeeOneAtt (ActChgNumRowFooGrp+ 67)
#define ActRecAttStd (ActChgNumRowFooGrp+ 68)
#define ActRecAttMe (ActChgNumRowFooGrp+ 69)
#define ActReqLstStdAtt (ActChgNumRowFooGrp+ 55)
#define ActSeeLstMyAtt (ActChgNumRowFooGrp+ 56)
#define ActPrnLstMyAtt (ActChgNumRowFooGrp+ 57)
#define ActSeeLstStdAtt (ActChgNumRowFooGrp+ 58)
#define ActPrnLstStdAtt (ActChgNumRowFooGrp+ 59)
#define ActFrmNewAtt (ActChgNumRowFooGrp+ 60)
#define ActEdiOneAtt (ActChgNumRowFooGrp+ 61)
#define ActNewAtt (ActChgNumRowFooGrp+ 62)
#define ActChgAtt (ActChgNumRowFooGrp+ 63)
#define ActReqRemAtt (ActChgNumRowFooGrp+ 64)
#define ActRemAtt (ActChgNumRowFooGrp+ 65)
#define ActHidAtt (ActChgNumRowFooGrp+ 66)
#define ActShoAtt (ActChgNumRowFooGrp+ 67)
#define ActSeeOneAtt (ActChgNumRowFooGrp+ 68)
#define ActRecAttStd (ActChgNumRowFooGrp+ 69)
#define ActRecAttMe (ActChgNumRowFooGrp+ 70)
#define ActSignUp (ActChgNumRowFooGrp+ 70)
#define ActUpdSignUpReq (ActChgNumRowFooGrp+ 71)
#define ActReqRejSignUp (ActChgNumRowFooGrp+ 72)
#define ActRejSignUp (ActChgNumRowFooGrp+ 73)
#define ActSignUp (ActChgNumRowFooGrp+ 71)
#define ActUpdSignUpReq (ActChgNumRowFooGrp+ 72)
#define ActReqRejSignUp (ActChgNumRowFooGrp+ 73)
#define ActRejSignUp (ActChgNumRowFooGrp+ 74)
#define ActReqMdfOneOth (ActChgNumRowFooGrp+ 74)
#define ActReqMdfOneStd (ActChgNumRowFooGrp+ 75)
#define ActReqMdfOneTch (ActChgNumRowFooGrp+ 76)
#define ActReqMdfOneOth (ActChgNumRowFooGrp+ 75)
#define ActReqMdfOneStd (ActChgNumRowFooGrp+ 76)
#define ActReqMdfOneTch (ActChgNumRowFooGrp+ 77)
#define ActReqMdfOth (ActChgNumRowFooGrp+ 77)
#define ActReqMdfStd (ActChgNumRowFooGrp+ 78)
#define ActReqMdfTch (ActChgNumRowFooGrp+ 79)
#define ActReqMdfOth (ActChgNumRowFooGrp+ 78)
#define ActReqMdfStd (ActChgNumRowFooGrp+ 79)
#define ActReqMdfTch (ActChgNumRowFooGrp+ 80)
#define ActReqOthPho (ActChgNumRowFooGrp+ 80)
#define ActReqStdPho (ActChgNumRowFooGrp+ 81)
#define ActReqTchPho (ActChgNumRowFooGrp+ 82)
#define ActDetOthPho (ActChgNumRowFooGrp+ 83)
#define ActDetStdPho (ActChgNumRowFooGrp+ 84)
#define ActDetTchPho (ActChgNumRowFooGrp+ 85)
#define ActUpdOthPho (ActChgNumRowFooGrp+ 86)
#define ActUpdStdPho (ActChgNumRowFooGrp+ 87)
#define ActUpdTchPho (ActChgNumRowFooGrp+ 88)
#define ActReqRemOthPho (ActChgNumRowFooGrp+ 89)
#define ActReqRemStdPho (ActChgNumRowFooGrp+ 90)
#define ActReqRemTchPho (ActChgNumRowFooGrp+ 91)
#define ActRemOthPho (ActChgNumRowFooGrp+ 92)
#define ActRemStdPho (ActChgNumRowFooGrp+ 93)
#define ActRemTchPho (ActChgNumRowFooGrp+ 94)
#define ActCreOth (ActChgNumRowFooGrp+ 95)
#define ActCreStd (ActChgNumRowFooGrp+ 96)
#define ActCreTch (ActChgNumRowFooGrp+ 97)
#define ActUpdOth (ActChgNumRowFooGrp+ 98)
#define ActUpdStd (ActChgNumRowFooGrp+ 99)
#define ActUpdTch (ActChgNumRowFooGrp+100)
#define ActReqOthPho (ActChgNumRowFooGrp+ 81)
#define ActReqStdPho (ActChgNumRowFooGrp+ 82)
#define ActReqTchPho (ActChgNumRowFooGrp+ 83)
#define ActDetOthPho (ActChgNumRowFooGrp+ 84)
#define ActDetStdPho (ActChgNumRowFooGrp+ 85)
#define ActDetTchPho (ActChgNumRowFooGrp+ 86)
#define ActUpdOthPho (ActChgNumRowFooGrp+ 87)
#define ActUpdStdPho (ActChgNumRowFooGrp+ 88)
#define ActUpdTchPho (ActChgNumRowFooGrp+ 89)
#define ActReqRemOthPho (ActChgNumRowFooGrp+ 90)
#define ActReqRemStdPho (ActChgNumRowFooGrp+ 91)
#define ActReqRemTchPho (ActChgNumRowFooGrp+ 92)
#define ActRemOthPho (ActChgNumRowFooGrp+ 93)
#define ActRemStdPho (ActChgNumRowFooGrp+ 94)
#define ActRemTchPho (ActChgNumRowFooGrp+ 95)
#define ActCreOth (ActChgNumRowFooGrp+ 96)
#define ActCreStd (ActChgNumRowFooGrp+ 97)
#define ActCreTch (ActChgNumRowFooGrp+ 98)
#define ActUpdOth (ActChgNumRowFooGrp+ 99)
#define ActUpdStd (ActChgNumRowFooGrp+100)
#define ActUpdTch (ActChgNumRowFooGrp+101)
#define ActReqAccEnrStd (ActChgNumRowFooGrp+101)
#define ActReqAccEnrTch (ActChgNumRowFooGrp+102)
#define ActAccEnrStd (ActChgNumRowFooGrp+103)
#define ActAccEnrTch (ActChgNumRowFooGrp+104)
#define ActRemMe_Std (ActChgNumRowFooGrp+105)
#define ActRemMe_Tch (ActChgNumRowFooGrp+106)
#define ActReqAccEnrStd (ActChgNumRowFooGrp+102)
#define ActReqAccEnrTch (ActChgNumRowFooGrp+103)
#define ActAccEnrStd (ActChgNumRowFooGrp+104)
#define ActAccEnrTch (ActChgNumRowFooGrp+105)
#define ActRemMe_Std (ActChgNumRowFooGrp+106)
#define ActRemMe_Tch (ActChgNumRowFooGrp+107)
#define ActNewAdmIns (ActChgNumRowFooGrp+107)
#define ActRemAdmIns (ActChgNumRowFooGrp+108)
#define ActNewAdmCtr (ActChgNumRowFooGrp+109)
#define ActRemAdmCtr (ActChgNumRowFooGrp+110)
#define ActNewAdmDeg (ActChgNumRowFooGrp+111)
#define ActRemAdmDeg (ActChgNumRowFooGrp+112)
#define ActNewAdmIns (ActChgNumRowFooGrp+108)
#define ActRemAdmIns (ActChgNumRowFooGrp+109)
#define ActNewAdmCtr (ActChgNumRowFooGrp+110)
#define ActRemAdmCtr (ActChgNumRowFooGrp+111)
#define ActNewAdmDeg (ActChgNumRowFooGrp+112)
#define ActRemAdmDeg (ActChgNumRowFooGrp+113)
#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+113)
#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+114)
#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+114)
#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+115)
#define ActReqCnfID_Oth (ActChgNumRowFooGrp+115)
#define ActReqCnfID_Std (ActChgNumRowFooGrp+116)
#define ActReqCnfID_Tch (ActChgNumRowFooGrp+117)
#define ActCnfID_Oth (ActChgNumRowFooGrp+118)
#define ActCnfID_Std (ActChgNumRowFooGrp+119)
#define ActCnfID_Tch (ActChgNumRowFooGrp+120)
#define ActReqCnfID_Oth (ActChgNumRowFooGrp+116)
#define ActReqCnfID_Std (ActChgNumRowFooGrp+117)
#define ActReqCnfID_Tch (ActChgNumRowFooGrp+118)
#define ActCnfID_Oth (ActChgNumRowFooGrp+119)
#define ActCnfID_Std (ActChgNumRowFooGrp+120)
#define ActCnfID_Tch (ActChgNumRowFooGrp+121)
#define ActFrmIDsOth (ActChgNumRowFooGrp+121)
#define ActFrmIDsStd (ActChgNumRowFooGrp+122)
#define ActFrmIDsTch (ActChgNumRowFooGrp+123)
#define ActRemID_Oth (ActChgNumRowFooGrp+124)
#define ActRemID_Std (ActChgNumRowFooGrp+125)
#define ActRemID_Tch (ActChgNumRowFooGrp+126)
#define ActNewID_Oth (ActChgNumRowFooGrp+127)
#define ActNewID_Std (ActChgNumRowFooGrp+128)
#define ActNewID_Tch (ActChgNumRowFooGrp+129)
#define ActFrmPwdOth (ActChgNumRowFooGrp+130)
#define ActFrmPwdStd (ActChgNumRowFooGrp+131)
#define ActFrmPwdTch (ActChgNumRowFooGrp+132)
#define ActChgPwdOth (ActChgNumRowFooGrp+133)
#define ActChgPwdStd (ActChgNumRowFooGrp+134)
#define ActChgPwdTch (ActChgNumRowFooGrp+135)
#define ActFrmMaiOth (ActChgNumRowFooGrp+136)
#define ActFrmMaiStd (ActChgNumRowFooGrp+137)
#define ActFrmMaiTch (ActChgNumRowFooGrp+138)
#define ActRemMaiOth (ActChgNumRowFooGrp+139)
#define ActRemMaiStd (ActChgNumRowFooGrp+140)
#define ActRemMaiTch (ActChgNumRowFooGrp+141)
#define ActNewMaiOth (ActChgNumRowFooGrp+142)
#define ActNewMaiStd (ActChgNumRowFooGrp+143)
#define ActNewMaiTch (ActChgNumRowFooGrp+144)
#define ActFrmIDsOth (ActChgNumRowFooGrp+122)
#define ActFrmIDsStd (ActChgNumRowFooGrp+123)
#define ActFrmIDsTch (ActChgNumRowFooGrp+124)
#define ActRemID_Oth (ActChgNumRowFooGrp+125)
#define ActRemID_Std (ActChgNumRowFooGrp+126)
#define ActRemID_Tch (ActChgNumRowFooGrp+127)
#define ActNewID_Oth (ActChgNumRowFooGrp+128)
#define ActNewID_Std (ActChgNumRowFooGrp+129)
#define ActNewID_Tch (ActChgNumRowFooGrp+130)
#define ActFrmPwdOth (ActChgNumRowFooGrp+131)
#define ActFrmPwdStd (ActChgNumRowFooGrp+132)
#define ActFrmPwdTch (ActChgNumRowFooGrp+133)
#define ActChgPwdOth (ActChgNumRowFooGrp+134)
#define ActChgPwdStd (ActChgNumRowFooGrp+135)
#define ActChgPwdTch (ActChgNumRowFooGrp+136)
#define ActFrmMaiOth (ActChgNumRowFooGrp+137)
#define ActFrmMaiStd (ActChgNumRowFooGrp+138)
#define ActFrmMaiTch (ActChgNumRowFooGrp+139)
#define ActRemMaiOth (ActChgNumRowFooGrp+140)
#define ActRemMaiStd (ActChgNumRowFooGrp+141)
#define ActRemMaiTch (ActChgNumRowFooGrp+142)
#define ActNewMaiOth (ActChgNumRowFooGrp+143)
#define ActNewMaiStd (ActChgNumRowFooGrp+144)
#define ActNewMaiTch (ActChgNumRowFooGrp+145)
#define ActRemStdCrs (ActChgNumRowFooGrp+145)
#define ActRemTchCrs (ActChgNumRowFooGrp+146)
#define ActRemUsrGbl (ActChgNumRowFooGrp+147)
#define ActRemStdCrs (ActChgNumRowFooGrp+146)
#define ActRemTchCrs (ActChgNumRowFooGrp+147)
#define ActRemUsrGbl (ActChgNumRowFooGrp+148)
#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+148)
#define ActRemAllStdCrs (ActChgNumRowFooGrp+149)
#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+149)
#define ActRemAllStdCrs (ActChgNumRowFooGrp+150)
#define ActReqRemOldUsr (ActChgNumRowFooGrp+150)
#define ActRemOldUsr (ActChgNumRowFooGrp+151)
#define ActReqRemOldUsr (ActChgNumRowFooGrp+151)
#define ActRemOldUsr (ActChgNumRowFooGrp+152)
#define ActLstDupUsr (ActChgNumRowFooGrp+152)
#define ActLstSimUsr (ActChgNumRowFooGrp+153)
#define ActRemDupUsr (ActChgNumRowFooGrp+154)
#define ActLstDupUsr (ActChgNumRowFooGrp+153)
#define ActLstSimUsr (ActChgNumRowFooGrp+154)
#define ActRemDupUsr (ActChgNumRowFooGrp+155)
#define ActLstClk (ActChgNumRowFooGrp+156)
#define ActLstClk (ActChgNumRowFooGrp+155)
/*****************************************************************************/
/******************************** Social tab *********************************/
@ -1385,88 +1383,87 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
#define ActLogOut (ActSeeMyUsgRep+13)
#define ActAutUsrInt (ActSeeMyUsgRep+14)
#define ActAutUsrNew (ActSeeMyUsgRep+15)
#define ActAutUsrExt (ActSeeMyUsgRep+16)
#define ActAutUsrChgLan (ActSeeMyUsgRep+17)
#define ActAnnSee (ActSeeMyUsgRep+18)
#define ActChgMyRol (ActSeeMyUsgRep+19)
#define ActChkUsrAcc (ActSeeMyUsgRep+20)
#define ActCreUsrAcc (ActSeeMyUsgRep+21)
#define ActRemID_Me (ActSeeMyUsgRep+22)
#define ActNewIDMe (ActSeeMyUsgRep+23)
#define ActRemOldNic (ActSeeMyUsgRep+24)
#define ActChgNic (ActSeeMyUsgRep+25)
#define ActRemMaiMe (ActSeeMyUsgRep+26)
#define ActNewMaiMe (ActSeeMyUsgRep+27)
#define ActCnfMai (ActSeeMyUsgRep+28)
#define ActFrmChgMyPwd (ActSeeMyUsgRep+29)
#define ActChgPwd (ActSeeMyUsgRep+30)
#define ActReqRemMyAcc (ActSeeMyUsgRep+31)
#define ActRemMyAcc (ActSeeMyUsgRep+32)
#define ActAutUsrChgLan (ActSeeMyUsgRep+16)
#define ActAnnSee (ActSeeMyUsgRep+17)
#define ActChgMyRol (ActSeeMyUsgRep+18)
#define ActChkUsrAcc (ActSeeMyUsgRep+19)
#define ActCreUsrAcc (ActSeeMyUsgRep+20)
#define ActRemID_Me (ActSeeMyUsgRep+21)
#define ActNewIDMe (ActSeeMyUsgRep+22)
#define ActRemOldNic (ActSeeMyUsgRep+23)
#define ActChgNic (ActSeeMyUsgRep+24)
#define ActRemMaiMe (ActSeeMyUsgRep+25)
#define ActNewMaiMe (ActSeeMyUsgRep+26)
#define ActCnfMai (ActSeeMyUsgRep+27)
#define ActFrmChgMyPwd (ActSeeMyUsgRep+28)
#define ActChgPwd (ActSeeMyUsgRep+29)
#define ActReqRemMyAcc (ActSeeMyUsgRep+30)
#define ActRemMyAcc (ActSeeMyUsgRep+31)
#define ActChgMyData (ActSeeMyUsgRep+33)
#define ActChgMyData (ActSeeMyUsgRep+32)
#define ActReqMyPho (ActSeeMyUsgRep+34)
#define ActDetMyPho (ActSeeMyUsgRep+35)
#define ActUpdMyPho (ActSeeMyUsgRep+36)
#define ActReqRemMyPho (ActSeeMyUsgRep+37)
#define ActRemMyPho (ActSeeMyUsgRep+38)
#define ActReqMyPho (ActSeeMyUsgRep+33)
#define ActDetMyPho (ActSeeMyUsgRep+34)
#define ActUpdMyPho (ActSeeMyUsgRep+35)
#define ActReqRemMyPho (ActSeeMyUsgRep+36)
#define ActRemMyPho (ActSeeMyUsgRep+37)
#define ActEdiPri (ActSeeMyUsgRep+39)
#define ActChgPriPho (ActSeeMyUsgRep+40)
#define ActChgPriPrf (ActSeeMyUsgRep+41)
#define ActEdiPri (ActSeeMyUsgRep+38)
#define ActChgPriPho (ActSeeMyUsgRep+39)
#define ActChgPriPrf (ActSeeMyUsgRep+40)
#define ActReqEdiMyIns (ActSeeMyUsgRep+42)
#define ActChgCtyMyIns (ActSeeMyUsgRep+43)
#define ActChgMyIns (ActSeeMyUsgRep+44)
#define ActChgMyCtr (ActSeeMyUsgRep+45)
#define ActChgMyDpt (ActSeeMyUsgRep+46)
#define ActChgMyOff (ActSeeMyUsgRep+47)
#define ActChgMyOffPho (ActSeeMyUsgRep+48)
#define ActReqEdiMyIns (ActSeeMyUsgRep+41)
#define ActChgCtyMyIns (ActSeeMyUsgRep+42)
#define ActChgMyIns (ActSeeMyUsgRep+43)
#define ActChgMyCtr (ActSeeMyUsgRep+44)
#define ActChgMyDpt (ActSeeMyUsgRep+45)
#define ActChgMyOff (ActSeeMyUsgRep+46)
#define ActChgMyOffPho (ActSeeMyUsgRep+47)
#define ActReqEdiMyNet (ActSeeMyUsgRep+49)
#define ActChgMyNet (ActSeeMyUsgRep+50)
#define ActReqEdiMyNet (ActSeeMyUsgRep+48)
#define ActChgMyNet (ActSeeMyUsgRep+49)
#define ActChgThe (ActSeeMyUsgRep+51)
#define ActReqChgLan (ActSeeMyUsgRep+52)
#define ActChgLan (ActSeeMyUsgRep+53)
#define ActChg1stDay (ActSeeMyUsgRep+54)
#define ActChgCol (ActSeeMyUsgRep+55)
#define ActHidLftCol (ActSeeMyUsgRep+56)
#define ActHidRgtCol (ActSeeMyUsgRep+57)
#define ActShoLftCol (ActSeeMyUsgRep+58)
#define ActShoRgtCol (ActSeeMyUsgRep+59)
#define ActChgIco (ActSeeMyUsgRep+60)
#define ActChgMnu (ActSeeMyUsgRep+61)
#define ActChgNtfPrf (ActSeeMyUsgRep+62)
#define ActChgThe (ActSeeMyUsgRep+50)
#define ActReqChgLan (ActSeeMyUsgRep+51)
#define ActChgLan (ActSeeMyUsgRep+52)
#define ActChg1stDay (ActSeeMyUsgRep+53)
#define ActChgCol (ActSeeMyUsgRep+54)
#define ActHidLftCol (ActSeeMyUsgRep+55)
#define ActHidRgtCol (ActSeeMyUsgRep+56)
#define ActShoLftCol (ActSeeMyUsgRep+57)
#define ActShoRgtCol (ActSeeMyUsgRep+58)
#define ActChgIco (ActSeeMyUsgRep+59)
#define ActChgMnu (ActSeeMyUsgRep+60)
#define ActChgNtfPrf (ActSeeMyUsgRep+61)
#define ActPrnUsrQR (ActSeeMyUsgRep+63)
#define ActPrnUsrQR (ActSeeMyUsgRep+62)
#define ActPrnMyTT (ActSeeMyUsgRep+64)
#define ActEdiTut (ActSeeMyUsgRep+65)
#define ActChgTut (ActSeeMyUsgRep+66)
#define ActChgMyTT1stDay (ActSeeMyUsgRep+67)
#define ActPrnMyTT (ActSeeMyUsgRep+63)
#define ActEdiTut (ActSeeMyUsgRep+64)
#define ActChgTut (ActSeeMyUsgRep+65)
#define ActChgMyTT1stDay (ActSeeMyUsgRep+66)
#define ActReqRemFilBrf (ActSeeMyUsgRep+68)
#define ActRemFilBrf (ActSeeMyUsgRep+69)
#define ActRemFolBrf (ActSeeMyUsgRep+70)
#define ActCopBrf (ActSeeMyUsgRep+71)
#define ActPasBrf (ActSeeMyUsgRep+72)
#define ActRemTreBrf (ActSeeMyUsgRep+73)
#define ActFrmCreBrf (ActSeeMyUsgRep+74)
#define ActCreFolBrf (ActSeeMyUsgRep+75)
#define ActCreLnkBrf (ActSeeMyUsgRep+76)
#define ActRenFolBrf (ActSeeMyUsgRep+77)
#define ActRcvFilBrfDZ (ActSeeMyUsgRep+78)
#define ActRcvFilBrfCla (ActSeeMyUsgRep+79)
#define ActExpBrf (ActSeeMyUsgRep+80)
#define ActConBrf (ActSeeMyUsgRep+81)
#define ActZIPBrf (ActSeeMyUsgRep+82)
#define ActReqDatBrf (ActSeeMyUsgRep+83)
#define ActChgDatBrf (ActSeeMyUsgRep+84)
#define ActDowBrf (ActSeeMyUsgRep+85)
#define ActReqRemFilBrf (ActSeeMyUsgRep+67)
#define ActRemFilBrf (ActSeeMyUsgRep+68)
#define ActRemFolBrf (ActSeeMyUsgRep+69)
#define ActCopBrf (ActSeeMyUsgRep+70)
#define ActPasBrf (ActSeeMyUsgRep+71)
#define ActRemTreBrf (ActSeeMyUsgRep+72)
#define ActFrmCreBrf (ActSeeMyUsgRep+73)
#define ActCreFolBrf (ActSeeMyUsgRep+74)
#define ActCreLnkBrf (ActSeeMyUsgRep+75)
#define ActRenFolBrf (ActSeeMyUsgRep+76)
#define ActRcvFilBrfDZ (ActSeeMyUsgRep+77)
#define ActRcvFilBrfCla (ActSeeMyUsgRep+78)
#define ActExpBrf (ActSeeMyUsgRep+79)
#define ActConBrf (ActSeeMyUsgRep+80)
#define ActZIPBrf (ActSeeMyUsgRep+81)
#define ActReqDatBrf (ActSeeMyUsgRep+82)
#define ActChgDatBrf (ActSeeMyUsgRep+83)
#define ActDowBrf (ActSeeMyUsgRep+84)
#define ActReqRemOldBrf (ActSeeMyUsgRep+86)
#define ActRemOldBrf (ActSeeMyUsgRep+87)
#define ActReqRemOldBrf (ActSeeMyUsgRep+85)
#define ActRemOldBrf (ActSeeMyUsgRep+86)
/*****************************************************************************/
/******************************** Public types *******************************/

View File

@ -148,14 +148,21 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.17.17 (2016-10-09)"
#define Log_PLATFORM_VERSION "SWAD 16.18 (2016-10-09)"
#define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.238.1.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.17.17: Oct 09, 2016 Fixed bug in user's usage report. (? lines)
Version 16.18: Oct 09, 2016 Removed external authentication (previously used at University of Granada). (205092 lines)
4 changes necessary in database:
DROP TABLE IF EXISTS imported_groups;
DROP TABLE IF EXISTS imported_sessions;
DROP TABLE IF EXISTS imported_students;
UPDATE actions SET Obsolete='Y' WHERE ActCod IN ('794','796');
Version 16.17.17: Oct 09, 2016 Fixed bug in user's usage report. (206245 lines)
Version 16.17.16: Oct 09, 2016 Code refactoring in user's usage report. (206236 lines)
Version 16.17.15: Oct 09, 2016 Code refactoring in user's usage report. (206236 lines)
Version 16.17.14: Oct 09, 2016 Code refactoring in user's usage report. (206268 lines)

View File

@ -28,8 +28,8 @@
/** Uncomment one of the following installations of SWAD or create your own **/
/*****************************************************************************/
//#define LOCALHOST_UBUNTU // Comment this line if not applicable
#define OPENSWAD_ORG // Comment this line if not applicable
#define LOCALHOST_UBUNTU // Comment this line if not applicable
//#define OPENSWAD_ORG // Comment this line if not applicable
//#define SWAD_UGR_ES // Comment this line if not applicable
//#define SWADBERRY_UGR_ES // Comment this line if not applicable
@ -83,14 +83,6 @@
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND "" // Client of the web service called by this CGI
#define Cfg_EXTERNAL_LOGIN_SERVICE_NAME ""
#define Cfg_EXTERNAL_LOGIN_URL ""
#define Cfg_NAME_PARAM_IMPORTED_USR_ID ""
#define Cfg_NAME_PARAM_IMPORTED_SESSION_ID ""
#define Cfg_MAX_LENGTH_IMPORTED_USR_ID 255 // The same size as that of column ImportedUsrId in table imported_sessions
#define Cfg_MAX_LENGTH_IMPORTED_SESSION_ID 255 // The same size as that of column ImportedSessionId in table imported_sessions
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t)(30UL*60UL)) // After these seconds after first pending notification, all the pending notifications are sent by e-mail
#define Cfg_GOOGLE_ANALYTICS ""
@ -132,14 +124,6 @@
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND "" // Client of the web service called by this CGI
#define Cfg_EXTERNAL_LOGIN_SERVICE_NAME ""
#define Cfg_EXTERNAL_LOGIN_URL ""
#define Cfg_NAME_PARAM_IMPORTED_USR_ID ""
#define Cfg_NAME_PARAM_IMPORTED_SESSION_ID ""
#define Cfg_MAX_LENGTH_IMPORTED_USR_ID 255 // The same size as that of column ImportedUsrId in table imported_sessions
#define Cfg_MAX_LENGTH_IMPORTED_SESSION_ID 255 // The same size as that of column ImportedSessionId in table imported_sessions
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t)(30UL*60UL)) // After these seconds after first pending notification, all the pending notifications are sent by e-mail
/* Google Analytics without cookies.
@ -198,22 +182,6 @@
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND "" // Client of the web service called by this CGI
#define Cfg_EXTERNAL_LOGIN_SERVICE_NAME ""
#define Cfg_EXTERNAL_LOGIN_URL ""
#define Cfg_NAME_PARAM_IMPORTED_USR_ID ""
#define Cfg_NAME_PARAM_IMPORTED_SESSION_ID ""
#define Cfg_MAX_LENGTH_IMPORTED_USR_ID 255 // The same size as that of column ImportedUsrId in table imported_sessions
#define Cfg_MAX_LENGTH_IMPORTED_SESSION_ID 255 // The same size as that of column ImportedSessionId in table imported_sessions
/*
#define Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND "./prado" // Client of the web service called by this CGI
#define Cfg_EXTERNAL_LOGIN_SERVICE_NAME "PRADO (Plataforma de Recursos de Apoyo a la Docencia)"
#define Cfg_EXTERNAL_LOGIN_URL "https://oficinavirtual.ugr.es/"
#define Cfg_NAME_PARAM_IMPORTED_USR_ID "pradouser"
#define Cfg_NAME_PARAM_IMPORTED_SESSION_ID "pradosession"
#define Cfg_MAX_LENGTH_IMPORTED_USR_ID 255 // The same size as that of column ImportedUsrId in table imported_sessions
#define Cfg_MAX_LENGTH_IMPORTED_SESSION_ID 255 // The same size as that of column ImportedSessionId in table imported_sessions
*/
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t)(60UL*60UL)) // After these seconds after first pending notification, all the pending notifications are sent by e-mail
#define Cfg_GOOGLE_ANALYTICS "<script type=\"text/javascript\">" \
@ -269,14 +237,6 @@
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND "" // Client of the web service called by this CGI
#define Cfg_EXTERNAL_LOGIN_SERVICE_NAME ""
#define Cfg_EXTERNAL_LOGIN_URL ""
#define Cfg_NAME_PARAM_IMPORTED_USR_ID ""
#define Cfg_NAME_PARAM_IMPORTED_SESSION_ID ""
#define Cfg_MAX_LENGTH_IMPORTED_USR_ID 255 // The same size as that of column ImportedUsrId in table imported_sessions
#define Cfg_MAX_LENGTH_IMPORTED_SESSION_ID 255 // The same size as that of column ImportedSessionId in table imported_sessions
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t)(30UL*60UL)) // After these seconds after first pending notification, all the pending notifications are sent by e-mail
#define Cfg_GOOGLE_ANALYTICS ""

View File

@ -258,8 +258,7 @@ void Con_GetAndShowLastClicks (void)
/* Use a special color for this row depending on the action */
ClassRow = (Act_Actions[Act_FromActCodToAction[ActCod]].BrowserWindow == Act_DOWNLD_FILE) ? "DAT_SMALL_YELLOW LEFT_MIDDLE" :
(ActCod == Act_Actions[ActAutUsrInt].ActCod ||
ActCod == Act_Actions[ActAutUsrNew].ActCod ||
ActCod == Act_Actions[ActAutUsrExt].ActCod) ? "DAT_SMALL_GREEN" :
ActCod == Act_Actions[ActAutUsrNew].ActCod) ? "DAT_SMALL_GREEN" :
(ActCod == Act_Actions[ActLogOut].ActCod ) ? "DAT_SMALL_RED" :
(ActCod == Act_Actions[ActWebSvc].ActCod ) ? "DAT_SMALL_BLUE" :
"DAT_SMALL_GREY";

View File

@ -1249,81 +1249,6 @@ mysql> DESCRIBE holidays;
"INDEX(InsCod),"
"INDEX(PlcCod))");
/***** Table imported_groups *****/
/*
mysql> DESCRIBE imported_groups;
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| GrpCod | int(11) | NO | PRI | NULL | auto_increment |
| SessionId | char(43) | NO | MUL | NULL | |
| ExternalCrsCod | char(7) | NO | | NULL | |
| DegName | varchar(127) | NO | | NULL | |
| CrsName | varchar(127) | NO | | NULL | |
| GrpName | varchar(255) | NO | | NULL | |
| GrpType | varchar(255) | NO | | NULL | |
+----------------+--------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS imported_groups ("
"GrpCod INT NOT NULL AUTO_INCREMENT,"
"SessionId CHAR(43) NOT NULL,"
"ExternalCrsCod CHAR(7) NOT NULL,"
"DegName VARCHAR(127) NOT NULL,"
"CrsName VARCHAR(127) NOT NULL,"
"GrpName VARCHAR(255) NOT NULL,"
"GrpType VARCHAR(255) NOT NULL,"
"UNIQUE INDEX(GrpCod),"
"INDEX(SessionId))");
/***** Table imported_sessions *****/
/*
mysql> DESCRIBE imported_sessions;
+-------------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+------------+------+-----+---------+-------+
| SessionId | char(43) | NO | PRI | NULL | |
| UsrCod | int(11) | NO | | NULL | |
| ImportedUsrId | char(255) | NO | | NULL | |
| ImportedSessionId | char(255) | NO | | NULL | |
| ImportedRole | tinyint(4) | NO | | 0 | |
+-------------------+------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS imported_sessions ("
"SessionId CHAR(43) NOT NULL,"
"UsrCod INT NOT NULL,"
"ImportedUsrId CHAR(255) NOT NULL,"
"ImportedSessionId CHAR(255) NOT NULL,"
"ImportedRole TINYINT NOT NULL DEFAULT 0,"
"UNIQUE INDEX(SessionId))");
/***** Table imported_students *****/
/*
mysql> DESCRIBE imported_students;
+-----------+---------------------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------------------------+------+-----+---------+----------------+
| GrpCod | int(11) | NO | MUL | NULL | auto_increment |
| UsrID | char(16) | NO | | NULL | |
| Surname1 | varchar(32) | NO | | NULL | |
| Surname2 | varchar(32) | NO | | NULL | |
| FirstName | varchar(32) | NO | | NULL | |
| Sex | enum('unknown','female','male') | NO | | unknown | |
| E_mail | varchar(127) | NO | | NULL | |
+-----------+---------------------------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS imported_students ("
"GrpCod INT NOT NULL AUTO_INCREMENT,"
"UsrID CHAR(16) NOT NULL,"
"Surname1 VARCHAR(32) NOT NULL,"
"Surname2 VARCHAR(32) NOT NULL,"
"FirstName VARCHAR(32) NOT NULL,"
"Sex ENUM ('unknown','female','male') NOT NULL DEFAULT 'unknown',"
"E_mail VARCHAR(127) NOT NULL,"
"INDEX(GrpCod))");
/***** Table institutions *****/
/*
mysql> DESCRIBE institutions;

View File

@ -99,7 +99,6 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role);
static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered);
static void Enr_MarkOfficialStdsAsRemovable (long ImpGrpCod,bool RemoveSpecifiedUsrs);
static void Enr_PutLinkToRemAllStdsThisCrs (void);
@ -581,9 +580,6 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
extern const char *Txt_Admin_several_students;
extern const char *Txt_Admin_several_teachers;
extern const char *Txt_Step_1_Provide_a_list_of_users;
extern const char *Txt_Option_a_Import_students_from_the_official_lists;
extern const char *Txt_Select_the_groups_of_students_you_want_to_register_in_remove_from_this_course;
extern const char *Txt_Option_b_Type_or_paste_a_list_of_users;
extern const char *Txt_Type_or_paste_a_list_of_IDs_nicks_or_emails_;
extern const char *Txt_Step_2_Select_the_desired_action;
extern const char *Txt_Step_3_Optionally_select_groups;
@ -591,7 +587,6 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
extern const char *Txt_No_groups_have_been_created_in_the_course_X_Therefore_;
extern const char *Txt_Step_4_Confirm_the_enrollment_removing;
extern const char *Txt_Confirm;
bool ExternalUsrsServiceAvailable = (Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND[0] != '\0');
/***** Put contextual links *****/
if (Role == Rol_STUDENT && // Users to admin: students
@ -623,25 +618,6 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
The_ClassTitle[Gbl.Prefs.Theme],
Txt_Step_1_Provide_a_list_of_users);
if (ExternalUsrsServiceAvailable)
{
/* Option a: get students from official lists */
fprintf (Gbl.F.Out,"<div class=\"%s LEFT_MIDDLE\">"
"%s"
"</div>",
The_ClassTitle[Gbl.Prefs.Theme],
Txt_Option_a_Import_students_from_the_official_lists);
Lay_ShowAlert (Lay_INFO,Txt_Select_the_groups_of_students_you_want_to_register_in_remove_from_this_course);
Imp_ListMyImpGrpsAndStdsForm ();
/* Option b: get students' IDs from pasted text */
fprintf (Gbl.F.Out,"<div class=\"%s LEFT_MIDDLE\">"
"%s"
"</div>",
The_ClassTitle[Gbl.Prefs.Theme],
Txt_Option_b_Type_or_paste_a_list_of_users);
}
Lay_ShowAlert (Lay_INFO,Txt_Type_or_paste_a_list_of_IDs_nicks_or_emails_);
Enr_PutAreaToEnterUsrsIDs ();
@ -1223,12 +1199,8 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
extern const char *Txt_No_user_has_been_enrolled;
extern const char *Txt_One_user_has_been_enrolled;
extern const char *Txt_X_users_have_been_enrolled_including_possible_repetitions;
char ListExternalGrpCods[Imp_MAX_BYTES_LIST_EXTERNAL_GRP_CODS+1];
char ExternalStr[1+10+1+Crs_LENGTH_INSTITUTIONAL_CRS_COD+1];
char ExternalCrsCod[Crs_LENGTH_INSTITUTIONAL_CRS_COD+1];
char UnsignedStr[10+1];
unsigned UnsignedNum;
long LongNum;
struct
{
bool RemoveUsrs;
@ -1241,7 +1213,6 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
unsigned NumUsrFound;
const char *Ptr;
unsigned NumCurrentUsr;
long GrpCod;
unsigned NumUsrsRegistered = 0;
unsigned NumUsrsRemoved = 0;
unsigned NumUsrsEliminated = 0;
@ -1333,9 +1304,6 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
if (!ErrorInForm)
{
/***** Get external groups of students *****/
Par_GetParMultiToText ("ImpGrpCod",ListExternalGrpCods,Imp_MAX_BYTES_LIST_EXTERNAL_GRP_CODS);
/***** Get groups to which register/remove users *****/
LstGrps.NumGrps = 0;
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups?
@ -1386,25 +1354,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].Remove = !WhatToDo.RemoveSpecifiedUsrs;
/***** Loop 1: go through form list setting if a student must be removed *****/
/* Step a: Get students from a list of official groups */
if (Role == Rol_STUDENT)
{
Ptr = ListExternalGrpCods;
while (*Ptr)
{
/* Find next external group code and course code in list */
Str_GetNextStringUntilSeparator (&Ptr,ExternalStr,1+10+1+Crs_LENGTH_INSTITUTIONAL_CRS_COD);
if (sscanf (ExternalStr,"%ld_%s",&LongNum,ExternalCrsCod) == 2)
{
GrpCod = LongNum;
/* Mark users belonging to this official group as removable */
Enr_MarkOfficialStdsAsRemovable (GrpCod,WhatToDo.RemoveSpecifiedUsrs);
}
}
}
/* Step b: Get users from a list of users' IDs */
/* Get users from a list of users' IDs */
Ptr = ListUsrsIDs;
while (*Ptr)
{
@ -1524,28 +1474,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
/***** Register users *****/
if (WhatToDo.RegisterUsrs) // TODO: !!!!! NO CAMBIAR EL ROL DE LOS USUARIOS QUE YA ESTÉN EN LA ASIGNATURA SI HAY MÁS DE UN USUARIO ENCONTRADO PARA EL MISMO DNI !!!!!!
{
/***** Step a: Get users from a list of official groups *****/
if (Role == Rol_STUDENT)
{
Ptr = ListExternalGrpCods;
while (*Ptr)
{
/* Find next official group code in list */
Str_GetNextStringUntilSeparator (&Ptr,ExternalStr,1+10+1+Crs_LENGTH_INSTITUTIONAL_CRS_COD);
if (sscanf (ExternalStr,"%ld_%s",&LongNum,ExternalCrsCod) == 2)
{
GrpCod = LongNum;
/* Import official group of users */
Imp_ImportStdsFromAnImpGrp (GrpCod,&LstGrps,&NumUsrsRegistered);
/* Update the institutional course code to the external course code */
Crs_UpdateInstitutionalCrsCod (&Gbl.CurrentCrs.Crs,ExternalCrsCod);
}
}
}
/***** Step b: Get users from a list of users' IDs ******/
/***** Get users from a list of users' IDs ******/
Ptr = ListUsrsIDs;
while (*Ptr)
{
@ -1725,65 +1654,6 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
(*NumUsrsRegistered)++;
}
/*****************************************************************************/
/****** Mark the students belonging to an official group as removable ********/
/*****************************************************************************/
static void Enr_MarkOfficialStdsAsRemovable (long ImpGrpCod,bool RemoveSpecifiedUsrs)
{
char Query[1024];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumStds;
unsigned NumStd;
unsigned NumUsr;
struct ListUsrCods ListUsrCods; // List with users' codes for a given user's ID
unsigned NumUsrFound;
/***** Get imported students belonging to this group from database *****/
sprintf (Query,"SELECT UsrID FROM imported_students WHERE GrpCod='%ld'",
ImpGrpCod);
NumStds = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get imported students");
/***** Mark the students from this official group as removable *****/
for (NumStd = 0;
NumStd < NumStds;
NumStd++) // For each student inside the official group...
{
/* Get user's ID of the student from official list */
row = mysql_fetch_row (mysql_res);
/***** Allocate space for the list *****/
ID_ReallocateListIDs (&Gbl.Usrs.Other.UsrDat,1);
strncpy (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,row[0],ID_MAX_LENGTH_USR_ID);
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID[ID_MAX_LENGTH_USR_ID] = '\0';
// Users' IDs are always stored internally in capitals and without leading zeros
Str_RemoveLeadingZeros (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
Str_ConvertToUpperText (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
/* Check if this official user's ID is in the list of students */
if (ID_CheckIfUsrIDIsValid (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID))
if (ID_GetListUsrCodsFromUsrID (&Gbl.Usrs.Other.UsrDat,NULL,&ListUsrCods,false)) // User(s) found
{
for (NumUsr = 0;
NumUsr < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs;
NumUsr++)
for (NumUsrFound = 0;
NumUsrFound < ListUsrCods.NumUsrs;
NumUsrFound++)
if (Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].UsrCod == ListUsrCods.Lst[NumUsrFound]) // User found
Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumUsr].Remove = RemoveSpecifiedUsrs;
/* Free memory used for list of users' codes found for this ID */
Usr_FreeListUsrCods (&ListUsrCods);
}
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
/**** Put a link (form) to remove all the students in the current course *****/
/*****************************************************************************/

View File

@ -423,11 +423,6 @@ void Gbl_InitializeGlobals (void)
Gbl.ColorRows[0] = "COLOR0"; // Darker
Gbl.ColorRows[1] = "COLOR1"; // Lighter
/* Imported data from external site */
Gbl.Imported.ExternalUsrId[0] = '\0';
Gbl.Imported.ExternalSesId[0] = '\0';
Gbl.Imported.ExternalRole = Rol_UNKNOWN;
Gbl.WebService.Function = Svc_unknown;
}

View File

@ -48,7 +48,6 @@
#include "swad_forum.h"
#include "swad_holiday.h"
#include "swad_image.h"
#include "swad_import.h"
#include "swad_icon.h"
#include "swad_indicator.h"
#include "swad_institution.h"
@ -144,12 +143,6 @@ struct Globals
char IP[Cns_MAX_LENGTH_IP+1];
char UniqueNameEncrypted[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+1]; // Used for session id, temporary directory names, etc.
struct
{
char ExternalUsrId[Cfg_MAX_LENGTH_IMPORTED_USR_ID+1]; // External user ID
char ExternalSesId[Cfg_MAX_LENGTH_IMPORTED_SESSION_ID+1]; // External session ID
Rol_Role_t ExternalRole;
} Imported;
struct
{
Txt_Language_t Language;

View File

@ -126,7 +126,6 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
{
if (Gbl.Action.Act != ActAutUsrInt &&
Gbl.Action.Act != ActAutUsrNew &&
Gbl.Action.Act != ActAutUsrExt &&
Gbl.Action.Act != ActAutUsrChgLan) // I am not just logged
{
/* Request my removing from this course */

View File

@ -1,597 +0,0 @@
// swad_import.c: import courses and students from another web application using web services
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2016 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <linux/limits.h> // For PATH_MAX
#include <linux/stddef.h> // For NULL
#include <stdlib.h> // For exit, system, malloc, free, rand, etc.
#include <string.h> // For string functions
#include <sys/wait.h> // For the macro WEXITSTATUS
#include <unistd.h> // For unlink
#include "swad_account.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_enrollment.h"
#include "swad_global.h"
#include "swad_ID.h"
#include "swad_import.h"
#include "swad_parameter.h"
#include "swad_user.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
/*****************************************************************************/
/***************************** Private constants *****************************/
/*****************************************************************************/
#define Imp_OK 0
#define Imp_ERROR_BAD_SESSION 1
#define Imp_ERROR_NOT_ENOUGH_MEMORY 2
#define Imp_ERROR_SOAP 3
#define Imp_MAX_BYTES_USR_ID 16
#define Imp_MAX_BYTES_NAME 32
#define Imp_MAX_BYTES_EMAIL 127
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
struct ImportedStudent
{
char ExternalUsrID[Imp_MAX_BYTES_USR_ID+1];
char FirstName[Imp_MAX_BYTES_NAME+1];
char Surname1[Imp_MAX_BYTES_NAME+1];
char Surname2[Imp_MAX_BYTES_NAME+1];
char Email[Imp_MAX_BYTES_EMAIL+1];
Usr_Sex_t Sex;
};
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void Imp_ListMyImpGrpsAndStds (bool ItsAFormToRegRemStds);
static void Imp_RemoveOldImpSessions (void);
static void Imp_RemoveOldImpStdsAndGrps (void);
static unsigned Imp_GetAndListImpGrpsAndStdsFromDB (bool ItsAFormToRegRemStds);
/*****************************************************************************/
/************** Get parameters with imported user and session ****************/
/*****************************************************************************/
void Imp_GetImpUsrAndSession (void)
{
Gbl.Imported.ExternalUsrId[0] = '\0';
if (Cfg_NAME_PARAM_IMPORTED_USR_ID[0])
Par_GetParToText (Cfg_NAME_PARAM_IMPORTED_USR_ID,Gbl.Imported.ExternalUsrId,Cfg_MAX_LENGTH_IMPORTED_USR_ID);
Gbl.Imported.ExternalSesId[0] = '\0';
if (Cfg_NAME_PARAM_IMPORTED_SESSION_ID[0])
Par_GetParToText (Cfg_NAME_PARAM_IMPORTED_SESSION_ID,Gbl.Imported.ExternalSesId,Cfg_MAX_LENGTH_IMPORTED_SESSION_ID);
}
/*****************************************************************************/
/********** Import the students of an official group from database ***********/
/*****************************************************************************/
void Imp_ImportStdsFromAnImpGrp (long ImpGrpCod,struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered)
{
char Query[1024];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumStds;
unsigned NumStd;
struct ImportedStudent ImpStd;
Usr_Sex_t Sex;
struct UsrData UsrDat;
struct ListUsrCods ListUsrCodsForThisID;
unsigned NumUsrFoundForThisID;
/***** Get official data of the imported students belonging to this group from database *****/
sprintf (Query,"SELECT UsrID,Surname1,Surname2,FirstName,Sex,E_mail"
" FROM imported_students WHERE GrpCod='%ld'"
" ORDER BY Surname1,Surname2,FirstName,UsrID",
ImpGrpCod);
NumStds = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get imported students");
if (NumStds)
{
/***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat);
/***** Import the students from this official group *****/
for (NumStd = 0;
NumStd < NumStds;
NumStd++) // For each student inside the official group...
{
/* Get official data of the student */
row = mysql_fetch_row (mysql_res);
/* Get user's ID (row[0]) */
strncpy (ImpStd.ExternalUsrID,row[0],Imp_MAX_BYTES_USR_ID);
ImpStd.ExternalUsrID[Imp_MAX_BYTES_USR_ID] = '\0';
// Users' IDs are always stored internally in capitals and without leading zeros
Str_RemoveLeadingZeros (ImpStd.ExternalUsrID);
Str_ConvertToUpperText (ImpStd.ExternalUsrID);
if (ID_CheckIfUsrIDIsValid (ImpStd.ExternalUsrID)) // If it's not a valid user's ID, skip it
{
/* Get Surname1 (row[1]) */
strncpy (ImpStd.Surname1,row[1],Imp_MAX_BYTES_NAME);
ImpStd.Surname1[Imp_MAX_BYTES_NAME] = '\0';
/* Get Surname2 (row[2]) */
strncpy (ImpStd.Surname2,row[2],Imp_MAX_BYTES_NAME);
ImpStd.Surname2[Imp_MAX_BYTES_NAME] = '\0';
/* Get FirstName (row[3]) */
strncpy (ImpStd.FirstName,row[3],Imp_MAX_BYTES_NAME);
ImpStd.FirstName[Imp_MAX_BYTES_NAME] = '\0';
/* Get Sex (row[4]) */
ImpStd.Sex = Usr_SEX_UNKNOWN;
for (Sex = (Usr_Sex_t) 0;
Sex < Usr_NUM_SEXS;
Sex++)
if (!strcasecmp (row[4],Usr_StringsSexDB[Sex]))
{
ImpStd.Sex = Sex;
break;
}
/* Get e-mail (row[5]) */
strncpy (ImpStd.Email,row[5],Imp_MAX_BYTES_EMAIL);
ImpStd.Email[Imp_MAX_BYTES_EMAIL] = '\0';
/* Set ID of the student */
ID_ReallocateListIDs (&UsrDat,1);
strncpy (UsrDat.IDs.List[0].ID,ImpStd.ExternalUsrID,ID_MAX_LENGTH_USR_ID);
UsrDat.IDs.List[0].ID[ID_MAX_LENGTH_USR_ID] = '\0';
if (ID_GetListUsrCodsFromUsrID (&UsrDat,NULL,&ListUsrCodsForThisID,false))
{// User(s) found
for (NumUsrFoundForThisID = 0;
NumUsrFoundForThisID < ListUsrCodsForThisID.NumUsrs;
NumUsrFoundForThisID++)
{
/* Get user's data */
UsrDat.UsrCod = ListUsrCodsForThisID.Lst[NumUsrFoundForThisID];
Usr_GetUsrDataFromUsrCod (&UsrDat); // Get data of the first user in list
if (UsrDat.RoleInCurrentCrsDB <= Rol_STUDENT)
{
/* Update user's data if only one user with this ID */
if (ListUsrCodsForThisID.NumUsrs == 1) // Only one user with this ID
{
/* Fill empty data */
if (!UsrDat.Surname1[0])
strcpy (UsrDat.Surname1,ImpStd.Surname1);
if (!UsrDat.Surname2[0])
strcpy (UsrDat.Surname2,ImpStd.Surname2);
if (!UsrDat.FirstName[0])
strcpy (UsrDat.FirstName,ImpStd.FirstName);
if (UsrDat.Sex == Usr_SEX_UNKNOWN)
UsrDat.Sex = ImpStd.Sex;
/* Update user's data */
Enr_UpdateUsrData (&UsrDat);
/* Update e-mail */
if (!UsrDat.Email[0])
{
strcpy (UsrDat.Email,ImpStd.Email);
if (!Mai_UpdateEmailInDB (&UsrDat,UsrDat.Email)) // Email was already registered and confirmed by another user
UsrDat.Email[0] = '\0';
}
}
if (UsrDat.RoleInCurrentCrsDB == Rol_STUDENT) // He/she was already a student in current course
Enr_AcceptUsrInCrs (UsrDat.UsrCod);
else // He/she not belonged to the current course
/* Register user as student in the current course */
Enr_RegisterUsrInCurrentCrs (&UsrDat,Rol_STUDENT,
Cns_QUIET,Enr_SET_ACCEPTED_TO_TRUE);
/* Register user in the selected groups */
if (Gbl.CurrentCrs.Grps.NumGrps) // If there are groups in current course
Grp_RegisterUsrIntoGroups (&UsrDat,LstGrps); // Register student in the selected groups
/* Confirm user's ID */
ID_ConfirmUsrID (&UsrDat,ImpStd.ExternalUsrID);
(*NumUsrsRegistered)++;
}
}
/* Free memory used for list of users' codes found for this ID */
Usr_FreeListUsrCods (&ListUsrCodsForThisID);
}
else // No users found with this ID
{// The user does not exist in the platform. Register him/her in the current course as student
Usr_ResetUsrDataExceptUsrCodAndIDs (&UsrDat);
strcpy (UsrDat.Surname1,ImpStd.Surname1);
strcpy (UsrDat.Surname2,ImpStd.Surname2);
strcpy (UsrDat.FirstName,ImpStd.FirstName);
UsrDat.Sex = ImpStd.Sex;
strcpy (UsrDat.Email,ImpStd.Email);
/* Create user */
UsrDat.IDs.List[0].Confirmed = true; // If he/she is a new user ==> his/her ID will be stored as confirmed in database
Acc_CreateNewUsr (&UsrDat);
/* Update e-mail */
if (!Mai_UpdateEmailInDB (&UsrDat,UsrDat.Email)) // Email was already registered and confirmed by another user
UsrDat.Email[0] = '\0';
/* Register user as student in the current course */
Enr_RegisterUsrInCurrentCrs (&UsrDat,Rol_STUDENT,
Cns_QUIET,Enr_SET_ACCEPTED_TO_TRUE);
/* Register user in the selected groups */
if (Gbl.CurrentCrs.Grps.NumGrps) // If there are groups in current course
Grp_RegisterUsrIntoGroups (&UsrDat,LstGrps); // Register student in the selected groups
(*NumUsrsRegistered)++;
}
}
}
/***** Free memory used for user's data *****/
Usr_UsrDataDestructor (&UsrDat);
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
/*************** Insert new imported session in the database *****************/
/*****************************************************************************/
void Imp_InsertImpSessionInDB (void)
{
char Query[1024];
/***** Remove old imported sessions *****/
Imp_RemoveOldImpSessions ();
/***** Insert session in the database *****/
sprintf (Query,"INSERT INTO imported_sessions"
" (SessionId,UsrCod,ImportedUsrId,ImportedSessionId,ImportedRole)"
" VALUES ('%s','%ld','%s','%s','%u')",
Gbl.Session.Id,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Imported.ExternalUsrId,
Gbl.Imported.ExternalSesId,
(unsigned) Gbl.Imported.ExternalRole);
DB_QueryINSERT (Query,"can not create imported session");
}
/*****************************************************************************/
/******************** Get the data of a imported session *********************/
/*****************************************************************************/
bool Imp_GetImpSessionData (void)
{
char Query[512];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned long NumRows;
bool Result = false;
/***** Get data of the imported session from database *****/
sprintf (Query,"SELECT ImportedUsrId,ImportedSessionId,ImportedRole"
" FROM imported_sessions"
" WHERE SessionId='%s'",
Gbl.Session.Id);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get imported session data");
/***** Check if the session existed in the database *****/
if (NumRows)
{
row = mysql_fetch_row (mysql_res);
/***** Get imported user identifier (row[0]) *****/
strcpy (Gbl.Imported.ExternalUsrId,row[0]);
/***** Get imported session identifier (row[1]) *****/
strcpy (Gbl.Imported.ExternalSesId,row[1]);
/***** Get imported user's (external) role (row[2]) *****/
if (sscanf (row[2],"%u",&Gbl.Imported.ExternalRole) != 1)
Gbl.Imported.ExternalRole = Rol_UNKNOWN;
Result = true;
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return Result;
}
/*****************************************************************************/
/************* Get lists of my imported groups and students ******************/
/*****************************************************************************/
void Imp_ListMyImpGrpsAndStdsNoForm (void)
{
Imp_ListMyImpGrpsAndStds (false);
}
/*****************************************************************************/
/************* Get lists of my imported groups and students ******************/
/*****************************************************************************/
void Imp_ListMyImpGrpsAndStdsForm (void)
{
Imp_ListMyImpGrpsAndStds (true);
}
/*****************************************************************************/
/************* Get lists of my imported groups and students ******************/
/*****************************************************************************/
static void Imp_ListMyImpGrpsAndStds (bool ItsAFormToRegRemStds)
{
extern const char *Txt_Could_not_get_the_official_list_of_your_groups_and_students_;
extern const char *Txt_To_get_the_official_list_of_your_groups_and_students_;
char PathRelParamsToCommandsPriv[PATH_MAX+1];
char FileNameParams[PATH_MAX+1];
FILE *FileParams;
char Command[2048];
int ReturnCode;
/***** Try to get lists from database *****/
if (!Imp_GetAndListImpGrpsAndStdsFromDB (ItsAFormToRegRemStds))
{
/***** Remove old imported students and groups *****/
Imp_RemoveOldImpStdsAndGrps ();
if (Gbl.Imported.ExternalUsrId[0] &&
Gbl.Imported.ExternalSesId[0] &&
Gbl.Imported.ExternalRole == Rol_TEACHER)
{
/***** Parameters to command used to import data are passed through a temporary file *****/
/* If the private directory does not exist, create it */
sprintf (PathRelParamsToCommandsPriv,"%s/%s",
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PARAM);
Fil_CreateDirIfNotExists (PathRelParamsToCommandsPriv);
/* First of all, we remove the oldest temporary files.
Such temporary files have been created by me or by other users.
This is a bit sloppy, but they must be removed by someone.
Here "oldest" means more than x time from their creation */
Fil_RemoveOldTmpFiles (PathRelParamsToCommandsPriv,Cfg_TIME_TO_DELETE_PARAMS_TO_COMMANDS,false);
/****** Create a new temporary file *****/
sprintf (FileNameParams,"%s/%s",PathRelParamsToCommandsPriv,Gbl.UniqueNameEncrypted);
if ((FileParams = fopen (FileNameParams,"wb")) == NULL)
Lay_ShowErrorAndExit ("Can not open file to send parameters to command.");
fprintf (FileParams,"2\n%s\n%s\n%s\n",
Gbl.Session.Id,Gbl.Imported.ExternalUsrId,Gbl.Imported.ExternalSesId);
fclose (FileParams);
/***** Get new imported lists and store them in database *****/
sprintf (Command,"%s %s",Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND,FileNameParams);
ReturnCode = system (Command);
// unlink (FileNameParams); // File with parameters is no longer necessary
if (ReturnCode == -1)
Lay_ShowErrorAndExit ("Error when running command to import lists of groups and students.");
/***** Write message depending on return code *****/
ReturnCode = WEXITSTATUS(ReturnCode);
switch (ReturnCode)
{
case 0: // Success
/***** Try again to get lists from database *****/
if (!Imp_GetAndListImpGrpsAndStdsFromDB (ItsAFormToRegRemStds))
{
sprintf (Gbl.Message,Txt_Could_not_get_the_official_list_of_your_groups_and_students_,
Cfg_PLATFORM_SHORT_NAME,
Cfg_EXTERNAL_LOGIN_URL,
Cfg_EXTERNAL_LOGIN_SERVICE_NAME);
Lay_ShowAlert (Lay_ERROR,Gbl.Message);
}
break;
default: // Error
sprintf (Gbl.Message,"Error %d while importing lists of groups and students.",ReturnCode);
Lay_ShowAlert (Lay_ERROR,Gbl.Message);
break;
}
}
else // I am not entered from external program as teacher
{
sprintf (Gbl.Message,Txt_To_get_the_official_list_of_your_groups_and_students_,
Cfg_PLATFORM_SHORT_NAME,
Cfg_EXTERNAL_LOGIN_URL,
Cfg_EXTERNAL_LOGIN_SERVICE_NAME);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
}
}
}
/*****************************************************************************/
/*********************** Remove old imported sessions ************************/
/*****************************************************************************/
static void Imp_RemoveOldImpSessions (void)
{
char Query[1024];
/***** Remove old imported sessions *****/
sprintf (Query,"DELETE FROM imported_sessions"
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
DB_QueryDELETE (Query,"can not remove old imported sessions");
}
/*****************************************************************************/
/***************** Remove old imported students and groups *******************/
/*****************************************************************************/
static void Imp_RemoveOldImpStdsAndGrps (void)
{
char Query[1024];
/***** Remove old imported students *****/
sprintf (Query,"DELETE FROM imported_students"
" USING imported_groups,imported_students"
" WHERE imported_groups.SessionId NOT IN"
" (SELECT SessionId FROM sessions)"
" AND imported_groups.GrpCod=imported_students.GrpCod");
DB_QueryDELETE (Query,"can not remove old imported students");
/***** Remove old imported groups *****/
sprintf (Query,"DELETE FROM imported_groups"
" WHERE SessionId NOT IN"
" (SELECT SessionId FROM sessions)");
DB_QueryDELETE (Query,"can not remove old imported groups");
}
/*****************************************************************************/
/******** Get from database and list imported groups and students ************/
/*****************************************************************************/
static unsigned Imp_GetAndListImpGrpsAndStdsFromDB (bool ItsAFormToRegRemStds)
{
extern const char *Txt_Official_students;
extern const char *Txt_Group;
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
char Query[1024];
MYSQL_RES *mysql_res_grp;
MYSQL_RES *mysql_res_std;
MYSQL_ROW row;
char ExternalCrsCod[Crs_LENGTH_INSTITUTIONAL_CRS_COD+1];
unsigned NumGrps;
unsigned NumGrp;
long GrpCod;
unsigned NumStds;
unsigned NumStd;
/***** Get data of imported groups from database *****/
sprintf (Query,"SELECT GrpCod,ExternalCrsCod,DegName,CrsName,GrpName,GrpType"
" FROM imported_groups"
" WHERE SessionId='%s'"
" ORDER BY DegName,CrsName,GrpName,GrpType",
Gbl.Session.Id);
NumGrps = (unsigned) DB_QuerySELECT (Query,&mysql_res_grp,"can not get imported groups");
if (NumGrps)
{
/***** Start table with groups *****/
Lay_StartRoundFrameTable (NULL,2,NULL);
fprintf (Gbl.F.Out,"<tr>"
"<th colspan=\"%u\" class=\"CENTER_TOP\">",
ItsAFormToRegRemStds ? 3 :
2);
Lay_WriteTitle (Txt_Official_students);
fprintf (Gbl.F.Out,"</th>"
"</tr>");
/***** Get groups and write them *****/
for (NumGrp = 0;
NumGrp < NumGrps;
NumGrp++) // For each course
{
row = mysql_fetch_row (mysql_res_grp);
GrpCod = Str_ConvertStrCodToLongCod (row[0]);
strncpy (ExternalCrsCod,row[1],Crs_LENGTH_INSTITUTIONAL_CRS_COD);
ExternalCrsCod[Crs_LENGTH_INSTITUTIONAL_CRS_COD] = '\0';
/***** Get data of the imported students belonging to this group from database *****/
sprintf (Query,"SELECT UsrID,Surname1,Surname2,FirstName"
" FROM imported_students"
" WHERE GrpCod='%ld' ORDER BY Surname1,Surname2,FirstName,UsrID",
GrpCod);
NumStds = (unsigned) DB_QuerySELECT (Query,&mysql_res_std,"can not get imported students");
fprintf (Gbl.F.Out,"<tr>");
if (ItsAFormToRegRemStds)
/* Put checkbox to select the group */
fprintf (Gbl.F.Out,"<td rowspan=\"2\" class=\"LEFT_TOP\">"
"<input type=\"checkbox\" name=\"ImpGrpCod\" value=\"%ld_%s\" />"
"</td>",
GrpCod,ExternalCrsCod);
/* Write degree, course and group */
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"DAT LEFT_TOP\">"
"%s<br />%s %s<br />%s %s (%s)"
"</td>" \
"</tr>",
row[2],
ExternalCrsCod,row[3],
Txt_Group,row[4],row[5]);
/* Write students */
fprintf (Gbl.F.Out,"<tr>" \
"<td class=\"DAT LEFT_TOP\">"
"%u %s%s"
"</td>" \
"<td class=\"DAT LEFT_TOP\">",
NumStds,Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
NumStds ? ":" :
"");
if (NumStds)
{
fprintf (Gbl.F.Out,"<textarea cols=\"60\" rows=\"%u\" readonly>",
NumStds > 50 ? NumStds / 10 :
5);
for (NumStd = 0;
NumStd < NumStds;
NumStd++) // For each student inside the group
{
row = mysql_fetch_row (mysql_res_std);
fprintf (Gbl.F.Out,"%s %s",row[0],row[1]); // User's ID and Surname 1
if (row[2][0])
fprintf (Gbl.F.Out," %s",row[2]); // Surname 2
fprintf (Gbl.F.Out,", %s\n",row[3]); // First name
}
fprintf (Gbl.F.Out,"</textarea>");
}
fprintf (Gbl.F.Out,"</td>" \
"</tr>");
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res_std);
}
/***** End of table with courses *****/
Lay_EndRoundFrameTable ();
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res_grp);
return NumGrps;
}

View File

@ -1,53 +0,0 @@
// swad_import.h: import courses and students from another web application using web services
#ifndef _SWAD_IMP
#define _SWAD_IMP
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2016 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include "swad_group.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/
#define Imp_MAX_BYTES_LIST_EXTERNAL_GRP_CODS (10*1024)
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Imp_GetImpUsrAndSession (void);
void Imp_ImportStdsFromAnImpGrp (long ImpGrpCod,struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered);
void Imp_ListMyImpGrpsAndStdsNoForm (void);
void Imp_ListMyImpGrpsAndStdsForm (void);
void Imp_InsertImpSessionInDB (void);
bool Imp_GetImpSessionData (void);
#endif

View File

@ -220,8 +220,7 @@ void Lay_WriteStartOfPage (void)
/* Redirect to correct language */
if ((Gbl.Action.Act == ActAutUsrInt ||
Gbl.Action.Act == ActAutUsrNew ||
Gbl.Action.Act == ActAutUsrExt) && // Action is log in
Gbl.Action.Act == ActAutUsrNew) && // Action is log in
Gbl.Usrs.Me.Logged && // I am just logged
Gbl.Usrs.Me.UsrDat.Prefs.Language != Txt_Current_CGI_SWAD_Language) // My language != current language
Lay_WriteRedirectionToMyLanguage ();
@ -323,7 +322,6 @@ void Lay_WriteStartOfPage (void)
/* Write new year greeting */
if (Gbl.Action.Act == ActAutUsrInt ||
Gbl.Action.Act == ActAutUsrNew ||
Gbl.Action.Act == ActAutUsrExt ||
Gbl.Action.Act == ActAutUsrChgLan)
if (Gbl.Now.Date.Month == 1 &&
Gbl.Now.Date.Day == 1)
@ -987,8 +985,7 @@ static void Lay_ShowRightColumn (void)
/***** SWADroid advertisement *****/
if (!Gbl.Usrs.Me.Logged ||
Gbl.Action.Act == ActAutUsrInt ||
Gbl.Action.Act == ActAutUsrNew ||
Gbl.Action.Act == ActAutUsrExt)
Gbl.Action.Act == ActAutUsrNew)
fprintf (Gbl.F.Out,"<div class=\"LEFT_RIGHT_CELL\">"
"<a href=\"https://play.google.com/store/apps/details?id=es.ugr.swad.swadroid\""
" target=\"_blank\" title=\"%s\">"

View File

@ -668,18 +668,7 @@ void Par_GetMainParameters (void)
return;
}
/* Check if SWAD is called from an external site */
Imp_GetImpUsrAndSession ();
if (Gbl.Imported.ExternalUsrId[0] &&
Gbl.Imported.ExternalSesId[0])
{
Gbl.Action.Act = ActAutUsrExt;
Tab_SetCurrentTab ();
return;
}
// SWAD is not called from external site
/***** Set dfault action *****/
/***** Set default action *****/
Gbl.Action.Act = ActUnk;
/***** Get another user's nickname, if exists
@ -725,10 +714,7 @@ void Par_GetMainParameters (void)
{
/***** Get user's code, password, current degree and current course from stored session *****/
if (Ses_GetSessionData ())
{
Gbl.Session.IsOpen = true;
Imp_GetImpSessionData ();
}
else
{
Gbl.Session.HasBeenDisconnected = true;
@ -743,10 +729,7 @@ void Par_GetMainParameters (void)
{
/***** Get user's code, password, current degree and current course from stored session *****/
if (Ses_GetSessionData ())
{
Gbl.Session.IsOpen = true;
Imp_GetImpSessionData ();
}
else
{
Gbl.Session.HasBeenDisconnected = true;

View File

@ -26983,27 +26983,6 @@ const char *Txt_Office =
"Gabinete";
#endif
const char *Txt_Official_students =
#if L==1
"Estudiants oficials";
#elif L==2
"Offizielle Teilnehmer";
#elif L==3
"Official students";
#elif L==4
"Estudiantes oficiales";
#elif L==5
"&Eacute;tudiants officiels";
#elif L==6
"Estudiantes oficiales"; // Okoteve traducción
#elif L==7
"Studenti ufficiali";
#elif L==8
"Dziennik student&oacute;w";
#elif L==9
"Estudantes oficiais";
#endif
const char *Txt_One_message_has_been_deleted =
#if L==1
"Se ha eliminado un mensaje."; // Necessita traduccio
@ -27277,48 +27256,6 @@ const char *Txt_Opening_of_groups =
"Opening of groups"; // Necessita de tradução
#endif
const char *Txt_Option_a_Import_students_from_the_official_lists =
#if L==1
"Opci&oacute;n a): Obtenga estudiantes de las listas oficiales"; // Necessita traduccio
#elif L==2
"Option a): Import students from the official lists"; // Need Übersetzung
#elif L==3
"Option a): Import students from the official lists";
#elif L==4
"Opci&oacute;n a): Obtenga estudiantes de las listas oficiales";
#elif L==5
"Option a): Import students from the official lists"; // Besoin de traduction
#elif L==6
"Opci&oacute;n a): Obtenga estudiantes de las listas oficiales"; // Okoteve traducción
#elif L==7
"Opzione a): Importa studenti dalle liste ufficiali";
#elif L==8
"Opcja a): Student&oacute;w Import z oficjalnej listy";
#elif L==9
"Option a): Import students from the official lists"; // Necessita de tradução
#endif
const char *Txt_Option_b_Type_or_paste_a_list_of_users =
#if L==1
"Opci&oacute;n b): Escriba o pegue una lista de usuarios"; // Necessita traduccio
#elif L==2
"Option b): Type or paste a list of users"; // Need Übersetzung
#elif L==3
"Option b): Type or paste a list of users";
#elif L==4
"Opci&oacute;n b): Escriba o pegue una lista de usuarios";
#elif L==5
"Option b): Type or paste a list of users"; // Besoin de traduction
#elif L==6
"Opci&oacute;n b): Escriba o pegue una lista de usuarios"; // Okoteve traducción
#elif L==7
"Opzione b): Scrivi o incolla una lista di utenti";
#elif L==8
"Opcja b): Wpisz lub wklej liste uzytkownik&oacute;w";
#elif L==9
"Option b): Type or paste a list of users"; // Necessita de tradução
#endif
const char *Txt_Option_under_development =
#if L==1
"Opci&oacute; en desenvolupament.";
@ -35793,27 +35730,6 @@ const char *Txt_Select_the_groups_in_from_which_you_want_to_register_remove_user
" or removed from the course and from all groups."; // Necessita de tradução
#endif
const char *Txt_Select_the_groups_of_students_you_want_to_register_in_remove_from_this_course =
#if L==1
"Seleccione los grupos de estudiantes que desee inscribir en / eliminar de esta asignatura."; // Necessita traduccio
#elif L==2
"Select the groups of students you want to register in / remove from this course."; // Need Übersetzung
#elif L==3
"Select the groups of students you want to register in / remove from this course.";
#elif L==4
"Seleccione los grupos de estudiantes que desee inscribir en / eliminar de esta asignatura.";
#elif L==5
"Select the groups of students you want to register in / remove from this course."; // Besoin de traduction
#elif L==6
"Seleccione los grupos de estudiantes que desee inscribir en / eliminar de esta asignatura."; // Okoteve traducción
#elif L==7
"Seleziona i gruppi di studenti che vuoi registrare in / rimuovere da questo corso.";
#elif L==8
"Select the groups of students you want to register in / remove from this course."; // Potrzebujesz tlumaczenie
#elif L==9
"Select the groups of students you want to register in / remove from this course."; // Necessita de tradução
#endif
const char *Txt_Send =
#if L==1
"Enviar";
@ -46609,7 +46525,8 @@ const char *Txt_There_is_no_empty_account_associated_with_your_ID_X_ = // Warnin
#elif L==4
"No existe ninguna cuenta vac&iacute;a (a&uacute;n no usada)"
" asociada a su ID <strong>%s</strong>."
" Si cree que puede haber sido inscrito/a con otro ID, compru&eacute;belo, por favor.";
" Si cree que puede haber sido inscrito/a con otro ID"
" (DNI con letra final o sin ella, NIE, c&eacute;dula, etc.), compru&eacute;belo, por favor.";
#elif L==5
"Il n'y a pas de compte vide (pas encore utilis&eacute;)"
" associ&eacute; &agrave; votre ID <strong>%s</strong>."
@ -46751,63 +46668,6 @@ const char *Txt_There_is_no_user_with_email_X = // Warning: it is very important
" with e-mail <strong>%s</strong>."; // Necessita de tradução
#endif
const char *Txt_There_is_no_user_in_X_with_ID_Y_If_you_already_have_an_account_on_Z_ = // Warning: it is very important to include three %s in the following sentences
#if L==1
"No existe ning&uacute;n usuario en %s"
" con el ID (DNI/c&eacute;dula&hellip;) <strong>%s</strong>."
" Si usted ya tiene cuenta en %s,"
" inicie sesi&oacute;n y a&ntilde;ada este ID a su cuenta."
" Si no tiene cuenta, puede crear una nueva."; // Necessita traduccio
#elif L==2
"There is no user in %s"
" with ID <strong>%s</strong>."
" If you already have an account on %s,"
" login and add this ID to your account."
" If you have no account, you can create a new one."; // Übersetzung notwendig
#elif L==3
"There is no user in %s"
" with ID <strong>%s</strong>."
" If you already have an account on %s,"
" login and add this ID to your account."
" If you have no account, you can create a new one.";
#elif L==4
"No existe ning&uacute;n usuario en %s"
" con el ID (DNI/c&eacute;dula&hellip;) <strong>%s</strong>."
" Si usted ya tiene cuenta en %s,"
" inicie sesi&oacute;n y a&ntilde;ada este ID a su cuenta."
" Si no tiene cuenta, puede crear una nueva.";
#elif L==5
"Il n'ya pas d'utilisateur dans %s"
" avec ID <strong>%s</strong>."
" Si vous avez d&eacute;j&agrave; un compte sur %s,"
" vous connecter et ajouter cet ID &agrave; votre compte."
" Si vous n'avez pas de compte, vous pouvez en cr&eacute;er un nouveau.";
#elif L==6
"No existe ning&uacute;n usuario en %s"
" con el ID (DNI/c&eacute;dula&hellip;) <strong>%s</strong>."
" Si usted ya tiene cuenta en %s,"
" inicie sesi&oacute;n y a&ntilde;ada este ID a su cuenta."
" Si no tiene cuenta, puede crear una nueva."; // Okoteve traducción
#elif L==7
"Non c'&egrave; nessun utente in %s"
" con ID <strong>%s</strong>."
" Se hai gi&agrave; un account su %s,"
" login e inserire questo ID al tuo account."
" Se non avete account, &egrave; possibile crearne uno nuovo.";
#elif L==8
"There is no user in %s"
" with ID <strong>%s</strong>."
" If you already have an account on %s,"
" login and add this ID to your account."
" If you have no account, you can create a new one."; // Potrzebujesz tlumaczenie
#elif L==9
"There is no user in %s"
" with ID <strong>%s</strong>."
" If you already have an account on %s,"
" login and add this ID to your account."
" If you have no account, you can create a new one."; // Necessita de tradução
#endif
const char *Txt_There_is_no_user_with_ID_nick_or_e_mail_X = // Warning: it is very important to include %s in the following sentences
#if L==1
"No existe ning&uacute;n usuario"

View File

@ -120,11 +120,9 @@ static void Usr_RemoveTemporaryTableMyCourses (void);
static void Usr_GetParamOtherUsrIDNickOrEMail (void);
static bool Usr_ChkUsrAndGetUsrDataFromDirectLogin (void);
static bool Usr_ChkUsrAndGetUsrDataFromExternalLogin (void);
static bool Usr_ChkUsrAndGetUsrDataFromSession (void);
static void Usr_ShowAlertUsrDoesNotExistsOrWrongPassword (void);
static void Usr_ShowAlertThereAreMoreThanOneUsr (void);
static void Usr_ShowAlertNoUsrWithThisID (void);
static void Usr_SetUsrRoleAndPrefs (void);
@ -190,8 +188,6 @@ static void Usr_ShowGstsAllDataParams (void);
static void Usr_ShowStdsAllDataParams (void);
static void Usr_ShowTchsAllDataParams (void);
static void Usr_PutLinkToListOfficialStudents (void);
static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
Rol_Role_t RoleInClassPhoto);
@ -2148,23 +2144,6 @@ void Usr_ChkUsrAndGetUsrData (void)
else
PutFormLogin = true;
}
else if (Gbl.Action.Act == ActAutUsrExt) // Login from external web service
{
if (Usr_ChkUsrAndGetUsrDataFromExternalLogin ()) // User logged in
{
Gbl.Usrs.Me.Logged = true;
Usr_SetUsrRoleAndPrefs ();
Act_AdjustCurrentAction ();
Ses_CreateSession ();
Pre_SetPrefsFromIP (); // Set preferences from current IP
Imp_InsertImpSessionInDB ();
}
else
PutFormLogin = true;
}
}
}
@ -2353,158 +2332,6 @@ static bool Usr_ChkUsrAndGetUsrDataFromDirectLogin (void)
return true;
}
/*****************************************************************************/
/************ Check user and get user's data when external login *************/
/*****************************************************************************/
// Returns true if user logged in successfully
// Returns false if user not logged in
static bool Usr_ChkUsrAndGetUsrDataFromExternalLogin (void)
{
struct ListUsrCods ListUsrCods;
bool ItSeemsANewUsrIsEnteringFromExternalSite = false;
char PathRelParamsToCommandsPriv[PATH_MAX+1];
char FileNameParams[PATH_MAX+1];
FILE *FileParams;
char Command[2048];
int ReturnCode;
/* Login from external service using ID (not necessarily unique) is not secure.
Example: Assume a first user who uses an account with private files, messages, etc.
If he/she is the unique user with this ID confirmed
or if he/she is the unique user with this ID,
another second user with the same ID
would enter from external service into the first user's account.
The solution would be that external service should use e-mail, that is unique. */
/***** Copy user's identifier received from external site *****/
strncpy (Gbl.Usrs.Me.UsrIdLogin,Gbl.Imported.ExternalUsrId,Usr_MAX_BYTES_USR_LOGIN);
Gbl.Usrs.Me.UsrIdLogin[Usr_MAX_BYTES_USR_LOGIN] = '\0';
// Users' IDs are always stored internally in capitals and without leading zeros
Str_RemoveLeadingZeros (Gbl.Usrs.Me.UsrIdLogin);
/***** Check if user's ID is valid *****/
if (ID_CheckIfUsrIDIsValid (Gbl.Usrs.Me.UsrIdLogin))
{
/***** Allocate space for the list *****/
ID_ReallocateListIDs (&Gbl.Usrs.Me.UsrDat,1);
strncpy (Gbl.Usrs.Me.UsrDat.IDs.List[0].ID,Gbl.Usrs.Me.UsrIdLogin,ID_MAX_LENGTH_USR_ID);
Gbl.Usrs.Me.UsrDat.IDs.List[0].ID[ID_MAX_LENGTH_USR_ID] = '\0';
Str_ConvertToUpperText (Gbl.Usrs.Me.UsrDat.IDs.List[0].ID);
/* Check if user's ID exists in database, and get user's data */
if (ID_GetListUsrCodsFromUsrID (&Gbl.Usrs.Me.UsrDat,NULL,&ListUsrCods,true)) // Try first only confirmed IDs
{
if (ListUsrCods.NumUsrs == 1) // Only one user with this ID confirmed
{
/* Free memory used for list of users' codes found for this ID */
Usr_FreeListUsrCods (&ListUsrCods);
/* Get user's data */
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat);
}
else // ListUsrCods.NumUsrs > 1 ==> more than one user with this ID confirmed
{
/* Free memory used for list of users' codes found for this ID */
Usr_FreeListUsrCods (&ListUsrCods);
Usr_ShowAlertThereAreMoreThanOneUsr ();
return false;
}
}
else if (ID_GetListUsrCodsFromUsrID (&Gbl.Usrs.Me.UsrDat,NULL,&ListUsrCods,false)) // If there are no users with this ID confirmed, try with all IDs, not only the confirmed ones
{
if (ListUsrCods.NumUsrs == 1) // Only one user with this ID
{
/* Free memory used for list of users' codes found for this ID */
Usr_FreeListUsrCods (&ListUsrCods);
/* Mark user's ID as confirmed */
ID_ConfirmUsrID (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.UsrIdLogin);
/* Get user's data */
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat);
}
else // ListUsrCods.NumUsrs > 1
{
/* Free memory used for list of users' codes found for this ID */
Usr_FreeListUsrCods (&ListUsrCods);
Usr_ShowAlertThereAreMoreThanOneUsr ();
return false;
}
}
else
ItSeemsANewUsrIsEnteringFromExternalSite = true;
}
else // String is not a valid user's nickname, e-mail or ID
{
Usr_ShowAlertUsrDoesNotExistsOrWrongPassword ();
return false;
}
/***** Validate session:
the call to SWAD is really coming from external site? *****/
if (Gbl.Imported.ExternalUsrId[0] &&
Gbl.Imported.ExternalSesId[0])
{
/***** Parameters to command used to import data are passed through a temporary file *****/
/* If the private directory does not exist, create it */
sprintf (PathRelParamsToCommandsPriv,"%s/%s",
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PARAM);
Fil_CreateDirIfNotExists (PathRelParamsToCommandsPriv);
/* First of all, we remove the oldest temporary files.
Such temporary files have been created by me or by other users.
This is a bit sloppy, but they must be removed by someone.
Here "oldest" means more than x time from their creation */
Fil_RemoveOldTmpFiles (PathRelParamsToCommandsPriv,Cfg_TIME_TO_DELETE_PARAMS_TO_COMMANDS,false);
/* Create a new temporary file *****/
sprintf (FileNameParams,"%s/%s",PathRelParamsToCommandsPriv,Gbl.UniqueNameEncrypted);
if ((FileParams = fopen (FileNameParams,"wb")) == NULL)
Lay_ShowErrorAndExit ("Can not open file to send parameters to command.");
fprintf (FileParams,"1\n0\n%s\n%s\n",
Gbl.Imported.ExternalUsrId,Gbl.Imported.ExternalSesId);
fclose (FileParams);
/***** Validate imported session *****/
sprintf (Command,"%s %s",Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND,FileNameParams);
ReturnCode = system (Command);
unlink (FileNameParams); // File with parameters is no longer necessary
if (ReturnCode == -1)
Lay_ShowErrorAndExit ("Error when running command to validate imported session.");
ReturnCode = WEXITSTATUS(ReturnCode);
switch (ReturnCode)
{
case Rol_STUDENT: // Student
case Rol_TEACHER: // Teacher
Gbl.Imported.ExternalRole = (Rol_Role_t) ReturnCode;
break;
default:
sprintf (Gbl.Message,"Error %d while validating session.",ReturnCode);
Lay_ShowErrorAndExit (Gbl.Message);
break;
}
// Now we know than imported session (external login) is valid
if (ItSeemsANewUsrIsEnteringFromExternalSite)
{
/***** User does not exist in the platform *****/
Usr_ShowAlertNoUsrWithThisID ();
return false;
}
}
else // External user's ID or session are not valid
{
Usr_ShowAlertUsrDoesNotExistsOrWrongPassword ();
return false;
}
return true; // User is now logged
}
/*****************************************************************************/
/******** Check user and get user's data when the session is open ************/
/*****************************************************************************/
@ -2561,23 +2388,6 @@ static void Usr_ShowAlertThereAreMoreThanOneUsr (void)
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
}
/*****************************************************************************/
/********** Show alert indicating that this ID does not exist ****************/
/*****************************************************************************/
static void Usr_ShowAlertNoUsrWithThisID (void)
{
extern const char *Txt_There_is_no_user_in_X_with_ID_Y_If_you_already_have_an_account_on_Z_;
Gbl.Action.Act = ActFrmLogIn;
Tab_SetCurrentTab ();
sprintf (Gbl.Message,Txt_There_is_no_user_in_X_with_ID_Y_If_you_already_have_an_account_on_Z_,
Cfg_PLATFORM_SHORT_NAME,
Gbl.Usrs.Me.UsrIdLogin,
Cfg_PLATFORM_SHORT_NAME);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
}
/*****************************************************************************/
/**** Check if users exists, if his password is correct, get his data... *****/
/*****************************************************************************/
@ -2614,8 +2424,7 @@ static void Usr_SetUsrRoleAndPrefs (void)
/***** Get my last data *****/
Usr_GetMyLastData ();
if (Gbl.Action.Act == ActAutUsrInt ||
Gbl.Action.Act == ActAutUsrNew ||
Gbl.Action.Act == ActAutUsrExt) // If I just logged in...
Gbl.Action.Act == ActAutUsrNew) // If I just logged in...
{
/***** WhatToSearch is stored in session,
but in login it is got from user's last data *****/
@ -6887,9 +6696,6 @@ void Usr_SeeStudents (void)
/* Put link to go to admin several users */
Enr_PutLinkToAdminSeveralUsrs (Rol_STUDENT);
/* Put link to list official students */
Usr_PutLinkToListOfficialStudents ();
/* Put link to edit record fields */
Rec_PutLinkToEditRecordFields ();
@ -7257,26 +7063,6 @@ static void Usr_ShowTchsAllDataParams (void)
Usr_PutExtraParamsUsrList (ActLstTchAll);
}
/*****************************************************************************/
/******************* Put a link to list official students ********************/
/*****************************************************************************/
static void Usr_PutLinkToListOfficialStudents (void)
{
extern const char *Txt_Official_students;
bool ExternalUsrsServiceAvailable = (Cfg_EXTERNAL_LOGIN_CLIENT_COMMAND[0] != '\0');
if (ExternalUsrsServiceAvailable && // There is an external service for authentication and official lists
Gbl.Imported.ExternalUsrId[0] && // I was authenticated from external service...
Gbl.Imported.ExternalSesId[0] &&
Gbl.Imported.ExternalRole == Rol_TEACHER) // ...as a teacher
/***** Link to list official students *****/
Lay_PutContextualLink (ActGetExtLstStd,NULL,
"list64x64.gif",
Txt_Official_students,Txt_Official_students,
NULL);
}
/*****************************************************************************/
/************* Draw class photo with guests ready to be printed **************/
/*****************************************************************************/

View File

@ -69,7 +69,7 @@ cp -f /home/acanas/swad/swad/soap/swad.wsdl /var/www/html/ws/
The makefile must include -lgsoap, and compile soapC.c and soapServer.c files generated by soapcpp2 in step 2
Example of Makefile:
---------------------
OBJS = swad.o swad_action.o swad_assignment.o swad_file_browser.o swad_chat.o swad_connected.o swad_course.o swad_cryptography.o swad_centre.o swad_date.o swad_database.o swad_degree.o swad_department.o swad_exam.o swad_file.o swad_forum.o swad_group.o swad_holiday.o swad_import.o swad_institution.o swad_layout.o swad_link.o swad_changelog.o swad_message.o swad_notice.o swad_notification.o swad_pagination.o swad_parameter.o swad_place.o swad_plugin.o swad_preference.o swad_record.o swad_session.o swad_statistic.o swad_string.o swad_syllabus.o swad_theme.o swad_test.o swad_timetable.o swad_text.o swad_user.o swad_web_service.o sha2.o
OBJS = list of swad object files
SOAPOBJS = soap/soapC.o soap/soapServer.o
CC = gcc