diff --git a/swad_changelog.h b/swad_changelog.h index 588d69e3..5ff66ae8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -629,10 +629,18 @@ 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.81 (2023-03-26)" +#define Log_PLATFORM_VERSION "SWAD 22.81.1 (2023-03-26)" #define CSS_FILE "swad22.78.15.css" #define JS_FILE "swad22.49.js" /* + Version 22.81.1: Mar 26, 2023 Changes in resources. (338012 lines) + 5 changes necessary in database: +ALTER TABLE prg_clipboards CHANGE COLUMN Type Type ENUM('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') NOT NULL DEFAULT 'non'; +ALTER TABLE prg_resources CHANGE COLUMN Type Type ENUM('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') NOT NULL DEFAULT 'non'; +ALTER TABLE rub_criteria ADD COLUMN Type ENUM('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') NOT NULL DEFAULT 'non' AFTER CriInd; +ALTER TABLE rub_criteria DROP INDEX Source; +ALTER TABLE rub_criteria DROP COLUMN Source; + Version 22.81: Mar 26, 2023 New module swad_resource. (337946 lines) Version 22.80: Mar 25, 2023 Resources in rubric criteria. Not finished. (338110 lines) Version 22.79.3: Mar 24, 2023 Translation of some actions. (337938 lines) diff --git a/swad_database.c b/swad_database.c index db18a8ac..425d1088 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2474,32 +2474,21 @@ mysql> DESCRIBE plg_plugins; /***** Table prg_clipboards *****/ /* mysql> DESCRIBE prg_clipboards; -+----------+-------------------------------------------------------------------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+----------+-------------------------------------------------------------------------+------+-----+---------+-------+ -| UsrCod | int | NO | PRI | NULL | | -| CrsCod | int | NO | PRI | NULL | | -| Type | enum('non','asg','prj','cfe','exa','gam','svy','doc','mrk','att','for') | NO | PRI | non | | -| Cod | int | NO | PRI | -1 | | -| CopyTime | timestamp | YES | MUL | NULL | | -+----------+-------------------------------------------------------------------------+------+-----+---------+-------+ ++----------+-------------------------------------------------------------------------------------------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++----------+-------------------------------------------------------------------------------------------+------+-----+---------+-------+ +| UsrCod | int | NO | PRI | NULL | | +| CrsCod | int | NO | PRI | NULL | | +| Type | enum('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') | NO | PRI | non | | +| Cod | int | NO | PRI | -1 | | +| CopyTime | timestamp | YES | MUL | NULL | | ++----------+-------------------------------------------------------------------------------------------+------+-----+---------+-------+ 5 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS prg_clipboards (" "UsrCod INT NOT NULL," "CrsCod INT NOT NULL," - "Type ENUM(" - "'non'," - "'asg'," - "'prj'," - "'cfe'," - "'exa'," - "'gam'," - "'svy'," - "'doc'," - "'mrk'," - "'att'," - "'for') NOT NULL DEFAULT 'non'," + "Type ENUM('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') NOT NULL DEFAULT 'non'," "Cod INT NOT NULL DEFAULT -1," "CopyTime TIMESTAMP," "UNIQUE INDEX(UsrCod,CrsCod,Type,Cod)," @@ -2563,17 +2552,17 @@ mysql> DESCRIBE prg_items; /***** Table prg_resources *****/ /* mysql> DESCRIBE prg_resources; -+--------+-------------------------------------------------------------------------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+--------+-------------------------------------------------------------------------+------+-----+---------+----------------+ -| RscCod | int | NO | PRI | NULL | auto_increment | -| ItmCod | int | NO | MUL | -1 | | -| RscInd | int | NO | | 0 | | -| Hidden | enum('N','Y') | NO | | N | | -| Type | enum('non','asg','prj','cfe','exa','gam','svy','doc','mrk','att','for') | NO | | non | | -| Cod | int | NO | | -1 | | -| Title | varchar(2047) | NO | | NULL | | -+--------+-------------------------------------------------------------------------+------+-----+---------+----------------+ ++--------+-------------------------------------------------------------------------------------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++--------+-------------------------------------------------------------------------------------------+------+-----+---------+----------------+ +| RscCod | int | NO | PRI | NULL | auto_increment | +| ItmCod | int | NO | MUL | -1 | | +| RscInd | int | NO | | 0 | | +| Hidden | enum('N','Y') | NO | | N | | +| Type | enum('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') | NO | | non | | +| Cod | int | NO | | -1 | | +| Title | varchar(2047) | NO | | NULL | | ++--------+-------------------------------------------------------------------------------------------+------+-----+---------+----------------+ 7 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS prg_resources (" @@ -2581,18 +2570,7 @@ mysql> DESCRIBE prg_resources; "ItmCod INT NOT NULL DEFAULT -1," "RscInd INT NOT NULL DEFAULT 0," "Hidden ENUM('N','Y') NOT NULL DEFAULT 'N'," - "Type ENUM(" - "'non'," - "'asg'," - "'prj'," - "'cfe'," - "'exa'," - "'gam'," - "'svy'," - "'doc'," - "'mrk'," - "'att'," - "'for') NOT NULL DEFAULT 'non'," + "Type ENUM('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') NOT NULL DEFAULT 'non'," "Title VARCHAR(2047) NOT NULL," // Rsc_MAX_BYTES_RESOURCE_TITLE "UNIQUE INDEX(RscCod)," "UNIQUE INDEX(ItmCod,RscInd))"); @@ -2801,34 +2779,33 @@ mysql> DESCRIBE roo_check_in; /***** Table rub_criteria *****/ /* mysql> DESCRIBE rub_criteria; -+--------+----------------------------------------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+--------+----------------------------------------+------+-----+---------+----------------+ -| CriCod | int | NO | PRI | NULL | auto_increment | -| RubCod | int | NO | MUL | NULL | | -| CriInd | int | NO | | NULL | | -| Source | enum('teacher','rubric','exam','game') | NO | MUL | teacher | | -| Cod | int | NO | | -1 | | -| MinVal | double | NO | | 0 | | -| MaxVal | double | NO | | 1 | | -| Weight | double | NO | | 1 | | -| Title | varchar(2047) | NO | | NULL | | -+--------+----------------------------------------+------+-----+---------+----------------+ ++--------+-------------------------------------------------------------------------------------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++--------+-------------------------------------------------------------------------------------------+------+-----+---------+----------------+ +| CriCod | int | NO | PRI | NULL | auto_increment | +| RubCod | int | NO | MUL | NULL | | +| CriInd | int | NO | | NULL | | +| Type | enum('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy') | NO | | non | | +| Cod | int | NO | | -1 | | +| MinVal | double | NO | | 0 | | +| MaxVal | double | NO | | 1 | | +| Weight | double | NO | | 1 | | +| Title | varchar(2047) | NO | | NULL | | ++--------+-------------------------------------------------------------------------------------------+------+-----+---------+----------------+ 9 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS rub_criteria (" "CriCod INT NOT NULL AUTO_INCREMENT," "RubCod INT NOT NULL," "CriInd INT NOT NULL," - "Source ENUM('teacher','rubric','exam','game') NOT NULL DEFAULT 'teacher'," + "Type ENUM('non','asg','prj','cfe','exa','ses','gam','mch','rub','doc','mrk','att','for','svy')," "Cod INT NOT NULL DEFAULT -1," "MinVal DOUBLE PRECISION NOT NULL DEFAULT 0," "MaxVal DOUBLE PRECISION NOT NULL DEFAULT 1," "Weight DOUBLE PRECISION NOT NULL DEFAULT 1," "Title VARCHAR(2047) NOT NULL," "UNIQUE INDEX(CriCod)," - "UNIQUE INDEX(RubCod,CriInd)," - "INDEX(Source,Cod))"); + "UNIQUE INDEX(RubCod,CriInd))"); /***** Table rub_rubrics *****/ /* diff --git a/swad_program_database.c b/swad_program_database.c index 52199497..1bf139a5 100644 --- a/swad_program_database.c +++ b/swad_program_database.c @@ -30,32 +30,6 @@ #include "swad_program.h" #include "swad_program_resource.h" -/*****************************************************************************/ -/**************************** Private constants ******************************/ -/*****************************************************************************/ - -const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES] = - { - [Rsc_NONE ] = "non", - // gui TEACHING_GUIDE // Link to teaching guide - // bib BIBLIOGRAPHY // Link to bibliography - // faq FAQ // Link to FAQ - // lnk LINKS // Link to links - // tmt TIMETABLE // Link to timetable - [Rsc_ASSIGNMENT ] = "asg", - [Rsc_PROJECT ] = "prj", - [Rsc_CALL_FOR_EXAM ] = "cfe", - // tst TEST // User selects tags, teacher should select - [Rsc_EXAM ] = "exa", - [Rsc_GAME ] = "gam", - [Rsc_SURVEY ] = "svy", - [Rsc_DOCUMENT ] = "doc", - [Rsc_MARKS ] = "mrk", - // grp GROUPS // ??? User select groups - [Rsc_ATTENDANCE_EVENT] = "att", - [Rsc_FORUM_THREAD ] = "for", - }; - /*****************************************************************************/ /************** External global variables from others modules ****************/ /*****************************************************************************/ @@ -658,6 +632,8 @@ void Prg_DB_UpdateRscInd (long RscCod,int RscInd) void Prg_DB_UpdateRscLink (const struct Prg_Item *Item) { + extern const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES]; + DB_QueryUPDATE ("can not update link of resource", "UPDATE prg_resources" " SET Type='%s'," @@ -674,6 +650,8 @@ void Prg_DB_UpdateRscLink (const struct Prg_Item *Item) void Prg_DB_CopyToClipboard (Rsc_Type_t Type,long Cod) { + extern const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES]; + DB_QueryREPLACE ("can not copy link to resource clipboard", "REPLACE INTO prg_clipboards" " (UsrCod,CrsCod,Type,Cod,CopyTime)" @@ -709,6 +687,8 @@ unsigned Prg_DB_GetClipboard (MYSQL_RES **mysql_res) void Prg_DB_RemoveLinkFromClipboard (struct Rsc_Link *Link) { + extern const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES]; + DB_QueryDELETE ("can not remove link from clipboard", "DELETE FROM prg_clipboards" " WHERE UsrCod=%ld" diff --git a/swad_resource.c b/swad_resource.c index 99b4c447..1a7a9faa 100644 --- a/swad_resource.c +++ b/swad_resource.c @@ -48,6 +48,31 @@ /***************************** Public constants ******************************/ /*****************************************************************************/ +const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES] = + { + [Rsc_NONE ] = "non", + // gui TEACHING_GUIDE // Link to teaching guide + // bib BIBLIOGRAPHY // Link to bibliography + // faq FAQ // Link to FAQ + // lnk LINKS // Link to links + // tmt TIMETABLE // Link to timetable + [Rsc_ASSIGNMENT ] = "asg", + [Rsc_PROJECT ] = "prj", + [Rsc_CALL_FOR_EXAM ] = "cfe", + // tst TEST // User selects tags, teacher should select + [Rsc_EXAM ] = "exa", + [Rsc_EXAM_SESSION ] = "ses", + [Rsc_GAME ] = "gam", + [Rsc_GAME_MATCH ] = "mch", + [Rsc_RUBRIC ] = "rub", + [Rsc_DOCUMENT ] = "doc", + [Rsc_MARKS ] = "mrk", + // grp GROUPS // ??? User select groups + [Rsc_ATTENDANCE_EVENT] = "att", + [Rsc_FORUM_THREAD ] = "for", + [Rsc_SURVEY ] = "svy", + }; + const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES] = { [Rsc_NONE ] = "link-slash.svg", @@ -61,13 +86,16 @@ const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES] = [Rsc_CALL_FOR_EXAM ] = "bullhorn.svg", // tst TEST // User selects tags, teacher should select [Rsc_EXAM ] = "file-signature.svg", + [Rsc_EXAM_SESSION ] = "file-signature.svg", [Rsc_GAME ] = "gamepad.svg", - [Rsc_SURVEY ] = "poll.svg", + [Rsc_GAME_MATCH ] = "gamepad.svg", + [Rsc_RUBRIC ] = "tasks.svg", [Rsc_DOCUMENT ] = "folder-open.svg", [Rsc_MARKS ] = "list-alt.svg", // grp GROUPS // ??? User select groups [Rsc_ATTENDANCE_EVENT] = "calendar-check.svg", [Rsc_FORUM_THREAD ] = "comments.svg", + [Rsc_SURVEY ] = "poll.svg", }; /*****************************************************************************/ @@ -82,7 +110,6 @@ extern struct Globals Gbl; void Rsc_WriteRowClipboard (bool SubmitOnClick,const struct Rsc_Link *Link) { - extern const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES]; extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES]; HTM_LI_Begin ("class=\"PRG_RSC_%s\"",The_GetSuffix ()); @@ -121,12 +148,15 @@ void Rsc_WriteLinkName (const struct Rsc_Link *Link,bool PutFormToGo, [Rsc_PROJECT ] = PrjRsc_WriteResourceProject, [Rsc_CALL_FOR_EXAM ] = CfeRsc_WriteResourceCallForExam, [Rsc_EXAM ] = ExaRsc_WriteResourceExam, + [Rsc_EXAM_SESSION ] = ExaRsc_WriteResourceExam, // TODO [Rsc_GAME ] = GamRsc_WriteResourceGame, - [Rsc_SURVEY ] = SvyRsc_WriteResourceSurvey, + [Rsc_GAME_MATCH ] = GamRsc_WriteResourceGame, // TODO + [Rsc_RUBRIC ] = Rsc_WriteResourceEmpty, // TODO [Rsc_DOCUMENT ] = BrwRsc_WriteResourceDocument, [Rsc_MARKS ] = BrwRsc_WriteResourceMarksFile, [Rsc_ATTENDANCE_EVENT] = AttRsc_WriteResourceEvent, [Rsc_FORUM_THREAD ] = ForRsc_WriteResourceThread, + [Rsc_SURVEY ] = SvyRsc_WriteResourceSurvey, }; /***** Write link name *****/ @@ -167,12 +197,15 @@ void Rsc_GetResourceTitleFromLink (struct Rsc_Link *Link, [Rsc_PROJECT ] = PrjRsc_GetTitleFromPrjCod, [Rsc_CALL_FOR_EXAM ] = CfeRsc_GetTitleFromExaCod, [Rsc_EXAM ] = ExaRsc_GetTitleFromExaCod, + [Rsc_EXAM_SESSION ] = ExaRsc_GetTitleFromExaCod, // TODO [Rsc_GAME ] = GamRsc_GetTitleFromGamCod, - [Rsc_SURVEY ] = SvyRsc_GetTitleFromSvyCod, + [Rsc_GAME_MATCH ] = GamRsc_GetTitleFromGamCod, // TODO + [Rsc_RUBRIC ] = NULL, // TODO [Rsc_DOCUMENT ] = BrwRsc_GetTitleFromDocFilCod, [Rsc_MARKS ] = BrwRsc_GetTitleFromMrkFilCod, [Rsc_ATTENDANCE_EVENT] = AttRsc_GetTitleFromAttCod, [Rsc_FORUM_THREAD ] = ForRsc_GetTitleFromThrCod, + [Rsc_SURVEY ] = SvyRsc_GetTitleFromSvyCod, }; /***** Reset title *****/ @@ -212,7 +245,6 @@ void Rsc_GetLinkDataFromRow (MYSQL_RES *mysql_res,struct Rsc_Link *Link) Rsc_Type_t Rsc_GetTypeFromString (const char *Str) { - extern const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES]; Rsc_Type_t Type; /***** Compare string with all string types *****/ diff --git a/swad_resource.h b/swad_resource.h index 210816a9..40522354 100644 --- a/swad_resource.h +++ b/swad_resource.h @@ -38,7 +38,7 @@ #define Rsc_MAX_CHARS_RESOURCE_TITLE (128 - 1) // 127 #define Rsc_MAX_BYTES_RESOURCE_TITLE ((Rsc_MAX_CHARS_RESOURCE_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 -#define Rsc_NUM_TYPES 11 +#define Rsc_NUM_TYPES 14 typedef enum { Rsc_NONE, @@ -52,13 +52,16 @@ typedef enum Rsc_CALL_FOR_EXAM, // tst TEST // User selects tags, teacher should select Rsc_EXAM, + Rsc_EXAM_SESSION, Rsc_GAME, - Rsc_SURVEY, + Rsc_GAME_MATCH, + Rsc_RUBRIC, Rsc_DOCUMENT, Rsc_MARKS, // grp GROUPS // ??? User select groups Rsc_ATTENDANCE_EVENT, Rsc_FORUM_THREAD, + Rsc_SURVEY, } Rsc_Type_t; struct Rsc_Link diff --git a/swad_text.c b/swad_text.c index 9f05a22a..5651e8bb 100644 --- a/swad_text.c +++ b/swad_text.c @@ -20692,7 +20692,7 @@ const char *Txt_Match = // of a game #elif L==5 // fr "Match"; #elif L==6 // gn - "Partida"; // Okoteve traducción + "Ñes&etilde;ha"; #elif L==7 // it "Partita"; #elif L==8 // pl @@ -20700,7 +20700,7 @@ const char *Txt_Match = // of a game #elif L==9 // pt "Jogo"; #elif L==10 // tr - "Match"; // Çeviri lazim! + "Maç"; #endif const char *Txt_MATCH_End = @@ -36522,6 +36522,29 @@ const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES] = "Exame" #elif L==10 // tr "Sınav" +#endif + , + [Rsc_EXAM_SESSION] = +#if L==1 // ca + "Sessió d'examen" +#elif L==2 // de + "Prüfungssitzung" +#elif L==3 // en + "Exam session" +#elif L==4 // es + "Sesión de examen" +#elif L==5 // fr + "Session d'examen" +#elif L==6 // gn + "Sesión de examen" // Okoteve traducción +#elif L==7 // it + "Sessione d'esame" +#elif L==8 // pl + "Sesja egzaminacyjna" +#elif L==9 // pt + "Sessão de exame" +#elif L==10 // tr + "Sınav oturumu" #endif , [Rsc_GAME] = @@ -36547,27 +36570,50 @@ const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES] = "Oyun" #endif , - [Rsc_SURVEY] = + [Rsc_GAME_MATCH] = #if L==1 // ca - "Enquesta" + "Partida" #elif L==2 // de - "Umfrage" + "Spiel" #elif L==3 // en - "Survey" + "Match" #elif L==4 // es - "Encuesta" + "Partida" #elif L==5 // fr - "Sondage" + "Match" #elif L==6 // gn - "Encuesta" // Okoteve traducción + "Ñes&etilde;ha" #elif L==7 // it - "Sondaggio" + "Partita" #elif L==8 // pl - "Ankieta" + "Mecz" #elif L==9 // pt - "Inquérito" + "Jogo" #elif L==10 // tr - "Anket" + "Maç" +#endif + , + [Rsc_RUBRIC] = +#if L==1 // ca + "Rúbrica" +#elif L==2 // de + "Rubrik" +#elif L==3 // en + "Rubric" +#elif L==4 // es + "Rúbrica" +#elif L==5 // fr + "Rubrique" +#elif L==6 // gn + "Rúbrica" // Okoteve traducción +#elif L==7 // it + "Rubriche" +#elif L==8 // pl + "Rubryki" +#elif L==9 // pt + "Rubrica" +#elif L==10 // tr + "Değerlendirme" #endif , [Rsc_DOCUMENT] = @@ -36660,6 +36706,29 @@ const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES] = "Tópico do fórum" #elif L==10 // tr "Forum başlığı" +#endif + , + [Rsc_SURVEY] = +#if L==1 // ca + "Enquesta" +#elif L==2 // de + "Umfrage" +#elif L==3 // en + "Survey" +#elif L==4 // es + "Encuesta" +#elif L==5 // fr + "Sondage" +#elif L==6 // gn + "Encuesta" // Okoteve traducción +#elif L==7 // it + "Sondaggio" +#elif L==8 // pl + "Ankieta" +#elif L==9 // pt + "Inquérito" +#elif L==10 // tr + "Anket" #endif };