mirror of https://github.com/acanas/swad-core.git
Version 22.100: Apr 18, 2023 Changes in resources, assignments, exams, games, attendance events and surveys.
This commit is contained in:
parent
892529546c
commit
72ba2a9162
|
@ -186,6 +186,7 @@ void Asg_ShowAllAssignments (struct Asg_Assignments *Assignments)
|
|||
NumAsg++, The_ChangeRowColor ())
|
||||
{
|
||||
Assignments->Asg.AsgCod = Assignments->LstAsgCods[NumAsg - 1];
|
||||
Asg_GetAssignmentDataByCod (&Assignments->Asg);
|
||||
Asg_ShowAssignmentRow (Assignments,
|
||||
false, // Not only this assignment in table
|
||||
false); // Not print view
|
||||
|
@ -384,6 +385,9 @@ void Asg_SeeOneAssignment (void)
|
|||
/***** Get the code of the assignment *****/
|
||||
Assignments.Asg.AsgCod = ParCod_GetAndCheckPar (ParCod_Asg);
|
||||
|
||||
/***** Get data of this assignment *****/
|
||||
Asg_GetAssignmentDataByCod (&Assignments.Asg);
|
||||
|
||||
/***** Show selected assignment in a box *****/
|
||||
Asg_ShowOneAssignmentInBox (&Assignments);
|
||||
|
||||
|
@ -406,6 +410,9 @@ void Asg_PrintOneAssignment (void)
|
|||
/***** Get the code of the assignment *****/
|
||||
Assignments.Asg.AsgCod = ParCod_GetAndCheckPar (ParCod_Asg);
|
||||
|
||||
/***** Get data of this assignment *****/
|
||||
Asg_GetAssignmentDataByCod (&Assignments.Asg);
|
||||
|
||||
/***** Write header *****/
|
||||
Lay_WriteHeaderClassPhoto (true,false,
|
||||
Gbl.Hierarchy.Ins.InsCod,
|
||||
|
@ -439,7 +446,8 @@ void Asg_ShowOneAssignmentInBox (struct Asg_Assignments *Assignments)
|
|||
extern const char *Txt_Assignment;
|
||||
|
||||
/***** Begin box and table *****/
|
||||
Box_BoxTableBegin (NULL,Txt_Assignment,
|
||||
Box_BoxTableBegin (NULL,Assignments->Asg.Title[0] ? Assignments->Asg.Title :
|
||||
Txt_Assignment,
|
||||
Asg_PutIconsOneAsg,Assignments,
|
||||
Hlp_ASSESSMENT_Assignments,Box_NOT_CLOSABLE,2);
|
||||
|
||||
|
@ -493,9 +501,6 @@ static void Asg_ShowAssignmentRow (struct Asg_Assignments *Assignments,
|
|||
Dat_StartEndTime_t StartEndTime;
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||
|
||||
/***** Get data of this assignment *****/
|
||||
Asg_GetAssignmentDataByCod (&Assignments->Asg);
|
||||
|
||||
/***** Set anchor string *****/
|
||||
Frm_SetAnchorStr (Assignments->Asg.AsgCod,&Anchor);
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
void AsgRsc_GetLinkToAssignment (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Assignments;
|
||||
struct Asg_Assignments Assignments;
|
||||
char Title[Asg_MAX_BYTES_ASSIGNMENT_TITLE + 1];
|
||||
|
||||
/***** Reset assignments *****/
|
||||
Asg_ResetAssignments (&Assignments);
|
||||
|
@ -57,15 +57,17 @@ void AsgRsc_GetLinkToAssignment (void)
|
|||
/***** Get assignment code *****/
|
||||
Assignments.Asg.AsgCod = ParCod_GetPar (ParCod_Asg);
|
||||
|
||||
/***** Get assignment title *****/
|
||||
AsgRsc_GetTitleFromAsgCod (Assignments.Asg.AsgCod,Title,sizeof (Title) - 1);
|
||||
/***** Get data of this assignment *****/
|
||||
if (Assignments.Asg.AsgCod > 0)
|
||||
Asg_GetAssignmentDataByCod (&Assignments.Asg);
|
||||
|
||||
/***** Copy link to assignment into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_ASSIGNMENT,Assignments.Asg.AsgCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
Assignments.Asg.AsgCod > 0 ? Assignments.Asg.Title :
|
||||
Txt_Assignments);
|
||||
|
||||
/***** Show selected assignment in a box *****/
|
||||
if (Assignments.Asg.AsgCod > 0)
|
||||
|
@ -74,20 +76,3 @@ void AsgRsc_GetLinkToAssignment (void)
|
|||
/***** Show current assignments, if any *****/
|
||||
Asg_ShowAllAssignments (&Assignments);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Get assignment title from assignment code ******************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void AsgRsc_GetTitleFromAsgCod (long AsgCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Assignments;
|
||||
|
||||
if (AsgCod > 0)
|
||||
/***** Get assignment title from database *****/
|
||||
Asg_DB_GetAssignmentTitleByCod (AsgCod,Title,TitleSize);
|
||||
else
|
||||
/***** Generic title for all assignments *****/
|
||||
Str_Copy (Title,Txt_Assignments,TitleSize);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,5 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void AsgRsc_GetLinkToAssignment (void);
|
||||
void AsgRsc_GetTitleFromAsgCod (long AsgCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -299,7 +299,7 @@ static void Att_ShowAllEvents (struct Att_Events *Events)
|
|||
|
||||
/***** Show one attendance event *****/
|
||||
Att_ShowOneEventRow (Events,
|
||||
false); // Don't show only this event
|
||||
false); // Don't show only this event
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -1474,7 +1474,8 @@ static void Att_ShowEvent (struct Att_Events *Events)
|
|||
Events->Event.NumStdsTotal = Att_DB_GetNumStdsTotalWhoAreInEvent (Events->Event.AttCod);
|
||||
|
||||
/***** Show attendance event inside a box *****/
|
||||
Box_BoxTableBegin (NULL,Txt_Event,
|
||||
Box_BoxTableBegin (NULL,Events->Event.Title[0] ? Events->Event.Title :
|
||||
Txt_Event,
|
||||
Att_PutIconsOneEvent,Events,
|
||||
Hlp_USERS_Attendance,Box_NOT_CLOSABLE,2);
|
||||
Att_ShowOneEventRow (Events,
|
||||
|
|
|
@ -40,39 +40,24 @@
|
|||
void AttRsc_GetLinkToEvent (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
long AttCod;
|
||||
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
||||
extern const char *Txt_Control_of_class_attendance;
|
||||
struct Att_Event Event;
|
||||
|
||||
/***** Get attendance event code *****/
|
||||
AttCod = ParCod_GetPar (ParCod_Att);
|
||||
Event.AttCod = ParCod_GetPar (ParCod_Att);
|
||||
|
||||
/***** Get attendance event title *****/
|
||||
AttRsc_GetTitleFromAttCod (AttCod,Title,sizeof (Title) - 1);
|
||||
/***** Get attendance event data *****/
|
||||
if (Event.AttCod > 0)
|
||||
Att_GetEventDataByCod (&Event);
|
||||
|
||||
/***** Copy link to attendance event into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_ATTENDANCE_EVENT,AttCod);
|
||||
Rsc_DB_CopyToClipboard (Rsc_ATTENDANCE_EVENT,Event.AttCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
Event.AttCod > 0 ? Event.Title :
|
||||
Txt_Control_of_class_attendance);
|
||||
|
||||
/***** Show attendance events again *****/
|
||||
Att_SeeEvents ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Get attendance event title from game code *******************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Control_of_class_attendance;
|
||||
|
||||
if (AttCod > 0)
|
||||
/***** Get attendance event title from database *****/
|
||||
Att_DB_GetEventTitle (AttCod,Title,TitleSize);
|
||||
else
|
||||
/***** Generic title for all attendance events *****/
|
||||
Str_Copy (Title,Txt_Control_of_class_attendance,TitleSize);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,5 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void AttRsc_GetLinkToEvent (void);
|
||||
void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8569,36 +8569,6 @@ static void Brw_GetFileMetadataFromRow (MYSQL_RES *mysql_res,
|
|||
FileMetadata->License = (Brw_License_t) UnsignedNum;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get file type and path using its code ********************/
|
||||
/*****************************************************************************/
|
||||
// FileMetadata.FilCod must be filled
|
||||
// This function only gets type and path stored in table files,
|
||||
// The rest of the fields are not filled
|
||||
|
||||
void Brw_GetPathByCod (struct Brw_FileMetadata *FileMetadata)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
/***** Get metadata of a file from database *****/
|
||||
if (Brw_DB_GetPathByCod (&mysql_res,FileMetadata->FilCod))
|
||||
{
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get path (row[0]) */
|
||||
Str_Copy (FileMetadata->FilFolLnk.Full,row[0],
|
||||
sizeof (FileMetadata->FilFolLnk.Full) - 1);
|
||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata->FilFolLnk.Full,
|
||||
FileMetadata->FilFolLnk.Path,
|
||||
FileMetadata->FilFolLnk.Name);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get file type, size and date *************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -224,7 +224,6 @@ void Brw_DownloadFile (void);
|
|||
void Brw_ChgFileMetadata (void);
|
||||
void Brw_GetFileMetadataByPath (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_GetFileMetadataByCod (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_GetPathByCod (struct Brw_FileMetadata *FileMetadata);
|
||||
bool Brw_GetFileTypeSizeAndDate (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_GetAndUpdateFileViews (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_UpdateMyFileViews (long FilCod);
|
||||
|
|
|
@ -328,14 +328,13 @@ unsigned Brw_DB_GetFileMetadataByCod (MYSQL_RES **mysql_res,long FilCod)
|
|||
/************************ Get file path using its code ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Brw_DB_GetPathByCod (MYSQL_RES **mysql_res,long FilCod)
|
||||
void Brw_DB_GetPathByCod (long FilCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get path",
|
||||
"SELECT Path" // row[0]
|
||||
" FROM brw_files"
|
||||
" WHERE FilCod=%ld",
|
||||
FilCod);
|
||||
DB_QuerySELECTString (Title,TitleSize,"can not get path",
|
||||
"SELECT Path" // row[0]
|
||||
" FROM brw_files"
|
||||
" WHERE FilCod=%ld",
|
||||
FilCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -47,7 +47,7 @@ void Brw_DB_RenameChildrenFilesOrFolders (const char OldPath[PATH_MAX + 1],
|
|||
long Brw_DB_GetFilCodByPath (const char *Path,bool OnlyIfPublic);
|
||||
unsigned Brw_DB_GetFileMetadataByPath (MYSQL_RES **mysql_res,const char *Path);
|
||||
unsigned Brw_DB_GetFileMetadataByCod (MYSQL_RES **mysql_res,long FilCod);
|
||||
unsigned Brw_DB_GetPathByCod (MYSQL_RES **mysql_res,long FilCod);
|
||||
void Brw_DB_GetPathByCod (long FilCod,char *Title,size_t TitleSize);
|
||||
long Brw_DB_GetPublisherOfSubtree (const char *Path);
|
||||
unsigned Brw_DB_GetNumFilesUsr (long UsrCod);
|
||||
unsigned Brw_DB_GetNumFilesInDocumZonesOfCrs (long CrsCod);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "swad_action.h"
|
||||
#include "swad_action_list.h"
|
||||
#include "swad_alert.h"
|
||||
#include "swad_browser.h"
|
||||
#include "swad_browser_database.h"
|
||||
#include "swad_browser_resource.h"
|
||||
#include "swad_error.h"
|
||||
#include "swad_global.h"
|
||||
|
@ -49,24 +49,26 @@ extern struct Globals Gbl;
|
|||
void BrwRsc_GetLinkToDocFil (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
long FilCod;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
extern const char *Txt_Documents;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
|
||||
/***** Get parameters related to file browser *****/
|
||||
Brw_GetParAndInitFileBrowser ();
|
||||
|
||||
/***** Get file code *****/
|
||||
FilCod = ParCod_GetPar (ParCod_Fil);
|
||||
FileMetadata.FilCod = ParCod_GetPar (ParCod_Fil);
|
||||
|
||||
/***** Get file title *****/
|
||||
BrwRsc_GetTitleFromDocFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
/***** Get file metadata *****/
|
||||
if (FileMetadata.FilCod > 0)
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
|
||||
/***** Copy link to file into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_DOCUMENT,FilCod);
|
||||
Rsc_DB_CopyToClipboard (Rsc_DOCUMENT,FileMetadata.FilCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
FileMetadata.FilCod > 0 ? FileMetadata.FilFolLnk.Name :
|
||||
Txt_Documents);
|
||||
|
||||
/***** Show again the file browser *****/
|
||||
Brw_ShowAgainFileBrowserOrWorks ();
|
||||
|
@ -75,24 +77,26 @@ void BrwRsc_GetLinkToDocFil (void)
|
|||
void BrwRsc_GetLinkToMrkFil (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
long FilCod;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
extern const char *Txt_Marks_area;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
|
||||
/***** Get parameters related to file browser *****/
|
||||
Brw_GetParAndInitFileBrowser ();
|
||||
|
||||
/***** Get file code *****/
|
||||
FilCod = ParCod_GetPar (ParCod_Fil);
|
||||
FileMetadata.FilCod = ParCod_GetPar (ParCod_Fil);
|
||||
|
||||
/***** Get file title *****/
|
||||
BrwRsc_GetTitleFromMrkFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
/***** Get file metadata *****/
|
||||
if (FileMetadata.FilCod > 0)
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
|
||||
/***** Copy link to file into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_MARKS,FilCod);
|
||||
Rsc_DB_CopyToClipboard (Rsc_MARKS,FileMetadata.FilCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
FileMetadata.FilCod > 0 ? FileMetadata.FilFolLnk.Name :
|
||||
Txt_Marks_area);
|
||||
|
||||
/***** Show again the file browser *****/
|
||||
Brw_ShowAgainFileBrowserOrWorks ();
|
||||
|
@ -103,44 +107,23 @@ void BrwRsc_GetLinkToMrkFil (void)
|
|||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void BrwRsc_GetTitleFromDocFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
void BrwRsc_GetTitleFromFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Documents;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
|
||||
if (FilCod > 0)
|
||||
{
|
||||
/***** Get file name *****/
|
||||
FileMetadata.FilCod = FilCod;
|
||||
Brw_GetPathByCod (&FileMetadata);
|
||||
/***** Get file name *****/
|
||||
FileMetadata.FilCod = FilCod;
|
||||
Brw_DB_GetPathByCod (FileMetadata.FilCod,
|
||||
FileMetadata.FilFolLnk.Full,
|
||||
sizeof (FileMetadata.FilFolLnk.Full) - 1);
|
||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.FilFolLnk.Full,
|
||||
FileMetadata.FilFolLnk.Path,
|
||||
FileMetadata.FilFolLnk.Name);
|
||||
|
||||
/***** Remove .url if it's a link *****/
|
||||
if (Str_FileIs (FileMetadata.FilFolLnk.Name,"url"))
|
||||
FileMetadata.FilFolLnk.Name[strlen (FileMetadata.FilFolLnk.Name) - 4] = '\0';
|
||||
/***** Remove .url if it's a link *****/
|
||||
if (Str_FileIs (FileMetadata.FilFolLnk.Name,"url"))
|
||||
FileMetadata.FilFolLnk.Name[strlen (FileMetadata.FilFolLnk.Name) - 4] = '\0';
|
||||
|
||||
/***** Copy file name into title *****/
|
||||
Str_Copy (Title,FileMetadata.FilFolLnk.Name,TitleSize);
|
||||
}
|
||||
else
|
||||
/***** Generic title for all documents *****/
|
||||
Str_Copy (Title,Txt_Documents,TitleSize);
|
||||
}
|
||||
|
||||
void BrwRsc_GetTitleFromMrkFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Marks_area;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
|
||||
if (FilCod > 0)
|
||||
{
|
||||
/***** Get file name *****/
|
||||
FileMetadata.FilCod = FilCod;
|
||||
Brw_GetPathByCod (&FileMetadata);
|
||||
|
||||
/***** Copy file name into title *****/
|
||||
Str_Copy (Title,FileMetadata.FilFolLnk.Name,TitleSize);
|
||||
}
|
||||
else
|
||||
/***** Generic title for marks area *****/
|
||||
Str_Copy (Title,Txt_Marks_area,TitleSize);
|
||||
/***** Copy file name into title *****/
|
||||
Str_Copy (Title,FileMetadata.FilFolLnk.Name,TitleSize);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
void BrwRsc_GetLinkToDocFil (void);
|
||||
void BrwRsc_GetLinkToMrkFil (void);
|
||||
void BrwRsc_GetTitleFromDocFilCod (long FilCod,char *Title,size_t TitleSize);
|
||||
void BrwRsc_GetTitleFromMrkFilCod (long FilCod,char *Title,size_t TitleSize);
|
||||
void BrwRsc_GetTitleFromFilCod (long FilCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -612,14 +612,14 @@ static void Cfe_ListCallsForExams (struct Cfe_CallsForExams *CallsForExams,
|
|||
extern const char *Txt_Calls_for_exams;
|
||||
extern const char *Txt_No_calls_for_exams_of_X;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumExaAnns;
|
||||
unsigned NumExaAnn;
|
||||
unsigned NumCalls;
|
||||
unsigned NumCall;
|
||||
long ExaCod;
|
||||
bool HighLight;
|
||||
|
||||
/***** Get calls for exams (the most recent first)
|
||||
in current course from database *****/
|
||||
NumExaAnns = Cfe_DB_GetCallsForExamsInCurrentCrs (&mysql_res);
|
||||
NumCalls = Cfe_DB_GetCallsForExamsInCurrentCrs (&mysql_res);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Txt_Calls_for_exams,
|
||||
|
@ -627,10 +627,10 @@ static void Cfe_ListCallsForExams (struct Cfe_CallsForExams *CallsForExams,
|
|||
Hlp_ASSESSMENT_Calls_for_exams,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** List the existing calls for exams *****/
|
||||
if (NumExaAnns)
|
||||
for (NumExaAnn = 0;
|
||||
NumExaAnn < NumExaAnns;
|
||||
NumExaAnn++)
|
||||
if (NumCalls)
|
||||
for (NumCall = 0;
|
||||
NumCall < NumCalls;
|
||||
NumCall++)
|
||||
{
|
||||
/***** Get the code of the call for exam (row[0]) *****/
|
||||
if ((ExaCod = DB_GetNextCode (mysql_res)) <= 0)
|
||||
|
|
|
@ -40,26 +40,40 @@
|
|||
void CfeRsc_GetLinkToCallForExam (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Calls_for_exams;
|
||||
struct Cfe_CallsForExams *CallsForExams = Cfe_GetGlobalCallsForExams ();
|
||||
long ExaCod;
|
||||
char Title[Cfe_MAX_BYTES_SESSION_AND_DATE];
|
||||
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE];
|
||||
|
||||
/***** Reset calls for exams context *****/
|
||||
Cfe_ResetCallsForExams (CallsForExams);
|
||||
|
||||
/***** Get the code of the call for exam *****/
|
||||
ExaCod = ParCod_GetPar (ParCod_Exa);
|
||||
CallsForExams->ExaCod = ParCod_GetPar (ParCod_Exa);
|
||||
|
||||
/***** Get session and date of the exam *****/
|
||||
CfeRsc_GetTitleFromExaCod (ExaCod,Title,sizeof (Title) - 1);
|
||||
/***** Get call for exam title *****/
|
||||
if (CallsForExams->ExaCod > 0)
|
||||
{
|
||||
/* Get data of call for exam */
|
||||
Cfe_AllocMemCallForExam (CallsForExams);
|
||||
Cfe_GetCallForExamDataByCod (CallsForExams,CallsForExams->ExaCod);
|
||||
|
||||
/* Session and date of the exam */
|
||||
Cfe_BuildSessionAndDate (CallsForExams,SessionAndDate);
|
||||
|
||||
/* Free memory of the call for exam */
|
||||
Cfe_FreeMemCallForExam (CallsForExams);
|
||||
}
|
||||
|
||||
/***** Copy link to call for exam into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_CALL_FOR_EXAM,ExaCod);
|
||||
Rsc_DB_CopyToClipboard (Rsc_CALL_FOR_EXAM,CallsForExams->ExaCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
CallsForExams->ExaCod > 0 ? SessionAndDate :
|
||||
Txt_Calls_for_exams);
|
||||
|
||||
/***** Set exam to be highlighted *****/
|
||||
Cfe_ResetCallsForExams (CallsForExams);
|
||||
CallsForExams->HighlightExaCod = ExaCod;
|
||||
CallsForExams->HighlightExaCod = CallsForExams->ExaCod;
|
||||
|
||||
/***** Show again the list of calls for exams *****/
|
||||
Cfe_ListCallsForExamsEdit ();
|
||||
|
@ -72,28 +86,20 @@ void CfeRsc_GetLinkToCallForExam (void)
|
|||
|
||||
void CfeRsc_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Call_for_exam;
|
||||
extern const char *Txt_Calls_for_exams;
|
||||
struct Cfe_CallsForExams CallsForExams;
|
||||
char SessionAndDate[Cfe_MAX_BYTES_SESSION_AND_DATE];
|
||||
|
||||
if (ExaCod > 0)
|
||||
{
|
||||
/***** Reset calls for exams context *****/
|
||||
Cfe_ResetCallsForExams (&CallsForExams);
|
||||
/***** Reset calls for exams context *****/
|
||||
Cfe_ResetCallsForExams (&CallsForExams);
|
||||
|
||||
/***** Get data of call for exam *****/
|
||||
Cfe_AllocMemCallForExam (&CallsForExams);
|
||||
Cfe_GetCallForExamDataByCod (&CallsForExams,ExaCod);
|
||||
/***** Get data of call for exam *****/
|
||||
Cfe_AllocMemCallForExam (&CallsForExams);
|
||||
Cfe_GetCallForExamDataByCod (&CallsForExams,ExaCod);
|
||||
|
||||
/***** Session and date of the exam *****/
|
||||
Cfe_BuildSessionAndDate (&CallsForExams,SessionAndDate);
|
||||
snprintf (Title,TitleSize,"%s: %s",Txt_Call_for_exam,SessionAndDate);
|
||||
/***** Session and date of the exam *****/
|
||||
Cfe_BuildSessionAndDate (&CallsForExams,SessionAndDate);
|
||||
Str_Copy (Title,SessionAndDate,TitleSize);
|
||||
|
||||
/***** Free memory of the call for exam *****/
|
||||
Cfe_FreeMemCallForExam (&CallsForExams);
|
||||
}
|
||||
else
|
||||
/***** Generic title for all calls for exams *****/
|
||||
Str_Copy (Title,Txt_Calls_for_exams,TitleSize);
|
||||
/***** Free memory of the call for exam *****/
|
||||
Cfe_FreeMemCallForExam (&CallsForExams);
|
||||
}
|
||||
|
|
|
@ -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.99 (2023-04-18)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.100 (2023-04-18)"
|
||||
#define CSS_FILE "swad22.95.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 22.100: Apr 18, 2023 Changes in resources, assignments, exams, games, attendance events and surveys. (? lines)
|
||||
Version 22.99: Apr 18, 2023 Code refactoring in rubrics. (339025 lines)
|
||||
Version 22.98: Apr 17, 2023 Code refactoring in rubrics. (339062 lines)
|
||||
Version 22.97: Apr 14, 2023 Changes in listing of rubrics. (339029 lines)
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
void ExaRsc_GetLinkToExam (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Exams;
|
||||
struct Exa_Exams Exams;
|
||||
char Title[Exa_MAX_BYTES_TITLE + 1];
|
||||
|
||||
/***** Reset exams context *****/
|
||||
Exa_ResetExams (&Exams);
|
||||
|
@ -51,32 +51,17 @@ void ExaRsc_GetLinkToExam (void)
|
|||
Exa_GetPars (&Exams,Exa_DONT_CHECK_EXA_COD);
|
||||
|
||||
/***** Get exam title *****/
|
||||
ExaRsc_GetTitleFromExaCod (Exams.Exam.ExaCod,Title,sizeof (Title) - 1);
|
||||
if (Exams.Exam.ExaCod > 0)
|
||||
Exa_GetExamDataByCod (&Exams.Exam);
|
||||
|
||||
/***** Copy link to exam into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_EXAM,Exams.Exam.ExaCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
Exams.Exam.ExaCod > 0 ? Exams.Exam.Title :
|
||||
Txt_Exams);
|
||||
|
||||
/***** Show exams again *****/
|
||||
Exa_ListAllExams (&Exams);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get exam title from exam code ***********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void ExaRsc_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Exams;
|
||||
|
||||
if (ExaCod > 0)
|
||||
/***** Get exam title from database *****/
|
||||
Exa_DB_GetExamTitle (ExaCod,Title,TitleSize);
|
||||
else
|
||||
/***** Generic title for all exams *****/
|
||||
Str_Copy (Title,Txt_Exams,TitleSize);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,5 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void ExaRsc_GetLinkToExam (void);
|
||||
void ExaRsc_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -370,7 +370,6 @@ static void For_ListForumThrs (struct For_Forums *Forums,
|
|||
long ThrCods[Pag_ITEMS_PER_PAGE],
|
||||
long ThrCodHighlighted,
|
||||
struct Pag_Pagination *PaginationThrs);
|
||||
static void For_GetThreadData (struct For_Thread *Thr);
|
||||
|
||||
static void For_SetForumType (struct For_Forums *Forums);
|
||||
static void For_RestrictAccess (const struct For_Forums *Forums);
|
||||
|
@ -2353,7 +2352,7 @@ static void For_ListForumThrs (struct For_Forums *Forums,
|
|||
/***************************** Get data of a thread **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_GetThreadData (struct For_Thread *Thr)
|
||||
void For_GetThreadData (struct For_Thread *Thr)
|
||||
{
|
||||
extern const char *Txt_no_subject;
|
||||
MYSQL_RES *mysql_res;
|
||||
|
|
|
@ -154,6 +154,8 @@ void For_ShowForumTheads (void);
|
|||
void For_ShowForumThreadsHighlightingOneThread (struct For_Forums *Forums,
|
||||
Ale_AlertType_t AlertType,const char *Message);
|
||||
|
||||
void For_GetThreadData (struct For_Thread *Thr);
|
||||
|
||||
void For_ShowThreadPosts (void);
|
||||
|
||||
void For_GetParsForums (struct For_Forums *Forums);
|
||||
|
|
|
@ -46,24 +46,28 @@ extern struct Globals Gbl;
|
|||
void ForRsc_GetLinkToThread (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Course_forum;
|
||||
struct For_Forums Forums;
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||
struct For_Thread Thr;
|
||||
|
||||
/***** Reset forum *****/
|
||||
For_ResetForums (&Forums);
|
||||
|
||||
/***** Get parameters related to forums *****/
|
||||
For_GetParsForums (&Forums);
|
||||
Thr.ThrCod = Forums.Thread.Current;
|
||||
|
||||
/***** Get thread subject *****/
|
||||
ForRsc_GetTitleFromThrCod (Forums.Thread.Current,Subject,sizeof (Subject) - 1);
|
||||
if (Thr.ThrCod > 0)
|
||||
For_GetThreadData (&Thr);
|
||||
|
||||
/***** Copy link to thread into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_FORUM_THREAD,Forums.Thread.Current);
|
||||
Rsc_DB_CopyToClipboard (Rsc_FORUM_THREAD,Thr.ThrCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Subject);
|
||||
Thr.ThrCod > 0 ? Thr.Subject :
|
||||
Txt_Course_forum);
|
||||
|
||||
/***** Show forum list again *****/
|
||||
For_ShowForumList (&Forums);
|
||||
|
@ -89,20 +93,3 @@ void ForRsc_FreeAnchorStr (char **Anchor)
|
|||
{
|
||||
*Anchor = NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get survey title from survey code *********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void ForRsc_GetTitleFromThrCod (long ThrCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Course_forum;
|
||||
|
||||
if (ThrCod > 0)
|
||||
/***** Get thread subject from database *****/
|
||||
For_DB_GetThreadTitle (ThrCod,Title,TitleSize);
|
||||
else
|
||||
/***** Generic title for all posts *****/
|
||||
Str_Copy (Title,Txt_Course_forum,TitleSize);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,5 @@
|
|||
void ForRsc_GetLinkToThread (void);
|
||||
void ForRsc_SetAnchorStr (long ThrCod,char **Anchor);
|
||||
void ForRsc_FreeAnchorStr (char **Anchor);
|
||||
void ForRsc_GetTitleFromThrCod (long ThrCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,43 +42,27 @@
|
|||
void GamRsc_GetLinkToGame (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Games;
|
||||
struct Gam_Games Games;
|
||||
long GamCod;
|
||||
char Title[Gam_MAX_BYTES_TITLE + 1];
|
||||
|
||||
/***** Reset games context *****/
|
||||
Gam_ResetGames (&Games);
|
||||
|
||||
/***** Get parameters *****/
|
||||
GamCod = Gam_GetPars (&Games);
|
||||
Games.Game.GamCod = Gam_GetPars (&Games);
|
||||
|
||||
/***** Get game title *****/
|
||||
GamRsc_GetTitleFromGamCod (GamCod,Title,sizeof (Title) - 1);
|
||||
/***** Get game data *****/
|
||||
if (Games.Game.GamCod > 0)
|
||||
Gam_GetGameDataByCod (&Games.Game);
|
||||
|
||||
/***** Copy link to game into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_GAME,GamCod);
|
||||
Rsc_DB_CopyToClipboard (Rsc_GAME,Games.Game.GamCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
Games.Game.GamCod > 0 ? Games.Game.Title :
|
||||
Txt_Games);
|
||||
|
||||
/***** Show games again *****/
|
||||
Gam_ListAllGames (&Games);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get game title from game code ***********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Games;
|
||||
|
||||
if (GamCod > 0)
|
||||
/***** Get game title from database *****/
|
||||
Gam_DB_GetGameTitle (GamCod,Title,TitleSize);
|
||||
else
|
||||
/***** Generic title for all games *****/
|
||||
Str_Copy (Title,Txt_Games,TitleSize);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,5 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void GamRsc_GetLinkToGame (void);
|
||||
void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1323,9 +1323,18 @@ void Prj_ShowOneProject (void)
|
|||
Prj_GetPars (&Projects);
|
||||
Projects.Prj.PrjCod = ParCod_GetAndCheckPar (ParCod_Prj);
|
||||
|
||||
/***** Allocate memory for the project *****/
|
||||
Prj_AllocMemProject (&Projects.Prj);
|
||||
|
||||
/***** Get project data *****/
|
||||
Prj_GetProjectDataByCod (&Projects.Prj);
|
||||
|
||||
/***** Show project and (if possible) its file browser *****/
|
||||
Prj_ShowOneProjectWithFileBrowser (&Projects);
|
||||
|
||||
/***** Free memory of the project *****/
|
||||
Prj_FreeMemProject (&Projects.Prj);
|
||||
|
||||
/***** Show projects again *****/
|
||||
Prj_ShowProjects (&Projects);
|
||||
}
|
||||
|
@ -1338,16 +1347,6 @@ void Prj_ShowOneProjectWithFileBrowser (struct Prj_Projects *Projects)
|
|||
{
|
||||
extern const char *Hlp_ASSESSMENT_Projects;
|
||||
|
||||
/***** Trivial check: show project only if code > 0 *****/
|
||||
if (Projects->Prj.PrjCod <= 0)
|
||||
return;
|
||||
|
||||
/***** Allocate memory for the project *****/
|
||||
Prj_AllocMemProject (&Projects->Prj);
|
||||
|
||||
/***** Get project data *****/
|
||||
Prj_GetProjectDataByCod (&Projects->Prj);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin (NULL,Projects->Prj.Title,
|
||||
Prj_PutIconsOnePrj,Projects,
|
||||
|
@ -1371,9 +1370,6 @@ void Prj_ShowOneProjectWithFileBrowser (struct Prj_Projects *Projects)
|
|||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
||||
/***** Free memory of the project *****/
|
||||
Prj_FreeMemProject (&Projects->Prj);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#include "swad_hierarchy_level.h"
|
||||
#include "swad_project.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
void PrjRsc_GetLinkToProject (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Projects;
|
||||
struct Prj_Projects Projects;
|
||||
char Title[Prj_MAX_BYTES_TITLE + 1];
|
||||
|
||||
/***** Reset projects *****/
|
||||
Prj_ResetPrjsAndReadConfig (&Projects);
|
||||
|
@ -52,36 +52,27 @@ void PrjRsc_GetLinkToProject (void)
|
|||
Prj_GetPars (&Projects);
|
||||
Projects.Prj.PrjCod = ParCod_GetPar (ParCod_Prj);
|
||||
|
||||
/***** Get project title *****/
|
||||
PrjRsc_GetTitleFromPrjCod (Projects.Prj.PrjCod,Title,sizeof (Title) - 1);
|
||||
/***** Allocate memory for the project *****/
|
||||
Prj_AllocMemProject (&Projects.Prj);
|
||||
|
||||
/***** Get project data *****/
|
||||
Prj_GetProjectDataByCod (&Projects.Prj);
|
||||
|
||||
/***** Copy link to PROJECT into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_PROJECT,Projects.Prj.PrjCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
Projects.Prj.PrjCod > 0 ? Projects.Prj.Title :
|
||||
Txt_Projects);
|
||||
|
||||
/***** Show project and (if possible) its file browser *****/
|
||||
Prj_ShowOneProjectWithFileBrowser (&Projects);
|
||||
if (Projects.Prj.PrjCod > 0)
|
||||
Prj_ShowOneProjectWithFileBrowser (&Projects);
|
||||
|
||||
/***** Free memory of the project *****/
|
||||
Prj_FreeMemProject (&Projects.Prj);
|
||||
|
||||
/***** Show projects again *****/
|
||||
Prj_ShowProjects (&Projects);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get project title from project code *********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void PrjRsc_GetTitleFromPrjCod (long PrjCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Projects;
|
||||
|
||||
if (PrjCod > 0)
|
||||
/***** Get project title from database *****/
|
||||
Prj_DB_GetProjectTitle (PrjCod,Title,TitleSize);
|
||||
else
|
||||
/***** Generic title for all projects *****/
|
||||
Str_Copy (Title,Txt_Projects,TitleSize);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void PrjRsc_GetLinkToProject (void);
|
||||
void PrjRsc_GetTitleFromPrjCod (long PrjCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
104
swad_resource.c
104
swad_resource.c
|
@ -30,24 +30,25 @@
|
|||
|
||||
#include "swad_action_list.h"
|
||||
#include "swad_alert.h"
|
||||
#include "swad_assignment_resource.h"
|
||||
#include "swad_attendance_resource.h"
|
||||
#include "swad_assignment_database.h"
|
||||
#include "swad_attendance_database.h"
|
||||
#include "swad_browser_resource.h"
|
||||
#include "swad_call_for_exam_resource.h"
|
||||
#include "swad_database.h"
|
||||
#include "swad_exam_resource.h"
|
||||
#include "swad_exam_database.h"
|
||||
#include "swad_forum_database.h"
|
||||
#include "swad_forum_resource.h"
|
||||
#include "swad_game_resource.h"
|
||||
#include "swad_game_database.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_HTML.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_parameter_code.h"
|
||||
#include "swad_project_resource.h"
|
||||
#include "swad_project_database.h"
|
||||
#include "swad_resource.h"
|
||||
#include "swad_resource_database.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_rubric_resource.h"
|
||||
#include "swad_survey_resource.h"
|
||||
#include "swad_rubric_database.h"
|
||||
#include "swad_survey_database.h"
|
||||
#include "swad_theme.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -106,13 +107,6 @@ const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES] =
|
|||
|
||||
extern struct Globals Gbl;
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Rsc_GetResourceEmptyTitle (__attribute__((unused)) long Cod,
|
||||
char *Title,size_t TitleSize);
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Show resources clipboard **************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -336,19 +330,6 @@ void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToG
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Write empty resource as resource ***********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
static void Rsc_GetResourceEmptyTitle (__attribute__((unused)) long Cod,
|
||||
char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
Str_Copy (Title,Txt_RESOURCE_TYPES[Rsc_NONE],TitleSize);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get the title for a new resource from link title **************/
|
||||
/*****************************************************************************/
|
||||
|
@ -356,30 +337,69 @@ static void Rsc_GetResourceEmptyTitle (__attribute__((unused)) long Cod,
|
|||
void Rsc_GetResourceTitleFromLink (const struct Rsc_Link *Link,
|
||||
char Title[Rsc_MAX_BYTES_RESOURCE_TITLE + 1])
|
||||
{
|
||||
extern const char *Txt_Assignments;
|
||||
extern const char *Txt_Projects;
|
||||
extern const char *Txt_Calls_for_exams;
|
||||
extern const char *Txt_Exams;
|
||||
extern const char *Txt_Games;
|
||||
extern const char *Txt_Rubrics;
|
||||
extern const char *Txt_Documents;
|
||||
extern const char *Txt_Marks_area;
|
||||
extern const char *Txt_Control_of_class_attendance;
|
||||
extern const char *Txt_Course_forum;
|
||||
extern const char *Txt_Surveys;
|
||||
static void (*GetTitle[Rsc_NUM_TYPES]) (long Cod,char *Title,size_t TitleSize) =
|
||||
{
|
||||
[Rsc_NONE ] = Rsc_GetResourceEmptyTitle,
|
||||
[Rsc_ASSIGNMENT ] = AsgRsc_GetTitleFromAsgCod,
|
||||
[Rsc_PROJECT ] = PrjRsc_GetTitleFromPrjCod,
|
||||
[Rsc_NONE ] = NULL,
|
||||
[Rsc_ASSIGNMENT ] = Asg_DB_GetAssignmentTitleByCod,
|
||||
[Rsc_PROJECT ] = Prj_DB_GetProjectTitle,
|
||||
[Rsc_CALL_FOR_EXAM ] = CfeRsc_GetTitleFromExaCod,
|
||||
[Rsc_EXAM ] = ExaRsc_GetTitleFromExaCod,
|
||||
[Rsc_GAME ] = GamRsc_GetTitleFromGamCod,
|
||||
[Rsc_RUBRIC ] = RubRsc_GetTitleFromRubCod,
|
||||
[Rsc_DOCUMENT ] = BrwRsc_GetTitleFromDocFilCod,
|
||||
[Rsc_MARKS ] = BrwRsc_GetTitleFromMrkFilCod,
|
||||
[Rsc_ATTENDANCE_EVENT] = AttRsc_GetTitleFromAttCod,
|
||||
[Rsc_FORUM_THREAD ] = ForRsc_GetTitleFromThrCod,
|
||||
[Rsc_SURVEY ] = SvyRsc_GetTitleFromSvyCod,
|
||||
[Rsc_EXAM ] = Exa_DB_GetExamTitle,
|
||||
[Rsc_GAME ] = Gam_DB_GetGameTitle,
|
||||
[Rsc_RUBRIC ] = Rub_DB_GetRubricTitle,
|
||||
[Rsc_DOCUMENT ] = BrwRsc_GetTitleFromFilCod,
|
||||
[Rsc_MARKS ] = BrwRsc_GetTitleFromFilCod,
|
||||
[Rsc_ATTENDANCE_EVENT] = Att_DB_GetEventTitle,
|
||||
[Rsc_FORUM_THREAD ] = For_DB_GetThreadTitle,
|
||||
[Rsc_SURVEY ] = Svy_DB_GetSurveyTitle,
|
||||
};
|
||||
const char *GenericTitle[Rsc_NUM_TYPES] =
|
||||
{
|
||||
[Rsc_NONE ] = NULL,
|
||||
[Rsc_ASSIGNMENT ] = Txt_Assignments,
|
||||
[Rsc_PROJECT ] = Txt_Projects,
|
||||
[Rsc_CALL_FOR_EXAM ] = Txt_Calls_for_exams,
|
||||
[Rsc_EXAM ] = Txt_Exams,
|
||||
[Rsc_GAME ] = Txt_Games,
|
||||
[Rsc_RUBRIC ] = Txt_Rubrics,
|
||||
[Rsc_DOCUMENT ] = Txt_Documents,
|
||||
[Rsc_MARKS ] = Txt_Marks_area,
|
||||
[Rsc_ATTENDANCE_EVENT] = Txt_Control_of_class_attendance,
|
||||
[Rsc_FORUM_THREAD ] = Txt_Course_forum,
|
||||
[Rsc_SURVEY ] = Txt_Surveys,
|
||||
};
|
||||
|
||||
/***** Reset title *****/
|
||||
Title[0] = '\0';
|
||||
|
||||
/***** Get title *****/
|
||||
if (GetTitle[Link->Type])
|
||||
GetTitle[Link->Type] (Link->Cod,Title,Rsc_MAX_BYTES_RESOURCE_TITLE);
|
||||
else
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
if (Link->Type != Rsc_NONE)
|
||||
{
|
||||
if (Link->Cod > 0)
|
||||
{
|
||||
if (GetTitle[Link->Type])
|
||||
GetTitle[Link->Type] (Link->Cod,Title,Rsc_MAX_BYTES_RESOURCE_TITLE);
|
||||
else
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GenericTitle[Link->Type])
|
||||
Str_Copy (Title,GenericTitle[Link->Type],Rsc_MAX_BYTES_RESOURCE_TITLE);
|
||||
else
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -745,7 +745,6 @@ void Rub_RemoveCrsRubrics (long CrsCod)
|
|||
void Rub_ReqCreatOrEditRubric (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric;
|
||||
|
||||
/***** Check if I can edit rubrics *****/
|
||||
|
@ -755,11 +754,11 @@ void Rub_ReqCreatOrEditRubric (void)
|
|||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false); // Don't check rubric code
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
|
||||
|
@ -775,7 +774,7 @@ void Rub_ReqCreatOrEditRubric (void)
|
|||
}
|
||||
|
||||
/***** Put form to create/edit a rubric and show criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,ExistingNewRubric);
|
||||
Rub_PutFormsOneRubric (&Rubrics,ExistingNewRubric);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -786,7 +785,6 @@ void Rub_ReqCreatOrEditRubric (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion,
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric)
|
||||
{
|
||||
/***** Put form to create/edit a rubric *****/
|
||||
|
@ -797,7 +795,7 @@ void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
|||
{
|
||||
case Rub_EXISTING_RUBRIC:
|
||||
/* Show list of criteria */
|
||||
RubCri_ListCriteriaForEdition (Rubrics,Criterion);
|
||||
RubCri_ListCriteriaForEdition (Rubrics);
|
||||
break;
|
||||
case Rub_NEW_RUBRIC:
|
||||
/* Show rubrics again */
|
||||
|
@ -908,7 +906,6 @@ void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
|||
void Rub_ReceiveFormRubric (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric;
|
||||
|
||||
/***** Check if I can edit rubrics *****/
|
||||
|
@ -918,11 +915,11 @@ void Rub_ReceiveFormRubric (void)
|
|||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false);
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
|
||||
|
@ -959,7 +956,7 @@ void Rub_ReceiveFormRubric (void)
|
|||
Ale_ShowAlerts (NULL);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,ExistingNewRubric);
|
||||
Rub_PutFormsOneRubric (&Rubrics,ExistingNewRubric);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
|
|
@ -65,7 +65,6 @@ void Rub_RemoveCrsRubrics (long CrsCod);
|
|||
|
||||
void Rub_ReqCreatOrEditRubric (void);
|
||||
void Rub_PutFormsOneRubric (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion,
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric);
|
||||
void Rub_PutFormEditionRubric (struct Rub_Rubrics *Rubrics,
|
||||
Rub_ExistingNewRubric_t ExistingNewRubric);
|
||||
|
|
|
@ -73,7 +73,6 @@ static const char *RubCri_ParValues[RubCri_NUM_VALUES] =
|
|||
static void RubCri_PutParsOneCriterion (void *Rubrics);
|
||||
|
||||
static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion,
|
||||
unsigned MaxCriInd);
|
||||
static void RubCri_ReceiveCriterionFieldsFromForm (struct RubCri_Criterion *Criterion);
|
||||
static bool RubCri_CheckCriterionTitleReceivedFromForm (const struct RubCri_Criterion *Criterion,
|
||||
|
@ -95,8 +94,7 @@ static void RubCri_GetCriterionDataFromRow (MYSQL_RES *mysql_res,
|
|||
|
||||
static void RubCri_PutTableHeadingForCriteria (void);
|
||||
|
||||
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion);
|
||||
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics);
|
||||
|
||||
static void RubCri_ExchangeCriteria (long RubCod,
|
||||
unsigned CriIndTop,unsigned CriIndBottom);
|
||||
|
@ -110,7 +108,7 @@ static void RubCri_PutParsOneCriterion (void *Rubrics)
|
|||
if (Rubrics)
|
||||
{
|
||||
Rub_PutPars (Rubrics);
|
||||
ParCod_PutPar (ParCod_Cri,((struct Rub_Rubrics *) Rubrics)->CriCod);
|
||||
ParCod_PutPar (ParCod_Cri,((struct Rub_Rubrics *) Rubrics)->Criterion.CriCod);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +144,6 @@ void RubCri_GetCriterionDataByCod (struct RubCri_Criterion *Criterion)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion,
|
||||
unsigned MaxCriInd)
|
||||
{
|
||||
extern const char *Txt_New_criterion;
|
||||
|
@ -179,7 +176,7 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
HTM_INPUT_TEXT ("Title",RubCri_MAX_CHARS_TITLE,Criterion->Title,
|
||||
HTM_INPUT_TEXT ("Title",RubCri_MAX_CHARS_TITLE,Rubrics->Criterion.Title,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"Title\""
|
||||
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
||||
|
@ -199,7 +196,7 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
{
|
||||
HTM_TD_Begin ("class=\"RM\"");
|
||||
HTM_INPUT_FLOAT (RubCri_ParValues[ValueRange],0.0,DBL_MAX,0.1,
|
||||
Criterion->Values[ValueRange],false,
|
||||
Rubrics->Criterion.Values[ValueRange],false,
|
||||
" class=\"INPUT_FLOAT INPUT_%s\" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
@ -211,7 +208,7 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
RubCri_WEIGHT_MIN,
|
||||
RubCri_WEIGHT_MAX,
|
||||
RubCri_WEIGHT_STEP,
|
||||
Criterion->Weight,false,
|
||||
Rubrics->Criterion.Weight,false,
|
||||
" class=\"INPUT_FLOAT INPUT_%s\" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
@ -233,16 +230,15 @@ static void RubCri_PutFormNewCriterion (struct Rub_Rubrics *Rubrics,
|
|||
void RubCri_ReceiveFormCriterion (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
|
||||
/***** Get rubric data from database *****/
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
|
@ -252,14 +248,13 @@ void RubCri_ReceiveFormCriterion (void)
|
|||
Err_NoPermissionExit ();
|
||||
|
||||
/***** If I can edit rubrics ==> receive criterion from form *****/
|
||||
RubCri_ReceiveCriterionFieldsFromForm (&Criterion);
|
||||
RubCri_ReceiveCriterionFieldsFromForm (&Rubrics.Criterion);
|
||||
|
||||
if (RubCri_CheckCriterionTitleReceivedFromForm (&Criterion,Criterion.Title))
|
||||
RubCri_CreateCriterion (&Criterion); // Add new criterion to database
|
||||
if (RubCri_CheckCriterionTitleReceivedFromForm (&Rubrics.Criterion,Rubrics.Criterion.Title))
|
||||
RubCri_CreateCriterion (&Rubrics.Criterion); // Add new criterion to database
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -332,16 +327,15 @@ static bool RubCri_CheckCriterionTitleReceivedFromForm (const struct RubCri_Crit
|
|||
void RubCri_ChangeTitle (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char NewTitle[RubCri_MAX_BYTES_TITLE + 1];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -351,16 +345,15 @@ void RubCri_ChangeTitle (void)
|
|||
Par_GetParText ("Title",NewTitle,RubCri_MAX_BYTES_TITLE);
|
||||
|
||||
/***** Check if title should be changed *****/
|
||||
if (RubCri_CheckCriterionTitleReceivedFromForm (&Criterion,NewTitle))
|
||||
if (RubCri_CheckCriterionTitleReceivedFromForm (&Rubrics.Criterion,NewTitle))
|
||||
{
|
||||
/* Update title and database table */
|
||||
Str_Copy (Criterion.Title,NewTitle,sizeof (Criterion.Title) - 1);
|
||||
Rub_DB_UpdateCriterionTitle (&Criterion);
|
||||
Str_Copy (Rubrics.Criterion.Title,NewTitle,sizeof (Rubrics.Criterion.Title) - 1);
|
||||
Rub_DB_UpdateCriterionTitle (&Rubrics.Criterion);
|
||||
}
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -383,21 +376,20 @@ void RubCri_ChangeMaxValue (void)
|
|||
static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char ValueStr[64];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -405,15 +397,14 @@ static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
|||
|
||||
/***** Receive new value from form *****/
|
||||
Par_GetParText (RubCri_ParValues[ValueRange],ValueStr,sizeof (ValueStr) - 1);
|
||||
Criterion.Values[ValueRange] = Str_GetDoubleFromStr (ValueStr);
|
||||
Rubrics.Criterion.Values[ValueRange] = Str_GetDoubleFromStr (ValueStr);
|
||||
|
||||
/***** Change value *****/
|
||||
/* Update the table changing old value by new value */
|
||||
Rub_DB_UpdateCriterionValue (&Criterion,ValueRange);
|
||||
Rub_DB_UpdateCriterionValue (&Rubrics.Criterion,ValueRange);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -426,21 +417,20 @@ static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
|||
void RubCri_ChangeWeight (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char WeightStr[64];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.CriCod = Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -448,15 +438,14 @@ void RubCri_ChangeWeight (void)
|
|||
|
||||
/***** Receive new weight from form *****/
|
||||
Par_GetParText ("Weight",WeightStr,sizeof (WeightStr) - 1);
|
||||
Criterion.Weight = Str_GetDoubleFromStr (WeightStr);
|
||||
Rubrics.Criterion.Weight = Str_GetDoubleFromStr (WeightStr);
|
||||
|
||||
/***** Change value *****/
|
||||
/* Update the table changing old weight by new weight */
|
||||
Rub_DB_UpdateCriterionWeight (&Criterion);
|
||||
Rub_DB_UpdateCriterionWeight (&Rubrics.Criterion);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -517,8 +506,7 @@ void RubCri_ListCriteriaForSeeing (const struct Rub_Rubrics *Rubrics)
|
|||
/**************** List the criteria of a rubric for edition ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void RubCri_ListCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion)
|
||||
void RubCri_ListCriteriaForEdition (struct Rub_Rubrics *Rubrics)
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Rubrics_criteria;
|
||||
extern const char *Txt_Criteria;
|
||||
|
@ -549,7 +537,7 @@ void RubCri_ListCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
|
||||
/***** Put forms to create/edit a criterion *****/
|
||||
if (ICanEditCriteria)
|
||||
RubCri_PutFormNewCriterion (Rubrics,Criterion,MaxCriInd);
|
||||
RubCri_PutFormNewCriterion (Rubrics,MaxCriInd);
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
@ -567,10 +555,6 @@ static void RubCri_ListOneOrMoreCriteriaForSeeing (unsigned NumCriteria,
|
|||
struct RubCri_Criterion Criterion;
|
||||
RubCri_ValueRange_t ValueRange;
|
||||
|
||||
/***** Trivial check *****/
|
||||
if (!NumCriteria)
|
||||
return;
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (5);
|
||||
|
||||
|
@ -628,7 +612,7 @@ static void RubCri_ListOneOrMoreCriteriaForSeeing (unsigned NumCriteria,
|
|||
HTM_TD_Begin ("class=\"RT DAT_%s %s\"",
|
||||
The_GetSuffix (),
|
||||
The_GetColorRows ());
|
||||
HTM_Unsigned (Criterion.Values[ValueRange]);
|
||||
HTM_Double (Criterion.Values[ValueRange]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
|
@ -636,7 +620,7 @@ static void RubCri_ListOneOrMoreCriteriaForSeeing (unsigned NumCriteria,
|
|||
HTM_TD_Begin ("class=\"RT DAT_%s %s\"",
|
||||
The_GetSuffix (),
|
||||
The_GetColorRows ());
|
||||
HTM_Unsigned (Criterion.Weight);
|
||||
HTM_Double (Criterion.Weight);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** End first row *****/
|
||||
|
@ -679,14 +663,9 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
[RubCri_MAX] = ActChgMaxRubCri,
|
||||
};
|
||||
unsigned NumCriterion;
|
||||
struct RubCri_Criterion Criterion;
|
||||
char *Anchor;
|
||||
RubCri_ValueRange_t ValueRange;
|
||||
|
||||
/***** Trivial check *****/
|
||||
if (!NumCriteria)
|
||||
return;
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (5);
|
||||
|
||||
|
@ -699,17 +678,13 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
NumCriterion++, The_ChangeRowColor ())
|
||||
{
|
||||
/***** Create criterion of questions *****/
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics->Criterion);
|
||||
|
||||
/***** Get criterion data *****/
|
||||
RubCri_GetCriterionDataFromRow (mysql_res,&Criterion);
|
||||
|
||||
/* Initialize context */
|
||||
Rubrics->CriCod = Criterion.CriCod;
|
||||
Rubrics->CriInd = Criterion.CriInd;
|
||||
RubCri_GetCriterionDataFromRow (mysql_res,&Rubrics->Criterion);
|
||||
|
||||
/***** Build anchor string *****/
|
||||
Frm_SetAnchorStr (Criterion.CriCod,&Anchor);
|
||||
Frm_SetAnchorStr (Rubrics->Criterion.CriCod,&Anchor);
|
||||
|
||||
/***** Begin first row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -723,7 +698,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
RubCri_PutParsOneCriterion,Rubrics);
|
||||
|
||||
/* Put icon to move up the question */
|
||||
if (Criterion.CriInd > 1)
|
||||
if (Rubrics->Criterion.CriInd > 1)
|
||||
Lay_PutContextualLinkOnlyIcon (ActUp_RubCri,Anchor,
|
||||
RubCri_PutParsOneCriterion,Rubrics,
|
||||
"arrow-up.svg",Ico_BLACK);
|
||||
|
@ -732,7 +707,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
Txt_Movement_not_allowed);
|
||||
|
||||
/* Put icon to move down the criterion */
|
||||
if (Criterion.CriInd < MaxCriInd)
|
||||
if (Rubrics->Criterion.CriInd < MaxCriInd)
|
||||
Lay_PutContextualLinkOnlyIcon (ActDwnRubCri,Anchor,
|
||||
RubCri_PutParsOneCriterion,Rubrics,
|
||||
"arrow-down.svg",Ico_BLACK);
|
||||
|
@ -745,7 +720,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
/***** Index *****/
|
||||
HTM_TD_Begin ("rowspan=\"2\" class=\"RT %s\"",
|
||||
The_GetColorRows ());
|
||||
Lay_WriteIndex (Criterion.CriInd,"BIG_INDEX");
|
||||
Lay_WriteIndex (Rubrics->Criterion.CriInd,"BIG_INDEX");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
|
@ -753,7 +728,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
HTM_ARTICLE_Begin (Anchor);
|
||||
Frm_BeginFormAnchor (ActChgTitRubCri,Anchor);
|
||||
RubCri_PutParsOneCriterion (Rubrics);
|
||||
HTM_INPUT_TEXT ("Title",RubCri_MAX_CHARS_TITLE,Criterion.Title,
|
||||
HTM_INPUT_TEXT ("Title",RubCri_MAX_CHARS_TITLE,Rubrics->Criterion.Title,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"id=\"Title\""
|
||||
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
||||
|
@ -767,7 +742,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
||||
Frm_BeginFormAnchor (ActChgLnkRubCri,Anchor);
|
||||
RubCri_PutParsOneCriterion (Rubrics);
|
||||
Rsc_ShowClipboardToChangeLink (&Criterion.Link);
|
||||
Rsc_ShowClipboardToChangeLink (&Rubrics->Criterion.Link);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -780,7 +755,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
Frm_BeginFormAnchor (RubCri_ActionsValues[ValueRange],Anchor);
|
||||
RubCri_PutParsOneCriterion (Rubrics);
|
||||
HTM_INPUT_FLOAT (RubCri_ParValues[ValueRange],0.0,DBL_MAX,0.1,
|
||||
Criterion.Values[ValueRange],false,
|
||||
Rubrics->Criterion.Values[ValueRange],false,
|
||||
" class=\"INPUT_FLOAT INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -796,7 +771,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
RubCri_WEIGHT_MIN,
|
||||
RubCri_WEIGHT_MAX,
|
||||
RubCri_WEIGHT_STEP,
|
||||
Criterion.Weight,false,
|
||||
Rubrics->Criterion.Weight,false,
|
||||
" class=\"INPUT_FLOAT INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -943,15 +918,14 @@ void RubCri_ReqRemCriterion (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_criterion_X;
|
||||
extern const char *Txt_Remove_criterion;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -962,11 +936,10 @@ void RubCri_ReqRemCriterion (void)
|
|||
RubCri_PutParsOneCriterion,&Rubrics,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_criterion,
|
||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_criterion_X,
|
||||
Criterion.Title);
|
||||
Rubrics.Criterion.Title);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -980,15 +953,14 @@ void RubCri_RemoveCriterion (void)
|
|||
{
|
||||
extern const char *Txt_Criterion_removed;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
|
@ -999,17 +971,16 @@ void RubCri_RemoveCriterion (void)
|
|||
// Exa_DB_RemoveAllSetQuestionsFromSet (Criterion.CriCod,Criterion.RubCod);
|
||||
|
||||
/* Remove the criterion itself */
|
||||
Rub_DB_RemoveCriterionFromRubric (&Criterion);
|
||||
Rub_DB_RemoveCriterionFromRubric (&Rubrics.Criterion);
|
||||
|
||||
/* Change indexes of criteria greater than this */
|
||||
Rub_DB_UpdateCriteriaIndexesInRubricGreaterThan (&Criterion);
|
||||
Rub_DB_UpdateCriteriaIndexesInRubricGreaterThan (&Rubrics.Criterion);
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Criterion_removed);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -1023,24 +994,23 @@ void RubCri_MoveUpCriterion (void)
|
|||
{
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
unsigned CriIndTop;
|
||||
unsigned CriIndBottom;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get criterion index *****/
|
||||
CriIndBottom = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Criterion.CriCod);
|
||||
CriIndBottom = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Rubrics.Criterion.CriCod);
|
||||
|
||||
/***** Move up criterion *****/
|
||||
if (CriIndBottom > 1)
|
||||
|
@ -1057,8 +1027,7 @@ void RubCri_MoveUpCriterion (void)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -1072,7 +1041,6 @@ void RubCri_MoveDownCriterion (void)
|
|||
{
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
unsigned CriIndTop;
|
||||
unsigned CriIndBottom;
|
||||
unsigned MaxCriInd; // 0 if no criteria
|
||||
|
@ -1080,17 +1048,17 @@ void RubCri_MoveDownCriterion (void)
|
|||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get criterion index *****/
|
||||
CriIndTop = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Criterion.CriCod);
|
||||
CriIndTop = Rub_DB_GetCriIndFromCriCod (Rubrics.Rubric.RubCod,Rubrics.Criterion.CriCod);
|
||||
|
||||
/***** Get maximum criterion index *****/
|
||||
MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics.Rubric.RubCod);
|
||||
|
@ -1110,8 +1078,7 @@ void RubCri_MoveDownCriterion (void)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,
|
||||
Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
@ -1121,12 +1088,11 @@ void RubCri_MoveDownCriterion (void)
|
|||
/********* Get and check parameters, rubric data and criterion data **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion)
|
||||
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics)
|
||||
{
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (Rubrics,true);
|
||||
Criterion->CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
Rubrics->Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
/***** Get rubric data from database *****/
|
||||
Rub_GetRubricDataByCod (&Rubrics->Rubric);
|
||||
|
@ -1134,10 +1100,9 @@ static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics,
|
|||
Err_WrongRubricExit ();
|
||||
|
||||
/***** Get criterion data from database *****/
|
||||
RubCri_GetCriterionDataByCod (Criterion);
|
||||
if (Criterion->RubCod != Rubrics->Rubric.RubCod)
|
||||
RubCri_GetCriterionDataByCod (&Rubrics->Criterion);
|
||||
if (Rubrics->Criterion.RubCod != Rubrics->Rubric.RubCod)
|
||||
Err_WrongCriterionExit ();
|
||||
Rubrics->CriCod = Criterion->CriCod;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1192,32 +1157,31 @@ static void RubCri_ExchangeCriteria (long RubCod,
|
|||
void RubCri_ChangeLink (void)
|
||||
{
|
||||
struct Rub_Rubrics Rubrics;
|
||||
struct RubCri_Criterion Criterion;
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
RubCri_ResetCriterion (&Criterion);
|
||||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get and check parameters *****/
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics,&Criterion);
|
||||
RubCri_GetAndCheckRubricAndCriterion (&Rubrics);
|
||||
|
||||
/***** Check if rubric is editable *****/
|
||||
if (!Rub_CheckIfEditable ())
|
||||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Get link type and code *****/
|
||||
if (Rsc_GetParLink (&Criterion.Link))
|
||||
if (Rsc_GetParLink (&Rubrics.Criterion.Link))
|
||||
{
|
||||
/***** Update link to resource in criterion *****/
|
||||
Rub_DB_UpdateCriterionLink (&Criterion);
|
||||
Rub_DB_UpdateCriterionLink (&Rubrics.Criterion);
|
||||
|
||||
/***** Remove link from clipboard *****/
|
||||
Rsc_DB_RemoveLinkFromClipboard (&Criterion.Link);
|
||||
Rsc_DB_RemoveLinkFromClipboard (&Rubrics.Criterion.Link);
|
||||
}
|
||||
|
||||
/***** Show current rubric and its criteria *****/
|
||||
Rub_PutFormsOneRubric (&Rubrics,&Criterion,Rub_EXISTING_RUBRIC);
|
||||
Rub_PutFormsOneRubric (&Rubrics,Rub_EXISTING_RUBRIC);
|
||||
|
||||
/***** Free memory used for rubric *****/
|
||||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
|
|
|
@ -42,8 +42,7 @@ void RubCri_ChangeMaxValue (void);
|
|||
void RubCri_ChangeWeight (void);
|
||||
|
||||
void RubCri_ListCriteriaForSeeing (const struct Rub_Rubrics *Rubrics);
|
||||
void RubCri_ListCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
||||
struct RubCri_Criterion *Criterion);
|
||||
void RubCri_ListCriteriaForEdition (struct Rub_Rubrics *Rubrics);
|
||||
|
||||
void RubCri_ResetCriterion (struct RubCri_Criterion *Criterion);
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ static void RubRsc_PutIconsClipboard (__attribute__((unused)) void *Args);
|
|||
void RubRsc_GetLinkToRubric (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Rubrics;
|
||||
struct Rub_Rubrics Rubrics;
|
||||
char Title[Rub_MAX_BYTES_TITLE + 1];
|
||||
|
||||
/***** Reset rubrics context *****/
|
||||
Rub_ResetRubrics (&Rubrics);
|
||||
|
@ -60,15 +60,17 @@ void RubRsc_GetLinkToRubric (void)
|
|||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false);
|
||||
|
||||
/***** Get rubric title *****/
|
||||
RubRsc_GetTitleFromRubCod (Rubrics.Rubric.RubCod,Title,sizeof (Title) - 1);
|
||||
/***** Get rubric data *****/
|
||||
if (Rubrics.Rubric.RubCod > 0)
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
|
||||
/***** Copy link to rubric into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_RUBRIC,Rubrics.Rubric.RubCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
Rubrics.Rubric.RubCod > 0 ? Rubrics.Rubric.Title :
|
||||
Txt_Rubrics);
|
||||
|
||||
/***** Show rubrics again *****/
|
||||
Rub_ListAllRubrics (&Rubrics);
|
||||
|
@ -77,23 +79,6 @@ void RubRsc_GetLinkToRubric (void)
|
|||
Rub_RubricDestructor (&Rubrics.Rubric);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get rubric title from rubric code *********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void RubRsc_GetTitleFromRubCod (long RubCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Rubrics;
|
||||
|
||||
if (RubCod > 0)
|
||||
/***** Get rubric title from database *****/
|
||||
Rub_DB_GetRubricTitle (RubCod,Title,TitleSize);
|
||||
else
|
||||
/***** Generic title for all rubrics *****/
|
||||
Str_Copy (Title,Txt_Rubrics,TitleSize);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Show clipboard on top of rubrics ***********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void RubRsc_GetLinkToRubric (void);
|
||||
void RubRsc_GetTitleFromRubCod (long RubCod,char *Title,size_t TitleSize);
|
||||
|
||||
void RubRsc_ViewResourceClipboard (void);
|
||||
void RubRsc_RemoveResourceClipboard (void);
|
||||
|
|
|
@ -44,6 +44,13 @@
|
|||
#define RubCri_MAX_CHARS_TITLE (256 - 1) // 255
|
||||
#define RubCri_MAX_BYTES_TITLE ((RubCri_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 4095
|
||||
|
||||
#define RubCri_NUM_VALUES 2
|
||||
typedef enum
|
||||
{
|
||||
RubCri_MIN = 0,
|
||||
RubCri_MAX = 1,
|
||||
} RubCri_ValueRange_t;
|
||||
|
||||
struct Rub_Rubric
|
||||
{
|
||||
long RubCod; // Rubric code
|
||||
|
@ -53,31 +60,6 @@ struct Rub_Rubric
|
|||
char *Txt; // Text (dynamically allocated)
|
||||
};
|
||||
|
||||
struct Rub_Rubrics
|
||||
{
|
||||
bool LstIsRead; // Is the list already read from database...
|
||||
// ...or it needs to be read?
|
||||
unsigned Num; // Total number of rubrics
|
||||
long *Lst; // List of rubric codes
|
||||
unsigned CurrentPage;
|
||||
struct Rub_Rubric Rubric; // Selected/current rubric
|
||||
long CriCod; // Selected/current criterion code
|
||||
unsigned CriInd; // Current citerion index
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Rub_EXISTING_RUBRIC,
|
||||
Rub_NEW_RUBRIC,
|
||||
} Rub_ExistingNewRubric_t;
|
||||
|
||||
#define RubCri_NUM_VALUES 2
|
||||
typedef enum
|
||||
{
|
||||
RubCri_MIN = 0,
|
||||
RubCri_MAX = 1,
|
||||
} RubCri_ValueRange_t;
|
||||
|
||||
struct RubCri_Criterion
|
||||
{
|
||||
long RubCod; // Rubric code
|
||||
|
@ -89,4 +71,21 @@ struct RubCri_Criterion
|
|||
char Title[RubCri_MAX_BYTES_TITLE + 1]; // Title of the criterion
|
||||
};
|
||||
|
||||
struct Rub_Rubrics
|
||||
{
|
||||
bool LstIsRead; // Is the list already read from database...
|
||||
// ...or it needs to be read?
|
||||
unsigned Num; // Total number of rubrics
|
||||
long *Lst; // List of rubric codes
|
||||
unsigned CurrentPage;
|
||||
struct Rub_Rubric Rubric; // Selected/current rubric
|
||||
struct RubCri_Criterion Criterion; // Selected/current criterion
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Rub_EXISTING_RUBRIC,
|
||||
Rub_NEW_RUBRIC,
|
||||
} Rub_ExistingNewRubric_t;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -445,7 +445,8 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
|||
|
||||
/***** Begin box *****/
|
||||
if (ShowOnlyThisSvyComplete)
|
||||
Box_BoxBegin (NULL,Txt_Survey,
|
||||
Box_BoxBegin (NULL,Surveys->Svy.Title[0] ? Surveys->Svy.Title :
|
||||
Txt_Survey,
|
||||
Svy_PutIconsOneSvy,Surveys,
|
||||
Hlp_ANALYTICS_Surveys,Box_NOT_CLOSABLE);
|
||||
|
||||
|
|
|
@ -290,9 +290,9 @@ unsigned Svy_DB_GetSurveyDataByCod (MYSQL_RES **mysql_res,long SvyCod)
|
|||
/******************** Get survey title using its code ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Svy_DB_GetSurveyTitle (long SvyCod,char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1])
|
||||
void Svy_DB_GetSurveyTitle (long SvyCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
DB_QuerySELECTString (Title,Svy_MAX_BYTES_SURVEY_TITLE,"can not get survey title",
|
||||
DB_QuerySELECTString (Title,TitleSize,"can not get survey title",
|
||||
"SELECT Title" // row[0]
|
||||
" FROM svy_surveys"
|
||||
" WHERE SvyCod=%ld", // Extra check
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "swad_constant.h"
|
||||
#include "swad_date.h"
|
||||
#include "swad_survey.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
|
@ -48,7 +49,7 @@ unsigned Svy_DB_GetListSurveys (MYSQL_RES **mysql_res,
|
|||
unsigned HiddenAllowed,
|
||||
Dat_StartEndTime_t SelectedOrder);
|
||||
unsigned Svy_DB_GetSurveyDataByCod (MYSQL_RES **mysql_res,long SvyCod);
|
||||
void Svy_DB_GetSurveyTitle (long SvyCod,char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1]);
|
||||
void Svy_DB_GetSurveyTitle (long SvyCod,char *Title,size_t TitleSize);
|
||||
unsigned Svy_DB_GetSurveyTitleAndText (MYSQL_RES **mysql_res,long SvyCod);
|
||||
void Svy_DB_GetSurveyTxt (long SvyCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
bool Svy_DB_CheckIfSimilarSurveyExists (const struct Svy_Survey *Svy);
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
void SvyRsc_GetLinkToSurvey (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
extern const char *Txt_Surveys;
|
||||
struct Svy_Surveys Surveys;
|
||||
char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1];
|
||||
|
||||
/***** Reset surveys context *****/
|
||||
Svy_ResetSurveys (&Surveys);
|
||||
|
@ -51,37 +51,18 @@ void SvyRsc_GetLinkToSurvey (void)
|
|||
/***** Get survey code *****/
|
||||
Surveys.Svy.SvyCod = ParCod_GetPar (ParCod_Svy);
|
||||
|
||||
/***** Get survey title *****/
|
||||
SvyRsc_GetTitleFromSvyCod (Surveys.Svy.SvyCod,Title,sizeof (Title) - 1);
|
||||
/***** Get survey data *****/
|
||||
if (Surveys.Svy.SvyCod > 0)
|
||||
Svy_GetSurveyDataByCod (&Surveys.Svy);
|
||||
|
||||
/***** Copy link to survey into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_SURVEY,Surveys.Svy.SvyCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
Surveys.Svy.SvyCod > 0 ? Surveys.Svy.Title :
|
||||
Txt_Surveys);
|
||||
|
||||
/***** Show surveys again *****/
|
||||
Svy_ListAllSurveys (&Surveys);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get survey title from survey code *********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void SvyRsc_GetTitleFromSvyCod (long SvyCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Surveys;
|
||||
char TitleFromDB[Svy_MAX_BYTES_SURVEY_TITLE + 1];
|
||||
|
||||
if (SvyCod > 0)
|
||||
{
|
||||
/***** Get survey title *****/
|
||||
Svy_DB_GetSurveyTitle (SvyCod,TitleFromDB);
|
||||
Str_Copy (Title,TitleFromDB,TitleSize);
|
||||
}
|
||||
else
|
||||
/***** Generic title for all surveys *****/
|
||||
Str_Copy (Title,Txt_Surveys,TitleSize);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,5 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void SvyRsc_GetLinkToSurvey (void);
|
||||
void SvyRsc_GetTitleFromSvyCod (long SvyCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue