mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-16 13:44:06 +02:00
Version 23.26.1: Oct 05, 2023 Code refactoring.
This commit is contained in:
parent
404b44356e
commit
33b2b50c3c
|
@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
|
||||||
Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
|
Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
|
||||||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 23.26 (2023-10-04)"
|
#define Log_PLATFORM_VERSION "SWAD 23.26.1 (2023-10-05)"
|
||||||
#define CSS_FILE "swad23.25.2.css"
|
#define CSS_FILE "swad23.25.2.css"
|
||||||
#define JS_FILE "swad22.49.js"
|
#define JS_FILE "swad22.49.js"
|
||||||
/*
|
/*
|
||||||
|
Version 23.26.1: Oct 05, 2023 Code refactoring. (335938 lines)
|
||||||
Version 23.26: Oct 04, 2023 Code refactoring in forum stats. (335965 lines)
|
Version 23.26: Oct 04, 2023 Code refactoring in forum stats. (335965 lines)
|
||||||
Version 23.25.4: Oct 03, 2023 Code refactoring. (336036 lines)
|
Version 23.25.4: Oct 03, 2023 Code refactoring. (336036 lines)
|
||||||
Version 23.25.3: Oct 03, 2023 Code refactoring in user's hierarchy. (336222 lines)
|
Version 23.25.3: Oct 03, 2023 Code refactoring in user's hierarchy. (336222 lines)
|
||||||
|
|
|
@ -1144,6 +1144,17 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
|
||||||
void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
|
void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
|
||||||
struct Ind_IndicatorsCrs *IndicatorsCrs)
|
struct Ind_IndicatorsCrs *IndicatorsCrs)
|
||||||
{
|
{
|
||||||
|
long HieCod[Hie_NUM_LEVELS] =
|
||||||
|
{
|
||||||
|
[Hie_UNK] = -1L,
|
||||||
|
[Hie_SYS] = -1L,
|
||||||
|
[Hie_CTY] = -1L,
|
||||||
|
[Hie_INS] = -1L,
|
||||||
|
[Hie_CTR] = -1L,
|
||||||
|
[Hie_DEG] = -1L,
|
||||||
|
[Hie_CRS] = Gbl.Hierarchy.Node[Hie_CRS].HieCod,
|
||||||
|
};
|
||||||
|
|
||||||
/***** Initialize number of indicators *****/
|
/***** Initialize number of indicators *****/
|
||||||
IndicatorsCrs->NumIndicators = 0;
|
IndicatorsCrs->NumIndicators = 0;
|
||||||
|
|
||||||
|
@ -1172,8 +1183,8 @@ void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
|
||||||
IndicatorsCrs->NumIndicators++;
|
IndicatorsCrs->NumIndicators++;
|
||||||
|
|
||||||
/***** Indicator #3: information about online tutoring *****/
|
/***** Indicator #3: information about online tutoring *****/
|
||||||
IndicatorsCrs->NumThreads = For_DB_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod);
|
IndicatorsCrs->NumThreads = For_DB_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,HieCod);
|
||||||
IndicatorsCrs->NumPosts = For_DB_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod,&(IndicatorsCrs->NumUsrsToBeNotifiedByEMail));
|
IndicatorsCrs->NumPosts = For_DB_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,HieCod,&(IndicatorsCrs->NumUsrsToBeNotifiedByEMail));
|
||||||
IndicatorsCrs->NumMsgsSentByTchs = Msg_DB_GetNumMsgsSentByTchsCrs (CrsCod);
|
IndicatorsCrs->NumMsgsSentByTchs = Msg_DB_GetNumMsgsSentByTchsCrs (CrsCod);
|
||||||
IndicatorsCrs->ThereIsOnlineTutoring = (IndicatorsCrs->NumThreads != 0) ||
|
IndicatorsCrs->ThereIsOnlineTutoring = (IndicatorsCrs->NumThreads != 0) ||
|
||||||
(IndicatorsCrs->NumPosts != 0) ||
|
(IndicatorsCrs->NumPosts != 0) ||
|
||||||
|
|
|
@ -283,8 +283,7 @@ void Mch_ListMatches (struct Gam_Games *Games,
|
||||||
if (Gbl.Crs.Grps.NumGrps)
|
if (Gbl.Crs.Grps.NumGrps)
|
||||||
{
|
{
|
||||||
Set_BeginSettingsHead ();
|
Set_BeginSettingsHead ();
|
||||||
Grp_ShowFormToSelWhichGrps (ActSeeOneGam,
|
Grp_ShowFormToSelWhichGrps (ActSeeOneGam,Gam_PutPars,Games);
|
||||||
Gam_PutPars,Games);
|
|
||||||
Set_EndSettingsHead ();
|
Set_EndSettingsHead ();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2985,7 +2985,7 @@ bool Qst_CheckIfQstFormatIsCorrectAndCountNumOptions (struct Qst_Question *Quest
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Its mandatory to mark at least one option as correct */
|
/* Its mandatory to mark at least one option as correct */
|
||||||
for (NumOpt = 0;
|
for (NumOpt = 0;
|
||||||
NumOpt <= NumLastOpt;
|
NumOpt <= NumLastOpt;
|
||||||
NumOpt++)
|
NumOpt++)
|
||||||
if (Question->Answer.Options[NumOpt].Correct)
|
if (Question->Answer.Options[NumOpt].Correct)
|
||||||
|
@ -3010,8 +3010,8 @@ bool Qst_CheckIfQstFormatIsCorrectAndCountNumOptions (struct Qst_Question *Quest
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No option should be empty before a non-empty option */
|
/* No option should be empty before a non-empty option */
|
||||||
for (NumOpt=0, ThereIsEndOfAnswers=false;
|
for (NumOpt = 0, ThereIsEndOfAnswers=false;
|
||||||
NumOpt<Qst_MAX_OPTIONS_PER_QUESTION;
|
NumOpt < Qst_MAX_OPTIONS_PER_QUESTION;
|
||||||
NumOpt++)
|
NumOpt++)
|
||||||
if (Question->Answer.Options[NumOpt].Text)
|
if (Question->Answer.Options[NumOpt].Text)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1924,52 +1924,33 @@ void Svy_ReceiveFormSurvey (void)
|
||||||
/***** Get scope *****/
|
/***** Get scope *****/
|
||||||
Svy_SetAllowedScopes (&NewSvy);
|
Svy_SetAllowedScopes (&NewSvy);
|
||||||
Sco_GetScope ("ScopeSvy",NewSvy.Level);
|
Sco_GetScope ("ScopeSvy",NewSvy.Level);
|
||||||
switch (Gbl.Scope.Current)
|
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||||
{
|
switch (Gbl.Scope.Current)
|
||||||
case Hie_SYS:
|
{
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
case Hie_SYS:
|
||||||
|
case Hie_CTY:
|
||||||
|
default:
|
||||||
Err_WrongHierarchyLevelExit ();
|
Err_WrongHierarchyLevelExit ();
|
||||||
NewSvy.Level = Hie_SYS;
|
break;
|
||||||
NewSvy.HieCod = -1L;
|
case Hie_INS:
|
||||||
break;
|
if (Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
|
||||||
case Hie_CTY:
|
Err_WrongHierarchyLevelExit ();
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
break;
|
||||||
Err_WrongHierarchyLevelExit ();
|
case Hie_CTR:
|
||||||
NewSvy.Level = Hie_CTY;
|
if (Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
|
||||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Hie_CTY].HieCod;
|
Err_WrongHierarchyLevelExit ();
|
||||||
break;
|
break;
|
||||||
case Hie_INS:
|
case Hie_DEG:
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
if (Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM)
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
|
Err_WrongHierarchyLevelExit ();
|
||||||
Err_WrongHierarchyLevelExit ();
|
break;
|
||||||
NewSvy.Level = Hie_INS;
|
case Hie_CRS:
|
||||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Hie_INS].HieCod;
|
if (Gbl.Usrs.Me.Role.Logged != Rol_TCH)
|
||||||
break;
|
Err_WrongHierarchyLevelExit ();
|
||||||
case Hie_CTR:
|
break;
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
}
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
|
NewSvy.Level = Gbl.Scope.Current;
|
||||||
Err_WrongHierarchyLevelExit ();
|
NewSvy.HieCod = Gbl.Hierarchy.Node[Gbl.Scope.Current].HieCod;
|
||||||
NewSvy.Level = Hie_CTR;
|
|
||||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Hie_CTR].HieCod;
|
|
||||||
break;
|
|
||||||
case Hie_DEG:
|
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM)
|
|
||||||
Err_WrongHierarchyLevelExit ();
|
|
||||||
NewSvy.Level = Hie_DEG;
|
|
||||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Hie_DEG].HieCod;
|
|
||||||
break;
|
|
||||||
case Hie_CRS:
|
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_TCH)
|
|
||||||
Err_WrongHierarchyLevelExit ();
|
|
||||||
NewSvy.Level = Hie_CRS;
|
|
||||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Hie_CRS].HieCod;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Err_WrongHierarchyLevelExit ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Get start/end date-times *****/
|
/***** Get start/end date-times *****/
|
||||||
NewSvy.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm (Dat_STR_TIME);
|
NewSvy.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm (Dat_STR_TIME);
|
||||||
|
|
|
@ -499,38 +499,28 @@ static void TmlNot_WriteLocationInHierarchy (const struct TmlNot_Note *Not,
|
||||||
case TmlNot_INS_DOC_PUB_FILE:
|
case TmlNot_INS_DOC_PUB_FILE:
|
||||||
case TmlNot_INS_SHA_PUB_FILE:
|
case TmlNot_INS_SHA_PUB_FILE:
|
||||||
/* Write location (institution) in hierarchy */
|
/* Write location (institution) in hierarchy */
|
||||||
HTM_TxtF ("%s: %s",
|
HTM_TxtF ("%s: %s",Txt_Institution,Hie[Hie_INS].ShrtName);
|
||||||
Txt_Institution,
|
|
||||||
Hie[Hie_INS].ShrtName);
|
|
||||||
break;
|
break;
|
||||||
case TmlNot_CTR_DOC_PUB_FILE:
|
case TmlNot_CTR_DOC_PUB_FILE:
|
||||||
case TmlNot_CTR_SHA_PUB_FILE:
|
case TmlNot_CTR_SHA_PUB_FILE:
|
||||||
/* Write location (center) in hierarchy */
|
/* Write location (center) in hierarchy */
|
||||||
HTM_TxtF ("%s: %s",
|
HTM_TxtF ("%s: %s",Txt_Center,Hie[Hie_CTR].ShrtName);
|
||||||
Txt_Center,
|
|
||||||
Hie[Hie_CTR].ShrtName);
|
|
||||||
break;
|
break;
|
||||||
case TmlNot_DEG_DOC_PUB_FILE:
|
case TmlNot_DEG_DOC_PUB_FILE:
|
||||||
case TmlNot_DEG_SHA_PUB_FILE:
|
case TmlNot_DEG_SHA_PUB_FILE:
|
||||||
/* Write location (degree) in hierarchy */
|
/* Write location (degree) in hierarchy */
|
||||||
HTM_TxtF ("%s: %s",
|
HTM_TxtF ("%s: %s",Txt_Degree,Hie[Hie_DEG].ShrtName);
|
||||||
Txt_Degree,
|
|
||||||
Hie[Hie_DEG].ShrtName);
|
|
||||||
break;
|
break;
|
||||||
case TmlNot_CRS_DOC_PUB_FILE:
|
case TmlNot_CRS_DOC_PUB_FILE:
|
||||||
case TmlNot_CRS_SHA_PUB_FILE:
|
case TmlNot_CRS_SHA_PUB_FILE:
|
||||||
case TmlNot_CALL_FOR_EXAM:
|
case TmlNot_CALL_FOR_EXAM:
|
||||||
case TmlNot_NOTICE:
|
case TmlNot_NOTICE:
|
||||||
/* Write location (course) in hierarchy */
|
/* Write location (course) in hierarchy */
|
||||||
HTM_TxtF ("%s: %s",
|
HTM_TxtF ("%s: %s", Txt_Course,Hie[Hie_CRS].ShrtName);
|
||||||
Txt_Course,
|
|
||||||
Hie[Hie_CRS].ShrtName);
|
|
||||||
break;
|
break;
|
||||||
case TmlNot_FORUM_POST:
|
case TmlNot_FORUM_POST:
|
||||||
/* Write forum name */
|
/* Write forum name */
|
||||||
HTM_TxtF ("%s: %s",
|
HTM_TxtF ("%s: %s",Txt_Forum,ForumName);
|
||||||
Txt_Forum,
|
|
||||||
ForumName);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -897,32 +887,28 @@ void TmlNot_StoreAndPublishNote (TmlNot_Type_t NoteType,long Cod)
|
||||||
void TmlNot_StoreAndPublishNoteInternal (TmlNot_Type_t NoteType,long Cod,
|
void TmlNot_StoreAndPublishNoteInternal (TmlNot_Type_t NoteType,long Cod,
|
||||||
struct TmlPub_Publication *Pub)
|
struct TmlPub_Publication *Pub)
|
||||||
{
|
{
|
||||||
|
static Hie_Level_t Level[Tml_NOT_NUM_NOTE_TYPES] =
|
||||||
|
{
|
||||||
|
[TmlNot_INS_DOC_PUB_FILE] = Hie_INS,
|
||||||
|
[TmlNot_INS_SHA_PUB_FILE] = Hie_INS,
|
||||||
|
|
||||||
|
[TmlNot_CTR_DOC_PUB_FILE] = Hie_CTR,
|
||||||
|
[TmlNot_CTR_SHA_PUB_FILE] = Hie_CTR,
|
||||||
|
|
||||||
|
[TmlNot_DEG_DOC_PUB_FILE] = Hie_DEG,
|
||||||
|
[TmlNot_DEG_SHA_PUB_FILE] = Hie_DEG,
|
||||||
|
|
||||||
|
[TmlNot_CRS_DOC_PUB_FILE] = Hie_CRS,
|
||||||
|
[TmlNot_CRS_SHA_PUB_FILE] = Hie_CRS,
|
||||||
|
[TmlNot_CALL_FOR_EXAM ] = Hie_CRS,
|
||||||
|
[TmlNot_NOTICE ] = Hie_CRS,
|
||||||
|
};
|
||||||
long HieCod; // Hierarchy code (institution/center/degree/course)
|
long HieCod; // Hierarchy code (institution/center/degree/course)
|
||||||
|
|
||||||
switch (NoteType)
|
if (Level[NoteType])
|
||||||
{
|
HieCod = Gbl.Hierarchy.Node[Level[NoteType]].HieCod;
|
||||||
case TmlNot_INS_DOC_PUB_FILE:
|
else
|
||||||
case TmlNot_INS_SHA_PUB_FILE:
|
HieCod = -1L;
|
||||||
HieCod = Gbl.Hierarchy.Node[Hie_INS].HieCod;
|
|
||||||
break;
|
|
||||||
case TmlNot_CTR_DOC_PUB_FILE:
|
|
||||||
case TmlNot_CTR_SHA_PUB_FILE:
|
|
||||||
HieCod = Gbl.Hierarchy.Node[Hie_CTR].HieCod;
|
|
||||||
break;
|
|
||||||
case TmlNot_DEG_DOC_PUB_FILE:
|
|
||||||
case TmlNot_DEG_SHA_PUB_FILE:
|
|
||||||
HieCod = Gbl.Hierarchy.Node[Hie_DEG].HieCod;
|
|
||||||
break;
|
|
||||||
case TmlNot_CRS_DOC_PUB_FILE:
|
|
||||||
case TmlNot_CRS_SHA_PUB_FILE:
|
|
||||||
case TmlNot_CALL_FOR_EXAM:
|
|
||||||
case TmlNot_NOTICE:
|
|
||||||
HieCod = Gbl.Hierarchy.Node[Hie_CRS].HieCod;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
HieCod = -1L;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Publish note in timeline *****/
|
/***** Publish note in timeline *****/
|
||||||
Pub->PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
Pub->PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
|
|
@ -3847,8 +3847,7 @@ void Usr_ListUsersToSelect (Rol_Role_t Role,struct Usr_SelectedUsrs *SelectedUsr
|
||||||
switch (Gbl.Usrs.Me.ListType)
|
switch (Gbl.Usrs.Me.ListType)
|
||||||
{
|
{
|
||||||
case Set_USR_LIST_AS_CLASS_PHOTO:
|
case Set_USR_LIST_AS_CLASS_PHOTO:
|
||||||
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL,
|
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL,Role,SelectedUsrs,true);
|
||||||
Role,SelectedUsrs,true);
|
|
||||||
break;
|
break;
|
||||||
case Set_USR_LIST_AS_LISTING:
|
case Set_USR_LIST_AS_LISTING:
|
||||||
Usr_ListUsrsForSelection (Role,SelectedUsrs);
|
Usr_ListUsrsForSelection (Role,SelectedUsrs);
|
||||||
|
@ -5322,7 +5321,7 @@ void Usr_SeeTeachers (void)
|
||||||
/***** Contextual menu *****/
|
/***** Contextual menu *****/
|
||||||
Mnu_ContextMenuBegin ();
|
Mnu_ContextMenuBegin ();
|
||||||
Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch); // Admin one teacher
|
Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch); // Admin one teacher
|
||||||
if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||||
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am logged as admin
|
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am logged as admin
|
||||||
{
|
{
|
||||||
Enr_PutLinkToAdminSeveralUsrs (Rol_NET); // Admin several non-editing teachers
|
Enr_PutLinkToAdminSeveralUsrs (Rol_NET); // Admin several non-editing teachers
|
||||||
|
|
Loading…
Reference in New Issue
Block a user