Version 22.16: Sep 21, 2022 Changes in program layout.

This commit is contained in:
acanas 2022-09-21 10:10:12 +02:00
parent a7608da596
commit f41c479fe0
7 changed files with 65 additions and 5092 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1838,7 +1838,7 @@ void Asg_WriteAssignmentInCrsProgram (long AsgCod,bool PutFormToGo,
/***** Icon depending on type ******/ /***** Icon depending on type ******/
if (PutFormToGo) if (PutFormToGo)
Ico_PutIconLink (Icon,Ico_BLACK,ActSeeGam); Ico_PutIconLink (Icon,Ico_BLACK,ActSeeOneAsg);
else else
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle); Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);

View File

@ -606,10 +606,11 @@ 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.15 (2022-09-21)" #define Log_PLATFORM_VERSION "SWAD 22.16 (2022-09-21)"
#define CSS_FILE "swad22.7.css" #define CSS_FILE "swad22.16.css"
#define JS_FILE "swad21.100.js" #define JS_FILE "swad21.100.js"
/* /*
Version 22.16: Sep 21, 2022 Changes in program layout. (331455 lines)
Version 22.15: Sep 21, 2022 Links to assignments in program. (331442 lines) Version 22.15: Sep 21, 2022 Links to assignments in program. (331442 lines)
Version 22.14: Sep 21, 2022 An assignment is shown when clicking on its title. (331300 lines) Version 22.14: Sep 21, 2022 An assignment is shown when clicking on its title. (331300 lines)
Version 22.13: Sep 20, 2022 Links to course forum threads in program. (331234 lines) Version 22.13: Sep 20, 2022 Links to course forum threads in program. (331234 lines)

View File

@ -207,13 +207,14 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,
long SelectedItmCod,long SelectedRscCod) long SelectedItmCod,long SelectedRscCod)
{ {
extern const char *Hlp_COURSE_Program; extern const char *Hlp_COURSE_Program;
extern const char *Txt_Course_program; extern const char *Txt_COURSE_program;
long ParentItmCod = -1L; // Initialized to avoid warning long ParentItmCod = -1L; // Initialized to avoid warning
unsigned NumItem; unsigned NumItem;
unsigned FormLevel = 0; // Initialized to avoid warning unsigned FormLevel = 0; // Initialized to avoid warning
Prg_ListingType_t LT; Prg_ListingType_t LT;
struct Prg_Item Item; struct Prg_Item Item;
struct Prg_ItemRange ToHighlight; struct Prg_ItemRange ToHighlight;
char *Title;
static bool FirstTBodyOpen = false; static bool FirstTBodyOpen = false;
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *Args) = static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *Args) =
{ {
@ -265,9 +266,12 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,
} }
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin ("100%",Txt_Course_program, if (asprintf (&Title,Txt_COURSE_program,Gbl.Hierarchy.Crs.ShrtName) < 0)
Err_NotEnoughMemoryExit ();
Box_BoxBegin ("100%",Title,
FunctionToDrawContextualIcons[ListingType],NULL, FunctionToDrawContextualIcons[ListingType],NULL,
Hlp_COURSE_Program,Box_NOT_CLOSABLE); Hlp_COURSE_Program,Box_NOT_CLOSABLE);
free (Title);
/***** Table *****/ /***** Table *****/
HTM_TABLE_BeginWideMarginPadding (2); HTM_TABLE_BeginWideMarginPadding (2);
@ -606,7 +610,7 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
} }
/* List of resources */ /* List of resources */
PrgRsc_ListItemResources (ListingType,Item->Hierarchy.ItmCod,SelectedRscCod); PrgRsc_ListItemResources (ListingType,Item,SelectedRscCod);
/* End text and resources */ /* End text and resources */
HTM_TD_End (); HTM_TD_End ();
@ -2086,7 +2090,7 @@ void Prg_GetAndShowCourseProgramStats (void) // TODO: Change function from assig
(double) NumCoursesWithItems; (double) NumCoursesWithItems;
/***** Begin box and table *****/ /***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_ASSIGNMENTS], Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_COURSE_PROGRAMS],
NULL,NULL, NULL,NULL,
Hlp_ANALYTICS_Figures_course_programs,Box_NOT_CLOSABLE,2); Hlp_ANALYTICS_Figures_course_programs,Box_NOT_CLOSABLE,2);

View File

@ -25,6 +25,8 @@
/********************************* Headers ***********************************/ /********************************* Headers ***********************************/
/*****************************************************************************/ /*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <stdio.h> // For asprintf
#include <string.h> // For string functions #include <string.h> // For string functions
#include "swad_attendance.h" #include "swad_attendance.h"
@ -119,7 +121,8 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item);
static void PrgRsc_WriteRowClipboard (bool SubmitOnClick,const struct Prg_Link *Link); static void PrgRsc_WriteRowClipboard (bool SubmitOnClick,const struct Prg_Link *Link);
static void PrgRsc_WriteLinkName (const struct Prg_Link *Link,bool PutFormToGo, static void PrgRsc_WriteLinkName (const struct Prg_Link *Link,bool PutFormToGo,
const char *Icon,const char *IconTitle); const char *Icon,const char *IconTitle);
static void PrgRsc_WriteEmptyLinkInCrsProgram (long Cod,__attribute__((unused)) bool PutFormToGo, static void PrgRsc_WriteEmptyLinkInCrsProgram (__attribute__((unused)) long Cod,
__attribute__((unused)) bool PutFormToGo,
const char *Icon,const char *IconTitle); const char *Icon,const char *IconTitle);
static void PrgRsc_GetDataOfLinkFromClipboard (struct Prg_Link *Link, static void PrgRsc_GetDataOfLinkFromClipboard (struct Prg_Link *Link,
MYSQL_RES **mysql_res); MYSQL_RES **mysql_res);
@ -171,16 +174,16 @@ void PrgRsc_EditResources (void)
/*****************************************************************************/ /*****************************************************************************/
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType, void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
long ItmCod,long SelectedRscCod) struct Prg_Item *Item,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;
extern const char *Txt_Resources; extern const char *Txt_Resources_of_X;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumRsc; unsigned NumRsc;
unsigned NumResources; unsigned NumResources;
struct Prg_Item Item;
bool EditLink; bool EditLink;
char *Title;
static bool GetHiddenResources[Prg_NUM_LISTING_TYPES] = static bool GetHiddenResources[Prg_NUM_LISTING_TYPES] =
{ {
[Prg_PRINT ] = false, [Prg_PRINT ] = false,
@ -243,11 +246,11 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
}; };
/***** Trivial check *****/ /***** Trivial check *****/
if (ItmCod <= 0) if (Item->Hierarchy.ItmCod <= 0)
return; return;
/***** Get list of item resources from database *****/ /***** Get list of item resources from database *****/
NumResources = Prg_DB_GetListResources (&mysql_res,ItmCod, NumResources = Prg_DB_GetListResources (&mysql_res,Item->Hierarchy.ItmCod,
GetHiddenResources[ListingType]); GetHiddenResources[ListingType]);
if (NumResources || ShowListWhenEmpty[ListingType]) if (NumResources || ShowListWhenEmpty[ListingType])
@ -272,9 +275,12 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
} }
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin ("100%",Txt_Resources, if (asprintf (&Title,Txt_Resources_of_X,Item->Title) < 0)
FunctionToDrawContextualIcons[ListingType],&ItmCod, Err_NotEnoughMemoryExit ();
Box_BoxBegin ("100%",Title,
FunctionToDrawContextualIcons[ListingType],&Item->Hierarchy.ItmCod,
Hlp_COURSE_Program,Box_NOT_CLOSABLE); Hlp_COURSE_Program,Box_NOT_CLOSABLE);
free (Title);
/***** Table *****/ /***** Table *****/
HTM_TABLE_BeginWideMarginPadding (2); HTM_TABLE_BeginWideMarginPadding (2);
@ -286,7 +292,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
NumRsc++, The_ChangeRowColor1 (1)) NumRsc++, The_ChangeRowColor1 (1))
{ {
/* Get data of this item resource */ /* Get data of this item resource */
PrgRsc_GetDataOfResource (&Item,&mysql_res); PrgRsc_GetDataOfResource (Item,&mysql_res);
/* Show item */ /* Show item */
switch (ListingType) switch (ListingType)
@ -295,27 +301,26 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
case Prg_EDIT_RESOURCE_LINK: case Prg_EDIT_RESOURCE_LINK:
case Prg_CHANGE_RESOURCE_LINK: case Prg_CHANGE_RESOURCE_LINK:
EditLink = (ListingType == Prg_EDIT_RESOURCE_LINK && EditLink = (ListingType == Prg_EDIT_RESOURCE_LINK &&
Item.Resource.Hierarchy.RscCod == SelectedRscCod); Item->Resource.Hierarchy.RscCod == SelectedRscCod);
PrgRsc_WriteRowEditResource (NumRsc,NumResources,&Item, PrgRsc_WriteRowEditResource (NumRsc,
EditLink); NumResources,Item,EditLink);
break; break;
default: default:
PrgRsc_WriteRowViewResource (NumRsc,&Item); PrgRsc_WriteRowViewResource (NumRsc,Item);
break; break;
} }
} }
/***** Form to create a new resource *****/ /***** Form to create a new resource *****/
Item->Resource.Hierarchy.RscCod = -1L;
switch (ListingType) switch (ListingType)
{ {
case Prg_EDIT_RESOURCES: case Prg_EDIT_RESOURCES:
case Prg_EDIT_RESOURCE_LINK: case Prg_EDIT_RESOURCE_LINK:
case Prg_CHANGE_RESOURCE_LINK: case Prg_CHANGE_RESOURCE_LINK:
Prg_ResetItem (&Item);
Item.Hierarchy.ItmCod = ItmCod;
EditLink = (ListingType == Prg_EDIT_RESOURCE_LINK && EditLink = (ListingType == Prg_EDIT_RESOURCE_LINK &&
Item.Resource.Hierarchy.RscCod == SelectedRscCod); Item->Resource.Hierarchy.RscCod == SelectedRscCod);
PrgRsc_WriteRowNewResource (NumResources,&Item,EditLink); PrgRsc_WriteRowNewResource (NumResources,Item,EditLink);
break; break;
default: default:
break; break;
@ -520,6 +525,8 @@ static void PrgRsc_WriteRowNewResource (unsigned NumResources,
struct Prg_Item *Item, struct Prg_Item *Item,
bool EditLink) bool EditLink)
{ {
extern const char *Txt_New_resource;
/***** Begin row *****/ /***** Begin row *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -544,7 +551,7 @@ static void PrgRsc_WriteRowNewResource (unsigned NumResources,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"placeholder=\"%s\"" "placeholder=\"%s\""
" class=\"PRG_RSC_INPUT INPUT_%s\"", " class=\"PRG_RSC_INPUT INPUT_%s\"",
"Nuevo recurso", // TODO: Need translation!!!!!!!!!!!!!!!!!!! Txt_New_resource,
The_GetSuffix ()); The_GetSuffix ());
Frm_EndForm (); Frm_EndForm ();
@ -1037,14 +1044,17 @@ static void PrgRsc_WriteLinkName (const struct Prg_Link *Link,bool PutFormToGo,
/********************** Write survey in course program ***********************/ /********************** Write survey in course program ***********************/
/*****************************************************************************/ /*****************************************************************************/
static void PrgRsc_WriteEmptyLinkInCrsProgram (__attribute__((unused)) long Cod,__attribute__((unused)) bool PutFormToGo, static void PrgRsc_WriteEmptyLinkInCrsProgram (__attribute__((unused)) long Cod,
__attribute__((unused)) bool PutFormToGo,
const char *Icon,const char *IconTitle) const char *Icon,const char *IconTitle)
{ {
extern const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES];
/***** Icon depending on type ******/ /***** Icon depending on type ******/
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle); Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
/***** Write Name of the course and date of exam *****/ /***** Write Name of the course and date of exam *****/
HTM_Txt ("sin enlace"); // TODO: Need translation!!!!!!!!!!!!! HTM_Txt (Txt_RESOURCE_TYPES[PrgRsc_NONE]);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -31,7 +31,7 @@ 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,
long SelectedItmCod,long SelectedRscCod); struct Prg_Item *Item,long SelectedRscCod);
void PrgRsc_GetDataOfResourceByCod (struct Prg_Item *Item); void PrgRsc_GetDataOfResourceByCod (struct Prg_Item *Item);

View File

@ -6060,27 +6060,27 @@ const char *Txt_course =
"kurs"; "kurs";
#endif #endif
const char *Txt_Course_program = const char *Txt_COURSE_program = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca #if L==1 // ca
"Programa de l'assignatura"; "Programa de %s";
#elif L==2 // de #elif L==2 // de
"Kursprogramm"; "Programm %s";
#elif L==3 // en #elif L==3 // en
"Course program"; "%s program";
#elif L==4 // es #elif L==4 // es
"Programa de la asignatura"; "Programa de %s";
#elif L==5 // fr #elif L==5 // fr
"Programme de la mati&egrave;re"; "Programme de %s";
#elif L==6 // gn #elif L==6 // gn
"Programa de la asignatura"; // Okoteve traducción "Programa de %s"; // Okoteve traducción
#elif L==7 // it #elif L==7 // it
"Programma del corso"; "Programma di %s";
#elif L==8 // pl #elif L==8 // pl
"Program kursu"; "Program %s";
#elif L==9 // pt #elif L==9 // pt
"Programa da disciplina"; "Programa de %s";
#elif L==10 // tr #elif L==10 // tr
"Course program"; // Çeviri lazim! "%s program&inodot;";
#endif #endif
const char *Txt_COURSE_STATUS[Hie_NUM_STATUS_TXT] = const char *Txt_COURSE_STATUS[Hie_NUM_STATUS_TXT] =
@ -35928,27 +35928,27 @@ const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES] =
#endif #endif
}; };
const char *Txt_Resources = const char *Txt_Resources_of_X = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca #if L==1 // ca
"Recursos"; "Recursos de %s";
#elif L==2 // de #elif L==2 // de
"Ressourcen"; "%s-Ressourcen";
#elif L==3 // en #elif L==3 // en
"Resources"; "Resources of %s";
#elif L==4 // es #elif L==4 // es
"Recursos"; "Recursos de %s";
#elif L==5 // fr #elif L==5 // fr
"Ressources"; "Ressources de %s";
#elif L==6 // gn #elif L==6 // gn
"Recursos"; // Okoteve traducción "Recursos de %s"; // Okoteve traducción
#elif L==7 // it #elif L==7 // it
"Risorse"; "Risorse di %s";
#elif L==8 // pl #elif L==8 // pl
"Zasoby"; "Zasoby %s";
#elif L==9 // pt #elif L==9 // pt
"Recursos"; "Recursos de %s";
#elif L==10 // tr #elif L==10 // tr
"Kaynaklar"; "%s kaynaklar&inodot;";
#endif #endif
const char *Txt_Result = const char *Txt_Result =