mirror of https://github.com/acanas/swad-core.git
Version 22.83.3: Mar 27, 2023 Changes in rubric criteria.
This commit is contained in:
parent
55a4c2aae6
commit
0350f81df0
|
@ -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.83.2 (2023-03-27)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.83.3 (2023-03-27)"
|
||||
#define CSS_FILE "swad22.78.15.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 22.83.3: Mar 27, 2023 Changes in rubric criteria. (338218 lines)
|
||||
Version 22.83.2: Mar 27, 2023 Changes in rubric criteria. (338189 lines)
|
||||
Version 22.83.1: Mar 27, 2023 Changes in rubric criteria. (338297 lines)
|
||||
Version 22.83: Mar 27, 2023 New module swad_resource_database. (338208 lines)
|
||||
|
|
|
@ -884,11 +884,15 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
|||
HTM_UL_Begin ("class=\"PRG_CLIPBOARD\"");
|
||||
|
||||
/***** Current link (empty or not) *****/
|
||||
Rsc_WriteRowClipboard (false,&Item->Resource.Link);
|
||||
Rsc_WriteRowClipboard (&Item->Resource.Link,
|
||||
false, // Don't submit on click
|
||||
true); // Checked
|
||||
|
||||
/***** Row with empty link to remove the current link *****/
|
||||
if (Item->Resource.Link.Type != Rsc_NONE)
|
||||
Rsc_WriteRowClipboard (true,&EmptyLink);
|
||||
Rsc_WriteRowClipboard (&EmptyLink,
|
||||
true, // Submit on click
|
||||
false); // Not checked
|
||||
|
||||
/***** Get links in clipboard from database and write them *****/
|
||||
NumLinks = Rsc_DB_GetClipboard (&mysql_res);
|
||||
|
@ -897,7 +901,9 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
|||
NumLink++)
|
||||
{
|
||||
Rsc_GetLinkDataFromRow (mysql_res,&Link);
|
||||
Rsc_WriteRowClipboard (true,&Link);
|
||||
Rsc_WriteRowClipboard (&Link,
|
||||
true, // Submit on click
|
||||
false); // Not checked
|
||||
}
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
|
@ -915,9 +921,6 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
|||
void PrgRsc_ChangeLink (void)
|
||||
{
|
||||
struct Prg_Item Item;
|
||||
char TypeCod[3 + 1 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
||||
char TypeStr[3 + 1];
|
||||
long Cod;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
Prg_GetListItems ();
|
||||
|
@ -929,12 +932,8 @@ void PrgRsc_ChangeLink (void)
|
|||
Err_WrongResourceExit ();
|
||||
|
||||
/* Get link type and code */
|
||||
Par_GetParText ("Link",TypeCod,sizeof (TypeCod) - 1);
|
||||
if (sscanf (TypeCod,"%3s_%ld",TypeStr,&Cod) == 2)
|
||||
if (Rsc_GetParLink (&Item.Resource.Link))
|
||||
{
|
||||
Item.Resource.Link.Type = Rsc_GetTypeFromString (TypeStr);
|
||||
Item.Resource.Link.Cod = Cod;
|
||||
|
||||
/***** Is it an existing resource? *****/
|
||||
if (Item.Resource.Hierarchy.RscCod <= 0)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "swad_game_resource.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_HTML.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_project_resource.h"
|
||||
#include "swad_resource.h"
|
||||
#include "swad_role.h"
|
||||
|
@ -105,7 +106,8 @@ extern struct Globals Gbl;
|
|||
/************************ Show one link from clipboard ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rsc_WriteRowClipboard (bool SubmitOnClick,const struct Rsc_Link *Link)
|
||||
void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
|
||||
bool SubmitOnClick,bool Checked)
|
||||
{
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
|
@ -116,14 +118,14 @@ void Rsc_WriteRowClipboard (bool SubmitOnClick,const struct Rsc_Link *Link)
|
|||
HTM_INPUT_RADIO ("Link",SubmitOnClick,
|
||||
"value=\"%s_%ld\"%s",
|
||||
Rsc_ResourceTypesDB[Link->Type],Link->Cod,
|
||||
SubmitOnClick ? "" :
|
||||
" checked=\"checked\"");
|
||||
Checked ? " checked=\"checked\"" :
|
||||
"");
|
||||
|
||||
/***** Name *****/
|
||||
Rsc_WriteLinkName (Link,
|
||||
false, // Don't put form
|
||||
Rsc_ResourceTypesIcons[Link->Type],
|
||||
Txt_RESOURCE_TYPES[Link->Type]);
|
||||
false, // Don't put form to go
|
||||
Rsc_ResourceTypesIcons[Link->Type],
|
||||
Txt_RESOURCE_TYPES[Link->Type]);
|
||||
|
||||
HTM_LABEL_End ();
|
||||
HTM_LI_End ();
|
||||
|
@ -250,6 +252,32 @@ Rsc_Type_t Rsc_GetTypeFromString (const char *Str)
|
|||
return Rsc_NONE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get resource data from clipboard *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Rsc_GetParLink (struct Rsc_Link *Link)
|
||||
{
|
||||
char TypeCod[3 + 1 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
||||
char TypeStr[3 + 1];
|
||||
long Cod;
|
||||
|
||||
/***** Get link type and code *****/
|
||||
Par_GetParText ("Link",TypeCod,sizeof (TypeCod) - 1);
|
||||
if (sscanf (TypeCod,"%3s_%ld",TypeStr,&Cod) == 2)
|
||||
{
|
||||
/* Correct link found */
|
||||
Link->Type = Rsc_GetTypeFromString (TypeStr);
|
||||
Link->Cod = Cod;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* No link found */
|
||||
Link->Type = Rsc_NONE;
|
||||
Link->Cod = -1L;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Check if I can get link **************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -72,7 +72,8 @@ struct Rsc_Link
|
|||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rsc_WriteRowClipboard (bool SubmitOnClick,const struct Rsc_Link *Link);
|
||||
void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
|
||||
bool SubmitOnClick,bool Checked);
|
||||
void Rsc_WriteLinkName (const struct Rsc_Link *Link,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void Rsc_WriteResourceEmpty (__attribute__((unused)) long Cod,
|
||||
|
@ -85,6 +86,8 @@ void Rsc_GetResourceTitleFromLink (struct Rsc_Link *Link,
|
|||
void Rsc_GetLinkDataFromRow (MYSQL_RES *mysql_res,struct Rsc_Link *Link);
|
||||
Rsc_Type_t Rsc_GetTypeFromString (const char *Str);
|
||||
|
||||
bool Rsc_GetParLink (struct Rsc_Link *Link);
|
||||
|
||||
bool Rsc_CheckIfICanGetLink (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -74,7 +74,6 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
static void RubCri_ReceiveCriterionFieldsFromForm (struct RubCri_Criterion *Criterion);
|
||||
static bool RubCri_CheckCriterionTitleReceivedFromForm (const struct RubCri_Criterion *Criterion,
|
||||
const char NewTitle[RubCri_MAX_BYTES_TITLE + 1]);
|
||||
static Rsc_Type_t RubCri_GetParType (void);
|
||||
|
||||
static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange);
|
||||
|
||||
|
@ -154,10 +153,16 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
{
|
||||
extern const char *Txt_New_criterion;
|
||||
extern const char *Txt_Create_criterion;
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
Rsc_Type_t Type;
|
||||
unsigned SourceUnsigned;
|
||||
RubCri_ValueRange_t ValueRange;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumLink;
|
||||
unsigned NumLinks;
|
||||
struct Rsc_Link Link;
|
||||
static const struct Rsc_Link EmptyLink =
|
||||
{
|
||||
.Type = Rsc_NONE,
|
||||
.Cod = -1L,
|
||||
};
|
||||
|
||||
/***** Begin form *****/
|
||||
Frm_BeginForm (ActNewRubCri);
|
||||
|
@ -175,16 +180,16 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Empty column for buttons *****/
|
||||
HTM_TD_Begin ("class=\"BM\"");
|
||||
HTM_TD_Begin ("class=\"BT\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Index *****/
|
||||
HTM_TD_Begin ("class=\"RM\"");
|
||||
HTM_TD_Begin ("class=\"RT\"");
|
||||
Lay_WriteIndex (MaxCriInd + 1,"BIG_INDEX");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
HTM_INPUT_TEXT ("Title",RubCri_MAX_CHARS_TITLE,Criterion->Title,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"Title\""
|
||||
|
@ -193,21 +198,33 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Source *****/
|
||||
HTM_TD_Begin ("class=\"LM %s\"",The_GetColorRows ());
|
||||
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"name=\"Type\" class=\"INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
for (Type = (Rsc_Type_t) 0;
|
||||
Type <= (Rsc_Type_t) (Rsc_NUM_TYPES - 1);
|
||||
Type++)
|
||||
/***** Link *****/
|
||||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||
|
||||
/***** Begin list *****/
|
||||
HTM_UL_Begin ("class=\"PRG_CLIPBOARD\"");
|
||||
|
||||
/***** Row with empty link *****/
|
||||
Rsc_WriteRowClipboard (&EmptyLink,
|
||||
false, // Don't submit on click
|
||||
true); // Checked
|
||||
|
||||
/***** Get links in clipboard from database and write them *****/
|
||||
NumLinks = Rsc_DB_GetClipboard (&mysql_res);
|
||||
for (NumLink = 1;
|
||||
NumLink <= NumLinks;
|
||||
NumLink++)
|
||||
{
|
||||
SourceUnsigned = (unsigned) Type;
|
||||
HTM_OPTION (HTM_Type_UNSIGNED,&SourceUnsigned,
|
||||
Type == Criterion->Link.Type,false,
|
||||
"%s",Txt_RESOURCE_TYPES[Type]);
|
||||
Rsc_GetLinkDataFromRow (mysql_res,&Link);
|
||||
Rsc_WriteRowClipboard (&Link,
|
||||
false, // Don't submit on click
|
||||
false); // Not checked
|
||||
}
|
||||
HTM_SELECT_End ();
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** End list *****/
|
||||
HTM_UL_End ();
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Minimum and maximum values of the criterion *****/
|
||||
|
@ -286,8 +303,10 @@ static void RubCri_ReceiveCriterionFieldsFromForm (struct RubCri_Criterion *Crit
|
|||
/***** Get criterion title *****/
|
||||
Par_GetParText ("Title",Criterion->Title,RubCri_MAX_BYTES_TITLE);
|
||||
|
||||
/***** Get criterion source *****/
|
||||
Criterion->Link.Type = RubCri_GetParType ();
|
||||
/***** Get criterion link to resource *****/
|
||||
if (Rsc_GetParLink (&Criterion->Link))
|
||||
/***** Remove link from clipboard *****/
|
||||
Rsc_DB_RemoveLinkFromClipboard (&Criterion->Link);
|
||||
|
||||
/***** Get minimum and maximum values of criterion *****/
|
||||
for (ValueRange = (RubCri_ValueRange_t) 0;
|
||||
|
@ -335,19 +354,6 @@ static bool RubCri_CheckCriterionTitleReceivedFromForm (const struct RubCri_Crit
|
|||
return NewTitleIsCorrect;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get parameter with criterion source **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static Rsc_Type_t RubCri_GetParType (void)
|
||||
{
|
||||
return (Rsc_Type_t)
|
||||
Par_GetParUnsignedLong ("Type",
|
||||
0,
|
||||
Rsc_NUM_TYPES - 1,
|
||||
(unsigned long) Rsc_NONE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Receive form to change title of rubric criterion **************/
|
||||
/*****************************************************************************/
|
||||
|
@ -564,7 +570,6 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
{
|
||||
extern const char *Txt_Criteria;
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
// Actions to change minimum/maximum criterion values
|
||||
static Act_Action_t RubCri_ActionsValues[RubCri_NUM_VALUES] =
|
||||
{
|
||||
|
@ -1106,7 +1111,7 @@ static void RubCri_ShowResource (struct Rub_Rubrics *Rubrics,
|
|||
RubCri_ShowClipboard (Rubrics,Criterion,Anchor);
|
||||
else
|
||||
Rsc_WriteLinkName (&Criterion->Link,
|
||||
true, // Put form
|
||||
true, // Put form to go
|
||||
Rsc_ResourceTypesIcons[Criterion->Link.Type],
|
||||
Txt_RESOURCE_TYPES[Criterion->Link.Type]);
|
||||
}
|
||||
|
@ -1137,11 +1142,16 @@ static void RubCri_ShowClipboard (struct Rub_Rubrics *Rubrics,
|
|||
HTM_UL_Begin ("class=\"PRG_CLIPBOARD\"");
|
||||
|
||||
/***** Current link (empty or not) *****/
|
||||
Rsc_WriteRowClipboard (false,&Criterion->Link);
|
||||
Rsc_WriteRowClipboard (&Criterion->Link,
|
||||
false, // Don't submit on click
|
||||
true); // Checked
|
||||
|
||||
/***** Row with empty link to remove the current link *****/
|
||||
if (Criterion->Link.Type != Rsc_NONE)
|
||||
Rsc_WriteRowClipboard (true,&EmptyLink);
|
||||
Rsc_WriteRowClipboard (&EmptyLink,
|
||||
true, // Don't submit on click
|
||||
false); // Checked
|
||||
|
||||
|
||||
/***** Get links in clipboard from database and write them *****/
|
||||
NumLinks = Rsc_DB_GetClipboard (&mysql_res);
|
||||
|
@ -1150,7 +1160,9 @@ static void RubCri_ShowClipboard (struct Rub_Rubrics *Rubrics,
|
|||
NumLink++)
|
||||
{
|
||||
Rsc_GetLinkDataFromRow (mysql_res,&Link);
|
||||
Rsc_WriteRowClipboard (true,&Link);
|
||||
Rsc_WriteRowClipboard (&Link,
|
||||
true, // Don't submit on click
|
||||
false); // Checked
|
||||
}
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
|
@ -1169,9 +1181,6 @@ void RubCri_ChangeLink (void)
|
|||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char TypeCod[3 + 1 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
||||
char TypeStr[3 + 1];
|
||||
long Cod;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
|
@ -1186,12 +1195,8 @@ void RubCri_ChangeLink (void)
|
|||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get link type and code *****/
|
||||
Par_GetParText ("Link",TypeCod,sizeof (TypeCod) - 1);
|
||||
if (sscanf (TypeCod,"%3s_%ld",TypeStr,&Cod) == 2)
|
||||
if (Rsc_GetParLink (&Criterion.Link))
|
||||
{
|
||||
Criterion.Link.Type = Rsc_GetTypeFromString (TypeStr);
|
||||
Criterion.Link.Cod = Cod;
|
||||
|
||||
/***** Update link to resource in criterion *****/
|
||||
Rub_DB_UpdateCriterionLink (&Criterion);
|
||||
|
||||
|
|
Loading…
Reference in New Issue