Link to calls for exams in program.

This commit is contained in:
acanas 2022-09-18 16:32:59 +02:00
parent e5d9888810
commit e878405ecd
11 changed files with 156 additions and 62 deletions

View File

@ -1946,9 +1946,9 @@ function DrawMonth (id,FirstDayOfWeek,
Mon == CurrentMonth &&
Day == CurrentDay);
/* Check if day has an exam announcement */
/* Check if day has a call for exam */
ThisDayHasEvent = false;
if (!DrawingCalendar || Mon == MonthToDraw) // If drawing calendar and the month is not the real one, don't draw exam announcements
if (!DrawingCalendar || Mon == MonthToDraw) // If drawing calendar and the month is not the real one, don't draw call for exams
for (NumExamAnnouncement = 0;
NumExamAnnouncement < LstExamAnnouncements.length;
NumExamAnnouncement++)

View File

@ -683,7 +683,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActRemCfe ] = { 187,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cfe_RemoveCallForExam1 ,Cfe_RemoveCallForExam2 ,NULL},
[ActHidCfe ] = {1620,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cfe_HideCallForExam ,Cfe_ListCallsForExamsEdit ,NULL},
[ActUnhCfe ] = {1621,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cfe_UnhideCallForExam ,Cfe_ListCallsForExamsEdit ,NULL},
[ActReqLnkCfe ] = {1934,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cfe_GetLinkToFile ,NULL},
[ActReqLnkCfe ] = {1934,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cfe_GetLinkToCallForExam ,NULL},
[ActEdiOneTstQst ] = { 105,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Qst_ShowFormEditOneQst ,NULL},
[ActReqImpTstQst ] = {1007,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,QstImp_ShowFormImpQstsFromXML ,NULL},

View File

@ -9146,7 +9146,7 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
}
/*****************************************************************************/
/******************** Get summary and content of a file **********************/
/********************** Get file name from file code *************************/
/*****************************************************************************/
void Brw_GetFileNameFromFilCod (long FilCod,char *FileName,size_t FileNameSize)

View File

@ -32,7 +32,6 @@
#include "swad_box.h"
#include "swad_calendar.h"
#include "swad_call_for_exam.h"
#include "swad_database.h"
#include "swad_error.h"
#include "swad_figure.h"

View File

@ -47,12 +47,19 @@
#include "swad_notification.h"
#include "swad_notification_database.h"
#include "swad_parameter.h"
#include "swad_program_database.h"
#include "swad_QR.h"
#include "swad_RSS.h"
#include "swad_string.h"
#include "swad_timeline.h"
#include "swad_timeline_database.h"
/*****************************************************************************/
/**************************** Private constants ******************************/
/*****************************************************************************/
#define Cfe_MAX_BYTES_SESSION_AND_DATE (Cfe_MAX_BYTES_SESSION + (2 + Cns_MAX_BYTES_DATE + 7) + 1)
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
@ -91,6 +98,9 @@ static long Cfe_GetParamExaCod (void);
static void Cfe_GetNotifContentCallForExam (const struct Cfe_CallsForExams *CallsForExams,
char **ContentStr);
static void Cfe_BuildSessionAndDate (const struct Cfe_CallsForExams *CallsForExams,
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE]);
/*****************************************************************************/
/******************** Get global calls for exams context *********************/
/*****************************************************************************/
@ -1570,8 +1580,7 @@ void Cfe_GetSummaryAndContentCallForExam (char SummaryStr[Ntf_MAX_BYTES_SUMMARY
{
extern const char *Txt_hours_ABBREVIATION;
struct Cfe_CallsForExams CallsForExams;
char CrsNameAndDate[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + (2 + Cns_MAX_BYTES_DATE + 7) + 1];
char StrExamDate[Cns_MAX_BYTES_DATE + 1];
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE];
/***** Reset calls for exams context *****/
Cfe_ResetCallsForExams (&CallsForExams);
@ -1590,14 +1599,9 @@ void Cfe_GetSummaryAndContentCallForExam (char SummaryStr[Ntf_MAX_BYTES_SUMMARY
Cfe_GetNotifContentCallForExam (&CallsForExams,ContentStr);
/***** Summary *****/
/* Name of the course and date of exam */
Dat_ConvDateToDateStr (&CallsForExams.CallForExam.ExamDate,StrExamDate);
snprintf (CrsNameAndDate,sizeof (CrsNameAndDate),"%s, %s, %2u:%02u",
CallsForExams.CallForExam.CrsFullName,
StrExamDate,
CallsForExams.CallForExam.StartTime.Hour,
CallsForExams.CallForExam.StartTime.Minute);
Str_Copy (SummaryStr,CrsNameAndDate,Ntf_MAX_BYTES_SUMMARY);
/* Session and date of the exam */
Cfe_BuildSessionAndDate (&CallsForExams,SessionAndDate);
Str_Copy (SummaryStr,SessionAndDate,Ntf_MAX_BYTES_SUMMARY);
/***** Free memory of the call for exam *****/
Cfe_FreeMemCallForExam (&CallsForExams);
@ -1689,24 +1693,42 @@ static void Cfe_GetNotifContentCallForExam (const struct Cfe_CallsForExams *Call
void Cfe_WriteCallForExamInCrsProgram (long ExaCod,bool PutFormToGo)
{
extern const char *Txt_Call_for_exam;
extern const char *Txt_Actions[Act_NUM_ACTIONS];
struct Cfe_CallsForExams CallsForExams;
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE];
char *Anchor = NULL;
/***** Get session and date of the exam *****/
Cfe_ResetCallsForExams (&CallsForExams);
Cfe_AllocMemCallForExam (&CallsForExams);
Cfe_GetDataCallForExamFromDB (&CallsForExams,ExaCod);
Cfe_BuildSessionAndDate (&CallsForExams,SessionAndDate);
Cfe_FreeMemCallForExam (&CallsForExams);
/***** Begin form to download file *****/
if (PutFormToGo)
{
Frm_BeginForm (ActSeeOneCfe);
/* Build anchor string */
Frm_SetAnchorStr (ExaCod,&Anchor);
/* Begin form */
Frm_BeginFormAnchor (ActSeeOneCfe,Anchor);
Cfe_PutHiddenParamExaCod (ExaCod);
HTM_BUTTON_Submit_Begin (Txt_Call_for_exam,
HTM_BUTTON_Submit_Begin (Txt_Actions[ActSeeOneCfe],
"class=\"LM BT_LINK PRG_RSC_%s\"",
The_GetSuffix ());
/* Free anchor string */
Frm_FreeAnchorStr (Anchor);
}
/***** Write filename *****/
HTM_Txt ("Convocatoria de examen");
/***** Write Name of the course and date of exam *****/
HTM_Txt (SessionAndDate);
/***** End form to download file *****/
if (PutFormToGo)
{
/* End form */
HTM_BUTTON_End ();
Frm_EndForm ();
@ -1714,33 +1736,85 @@ void Cfe_WriteCallForExamInCrsProgram (long ExaCod,bool PutFormToGo)
}
/*****************************************************************************/
/*********************** Get link to call for exam ************************/
/************************ Get link to call for exam **************************/
/*****************************************************************************/
void Cfe_GetLinkToFile (void)
void Cfe_GetLinkToCallForExam (void)
{
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
// struct FileMetadata FileMetadata;
// bool Found;
struct Cfe_CallsForExams *CallsForExams = Cfe_GetGlobalCallsForExams ();
long ExaCod;
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE];
/***** Get parameters related to file browser *****/
// Brw_GetParAndInitFileBrowser ();
/***** Reset calls for exams context *****/
Cfe_ResetCallsForExams (CallsForExams);
/***** Get file metadata *****/
// FileMetadata.FilCod = Brw_GetParamFilCod ();
// Brw_GetFileMetadataByCod (&FileMetadata);
// Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
/***** Get the code of the call for exam *****/
if ((ExaCod = Cfe_GetParamExaCod ()) <= 0)
Err_WrongCallForExamExit ();
// if (Found)
// {
/***** Copy link to file into resource clipboard *****/
// Prg_DB_CopyToClipboard (PrgRsc_DOCUMENT,FileMetadata.FilCod);
/***** Get data of call for exam *****/
Cfe_AllocMemCallForExam (CallsForExams);
Cfe_GetDataCallForExamFromDB (CallsForExams,ExaCod);
/***** Write sucess message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
"Convocatoria");
// }
/***** Session and date of the exam *****/
Cfe_BuildSessionAndDate (CallsForExams,SessionAndDate);
/***** Show again the file browser *****/
// Brw_ShowAgainFileBrowserOrWorks ();
/***** Copy link to call for exam into resource clipboard *****/
Prg_DB_CopyToClipboard (PrgRsc_CALL_FOR_EXAM,ExaCod);
/***** Write sucess message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
SessionAndDate);
/***** Free memory of the call for exam *****/
Cfe_FreeMemCallForExam (CallsForExams);
/***** Set exam to be highlighted *****/
CallsForExams->HighlightExaCod = ExaCod;
/***** Show again the list of calls for exams *****/
Cfe_ListCallsForExamsEdit ();
}
/*****************************************************************************/
/************** Get call for exam text from call for exam code ***************/
/*****************************************************************************/
void Cfe_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize)
{
extern const char *Txt_Call_for_exam;
struct Cfe_CallsForExams CallsForExams;
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE];
/***** Reset calls for exams context *****/
Cfe_ResetCallsForExams (&CallsForExams);
/***** Get data of call for exam *****/
Cfe_AllocMemCallForExam (&CallsForExams);
Cfe_GetDataCallForExamFromDB (&CallsForExams,ExaCod);
/***** Session and date of the exam *****/
Cfe_BuildSessionAndDate (&CallsForExams,SessionAndDate);
snprintf (Title,TitleSize,"%s: %s",Txt_Call_for_exam,SessionAndDate);
/***** Free memory of the call for exam *****/
Cfe_FreeMemCallForExam (&CallsForExams);
}
/*****************************************************************************/
/*********** Build string with session and date of a call for exam ***********/
/*****************************************************************************/
static void Cfe_BuildSessionAndDate (const struct Cfe_CallsForExams *CallsForExams,
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE])
{
char StrExamDate[Cns_MAX_BYTES_DATE + 1];
Dat_ConvDateToDateStr (&CallsForExams->CallForExam.ExamDate,StrExamDate);
snprintf (SessionAndDate,Cfe_MAX_BYTES_SESSION_AND_DATE,"%s, %s, %2u:%02u",
CallsForExams->CallForExam.Session,
StrExamDate,
CallsForExams->CallForExam.StartTime.Hour,
CallsForExams->CallForExam.StartTime.Minute);
}

View File

@ -128,6 +128,7 @@ void Cfe_GetSummaryAndContentCallForExam (char SummaryStr[Ntf_MAX_BYTES_SUMMARY
void Cfe_WriteCallForExamInCrsProgram (long ExaCod,bool PutFormToGo);
void Cfe_GetLinkToFile (void);
void Cfe_GetLinkToCallForExam (void);
void Cfe_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize);
#endif

View File

@ -610,7 +610,8 @@ TODO: Attach pdf files in multimedia.
#define CSS_FILE "swad22.7.css"
#define JS_FILE "swad21.100.js"
/*
Version 22.7: Sep 17, 2022 Link to calls for exams in program. (? lines)
Version 22.7: Sep 18, 2022 Link to calls for exams in program.
Notification of a call for exam now links to the call. (330230 lines)
Version 22.6: Sep 17, 2022 Changes in edition of program items. (330065 lines)
Version 22.5: Sep 16, 2022 Link to download document in program. (330018 lines)
Version 22.4.2: Sep 16, 2022 Changes in edition of program items. (329982 lines)

View File

@ -699,10 +699,23 @@ static Act_Action_t Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
long DegCod = -1L;
long GrpCod = -1L;
Act_Action_t Action = ActUnk;
char *Anchor = NULL;
/***** Parameters depending on the type of event *****/
switch (NotifyEvent)
{
case Ntf_EVENT_CALL_FOR_EXAM:
/* Build anchor string */
Frm_SetAnchorStr (Cod,&Anchor);
/* Begin form */
Action = ActSeeOneCfe;
Frm_BeginFormAnchor (ActSeeOneCfe,Anchor);
Cfe_PutHiddenParamExaCod (Cod);
/* Free anchor string */
Frm_FreeAnchorStr (Anchor);
break;
case Ntf_EVENT_DOCUMENT_FILE:
case Ntf_EVENT_TEACHERS_FILE:
case Ntf_EVENT_SHARED_FILE:

View File

@ -1056,7 +1056,13 @@ static void PrgRsc_GetResourceTitleFromLink (struct Prg_Item *Item)
case PrgRsc_NONE:
break;
case PrgRsc_ASSIGNMENT:
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
break;
case PrgRsc_CALL_FOR_EXAM:
Cfe_GetTitleFromExaCod (Item->Resource.Link.Cod,
Item->Resource.Title,
sizeof (Item->Resource.Title) - 1);
break;
case PrgRsc_EXAM:
case PrgRsc_GAME:
case PrgRsc_SURVEY:

View File

@ -19800,25 +19800,25 @@ const char *Txt_Link_to_call_for_exam =
const char *Txt_Link_to_resource_X_copied_into_clipboard = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"Enlla&ccedil; al recurs %s copiat al porta-retalls.";
"Enlla&ccedil; al recurs <strong>%s</strong> copiat al porta-retalls.";
#elif L==2 // de
"Link zu Ressource %s in die Zwischenablage kopiert.";
"Link zu Ressource <strong>%s</strong> in die Zwischenablage kopiert.";
#elif L==3 // en
"Link to resource %s copied into clipboard.";
"Link to resource <strong>%s</strong> copied into clipboard.";
#elif L==4 // es
"Enlace al recurso %s copiado en el portapapeles.";
"Enlace al recurso <strong>%s</strong> copiado en el portapapeles.";
#elif L==5 // fr
"Lien vers la ressource %s copi&eacute; dans le presse-papiers.";
"Lien vers la ressource <strong>%s</strong> copi&eacute; dans le presse-papiers.";
#elif L==6 // gn
"Enlace al recurso %s copiado en el portapapeles."; // Okoteve traducción
"Enlace al recurso <strong>%s</strong> copiado en el portapapeles."; // Okoteve traducción
#elif L==7 // it
"Collegamento alla risorsa %s copiata negli appunti.";
"Collegamento alla risorsa <strong>%s</strong> copiata negli appunti.";
#elif L==8 // pl
"Link do zasobu %s skopiowany do schowka.";
"Link do zasobu <strong>%s</strong> skopiowany do schowka.";
#elif L==9 // pt
"Link para o recurso %s copiado para a &aacute;rea de transfer&ecirc;ncia.";
"Link para o recurso <strong>%s</strong> copiado para a &aacute;rea de transfer&ecirc;ncia.";
#elif L==10 // tr
"Panoya kopyalanan %s kayna&gbreve;&inodot;na ba&gbreve;lant&inodot;.";
"Panoya kopyalanan <strong>%s</strong> kayna&gbreve;&inodot;na ba&gbreve;lant&inodot;.";
#endif
const char *Txt_List_of_detailed_clicks =

View File

@ -10782,25 +10782,25 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
,
[ActSeeOneCfe] =
#if L==1 // ca
"See one exam announcement" // Necessita traducció
"See exam announcement" // Necessita traducció
#elif L==2 // de
"See one exam announcement" // Need Übersetzung
"See exam announcement" // Need Übersetzung
#elif L==3 // en
"See one exam announcement"
"See exam announcement"
#elif L==4 // es
"Ver una convocatoria de examen"
"Ver convocatoria de examen"
#elif L==5 // fr
"See one exam announcement" // Besoin de traduction
"See exam announcement" // Besoin de traduction
#elif L==6 // gn
"Ver una convocatoria de examen" // Okoteve traducción
"Ver convocatoria de examen" // Okoteve traducción
#elif L==7 // it
"See one exam announcement" // Bisogno di traduzione
"See exam announcement" // Bisogno di traduzione
#elif L==8 // pl
"See one exam announcement" // Potrzebujesz tlumaczenie
"See exam announcement" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"See one exam announcement" // Precisa de tradução
"See exam announcement" // Precisa de tradução
#elif L==10 // tr
"See one exam announcement" // Çeviri lazim!
"See exam announcement" // Çeviri lazim!
#endif
,
[ActSeeDatCfe] =