mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-17 05:55:43 +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í?
|
||||
"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 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.25.4: Oct 03, 2023 Code refactoring. (336036 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,
|
||||
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 *****/
|
||||
IndicatorsCrs->NumIndicators = 0;
|
||||
|
||||
|
@ -1172,8 +1183,8 @@ void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
|
|||
IndicatorsCrs->NumIndicators++;
|
||||
|
||||
/***** Indicator #3: information about online tutoring *****/
|
||||
IndicatorsCrs->NumThreads = For_DB_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod);
|
||||
IndicatorsCrs->NumPosts = For_DB_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod,&(IndicatorsCrs->NumUsrsToBeNotifiedByEMail));
|
||||
IndicatorsCrs->NumThreads = For_DB_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,HieCod);
|
||||
IndicatorsCrs->NumPosts = For_DB_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,HieCod,&(IndicatorsCrs->NumUsrsToBeNotifiedByEMail));
|
||||
IndicatorsCrs->NumMsgsSentByTchs = Msg_DB_GetNumMsgsSentByTchsCrs (CrsCod);
|
||||
IndicatorsCrs->ThereIsOnlineTutoring = (IndicatorsCrs->NumThreads != 0) ||
|
||||
(IndicatorsCrs->NumPosts != 0) ||
|
||||
|
|
|
@ -283,8 +283,7 @@ void Mch_ListMatches (struct Gam_Games *Games,
|
|||
if (Gbl.Crs.Grps.NumGrps)
|
||||
{
|
||||
Set_BeginSettingsHead ();
|
||||
Grp_ShowFormToSelWhichGrps (ActSeeOneGam,
|
||||
Gam_PutPars,Games);
|
||||
Grp_ShowFormToSelWhichGrps (ActSeeOneGam,Gam_PutPars,Games);
|
||||
Set_EndSettingsHead ();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -2985,7 +2985,7 @@ bool Qst_CheckIfQstFormatIsCorrectAndCountNumOptions (struct Qst_Question *Quest
|
|||
}
|
||||
|
||||
/* Its mandatory to mark at least one option as correct */
|
||||
for (NumOpt = 0;
|
||||
for (NumOpt = 0;
|
||||
NumOpt <= NumLastOpt;
|
||||
NumOpt++)
|
||||
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 */
|
||||
for (NumOpt=0, ThereIsEndOfAnswers=false;
|
||||
NumOpt<Qst_MAX_OPTIONS_PER_QUESTION;
|
||||
for (NumOpt = 0, ThereIsEndOfAnswers=false;
|
||||
NumOpt < Qst_MAX_OPTIONS_PER_QUESTION;
|
||||
NumOpt++)
|
||||
if (Question->Answer.Options[NumOpt].Text)
|
||||
{
|
||||
|
|
|
@ -1924,52 +1924,33 @@ void Svy_ReceiveFormSurvey (void)
|
|||
/***** Get scope *****/
|
||||
Svy_SetAllowedScopes (&NewSvy);
|
||||
Sco_GetScope ("ScopeSvy",NewSvy.Level);
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case Hie_SYS:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case Hie_SYS:
|
||||
case Hie_CTY:
|
||||
default:
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
NewSvy.Level = Hie_SYS;
|
||||
NewSvy.HieCod = -1L;
|
||||
break;
|
||||
case Hie_CTY:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
NewSvy.Level = Hie_CTY;
|
||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Hie_CTY].HieCod;
|
||||
break;
|
||||
case Hie_INS:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
||||
Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
NewSvy.Level = Hie_INS;
|
||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Hie_INS].HieCod;
|
||||
break;
|
||||
case Hie_CTR:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
||||
Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
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;
|
||||
}
|
||||
break;
|
||||
case Hie_INS:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
break;
|
||||
case Hie_CTR:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
break;
|
||||
case Hie_DEG:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM)
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
break;
|
||||
case Hie_CRS:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_TCH)
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
break;
|
||||
}
|
||||
NewSvy.Level = Gbl.Scope.Current;
|
||||
NewSvy.HieCod = Gbl.Hierarchy.Node[Gbl.Scope.Current].HieCod;
|
||||
|
||||
/***** Get start/end date-times *****/
|
||||
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_SHA_PUB_FILE:
|
||||
/* Write location (institution) in hierarchy */
|
||||
HTM_TxtF ("%s: %s",
|
||||
Txt_Institution,
|
||||
Hie[Hie_INS].ShrtName);
|
||||
HTM_TxtF ("%s: %s",Txt_Institution,Hie[Hie_INS].ShrtName);
|
||||
break;
|
||||
case TmlNot_CTR_DOC_PUB_FILE:
|
||||
case TmlNot_CTR_SHA_PUB_FILE:
|
||||
/* Write location (center) in hierarchy */
|
||||
HTM_TxtF ("%s: %s",
|
||||
Txt_Center,
|
||||
Hie[Hie_CTR].ShrtName);
|
||||
HTM_TxtF ("%s: %s",Txt_Center,Hie[Hie_CTR].ShrtName);
|
||||
break;
|
||||
case TmlNot_DEG_DOC_PUB_FILE:
|
||||
case TmlNot_DEG_SHA_PUB_FILE:
|
||||
/* Write location (degree) in hierarchy */
|
||||
HTM_TxtF ("%s: %s",
|
||||
Txt_Degree,
|
||||
Hie[Hie_DEG].ShrtName);
|
||||
HTM_TxtF ("%s: %s",Txt_Degree,Hie[Hie_DEG].ShrtName);
|
||||
break;
|
||||
case TmlNot_CRS_DOC_PUB_FILE:
|
||||
case TmlNot_CRS_SHA_PUB_FILE:
|
||||
case TmlNot_CALL_FOR_EXAM:
|
||||
case TmlNot_NOTICE:
|
||||
/* Write location (course) in hierarchy */
|
||||
HTM_TxtF ("%s: %s",
|
||||
Txt_Course,
|
||||
Hie[Hie_CRS].ShrtName);
|
||||
HTM_TxtF ("%s: %s", Txt_Course,Hie[Hie_CRS].ShrtName);
|
||||
break;
|
||||
case TmlNot_FORUM_POST:
|
||||
/* Write forum name */
|
||||
HTM_TxtF ("%s: %s",
|
||||
Txt_Forum,
|
||||
ForumName);
|
||||
HTM_TxtF ("%s: %s",Txt_Forum,ForumName);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -897,32 +887,28 @@ void TmlNot_StoreAndPublishNote (TmlNot_Type_t NoteType,long Cod)
|
|||
void TmlNot_StoreAndPublishNoteInternal (TmlNot_Type_t NoteType,long Cod,
|
||||
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)
|
||||
|
||||
switch (NoteType)
|
||||
{
|
||||
case TmlNot_INS_DOC_PUB_FILE:
|
||||
case TmlNot_INS_SHA_PUB_FILE:
|
||||
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;
|
||||
}
|
||||
if (Level[NoteType])
|
||||
HieCod = Gbl.Hierarchy.Node[Level[NoteType]].HieCod;
|
||||
else
|
||||
HieCod = -1L;
|
||||
|
||||
/***** Publish note in timeline *****/
|
||||
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)
|
||||
{
|
||||
case Set_USR_LIST_AS_CLASS_PHOTO:
|
||||
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL,
|
||||
Role,SelectedUsrs,true);
|
||||
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL,Role,SelectedUsrs,true);
|
||||
break;
|
||||
case Set_USR_LIST_AS_LISTING:
|
||||
Usr_ListUsrsForSelection (Role,SelectedUsrs);
|
||||
|
@ -5322,7 +5321,7 @@ void Usr_SeeTeachers (void)
|
|||
/***** Contextual menu *****/
|
||||
Mnu_ContextMenuBegin ();
|
||||
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
|
||||
{
|
||||
Enr_PutLinkToAdminSeveralUsrs (Rol_NET); // Admin several non-editing teachers
|
||||
|
|
Loading…
Reference in New Issue
Block a user