mirror of https://github.com/acanas/swad-core.git
Version 22.94: Apr 12, 2023 Code refactoring in rubrics.
This commit is contained in:
parent
cfddb5c174
commit
45d2b2a2d9
|
@ -629,10 +629,12 @@ 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.
|
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.93 (2023-04-10)"
|
#define Log_PLATFORM_VERSION "SWAD 22.94 (2023-04-12)"
|
||||||
#define CSS_FILE "swad22.88.css"
|
#define CSS_FILE "swad22.88.css"
|
||||||
#define JS_FILE "swad22.49.js"
|
#define JS_FILE "swad22.49.js"
|
||||||
/*
|
/*
|
||||||
|
Version 22.94: Apr 12, 2023 Code refactoring in rubrics.
|
||||||
|
Changes in configuration of projects. (338537 lines)
|
||||||
Version 22.93: Apr 10, 2023 Changes in configuration of projects. (338417 lines)
|
Version 22.93: Apr 10, 2023 Changes in configuration of projects. (338417 lines)
|
||||||
Version 22.92.3: Apr 06, 2023 Code refactoring in resources. (338493 lines)
|
Version 22.92.3: Apr 06, 2023 Code refactoring in resources. (338493 lines)
|
||||||
Version 22.92.2: Apr 06, 2023 Code refactoring in resources. (338500 lines)
|
Version 22.92.2: Apr 06, 2023 Code refactoring in resources. (338500 lines)
|
||||||
|
|
|
@ -100,10 +100,10 @@ static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults,
|
||||||
double TotalScore,
|
double TotalScore,
|
||||||
double TotalGrade);
|
double TotalGrade);
|
||||||
|
|
||||||
static void MchRes_CheckIfICanSeeMatchResult (const struct Gam_Game *Game,
|
static void MchRes_CheckIfICanViewMatchResult (const struct Gam_Game *Game,
|
||||||
const struct Mch_Match *Match,
|
const struct Mch_Match *Match,
|
||||||
long UsrCod,
|
long UsrCod,
|
||||||
struct MchRes_ICanView *ICanView);
|
struct MchRes_ICanView *ICanView);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************************** Show my matches results *************************/
|
/*************************** Show my matches results *************************/
|
||||||
|
@ -764,7 +764,7 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games,
|
||||||
Gam_GetGameDataByCod (&Games->Game);
|
Gam_GetGameDataByCod (&Games->Game);
|
||||||
|
|
||||||
/* Check if I can view this match result and score */
|
/* Check if I can view this match result and score */
|
||||||
MchRes_CheckIfICanSeeMatchResult (&Games->Game,&Match,UsrDat->UsrCod,&ICanView);
|
MchRes_CheckIfICanViewMatchResult (&Games->Game,&Match,UsrDat->UsrCod,&ICanView);
|
||||||
|
|
||||||
if (NumResult)
|
if (NumResult)
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
@ -1103,7 +1103,7 @@ void MchRes_ShowOneMchResult (void)
|
||||||
MchPrn_GetMatchPrintDataByMchCodAndUsrCod (&Print);
|
MchPrn_GetMatchPrintDataByMchCodAndUsrCod (&Print);
|
||||||
|
|
||||||
/***** Check if I can view this match result and score *****/
|
/***** Check if I can view this match result and score *****/
|
||||||
MchRes_CheckIfICanSeeMatchResult (&Games.Game,&Match,UsrDat->UsrCod,&ICanView);
|
MchRes_CheckIfICanViewMatchResult (&Games.Game,&Match,UsrDat->UsrCod,&ICanView);
|
||||||
if (!ICanView.Result)
|
if (!ICanView.Result)
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
|
@ -1288,13 +1288,13 @@ void MchRes_ShowOneMchResult (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************** Get if I can see match result ************************/
|
/********************** Get if I can view match result ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void MchRes_CheckIfICanSeeMatchResult (const struct Gam_Game *Game,
|
static void MchRes_CheckIfICanViewMatchResult (const struct Gam_Game *Game,
|
||||||
const struct Mch_Match *Match,
|
const struct Mch_Match *Match,
|
||||||
long UsrCod,
|
long UsrCod,
|
||||||
struct MchRes_ICanView *ICanView)
|
struct MchRes_ICanView *ICanView)
|
||||||
{
|
{
|
||||||
/***** Check if I can view print result and score *****/
|
/***** Check if I can view print result and score *****/
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "swad_project.h"
|
#include "swad_project.h"
|
||||||
#include "swad_project_config.h"
|
#include "swad_project_config.h"
|
||||||
#include "swad_project_database.h"
|
#include "swad_project_database.h"
|
||||||
|
#include "swad_rubric.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************** External global variables from others modules ****************/
|
/************** External global variables from others modules ****************/
|
||||||
|
@ -48,6 +49,7 @@ extern struct Globals Gbl;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void PrjCfg_ShowFormNETCanCreate (const struct Prj_Projects *Projects);
|
static void PrjCfg_ShowFormNETCanCreate (const struct Prj_Projects *Projects);
|
||||||
|
static void PrjCfg_ShowFormRubrics (void);
|
||||||
|
|
||||||
static void PrjCfg_GetConfigDataFromRow (MYSQL_RES *mysql_res,
|
static void PrjCfg_GetConfigDataFromRow (MYSQL_RES *mysql_res,
|
||||||
struct Prj_Projects *Projects);
|
struct Prj_Projects *Projects);
|
||||||
|
@ -113,6 +115,9 @@ void PrjCfg_ShowFormConfig (void)
|
||||||
/***** Projects are editable by non-editing teachers? *****/
|
/***** Projects are editable by non-editing teachers? *****/
|
||||||
PrjCfg_ShowFormNETCanCreate (&Projects);
|
PrjCfg_ShowFormNETCanCreate (&Projects);
|
||||||
|
|
||||||
|
/***** Rubrics *****/
|
||||||
|
PrjCfg_ShowFormRubrics ();
|
||||||
|
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
|
||||||
/***** Send button *****/
|
/***** Send button *****/
|
||||||
|
@ -126,7 +131,7 @@ void PrjCfg_ShowFormConfig (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** Cam non-editing teachers create new projects? ***************/
|
/****** Show form to edit if non-editing teachers create new projects ********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void PrjCfg_ShowFormNETCanCreate (const struct Prj_Projects *Projects)
|
static void PrjCfg_ShowFormNETCanCreate (const struct Prj_Projects *Projects)
|
||||||
|
@ -157,6 +162,102 @@ static void PrjCfg_ShowFormNETCanCreate (const struct Prj_Projects *Projects)
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Show form to edit rubrics associated to projects ***************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void PrjCfg_ShowFormRubrics (void)
|
||||||
|
{
|
||||||
|
struct Rub_Rubrics Rubrics;
|
||||||
|
unsigned NumRub;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
struct Rub_Rubric Tutors;
|
||||||
|
struct Rub_Rubric Evaluators;
|
||||||
|
struct Rub_Rubric Global;
|
||||||
|
} PrjRubrics = {};
|
||||||
|
|
||||||
|
/***** Reset rubrics context *****/
|
||||||
|
Rub_ResetRubrics (&Rubrics);
|
||||||
|
|
||||||
|
/***** Get list of rubrics *****/
|
||||||
|
Rub_GetListRubrics (&Rubrics);
|
||||||
|
|
||||||
|
/***** Rubric for tutors *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/* Label */
|
||||||
|
HTM_TD_Begin ("class=\"RT FORM_IN_%s\"",
|
||||||
|
The_GetSuffix ());
|
||||||
|
HTM_TxtColon ("Rúbrica para tutores");
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Data */
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL,
|
||||||
|
"id=\"rub_tut\" name=\"rub_tut\" class=\"LICENSE\"");
|
||||||
|
for (NumRub = 0;
|
||||||
|
NumRub < Rubrics.Num;
|
||||||
|
NumRub++)
|
||||||
|
HTM_OPTION (HTM_Type_LONG,&Rubrics.Lst[NumRub].RubCod,
|
||||||
|
Rubrics.Lst[NumRub].RubCod == PrjRubrics.Global.RubCod,false,
|
||||||
|
"%s",Rubrics.Lst[NumRub].Title);
|
||||||
|
HTM_SELECT_End ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Rubric for evaluators *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
/* Label */
|
||||||
|
HTM_TD_Begin ("class=\"RT FORM_IN_%s\"",
|
||||||
|
The_GetSuffix ());
|
||||||
|
HTM_TxtColon ("Rúbrica para evaluadores");
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Data */
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL,
|
||||||
|
"id=\"rub_eva\" name=\"rub_eva\" class=\"LICENSE\"");
|
||||||
|
for (NumRub = 0;
|
||||||
|
NumRub < Rubrics.Num;
|
||||||
|
NumRub++)
|
||||||
|
HTM_OPTION (HTM_Type_LONG,&Rubrics.Lst[NumRub].RubCod,
|
||||||
|
Rubrics.Lst[NumRub].RubCod == PrjRubrics.Global.RubCod,false,
|
||||||
|
"%s",Rubrics.Lst[NumRub].Title);
|
||||||
|
HTM_SELECT_End ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Rubric global *****/
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/* Label */
|
||||||
|
HTM_TD_Begin ("class=\"RT FORM_IN_%s\"",
|
||||||
|
The_GetSuffix ());
|
||||||
|
HTM_TxtColon ("Rúbrica global");
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Data */
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL,
|
||||||
|
"id=\"rub_gbl\" name=\"rub_gbl\" class=\"LICENSE\"");
|
||||||
|
for (NumRub = 0;
|
||||||
|
NumRub < Rubrics.Num;
|
||||||
|
NumRub++)
|
||||||
|
HTM_OPTION (HTM_Type_LONG,&Rubrics.Lst[NumRub].RubCod,
|
||||||
|
Rubrics.Lst[NumRub].RubCod == PrjRubrics.Global.RubCod,false,
|
||||||
|
"%s",Rubrics.Lst[NumRub].Title);
|
||||||
|
HTM_SELECT_End ();
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
/***** Free list of rubrics *****/
|
||||||
|
Rub_FreeListRubrics (&Rubrics);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************ Get configuration values from a database table row *************/
|
/************ Get configuration values from a database table row *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
160
swad_rubric.c
160
swad_rubric.c
|
@ -65,10 +65,11 @@ static void Rub_PutButtonToCreateNewRubric (struct Rub_Rubrics *Rubrics);
|
||||||
static void Rub_PutParsToCreateNewRubric (void *Rubrics);
|
static void Rub_PutParsToCreateNewRubric (void *Rubrics);
|
||||||
|
|
||||||
static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
||||||
|
const struct Rub_Rubric *Rubric,
|
||||||
bool ShowOnlyThisRubric);
|
bool ShowOnlyThisRubric);
|
||||||
|
|
||||||
static void Rub_PutIconsOneRubric (void *Rubrics);
|
static void Rub_PutIconsOneRubric (void *Rubrics);
|
||||||
static void Rub_WriteAuthor (struct Rub_Rubric *Rubric);
|
static void Rub_WriteAuthor (const struct Rub_Rubric *Rubric);
|
||||||
|
|
||||||
static void Rub_PutIconsToRemEditOneRubric (struct Rub_Rubrics *Rubrics);
|
static void Rub_PutIconsToRemEditOneRubric (struct Rub_Rubrics *Rubrics);
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ void Rub_ResetRubrics (struct Rub_Rubrics *Rubrics)
|
||||||
Rubrics->Num = 0; // Total number of rubrics
|
Rubrics->Num = 0; // Total number of rubrics
|
||||||
Rubrics->Lst = NULL; // List of rubrics
|
Rubrics->Lst = NULL; // List of rubrics
|
||||||
Rubrics->CurrentPage = 0;
|
Rubrics->CurrentPage = 0;
|
||||||
Rubrics->Rubric.RubCod = -1L; // Current/selected rubric code
|
// Rubrics->Rubric.RubCod = -1L; // Current/selected rubric code
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -105,7 +106,6 @@ void Rub_ResetRubric (struct Rub_Rubric *Rubric)
|
||||||
Rubric->CrsCod = -1L;
|
Rubric->CrsCod = -1L;
|
||||||
Rubric->UsrCod = -1L;
|
Rubric->UsrCod = -1L;
|
||||||
Rubric->Title[0] = '\0';
|
Rubric->Title[0] = '\0';
|
||||||
Rubric->NumCriteria = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -139,9 +139,6 @@ void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics)
|
||||||
struct Pag_Pagination Pagination;
|
struct Pag_Pagination Pagination;
|
||||||
unsigned NumRubric;
|
unsigned NumRubric;
|
||||||
|
|
||||||
/***** Reset rubric *****/
|
|
||||||
Rub_ResetRubric (&Rubrics->Rubric);
|
|
||||||
|
|
||||||
/***** Get number of groups in current course *****/
|
/***** Get number of groups in current course *****/
|
||||||
if (!Gbl.Crs.Grps.NumGrps)
|
if (!Gbl.Crs.Grps.NumGrps)
|
||||||
Gbl.Crs.Grps.WhichGrps = Grp_ALL_GROUPS;
|
Gbl.Crs.Grps.WhichGrps = Grp_ALL_GROUPS;
|
||||||
|
@ -189,12 +186,9 @@ void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics)
|
||||||
NumRubric <= Pagination.LastItemVisible;
|
NumRubric <= Pagination.LastItemVisible;
|
||||||
NumRubric++)
|
NumRubric++)
|
||||||
{
|
{
|
||||||
/* Get data of this rubric */
|
|
||||||
Rubrics->Rubric.RubCod = Rubrics->Lst[NumRubric - 1];
|
|
||||||
Rub_GetRubricDataByCod (&Rubrics->Rubric);
|
|
||||||
|
|
||||||
/* Show a pair of rows with the main data of this rubric */
|
/* Show a pair of rows with the main data of this rubric */
|
||||||
Rub_ShowRubricMainData (Rubrics,
|
Rubrics->RubCod = Rubrics->Lst[NumRubric - 1].RubCod;
|
||||||
|
Rub_ShowRubricMainData (Rubrics,&Rubrics->Lst[NumRubric - 1],
|
||||||
false); // Do not show only this rubric
|
false); // Do not show only this rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,13 +232,16 @@ bool Rub_CheckIfICanEditRubrics (void)
|
||||||
/*********************** Check if edition is possible ************************/
|
/*********************** Check if edition is possible ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
bool Rub_CheckIfEditable (const struct Rub_Rubric *Rubric)
|
bool Rub_CheckIfEditable (void)
|
||||||
{
|
{
|
||||||
if (Rub_CheckIfICanEditRubrics ())
|
if (Rub_CheckIfICanEditRubrics ())
|
||||||
/***** Rubric is editable only if ... *****/
|
/***** Rubric is editable only if ... *****/
|
||||||
// TODO: Change to control that a rubric is not edited in some circunstances?
|
// TODO: Change to control that a rubric is not edited in some circunstances?
|
||||||
|
/*
|
||||||
return Rubric->NumCriteria == 0 ||
|
return Rubric->NumCriteria == 0 ||
|
||||||
Rubric->NumCriteria != 0;
|
Rubric->NumCriteria != 0;
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
else
|
else
|
||||||
return false; // Questions are not editable
|
return false; // Questions are not editable
|
||||||
}
|
}
|
||||||
|
@ -329,19 +326,19 @@ static void Rub_PutParsToCreateNewRubric (void *Rubrics)
|
||||||
void Rub_SeeOneRubric (void)
|
void Rub_SeeOneRubric (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
|
Rub_ResetRubric (&Rubric);
|
||||||
/***** Reset rubric *****/
|
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,true);
|
Rub_GetPars (&Rubrics,true);
|
||||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
Rubric.RubCod = Rubrics.RubCod;
|
||||||
|
Rub_GetRubricDataByCod (&Rubric);
|
||||||
|
|
||||||
/***** Show rubric *****/
|
/***** Show rubric *****/
|
||||||
Rub_ShowOnlyOneRubric (&Rubrics,
|
Rub_ShowOnlyOneRubric (&Rubrics,&Rubric,
|
||||||
false); // Do not list rubric criteria
|
false); // Do not list rubric criteria
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,13 +347,15 @@ void Rub_SeeOneRubric (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics,
|
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics,
|
||||||
|
const struct Rub_Rubric *Rubric,
|
||||||
bool ListRubricCriteria)
|
bool ListRubricCriteria)
|
||||||
{
|
{
|
||||||
Rub_ShowOnlyOneRubricBegin (Rubrics,ListRubricCriteria);
|
Rub_ShowOnlyOneRubricBegin (Rubrics,Rubric,ListRubricCriteria);
|
||||||
Rub_ShowOnlyOneRubricEnd ();
|
Rub_ShowOnlyOneRubricEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rub_ShowOnlyOneRubricBegin (struct Rub_Rubrics *Rubrics,
|
void Rub_ShowOnlyOneRubricBegin (struct Rub_Rubrics *Rubrics,
|
||||||
|
const struct Rub_Rubric *Rubric,
|
||||||
bool ListRubricCriteria)
|
bool ListRubricCriteria)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Rubrics;
|
extern const char *Hlp_ASSESSMENT_Rubrics;
|
||||||
|
@ -368,7 +367,7 @@ void Rub_ShowOnlyOneRubricBegin (struct Rub_Rubrics *Rubrics,
|
||||||
Hlp_ASSESSMENT_Rubrics,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Rubrics,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Show main data of this rubric *****/
|
/***** Show main data of this rubric *****/
|
||||||
Rub_ShowRubricMainData (Rubrics,
|
Rub_ShowRubricMainData (Rubrics,Rubric,
|
||||||
true); // Show only this rubric
|
true); // Show only this rubric
|
||||||
|
|
||||||
/***** Write criteria of this rubric *****/
|
/***** Write criteria of this rubric *****/
|
||||||
|
@ -388,6 +387,7 @@ void Rub_ShowOnlyOneRubricEnd (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
||||||
|
const struct Rub_Rubric *Rubric,
|
||||||
bool ShowOnlyThisRubric)
|
bool ShowOnlyThisRubric)
|
||||||
{
|
{
|
||||||
extern const char *Txt_View_rubric;
|
extern const char *Txt_View_rubric;
|
||||||
|
@ -421,14 +421,15 @@ static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
||||||
Rub_PutPars (Rubrics);
|
Rub_PutPars (Rubrics);
|
||||||
HTM_BUTTON_Submit_Begin (Txt_View_rubric,"class=\"LT BT_LINK ASG_TITLE_%s\"",
|
HTM_BUTTON_Submit_Begin (Txt_View_rubric,"class=\"LT BT_LINK ASG_TITLE_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
HTM_Txt (Rubrics->Rubric.Title);
|
HTM_Txt (Rubric->Title);
|
||||||
HTM_BUTTON_End ();
|
HTM_BUTTON_End ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
/* Number of criteria */
|
/* Number of criteria */
|
||||||
HTM_DIV_Begin ("class=\"ASG_GRP_%s\"",The_GetSuffix ());
|
HTM_DIV_Begin ("class=\"ASG_GRP_%s\"",The_GetSuffix ());
|
||||||
HTM_TxtColonNBSP (Txt_Number_of_criteria);
|
HTM_TxtColonNBSP (Txt_Number_of_criteria);
|
||||||
HTM_Unsigned (Rubrics->Rubric.NumCriteria);
|
// HTM_Unsigned (Rubrics->Rubric.NumCriteria);
|
||||||
|
HTM_Unsigned (Rub_DB_GetNumCriteriaInRubric (Rubric->RubCod));
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
||||||
/***** End 1st row of this rubric *****/
|
/***** End 1st row of this rubric *****/
|
||||||
|
@ -442,7 +443,7 @@ static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||||
Rub_WriteAuthor (&Rubrics->Rubric);
|
Rub_WriteAuthor (Rubric);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Text of the rubric *****/
|
/***** Text of the rubric *****/
|
||||||
|
@ -450,7 +451,7 @@ static void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||||
Rub_DB_GetRubricTxt (Rubrics->Rubric.RubCod,Txt);
|
Rub_DB_GetRubricTxt (Rubric->RubCod,Txt);
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||||
ALn_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
ALn_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||||
|
@ -483,7 +484,7 @@ static void Rub_PutIconsOneRubric (void *Rubrics)
|
||||||
/*********************** Write the author of a rubric ************************/
|
/*********************** Write the author of a rubric ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Rub_WriteAuthor (struct Rub_Rubric *Rubric)
|
static void Rub_WriteAuthor (const struct Rub_Rubric *Rubric)
|
||||||
{
|
{
|
||||||
Usr_WriteAuthor1Line (Rubric->UsrCod,
|
Usr_WriteAuthor1Line (Rubric->UsrCod,
|
||||||
false); // Not hidden
|
false); // Not hidden
|
||||||
|
@ -520,7 +521,7 @@ void Rub_PutPars (void *Rubrics)
|
||||||
{
|
{
|
||||||
if (Rubrics)
|
if (Rubrics)
|
||||||
{
|
{
|
||||||
ParCod_PutPar (ParCod_Rub,((struct Rub_Rubrics *) Rubrics)->Rubric.RubCod);
|
ParCod_PutPar (ParCod_Rub,((struct Rub_Rubrics *) Rubrics)->RubCod);
|
||||||
Pag_PutParPagNum (Pag_RUBRICS,((struct Rub_Rubrics *) Rubrics)->CurrentPage);
|
Pag_PutParPagNum (Pag_RUBRICS,((struct Rub_Rubrics *) Rubrics)->CurrentPage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,7 +542,7 @@ void Rub_GetPars (struct Rub_Rubrics *Rubrics,bool CheckRubCod)
|
||||||
Rubrics->CurrentPage = Pag_GetParPagNum (Pag_RUBRICS);
|
Rubrics->CurrentPage = Pag_GetParPagNum (Pag_RUBRICS);
|
||||||
|
|
||||||
/***** Get rubric code *****/
|
/***** Get rubric code *****/
|
||||||
Rubrics->Rubric.RubCod = GetExaCo[CheckRubCod] (ParCod_Rub);
|
Rubrics->RubCod = GetExaCo[CheckRubCod] (ParCod_Rub);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -566,15 +567,21 @@ void Rub_GetListRubrics (struct Rub_Rubrics *Rubrics)
|
||||||
sizeof (*Rubrics->Lst))) == NULL)
|
sizeof (*Rubrics->Lst))) == NULL)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
/***** Get the rubrics codes *****/
|
/***** Get the rubrics *****/
|
||||||
for (NumRubric = 0;
|
for (NumRubric = 0;
|
||||||
NumRubric < Rubrics->Num;
|
NumRubric < Rubrics->Num;
|
||||||
NumRubric++)
|
NumRubric++)
|
||||||
{
|
{
|
||||||
/* Get next rubric code (row[0]) */
|
/* Get row */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Rubrics->Lst[NumRubric] = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
|
||||||
Err_WrongRubricExit ();
|
/* Get code of the rubric (row[0]), course (row[1] and author (row[2]) */
|
||||||
|
Rubrics->Lst[NumRubric].RubCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
Rubrics->Lst[NumRubric].CrsCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
Rubrics->Lst[NumRubric].UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
|
|
||||||
|
/* Get the title of the rubric (row[3]) */
|
||||||
|
Str_Copy (Rubrics->Lst[NumRubric].Title,row[3],sizeof (Rubrics->Lst[NumRubric].Title) - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,9 +613,6 @@ void Rub_GetRubricDataByCod (struct Rub_Rubric *Rubric)
|
||||||
|
|
||||||
/* Get the title of the rubric (row[3]) */
|
/* Get the title of the rubric (row[3]) */
|
||||||
Str_Copy (Rubric->Title,row[3],sizeof (Rubric->Title) - 1);
|
Str_Copy (Rubric->Title,row[3],sizeof (Rubric->Title) - 1);
|
||||||
|
|
||||||
/* Get number of criteria */
|
|
||||||
Rubric->NumCriteria = Rub_DB_GetNumCriteriaInRubric (Rubric->RubCod);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Initialize to empty rubric */
|
/* Initialize to empty rubric */
|
||||||
|
@ -643,18 +647,18 @@ void Rub_AskRemRubric (void)
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_rubric_X;
|
extern const char *Txt_Do_you_really_want_to_remove_the_rubric_X;
|
||||||
extern const char *Txt_Remove_rubric;
|
extern const char *Txt_Remove_rubric;
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
|
Rub_ResetRubric (&Rubric);
|
||||||
/***** Reset rubric *****/
|
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,true);
|
Rub_GetPars (&Rubrics,true);
|
||||||
|
Rubric.RubCod = Rubrics.RubCod;
|
||||||
|
|
||||||
/***** Get data of the rubric from database *****/
|
/***** Get data of the rubric from database *****/
|
||||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
Rub_GetRubricDataByCod (&Rubric);
|
||||||
if (!Rub_CheckIfICanEditRubrics ())
|
if (!Rub_CheckIfICanEditRubrics ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
|
@ -663,7 +667,7 @@ void Rub_AskRemRubric (void)
|
||||||
Rub_PutPars,&Rubrics,
|
Rub_PutPars,&Rubrics,
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_rubric,
|
Btn_REMOVE_BUTTON,Txt_Remove_rubric,
|
||||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_rubric_X,
|
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_rubric_X,
|
||||||
Rubrics.Rubric.Title);
|
Rubric.Title);
|
||||||
|
|
||||||
/***** Show rubrics again *****/
|
/***** Show rubrics again *****/
|
||||||
Rub_ListAllRubrics (&Rubrics);
|
Rub_ListAllRubrics (&Rubrics);
|
||||||
|
@ -677,27 +681,27 @@ void Rub_RemoveRubric (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Rubric_X_removed;
|
extern const char *Txt_Rubric_X_removed;
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
|
Rub_ResetRubric (&Rubric);
|
||||||
|
|
||||||
/***** Reset rubric *****/
|
/***** Get parameters *****/
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_GetPars (&Rubrics,true);
|
||||||
|
Rubric.RubCod = Rubrics.RubCod;
|
||||||
/***** Get rubric code *****/
|
|
||||||
Rubrics.Rubric.RubCod = ParCod_GetAndCheckPar (ParCod_Rub);
|
|
||||||
|
|
||||||
/***** Get data of the rubric from database *****/
|
/***** Get data of the rubric from database *****/
|
||||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
Rub_GetRubricDataByCod (&Rubric);
|
||||||
if (!Rub_CheckIfICanEditRubrics ())
|
if (!Rub_CheckIfICanEditRubrics ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Remove rubric from all tables *****/
|
/***** Remove rubric from all tables *****/
|
||||||
Rub_RemoveRubricFromAllTables (Rubrics.Rubric.RubCod);
|
Rub_RemoveRubricFromAllTables (Rubric.RubCod);
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Rubric_X_removed,
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Rubric_X_removed,
|
||||||
Rubrics.Rubric.Title);
|
Rubric.Title);
|
||||||
|
|
||||||
/***** Show rubrics again *****/
|
/***** Show rubrics again *****/
|
||||||
Rub_ListAllRubrics (&Rubrics);
|
Rub_ListAllRubrics (&Rubrics);
|
||||||
|
@ -736,24 +740,24 @@ void Rub_RemoveCrsRubrics (long CrsCod)
|
||||||
void Rub_ListRubric (void)
|
void Rub_ListRubric (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
|
Rub_ResetRubric (&Rubric);
|
||||||
/***** Reset rubric *****/
|
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,true);
|
Rub_GetPars (&Rubrics,true);
|
||||||
|
Rubric.RubCod = Rubrics.RubCod;
|
||||||
|
|
||||||
/***** Get rubric data *****/
|
/***** Get rubric data *****/
|
||||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
Rub_GetRubricDataByCod (&Rubric);
|
||||||
Rub_DB_GetRubricTxt (Rubrics.Rubric.RubCod,Txt);
|
Rub_DB_GetRubricTxt (Rubric.RubCod,Txt);
|
||||||
|
|
||||||
/***** Show rubric *****/
|
/***** Show rubric *****/
|
||||||
Rub_ShowOnlyOneRubric (&Rubrics,
|
Rub_ShowOnlyOneRubric (&Rubrics,&Rubric,
|
||||||
true); // List rubric criteria
|
true); // List rubric criteria
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -763,6 +767,7 @@ void Rub_ListRubric (void)
|
||||||
void Rub_ReqCreatOrEditRubric (void)
|
void Rub_ReqCreatOrEditRubric (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
Rub_ExistingNewRubric_t ExistingNewRubric;
|
Rub_ExistingNewRubric_t ExistingNewRubric;
|
||||||
|
|
||||||
|
@ -772,29 +777,30 @@ void Rub_ReqCreatOrEditRubric (void)
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,false); // Don't check rubric code
|
Rub_GetPars (&Rubrics,false); // Don't check rubric code
|
||||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||||
Rub_NEW_RUBRIC;
|
ExistingNewRubric = (Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||||
|
Rub_NEW_RUBRIC;
|
||||||
|
|
||||||
/***** Get rubric data *****/
|
/***** Get rubric data *****/
|
||||||
switch (ExistingNewRubric)
|
switch (ExistingNewRubric)
|
||||||
{
|
{
|
||||||
case Rub_EXISTING_RUBRIC:
|
case Rub_EXISTING_RUBRIC:
|
||||||
/* Get rubric data from database */
|
/* Get rubric data from database */
|
||||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
Rub_GetRubricDataByCod (&Rubric);
|
||||||
break;
|
break;
|
||||||
case Rub_NEW_RUBRIC:
|
case Rub_NEW_RUBRIC:
|
||||||
/* Initialize to empty rubric */
|
/* Initialize to empty rubric */
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Put form to create/edit a rubric and show criteria *****/
|
/***** Put form to create/edit a rubric and show criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,ExistingNewRubric);
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,ExistingNewRubric);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -802,6 +808,7 @@ void Rub_ReqCreatOrEditRubric (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||||
|
struct Rub_Rubric *Rubric,
|
||||||
struct RubCri_Criterion *Criterion,
|
struct RubCri_Criterion *Criterion,
|
||||||
Rub_ExistingNewRubric_t ExistingNewRubric)
|
Rub_ExistingNewRubric_t ExistingNewRubric)
|
||||||
{
|
{
|
||||||
|
@ -811,15 +818,15 @@ void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||||
switch (ExistingNewRubric)
|
switch (ExistingNewRubric)
|
||||||
{
|
{
|
||||||
case Rub_EXISTING_RUBRIC:
|
case Rub_EXISTING_RUBRIC:
|
||||||
Rub_DB_GetRubricTxt (Rubrics->Rubric.RubCod,Txt);
|
Rub_DB_GetRubricTxt (Rubric->RubCod,Txt);
|
||||||
break;
|
break;
|
||||||
case Rub_NEW_RUBRIC:
|
case Rub_NEW_RUBRIC:
|
||||||
Txt[0] = '\0';
|
Txt[0] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Put form to create/edit an exam *****/
|
/***** Put form to create/edit a rubric *****/
|
||||||
Rub_PutFormEditionRubric (Rubrics,Txt,ExistingNewRubric);
|
Rub_PutFormEditionRubric (Rubrics,Rubric,Txt,ExistingNewRubric);
|
||||||
|
|
||||||
/***** Show other lists *****/
|
/***** Show other lists *****/
|
||||||
switch (ExistingNewRubric)
|
switch (ExistingNewRubric)
|
||||||
|
@ -840,6 +847,7 @@ void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||||
|
struct Rub_Rubric *Rubric,
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
||||||
Rub_ExistingNewRubric_t ExistingNewRubric)
|
Rub_ExistingNewRubric_t ExistingNewRubric)
|
||||||
{
|
{
|
||||||
|
@ -883,8 +891,8 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||||
|
|
||||||
/***** Begin box and table *****/
|
/***** Begin box and table *****/
|
||||||
Box_BoxTableBegin (NULL,
|
Box_BoxTableBegin (NULL,
|
||||||
Rubrics->Rubric.Title[0] ? Rubrics->Rubric.Title :
|
Rubric->Title[0] ? Rubric->Title :
|
||||||
Title[ExistingNewRubric],
|
Title[ExistingNewRubric],
|
||||||
NULL,NULL,
|
NULL,NULL,
|
||||||
HelpLink[ExistingNewRubric],Box_NOT_CLOSABLE,2);
|
HelpLink[ExistingNewRubric],Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
|
@ -896,7 +904,7 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
HTM_INPUT_TEXT ("Title",Rub_MAX_CHARS_TITLE,Rubrics->Rubric.Title,
|
HTM_INPUT_TEXT ("Title",Rub_MAX_CHARS_TITLE,Rubric->Title,
|
||||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"Title\""
|
"id=\"Title\""
|
||||||
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
||||||
|
@ -938,6 +946,7 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||||
void Rub_ReceiveFormRubric (void)
|
void Rub_ReceiveFormRubric (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
Rub_ExistingNewRubric_t ExistingNewRubric;
|
Rub_ExistingNewRubric_t ExistingNewRubric;
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
@ -948,13 +957,14 @@ void Rub_ReceiveFormRubric (void)
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,false);
|
Rub_GetPars (&Rubrics,false);
|
||||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||||
Rub_NEW_RUBRIC;
|
ExistingNewRubric = (Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||||
|
Rub_NEW_RUBRIC;
|
||||||
|
|
||||||
/***** Get all current rubric data from database *****/
|
/***** Get all current rubric data from database *****/
|
||||||
// Some data, not received from form,
|
// Some data, not received from form,
|
||||||
|
@ -962,31 +972,31 @@ void Rub_ReceiveFormRubric (void)
|
||||||
switch (ExistingNewRubric)
|
switch (ExistingNewRubric)
|
||||||
{
|
{
|
||||||
case Rub_EXISTING_RUBRIC:
|
case Rub_EXISTING_RUBRIC:
|
||||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
Rub_GetRubricDataByCod (&Rubric);
|
||||||
break;
|
break;
|
||||||
case Rub_NEW_RUBRIC:
|
case Rub_NEW_RUBRIC:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Overwrite some rubric data with the data received from form *****/
|
/***** Overwrite some rubric data with the data received from form *****/
|
||||||
Rub_ReceiveRubricFieldsFromForm (&Rubrics.Rubric,Txt);
|
Rub_ReceiveRubricFieldsFromForm (&Rubric,Txt);
|
||||||
if (Rub_CheckRubricFieldsReceivedFromForm (&Rubrics.Rubric))
|
if (Rub_CheckRubricFieldsReceivedFromForm (&Rubric))
|
||||||
{
|
{
|
||||||
/***** Create a new rubric or update an existing one *****/
|
/***** Create a new rubric or update an existing one *****/
|
||||||
switch (ExistingNewRubric)
|
switch (ExistingNewRubric)
|
||||||
{
|
{
|
||||||
case Rub_EXISTING_RUBRIC:
|
case Rub_EXISTING_RUBRIC:
|
||||||
Rub_UpdateRubric (&Rubrics.Rubric,Txt); // Update rubric data in database
|
Rub_UpdateRubric (&Rubric,Txt); // Update rubric data in database
|
||||||
break;
|
break;
|
||||||
case Rub_NEW_RUBRIC:
|
case Rub_NEW_RUBRIC:
|
||||||
Rub_CreateRubric (&Rubrics.Rubric,Txt); // Add new rubric to database
|
Rub_CreateRubric (&Rubric,Txt); // Add new rubric to database
|
||||||
ExistingNewRubric = Rub_EXISTING_RUBRIC;
|
ExistingNewRubric = Rub_EXISTING_RUBRIC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,ExistingNewRubric);
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,ExistingNewRubric);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Rub_ReceiveRubricFieldsFromForm (struct Rub_Rubric *Rubric,
|
static void Rub_ReceiveRubricFieldsFromForm (struct Rub_Rubric *Rubric,
|
||||||
|
|
|
@ -46,12 +46,14 @@ void Rub_ResetRubric (struct Rub_Rubric *Rubric);
|
||||||
void Rub_SeeAllRubrics (void);
|
void Rub_SeeAllRubrics (void);
|
||||||
void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics);
|
void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics);
|
||||||
bool Rub_CheckIfICanEditRubrics (void);
|
bool Rub_CheckIfICanEditRubrics (void);
|
||||||
bool Rub_CheckIfEditable (const struct Rub_Rubric *Rubric);
|
bool Rub_CheckIfEditable (void);
|
||||||
void Rub_SeeOneRubric (void);
|
void Rub_SeeOneRubric (void);
|
||||||
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics,
|
void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics,
|
||||||
bool ListRubricDims);
|
const struct Rub_Rubric *Rubric,
|
||||||
|
bool ListRubricCriteria);
|
||||||
void Rub_ShowOnlyOneRubricBegin (struct Rub_Rubrics *Rubrics,
|
void Rub_ShowOnlyOneRubricBegin (struct Rub_Rubrics *Rubrics,
|
||||||
bool ListRubricDims);
|
const struct Rub_Rubric *Rubric,
|
||||||
|
bool ListRubricCriteria);
|
||||||
void Rub_ShowOnlyOneRubricEnd (void);
|
void Rub_ShowOnlyOneRubricEnd (void);
|
||||||
|
|
||||||
void Rub_SetCurrentRubCod (long GamCod);
|
void Rub_SetCurrentRubCod (long GamCod);
|
||||||
|
@ -71,9 +73,11 @@ void Rub_ListRubric (void);
|
||||||
|
|
||||||
void Rub_ReqCreatOrEditRubric (void);
|
void Rub_ReqCreatOrEditRubric (void);
|
||||||
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||||
|
struct Rub_Rubric *Rubric,
|
||||||
struct RubCri_Criterion *Criterion,
|
struct RubCri_Criterion *Criterion,
|
||||||
Rub_ExistingNewRubric_t ExistingNewRubric);
|
Rub_ExistingNewRubric_t ExistingNewRubric);
|
||||||
void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||||
|
struct Rub_Rubric *Rubric,
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
char Txt[Cns_MAX_BYTES_TEXT + 1],
|
||||||
Rub_ExistingNewRubric_t ExistingNewRubric);
|
Rub_ExistingNewRubric_t ExistingNewRubric);
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,9 @@ static void RubCri_GetCriterionDataFromRow (MYSQL_RES *mysql_res,
|
||||||
|
|
||||||
static void RubCri_PutTableHeadingForCriteria (void);
|
static void RubCri_PutTableHeadingForCriteria (void);
|
||||||
|
|
||||||
static void RubCri_GetAndCheckPars (struct Rub_Rubrics *Rubrics,
|
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics,
|
||||||
struct RubCri_Criterion *Criterion);
|
struct Rub_Rubric *Rubric,
|
||||||
|
struct RubCri_Criterion *Criterion);
|
||||||
|
|
||||||
static void RubCri_ExchangeCriteria (long RubCod,
|
static void RubCri_ExchangeCriteria (long RubCod,
|
||||||
unsigned CriIndTop,unsigned CriIndBottom);
|
unsigned CriIndTop,unsigned CriIndBottom);
|
||||||
|
@ -232,22 +233,23 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
||||||
void RubCri_ReceiveFormCriterion (void)
|
void RubCri_ReceiveFormCriterion (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,true);
|
Rub_GetPars (&Rubrics,true);
|
||||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||||
|
|
||||||
/***** Get rubric data from database *****/
|
/***** Get rubric data from database *****/
|
||||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
Rub_GetRubricDataByCod (&Rubric);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** If I can edit rubrics ==> receive criterion from form *****/
|
/***** If I can edit rubrics ==> receive criterion from form *****/
|
||||||
|
@ -257,7 +259,7 @@ void RubCri_ReceiveFormCriterion (void)
|
||||||
RubCri_CreateCriterion (&Criterion); // Add new criterion to database
|
RubCri_CreateCriterion (&Criterion); // Add new criterion to database
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,20 +330,21 @@ static bool RubCri_CheckCriterionTitleReceivedFromForm (const struct RubCri_Crit
|
||||||
void RubCri_ChangeTitle (void)
|
void RubCri_ChangeTitle (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
char NewTitle[RubCri_MAX_BYTES_TITLE + 1];
|
char NewTitle[RubCri_MAX_BYTES_TITLE + 1];
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Receive new title from form *****/
|
/***** Receive new title from form *****/
|
||||||
Par_GetParText ("Title",NewTitle,RubCri_MAX_BYTES_TITLE);
|
Par_GetParText ("Title",NewTitle,RubCri_MAX_BYTES_TITLE);
|
||||||
|
@ -355,7 +358,7 @@ void RubCri_ChangeTitle (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,24 +379,25 @@ void RubCri_ChangeMaxValue (void)
|
||||||
static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
char ValueStr[64];
|
char ValueStr[64];
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,true);
|
Rub_GetPars (&Rubrics,true);
|
||||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||||
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Receive new value from form *****/
|
/***** Receive new value from form *****/
|
||||||
|
@ -405,7 +409,7 @@ static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
||||||
Rub_DB_UpdateCriterionValue (&Criterion,ValueRange);
|
Rub_DB_UpdateCriterionValue (&Criterion,ValueRange);
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,24 +420,25 @@ static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
||||||
void RubCri_ChangeWeight (void)
|
void RubCri_ChangeWeight (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
char WeightStr[64];
|
char WeightStr[64];
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,true);
|
Rub_GetPars (&Rubrics,true);
|
||||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
Criterion.RubCod = Rubric.RubCod = Rubrics.RubCod;
|
||||||
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Receive new weight from form *****/
|
/***** Receive new weight from form *****/
|
||||||
|
@ -445,7 +450,7 @@ void RubCri_ChangeWeight (void)
|
||||||
Rub_DB_UpdateCriterionWeight (&Criterion);
|
Rub_DB_UpdateCriterionWeight (&Criterion);
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,13 +487,13 @@ void RubCri_ListCriteria (struct Rub_Rubrics *Rubrics,
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
unsigned MaxCriInd;
|
unsigned MaxCriInd;
|
||||||
unsigned NumCriteria;
|
unsigned NumCriteria;
|
||||||
bool ICanEditCriteria = Rub_CheckIfEditable (&Rubrics->Rubric);
|
bool ICanEditCriteria = Rub_CheckIfEditable ();
|
||||||
|
|
||||||
/***** Get maximum criterion index *****/
|
/***** Get maximum criterion index *****/
|
||||||
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics->Rubric.RubCod);
|
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics->RubCod);
|
||||||
|
|
||||||
/***** Get data of rubric criteria from database *****/
|
/***** Get data of rubric criteria from database *****/
|
||||||
NumCriteria = Rub_DB_GetCriteria (&mysql_res,Rubrics->Rubric.RubCod);
|
NumCriteria = Rub_DB_GetCriteria (&mysql_res,Rubrics->RubCod);
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Box_BoxBegin (NULL,Txt_Criteria,
|
Box_BoxBegin (NULL,Txt_Criteria,
|
||||||
|
@ -826,18 +831,19 @@ void RubCri_ReqRemCriterion (void)
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_criterion_X;
|
extern const char *Txt_Do_you_really_want_to_remove_the_criterion_X;
|
||||||
extern const char *Txt_Remove_criterion;
|
extern const char *Txt_Remove_criterion;
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Show question and button to remove question *****/
|
/***** Show question and button to remove question *****/
|
||||||
|
@ -848,7 +854,7 @@ void RubCri_ReqRemCriterion (void)
|
||||||
Criterion.Title);
|
Criterion.Title);
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,18 +866,19 @@ void RubCri_RemoveCriterion (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Criterion_removed;
|
extern const char *Txt_Criterion_removed;
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Remove the criterion from all tables *****/
|
/***** Remove the criterion from all tables *****/
|
||||||
|
@ -888,7 +895,7 @@ void RubCri_RemoveCriterion (void)
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Criterion_removed);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Criterion_removed);
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,41 +907,42 @@ void RubCri_MoveUpCriterion (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Movement_not_allowed;
|
extern const char *Txt_Movement_not_allowed;
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
unsigned CriIndTop;
|
unsigned CriIndTop;
|
||||||
unsigned CriIndBottom;
|
unsigned CriIndBottom;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Get criterion index *****/
|
/***** Get criterion index *****/
|
||||||
CriIndBottom = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Criterion.CriCod);
|
CriIndBottom = Rub_DB_GetCriIndFromCriCod (Rubric.RubCod,Criterion.CriCod);
|
||||||
|
|
||||||
/***** Move up criterion *****/
|
/***** Move up criterion *****/
|
||||||
if (CriIndBottom > 1)
|
if (CriIndBottom > 1)
|
||||||
{
|
{
|
||||||
/* Indexes of criteria to be exchanged */
|
/* Indexes of criteria to be exchanged */
|
||||||
CriIndTop = Rub_DB_GetPrevCriterionIndexInRubric (Rubrics.Rubric.RubCod,CriIndBottom);
|
CriIndTop = Rub_DB_GetPrevCriterionIndexInRubric (Rubric.RubCod,CriIndBottom);
|
||||||
if (CriIndTop == 0)
|
if (CriIndTop == 0)
|
||||||
Err_ShowErrorAndExit ("Wrong criterion index.");
|
Err_ShowErrorAndExit ("Wrong criterion index.");
|
||||||
|
|
||||||
/* Exchange criteria */
|
/* Exchange criteria */
|
||||||
RubCri_ExchangeCriteria (Rubrics.Rubric.RubCod,CriIndTop,CriIndBottom);
|
RubCri_ExchangeCriteria (Rubric.RubCod,CriIndTop,CriIndBottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -946,6 +954,7 @@ void RubCri_MoveDownCriterion (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Movement_not_allowed;
|
extern const char *Txt_Movement_not_allowed;
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
unsigned CriIndTop;
|
unsigned CriIndTop;
|
||||||
unsigned CriIndBottom;
|
unsigned CriIndBottom;
|
||||||
|
@ -953,60 +962,62 @@ void RubCri_MoveDownCriterion (void)
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Get criterion index *****/
|
/***** Get criterion index *****/
|
||||||
CriIndTop = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Criterion.CriCod);
|
CriIndTop = Rub_DB_GetCriIndFromCriCod (Rubric.RubCod,Criterion.CriCod);
|
||||||
|
|
||||||
/***** Get maximum criterion index *****/
|
/***** Get maximum criterion index *****/
|
||||||
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics.Rubric.RubCod);
|
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubric.RubCod);
|
||||||
|
|
||||||
/***** Move down criterion *****/
|
/***** Move down criterion *****/
|
||||||
if (CriIndTop < MaxCriInd)
|
if (CriIndTop < MaxCriInd)
|
||||||
{
|
{
|
||||||
/* Indexes of criteria to be exchanged */
|
/* Indexes of criteria to be exchanged */
|
||||||
CriIndBottom = Rub_DB_GetNextCriterionIndexInRubric (Rubrics.Rubric.RubCod,CriIndTop);
|
CriIndBottom = Rub_DB_GetNextCriterionIndexInRubric (Rubric.RubCod,CriIndTop);
|
||||||
if (CriIndBottom == 0) // 0 means error reading from database
|
if (CriIndBottom == 0) // 0 means error reading from database
|
||||||
Err_ShowErrorAndExit ("Wrong criterion index.");
|
Err_ShowErrorAndExit ("Wrong criterion index.");
|
||||||
|
|
||||||
/* Exchange criteria */
|
/* Exchange criteria */
|
||||||
RubCri_ExchangeCriteria (Rubrics.Rubric.RubCod,CriIndTop,CriIndBottom);
|
RubCri_ExchangeCriteria (Rubric.RubCod,CriIndTop,CriIndBottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new trubric
|
Rub_EXISTING_RUBRIC); // It's not a new trubric
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************** Get and check parameters *************************/
|
/********* Get and check parameters, rubric data and criterion data **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void RubCri_GetAndCheckPars (struct Rub_Rubrics *Rubrics,
|
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics,
|
||||||
struct RubCri_Criterion *Criterion)
|
struct Rub_Rubric *Rubric,
|
||||||
|
struct RubCri_Criterion *Criterion)
|
||||||
{
|
{
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (Rubrics,true);
|
Rub_GetPars (Rubrics,true);
|
||||||
|
Rubric->RubCod = Rubrics->RubCod;
|
||||||
Criterion->CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
Criterion->CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||||
|
|
||||||
/***** Get rubric data from database *****/
|
/***** Get rubric data from database *****/
|
||||||
Rub_GetRubricDataByCod (&Rubrics->Rubric);
|
Rub_GetRubricDataByCod (Rubric);
|
||||||
if (Rubrics->Rubric.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
if (Rubric->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||||
Err_WrongRubricExit ();
|
Err_WrongRubricExit ();
|
||||||
|
|
||||||
/***** Get criterion data from database *****/
|
/***** Get criterion data from database *****/
|
||||||
RubCri_GetCriterionDataByCod (Criterion);
|
RubCri_GetCriterionDataByCod (Criterion);
|
||||||
if (Criterion->RubCod != Rubrics->Rubric.RubCod)
|
if (Criterion->RubCod != Rubric->RubCod)
|
||||||
Err_WrongCriterionExit ();
|
Err_WrongCriterionExit ();
|
||||||
Rubrics->CriCod = Criterion->CriCod;
|
Rubrics->CriCod = Criterion->CriCod;
|
||||||
}
|
}
|
||||||
|
@ -1063,18 +1074,19 @@ static void RubCri_ExchangeCriteria (long RubCod,
|
||||||
void RubCri_ChangeLink (void)
|
void RubCri_ChangeLink (void)
|
||||||
{
|
{
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
Rub_ResetRubrics (&Rubrics);
|
Rub_ResetRubrics (&Rubrics);
|
||||||
Rub_ResetRubric (&Rubrics.Rubric);
|
Rub_ResetRubric (&Rubric);
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
|
|
||||||
/***** Get and check parameters *****/
|
/***** Get and check parameters *****/
|
||||||
RubCri_GetAndCheckPars (&Rubrics,&Criterion);
|
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Rubric,&Criterion);
|
||||||
|
|
||||||
/***** Check if rubric is editable *****/
|
/***** Check if rubric is editable *****/
|
||||||
if (!Rub_CheckIfEditable (&Rubrics.Rubric))
|
if (!Rub_CheckIfEditable ())
|
||||||
Err_NoPermissionExit ();
|
Err_NoPermissionExit ();
|
||||||
|
|
||||||
/***** Get link type and code *****/
|
/***** Get link type and code *****/
|
||||||
|
@ -1088,6 +1100,6 @@ void RubCri_ChangeLink (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show current rubric and its criteria *****/
|
/***** Show current rubric and its criteria *****/
|
||||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
Rub_PutFormsOneRubric (&Rubrics,&Rubric,&Criterion,
|
||||||
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
Rub_EXISTING_RUBRIC); // It's not a new rubric
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,10 @@ unsigned Rub_DB_GetListRubrics (MYSQL_RES **mysql_res)
|
||||||
{
|
{
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get rubrics",
|
DB_QuerySELECT (mysql_res,"can not get rubrics",
|
||||||
"SELECT RubCod" // row[0]
|
"SELECT RubCod," // row[0]
|
||||||
|
"CrsCod," // row[1]
|
||||||
|
"UsrCod," // row[2]
|
||||||
|
"Title" // row[3]
|
||||||
" FROM rub_rubrics"
|
" FROM rub_rubrics"
|
||||||
" WHERE CrsCod=%ld"
|
" WHERE CrsCod=%ld"
|
||||||
" ORDER BY Title",
|
" ORDER BY Title",
|
||||||
|
|
|
@ -51,6 +51,7 @@ void RubRsc_GetLinkToRubric (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||||
struct Rub_Rubrics Rubrics;
|
struct Rub_Rubrics Rubrics;
|
||||||
|
struct Rub_Rubric Rubric;
|
||||||
char Title[Rub_MAX_BYTES_TITLE + 1];
|
char Title[Rub_MAX_BYTES_TITLE + 1];
|
||||||
|
|
||||||
/***** Reset rubrics context *****/
|
/***** Reset rubrics context *****/
|
||||||
|
@ -58,12 +59,13 @@ void RubRsc_GetLinkToRubric (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Rub_GetPars (&Rubrics,false);
|
Rub_GetPars (&Rubrics,false);
|
||||||
|
Rubric.RubCod = Rubrics.RubCod;
|
||||||
|
|
||||||
/***** Get rubric title *****/
|
/***** Get rubric title *****/
|
||||||
RubRsc_GetTitleFromRubCod (Rubrics.Rubric.RubCod,Title,sizeof (Title) - 1);
|
RubRsc_GetTitleFromRubCod (Rubric.RubCod,Title,sizeof (Title) - 1);
|
||||||
|
|
||||||
/***** Copy link to rubric into resource clipboard *****/
|
/***** Copy link to rubric into resource clipboard *****/
|
||||||
Rsc_DB_CopyToClipboard (Rsc_RUBRIC,Rubrics.Rubric.RubCod);
|
Rsc_DB_CopyToClipboard (Rsc_RUBRIC,Rubric.RubCod);
|
||||||
|
|
||||||
/***** Write sucess message *****/
|
/***** Write sucess message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||||
|
|
|
@ -50,7 +50,6 @@ struct Rub_Rubric
|
||||||
long CrsCod; // Course code
|
long CrsCod; // Course code
|
||||||
long UsrCod; // Author code
|
long UsrCod; // Author code
|
||||||
char Title[Rub_MAX_BYTES_TITLE + 1];
|
char Title[Rub_MAX_BYTES_TITLE + 1];
|
||||||
unsigned NumCriteria; // Number of criteria in the rubric
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Rub_Rubrics
|
struct Rub_Rubrics
|
||||||
|
@ -58,12 +57,11 @@ struct Rub_Rubrics
|
||||||
bool LstIsRead; // Is the list already read from database...
|
bool LstIsRead; // Is the list already read from database...
|
||||||
// ...or it needs to be read?
|
// ...or it needs to be read?
|
||||||
unsigned Num; // Total number of rubrics
|
unsigned Num; // Total number of rubrics
|
||||||
long *Lst; // List of rubric codes
|
struct Rub_Rubric *Lst; // List of rubrics
|
||||||
unsigned CurrentPage;
|
unsigned CurrentPage;
|
||||||
struct Rub_Rubric Rubric; // Selected/current rubric
|
long RubCod; // Selected/current rubric code
|
||||||
long CriCod; // Selected/current criterion code
|
long CriCod; // Selected/current criterion code
|
||||||
unsigned CriInd; // Current citerion index
|
unsigned CriInd; // Current citerion index
|
||||||
long QstCod; // Current question code
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
Loading…
Reference in New Issue