mirror of https://github.com/acanas/swad-core.git
Version 22.19: Sep 22, 2022 Fixed bugs in program.
This commit is contained in:
parent
1b5071da3d
commit
891122d268
|
@ -606,10 +606,13 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
||||||
|
|
||||||
TODO: Attach pdf files in multimedia.
|
TODO: Attach pdf files in multimedia.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 22.18 (2022-09-21)"
|
#define Log_PLATFORM_VERSION "SWAD 22.19 (2022-09-21)"
|
||||||
#define CSS_FILE "swad22.18.css"
|
#define CSS_FILE "swad22.18.css"
|
||||||
#define JS_FILE "swad21.100.js"
|
#define JS_FILE "swad21.100.js"
|
||||||
/*
|
/*
|
||||||
|
TODO: Los items ocultos no deben salir en modo ver. En modo edición deben salir en otro color.
|
||||||
|
TODO: Enlace Ok en los TFG sale de otro color.
|
||||||
|
Version 22.19: Sep 22, 2022 Fixed bugs in program. (331843 lines)
|
||||||
Version 22.18: Sep 22, 2022 Expand/contract program items. (331877 lines)
|
Version 22.18: Sep 22, 2022 Expand/contract program items. (331877 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
CREATE TABLE IF NOT EXISTS prg_expanded (UsrCod INT NOT NULL,ItmCod INT NOT NULL,ClickTime DATETIME NOT NULL,UNIQUE INDEX(UsrCod,ItmCod),INDEX(ItmCod),INDEX(ClickTime));
|
CREATE TABLE IF NOT EXISTS prg_expanded (UsrCod INT NOT NULL,ItmCod INT NOT NULL,ClickTime DATETIME NOT NULL,UNIQUE INDEX(UsrCod,ItmCod),INDEX(ItmCod),INDEX(ClickTime));
|
||||||
|
|
|
@ -647,7 +647,7 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||||
Prg_WriteItemText (Item->Hierarchy.ItmCod,LightStyle);
|
Prg_WriteItemText (Item->Hierarchy.ItmCod,LightStyle);
|
||||||
|
|
||||||
/* List of resources */
|
/* List of resources */
|
||||||
PrgRsc_ListItemResources (ListingType,Item,SelectedRscCod);
|
PrgRsc_ListItemResources (ListingType,Item,SelectedItmCod,SelectedRscCod);
|
||||||
|
|
||||||
/* End text and resources */
|
/* End text and resources */
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
|
@ -105,11 +105,9 @@ static void PrgRsc_GetDataOfResource (struct Prg_Item *Item,
|
||||||
static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
||||||
const struct Prg_Item *Item);
|
const struct Prg_Item *Item);
|
||||||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||||
struct Prg_Item *Item,
|
struct Prg_Item *Item,bool EditLink);
|
||||||
bool EditLink);
|
|
||||||
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
||||||
struct Prg_Item *Item,
|
struct Prg_Item *Item,bool EditLink);
|
||||||
bool EditLink);
|
|
||||||
static void PrgRsc_PutFormsToRemEditOneResource (struct Prg_Item *Item,
|
static void PrgRsc_PutFormsToRemEditOneResource (struct Prg_Item *Item,
|
||||||
unsigned NumRsc,
|
unsigned NumRsc,
|
||||||
unsigned NumResources);
|
unsigned NumResources);
|
||||||
|
@ -176,7 +174,9 @@ void PrgRsc_EditResources (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
struct Prg_Item *Item,long SelectedRscCod)
|
struct Prg_Item *Item,
|
||||||
|
long SelectedItmCod,
|
||||||
|
long SelectedRscCod)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_COURSE_Program;
|
extern const char *Hlp_COURSE_Program;
|
||||||
extern const char *Txt_Remove_resource;
|
extern const char *Txt_Remove_resource;
|
||||||
|
@ -184,24 +184,10 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
unsigned NumRsc;
|
unsigned NumRsc;
|
||||||
unsigned NumResources;
|
unsigned NumResources;
|
||||||
|
bool EditingResourcesOfThisItem;
|
||||||
bool EditLink;
|
bool EditLink;
|
||||||
char *Title;
|
char *Title;
|
||||||
static bool GetHiddenResources[Prg_NUM_LISTING_TYPES] =
|
static bool Editing[Prg_NUM_LISTING_TYPES] =
|
||||||
{
|
|
||||||
[Prg_PRINT ] = false,
|
|
||||||
[Prg_VIEW ] = false,
|
|
||||||
[Prg_EDIT_ITEMS ] = false,
|
|
||||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
|
||||||
[Prg_FORM_NEW_CHILD_ITEM ] = false,
|
|
||||||
[Prg_FORM_EDIT_ITEM ] = false,
|
|
||||||
[Prg_END_EDIT_ITEM ] = false,
|
|
||||||
[Prg_RECEIVE_ITEM ] = false,
|
|
||||||
[Prg_EDIT_RESOURCES ] = true,
|
|
||||||
[Prg_EDIT_RESOURCE_LINK ] = true,
|
|
||||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
|
||||||
[Prg_END_EDIT_RES ] = false,
|
|
||||||
};
|
|
||||||
static bool ShowListWhenEmpty[Prg_NUM_LISTING_TYPES] =
|
|
||||||
{
|
{
|
||||||
[Prg_PRINT ] = false,
|
[Prg_PRINT ] = false,
|
||||||
[Prg_VIEW ] = false,
|
[Prg_VIEW ] = false,
|
||||||
|
@ -216,7 +202,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||||
[Prg_END_EDIT_RES ] = true,
|
[Prg_END_EDIT_RES ] = true,
|
||||||
};
|
};
|
||||||
static bool FeaturedList[Prg_NUM_LISTING_TYPES] =
|
static bool EditingResources[Prg_NUM_LISTING_TYPES] =
|
||||||
{
|
{
|
||||||
[Prg_PRINT ] = false,
|
[Prg_PRINT ] = false,
|
||||||
[Prg_VIEW ] = false,
|
[Prg_VIEW ] = false,
|
||||||
|
@ -229,22 +215,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
[Prg_EDIT_RESOURCES ] = true,
|
[Prg_EDIT_RESOURCES ] = true,
|
||||||
[Prg_EDIT_RESOURCE_LINK ] = true,
|
[Prg_EDIT_RESOURCE_LINK ] = true,
|
||||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||||
[Prg_END_EDIT_RES ] = true,
|
[Prg_END_EDIT_RES ] = false,
|
||||||
};
|
|
||||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *ItmCod) =
|
|
||||||
{
|
|
||||||
[Prg_PRINT ] = NULL,
|
|
||||||
[Prg_VIEW ] = NULL,
|
|
||||||
[Prg_EDIT_ITEMS ] = PrgRsc_PutIconsEditResources,
|
|
||||||
[Prg_FORM_NEW_END_ITEM ] = PrgRsc_PutIconsEditResources,
|
|
||||||
[Prg_FORM_NEW_CHILD_ITEM ] = PrgRsc_PutIconsEditResources,
|
|
||||||
[Prg_FORM_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
|
||||||
[Prg_END_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
|
||||||
[Prg_RECEIVE_ITEM ] = PrgRsc_PutIconsEditResources,
|
|
||||||
[Prg_EDIT_RESOURCES ] = PrgRsc_PutIconsViewResources,
|
|
||||||
[Prg_EDIT_RESOURCE_LINK ] = PrgRsc_PutIconsViewResources,
|
|
||||||
[Prg_CHANGE_RESOURCE_LINK] = PrgRsc_PutIconsViewResources,
|
|
||||||
[Prg_END_EDIT_RES ] = PrgRsc_PutIconsEditResources,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/***** Trivial check *****/
|
/***** Trivial check *****/
|
||||||
|
@ -253,34 +224,39 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
|
|
||||||
/***** Get list of item resources from database *****/
|
/***** Get list of item resources from database *****/
|
||||||
NumResources = Prg_DB_GetListResources (&mysql_res,Item->Hierarchy.ItmCod,
|
NumResources = Prg_DB_GetListResources (&mysql_res,Item->Hierarchy.ItmCod,
|
||||||
GetHiddenResources[ListingType]);
|
EditingResources[ListingType]);
|
||||||
|
|
||||||
if (NumResources || ShowListWhenEmpty[ListingType])
|
if (NumResources || Editing[ListingType])
|
||||||
{
|
{
|
||||||
/***** Begin section *****/
|
/***** Begin section *****/
|
||||||
if (FeaturedList[ListingType])
|
// if (FeaturedList[ListingType])
|
||||||
|
if (Item->Hierarchy.ItmCod == SelectedItmCod)
|
||||||
HTM_SECTION_Begin (PrgRsc_RESOURCE_SECTION_ID);
|
HTM_SECTION_Begin (PrgRsc_RESOURCE_SECTION_ID);
|
||||||
|
|
||||||
/***** Show possible alerts *****/
|
/***** Show possible alerts *****/
|
||||||
if (FeaturedList[ListingType])
|
if (Item->Hierarchy.ItmCod == SelectedItmCod)
|
||||||
switch (Gbl.Action.Act)
|
{
|
||||||
{
|
if (Gbl.Action.Act == ActReqRemPrgRsc)
|
||||||
case ActReqRemPrgRsc:
|
/* Alert with button to remove resource */
|
||||||
/* Alert with button to remove resource */
|
Ale_ShowLastAlertAndButton (ActRemPrgRsc,PrgRsc_RESOURCE_SECTION_ID,NULL,
|
||||||
Ale_ShowLastAlertAndButton (ActRemPrgRsc,PrgRsc_RESOURCE_SECTION_ID,NULL,
|
Prg_PutParamRscCod,&SelectedRscCod,
|
||||||
Prg_PutParamRscCod,&SelectedRscCod,
|
Btn_REMOVE_BUTTON,Txt_Remove_resource);
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_resource);
|
else
|
||||||
break;
|
Ale_ShowAlerts (PrgRsc_RESOURCE_SECTION_ID);
|
||||||
default:
|
}
|
||||||
Ale_ShowAlerts (PrgRsc_RESOURCE_SECTION_ID);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
|
EditingResourcesOfThisItem = EditingResources[ListingType] &&
|
||||||
|
(Item->Hierarchy.ItmCod == SelectedItmCod);
|
||||||
|
|
||||||
if (asprintf (&Title,Txt_Resources_of_X,Item->Title) < 0)
|
if (asprintf (&Title,Txt_Resources_of_X,Item->Title) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
Box_BoxBegin ("100%",Title,
|
Box_BoxBegin ("100%",Title,
|
||||||
FunctionToDrawContextualIcons[ListingType],&Item->Hierarchy.ItmCod,
|
Editing[ListingType] ? (EditingResourcesOfThisItem ? PrgRsc_PutIconsViewResources :
|
||||||
|
PrgRsc_PutIconsEditResources) :
|
||||||
|
NULL,
|
||||||
|
Editing[ListingType] ? &Item->Hierarchy.ItmCod :
|
||||||
|
NULL,
|
||||||
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
||||||
free (Title);
|
free (Title);
|
||||||
|
|
||||||
|
@ -297,36 +273,23 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
PrgRsc_GetDataOfResource (Item,&mysql_res);
|
PrgRsc_GetDataOfResource (Item,&mysql_res);
|
||||||
|
|
||||||
/* Show item */
|
/* Show item */
|
||||||
switch (ListingType)
|
if (EditingResourcesOfThisItem)
|
||||||
{
|
{
|
||||||
case Prg_EDIT_RESOURCES:
|
EditLink = (Item->Resource.Hierarchy.RscCod == SelectedRscCod);
|
||||||
case Prg_EDIT_RESOURCE_LINK:
|
PrgRsc_WriteRowEditResource (NumRsc,NumResources,Item,EditLink);
|
||||||
case Prg_CHANGE_RESOURCE_LINK:
|
}
|
||||||
EditLink = (ListingType == Prg_EDIT_RESOURCE_LINK &&
|
else
|
||||||
Item->Resource.Hierarchy.RscCod == SelectedRscCod);
|
PrgRsc_WriteRowViewResource (NumRsc,Item);
|
||||||
PrgRsc_WriteRowEditResource (NumRsc,
|
|
||||||
NumResources,Item,EditLink);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
PrgRsc_WriteRowViewResource (NumRsc,Item);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Form to create a new resource *****/
|
/***** Form to create a new resource *****/
|
||||||
Item->Resource.Hierarchy.RscCod = -1L;
|
if (EditingResourcesOfThisItem)
|
||||||
switch (ListingType)
|
{
|
||||||
{
|
Item->Resource.Hierarchy.RscCod = -1L;
|
||||||
case Prg_EDIT_RESOURCES:
|
EditLink = (ListingType == Prg_EDIT_RESOURCE_LINK &&
|
||||||
case Prg_EDIT_RESOURCE_LINK:
|
Item->Resource.Hierarchy.RscCod == SelectedRscCod);
|
||||||
case Prg_CHANGE_RESOURCE_LINK:
|
PrgRsc_WriteRowNewResource (NumResources,Item,EditLink);
|
||||||
EditLink = (ListingType == Prg_EDIT_RESOURCE_LINK &&
|
}
|
||||||
Item->Resource.Hierarchy.RscCod == SelectedRscCod);
|
|
||||||
PrgRsc_WriteRowNewResource (NumResources,Item,EditLink);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TBODY_End ();
|
HTM_TBODY_End ();
|
||||||
|
@ -336,7 +299,8 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
|
|
||||||
/***** End section *****/
|
/***** End section *****/
|
||||||
if (FeaturedList[ListingType])
|
// if (FeaturedList[ListingType])
|
||||||
|
if (Item->Hierarchy.ItmCod == SelectedItmCod)
|
||||||
HTM_SECTION_End ();
|
HTM_SECTION_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,8 +433,7 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||||
struct Prg_Item *Item,
|
struct Prg_Item *Item,bool EditLink)
|
||||||
bool EditLink)
|
|
||||||
{
|
{
|
||||||
extern const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES];
|
extern const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES];
|
||||||
|
|
||||||
|
@ -524,8 +487,7 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
||||||
struct Prg_Item *Item,
|
struct Prg_Item *Item,bool EditLink)
|
||||||
bool EditLink)
|
|
||||||
{
|
{
|
||||||
extern const char *Txt_New_resource;
|
extern const char *Txt_New_resource;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,9 @@ void PrgRsc_ViewResourcesAfterEdit (void);
|
||||||
void PrgRsc_EditResources (void);
|
void PrgRsc_EditResources (void);
|
||||||
|
|
||||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
struct Prg_Item *Item,long SelectedRscCod);
|
struct Prg_Item *Item,
|
||||||
|
long SelectedItmCod,
|
||||||
|
long SelectedRscCod);
|
||||||
|
|
||||||
void PrgRsc_GetDataOfResourceByCod (struct Prg_Item *Item);
|
void PrgRsc_GetDataOfResourceByCod (struct Prg_Item *Item);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue