From 49dacdeb2b06006b304dea2f4829a841ed36e01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 5 Mar 2015 01:55:46 +0100 Subject: [PATCH] Version 14.77 --- swad_action.c | 14 ++-- swad_action.h | 181 ++++++++++++++++++++++++----------------------- swad_changelog.h | 3 +- swad_config.h | 4 +- swad_nickname.c | 1 + swad_parameter.c | 22 +++++- swad_record.c | 106 ++++++++++++++++----------- swad_record.h | 6 +- swad_text.c | 44 +++++++++++- swad_user.c | 35 +++++++++ swad_user.h | 2 + 11 files changed, 271 insertions(+), 147 deletions(-) diff --git a/swad_action.c b/swad_action.c index c9a9b54ae..260acdda2 100644 --- a/swad_action.c +++ b/swad_action.c @@ -849,6 +849,7 @@ Users: 640. ActSeeSignUpReq Show pending requests for inscription in the current course 641. ActReqMdfSevUsr Request the enrollment/removing of several students to / from current course 642. ActLstCon List connected users + ---. ActSeeUsr Show another user's profile 643. ActChgGrp Change my groups 644. ActReqEdiGrp Request the edition of groups @@ -877,8 +878,8 @@ Users: 666. ActLstInvAll List in another window the full data of guests 667. ActLstStdAll List in another window the full data of students 668. ActLstTchAll List in another window the full data of teachers - 669. ActSeeRecOneStd Show records of one selected student - 670. ActSeeRecOneTch Show records of one selected teacher + 669. ActSeeRecOneStd Show record of one selected student + 670. ActSeeRecOneTch Show record of one selected teacher 671. ActSeeRecSevInv Show records of several selected guests 672. ActSeeRecSevStd Show records of several selected students 673. ActSeeRecSevTch Show records of several selected teachers @@ -1335,7 +1336,8 @@ const struct Act_Menu Act_Menu[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = {ActSeeSignUpReq ,false}, {ActReqMdfSevUsr ,true }, - {ActLstCon ,true }, + {ActLstCon ,false}, + {ActSeeUsr ,true }, }, // TabMsg ********** { @@ -2205,6 +2207,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSeeSignUpReq */{1057, 7,TabUsr,ActSeeSignUpReq ,0x1F0,0x1F0,0x1F0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ShowEnrollmentRequests ,"enrollmentrequest" }, /* ActReqMdfSevUsr */{ 797, 8,TabUsr,ActReqMdfSevUsr ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqAdminUsrs ,"configs" }, /* ActLstCon */{ 995, 9,TabUsr,ActLstCon ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Con_ShowConnectedUsrs ,"userplugged" }, + /* ActSeeUsr */{1401,10,TabUsr,ActSeeUsr ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Usr_ShowUser ,"prf" }, // Actions not in menu: /* ActChgGrp */{ 118,-1,TabUsr,ActReqSelGrp ,0x118,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Grp_ChangeMyGrpsAndShowChanges ,NULL}, @@ -2238,8 +2241,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActLstStdAll */{ 42,-1,TabUsr,ActLstStd ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_NEW_WINDOW ,NULL ,Usr_ListAllDataStds ,NULL}, /* ActLstTchAll */{ 578,-1,TabUsr,ActLstTch ,0x1F0,0x1F0,0x1E0,Act_CONTENT_NORM,Act_NEW_WINDOW ,NULL ,Usr_ListAllDataTchs ,NULL}, - /* ActSeeRecOneStd */{1174,-1,TabUsr,ActLstStd ,0x118,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ListRecordOneStdCrs ,NULL}, - /* ActSeeRecOneTch */{1175,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ListRecordOneTchCrs ,NULL}, + /* ActSeeRecOneStd */{1174,-1,TabUsr,ActLstStd ,0x118,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_GetUsrAndShowRecordOneStdCrs ,NULL}, + /* ActSeeRecOneTch */{1175,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_GetUsrAndShowRecordOneTchCrs ,NULL}, /* ActSeeRecSevInv */{1187,-1,TabUsr,ActLstInv ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ListRecordsInvs ,NULL}, /* ActSeeRecSevStd */{ 89,-1,TabUsr,ActLstStd ,0x118,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ListRecordsStdsCrs ,NULL}, /* ActSeeRecSevTch */{ 22,-1,TabUsr,ActLstTch ,0x1FF,0x1FF,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ListRecordsTchsCrs ,NULL}, @@ -4042,6 +4045,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActReqDatComIns, // #1398 ActChgDatComIns, // #1399 ActDowComIns, // #1400 + ActSeeUsr, // #1401 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index c5a7577da..46f2a6a5e 100644 --- a/swad_action.h +++ b/swad_action.h @@ -69,9 +69,9 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (7+52+15+90+73+68+204+184+98+168+28+75) +#define Act_NUM_ACTIONS (7+52+15+90+73+68+204+184+99+168+28+75) -#define Act_MAX_ACTION_COD 1400 +#define Act_MAX_ACTION_COD 1401 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 @@ -877,106 +877,107 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActSeeSignUpReq (ActChgNumRowFooGrp+ 8) #define ActReqMdfSevUsr (ActChgNumRowFooGrp+ 9) #define ActLstCon (ActChgNumRowFooGrp+10) +#define ActSeeUsr (ActChgNumRowFooGrp+11) // Secondary actions -#define ActChgGrp (ActChgNumRowFooGrp+11) -#define ActReqEdiGrp (ActChgNumRowFooGrp+12) -#define ActNewGrpTyp (ActChgNumRowFooGrp+13) -#define ActReqRemGrpTyp (ActChgNumRowFooGrp+14) -#define ActRemGrpTyp (ActChgNumRowFooGrp+15) -#define ActRenGrpTyp (ActChgNumRowFooGrp+16) -#define ActChgMdtGrpTyp (ActChgNumRowFooGrp+17) -#define ActChgMulGrpTyp (ActChgNumRowFooGrp+18) -#define ActChgTimGrpTyp (ActChgNumRowFooGrp+19) -#define ActNewGrp (ActChgNumRowFooGrp+20) -#define ActReqRemGrp (ActChgNumRowFooGrp+21) -#define ActRemGrp (ActChgNumRowFooGrp+22) -#define ActOpeGrp (ActChgNumRowFooGrp+23) -#define ActCloGrp (ActChgNumRowFooGrp+24) -#define ActEnaFilZonGrp (ActChgNumRowFooGrp+25) -#define ActDisFilZonGrp (ActChgNumRowFooGrp+26) -#define ActChgGrpTyp (ActChgNumRowFooGrp+27) -#define ActRenGrp (ActChgNumRowFooGrp+28) -#define ActChgMaxStdGrp (ActChgNumRowFooGrp+29) +#define ActChgGrp (ActChgNumRowFooGrp+12) +#define ActReqEdiGrp (ActChgNumRowFooGrp+13) +#define ActNewGrpTyp (ActChgNumRowFooGrp+14) +#define ActReqRemGrpTyp (ActChgNumRowFooGrp+15) +#define ActRemGrpTyp (ActChgNumRowFooGrp+16) +#define ActRenGrpTyp (ActChgNumRowFooGrp+17) +#define ActChgMdtGrpTyp (ActChgNumRowFooGrp+18) +#define ActChgMulGrpTyp (ActChgNumRowFooGrp+19) +#define ActChgTimGrpTyp (ActChgNumRowFooGrp+20) +#define ActNewGrp (ActChgNumRowFooGrp+21) +#define ActReqRemGrp (ActChgNumRowFooGrp+22) +#define ActRemGrp (ActChgNumRowFooGrp+23) +#define ActOpeGrp (ActChgNumRowFooGrp+24) +#define ActCloGrp (ActChgNumRowFooGrp+25) +#define ActEnaFilZonGrp (ActChgNumRowFooGrp+26) +#define ActDisFilZonGrp (ActChgNumRowFooGrp+27) +#define ActChgGrpTyp (ActChgNumRowFooGrp+28) +#define ActRenGrp (ActChgNumRowFooGrp+29) +#define ActChgMaxStdGrp (ActChgNumRowFooGrp+30) -#define ActGetExtLstStd (ActChgNumRowFooGrp+30) -#define ActPrnInvPho (ActChgNumRowFooGrp+31) -#define ActPrnStdPho (ActChgNumRowFooGrp+32) -#define ActPrnTchPho (ActChgNumRowFooGrp+33) -#define ActLstInvAll (ActChgNumRowFooGrp+34) -#define ActLstStdAll (ActChgNumRowFooGrp+35) -#define ActLstTchAll (ActChgNumRowFooGrp+36) -#define ActSeeRecOneStd (ActChgNumRowFooGrp+37) -#define ActSeeRecOneTch (ActChgNumRowFooGrp+38) -#define ActSeeRecSevInv (ActChgNumRowFooGrp+39) -#define ActSeeRecSevStd (ActChgNumRowFooGrp+40) -#define ActSeeRecSevTch (ActChgNumRowFooGrp+41) -#define ActPrnRecSevInv (ActChgNumRowFooGrp+42) -#define ActPrnRecSevStd (ActChgNumRowFooGrp+43) -#define ActPrnRecSevTch (ActChgNumRowFooGrp+44) -#define ActRcvRecOthUsr (ActChgNumRowFooGrp+45) -#define ActEdiRecFie (ActChgNumRowFooGrp+46) -#define ActNewFie (ActChgNumRowFooGrp+47) -#define ActReqRemFie (ActChgNumRowFooGrp+48) -#define ActRemFie (ActChgNumRowFooGrp+49) -#define ActRenFie (ActChgNumRowFooGrp+50) -#define ActChgRowFie (ActChgNumRowFooGrp+51) -#define ActChgVisFie (ActChgNumRowFooGrp+52) +#define ActGetExtLstStd (ActChgNumRowFooGrp+31) +#define ActPrnInvPho (ActChgNumRowFooGrp+32) +#define ActPrnStdPho (ActChgNumRowFooGrp+33) +#define ActPrnTchPho (ActChgNumRowFooGrp+34) +#define ActLstInvAll (ActChgNumRowFooGrp+35) +#define ActLstStdAll (ActChgNumRowFooGrp+36) +#define ActLstTchAll (ActChgNumRowFooGrp+37) +#define ActSeeRecOneStd (ActChgNumRowFooGrp+38) +#define ActSeeRecOneTch (ActChgNumRowFooGrp+39) +#define ActSeeRecSevInv (ActChgNumRowFooGrp+40) +#define ActSeeRecSevStd (ActChgNumRowFooGrp+41) +#define ActSeeRecSevTch (ActChgNumRowFooGrp+42) +#define ActPrnRecSevInv (ActChgNumRowFooGrp+43) +#define ActPrnRecSevStd (ActChgNumRowFooGrp+44) +#define ActPrnRecSevTch (ActChgNumRowFooGrp+45) +#define ActRcvRecOthUsr (ActChgNumRowFooGrp+46) +#define ActEdiRecFie (ActChgNumRowFooGrp+47) +#define ActNewFie (ActChgNumRowFooGrp+48) +#define ActReqRemFie (ActChgNumRowFooGrp+49) +#define ActRemFie (ActChgNumRowFooGrp+50) +#define ActRenFie (ActChgNumRowFooGrp+51) +#define ActChgRowFie (ActChgNumRowFooGrp+52) +#define ActChgVisFie (ActChgNumRowFooGrp+53) -#define ActReqLstAttStd (ActChgNumRowFooGrp+53) -#define ActSeeLstAttStd (ActChgNumRowFooGrp+54) -#define ActPrnLstAttStd (ActChgNumRowFooGrp+55) -#define ActFrmNewAtt (ActChgNumRowFooGrp+56) -#define ActEdiOneAtt (ActChgNumRowFooGrp+57) -#define ActNewAtt (ActChgNumRowFooGrp+58) -#define ActChgAtt (ActChgNumRowFooGrp+59) -#define ActReqRemAtt (ActChgNumRowFooGrp+60) -#define ActRemAtt (ActChgNumRowFooGrp+61) -#define ActHidAtt (ActChgNumRowFooGrp+62) -#define ActShoAtt (ActChgNumRowFooGrp+63) -#define ActSeeOneAtt (ActChgNumRowFooGrp+64) -#define ActRecAttStd (ActChgNumRowFooGrp+65) -#define ActRecAttMe (ActChgNumRowFooGrp+66) +#define ActReqLstAttStd (ActChgNumRowFooGrp+54) +#define ActSeeLstAttStd (ActChgNumRowFooGrp+55) +#define ActPrnLstAttStd (ActChgNumRowFooGrp+56) +#define ActFrmNewAtt (ActChgNumRowFooGrp+57) +#define ActEdiOneAtt (ActChgNumRowFooGrp+58) +#define ActNewAtt (ActChgNumRowFooGrp+59) +#define ActChgAtt (ActChgNumRowFooGrp+60) +#define ActReqRemAtt (ActChgNumRowFooGrp+61) +#define ActRemAtt (ActChgNumRowFooGrp+62) +#define ActHidAtt (ActChgNumRowFooGrp+63) +#define ActShoAtt (ActChgNumRowFooGrp+64) +#define ActSeeOneAtt (ActChgNumRowFooGrp+65) +#define ActRecAttStd (ActChgNumRowFooGrp+66) +#define ActRecAttMe (ActChgNumRowFooGrp+67) -#define ActSignUp (ActChgNumRowFooGrp+67) -#define ActReqRejSignUp (ActChgNumRowFooGrp+68) -#define ActRejSignUp (ActChgNumRowFooGrp+69) +#define ActSignUp (ActChgNumRowFooGrp+68) +#define ActReqRejSignUp (ActChgNumRowFooGrp+69) +#define ActRejSignUp (ActChgNumRowFooGrp+70) -#define ActReqMdfOneUsr (ActChgNumRowFooGrp+70) -#define ActReqMdfUsr (ActChgNumRowFooGrp+71) +#define ActReqMdfOneUsr (ActChgNumRowFooGrp+71) +#define ActReqMdfUsr (ActChgNumRowFooGrp+72) -#define ActReqUsrPho (ActChgNumRowFooGrp+72) -#define ActDetUsrPho (ActChgNumRowFooGrp+73) -#define ActUpdUsrPho (ActChgNumRowFooGrp+74) -#define ActRemUsrPho (ActChgNumRowFooGrp+75) -#define ActCreOthUsrDat (ActChgNumRowFooGrp+76) -#define ActUpdOthUsrDat (ActChgNumRowFooGrp+77) +#define ActReqUsrPho (ActChgNumRowFooGrp+73) +#define ActDetUsrPho (ActChgNumRowFooGrp+74) +#define ActUpdUsrPho (ActChgNumRowFooGrp+75) +#define ActRemUsrPho (ActChgNumRowFooGrp+76) +#define ActCreOthUsrDat (ActChgNumRowFooGrp+77) +#define ActUpdOthUsrDat (ActChgNumRowFooGrp+78) -#define ActReqAccEnrCrs (ActChgNumRowFooGrp+78) -#define ActAccEnrCrs (ActChgNumRowFooGrp+79) -#define ActRemMeCrs (ActChgNumRowFooGrp+80) +#define ActReqAccEnrCrs (ActChgNumRowFooGrp+79) +#define ActAccEnrCrs (ActChgNumRowFooGrp+80) +#define ActRemMeCrs (ActChgNumRowFooGrp+81) -#define ActNewAdmIns (ActChgNumRowFooGrp+81) -#define ActRemAdmIns (ActChgNumRowFooGrp+82) -#define ActNewAdmCtr (ActChgNumRowFooGrp+83) -#define ActRemAdmCtr (ActChgNumRowFooGrp+84) -#define ActNewAdmDeg (ActChgNumRowFooGrp+85) -#define ActRemAdmDeg (ActChgNumRowFooGrp+86) +#define ActNewAdmIns (ActChgNumRowFooGrp+82) +#define ActRemAdmIns (ActChgNumRowFooGrp+83) +#define ActNewAdmCtr (ActChgNumRowFooGrp+84) +#define ActRemAdmCtr (ActChgNumRowFooGrp+85) +#define ActNewAdmDeg (ActChgNumRowFooGrp+86) +#define ActRemAdmDeg (ActChgNumRowFooGrp+87) -#define ActRcvFrmMdfUsrCrs (ActChgNumRowFooGrp+87) -#define ActFrmIDsOthUsr (ActChgNumRowFooGrp+88) -#define ActRemIDOth (ActChgNumRowFooGrp+89) -#define ActNewIDOth (ActChgNumRowFooGrp+90) -#define ActFrmPwdOthUsr (ActChgNumRowFooGrp+91) -#define ActChgPwdOthUsr (ActChgNumRowFooGrp+92) -#define ActRemUsrCrs (ActChgNumRowFooGrp+93) -#define ActRemUsrGbl (ActChgNumRowFooGrp+94) +#define ActRcvFrmMdfUsrCrs (ActChgNumRowFooGrp+88) +#define ActFrmIDsOthUsr (ActChgNumRowFooGrp+89) +#define ActRemIDOth (ActChgNumRowFooGrp+90) +#define ActNewIDOth (ActChgNumRowFooGrp+91) +#define ActFrmPwdOthUsr (ActChgNumRowFooGrp+92) +#define ActChgPwdOthUsr (ActChgNumRowFooGrp+93) +#define ActRemUsrCrs (ActChgNumRowFooGrp+94) +#define ActRemUsrGbl (ActChgNumRowFooGrp+95) -#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+95) -#define ActRemAllStdCrs (ActChgNumRowFooGrp+96) +#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+96) +#define ActRemAllStdCrs (ActChgNumRowFooGrp+97) -#define ActReqRemOldUsr (ActChgNumRowFooGrp+97) -#define ActRemOldUsr (ActChgNumRowFooGrp+98) +#define ActReqRemOldUsr (ActChgNumRowFooGrp+98) +#define ActRemOldUsr (ActChgNumRowFooGrp+99) /*****************************************************************************/ /******************************* Messages tab ********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 655a37e2f..e3883733c 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,11 +103,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.76.5 (2015/03/03)" +#define Log_PLATFORM_VERSION "SWAD 14.77 (2015/03/04)" // 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 | tail -1 /* + Version 14.77 : Mar 04, 2015 New parameter "UsrNick" to go to a user. (178406 lines) Version 14.76.5: Mar 03, 2015 Added new social networks, suggested by Marta Gómez Macías. (178293 lines) 1 change necessary in database: ALTER TABLE usr_webs CHANGE Web Web ENUM('www','500px','delicious','deviantart','edmodo','facebook','flickr','foursquare','github','googleplus','googlescholar','instagram','linkedin','paperli','pinterest','researchgate','scoopit','slideshare','storify','tumblr','twitter','wikipedia','youtube') NOT NULL; diff --git a/swad_config.h b/swad_config.h index f07b7d8da..708bd81e4 100644 --- a/swad_config.h +++ b/swad_config.h @@ -28,9 +28,9 @@ /** Uncomment one of the following installations of SWAD or create your own **/ /*****************************************************************************/ -//#define LOCALHOST_UBUNTU // 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 SWAD_UGR_ES // Comment this line if not applicable //#define WWW_CEVUNA_UNA_PY // Comment this line if not applicable /*****************************************************************************/ diff --git a/swad_nickname.c b/swad_nickname.c index 821df0e4c..e473de512 100644 --- a/swad_nickname.c +++ b/swad_nickname.c @@ -135,6 +135,7 @@ bool Nck_GetNicknameFromUsrCod (long UsrCod,char *Nickname) /*****************************************************************************/ /************** Get user's code of a user from his/her nickname **************/ /*****************************************************************************/ +// Nickname may have leading '@' // Returns true if nickname found in database long Nck_GetUsrCodFromNickname (const char *Nickname) diff --git a/swad_parameter.c b/swad_parameter.c index 3c40fe301..bcc823a7c 100644 --- a/swad_parameter.c +++ b/swad_parameter.c @@ -132,11 +132,14 @@ void Par_GetMainParameters (void) extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS]; char UnsignedStr[10+1]; unsigned UnsignedNum; + char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA + 1]; + long OtherUsrCod; char LongStr[1+10+1]; char YearStr[2+1]; Lay_Layout_t LayoutFromForm; - /***** Reset codes of institution, degree and course *****/ + /***** Reset codes of country, institution, centre, degree and course *****/ + Gbl.CurrentCty.Cty.CtyCod = Gbl.CurrentIns.Ins.InsCod = Gbl.CurrentCtr.Ctr.CtrCod = Gbl.CurrentDeg.Deg.DegCod = @@ -260,7 +263,6 @@ void Par_GetMainParameters (void) { Gbl.CurrentCtr.Ctr.CtrCod = Str_ConvertStrCodToLongCod (LongStr); Gbl.YearOK = false; - Gbl.CurrentIns.Ins.InsCod = Gbl.CurrentDeg.Deg.DegCod = Gbl.CurrentCrs.Crs.CrsCod = -1L; } @@ -283,6 +285,7 @@ void Par_GetMainParameters (void) Gbl.CurrentCrs.Crs.CrsCod = -1L; // Reset possible course from session } else + Gbl.CurrentCty.Cty.CtyCod = Gbl.CurrentIns.Ins.InsCod = Gbl.CurrentCtr.Ctr.CtrCod = Gbl.CurrentDeg.Deg.DegCod = @@ -294,6 +297,20 @@ void Par_GetMainParameters (void) if (LongStr[0]) // Parameter CrsCod available Gbl.CurrentCrs.Crs.CrsCod = Str_ConvertStrCodToLongCod (LongStr); // Overwrite CrsCod from session + /***** Get user's nickname, if exists + (this nickname is used to go to a user's profile, not to get the logged user) *****/ + Par_GetParToText ("UsrNick",Nickname,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA); + if ((OtherUsrCod = Nck_GetUsrCodFromNickname (Nickname)) > 0) + { + Gbl.Usrs.Other.UsrDat.UsrCod = OtherUsrCod; + Gbl.CurrentAct = ActSeeUsr; + Gbl.CurrentCty.Cty.CtyCod = + Gbl.CurrentIns.Ins.InsCod = + Gbl.CurrentCtr.Ctr.CtrCod = + Gbl.CurrentDeg.Deg.DegCod = + Gbl.CurrentCrs.Crs.CrsCod = -1L; + } + /***** Get tab to activate *****/ Gbl.CurrentTab = TabUnk; if (Gbl.CurrentAct == ActMnu) @@ -400,6 +417,7 @@ static unsigned Par_GetParameter (tParamType ParamType,const char *ParamName, strcmp (ParamName,"CtrCod" ) && // To enter directly to a centre strcmp (ParamName,"DegCod" ) && // To enter directly to a degree strcmp (ParamName,"CrsCod" ) && // To enter directly to a course + strcmp (ParamName,"UsrNick") && // To enter directly to a user strcmp (ParamName,"ActCod" ) && // To execute directly an action (allowed only for fully public actions) strcmp (ParamName,"Layout" ) && // To change the layout of the page (wide or narrow) strcmp (ParamName,"IdSes" ) && // To use an open session when redirecting from one language to another diff --git a/swad_record.c b/swad_record.c index 48e734052..c17b99427 100644 --- a/swad_record.c +++ b/swad_record.c @@ -971,18 +971,34 @@ void Rec_ListRecordsInvs (void) Usr_FreeListsEncryptedUsrCods (); } +/*****************************************************************************/ +/********** Get user's data and draw record of one unique student ************/ +/*****************************************************************************/ + +void Rec_GetUsrAndShowRecordOneStdCrs (void) + { + /***** Get the selected student *****/ + Usr_GetParamOtherUsrCodEncrypted (); + + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the student + if ((Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = + Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod, + Gbl.Usrs.Other.UsrDat.UsrCod)) == Rol_ROLE_STUDENT) + Rec_ShowRecordOneStdCrs (); + } + /*****************************************************************************/ /******************** Draw record of one unique student **********************/ /*****************************************************************************/ -void Rec_ListRecordOneStdCrs (void) +void Rec_ShowRecordOneStdCrs (void) { + /***** Get if student has accepted enrollment in current course *****/ + Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod); + /***** Asign users listing type depending on current action *****/ Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_STUDENTS; - /***** Get the selected student *****/ - Usr_GetParamOtherUsrCodEncrypted (); - /***** Get list of fields of records in current course *****/ Rec_GetListRecordFieldsInCurrentCrs (); @@ -1000,24 +1016,18 @@ void Rec_ListRecordOneStdCrs (void) ""); /***** Show the record *****/ - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the student - if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod)) - { - Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod); + fprintf (Gbl.F.Out,"
"); - fprintf (Gbl.F.Out,"
"); + /* Common record */ + Rec_ShowCommonRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); - /* Common record */ - Rec_ShowCommonRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); + /* Record of the student in the course */ + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && + Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record + Rec_ShowCrsRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); - /* Record of the student in the course */ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && - Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record - Rec_ShowCrsRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); - - fprintf (Gbl.F.Out,"
"); - } + fprintf (Gbl.F.Out,"
"); } /*****************************************************************************/ @@ -1116,20 +1126,37 @@ void Rec_ListRecordsStdsCrs (void) Usr_FreeListsEncryptedUsrCods (); } +/*****************************************************************************/ +/********** Get user's data and draw record of one unique teacher ************/ +/*****************************************************************************/ + +void Rec_GetUsrAndShowRecordOneTchCrs (void) + { + /***** Get the selected teacher *****/ + Usr_GetParamOtherUsrCodEncrypted (); + + /***** Show the record *****/ + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the teacher + if ((Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = + Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod, + Gbl.Usrs.Other.UsrDat.UsrCod)) == Rol_ROLE_TEACHER) + Rec_ShowRecordOneTchCrs (); + } + /*****************************************************************************/ /******************** Draw record of one unique teacher **********************/ /*****************************************************************************/ -void Rec_ListRecordOneTchCrs (void) +void Rec_ShowRecordOneTchCrs (void) { extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES]; + /***** Get if teacher has accepted enrollment in current course *****/ + Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod); + /***** Asign users listing type depending on current action *****/ Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_TEACHERS; - /***** Get the selected teacher *****/ - Usr_GetParamOtherUsrCodEncrypted (); - fprintf (Gbl.F.Out,"
"); /***** Show office hours? *****/ @@ -1144,29 +1171,22 @@ void Rec_ListRecordOneTchCrs (void) fprintf (Gbl.F.Out,"" "
"); - /***** Show the record *****/ - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the teacher - if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod)) - { - Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod); + fprintf (Gbl.F.Out,"
"); - fprintf (Gbl.F.Out,"
"); + /* Common record */ + Rec_ShowCommonRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); - /* Common record */ - Rec_ShowCommonRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); + /* Office hours */ + Lay_StartRoundFrameTable10 (NULL,0,Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE]); + fprintf (Gbl.F.Out,"" + ""); + TT_ShowTimeTable (TT_TUTOR_TIMETABLE,Gbl.Usrs.Other.UsrDat.UsrCod); + fprintf (Gbl.F.Out,"" + ""); + Lay_EndRoundFrameTable10 (); - /* Office hours */ - Lay_StartRoundFrameTable10 (NULL,0,Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE]); - fprintf (Gbl.F.Out,"" - ""); - TT_ShowTimeTable (TT_TUTOR_TIMETABLE,Gbl.Usrs.Other.UsrDat.UsrCod); - fprintf (Gbl.F.Out,"" - ""); - Lay_EndRoundFrameTable10 (); - - fprintf (Gbl.F.Out,"
"); - } + fprintf (Gbl.F.Out,"
"); } /*****************************************************************************/ diff --git a/swad_record.h b/swad_record.h index 9d83eb2da..cdcab395f 100644 --- a/swad_record.h +++ b/swad_record.h @@ -120,9 +120,11 @@ void Rec_FreeListFields (void); void Rec_PutLinkToEditRecordFields (void); void Rec_ListRecordsInvs (void); -void Rec_ListRecordOneStdCrs (void); +void Rec_GetUsrAndShowRecordOneStdCrs (void); +void Rec_ShowRecordOneStdCrs (void); void Rec_ListRecordsStdsCrs (void); -void Rec_ListRecordOneTchCrs (void); +void Rec_GetUsrAndShowRecordOneTchCrs (void); +void Rec_ShowRecordOneTchCrs (void); void Rec_ListRecordsTchsCrs (void); void Rec_ShowLinkToPrintPreviewOfRecords (void); void Rec_ShowFormMyCrsRecord (void); diff --git a/swad_text.c b/swad_text.c index f6ad19b93..11057ba70 100644 --- a/swad_text.c +++ b/swad_text.c @@ -17339,7 +17339,27 @@ const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Conectados" #endif , - NULL, + // ActSeeUsr +#if L==0 + "Perfil" +#elif L==1 + "Profil" +#elif L==2 + "Profile" +#elif L==3 + "Perfil" +#elif L==4 + "Profil" +#elif L==5 + "Che" +#elif L==6 + "Profilo" +#elif L==7 + "Profil" +#elif L==8 + "Perfil" +#endif + , NULL, NULL, NULL, @@ -19315,7 +19335,27 @@ const char *Txt_MENU_SUBTITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Conectados" #endif , - NULL, + // ActSeeUsr +#if L==0 + "Perfil" +#elif L==1 + "Profil" +#elif L==2 + "A user's profile" +#elif L==3 + "Perfil de un usuario" +#elif L==4 + "Profil" +#elif L==5 + "Che" +#elif L==6 + "Profilo" +#elif L==7 + "Profil" +#elif L==8 + "Perfil" +#endif + , NULL, NULL, NULL, diff --git a/swad_user.c b/swad_user.c index 7ecfa2eea..9be178af4 100644 --- a/swad_user.c +++ b/swad_user.c @@ -7356,3 +7356,38 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role) return NumUsrsPerCrs; } + +/*****************************************************************************/ +/***************************** Show user's profile ***************************/ +/*****************************************************************************/ + +void Usr_ShowUser (void) + { + /***** Get user *****/ + if (Gbl.Usrs.Other.UsrDat.UsrCod < 0) // Check is user's code is valid + Usr_GetParamOtherUsrCodEncrypted (); + + sprintf (Gbl.Message,"Gbl.Usrs.Other.UsrDat.UsrCod = %ld",Gbl.Usrs.Other.UsrDat.UsrCod); + Lay_ShowAlert (Lay_INFO,Gbl.Message); + + /***** Check if user exists and get his data *****/ + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user + { + if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected + { + Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); + + switch (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB) + { + case Rol_ROLE_STUDENT: + Rec_ShowRecordOneStdCrs (); + break; + case Rol_ROLE_TEACHER: + Rec_ShowRecordOneTchCrs (); + break; + default: + break; + } + } + } + } diff --git a/swad_user.h b/swad_user.h index 5c8ed96e4..ae3606cb9 100644 --- a/swad_user.h +++ b/swad_user.h @@ -321,4 +321,6 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role); void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role); +void Usr_ShowUser (void); + #endif