mirror of https://github.com/acanas/swad-core.git
Version 22.99: Apr 18, 2023 Code refactoring in rubrics.
This commit is contained in:
parent
643876456b
commit
892529546c
|
@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
|
|||
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
|
||||
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.98 (2023-04-17)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.99 (2023-04-18)"
|
||||
#define CSS_FILE "swad22.95.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 22.99: Apr 18, 2023 Code refactoring in rubrics. (339025 lines)
|
||||
Version 22.98: Apr 17, 2023 Code refactoring in rubrics. (339062 lines)
|
||||
Version 22.97: Apr 14, 2023 Changes in listing of rubrics. (339029 lines)
|
||||
Version 22.96.1: Apr 14, 2023 Code refactoring in selectors. (338991 lines)
|
||||
|
|
|
@ -444,7 +444,8 @@ void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
|
|||
extern const char *Txt_Exam;
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Exam,
|
||||
Box_BoxBegin (NULL,Exams->Exam.Title[0] ? Exams->Exam.Title :
|
||||
Txt_Exam,
|
||||
Exa_PutIconsOneExam,Exams,
|
||||
Hlp_ASSESSMENT_Exams,Box_NOT_CLOSABLE);
|
||||
|
||||
|
|
|
@ -485,7 +485,8 @@ void Gam_ShowOnlyOneGameBegin (struct Gam_Games *Games,
|
|||
extern const char *Txt_Game;
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Game,
|
||||
Box_BoxBegin (NULL,Games->Game.Title[0] ? Games->Game.Title :
|
||||
Txt_Game,
|
||||
Gam_PutIconsOneGame,Games,
|
||||
Hlp_ASSESSMENT_Games,Box_NOT_CLOSABLE);
|
||||
|
||||
|
|
10
swad_match.c
10
swad_match.c
|
@ -851,8 +851,6 @@ void Mch_ToggleVisResultsMchUsr (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
@ -972,8 +970,6 @@ void Mch_ReqRemMatch (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
@ -1005,8 +1001,6 @@ void Mch_RemoveMatch (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
@ -1103,8 +1097,6 @@ void Mch_EditMatch (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
@ -1383,8 +1375,6 @@ void Mch_ChangeMatch (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
|
|
@ -157,8 +157,6 @@ void MchRes_ShowMyMchResultsInGam (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
|
||||
/***** Get parameters *****/
|
||||
|
@ -206,8 +204,6 @@ void MchRes_ShowMyMchResultsInMch (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
@ -361,8 +357,6 @@ void MchRes_ShowAllMchResultsInGam (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
|
||||
/***** Get parameters *****/
|
||||
|
@ -432,8 +426,6 @@ void MchRes_ShowAllMchResultsInMch (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
@ -1074,8 +1066,6 @@ void MchRes_ShowOneMchResult (void)
|
|||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Reset game and match *****/
|
||||
Gam_ResetGame (&Games.Game);
|
||||
Mch_ResetMatch (&Match);
|
||||
|
||||
|
|
123
swad_rubric.c
123
swad_rubric.c
|
@ -65,7 +65,6 @@ static void Rub_PutButtonToCreateNewRubric (struct Rub_Rubrics *Rubrics);
|
|||
static void Rub_PutParsToCreateNewRubric (void *Rubrics);
|
||||
|
||||
static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
bool ShowOnlyThisRubric);
|
||||
|
||||
static void Rub_PutIconsOneRubric (void *Rubrics);
|
||||
|
@ -151,7 +150,6 @@ void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics)
|
|||
extern const char *Txt_No_rubrics;
|
||||
struct Pag_Pagination Pagination;
|
||||
unsigned NumRubric;
|
||||
struct Rub_Rubric Rubric;
|
||||
|
||||
/***** Get number of groups in current course *****/
|
||||
if (!Gbl.Crs.Grps.NumGrps)
|
||||
|
@ -196,16 +194,16 @@ void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics)
|
|||
NumRubric++)
|
||||
{
|
||||
/***** Get rubric data *****/
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rubrics->RubCod = Rubric.RubCod = Rubrics->Lst[NumRubric - 1];
|
||||
Rub_GetRubricDataByCod (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics->Rubric);
|
||||
Rubrics->Rubric.RubCod = Rubrics->Lst[NumRubric - 1];
|
||||
Rub_GetRubricDataByCod (&Rubrics->Rubric);
|
||||
|
||||
/***** Show main data of this rubric *****/
|
||||
Rub_ShowRubricMainData (Rubrics,&Rubric,
|
||||
false); // Do not show only this rubric
|
||||
Rub_ShowRubricMainData (Rubrics,
|
||||
false); // Do not show only this rubric
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics->Rubric);
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -342,44 +340,41 @@ static void Rub_PutParsToCreateNewRubric (void *Rubrics)
|
|||
void Rub_SeeOneRubric (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rubric.RubCod = Rubrics.RubCod;
|
||||
|
||||
/***** Get rubric data *****/
|
||||
Rub_GetRubricDataByCod (&Rubric);
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
|
||||
/***** Show rubric *****/
|
||||
Rub_ShowOnlyOneRubric (&Rubrics,&Rubric);
|
||||
Rub_ShowOnlyOneRubric (&Rubrics);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Show one rubric *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric)
|
||||
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Rubrics;
|
||||
extern const char *Txt_Rubric;
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Rubric->Title[0] ? Rubric->Title :
|
||||
Txt_Rubric,
|
||||
Box_BoxBegin (NULL,Rubrics->Rubric.Title[0] ? Rubrics->Rubric.Title :
|
||||
Txt_Rubric,
|
||||
Rub_PutIconsOneRubric,Rubrics,
|
||||
Hlp_ASSESSMENT_Rubrics,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Show main data of this rubric *****/
|
||||
Rub_ShowRubricMainData (Rubrics,Rubric,
|
||||
Rub_ShowRubricMainData (Rubrics,
|
||||
true); // Show only this rubric
|
||||
|
||||
/***** Write criteria of this rubric *****/
|
||||
|
@ -394,7 +389,6 @@ void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics,
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
bool ShowOnlyThisRubric)
|
||||
{
|
||||
extern const char *Txt_View_rubric;
|
||||
|
@ -427,7 +421,7 @@ static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
|||
Rub_PutPars (Rubrics);
|
||||
HTM_BUTTON_Submit_Begin (Txt_View_rubric,"class=\"LT BT_LINK ASG_TITLE_%s\"",
|
||||
The_GetSuffix ());
|
||||
HTM_Txt (Rubric->Title);
|
||||
HTM_Txt (Rubrics->Rubric.Title);
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
|
||||
|
@ -435,7 +429,7 @@ static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
|||
HTM_DIV_Begin ("class=\"ASG_GRP_%s\"",The_GetSuffix ());
|
||||
HTM_TxtColonNBSP (Txt_Number_of_criteria);
|
||||
// HTM_Unsigned (Rubrics->Rubric.NumCriteria);
|
||||
HTM_Unsigned (Rub_DB_GetNumCriteriaInRubric (Rubric->RubCod));
|
||||
HTM_Unsigned (Rub_DB_GetNumCriteriaInRubric (Rubrics->Rubric.RubCod));
|
||||
HTM_DIV_End ();
|
||||
|
||||
/***** End 1st row of this rubric *****/
|
||||
|
@ -449,7 +443,7 @@ static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
|||
HTM_TD_Begin ("class=\"LT\"");
|
||||
else
|
||||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||
Rub_WriteAuthor (Rubric);
|
||||
Rub_WriteAuthor (&Rubrics->Rubric);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Text of the rubric *****/
|
||||
|
@ -458,10 +452,10 @@ static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
|||
else
|
||||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Rubric->Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||
ALn_InsertLinks (Rubric->Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
Rubrics->Rubric.Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||
ALn_InsertLinks (Rubrics->Rubric.Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
HTM_DIV_Begin ("class=\"PAR DAT_%s\"",The_GetSuffix ());
|
||||
HTM_Txt (Rubric->Txt);
|
||||
HTM_Txt (Rubrics->Rubric.Txt);
|
||||
HTM_DIV_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -526,7 +520,7 @@ void Rub_PutPars (void *Rubrics)
|
|||
{
|
||||
if (Rubrics)
|
||||
{
|
||||
ParCod_PutPar (ParCod_Rub,((struct Rub_Rubrics *) Rubrics)->RubCod);
|
||||
ParCod_PutPar (ParCod_Rub,((struct Rub_Rubrics *) Rubrics)->Rubric.RubCod);
|
||||
Pag_PutParPagNum (Pag_RUBRICS,((struct Rub_Rubrics *) Rubrics)->CurrentPage);
|
||||
}
|
||||
}
|
||||
|
@ -547,7 +541,7 @@ void Rub_GetPars (struct Rub_Rubrics *Rubrics,bool CheckRubCod)
|
|||
Rubrics->CurrentPage = Pag_GetParPagNum (Pag_RUBRICS);
|
||||
|
||||
/***** Get rubric code *****/
|
||||
Rubrics->RubCod = GetExaCo[CheckRubCod] (ParCod_Rub);
|
||||
Rubrics->Rubric.RubCod = GetExaCo[CheckRubCod] (ParCod_Rub);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -657,18 +651,16 @@ void Rub_AskRemRubric (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_rubric_X;
|
||||
extern const char *Txt_Remove_rubric;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rubric.RubCod = Rubrics.RubCod;
|
||||
|
||||
/***** Get data of the rubric from database *****/
|
||||
Rub_GetRubricDataByCod (&Rubric);
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
if (!Rub_CheckIfICanEditRubrics ())
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
|
@ -677,13 +669,13 @@ void Rub_AskRemRubric (void)
|
|||
Rub_PutPars,&Rubrics,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_rubric,
|
||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_rubric_X,
|
||||
Rubric.Title);
|
||||
Rubrics.Rubric.Title);
|
||||
|
||||
/***** Show rubrics again *****/
|
||||
Rub_ListAllRubrics (&Rubrics);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -694,33 +686,30 @@ void Rub_RemoveRubric (void)
|
|||
{
|
||||
extern const char *Txt_Rubric_X_removed;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rubric.RubCod = Rubrics.RubCod;
|
||||
|
||||
/***** Get data of the rubric from database *****/
|
||||
Rub_GetRubricDataByCod (&Rubric);
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
if (!Rub_CheckIfICanEditRubrics ())
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Remove rubric from all tables *****/
|
||||
Rub_RemoveRubricFromAllTables (Rubric.RubCod);
|
||||
Rub_RemoveRubricFromAllTables (Rubrics.Rubric.RubCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Rubric_X_removed,
|
||||
Rubric.Title);
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Rubric_X_removed,Rubrics.Rubric.Title);
|
||||
|
||||
/***** Show rubrics again *****/
|
||||
Rub_ListAllRubrics (&Rubrics);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -756,7 +745,6 @@ void Rub_RemoveCrsRubrics (long CrsCod)
|
|||
void Rub_ReqCreatOrEditRubric (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric;
|
||||
|
||||
|
@ -766,31 +754,31 @@ void Rub_ReqCreatOrEditRubric (void)
|
|||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false); // Don't check rubric code
|
||||
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||
ExistingNewRubric = (Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
|
||||
/***** Get rubric data *****/
|
||||
switch (ExistingNewRubric)
|
||||
{
|
||||
case Rub_EXISTING_RUBRIC:
|
||||
/* Get rubric data from database */
|
||||
Rub_GetRubricDataByCod (&Rubric);
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
break;
|
||||
case Rub_NEW_RUBRIC:
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Put form to create/edit a rubric and show criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,ExistingNewRubric);
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,ExistingNewRubric);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -798,12 +786,11 @@ void Rub_ReqCreatOrEditRubric (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
struct RubCri_Criterion *Criterion,
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric)
|
||||
{
|
||||
/***** Put form to create/edit a rubric *****/
|
||||
Rub_PutFormEditionRubric (Rubrics,Rubric,ExistingNewRubric);
|
||||
Rub_PutFormEditionRubric (Rubrics,ExistingNewRubric);
|
||||
|
||||
/***** Show other lists *****/
|
||||
switch (ExistingNewRubric)
|
||||
|
@ -824,7 +811,6 @@ void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
|||
/*****************************************************************************/
|
||||
|
||||
void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Rubrics_new_rubric;
|
||||
|
@ -867,8 +853,8 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
|||
|
||||
/***** Begin box and table *****/
|
||||
Box_BoxTableBegin (NULL,
|
||||
Rubric->Title[0] ? Rubric->Title :
|
||||
Title[ExistingNewRubric],
|
||||
Rubrics->Rubric.Title[0] ? Rubrics->Rubric.Title :
|
||||
Title[ExistingNewRubric],
|
||||
NULL,NULL,
|
||||
HelpLink[ExistingNewRubric],Box_NOT_CLOSABLE,2);
|
||||
|
||||
|
@ -880,7 +866,7 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
|||
|
||||
/* Data */
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
HTM_INPUT_TEXT ("Title",Rub_MAX_CHARS_TITLE,Rubric->Title,
|
||||
HTM_INPUT_TEXT ("Title",Rub_MAX_CHARS_TITLE,Rubrics->Rubric.Title,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"Title\""
|
||||
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
||||
|
@ -901,7 +887,7 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
|||
HTM_TEXTAREA_Begin ("id=\"Txt\" name=\"Txt\" rows=\"5\""
|
||||
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
HTM_Txt (Rubric->Txt);
|
||||
HTM_Txt (Rubrics->Rubric.Txt);
|
||||
HTM_TEXTAREA_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -922,7 +908,6 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
|||
void Rub_ReceiveFormRubric (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric;
|
||||
|
||||
|
@ -932,14 +917,14 @@ void Rub_ReceiveFormRubric (void)
|
|||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false);
|
||||
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||
ExistingNewRubric = (Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
|
||||
/***** Get all current rubric data from database *****/
|
||||
// Some data, not received from form,
|
||||
|
@ -947,24 +932,24 @@ void Rub_ReceiveFormRubric (void)
|
|||
switch (ExistingNewRubric)
|
||||
{
|
||||
case Rub_EXISTING_RUBRIC:
|
||||
Rub_GetRubricDataByCod (&Rubric);
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
break;
|
||||
case Rub_NEW_RUBRIC:
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Overwrite some rubric data with the data received from form *****/
|
||||
Rub_ReceiveRubricFieldsFromForm (&Rubric);
|
||||
if (Rub_CheckRubricFieldsReceivedFromForm (&Rubric))
|
||||
Rub_ReceiveRubricFieldsFromForm (&Rubrics.Rubric);
|
||||
if (Rub_CheckRubricFieldsReceivedFromForm (&Rubrics.Rubric))
|
||||
{
|
||||
/***** Create a new rubric or update an existing one *****/
|
||||
switch (ExistingNewRubric)
|
||||
{
|
||||
case Rub_EXISTING_RUBRIC:
|
||||
Rub_UpdateRubric (&Rubric); // Update rubric data in database
|
||||
Rub_UpdateRubric (&Rubrics.Rubric); // Update rubric data in database
|
||||
break;
|
||||
case Rub_NEW_RUBRIC:
|
||||
Rub_CreateRubric (&Rubric); // Add new rubric to database
|
||||
Rub_CreateRubric (&Rubrics.Rubric); // Add new rubric to database
|
||||
ExistingNewRubric = Rub_EXISTING_RUBRIC;
|
||||
break;
|
||||
}
|
||||
|
@ -974,10 +959,10 @@ void Rub_ReceiveFormRubric (void)
|
|||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,ExistingNewRubric);
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,ExistingNewRubric);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
static void Rub_ReceiveRubricFieldsFromForm (struct Rub_Rubric *Rubric)
|
||||
|
|
|
@ -49,8 +49,7 @@ void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics);
|
|||
bool Rub_CheckIfICanEditRubrics (void);
|
||||
bool Rub_CheckIfEditable (void);
|
||||
void Rub_SeeOneRubric (void);
|
||||
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric);
|
||||
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics);
|
||||
|
||||
void Rub_SetCurrentRubCod (long GamCod);
|
||||
void Rub_PutPars (void *Rubrics);
|
||||
|
@ -66,11 +65,9 @@ void Rub_RemoveCrsRubrics (long CrsCod);
|
|||
|
||||
void Rub_ReqCreatOrEditRubric (void);
|
||||
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
struct RubCri_Criterion *Criterion,
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric);
|
||||
void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric);
|
||||
|
||||
void Rub_ReceiveFormRubric (void);
|
||||
|
|
|
@ -96,7 +96,6 @@ static void RubCri_GetCriterionDataFromRow (MYSQL_RES *mysql_res,
|
|||
static void RubCri_PutTableHeadingForCriteria (void);
|
||||
|
||||
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
struct RubCri_Criterion *Criterion);
|
||||
|
||||
static void RubCri_ExchangeCriteria (long RubCod,
|
||||
|
@ -234,20 +233,19 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
void RubCri_ReceiveFormCriterion (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
|
||||
/***** Get rubric data from database *****/
|
||||
Rub_GetRubricDataByCod (&Rubric);
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -260,11 +258,11 @@ void RubCri_ReceiveFormCriterion (void)
|
|||
RubCri_CreateCriterion (&Criterion); // Add new criterion to database
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
static void RubCri_ReceiveCriterionFieldsFromForm (struct RubCri_Criterion *Criterion)
|
||||
|
@ -334,17 +332,16 @@ static bool RubCri_CheckCriterionTitleReceivedFromForm (const struct RubCri_Crit
|
|||
void RubCri_ChangeTitle (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char NewTitle[RubCri_MAX_BYTES_TITLE + 1];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -362,11 +359,11 @@ void RubCri_ChangeTitle (void)
|
|||
}
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -386,22 +383,21 @@ void RubCri_ChangeMaxValue (void)
|
|||
static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char ValueStr[64];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -416,11 +412,11 @@ static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
|||
Rub_DB_UpdateCriterionValue (&Criterion,ValueRange);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -430,22 +426,21 @@ static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
|||
void RubCri_ChangeWeight (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char WeightStr[64];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -460,11 +455,11 @@ void RubCri_ChangeWeight (void)
|
|||
Rub_DB_UpdateCriterionWeight (&Criterion);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -500,7 +495,7 @@ void RubCri_ListCriteriaForSeeing (const struct Rub_Rubrics *Rubrics)
|
|||
unsigned NumCriteria;
|
||||
|
||||
/***** Get data of rubric criteria from database *****/
|
||||
NumCriteria = Rub_DB_GetCriteria (&mysql_res,Rubrics->RubCod);
|
||||
NumCriteria = Rub_DB_GetCriteria (&mysql_res,Rubrics->Rubric.RubCod);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Criteria,
|
||||
|
@ -533,10 +528,10 @@ void RubCri_ListCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
bool ICanEditCriteria = Rub_CheckIfEditable ();
|
||||
|
||||
/***** Get maximum criterion index *****/
|
||||
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics->RubCod);
|
||||
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics->Rubric.RubCod);
|
||||
|
||||
/***** Get data of rubric criteria from database *****/
|
||||
NumCriteria = Rub_DB_GetCriteria (&mysql_res,Rubrics->RubCod);
|
||||
NumCriteria = Rub_DB_GetCriteria (&mysql_res,Rubrics->Rubric.RubCod);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Criteria,
|
||||
|
@ -948,16 +943,15 @@ void RubCri_ReqRemCriterion (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_criterion_X;
|
||||
extern const char *Txt_Remove_criterion;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -971,11 +965,11 @@ void RubCri_ReqRemCriterion (void)
|
|||
Criterion.Title);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -986,16 +980,15 @@ void RubCri_RemoveCriterion (void)
|
|||
{
|
||||
extern const char *Txt_Criterion_removed;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -1015,11 +1008,11 @@ void RubCri_RemoveCriterion (void)
|
|||
Ale_ShowAlert (Ale_SUCCESS,Txt_Criterion_removed);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1030,46 +1023,45 @@ void RubCri_MoveUpCriterion (void)
|
|||
{
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
unsigned CriIndTop;
|
||||
unsigned CriIndBottom;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get criterion index *****/
|
||||
CriIndBottom = Rub_DB_GetCriIndFromCriCod (Rubric.RubCod,Criterion.CriCod);
|
||||
CriIndBottom = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Criterion.CriCod);
|
||||
|
||||
/***** Move up criterion *****/
|
||||
if (CriIndBottom > 1)
|
||||
{
|
||||
/* Indexes of criteria to be exchanged */
|
||||
CriIndTop = Rub_DB_GetPrevCriterionIndexInRubric (Rubric.RubCod,CriIndBottom);
|
||||
CriIndTop = Rub_DB_GetPrevCriterionIndexInRubric (Rubrics.Rubric.RubCod,CriIndBottom);
|
||||
if (CriIndTop == 0)
|
||||
Err_ShowErrorAndExit ("Wrong criterion index.");
|
||||
|
||||
/* Exchange criteria */
|
||||
RubCri_ExchangeCriteria (Rubric.RubCod,CriIndTop,CriIndBottom);
|
||||
RubCri_ExchangeCriteria (Rubrics.Rubric.RubCod,CriIndTop,CriIndBottom);
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1080,7 +1072,6 @@ void RubCri_MoveDownCriterion (void)
|
|||
{
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
unsigned CriIndTop;
|
||||
unsigned CriIndBottom;
|
||||
|
@ -1088,42 +1079,42 @@ void RubCri_MoveDownCriterion (void)
|
|||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get criterion index *****/
|
||||
CriIndTop = Rub_DB_GetCriIndFromCriCod (Rubric.RubCod,Criterion.CriCod);
|
||||
CriIndTop = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Criterion.CriCod);
|
||||
|
||||
/***** Get maximum criterion index *****/
|
||||
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubric.RubCod);
|
||||
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics.Rubric.RubCod);
|
||||
|
||||
/***** Move down criterion *****/
|
||||
if (CriIndTop < MaxCriInd)
|
||||
{
|
||||
/* Indexes of criteria to be exchanged */
|
||||
CriIndBottom = Rub_DB_GetNextCriterionIndexInRubric (Rubric.RubCod,CriIndTop);
|
||||
CriIndBottom = Rub_DB_GetNextCriterionIndexInRubric (Rubrics.Rubric.RubCod,CriIndTop);
|
||||
if (CriIndBottom == 0) // 0 means error reading from database
|
||||
Err_ShowErrorAndExit ("Wrong criterion index.");
|
||||
|
||||
/* Exchange criteria */
|
||||
RubCri_ExchangeCriteria (Rubric.RubCod,CriIndTop,CriIndBottom);
|
||||
RubCri_ExchangeCriteria (Rubrics.Rubric.RubCod,CriIndTop,CriIndBottom);
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1131,22 +1122,20 @@ void RubCri_MoveDownCriterion (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics,
|
||||
struct Rub_Rubric *Rubric,
|
||||
struct RubCri_Criterion *Criterion)
|
||||
{
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (Rubrics,true);
|
||||
Rubric->RubCod = Rubrics->RubCod;
|
||||
Criterion->CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
/***** Get rubric data from database *****/
|
||||
Rub_GetRubricDataByCod (Rubric);
|
||||
if (Rubric->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Rub_GetRubricDataByCod (&Rubrics->Rubric);
|
||||
if (Rubrics->Rubric.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||
Err_WrongRubricExit ();
|
||||
|
||||
/***** Get criterion data from database *****/
|
||||
RubCri_GetCriterionDataByCod (Criterion);
|
||||
if (Criterion->RubCod != Rubric->RubCod)
|
||||
if (Criterion->RubCod != Rubrics->Rubric.RubCod)
|
||||
Err_WrongCriterionExit ();
|
||||
Rubrics->CriCod = Criterion->CriCod;
|
||||
}
|
||||
|
@ -1203,16 +1192,15 @@ static void RubCri_ExchangeCriteria (long RubCod,
|
|||
void RubCri_ChangeLink (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubric);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -1229,9 +1217,8 @@ void RubCri_ChangeLink (void)
|
|||
}
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubric);
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
|
|
@ -51,21 +51,20 @@ void RubRsc_GetLinkToRubric (void)
|
|||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct Rub_Rubric Rubric;
|
||||
char Title[Rub_MAX_BYTES_TITLE + 1];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false);
|
||||
Rubric.RubCod = Rubrics.RubCod;
|
||||
|
||||
/***** Get rubric title *****/
|
||||
RubRsc_GetTitleFromRubCod (Rubric.RubCod,Title,sizeof (Title) - 1);
|
||||
RubRsc_GetTitleFromRubCod (Rubrics.Rubric.RubCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to rubric into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_RUBRIC,Rubric.RubCod);
|
||||
Rsc_DB_CopyToClipboard (Rsc_RUBRIC,Rubrics.Rubric.RubCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -73,6 +72,9 @@ void RubRsc_GetLinkToRubric (void)
|
|||
|
||||
/***** Show rubrics again *****/
|
||||
Rub_ListAllRubrics (&Rubrics);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -60,7 +60,7 @@ struct Rub_Rubrics
|
|||
unsigned Num; // Total number of rubrics
|
||||
long *Lst; // List of rubric codes
|
||||
unsigned CurrentPage;
|
||||
long RubCod; // Selected/current rubric code
|
||||
struct Rub_Rubric Rubric; // Selected/current rubric
|
||||
long CriCod; // Selected/current criterion code
|
||||
unsigned CriInd; // Current citerion index
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue