From ba6a4f71b6370455aeaf064950be230ff84acce3 Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 23 Sep 2022 22:57:42 +0200 Subject: [PATCH] Version 22.25: Sep 23, 2022 New module swad_game_resource. --- Makefile | 9 +++-- swad_action.c | 1 + swad_changelog.h | 3 +- swad_game.c | 90 +---------------------------------------- swad_game.h | 7 +--- swad_game_database.h | 2 + swad_program_resource.c | 2 +- 7 files changed, 13 insertions(+), 101 deletions(-) diff --git a/Makefile b/Makefile index 82a2715ab..2ff537b95 100644 --- a/Makefile +++ b/Makefile @@ -53,10 +53,11 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \ swad_file_database.o swad_file_extension.o swad_file_MIME.o \ swad_firewall.o swad_firewall_database.o swad_follow.o \ swad_follow_database.o swad_form.o swad_forum.o swad_forum_database.o \ - swad_game.o swad_game_database.o swad_global.o swad_group.o \ - swad_group_database.o swad_help.o swad_hierarchy.o \ - swad_hierarchy_config.o swad_hierarchy_database.o swad_holiday.o \ - swad_holiday_database.o swad_HTML.o \ + swad_game.o swad_game_database.o swad_game_resource.o swad_global.o \ + swad_group.o swad_group_database.o \ + swad_help.o swad_hierarchy.o swad_hierarchy_config.o \ + swad_hierarchy_database.o swad_holiday.o swad_holiday_database.o \ + swad_HTML.o \ swad_icon.o swad_ID.o swad_ID_database.o swad_indicator.o \ swad_indicator_database.o swad_info.o swad_info_database.o \ swad_institution.o swad_institution_config.o \ diff --git a/swad_action.c b/swad_action.c index 68a784f4e..2de2c1906 100644 --- a/swad_action.c +++ b/swad_action.c @@ -61,6 +61,7 @@ #include "swad_follow.h" #include "swad_forum.h" #include "swad_game.h" +#include "swad_game_resource.h" #include "swad_global.h" #include "swad_group_database.h" #include "swad_hierarchy.h" diff --git a/swad_changelog.h b/swad_changelog.h index 112c1a65e..ada129069 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate TODO: Attach pdf files in multimedia. */ -#define Log_PLATFORM_VERSION "SWAD 22.24 (2022-09-23)" +#define Log_PLATFORM_VERSION "SWAD 22.25 (2022-09-23)" #define CSS_FILE "swad22.22.1.css" #define JS_FILE "swad21.100.js" /* + Version 22.25: Sep 23, 2022 New module swad_game_resource. (332037 lines) Version 22.24: Sep 23, 2022 New module swad_exam_resource. (331980 lines) Version 22.23: Sep 23, 2022 New module swad_call_for_exam_resource. (331924 lines) Version 22.22.1: Sep 23, 2022 Changes in layout of course program. (331875 lines) diff --git a/swad_game.c b/swad_game.c index abdff85eb..017df4cf1 100644 --- a/swad_game.c +++ b/swad_game.c @@ -106,7 +106,6 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static void Gam_ListAllGames (struct Gam_Games *Games); static bool Gam_CheckIfICanEditGames (void); static bool Gam_CheckIfICanListGameQuestions (void); static void Gam_PutIconsListGames (void *Games); @@ -223,7 +222,7 @@ void Gam_SeeAllGames (void) /******************************* Show all games ******************************/ /*****************************************************************************/ -static void Gam_ListAllGames (struct Gam_Games *Games) +void Gam_ListAllGames (struct Gam_Games *Games) { extern const char *Hlp_ASSESSMENT_Games; extern const char *Txt_Games; @@ -2351,90 +2350,3 @@ void Gam_GetAndShowGamesStats (void) /***** End table and box *****/ Box_BoxTableEnd (); } - -/*****************************************************************************/ -/***************************** Get link to game ******************************/ -/*****************************************************************************/ - -void Gam_GetLinkToGame (void) - { - extern const char *Txt_Link_to_resource_X_copied_into_clipboard; - struct Gam_Games Games; - long GamCod; - char Title[Gam_MAX_BYTES_TITLE + 1]; - - /***** Reset games context *****/ - Gam_ResetGames (&Games); - - /***** Get parameters *****/ - if ((GamCod = Gam_GetParams (&Games)) <= 0) - Err_WrongGameExit (); - - /***** Get game title *****/ - Gam_DB_GetGameTitle (GamCod,Title); - - /***** Copy link to game into resource clipboard *****/ - Prg_DB_CopyToClipboard (PrgRsc_GAME,GamCod); - - /***** Write sucess message *****/ - Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard, - Title); - - /***** Show games again *****/ - Gam_ListAllGames (&Games); - } - -/*****************************************************************************/ -/*********************** Write game in course program ************************/ -/*****************************************************************************/ - -void GamRsc_WriteGameInCrsProgram (long GamCod,bool PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[Act_NUM_ACTIONS]; - char Title[Gam_MAX_BYTES_TITLE + 1]; - - /***** Get game title *****/ - Gam_DB_GetGameTitle (GamCod,Title); - - /***** Begin form to go to game *****/ - if (PutFormToGo) - { - Frm_BeginForm (ActSeeGam); - Gam_PutParamGameCod (GamCod); - HTM_BUTTON_Submit_Begin (Txt_Actions[ActSeeGam], - "class=\"LM BT_LINK PRG_LNK_%s\"", - The_GetSuffix ()); - } - - /***** Icon depending on type ******/ - if (PutFormToGo) - Ico_PutIconLink (Icon,Ico_BLACK,ActSeeGam); - else - Ico_PutIconOn (Icon,Ico_BLACK,IconTitle); - - /***** Write game title of exam *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo) - { - /* End form */ - HTM_BUTTON_End (); - - Frm_EndForm (); - } - } - -/*****************************************************************************/ -/*********************** Get game title from game code ***********************/ -/*****************************************************************************/ - -void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize) - { - char TitleFromDB[Gam_MAX_BYTES_TITLE + 1]; - - /***** Get game title *****/ - Gam_DB_GetGameTitle (GamCod,TitleFromDB); - Str_Copy (Title,TitleFromDB,TitleSize); - } diff --git a/swad_game.h b/swad_game.h index 05c5726a5..c17ec03e7 100644 --- a/swad_game.h +++ b/swad_game.h @@ -107,6 +107,7 @@ void Gam_ResetGames (struct Gam_Games *Games); void Gam_ResetGame (struct Gam_Game *Game); void Gam_SeeAllGames (void); +void Gam_ListAllGames (struct Gam_Games *Games); void Gam_SeeOneGame (void); void Gam_ShowOnlyOneGame (struct Gam_Games *Games, struct Gam_Game *Game, @@ -167,10 +168,4 @@ void Gam_GetScoreRange (long GamCod,double *MinScore,double *MaxScore); //-------------------------------- Figures ------------------------------------ void Gam_GetAndShowGamesStats (void); -//--------------------------- Program resources ------------------------------- -void Gam_GetLinkToGame (void); -void GamRsc_WriteGameInCrsProgram (long GamCod,bool PutFormToGo, - const char *Icon,const char *IconTitle); -void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize); - #endif diff --git a/swad_game_database.h b/swad_game_database.h index 93ee977b8..b31bef95d 100644 --- a/swad_game_database.h +++ b/swad_game_database.h @@ -27,6 +27,8 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#include // To access MySQL databases + #include "swad_game.h" #include "swad_hierarchy_level.h" diff --git a/swad_program_resource.c b/swad_program_resource.c index 184e88c44..1eaa6c4a0 100644 --- a/swad_program_resource.c +++ b/swad_program_resource.c @@ -37,7 +37,7 @@ #include "swad_error.h" #include "swad_exam_resource.h" #include "swad_form.h" -#include "swad_game.h" +#include "swad_game_resource.h" #include "swad_global.h" #include "swad_program.h" #include "swad_program_database.h"