diff --git a/Makefile b/Makefile
index 45420ce3..599c8bdf 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
swad_announcement.o swad_announcement_database.o swad_API.o \
swad_API_database.o swad_assignment.o swad_assignment_database.o \
swad_assignment_resource.o swad_attendance.o swad_attendance_database.o \
- swad_autolink.o \
+ swad_attendance_resource.o swad_autolink.o \
swad_banner.o swad_banner_database.o swad_box.o swad_browser.o \
swad_browser_database.o swad_browser_resource.o swad_building.o \
swad_building_database.o swad_button.o \
diff --git a/swad_action.c b/swad_action.c
index 72ad639d..c6c763f1 100644
--- a/swad_action.c
+++ b/swad_action.c
@@ -31,6 +31,7 @@
#include "swad_announcement.h"
#include "swad_assignment_resource.h"
#include "swad_attendance.h"
+#include "swad_attendance_resource.h"
#include "swad_banner.h"
#include "swad_browser_resource.h"
#include "swad_building.h"
diff --git a/swad_attendance.c b/swad_attendance.c
index e2569e6c..01259525 100644
--- a/swad_attendance.c
+++ b/swad_attendance.c
@@ -109,8 +109,6 @@ static void Att_ResetAttendanceEvent (struct Att_Event *Event);
static void Att_FreeListAttEvents (struct Att_Events *Events);
static void Att_PutParamSelectedAttCod (void *Events);
-static void Att_PutParamAttCod (long AttCod);
-static long Att_GetParamAttCod (void);
static void Att_ShowLstGrpsToEditAttEvent (long AttCod);
static void Att_CreateGroups (long AttCod);
@@ -127,7 +125,6 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
struct Att_Event *Event);
static void Att_PutLinkAttEvent (struct Att_Event *Event,
const char *Title,const char *Txt);
-static void Att_PutParamsCodGrps (long AttCod);
static unsigned Att_GetNumUsrsFromAListWhoAreInAttEvent (long AttCod,
long LstSelectedUsrCods[],
unsigned NumUsrsInList);
@@ -810,7 +807,7 @@ static void Att_PutParamSelectedAttCod (void *Events)
Att_PutParamAttCod (((struct Att_Events *) Events)->AttCod);
}
-static void Att_PutParamAttCod (long AttCod)
+void Att_PutParamAttCod (long AttCod)
{
Par_PutHiddenParamLong (NULL,"AttCod",AttCod);
}
@@ -819,9 +816,8 @@ static void Att_PutParamAttCod (long AttCod)
/*************** Get parameter with code of attendance event *****************/
/*****************************************************************************/
-static long Att_GetParamAttCod (void)
+long Att_GetParamAttCod (void)
{
- /***** Get code of attendance event *****/
return Par_GetParToLong ("AttCod");
}
@@ -1885,7 +1881,7 @@ static void Att_PutLinkAttEvent (struct Att_Event *Event,
/****** Put parameters with the default groups in an attendance event ********/
/*****************************************************************************/
-static void Att_PutParamsCodGrps (long AttCod)
+void Att_PutParamsCodGrps (long AttCod)
{
extern const char *Par_SEPARATOR_PARAM_MULTIPLE;
MYSQL_RES *mysql_res;
@@ -3295,87 +3291,3 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
The_ChangeRowColor ();
}
-
-/*****************************************************************************/
-/************************ Get link to attendance event ***********************/
-/*****************************************************************************/
-
-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];
-
- /***** Get attendance event code *****/
- if ((AttCod = Att_GetParamAttCod ()) < 0)
- Err_WrongEventExit ();
-
- /***** Get attendance event title *****/
- Att_DB_GetAttEventTitle (AttCod,Title);
-
- /***** Copy link to attendance event into resource clipboard *****/
- Prg_DB_CopyToClipboard (PrgRsc_ATTENDANCE_EVENT,AttCod);
-
- /***** Write sucess message *****/
- Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
- Title);
-
- /***** Show attendance events again *****/
- Att_SeeAttEvents ();
- }
-
-/*****************************************************************************/
-/**************** Write attendance event in course program *******************/
-/*****************************************************************************/
-
-void AttRsc_WriteAttEventInCrsProgram (long AttCod,bool PutFormToGo,
- const char *Icon,const char *IconTitle)
- {
- extern const char *Txt_Actions[Act_NUM_ACTIONS];
- char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
-
- /***** Get game title *****/
- Att_DB_GetAttEventTitle (AttCod,Title);
-
- /***** Begin form to go to game *****/
- if (PutFormToGo)
- {
- Frm_BeginForm (ActSeeOneAtt);
- Att_PutParamAttCod (AttCod);
- Att_PutParamsCodGrps (AttCod);
- HTM_BUTTON_Submit_Begin (Txt_Actions[ActSeeOneAtt],
- "class=\"LM BT_LINK PRG_LNK_%s\"",
- The_GetSuffix ());
- }
-
- /***** Icon depending on type ******/
- if (PutFormToGo)
- Ico_PutIconLink (Icon,Ico_BLACK,ActSeeOneAtt);
- else
- Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
-
- /***** Write attendance event title *****/
- HTM_Txt (Title);
-
- /***** End form to download file *****/
- if (PutFormToGo)
- {
- /* End form */
- HTM_BUTTON_End ();
-
- Frm_EndForm ();
- }
- }
-
-/*****************************************************************************/
-/*************** Get attendance event title from game code *******************/
-/*****************************************************************************/
-
-void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize)
- {
- char TitleFromDB[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
-
- /***** Get attendance event title *****/
- Att_DB_GetAttEventTitle (AttCod,TitleFromDB);
- Str_Copy (Title,TitleFromDB,TitleSize);
- }
diff --git a/swad_attendance.h b/swad_attendance.h
index d8ca11dd..e227e71e 100644
--- a/swad_attendance.h
+++ b/swad_attendance.h
@@ -84,6 +84,9 @@ void Att_SeeAttEvents (void);
void Att_RequestCreatOrEditAttEvent (void);
bool Att_GetDataOfAttEventByCod (struct Att_Event *Event);
+void Att_PutParamAttCod (long AttCod);
+long Att_GetParamAttCod (void);
+
void Att_AskRemAttEvent (void);
void Att_GetAndRemAttEvent (void);
void Att_RemoveAttEventFromDB (long AttCod);
@@ -100,6 +103,8 @@ unsigned Att_GetNumAttEvents (HieLvl_Level_t Scope,unsigned *NumNotif);
void Att_SeeOneAttEvent (void);
+void Att_PutParamsCodGrps (long AttCod);
+
void Att_RegisterMeAsStdInAttEvent (void);
void Att_RegisterStudentsInAttEvent (void);
@@ -109,10 +114,4 @@ void Att_PrintMyAttendanceCrs (void);
void Att_ListUsrsAttendanceCrs (void);
void Att_PrintUsrsAttendanceCrs (void);
-//--------------------------- Program resources -------------------------------
-void AttRsc_GetLinkToEvent (void);
-void AttRsc_WriteAttEventInCrsProgram (long AttCod,bool PutFormToGo,
- const char *Icon,const char *IconTitle);
-void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize);
-
#endif
diff --git a/swad_attendance_resource.c b/swad_attendance_resource.c
new file mode 100644
index 00000000..4dac951b
--- /dev/null
+++ b/swad_attendance_resource.c
@@ -0,0 +1,144 @@
+// swad_attendance_resource.c: links to attendance events as program resources
+/*
+ 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 **********************************/
+/*****************************************************************************/
+
+// #define _GNU_SOURCE // For asprintf
+// #include // For PATH_MAX
+// #include // To access MySQL databases
+// #include // For NULL
+// #include // For asprintf
+// #include // For calloc
+// #include // For string functions
+
+#include "swad_alert.h"
+#include "swad_attendance.h"
+#include "swad_attendance_database.h"
+// #include "swad_autolink.h"
+// #include "swad_box.h"
+// #include "swad_database.h"
+#include "swad_error.h"
+#include "swad_form.h"
+// #include "swad_global.h"
+// #include "swad_group.h"
+// #include "swad_group_database.h"
+// #include "swad_hierarchy_level.h"
+// #include "swad_HTML.h"
+// #include "swad_ID.h"
+// #include "swad_pagination.h"
+// #include "swad_parameter.h"
+// #include "swad_photo.h"
+#include "swad_program_database.h"
+// #include "swad_QR.h"
+// #include "swad_setting.h"
+
+/*****************************************************************************/
+/*************** External global variables from others modules ***************/
+/*****************************************************************************/
+
+extern struct Globals Gbl;
+
+/*****************************************************************************/
+/************************ Get link to attendance event ***********************/
+/*****************************************************************************/
+
+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];
+
+ /***** Get attendance event code *****/
+ if ((AttCod = Att_GetParamAttCod ()) < 0)
+ Err_WrongEventExit ();
+
+ /***** Get attendance event title *****/
+ Att_DB_GetAttEventTitle (AttCod,Title);
+
+ /***** Copy link to attendance event into resource clipboard *****/
+ Prg_DB_CopyToClipboard (PrgRsc_ATTENDANCE_EVENT,AttCod);
+
+ /***** Write sucess message *****/
+ Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
+ Title);
+
+ /***** Show attendance events again *****/
+ Att_SeeAttEvents ();
+ }
+
+/*****************************************************************************/
+/**************** Write attendance event in course program *******************/
+/*****************************************************************************/
+
+void AttRsc_WriteAttEventInCrsProgram (long AttCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle)
+ {
+ extern const char *Txt_Actions[Act_NUM_ACTIONS];
+ char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
+
+ /***** Get game title *****/
+ Att_DB_GetAttEventTitle (AttCod,Title);
+
+ /***** Begin form to go to game *****/
+ if (PutFormToGo)
+ {
+ Frm_BeginForm (ActSeeOneAtt);
+ Att_PutParamAttCod (AttCod);
+ Att_PutParamsCodGrps (AttCod);
+ HTM_BUTTON_Submit_Begin (Txt_Actions[ActSeeOneAtt],
+ "class=\"LM BT_LINK PRG_LNK_%s\"",
+ The_GetSuffix ());
+ }
+
+ /***** Icon depending on type ******/
+ if (PutFormToGo)
+ Ico_PutIconLink (Icon,Ico_BLACK,ActSeeOneAtt);
+ else
+ Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
+
+ /***** Write attendance event title *****/
+ HTM_Txt (Title);
+
+ /***** End form to download file *****/
+ if (PutFormToGo)
+ {
+ /* End form */
+ HTM_BUTTON_End ();
+
+ Frm_EndForm ();
+ }
+ }
+
+/*****************************************************************************/
+/*************** Get attendance event title from game code *******************/
+/*****************************************************************************/
+
+void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize)
+ {
+ char TitleFromDB[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
+
+ /***** Get attendance event title *****/
+ Att_DB_GetAttEventTitle (AttCod,TitleFromDB);
+ Str_Copy (Title,TitleFromDB,TitleSize);
+ }
diff --git a/swad_attendance_resource.h b/swad_attendance_resource.h
new file mode 100644
index 00000000..29cd4de7
--- /dev/null
+++ b/swad_attendance_resource.h
@@ -0,0 +1,39 @@
+// swad_attendance_resource.h: links to attendance events as program resources
+
+#ifndef _SWAD_ATT_RSC
+#define _SWAD_ATT_RSC
+/*
+ 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 ***********************************/
+/*****************************************************************************/
+
+/*****************************************************************************/
+/***************************** Public prototypes *****************************/
+/*****************************************************************************/
+
+void AttRsc_GetLinkToEvent (void);
+void AttRsc_WriteAttEventInCrsProgram (long AttCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle);
+void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize);
+
+#endif
diff --git a/swad_browser_resource.c b/swad_browser_resource.c
new file mode 100644
index 00000000..fb0e47a8
--- /dev/null
+++ b/swad_browser_resource.c
@@ -0,0 +1,209 @@
+// swad_browser_resource.c: links to documents as program resources
+/*
+ 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 "swad_action.h"
+#include "swad_browser.h"
+#include "swad_error.h"
+#include "swad_form.h"
+#include "swad_global.h"
+#include "swad_program.h"
+#include "swad_program_database.h"
+#include "swad_program_resource.h"
+
+/*****************************************************************************/
+/******************** Global variables from other modules ********************/
+/*****************************************************************************/
+
+extern struct Globals Gbl;
+
+/*****************************************************************************/
+/****************************** Get link to file *****************************/
+/*****************************************************************************/
+
+void BrwRsc_GetLinkToFile (void)
+ {
+ extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
+ struct Brw_FileMetadata FileMetadata;
+ bool Found;
+ PrgRsc_Type_t Type;
+
+ /***** Get parameters related to file browser *****/
+ Brw_GetParAndInitFileBrowser ();
+
+ /***** Get file name *****/
+ FileMetadata.FilCod = Brw_GetParamFilCod ();
+ Brw_GetFileNameByCod (&FileMetadata);
+ Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
+
+ if (Found)
+ {
+ /***** Copy link to file into resource clipboard *****/
+ switch (Gbl.Action.Act)
+ {
+ case ActReqLnkSeeDocCrs:
+ case ActReqLnkAdmDocCrs:
+ Type = PrgRsc_DOCUMENT;
+ break;
+ case ActReqLnkSeeMrkCrs:
+ case ActReqLnkAdmMrkCrs:
+ Type = PrgRsc_MARKS;
+ break;
+ default:
+ Type = PrgRsc_NONE; // Initialized to avoid warning
+ Err_WrongTypeExit ();
+ break;
+ }
+ Prg_DB_CopyToClipboard (Type,FileMetadata.FilCod);
+
+ /***** Write sucess message *****/
+ Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
+ FileMetadata.FilFolLnk.Name);
+ }
+
+ /***** Show again the file browser *****/
+ Brw_ShowAgainFileBrowserOrWorks ();
+ }
+
+/*****************************************************************************/
+/******************** Write file name in course program **********************/
+/*****************************************************************************/
+
+void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle)
+ {
+ extern const char *Txt_Actions[Act_NUM_ACTIONS];
+ struct Brw_FileMetadata FileMetadata;
+
+ /***** Get file metadata *****/
+ FileMetadata.FilCod = FilCod;
+ Brw_GetFileMetadataByCod (&FileMetadata);
+
+ /***** Begin form to go to file data *****/
+ if (PutFormToGo)
+ {
+ Frm_BeginForm (ActReqDatSeeDocCrs);
+ Brw_PutParamsFileBrowser (NULL, // Not used
+ NULL, // Not used
+ Brw_IS_UNKNOWN, // Not used
+ FileMetadata.FilCod);
+ HTM_BUTTON_Submit_Begin (Txt_Actions[ActReqDatSeeDocCrs],
+ "class=\"LM BT_LINK PRG_LNK_%s\"",
+ The_GetSuffix ());
+ }
+
+ /***** Icon depending on type ******/
+ switch (FileMetadata.FilFolLnk.Type)
+ {
+ case Brw_IS_FILE:
+ Brw_PutIconFile (FileMetadata.FilFolLnk.Name,
+ "CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16",
+ PutFormToGo); // Put link to view metadata
+ break;
+ case Brw_IS_LINK:
+ if (PutFormToGo)
+ Ico_PutIconLink (Icon,Ico_BLACK,ActReqDatSeeDocCrs);
+ else
+ Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
+ break;
+ default:
+ break;
+ }
+
+ /***** Write filename *****/
+ HTM_Txt (FileMetadata.FilFolLnk.Name);
+
+ /***** End form to download file *****/
+ if (PutFormToGo)
+ {
+ HTM_BUTTON_End ();
+
+ Frm_EndForm ();
+ }
+ }
+
+/*****************************************************************************/
+/******************** Write file name in course program **********************/
+/*****************************************************************************/
+
+void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle)
+ {
+ extern const char *Txt_Actions[Act_NUM_ACTIONS];
+ struct Brw_FileMetadata FileMetadata;
+
+ /***** Get file metadata *****/
+ FileMetadata.FilCod = FilCod;
+ Brw_GetFileMetadataByCod (&FileMetadata);
+
+ /***** Begin form to go to file data *****/
+ if (PutFormToGo)
+ {
+ Frm_BeginForm (ActReqDatSeeMrkCrs);
+ Brw_PutParamsFileBrowser (NULL, // Not used
+ NULL, // Not used
+ Brw_IS_UNKNOWN, // Not used
+ FileMetadata.FilCod);
+ HTM_BUTTON_Submit_Begin (Txt_Actions[ActReqDatSeeMrkCrs],
+ "class=\"LM BT_LINK PRG_LNK_%s\"",
+ The_GetSuffix ());
+ }
+
+ /***** Icon depending on type ******/
+ if (PutFormToGo)
+ Ico_PutIconLink (Icon,Ico_BLACK,ActReqDatSeeMrkCrs);
+ else
+ Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
+
+ /***** Write filename *****/
+ HTM_Txt (FileMetadata.FilFolLnk.Name);
+
+ /***** End form to download file *****/
+ if (PutFormToGo)
+ {
+ HTM_BUTTON_End ();
+
+ Frm_EndForm ();
+ }
+ }
+
+/*****************************************************************************/
+/********************** Get file name from file code *************************/
+/*****************************************************************************/
+
+void BrwRsc_GetFileNameFromFilCod (long FilCod,char *FileName,size_t FileNameSize)
+ {
+ struct Brw_FileMetadata FileMetadata;
+
+ /***** Return nothing on error *****/
+ FileName[0] = '\0'; // Return nothing on error
+
+ /***** Get file metadata *****/
+ FileMetadata.FilCod = FilCod;
+ Brw_GetFileMetadataByCod (&FileMetadata);
+
+ /***** Copy file name into summary string *****/
+ Str_Copy (FileName,FileMetadata.FilFolLnk.Name,FileNameSize);
+ }
diff --git a/swad_browser_resource.h b/swad_browser_resource.h
new file mode 100644
index 00000000..50ebbba6
--- /dev/null
+++ b/swad_browser_resource.h
@@ -0,0 +1,43 @@
+// swad_browser_resource.h: links to documents as program resources
+
+#ifndef _SWAD_BRW_RSC
+#define _SWAD_BRW_RSC
+/*
+ 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 .
+*/
+/*****************************************************************************/
+/********************************* Headers ***********************************/
+/*****************************************************************************/
+
+#include // For size_t
+
+/*****************************************************************************/
+/************************ Public types and constants *************************/
+/*****************************************************************************/
+
+void BrwRsc_GetLinkToFile (void);
+void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle);
+void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle);
+void BrwRsc_GetFileNameFromFilCod (long FilCod,char *FileName,size_t FileNameSize);
+
+#endif
diff --git a/swad_changelog.h b/swad_changelog.h
index c43e4e56..97729565 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.27 (2022-09-24)"
+#define Log_PLATFORM_VERSION "SWAD 22.28 (2022-09-24)"
#define CSS_FILE "swad22.22.1.css"
#define JS_FILE "swad21.100.js"
/*
+ Version 22.28: Sep 24, 2022 New module swad_attendance_resource. (332236 lines)
Version 22.27: Sep 24, 2022 New module swad_browser_resource. (332157 lines)
Version 22.26: Sep 23, 2022 New module swad_survey_resource. (332095 lines)
Version 22.25: Sep 23, 2022 New module swad_game_resource. (332037 lines)
diff --git a/swad_program_resource.c b/swad_program_resource.c
index 89beaa72..eb6ac049 100644
--- a/swad_program_resource.c
+++ b/swad_program_resource.c
@@ -31,7 +31,7 @@
#include // For string functions
#include "swad_assignment_resource.h"
-#include "swad_attendance.h"
+#include "swad_attendance_resource.h"
#include "swad_browser_resource.h"
#include "swad_call_for_exam_resource.h"
#include "swad_error.h"
diff --git a/swad_survey_resource.c b/swad_survey_resource.c
new file mode 100644
index 00000000..24e3dee1
--- /dev/null
+++ b/swad_survey_resource.c
@@ -0,0 +1,120 @@
+// swad_survey_resource.c: links to surveys as program resources
+
+/*
+ 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 "swad_alert.h"
+#include "swad_error.h"
+#include "swad_form.h"
+#include "swad_program_database.h"
+#include "swad_survey.h"
+#include "swad_survey_database.h"
+
+/*****************************************************************************/
+/**************************** Get link to survey *****************************/
+/*****************************************************************************/
+
+void SvyRsc_GetLinkToSurvey (void)
+ {
+ extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
+ struct Svy_Surveys Surveys;
+ long SvyCod;
+ char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1];
+
+ /***** Reset surveys context *****/
+ Svy_ResetSurveys (&Surveys);
+
+ /***** Get survey code *****/
+ if ((SvyCod = Svy_GetParamSvyCod ()) <= 0)
+ Err_WrongSurveyExit ();
+
+ /***** Get survey title *****/
+ Svy_DB_GetSurveyTitle (SvyCod,Title);
+
+ /***** Copy link to survey into resource clipboard *****/
+ Prg_DB_CopyToClipboard (PrgRsc_SURVEY,SvyCod);
+
+ /***** Write sucess message *****/
+ Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
+ Title);
+
+ /***** Show surveys again *****/
+ Svy_ListAllSurveys (&Surveys);
+ }
+
+/*****************************************************************************/
+/********************** Write survey in course program ***********************/
+/*****************************************************************************/
+
+void SvyRsc_WriteSurveyInCrsProgram (long SvyCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle)
+ {
+ extern const char *Txt_Actions[Act_NUM_ACTIONS];
+ char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1];
+
+ /***** Get survey title *****/
+ Svy_DB_GetSurveyTitle (SvyCod,Title);
+
+ /***** Begin form to go to survey *****/
+ if (PutFormToGo)
+ {
+ Frm_BeginForm (ActSeeSvy);
+ Svy_PutParamSvyCod (SvyCod);
+ HTM_BUTTON_Submit_Begin (Txt_Actions[ActSeeSvy],
+ "class=\"LM BT_LINK PRG_LNK_%s\"",
+ The_GetSuffix ());
+ }
+
+ /***** Icon depending on type ******/
+ if (PutFormToGo)
+ Ico_PutIconLink (Icon,Ico_BLACK,ActSeeSvy);
+ else
+ Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
+
+ /***** Write Name of the course and date of exam *****/
+ HTM_Txt (Title);
+
+ /***** End form to download file *****/
+ if (PutFormToGo)
+ {
+ /* End form */
+ HTM_BUTTON_End ();
+
+ Frm_EndForm ();
+ }
+ }
+
+/*****************************************************************************/
+/********************* Get survey title from survey code *********************/
+/*****************************************************************************/
+
+void SvyRsc_GetTitleFromSvyCod (long SvyCod,char *Title,size_t TitleSize)
+ {
+ char TitleFromDB[Svy_MAX_BYTES_SURVEY_TITLE + 1];
+
+ /***** Get survey title *****/
+ Svy_DB_GetSurveyTitle (SvyCod,TitleFromDB);
+ Str_Copy (Title,TitleFromDB,TitleSize);
+ }
diff --git a/swad_survey_resource.h b/swad_survey_resource.h
new file mode 100644
index 00000000..a4a90bd6
--- /dev/null
+++ b/swad_survey_resource.h
@@ -0,0 +1,41 @@
+// swad_survey_resource.c: links to surveys as program resources
+
+#ifndef _SWAD_SVY_RSC
+#define _SWAD_SVY_RSC
+/*
+ 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 size_t
+
+/*****************************************************************************/
+/***************************** Public prototypes *****************************/
+/*****************************************************************************/
+
+void SvyRsc_GetLinkToSurvey (void);
+void SvyRsc_WriteSurveyInCrsProgram (long SvyCod,bool PutFormToGo,
+ const char *Icon,const char *IconTitle);
+void SvyRsc_GetTitleFromSvyCod (long SvyCod,char *Title,size_t TitleSize);
+
+#endif