From 86a333942532a107089dcf59fc81ac4b287562e5 Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 2 Mar 2023 22:40:41 +0100 Subject: [PATCH] Version 22.66: Mar 02, 2023 New module swad_rubric_criteria for rubric criteria. --- Makefile | 3 +- swad_agenda.c | 2 +- swad_assignment.c | 2 +- swad_attendance.c | 2 +- swad_changelog.h | 19 +- swad_exam.c | 2 +- swad_forum.c | 10 +- swad_game.c | 2 +- swad_message.c | 2 +- swad_pagination.c | 6 +- swad_pagination.h | 8 +- swad_project.c | 2 +- swad_rubric.c | 412 ++------------------------------------- swad_rubric.h | 22 +-- swad_rubric_criteria.c | 425 +++++++++++++++++++++++++++++++++++++++++ swad_rubric_criteria.h | 67 +++++++ swad_survey.c | 2 +- swad_text.c | 142 +++++++++----- 18 files changed, 635 insertions(+), 495 deletions(-) create mode 100644 swad_rubric_criteria.c create mode 100644 swad_rubric_criteria.h diff --git a/Makefile b/Makefile index 26ec71f6..92099003 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,8 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_action_list.o \ swad_QR.o \ swad_record.o swad_record_database.o swad_report.o \ swad_report_database.o swad_role.o swad_role_database.o swad_room.o \ - swad_room_database.o swad_RSS.o swad_rubric.o swad_rubric_database.o \ + swad_room_database.o swad_RSS.o swad_rubric.o swad_rubric_criteria.o \ + swad_rubric_database.o \ swad_scope.o swad_search.o swad_session.o swad_session_database.o \ swad_setting.o swad_setting_database.o swad_statistic.o \ swad_statistic_database.o swad_string.o swad_survey.o \ diff --git a/swad_agenda.c b/swad_agenda.c index 62926848..3e9796b2 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -489,7 +489,7 @@ static void Agd_ShowEvents (struct Agd_Agenda *Agenda, extern const char *Txt_Public_agenda_USER; extern const char *Txt_My_agenda; extern const char *Txt_No_events; - struct Pagination Pagination; + struct Pag_Pagination Pagination; unsigned NumEvent; static const Pag_WhatPaginate_t WhatPaginate[Agd_NUM_AGENDA_TYPES] = { diff --git a/swad_assignment.c b/swad_assignment.c index b2596b21..a55fa983 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -140,7 +140,7 @@ void Asg_ShowAllAssignments (struct Asg_Assignments *Assignments) extern const char *Hlp_ASSESSMENT_Assignments; extern const char *Txt_Assignments; extern const char *Txt_No_assignments; - struct Pagination Pagination; + struct Pag_Pagination Pagination; unsigned NumAsg; /***** Get list of assignments *****/ diff --git a/swad_attendance.c b/swad_attendance.c index 78bb38f9..36f866b4 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -214,7 +214,7 @@ static void Att_ShowAllAttEvents (struct Att_Events *Events) extern const char *Txt_Event; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_No_events; - struct Pagination Pagination; + struct Pag_Pagination Pagination; Dat_StartEndTime_t Order; Grp_WhichGroups_t WhichGroups; unsigned NumAttEvent; diff --git a/swad_changelog.h b/swad_changelog.h index d7e52e8b..ee28ae77 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -605,11 +605,7 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate TODO: Attach pdf files in multimedia. TODO: BUG al intentar crear un fichero ZIP con los trabajos de una asignatura si un estudiante con nombre cirílico está entre los alumnos que seleccionas para ver los trabajos. Reported by Víctor Vázquez Rodríguez el 22 de enero de 2023. -*/ -#define Log_PLATFORM_VERSION "SWAD 22.62 (2023-02-10)" -#define CSS_FILE "swad22.57.1.css" -#define JS_FILE "swad22.49.js" -/* + Sugerencia de J.L Bernier. Al eliminar los estudiantes, que se eliminen los trabajos opcionalmente marcando una casilla. En Actividades, no permitir acceso a documentos mientras dura la actividad, también opcionalmente. Que no haya dos sesiones del mismo usuario abiertas al entregar actividades, o hacer algo como en los exámenes, log. @@ -626,10 +622,19 @@ son planteamientos que facilitar siempre atento a sus comentarios y agradecido de antemano por la ayuda que siempre nos ha brindado.........Saludos Caribeños desde Venezuela -TODO: Emilce Barrera Mesa: Calificación integrada de las actividades. +TODO: Emilce Barrera Mesa: Calificación integrada de las actividades. No olvides por favor la opción de calificar y asignar nota en cada actividad o trabajo. Eso agregaría un toque de supereficiencia a tu plataforma. TODO: Emilce Barrera Mesa: Para futuras mejoras podrías incluir por favor la opción de duplicar una pregunta al momento de crearlas. Esto en razón a que si tengo dos preguntas con las mismas opciones de respuesta, pero diferente enunciado me ahorrarías tiempo si me permites duplicar la pregunta y solo cambiar el enunciado. +TODO: Emilce Barrera Mesa: Quiero preguntarte si es posible que me habilites la opción de que en el examen solo tenga en cuenta las respuestas correctas para asignar la nota. Es decir que no reste puntaje por las preguntas incorrectas, que tanto incorrectas como sin contestar tengan el valor de cero. +TODO: Emilce Barrera Mesa: Podrías agregar por favor una opción que me permita exportar en excel, cvs o pdf el listado de estudiantes y la nota optenida en el examen. Eso me ayudaría mucho a la hora de pegarlas en mi planilla de excel. +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. - Version 22.65.1: Mar 01, 2023 Changes in rubrics. Not finished. (? lines) +*/ +#define Log_PLATFORM_VERSION "SWAD 22.66 (2023-03-02)" +#define CSS_FILE "swad22.57.1.css" +#define JS_FILE "swad22.49.js" +/* + Version 22.66: Mar 02, 2023 New module swad_rubric_criteria for rubric criteria. (337125 lines) + Version 22.65.1: Mar 02, 2023 Changes in rubrics. Not finished. (337012 lines) Version 22.65: Mar 01, 2023 New module swad_rubric for rubrics. Not finished. (336989 lines) 2 changes necessary in database: CREATE TABLE IF NOT EXISTS rub_rubrics (RubCod INT NOT NULL AUTO_INCREMENT,CrsCod INT NOT NULL DEFAULT -1,UsrCod INT NOT NULL,Title VARCHAR(2047) NOT NULL,Txt TEXT NOT NULL,UNIQUE INDEX(RubCod),INDEX(CrsCod)); diff --git a/swad_exam.c b/swad_exam.c index 4c87c6b6..5d4076ed 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -217,7 +217,7 @@ void Exa_ListAllExams (struct Exa_Exams *Exams) extern const char *Txt_Sessions; extern const char *Txt_No_exams; Exa_Order_t Order; - struct Pagination Pagination; + struct Pag_Pagination Pagination; unsigned NumExam; /***** Get number of groups in current course *****/ diff --git a/swad_forum.c b/swad_forum.c index 5786b6f2..0f429779 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -369,7 +369,7 @@ static void For_PutAllHiddenParamsNewThread (void *Forums); static void For_ListForumThrs (struct For_Forums *Forums, long ThrCods[Pag_ITEMS_PER_PAGE], long ThrCodHighlighted, - struct Pagination *PaginationThrs); + struct Pag_Pagination *PaginationThrs); static void For_GetThreadData (struct For_Thread *Thr); static void For_SetForumType (struct For_Forums *Forums); @@ -669,7 +669,7 @@ void For_ShowPostsOfAThread (struct For_Forums *Forums, unsigned NumPsts; time_t ReadTimeUTC; // Read time of thread for the current user time_t CreatTimeUTC; // Creation time of post - struct Pagination PaginationPsts; + struct Pag_Pagination PaginationPsts; bool NewPst = false; bool ICanModerateForum = false; @@ -2005,7 +2005,7 @@ void For_ShowForumThreadsHighlightingOneThread (struct For_Forums *Forums, unsigned NumThrInScreen; // From 0 to Pag_ITEMS_PER_PAGE-1 Dat_StartEndTime_t Order; long ThrCods[Pag_ITEMS_PER_PAGE]; - struct Pagination PaginationThrs; + struct Pag_Pagination PaginationThrs; /***** Set forum name *****/ For_SetForumName (&Forums->Forum, @@ -2158,7 +2158,7 @@ static void For_PutAllHiddenParamsNewThread (void *Forums) static void For_ListForumThrs (struct For_Forums *Forums, long ThrCods[Pag_ITEMS_PER_PAGE], long ThrCodHighlighted, - struct Pagination *PaginationThrs) + struct Pag_Pagination *PaginationThrs) { extern const char *Txt_Thread_with_posts_from_you; extern const char *Txt_There_are_new_posts; @@ -2178,7 +2178,7 @@ static void For_ListForumThrs (struct For_Forums *Forums, struct Usr_Data UsrDat; Dat_StartEndTime_t Order; time_t TimeUTC; - struct Pagination PaginationPsts; + struct Pag_Pagination PaginationPsts; const char *Class; long ThreadInMyClipboard = -1L; unsigned Column; diff --git a/swad_game.c b/swad_game.c index 885b9534..4f763ac3 100644 --- a/swad_game.c +++ b/swad_game.c @@ -232,7 +232,7 @@ void Gam_ListAllGames (struct Gam_Games *Games) extern const char *Txt_Matches; extern const char *Txt_No_games; Gam_Order_t Order; - struct Pagination Pagination; + struct Pag_Pagination Pagination; unsigned NumGame; /***** Reset game *****/ diff --git a/swad_message.c b/swad_message.c index 7b9885f0..f666974b 100644 --- a/swad_message.c +++ b/swad_message.c @@ -1439,7 +1439,7 @@ static void Msg_ShowSntOrRcvMessages (struct Msg_Messages *Messages) unsigned NumMsg; char *NumMsgsStr; unsigned NumUnreadMsgs; - struct Pagination Pagination; + struct Pag_Pagination Pagination; long MsgCod; static const Act_Action_t ActionSee[Msg_NUM_TYPES_OF_MSGS] = { diff --git a/swad_pagination.c b/swad_pagination.c index 4eb7af01..14c811ae 100644 --- a/swad_pagination.c +++ b/swad_pagination.c @@ -88,7 +88,7 @@ static const char *Pag_ParamNumPag[Pag_NUM_WHAT_PAGINATE] = #define NUM_PAGES_BEFORE_CURRENT 1 #define NUM_PAGES_AFTER_CURRENT 1 -void Pag_CalculatePagination (struct Pagination *Pagination) +void Pag_CalculatePagination (struct Pag_Pagination *Pagination) { Pagination->StartPage = Pagination->LeftPage = @@ -138,7 +138,7 @@ void Pag_CalculatePagination (struct Pagination *Pagination) /*****************************************************************************/ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, - struct Pagination *Pagination, + struct Pag_Pagination *Pagination, const void *Context,long Cod) { if (Pagination->MoreThanOnePage) @@ -155,7 +155,7 @@ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, /*****************************************************************************/ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, - struct Pagination *Pagination, + struct Pag_Pagination *Pagination, const void *Context,long Cod, bool FirstMsgEnabled, const char *Subject,const char *ClassTxt, diff --git a/swad_pagination.h b/swad_pagination.h index b071924c..67a08cb2 100644 --- a/swad_pagination.h +++ b/swad_pagination.h @@ -58,7 +58,7 @@ typedef enum Pag_ANOTHER_AGENDA = 13, } Pag_WhatPaginate_t; -struct Pagination // Used for threads and messages pagination +struct Pag_Pagination // Used for threads and messages pagination { unsigned NumItems; unsigned StartPage; @@ -77,12 +77,12 @@ struct Pagination // Used for threads and messages pagination /****************************** Public prototypes ****************************/ /*****************************************************************************/ -void Pag_CalculatePagination (struct Pagination *Pagination); +void Pag_CalculatePagination (struct Pag_Pagination *Pagination); void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, - struct Pagination *Pagination, + struct Pag_Pagination *Pagination, const void *Context,long Cod); void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, - struct Pagination *Pagination, + struct Pag_Pagination *Pagination, const void *Context,long Cod, bool FirstMsgEnabled, const char *Subject,const char *ClassTxt, diff --git a/swad_project.c b/swad_project.c index 08234cfb..0ff2a537 100644 --- a/swad_project.c +++ b/swad_project.c @@ -490,7 +490,7 @@ static void Prj_ShowPrjsInCurrentPage (void *Projects) extern const char *Hlp_ASSESSMENT_Projects; extern const char *Txt_Projects; extern const char *Txt_No_projects; - struct Pagination Pagination; + struct Pag_Pagination Pagination; unsigned NumPrj; if (Projects) diff --git a/swad_rubric.c b/swad_rubric.c index b54f7d63..e835da58 100644 --- a/swad_rubric.c +++ b/swad_rubric.c @@ -25,27 +25,22 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ -#define _GNU_SOURCE // For asprintf -#include // For PATH_MAX +#include // For boolean type #include // For NULL -#include // For asprintf -#include // For free -#include // For string functions #include "swad_action_list.h" #include "swad_autolink.h" #include "swad_box.h" +#include "swad_constant.h" #include "swad_database.h" #include "swad_error.h" #include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" -#include "swad_hierarchy_level.h" -#include "swad_HTML.h" #include "swad_pagination.h" #include "swad_parameter.h" -#include "swad_role.h" #include "swad_rubric.h" +#include "swad_rubric_criteria.h" #include "swad_rubric_database.h" /*****************************************************************************/ @@ -62,7 +57,6 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static bool Rub_CheckIfICanEditRubrics (void); static void Rub_PutIconsListRubrics (void *Rubrics); static void Rub_PutIconToCreateNewRubric (struct Rub_Rubrics *Rubrics); static void Rub_PutButtonToCreateNewRubric (struct Rub_Rubrics *Rubrics); @@ -88,14 +82,6 @@ static bool Rub_CheckRubricFieldsReceivedFromForm (const struct Rub_Rubric *Rubr static void Rub_CreateRubric (struct Rub_Rubric *Rubric,const char *Txt); static void Rub_UpdateRubric (struct Rub_Rubric *Rubric,const char *Txt); -static void Rub_ListRubricCriteria (struct Rub_Rubrics *Rubrics); -static void Rub_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics, - unsigned NumCriteria, - MYSQL_RES *mysql_res, - bool ICanEditCriteria); -static void Rub_PutIconToAddNewCriterion (void *Rubrics); -static void Rub_PutButtonToAddNewCriterion (struct Rub_Rubrics *Rubrics); - /*****************************************************************************/ /*************************** Reset rubrics context ***************************/ /*****************************************************************************/ @@ -150,9 +136,8 @@ void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics) extern const char *Hlp_ASSESSMENT_Rubrics; extern const char *Txt_Rubrics; extern const char *Txt_Rubric; - // extern const char *Txt_Criteria; extern const char *Txt_No_rubrics; - struct Pagination Pagination; + struct Pag_Pagination Pagination; unsigned NumRubric; /***** Reset rubric *****/ @@ -239,7 +224,7 @@ void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics) /************************ Check if I can edit rubrics ************************/ /*****************************************************************************/ -static bool Rub_CheckIfICanEditRubrics (void) +bool Rub_CheckIfICanEditRubrics (void) { static const bool ICanEditRubrics[Rol_NUM_ROLES] = { @@ -488,16 +473,6 @@ static void Rub_PutIconsToRemEditOneRubric (struct Rub_Rubrics *Rubrics) } } -/*****************************************************************************/ -/**************** Put parameter to move/remove one criterion *****************/ -/*****************************************************************************/ - -static void Rub_PutParamsOneQst (void *Rubrics) - { - if (Rubrics) - Rub_PutParams (Rubrics); - } - /*****************************************************************************/ /*********************** Params used to edit a rubric ************************/ /*****************************************************************************/ @@ -645,8 +620,8 @@ void Rub_FreeListRubrics (struct Rub_Rubrics *Rubrics) void Rub_AskRemRubric (void) { - extern const char *Txt_Do_you_really_want_to_remove_the_game_X; - extern const char *Txt_Remove_game; + extern const char *Txt_Do_you_really_want_to_remove_the_rubric_X; + extern const char *Txt_Remove_rubric; struct Rub_Rubrics Rubrics; /***** Reset rubrics context *****/ @@ -667,8 +642,8 @@ void Rub_AskRemRubric (void) /***** Show criterion and button to remove rubric *****/ Ale_ShowAlertAndButton (ActRemGam,NULL,NULL, Rub_PutParams,&Rubrics, - Btn_REMOVE_BUTTON,Txt_Remove_game, - Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_game_X, + Btn_REMOVE_BUTTON,Txt_Remove_rubric, + Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_rubric_X, Rubrics.Rubric.Title); /***** Show rubrics again *****/ @@ -810,7 +785,7 @@ void Rub_RequestCreatOrEditRubric (void) Rub_ListAllRubrics (&Rubrics); else /* Show criteria of the rubric ready to be edited */ - Rub_ListRubricCriteria (&Rubrics); + RubCri_ListRubricCriteria (&Rubrics); } /*****************************************************************************/ @@ -929,10 +904,10 @@ void Rub_ReceiveFormRubric (void) /***** Put forms to edit the rubric created or updated *****/ Rub_PutFormsEditionRubric (&Rubrics,Txt, - false); // No new rubric + false); // No new rubric /***** Show criteria of the rubric ready to be edited ******/ - Rub_ListRubricCriteria (&Rubrics); + RubCri_ListRubricCriteria (&Rubrics); } else { @@ -945,7 +920,7 @@ void Rub_ReceiveFormRubric (void) Rub_ListAllRubrics (&Rubrics); else /* Show criteria of the rubric ready to be edited */ - Rub_ListRubricCriteria (&Rubrics); + RubCri_ListRubricCriteria (&Rubrics); } } else @@ -1018,217 +993,6 @@ static void Rub_UpdateRubric (struct Rub_Rubric *Rubric,const char *Txt) Ale_ShowAlert (Ale_SUCCESS,Txt_The_rubric_has_been_modified); } -/*****************************************************************************/ -/****************** Write parameter with index of criterion ******************/ -/*****************************************************************************/ - -void Rub_PutParamCriInd (unsigned CriInd) - { - Par_PutHiddenParamUnsigned (NULL,"CriInd",CriInd); - } - -/*****************************************************************************/ -/******************* Get parameter with index of criterion *******************/ -/*****************************************************************************/ - -unsigned Rub_GetParamCriInd (void) - { - long CriInd; - - if ((CriInd = Par_GetParToLong ("CriInd")) <= 0) // In rubrics, criterion index should be 1, 2, 3... - Err_WrongCriterionIndexExit (); - - return (unsigned) CriInd; - } - -/*****************************************************************************/ -/*********************** List the criteria of a rubric ***********************/ -/*****************************************************************************/ - -static void Rub_ListRubricCriteria (struct Rub_Rubrics *Rubrics) - { - extern const char *Hlp_ASSESSMENT_Rubrics_criteria; - extern const char *Txt_Criteria; - MYSQL_RES *mysql_res; - unsigned NumCriteria; - bool ICanEditCriteria = Rub_CheckIfICanEditRubrics (); - - /***** Get data of criteria from database *****/ - NumCriteria = Rub_DB_GetRubricCriteriaBasic (&mysql_res,Rubrics->Rubric.RubCod); - - /***** Begin box *****/ - if (ICanEditCriteria) - Box_BoxBegin (NULL,Txt_Criteria, - Rub_PutIconToAddNewCriterion,Rubrics, - Hlp_ASSESSMENT_Rubrics_criteria,Box_NOT_CLOSABLE); - else - Box_BoxBegin (NULL,Txt_Criteria, - NULL,NULL, - Hlp_ASSESSMENT_Rubrics_criteria,Box_NOT_CLOSABLE); - - /***** Show table with criteria *****/ - if (NumCriteria) - Rub_ListOneOrMoreCriteriaForEdition (Rubrics,NumCriteria,mysql_res, - ICanEditCriteria); - - /***** Put button to add a new criterion in this rubric *****/ - if (ICanEditCriteria) // I can edit criteria - Rub_PutButtonToAddNewCriterion (Rubrics); - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); - - /***** End box *****/ - Box_BoxEnd (); - } - -/*****************************************************************************/ -/********************* List rubric criteria for edition **********************/ -/*****************************************************************************/ - -static void Rub_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics, - unsigned NumCriteria, - MYSQL_RES *mysql_res, - bool ICanEditCriteria) - { - extern const char *Txt_Criteria; - extern const char *Txt_No_INDEX; - extern const char *Txt_Code; - extern const char *Txt_Tags; - extern const char *Txt_Criterion; - extern const char *Txt_Movement_not_allowed; - unsigned NumCri; - unsigned CriInd; - unsigned MaxCriInd; - MYSQL_ROW row; - struct Rub_Criterion Criterion; - char StrCriInd[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; - bool CriterionExists; - char *Anchor = NULL; - - /***** Trivial check *****/ - if (!NumCriteria) - return; - - /***** Get maximum criterion index *****/ - MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics->Rubric.RubCod); // 0 is no criteria in rubric - - /***** Write the heading *****/ - HTM_TABLE_BeginWideMarginPadding (5); - - HTM_TR_Begin (NULL); - HTM_TH_Empty (1); - HTM_TH (Txt_No_INDEX ,HTM_HEAD_CENTER); - HTM_TH (Txt_Code ,HTM_HEAD_CENTER); - HTM_TH (Txt_Tags ,HTM_HEAD_CENTER); - HTM_TH (Txt_Criterion,HTM_HEAD_CENTER); - HTM_TR_End (); - - /***** Write rows *****/ - for (NumCri = 0, The_ResetRowColor (); - NumCri < NumCriteria; - NumCri++, The_ChangeRowColor ()) - { - /***** Create rubric criterion *****/ - Rub_CriterionConstructor (&Criterion); - - /***** Get criterion data *****/ - row = mysql_fetch_row (mysql_res); - /* - row[0] QstCod - row[1] QstInd - */ - /* Get criterion code (row[0]) */ - Criterion.CriCod = Str_ConvertStrCodToLongCod (row[0]); - - /* Get criterion index (row[1]) */ - CriInd = Str_ConvertStrToUnsigned (row[1]); - snprintf (StrCriInd,sizeof (StrCriInd),"%u",CriInd); - - /***** Build anchor string *****/ - Frm_SetAnchorStr (Criterion.CriCod,&Anchor); - - /***** Begin row *****/ - HTM_TR_Begin (NULL); - - /***** Icons *****/ - HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ()); - - /* Put icon to remove the criterion */ - if (ICanEditCriteria) - Ico_PutContextualIconToRemove (ActReqRemGamQst,NULL, - Rub_PutParamsOneQst,Rubrics); - else - Ico_PutIconRemovalNotAllowed (); - - /* Put icon to move up the criterion */ - if (ICanEditCriteria && CriInd > 1) - Lay_PutContextualLinkOnlyIcon (ActUp_GamQst,Anchor, - Rub_PutParamsOneQst,Rubrics, - "arrow-up.svg",Ico_BLACK); - else - Ico_PutIconOff ("arrow-up.svg",Ico_BLACK, - Txt_Movement_not_allowed); - - /* Put icon to move down the criterion */ - if (ICanEditCriteria && CriInd < MaxCriInd) - Lay_PutContextualLinkOnlyIcon (ActDwnGamQst,Anchor, - Rub_PutParamsOneQst,Rubrics, - "arrow-down.svg",Ico_BLACK); - else - Ico_PutIconOff ("arrow-down.svg",Ico_BLACK, - Txt_Movement_not_allowed); - - /* Put icon to edit the criterion */ - if (ICanEditCriteria) - Ico_PutContextualIconToEdit (ActEdiOneTstQst,NULL, - Rub_PutParamCriCod,&Criterion.CriCod); - - HTM_TD_End (); - - /***** Criterion *****/ - CriterionExists = Rub_GetCriterionDataFromDB (&Criterion); - Rub_ListCriterionForEdition (&Criterion,CriInd,CriterionExists,Anchor); - - /***** End row *****/ - HTM_TR_End (); - - /***** Free anchor string *****/ - Frm_FreeAnchorStr (Anchor); - - /***** Destroy rubric criterion *****/ - Rub_CriterionDestructor (&Criterion); - } - - /***** End table *****/ - HTM_TABLE_End (); - } - -/*****************************************************************************/ -/***************** Put icon to add a new criterion to rubric *****************/ -/*****************************************************************************/ - -static void Rub_PutIconToAddNewCriterion (void *Rubrics) - { - Ico_PutContextualIconToAdd (ActAddOneGamQst,NULL,Rub_PutParams,Rubrics); - } - -/*****************************************************************************/ -/***************** Put button to add new criteria to rubric ******************/ -/*****************************************************************************/ - -static void Rub_PutButtonToAddNewCriterion (struct Rub_Rubrics *Rubrics) - { - extern const char *Txt_Add_criteria; - - Frm_BeginForm (ActAddOneGamQst); - Rub_PutParams (Rubrics); - - Btn_PutConfirmButton (Txt_Add_criteria); - - Frm_EndForm (); - } - /*****************************************************************************/ /************************** Show stats about rubrics *************************/ /*****************************************************************************/ @@ -1246,8 +1010,6 @@ void Rub_GetAndShowRubricsStats (void) double NumRubricsPerCourse = 0.0; double NumCriteriaPerRubric = 0.0; - // Err_ShowErrorAndExit ("Rub_GetAndShowRubricsStats ()"); - /***** Get the number of rubrics from this location *****/ if ((NumRubrics = Rub_DB_GetNumRubrics (Gbl.Scope.Current))) { @@ -1294,151 +1056,3 @@ void Rub_GetAndShowRubricsStats (void) /***** End table and box *****/ Box_BoxTableEnd (); } - -/*****************************************************************************/ -/********************** Initialize a new citerion to zero ********************/ -/*****************************************************************************/ - -void Rub_CriterionConstructor (struct Rub_Criterion *Criterion) - { - Criterion->CriCod = -1L; - } - -/*****************************************************************************/ -/*************** Free memory allocated for rubric criterion ******************/ -/*****************************************************************************/ - -void Rub_CriterionDestructor (struct Rub_Criterion *Criterion) - { - Criterion->CriCod = -1L; - } - -/*****************************************************************************/ -/*********** Put parameter with criterion code to edit, remove... ************/ -/*****************************************************************************/ - -void Rub_PutParamCriCod (void *CriCod) // Should be a pointer to long - { - if (CriCod) - if (*((long *) CriCod) > 0) // If criterion exists - Par_PutHiddenParamLong (NULL,"CriCod",*((long *) CriCod)); - } - -/*****************************************************************************/ -/*************** Get data of a rubric criterion from database ****************/ -/*****************************************************************************/ - -bool Rub_GetCriterionDataFromDB (struct Rub_Criterion *Criterion) - { - MYSQL_RES *mysql_res; - MYSQL_ROW row; - bool CriterionExists; - - /***** Get question data from database *****/ - if ((CriterionExists = (Rub_DB_GetCriterionData (&mysql_res,Criterion->CriCod) != 0))) - { - row = mysql_fetch_row (mysql_res); - - /* Get the title (row[0]) */ - Criterion->Title[0] = '\0'; - if (row[0]) - if (row[0][0]) - Str_Copy (Criterion->Title,row[0],Cns_MAX_BYTES_TEXT); - } - - /* Free structure that stores the query result */ - DB_FreeMySQLResult (&mysql_res); - - return CriterionExists; - } - -/*****************************************************************************/ -/******************* List a rubric criterion for edition *********************/ -/*****************************************************************************/ - -void Rub_ListCriterionForEdition (struct Rub_Criterion *Criterion, - unsigned CriInd,bool CriterionExists, - const char *Anchor) - { - extern const char *Txt_Criterion_removed; - - /***** Number of criterion *****/ - HTM_TD_Begin ("class=\"RT %s\"",The_GetColorRows ()); - Rub_WriteNumCriterion (CriInd,"BIG_INDEX"); - HTM_TD_End (); - - /***** Write criterion code *****/ - HTM_TD_Begin ("class=\"CT DAT_SMALL_%s %s CT\"", - The_GetSuffix (),The_GetColorRows ()); - HTM_TxtF ("%ld ",Criterion->CriCod); - HTM_TD_End (); - - /***** Write title *****/ - HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ()); - HTM_ARTICLE_Begin (Anchor); - if (CriterionExists) - /* Write title */ - Rub_WriteCriterionTitle (Criterion->Title,"Qst_TXT", - true); // Visible - else - { - HTM_SPAN_Begin ("class=\"DAT_LIGHT_%s\"", - The_GetSuffix ()); - HTM_Txt (Txt_Criterion_removed); - HTM_SPAN_End (); - } - HTM_ARTICLE_End (); - HTM_TD_End (); - } - -/*****************************************************************************/ -/******************* Write the number of a rubric criterion ******************/ -/*****************************************************************************/ -// Number of criterion should be 1, 2, 3... - -void Rub_WriteNumCriterion (unsigned NumCri,const char *Class) - { - HTM_DIV_Begin ("class=\"%s_%s\"",Class,The_GetSuffix ()); - HTM_Unsigned (NumCri); - HTM_DIV_End (); - } - -/*****************************************************************************/ -/******************* Write the title of a rubric criterion *******************/ -/*****************************************************************************/ - -void Rub_WriteCriterionTitle (const char *Title,const char *ClassTitle,bool Visible) - { - unsigned long TitleLength; - char *TitleRigorousHTML; - - /***** DIV begin *****/ - HTM_DIV_Begin ("class=\"%s_%s\"",ClassTitle,The_GetSuffix ()); - - /***** Write title *****/ - if (Title && Visible) - { - if (Title[0]) - { - /* Convert the title, that is in HTML, to rigorous HTML */ - TitleLength = strlen (Title) * Str_MAX_BYTES_PER_CHAR; - if ((TitleRigorousHTML = malloc (TitleLength + 1)) == NULL) - Err_NotEnoughMemoryExit (); - Str_Copy (TitleRigorousHTML,Title,TitleLength); - - Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, - TitleRigorousHTML,TitleLength,false); - - /* Write title text */ - HTM_Txt (TitleRigorousHTML); - - /* Free memory allocated for the title */ - free (TitleRigorousHTML); - } - } - else - Ico_PutIconNotVisible (); - - /***** DIV end *****/ - HTM_DIV_End (); - } diff --git a/swad_rubric.h b/swad_rubric.h index 9cebae29..532a73b2 100644 --- a/swad_rubric.h +++ b/swad_rubric.h @@ -27,8 +27,7 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ -#include "swad_date.h" -#include "swad_scope.h" +#include "swad_string.h" /*****************************************************************************/ /************************** Public types and constants ***********************/ @@ -58,13 +57,6 @@ struct Rub_Rubrics struct Rub_Rubric Rubric; // Selected/current rubric }; -struct Rub_Criterion - { - long RubCod; // Rubric code - long CriCod; // Course code - char Title[Rub_MAX_BYTES_TITLE + 1]; - }; - /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ @@ -74,6 +66,7 @@ void Rub_ResetRubric (struct Rub_Rubric *Rubric); void Rub_SeeAllRubrics (void); void Rub_ListAllRubrics (struct Rub_Rubrics *Rubrics); +bool Rub_CheckIfICanEditRubrics (void); void Rub_SeeOneRubric (void); void Rub_ShowOnlyOneRubric (struct Rub_Rubrics *Rubrics, bool ListRubricDims); @@ -102,17 +95,6 @@ void Rub_RequestCreatOrEditRubric (void); void Rub_ReceiveFormRubric (void); -//------------------------------- Criteria ------------------------------------ -void Rub_CriterionConstructor (struct Rub_Criterion *Criterion); -void Rub_CriterionDestructor (struct Rub_Criterion *Criterion); -void Rub_PutParamCriCod (void *CriCod); -bool Rub_GetCriterionDataFromDB (struct Rub_Criterion *Criterion); -void Rub_ListCriterionForEdition (struct Rub_Criterion *Criterion, - unsigned CriInd,bool CriterionExists, - const char *Anchor); -void Rub_WriteNumCriterion (unsigned NumDim,const char *Class); -void Rub_WriteCriterionTitle (const char *Title,const char *ClassTitle,bool Visible); - //-------------------------------- Figures ------------------------------------ void Rub_GetAndShowRubricsStats (void); diff --git a/swad_rubric_criteria.c b/swad_rubric_criteria.c new file mode 100644 index 00000000..3ed176d7 --- /dev/null +++ b/swad_rubric_criteria.c @@ -0,0 +1,425 @@ +// swad_rubric_criteria.c: criteria in assessment rubrics +/* + SWAD (Shared Workspace At a Distance), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2022 Antonio Cañas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/********************************* Headers ***********************************/ +/*****************************************************************************/ + +#include // For boolean type +#include // To access MySQL databases +#include // For string functions + +#include "swad_action_list.h" +#include "swad_box.h" +#include "swad_button.h" +#include "swad_database.h" +#include "swad_error.h" +#include "swad_form.h" +#include "swad_parameter.h" +#include "swad_rubric.h" +#include "swad_rubric_criteria.h" +#include "swad_rubric_database.h" + +/*****************************************************************************/ +/************** External global variables from others modules ****************/ +/*****************************************************************************/ + +extern struct Globals Gbl; + +/*****************************************************************************/ +/***************************** Private prototypes ****************************/ +/*****************************************************************************/ + +static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics, + unsigned NumCriteria, + MYSQL_RES *mysql_res, + bool ICanEditCriteria); +static void RubCri_PutParamsOneCriterion (void *Rubrics); + +/*****************************************************************************/ +/********************** Initialize a new citerion to zero ********************/ +/*****************************************************************************/ + +void RubCri_CriterionConstructor (struct Rub_Criterion *Criterion) + { + Criterion->CriCod = -1L; + } + +/*****************************************************************************/ +/*************** Free memory allocated for rubric criterion ******************/ +/*****************************************************************************/ + +void RubCri_CriterionDestructor (struct Rub_Criterion *Criterion) + { + Criterion->CriCod = -1L; + } + +/*****************************************************************************/ +/*********** Put parameter with criterion code to edit, remove... ************/ +/*****************************************************************************/ + +void RubCri_PutParamCriCod (void *CriCod) // Should be a pointer to long + { + if (CriCod) + if (*((long *) CriCod) > 0) // If criterion exists + Par_PutHiddenParamLong (NULL,"CriCod",*((long *) CriCod)); + } + +/*****************************************************************************/ +/*************** Get data of a rubric criterion from database ****************/ +/*****************************************************************************/ + +bool RubCri_GetCriterionDataFromDB (struct Rub_Criterion *Criterion) + { + MYSQL_RES *mysql_res; + MYSQL_ROW row; + bool CriterionExists; + + /***** Get question data from database *****/ + if ((CriterionExists = (Rub_DB_GetCriterionData (&mysql_res,Criterion->CriCod) != 0))) + { + row = mysql_fetch_row (mysql_res); + + /* Get the title (row[0]) */ + Criterion->Title[0] = '\0'; + if (row[0]) + if (row[0][0]) + Str_Copy (Criterion->Title,row[0],Cns_MAX_BYTES_TEXT); + } + + /* Free structure that stores the query result */ + DB_FreeMySQLResult (&mysql_res); + + return CriterionExists; + } + +/*****************************************************************************/ +/******************* List a rubric criterion for edition *********************/ +/*****************************************************************************/ + +void RubCri_ListCriterionForEdition (struct Rub_Criterion *Criterion, + unsigned CriInd,bool CriterionExists, + const char *Anchor) + { + extern const char *Txt_Criterion_removed; + + /***** Number of criterion *****/ + HTM_TD_Begin ("class=\"RT %s\"",The_GetColorRows ()); + RubCri_WriteNumCriterion (CriInd,"BIG_INDEX"); + HTM_TD_End (); + + /***** Write criterion code *****/ + HTM_TD_Begin ("class=\"CT DAT_SMALL_%s %s CT\"", + The_GetSuffix (),The_GetColorRows ()); + HTM_TxtF ("%ld ",Criterion->CriCod); + HTM_TD_End (); + + /***** Write title *****/ + HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ()); + HTM_ARTICLE_Begin (Anchor); + if (CriterionExists) + /* Write title */ + RubCri_WriteCriterionTitle (Criterion->Title,"Qst_TXT", + true); // Visible + else + { + HTM_SPAN_Begin ("class=\"DAT_LIGHT_%s\"", + The_GetSuffix ()); + HTM_Txt (Txt_Criterion_removed); + HTM_SPAN_End (); + } + HTM_ARTICLE_End (); + HTM_TD_End (); + } + +/*****************************************************************************/ +/******************* Write the number of a rubric criterion ******************/ +/*****************************************************************************/ +// Number of criterion should be 1, 2, 3... + +void RubCri_WriteNumCriterion (unsigned NumCri,const char *Class) + { + HTM_DIV_Begin ("class=\"%s_%s\"",Class,The_GetSuffix ()); + HTM_Unsigned (NumCri); + HTM_DIV_End (); + } + +/*****************************************************************************/ +/******************* Write the title of a rubric criterion *******************/ +/*****************************************************************************/ + +void RubCri_WriteCriterionTitle (const char *Title,const char *ClassTitle,bool Visible) + { + unsigned long TitleLength; + char *TitleRigorousHTML; + + /***** DIV begin *****/ + HTM_DIV_Begin ("class=\"%s_%s\"",ClassTitle,The_GetSuffix ()); + + /***** Write title *****/ + if (Title && Visible) + { + if (Title[0]) + { + /* Convert the title, that is in HTML, to rigorous HTML */ + TitleLength = strlen (Title) * Str_MAX_BYTES_PER_CHAR; + if ((TitleRigorousHTML = malloc (TitleLength + 1)) == NULL) + Err_NotEnoughMemoryExit (); + Str_Copy (TitleRigorousHTML,Title,TitleLength); + + Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, + TitleRigorousHTML,TitleLength,false); + + /* Write title text */ + HTM_Txt (TitleRigorousHTML); + + /* Free memory allocated for the title */ + free (TitleRigorousHTML); + } + } + else + Ico_PutIconNotVisible (); + + /***** DIV end *****/ + HTM_DIV_End (); + } + +/*****************************************************************************/ +/***************** Put icon to add a new criterion to rubric *****************/ +/*****************************************************************************/ + +void RubCri_PutIconToAddNewCriterion (void *Rubrics) + { + Ico_PutContextualIconToAdd (ActAddOneGamQst,NULL,Rub_PutParams,Rubrics); + } + +/*****************************************************************************/ +/***************** Put button to add new criteria to rubric ******************/ +/*****************************************************************************/ + +void RubCri_PutButtonToAddNewCriterion (struct Rub_Rubrics *Rubrics) + { + extern const char *Txt_Add_criteria; + + Frm_BeginForm (ActAddOneGamQst); + Rub_PutParams (Rubrics); + + Btn_PutConfirmButton (Txt_Add_criteria); + + Frm_EndForm (); + } + +/*****************************************************************************/ +/****************** Write parameter with index of criterion ******************/ +/*****************************************************************************/ + +void RubCri_PutParamCriInd (unsigned CriInd) + { + Par_PutHiddenParamUnsigned (NULL,"CriInd",CriInd); + } + +/*****************************************************************************/ +/******************* Get parameter with index of criterion *******************/ +/*****************************************************************************/ + +unsigned RubCri_GetParamCriInd (void) + { + long CriInd; + + if ((CriInd = Par_GetParToLong ("CriInd")) <= 0) // In rubrics, criterion index should be 1, 2, 3... + Err_WrongCriterionIndexExit (); + + return (unsigned) CriInd; + } + +/*****************************************************************************/ +/*********************** List the criteria of a rubric ***********************/ +/*****************************************************************************/ + +void RubCri_ListRubricCriteria (struct Rub_Rubrics *Rubrics) + { + extern const char *Hlp_ASSESSMENT_Rubrics_criteria; + extern const char *Txt_Criteria; + MYSQL_RES *mysql_res; + unsigned NumCriteria; + bool ICanEditCriteria = Rub_CheckIfICanEditRubrics (); + + /***** Get data of criteria from database *****/ + NumCriteria = Rub_DB_GetRubricCriteriaBasic (&mysql_res,Rubrics->Rubric.RubCod); + + /***** Begin box *****/ + if (ICanEditCriteria) + Box_BoxBegin (NULL,Txt_Criteria, + RubCri_PutIconToAddNewCriterion,Rubrics, + Hlp_ASSESSMENT_Rubrics_criteria,Box_NOT_CLOSABLE); + else + Box_BoxBegin (NULL,Txt_Criteria, + NULL,NULL, + Hlp_ASSESSMENT_Rubrics_criteria,Box_NOT_CLOSABLE); + + /***** Show table with criteria *****/ + if (NumCriteria) + RubCri_ListOneOrMoreCriteriaForEdition (Rubrics,NumCriteria,mysql_res, + ICanEditCriteria); + + /***** Put button to add a new criterion in this rubric *****/ + if (ICanEditCriteria) // I can edit criteria + RubCri_PutButtonToAddNewCriterion (Rubrics); + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + + /***** End box *****/ + Box_BoxEnd (); + } + +/*****************************************************************************/ +/********************* List rubric criteria for edition **********************/ +/*****************************************************************************/ + +static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics, + unsigned NumCriteria, + MYSQL_RES *mysql_res, + bool ICanEditCriteria) + { + extern const char *Txt_Criteria; + extern const char *Txt_No_INDEX; + extern const char *Txt_Code; + extern const char *Txt_Tags; + extern const char *Txt_Criterion; + extern const char *Txt_Movement_not_allowed; + unsigned NumCri; + unsigned CriInd; + unsigned MaxCriInd; + MYSQL_ROW row; + struct Rub_Criterion Criterion; + char StrCriInd[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; + bool CriterionExists; + char *Anchor = NULL; + + /***** Trivial check *****/ + if (!NumCriteria) + return; + + /***** Get maximum criterion index *****/ + MaxCriInd = Rub_DB_GetMaxCriterionIndexInRubric (Rubrics->Rubric.RubCod); // 0 is no criteria in rubric + + /***** Write the heading *****/ + HTM_TABLE_BeginWideMarginPadding (5); + + HTM_TR_Begin (NULL); + HTM_TH_Empty (1); + HTM_TH (Txt_No_INDEX ,HTM_HEAD_CENTER); + HTM_TH (Txt_Code ,HTM_HEAD_CENTER); + HTM_TH (Txt_Tags ,HTM_HEAD_CENTER); + HTM_TH (Txt_Criterion,HTM_HEAD_CENTER); + HTM_TR_End (); + + /***** Write rows *****/ + for (NumCri = 0, The_ResetRowColor (); + NumCri < NumCriteria; + NumCri++, The_ChangeRowColor ()) + { + /***** Create rubric criterion *****/ + RubCri_CriterionConstructor (&Criterion); + + /***** Get criterion data *****/ + row = mysql_fetch_row (mysql_res); + /* + row[0] QstCod + row[1] QstInd + */ + /* Get criterion code (row[0]) */ + Criterion.CriCod = Str_ConvertStrCodToLongCod (row[0]); + + /* Get criterion index (row[1]) */ + CriInd = Str_ConvertStrToUnsigned (row[1]); + snprintf (StrCriInd,sizeof (StrCriInd),"%u",CriInd); + + /***** Build anchor string *****/ + Frm_SetAnchorStr (Criterion.CriCod,&Anchor); + + /***** Begin row *****/ + HTM_TR_Begin (NULL); + + /***** Icons *****/ + HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ()); + + /* Put icon to remove the criterion */ + if (ICanEditCriteria) + Ico_PutContextualIconToRemove (ActReqRemGamQst,NULL, + RubCri_PutParamsOneCriterion,Rubrics); + else + Ico_PutIconRemovalNotAllowed (); + + /* Put icon to move up the criterion */ + if (ICanEditCriteria && CriInd > 1) + Lay_PutContextualLinkOnlyIcon (ActUp_GamQst,Anchor, + RubCri_PutParamsOneCriterion,Rubrics, + "arrow-up.svg",Ico_BLACK); + else + Ico_PutIconOff ("arrow-up.svg",Ico_BLACK, + Txt_Movement_not_allowed); + + /* Put icon to move down the criterion */ + if (ICanEditCriteria && CriInd < MaxCriInd) + Lay_PutContextualLinkOnlyIcon (ActDwnGamQst,Anchor, + RubCri_PutParamsOneCriterion,Rubrics, + "arrow-down.svg",Ico_BLACK); + else + Ico_PutIconOff ("arrow-down.svg",Ico_BLACK, + Txt_Movement_not_allowed); + + /* Put icon to edit the criterion */ + if (ICanEditCriteria) + Ico_PutContextualIconToEdit (ActEdiOneTstQst,NULL, + RubCri_PutParamCriCod,&Criterion.CriCod); + + HTM_TD_End (); + + /***** Criterion *****/ + CriterionExists = RubCri_GetCriterionDataFromDB (&Criterion); + RubCri_ListCriterionForEdition (&Criterion,CriInd,CriterionExists,Anchor); + + /***** End row *****/ + HTM_TR_End (); + + /***** Free anchor string *****/ + Frm_FreeAnchorStr (Anchor); + + /***** Destroy rubric criterion *****/ + RubCri_CriterionDestructor (&Criterion); + } + + /***** End table *****/ + HTM_TABLE_End (); + } + +/*****************************************************************************/ +/**************** Put parameter to move/remove one criterion *****************/ +/*****************************************************************************/ + +static void RubCri_PutParamsOneCriterion (void *Rubrics) + { + if (Rubrics) + Rub_PutParams (Rubrics); + } diff --git a/swad_rubric_criteria.h b/swad_rubric_criteria.h new file mode 100644 index 00000000..b75584b3 --- /dev/null +++ b/swad_rubric_criteria.h @@ -0,0 +1,67 @@ +// swad_rubric_criteria.h: criteria in assessment rubrics + +#ifndef _SWAD_RUB_CRI +#define _SWAD_RUB_CRI +/* + SWAD (Shared Workspace At a Distance in Spanish), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2022 Antonio Cañas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/************************** Public types and constants ***********************/ +/*****************************************************************************/ + +#define Rub_MAX_CHARS_CRITERION_TITLE (128 - 1) // 127 +#define Rub_MAX_BYTES_CRITERION_TITLE ((Rub_MAX_CHARS_CRITERION_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 + +#define Rub_AFTER_LAST_CRITERION ((unsigned)((1UL << 31) - 1)) // 2^31 - 1, don't change this number because it is used in database + +struct Rub_Criterion + { + long RubCod; // Rubric code + long CriCod; // Course code + char Title[Rub_MAX_BYTES_CRITERION_TITLE + 1]; + }; + +/*****************************************************************************/ +/***************************** Public prototypes *****************************/ +/*****************************************************************************/ + +void RubCri_CriterionConstructor (struct Rub_Criterion *Criterion); +void RubCri_CriterionDestructor (struct Rub_Criterion *Criterion); + +void RubCri_PutParamCriCod (void *CriCod); + +bool RubCri_GetCriterionDataFromDB (struct Rub_Criterion *Criterion); + +void RubCri_ListCriterionForEdition (struct Rub_Criterion *Criterion, + unsigned CriInd,bool CriterionExists, + const char *Anchor); +void RubCri_WriteNumCriterion (unsigned NumDim,const char *Class); +void RubCri_WriteCriterionTitle (const char *Title,const char *ClassTitle,bool Visible); + +void RubCri_PutIconToAddNewCriterion (void *Rubrics); +void RubCri_PutButtonToAddNewCriterion (struct Rub_Rubrics *Rubrics); + +void RubCri_PutParamCriInd (unsigned CriInd); +unsigned RubCri_GetParamCriInd (void); + +void RubCri_ListRubricCriteria (struct Rub_Rubrics *Rubrics); + +#endif diff --git a/swad_survey.c b/swad_survey.c index 57e8b08a..4e247293 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -197,7 +197,7 @@ void Svy_ListAllSurveys (struct Svy_Surveys *Surveys) extern const char *Txt_No_surveys; Dat_StartEndTime_t Order; Grp_WhichGroups_t WhichGroups; - struct Pagination Pagination; + struct Pag_Pagination Pagination; unsigned NumSvy; /***** Get number of groups in current course *****/ diff --git a/swad_text.c b/swad_text.c index 043e6105..ec5bed9e 100644 --- a/swad_text.c +++ b/swad_text.c @@ -10650,7 +10650,7 @@ const char *Txt_Do_you_really_want_to_remove_the_game_X = // Warning: it is very #elif L==9 // pt "Você realmente deseja remover o jogo %s?"; #elif L==10 // tr - "Do you really want to remove the game %s?"; // Çeviri lazim! + "%s oyununu gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_group_X = // Warning: it is very important to include %s in the following sentences @@ -10673,7 +10673,7 @@ const char *Txt_Do_you_really_want_to_remove_the_group_X = // Warning: it is ver #elif L==9 // pt "Você realmente quer remover o grupo %s?"; #elif L==10 // tr - "Do you really want to remove the group %s?"; // Çeviri lazim! + "%s grubunu gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_group_X_1_student_ = // Warning: it is very important to include %s in the following sentences @@ -10762,7 +10762,7 @@ const char *Txt_Do_you_really_want_to_remove_the_item_X = // Warning: it is very #elif L==9 // pt "Você realmente deseja remover o item %s?"; #elif L==10 // tr - "Do you really want to remove the item %s?"; // Çeviri lazim! + "%s öğesini gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_match_X = // Warning: it is very important to include %s in the following sentences @@ -10785,7 +10785,7 @@ const char *Txt_Do_you_really_want_to_remove_the_match_X = // Warning: it is ver #elif L==9 // pt "Você realmente deseja remover o jogo %s?"; #elif L==10 // tr - "Do you really want to remove the match %s?"; // Çeviri lazim! + "%s eşleşmesini gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_photo_of_X = // Warning: it is very important to include %s in the following sentences @@ -10831,7 +10831,7 @@ const char *Txt_Do_you_really_want_to_remove_the_project_X = // Warning: it is v #elif L==9 // pt "Você realmente deseja remover o projeto %s?"; #elif L==10 // tr - "Do you really want to remove the project %s?"; // Çeviri lazim! + "%s projesini gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_question_X = // Warning: it is very important to include %ld in the following sentences @@ -10854,7 +10854,7 @@ const char *Txt_Do_you_really_want_to_remove_the_question_X = // Warning: it is #elif L==9 // pt "Você realmente deseja remover a pergunta %ld?"; #elif L==10 // tr - "Do you really want to remove the question %ld?"; // Çeviri lazim! + "%ld sorusunu gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_resource_X = // Warning: it is very important to include %s in the following sentences @@ -10880,6 +10880,29 @@ const char *Txt_Do_you_really_want_to_remove_the_resource_X = // Warning: it is "%s kaynağını gerçekten kaldırmak istiyor musunuz?"; #endif +const char *Txt_Do_you_really_want_to_remove_the_rubric_X = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "Realment voleu eliminar la rúbrica %s?"; +#elif L==2 // de + "Wollen Sie die Rubrik %s wirklich entfernen?"; +#elif L==3 // en + "Do you really want to remove the rubric %s?"; +#elif L==4 // es + "¿Realmente desea eliminar la rúbrica %s?"; +#elif L==5 // fr + "Voulez-vous vraiment supprimer la rubrique %s?"; +#elif L==6 // gn + "¿Realmente desea eliminar la rúbrica %s?"; // Okoteve traducción +#elif L==7 // it + "Vuoi realmente rimuovere la rubrica %s?"; +#elif L==8 // pl + "Czy na pewno chcesz usunąć rubrykę %s?"; +#elif L==9 // pt + "Você realmente deseja remover a rubrica %s?"; +#elif L==10 // tr + "%s değerlendirme tablosunu gerçekten kaldırmak istiyor musunuz?"; +#endif + const char *Txt_Do_you_really_want_to_remove_the_selected_questions = #if L==1 // ca "Realment voleu eliminar les preguntes seleccionades?"; @@ -10923,7 +10946,7 @@ const char *Txt_Do_you_really_want_to_remove_the_session_X = // Warning: it is v #elif L==9 // pt "Você realmente deseja remover a sessão %s?"; #elif L==10 // tr - "Do you really want to remove the session %s?"; // Çeviri lazim! + "%s oturumunu gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_set_of_questions_X = // Warning: it is very important to include %s in the following sentences @@ -10946,7 +10969,7 @@ const char *Txt_Do_you_really_want_to_remove_the_set_of_questions_X = // Warning #elif L==9 // pt "Você realmente deseja remover o conjunto de perguntas %s?"; #elif L==10 // tr - "Do you really want to remove the set of questions %s?"; // Çeviri lazim! + "%s soru grubunu gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_survey_X = // Warning: it is very important to include %s in the following sentences @@ -10969,7 +10992,7 @@ const char *Txt_Do_you_really_want_to_remove_the_survey_X = // Warning: it is ve #elif L==9 // pt "Você realmente deseja remover o inquérito %s?"; #elif L==10 // tr - "Do you really want to remove the survey %s?"; // Çeviri lazim! + "%s anketini gerçekten kaldırmak istiyor musunuz?"; #endif const char *Txt_Do_you_really_want_to_remove_the_type_of_group_X_1_group_ = // Warning: it is very important to include %s in the following sentences @@ -35009,14 +35032,14 @@ const char *Txt_Remove_assignment = #elif L==9 // pt "Remover atividade"; #elif L==10 // tr - "Remove assignment"; // Çeviri lazim! + "Atamayı kaldır"; #endif const char *Txt_Remove_event = #if L==1 // ca "Eliminar esdeveniment"; #elif L==2 // de - "Ereignis Entfernen"; + "Ereignis entfernen"; #elif L==3 // en "Remove event"; #elif L==4 // es @@ -35032,14 +35055,14 @@ const char *Txt_Remove_event = #elif L==9 // pt "Remover evento"; #elif L==10 // tr - "Remove event"; // Çeviri lazim! + "Etkinliği kaldır"; #endif const char *Txt_Remove_exam = #if L==1 // ca "Eliminar examen"; #elif L==2 // de - "Ereignis Prüfung"; + "Prüfung entfernen"; #elif L==3 // en "Remove exam"; #elif L==4 // es @@ -35055,14 +35078,14 @@ const char *Txt_Remove_exam = #elif L==9 // pt "Remover exame"; #elif L==10 // tr - "Remove exam"; // Çeviri lazim! + "Sınavı kaldır"; #endif const char *Txt_Remove_file = #if L==1 // ca "Eliminar fitxer"; #elif L==2 // de - "Datei Entfernen"; + "Datei entfernen"; #elif L==3 // en "Remove file"; #elif L==4 // es @@ -35078,7 +35101,7 @@ const char *Txt_Remove_file = #elif L==9 // pt "Remover arquivo"; #elif L==10 // tr - "Remove file"; // Çeviri lazim! + "Dosyayı kaldır"; #endif const char *Txt_Remove_files_older_than_PART_1_OF_2 = @@ -35147,14 +35170,14 @@ const char *Txt_Remove_folder = #elif L==9 // pt "Remover diretório"; #elif L==10 // tr - "Remove folder"; // Çeviri lazim! + "Klasörü kaldır"; #endif const char *Txt_Remove_game = #if L==1 // ca "Eliminar joc"; #elif L==2 // de - "Entfernen Spiel"; + "Spiel entfernen"; #elif L==3 // en "Remove game"; #elif L==4 // es @@ -35170,14 +35193,14 @@ const char *Txt_Remove_game = #elif L==9 // pt "Remover jogo"; #elif L==10 // tr - "Remove folder"; // Çeviri lazim! + "Oyunu kaldır"; #endif const char *Txt_Remove_group = #if L==1 // ca "Eliminar grup"; #elif L==2 // de - "Entfernen Gruppe"; + "Gruppe entfernen"; #elif L==3 // en "Remove group"; #elif L==4 // es @@ -35193,14 +35216,14 @@ const char *Txt_Remove_group = #elif L==9 // pt "Remover grupo"; #elif L==10 // tr - "Remove group"; // Çeviri lazim! + "Grubu kaldır"; #endif const char *Txt_Remove_item = #if L==1 // ca "Eliminar ítem"; #elif L==2 // de - "Entfernen Artikel"; + "Artikel entfernen"; #elif L==3 // en "Remove item"; #elif L==4 // es @@ -35216,14 +35239,14 @@ const char *Txt_Remove_item = #elif L==9 // pt "Remover item"; #elif L==10 // tr - "Remove item"; // Çeviri lazim! + "Öğeyi kaldır"; #endif const char *Txt_Remove_link = #if L==1 // ca "Eliminar enllaç"; #elif L==2 // de - "Entfernen Link"; + "Link entfernen"; #elif L==3 // en "Remove link"; #elif L==4 // es @@ -35239,14 +35262,14 @@ const char *Txt_Remove_link = #elif L==9 // pt "Remover ligação"; #elif L==10 // tr - "Remove link"; // Çeviri lazim! + "Bağlantıyı kaldır"; #endif const char *Txt_Remove_match = // of a game #if L==1 // ca "Eliminar partida"; #elif L==2 // de - "Entfernen Spiel"; + "Spiel entfernen"; #elif L==3 // en "Remove match"; #elif L==4 // es @@ -35262,7 +35285,7 @@ const char *Txt_Remove_match = // of a game #elif L==9 // pt "Remover jogo"; #elif L==10 // tr - "Remove match"; // Çeviri lazim! + "Eşleşmeyi kaldır"; #endif const char *Txt_Remove_me = @@ -35460,7 +35483,7 @@ const char *Txt_Remove_old_files = #if L==1 // ca "Eliminar arxius antics"; #elif L==2 // de - "Entfernen Sie alte Dateien"; + "Sie alte Dateien entfernen"; #elif L==3 // en "Remove old files"; #elif L==4 // es @@ -35483,7 +35506,7 @@ const char *Txt_Remove_photo = #if L==1 // ca "Eliminar foto"; #elif L==2 // de - "Entfernen Foto"; + "Foto entfernen"; #elif L==3 // en "Remove photo"; #elif L==4 // es @@ -35499,14 +35522,14 @@ const char *Txt_Remove_photo = #elif L==9 // pt "Remover foto"; #elif L==10 // tr - "Remove photo"; // Çeviri lazim! + "Fotoğrafı kaldır"; #endif const char *Txt_Remove_project = #if L==1 // ca "Eliminar projecte"; #elif L==2 // de - "Entfernen Projekt"; + "Projekt entfernen"; #elif L==3 // en "Remove project"; #elif L==4 // es @@ -35522,7 +35545,7 @@ const char *Txt_Remove_project = #elif L==9 // pt "Remover projeto"; #elif L==10 // tr - "Remove project"; // Çeviri lazim! + "Projeyi kaldır"; #endif const char *Txt_Remove_question = @@ -35545,7 +35568,7 @@ const char *Txt_Remove_question = #elif L==9 // pt "Remover pergunta"; #elif L==10 // tr - "Remove question"; // Çeviri lazim! + "Soruyu kaldır"; #endif const char *Txt_Remove_questions = @@ -35568,14 +35591,14 @@ const char *Txt_Remove_questions = #elif L==9 // pt "Remover perguntas"; #elif L==10 // tr - "Remove questions"; // Çeviri lazim! + "Soruları kaldır"; #endif const char *Txt_Remove_record_field = #if L==1 // ca "Eliminar camp de fitxa"; #elif L==2 // de - "Entfernen Datenfeld"; + "Datenfeld entfernen"; #elif L==3 // en "Remove record field"; #elif L==4 // es @@ -35591,14 +35614,14 @@ const char *Txt_Remove_record_field = #elif L==9 // pt "Remover campo de cartão"; #elif L==10 // tr - "Remove record field"; // Çeviri lazim! + "Kayıt alanını kaldır"; #endif const char *Txt_Remove_resource = #if L==1 // ca "Eliminar recurs"; #elif L==2 // de - "Entfernen Ressource"; + "Ressource entfernen"; #elif L==3 // en "Remove resource"; #elif L==4 // es @@ -35614,14 +35637,37 @@ const char *Txt_Remove_resource = #elif L==9 // pt "Remover recurso"; #elif L==10 // tr - "Kaynağı kaynak"; + "Kaynağı kaldır"; +#endif + +const char *Txt_Remove_rubric = +#if L==1 // ca + "Eliminar rúbrica"; +#elif L==2 // de + "Rubrik entfernen"; +#elif L==3 // en + "Remove rubric"; +#elif L==4 // es + "Eliminar rúbrica"; +#elif L==5 // fr + "Supprimer rubrique"; +#elif L==6 // gn + "Eliminar rúbrica"; // Okoteve traducción +#elif L==7 // it + "Rimuovere rubrica"; +#elif L==8 // pl + "Usuń rubrykę"; +#elif L==9 // pt + "Remover rubrica"; +#elif L==10 // tr + "Puan anahtarını kaldır"; #endif const char *Txt_Remove_session = #if L==1 // ca "Eliminar sessió"; #elif L==2 // de - "Entfernen Sitzung"; + "Sitzung entfernen"; #elif L==3 // en "Remove session"; #elif L==4 // es @@ -35637,14 +35683,14 @@ const char *Txt_Remove_session = #elif L==9 // pt "Remover sessão"; #elif L==10 // tr - "Remove session"; // Çeviri lazim! + "Oturumu kaldır"; #endif const char *Txt_Remove_set_of_questions = #if L==1 // ca "Eliminar conjunt de preguntes"; #elif L==2 // de - "Entfernen Satz von Fragen"; + "Satz von Fragen entfernen"; #elif L==3 // en "Remove set of questions"; #elif L==4 // es @@ -35660,14 +35706,14 @@ const char *Txt_Remove_set_of_questions = #elif L==9 // pt "Remover conjunto de perguntas"; #elif L==10 // tr - "Remove set of questions"; // Çeviri lazim! + "Soru grubunu kaldır"; #endif const char *Txt_Remove_survey = #if L==1 // ca "Eliminar enquesta"; #elif L==2 // de - "Entfernen Umfrage"; + "Umfrage entfernen"; #elif L==3 // en "Remove survey"; #elif L==4 // es @@ -35683,14 +35729,14 @@ const char *Txt_Remove_survey = #elif L==9 // pt "Remover inquérito"; #elif L==10 // tr - "Remove survey"; // Çeviri lazim! + "Anketi kaldır"; #endif const char *Txt_Remove_thread = #if L==1 // ca "Eliminar discussió"; #elif L==2 // de - "Entfernen Thread"; + "Thread entfernen"; #elif L==3 // en "Remove thread"; #elif L==4 // es @@ -35706,7 +35752,7 @@ const char *Txt_Remove_thread = #elif L==9 // pt "Remover discussão"; #elif L==10 // tr - "Remove thread"; // Çeviri lazim! + "İpliği kaldır"; #endif const char *Txt_Remove_the_users_not_indicated_in_step_1 = @@ -35775,7 +35821,7 @@ const char *Txt_Remove_type_of_group = #elif L==9 // pt "Remover tipo de grupo"; #elif L==10 // tr - "Remove type of group"; // Çeviri lazim! + "Grup türünü kaldır"; #endif const char *Txt_Remove_user_from_this_course = @@ -35989,7 +36035,7 @@ const char *Txt_Reply_message = // "Reply" as a noun, not as a verb #elif L==9 // pt "Mensagem de resposta"; #elif L==10 // tr - "Reply message"; // Çeviri lazim! + "Mesajı yanıtla"; #endif const char *Txt_Report =