mirror of https://github.com/acanas/swad-core.git
Version 21.104: Jul 12, 2022 Adding resources to program items.
This commit is contained in:
parent
9bfd537d5f
commit
b51fb3bcd5
2
Makefile
2
Makefile
|
@ -74,7 +74,7 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
|
|||
swad_photo_shape.o swad_place.o swad_place_database.o swad_plugin.o \
|
||||
swad_plugin_database.o swad_privacy.o swad_profile.o \
|
||||
swad_profile_database.o swad_program.o swad_program_database.o \
|
||||
swad_project.o swad_project_database.o \
|
||||
swad_program_resource.o swad_project.o swad_project_database.o \
|
||||
swad_question.o swad_question_database.o swad_question_import.o \
|
||||
swad_QR.o \
|
||||
swad_record.o swad_record_database.o swad_report.o \
|
||||
|
|
|
@ -13605,6 +13605,11 @@ ALTER TABLE usr_data ADD COLUMN PhotoShape TINYINT NOT NULL DEFAULT 0 AFTER Side
|
|||
UPDATE usr_data SET PhotoShape=3;
|
||||
|
||||
|
||||
-----------------
|
||||
|
||||
INSERT INTO prg_resources (ItmCod,RscInd,Hidden,Title) VALUES (14,0,'N','Recurso 1');
|
||||
INSERT INTO prg_resources (ItmCod,RscInd,Hidden,Title) VALUES (14,1,'N','Recurso 2');
|
||||
INSERT INTO prg_resources (ItmCod,RscInd,Hidden,Title) VALUES (14,2,'N','Recurso 3');
|
||||
|
||||
|
||||
|
||||
|
|
11
sql/swad.sql
11
sql/swad.sql
|
@ -1178,6 +1178,17 @@ CREATE TABLE IF NOT EXISTS prg_items (
|
|||
UNIQUE INDEX(ItmCod),
|
||||
UNIQUE INDEX(CrsCod,ItmInd));
|
||||
--
|
||||
-- Table prg_resources: stores the resources of the course program
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS prg_resources (
|
||||
RscCod INT NOT NULL AUTO_INCREMENT,
|
||||
ItmCod INT NOT NULL DEFAULT -1,
|
||||
RscInd INT NOT NULL DEFAULT 0,
|
||||
Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||
Title VARCHAR(2047) NOT NULL,
|
||||
UNIQUE INDEX(RscCod),
|
||||
UNIQUE INDEX(ItmCod,RscInd));
|
||||
--
|
||||
-- Table prj_config: stores the configuration of projects for each course
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS prj_config (
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include "swad_privacy.h"
|
||||
#include "swad_profile.h"
|
||||
#include "swad_program.h"
|
||||
#include "swad_program_resource.h"
|
||||
#include "swad_project.h"
|
||||
#include "swad_question_import.h"
|
||||
#include "swad_QR.h"
|
||||
|
@ -441,6 +442,8 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
[ActLftPrgItm ] = {1834,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prg_MoveLeftItem ,NULL},
|
||||
[ActRgtPrgItm ] = {1833,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prg_MoveRightItem ,NULL},
|
||||
|
||||
[ActFrmNewPrgRsc ] = {1918,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prg_RequestChangeItem ,NULL},
|
||||
|
||||
[ActEdiTchGui ] = { 785,-1,TabUnk,ActSeeTchGui ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_FormsToSelSendInfo ,NULL},
|
||||
|
||||
[ActSeeSylLec ] = { 28,-1,TabUnk,ActSeeSyl ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_ShowInfo ,NULL},
|
||||
|
@ -3743,6 +3746,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
-1, // #1915 (obsolete action)
|
||||
-1, // #1916 (obsolete action)
|
||||
ActChgUsrPho, // #1917
|
||||
ActFrmNewPrgRsc, // #1918
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
195
swad_action.h
195
swad_action.h
|
@ -65,7 +65,7 @@ typedef enum
|
|||
|
||||
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||
|
||||
#define Act_MAX_ACTION_COD 1917
|
||||
#define Act_MAX_ACTION_COD 1918
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
||||
|
||||
|
@ -408,107 +408,108 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActDwnPrgItm (ActChgCrsSta + 25)
|
||||
#define ActLftPrgItm (ActChgCrsSta + 26)
|
||||
#define ActRgtPrgItm (ActChgCrsSta + 27)
|
||||
#define ActEdiTchGui (ActChgCrsSta + 28)
|
||||
#define ActSeeSylLec (ActChgCrsSta + 29)
|
||||
#define ActSeeSylPra (ActChgCrsSta + 30)
|
||||
#define ActEdiSylLec (ActChgCrsSta + 31)
|
||||
#define ActEdiSylPra (ActChgCrsSta + 32)
|
||||
#define ActDelItmSylLec (ActChgCrsSta + 33)
|
||||
#define ActDelItmSylPra (ActChgCrsSta + 34)
|
||||
#define ActUp_IteSylLec (ActChgCrsSta + 35)
|
||||
#define ActUp_IteSylPra (ActChgCrsSta + 36)
|
||||
#define ActDwnIteSylLec (ActChgCrsSta + 37)
|
||||
#define ActDwnIteSylPra (ActChgCrsSta + 38)
|
||||
#define ActRgtIteSylLec (ActChgCrsSta + 39)
|
||||
#define ActRgtIteSylPra (ActChgCrsSta + 40)
|
||||
#define ActLftIteSylLec (ActChgCrsSta + 41)
|
||||
#define ActLftIteSylPra (ActChgCrsSta + 42)
|
||||
#define ActInsIteSylLec (ActChgCrsSta + 43)
|
||||
#define ActInsIteSylPra (ActChgCrsSta + 44)
|
||||
#define ActModIteSylLec (ActChgCrsSta + 45)
|
||||
#define ActModIteSylPra (ActChgCrsSta + 46)
|
||||
#define ActFrmNewPrgRsc (ActChgCrsSta + 28)
|
||||
#define ActEdiTchGui (ActChgCrsSta + 29)
|
||||
#define ActSeeSylLec (ActChgCrsSta + 30)
|
||||
#define ActSeeSylPra (ActChgCrsSta + 31)
|
||||
#define ActEdiSylLec (ActChgCrsSta + 32)
|
||||
#define ActEdiSylPra (ActChgCrsSta + 33)
|
||||
#define ActDelItmSylLec (ActChgCrsSta + 34)
|
||||
#define ActDelItmSylPra (ActChgCrsSta + 35)
|
||||
#define ActUp_IteSylLec (ActChgCrsSta + 36)
|
||||
#define ActUp_IteSylPra (ActChgCrsSta + 37)
|
||||
#define ActDwnIteSylLec (ActChgCrsSta + 38)
|
||||
#define ActDwnIteSylPra (ActChgCrsSta + 39)
|
||||
#define ActRgtIteSylLec (ActChgCrsSta + 40)
|
||||
#define ActRgtIteSylPra (ActChgCrsSta + 41)
|
||||
#define ActLftIteSylLec (ActChgCrsSta + 42)
|
||||
#define ActLftIteSylPra (ActChgCrsSta + 43)
|
||||
#define ActInsIteSylLec (ActChgCrsSta + 44)
|
||||
#define ActInsIteSylPra (ActChgCrsSta + 45)
|
||||
#define ActModIteSylLec (ActChgCrsSta + 46)
|
||||
#define ActModIteSylPra (ActChgCrsSta + 47)
|
||||
|
||||
#define ActEdiBib (ActChgCrsSta + 47)
|
||||
#define ActEdiFAQ (ActChgCrsSta + 48)
|
||||
#define ActEdiCrsLnk (ActChgCrsSta + 49)
|
||||
#define ActEdiBib (ActChgCrsSta + 48)
|
||||
#define ActEdiFAQ (ActChgCrsSta + 49)
|
||||
#define ActEdiCrsLnk (ActChgCrsSta + 50)
|
||||
|
||||
#define ActChgFrcReaCrsInf (ActChgCrsSta + 50)
|
||||
#define ActChgFrcReaTchGui (ActChgCrsSta + 51)
|
||||
#define ActChgFrcReaSylLec (ActChgCrsSta + 52)
|
||||
#define ActChgFrcReaSylPra (ActChgCrsSta + 53)
|
||||
#define ActChgFrcReaBib (ActChgCrsSta + 54)
|
||||
#define ActChgFrcReaFAQ (ActChgCrsSta + 55)
|
||||
#define ActChgFrcReaCrsLnk (ActChgCrsSta + 56)
|
||||
#define ActChgFrcReaCrsInf (ActChgCrsSta + 51)
|
||||
#define ActChgFrcReaTchGui (ActChgCrsSta + 52)
|
||||
#define ActChgFrcReaSylLec (ActChgCrsSta + 53)
|
||||
#define ActChgFrcReaSylPra (ActChgCrsSta + 54)
|
||||
#define ActChgFrcReaBib (ActChgCrsSta + 55)
|
||||
#define ActChgFrcReaFAQ (ActChgCrsSta + 56)
|
||||
#define ActChgFrcReaCrsLnk (ActChgCrsSta + 57)
|
||||
|
||||
#define ActChgHavReaCrsInf (ActChgCrsSta + 57)
|
||||
#define ActChgHavReaTchGui (ActChgCrsSta + 58)
|
||||
#define ActChgHavReaSylLec (ActChgCrsSta + 59)
|
||||
#define ActChgHavReaSylPra (ActChgCrsSta + 60)
|
||||
#define ActChgHavReaBib (ActChgCrsSta + 61)
|
||||
#define ActChgHavReaFAQ (ActChgCrsSta + 62)
|
||||
#define ActChgHavReaCrsLnk (ActChgCrsSta + 63)
|
||||
#define ActChgHavReaCrsInf (ActChgCrsSta + 58)
|
||||
#define ActChgHavReaTchGui (ActChgCrsSta + 59)
|
||||
#define ActChgHavReaSylLec (ActChgCrsSta + 60)
|
||||
#define ActChgHavReaSylPra (ActChgCrsSta + 61)
|
||||
#define ActChgHavReaBib (ActChgCrsSta + 62)
|
||||
#define ActChgHavReaFAQ (ActChgCrsSta + 63)
|
||||
#define ActChgHavReaCrsLnk (ActChgCrsSta + 64)
|
||||
|
||||
#define ActSelInfSrcCrsInf (ActChgCrsSta + 64)
|
||||
#define ActSelInfSrcTchGui (ActChgCrsSta + 65)
|
||||
#define ActSelInfSrcSylLec (ActChgCrsSta + 66)
|
||||
#define ActSelInfSrcSylPra (ActChgCrsSta + 67)
|
||||
#define ActSelInfSrcBib (ActChgCrsSta + 68)
|
||||
#define ActSelInfSrcFAQ (ActChgCrsSta + 69)
|
||||
#define ActSelInfSrcCrsLnk (ActChgCrsSta + 70)
|
||||
#define ActRcvURLCrsInf (ActChgCrsSta + 71)
|
||||
#define ActRcvURLTchGui (ActChgCrsSta + 72)
|
||||
#define ActRcvURLSylLec (ActChgCrsSta + 73)
|
||||
#define ActRcvURLSylPra (ActChgCrsSta + 74)
|
||||
#define ActRcvURLBib (ActChgCrsSta + 75)
|
||||
#define ActRcvURLFAQ (ActChgCrsSta + 76)
|
||||
#define ActRcvURLCrsLnk (ActChgCrsSta + 77)
|
||||
#define ActRcvPagCrsInf (ActChgCrsSta + 78)
|
||||
#define ActRcvPagTchGui (ActChgCrsSta + 79)
|
||||
#define ActRcvPagSylLec (ActChgCrsSta + 80)
|
||||
#define ActRcvPagSylPra (ActChgCrsSta + 81)
|
||||
#define ActRcvPagBib (ActChgCrsSta + 82)
|
||||
#define ActRcvPagFAQ (ActChgCrsSta + 83)
|
||||
#define ActRcvPagCrsLnk (ActChgCrsSta + 84)
|
||||
#define ActEditorCrsInf (ActChgCrsSta + 85)
|
||||
#define ActEditorTchGui (ActChgCrsSta + 86)
|
||||
#define ActEditorSylLec (ActChgCrsSta + 87)
|
||||
#define ActEditorSylPra (ActChgCrsSta + 88)
|
||||
#define ActEditorBib (ActChgCrsSta + 89)
|
||||
#define ActEditorFAQ (ActChgCrsSta + 90)
|
||||
#define ActEditorCrsLnk (ActChgCrsSta + 91)
|
||||
#define ActPlaTxtEdiCrsInf (ActChgCrsSta + 92)
|
||||
#define ActPlaTxtEdiTchGui (ActChgCrsSta + 93)
|
||||
#define ActPlaTxtEdiSylLec (ActChgCrsSta + 94)
|
||||
#define ActPlaTxtEdiSylPra (ActChgCrsSta + 95)
|
||||
#define ActPlaTxtEdiBib (ActChgCrsSta + 96)
|
||||
#define ActPlaTxtEdiFAQ (ActChgCrsSta + 97)
|
||||
#define ActPlaTxtEdiCrsLnk (ActChgCrsSta + 98)
|
||||
#define ActRchTxtEdiCrsInf (ActChgCrsSta + 99)
|
||||
#define ActRchTxtEdiTchGui (ActChgCrsSta + 100)
|
||||
#define ActRchTxtEdiSylLec (ActChgCrsSta + 101)
|
||||
#define ActRchTxtEdiSylPra (ActChgCrsSta + 102)
|
||||
#define ActRchTxtEdiBib (ActChgCrsSta + 103)
|
||||
#define ActRchTxtEdiFAQ (ActChgCrsSta + 104)
|
||||
#define ActRchTxtEdiCrsLnk (ActChgCrsSta + 105)
|
||||
#define ActRcvPlaTxtCrsInf (ActChgCrsSta + 106)
|
||||
#define ActRcvPlaTxtTchGui (ActChgCrsSta + 107)
|
||||
#define ActRcvPlaTxtSylLec (ActChgCrsSta + 108)
|
||||
#define ActRcvPlaTxtSylPra (ActChgCrsSta + 109)
|
||||
#define ActRcvPlaTxtBib (ActChgCrsSta + 110)
|
||||
#define ActRcvPlaTxtFAQ (ActChgCrsSta + 111)
|
||||
#define ActRcvPlaTxtCrsLnk (ActChgCrsSta + 112)
|
||||
#define ActRcvRchTxtCrsInf (ActChgCrsSta + 113)
|
||||
#define ActRcvRchTxtTchGui (ActChgCrsSta + 114)
|
||||
#define ActRcvRchTxtSylLec (ActChgCrsSta + 115)
|
||||
#define ActRcvRchTxtSylPra (ActChgCrsSta + 116)
|
||||
#define ActRcvRchTxtBib (ActChgCrsSta + 117)
|
||||
#define ActRcvRchTxtFAQ (ActChgCrsSta + 118)
|
||||
#define ActRcvRchTxtCrsLnk (ActChgCrsSta + 119)
|
||||
#define ActSelInfSrcCrsInf (ActChgCrsSta + 65)
|
||||
#define ActSelInfSrcTchGui (ActChgCrsSta + 66)
|
||||
#define ActSelInfSrcSylLec (ActChgCrsSta + 67)
|
||||
#define ActSelInfSrcSylPra (ActChgCrsSta + 68)
|
||||
#define ActSelInfSrcBib (ActChgCrsSta + 69)
|
||||
#define ActSelInfSrcFAQ (ActChgCrsSta + 70)
|
||||
#define ActSelInfSrcCrsLnk (ActChgCrsSta + 71)
|
||||
#define ActRcvURLCrsInf (ActChgCrsSta + 72)
|
||||
#define ActRcvURLTchGui (ActChgCrsSta + 73)
|
||||
#define ActRcvURLSylLec (ActChgCrsSta + 74)
|
||||
#define ActRcvURLSylPra (ActChgCrsSta + 75)
|
||||
#define ActRcvURLBib (ActChgCrsSta + 76)
|
||||
#define ActRcvURLFAQ (ActChgCrsSta + 77)
|
||||
#define ActRcvURLCrsLnk (ActChgCrsSta + 78)
|
||||
#define ActRcvPagCrsInf (ActChgCrsSta + 79)
|
||||
#define ActRcvPagTchGui (ActChgCrsSta + 80)
|
||||
#define ActRcvPagSylLec (ActChgCrsSta + 81)
|
||||
#define ActRcvPagSylPra (ActChgCrsSta + 82)
|
||||
#define ActRcvPagBib (ActChgCrsSta + 83)
|
||||
#define ActRcvPagFAQ (ActChgCrsSta + 84)
|
||||
#define ActRcvPagCrsLnk (ActChgCrsSta + 85)
|
||||
#define ActEditorCrsInf (ActChgCrsSta + 86)
|
||||
#define ActEditorTchGui (ActChgCrsSta + 87)
|
||||
#define ActEditorSylLec (ActChgCrsSta + 88)
|
||||
#define ActEditorSylPra (ActChgCrsSta + 89)
|
||||
#define ActEditorBib (ActChgCrsSta + 90)
|
||||
#define ActEditorFAQ (ActChgCrsSta + 91)
|
||||
#define ActEditorCrsLnk (ActChgCrsSta + 92)
|
||||
#define ActPlaTxtEdiCrsInf (ActChgCrsSta + 93)
|
||||
#define ActPlaTxtEdiTchGui (ActChgCrsSta + 94)
|
||||
#define ActPlaTxtEdiSylLec (ActChgCrsSta + 95)
|
||||
#define ActPlaTxtEdiSylPra (ActChgCrsSta + 96)
|
||||
#define ActPlaTxtEdiBib (ActChgCrsSta + 97)
|
||||
#define ActPlaTxtEdiFAQ (ActChgCrsSta + 98)
|
||||
#define ActPlaTxtEdiCrsLnk (ActChgCrsSta + 99)
|
||||
#define ActRchTxtEdiCrsInf (ActChgCrsSta + 100)
|
||||
#define ActRchTxtEdiTchGui (ActChgCrsSta + 101)
|
||||
#define ActRchTxtEdiSylLec (ActChgCrsSta + 102)
|
||||
#define ActRchTxtEdiSylPra (ActChgCrsSta + 103)
|
||||
#define ActRchTxtEdiBib (ActChgCrsSta + 104)
|
||||
#define ActRchTxtEdiFAQ (ActChgCrsSta + 105)
|
||||
#define ActRchTxtEdiCrsLnk (ActChgCrsSta + 106)
|
||||
#define ActRcvPlaTxtCrsInf (ActChgCrsSta + 107)
|
||||
#define ActRcvPlaTxtTchGui (ActChgCrsSta + 108)
|
||||
#define ActRcvPlaTxtSylLec (ActChgCrsSta + 109)
|
||||
#define ActRcvPlaTxtSylPra (ActChgCrsSta + 110)
|
||||
#define ActRcvPlaTxtBib (ActChgCrsSta + 111)
|
||||
#define ActRcvPlaTxtFAQ (ActChgCrsSta + 112)
|
||||
#define ActRcvPlaTxtCrsLnk (ActChgCrsSta + 113)
|
||||
#define ActRcvRchTxtCrsInf (ActChgCrsSta + 114)
|
||||
#define ActRcvRchTxtTchGui (ActChgCrsSta + 115)
|
||||
#define ActRcvRchTxtSylLec (ActChgCrsSta + 116)
|
||||
#define ActRcvRchTxtSylPra (ActChgCrsSta + 117)
|
||||
#define ActRcvRchTxtBib (ActChgCrsSta + 118)
|
||||
#define ActRcvRchTxtFAQ (ActChgCrsSta + 119)
|
||||
#define ActRcvRchTxtCrsLnk (ActChgCrsSta + 120)
|
||||
|
||||
#define ActPrnCrsTT (ActChgCrsSta + 120)
|
||||
#define ActEdiCrsTT (ActChgCrsSta + 121)
|
||||
#define ActChgCrsTT (ActChgCrsSta + 122)
|
||||
#define ActChgCrsTT1stDay (ActChgCrsSta + 123)
|
||||
#define ActPrnCrsTT (ActChgCrsSta + 121)
|
||||
#define ActEdiCrsTT (ActChgCrsSta + 122)
|
||||
#define ActChgCrsTT (ActChgCrsSta + 123)
|
||||
#define ActChgCrsTT1stDay (ActChgCrsSta + 124)
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Assessment tab ********************************/
|
||||
|
|
16
swad_box.c
16
swad_box.c
|
@ -222,16 +222,16 @@ void Box_BoxWithButtonEnd (Btn_Button_t Button,const char *TxtButton)
|
|||
|
||||
void Box_BoxEnd (void)
|
||||
{
|
||||
/***** Check level of nesting *****/
|
||||
if (Gbl.Box.Nested < 0)
|
||||
Err_ShowErrorAndExit ("Trying to end a box not open.");
|
||||
/***** Check level of nesting *****/
|
||||
if (Gbl.Box.Nested < 0)
|
||||
Err_ShowErrorAndExit ("Trying to end a box not open.");
|
||||
|
||||
/***** Free memory allocated for box id string *****/
|
||||
if (Gbl.Box.Ids[Gbl.Box.Nested])
|
||||
free (Gbl.Box.Ids[Gbl.Box.Nested]);
|
||||
/***** Free memory allocated for box id string *****/
|
||||
if (Gbl.Box.Ids[Gbl.Box.Nested])
|
||||
free (Gbl.Box.Ids[Gbl.Box.Nested]);
|
||||
|
||||
/***** End box and box container *****/
|
||||
HTM_DIV_End ();
|
||||
/***** End box and box container *****/
|
||||
HTM_DIV_End ();
|
||||
HTM_DIV_End ();
|
||||
|
||||
/***** Decrease level of nesting *****/
|
||||
|
|
|
@ -606,10 +606,14 @@ 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 21.103.6 (2022-07-01)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.104 (2022-07-12)"
|
||||
#define CSS_FILE "swad21.103.6.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 21.104: Jul 12, 2022 Adding resources to program items. (? lines)
|
||||
1 change necessary in database:
|
||||
CREATE TABLE IF NOT EXISTS prg_resources (RscCod INT NOT NULL AUTO_INCREMENT,ItmCod INT NOT NULL DEFAULT -1,RscInd INT NOT NULL DEFAULT 0,Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',Title VARCHAR(2047) NOT NULL,UNIQUE INDEX(RscCod),UNIQUE INDEX(ItmCod,RscInd));
|
||||
|
||||
Version 21.103.6: Jul 01, 2022 Fixed issues in matches. (327737 lines)
|
||||
Version 21.103.5: Jun 30, 2022 Code refactoring in icons. (327727 lines)
|
||||
Version 21.103.4: Jun 30, 2022 Code refactoring in icons. (327968 lines)
|
||||
|
|
|
@ -2451,6 +2451,29 @@ mysql> DESCRIBE prg_items;
|
|||
"UNIQUE INDEX(ItmCod),"
|
||||
"UNIQUE INDEX(CrsCod,ItmInd))");
|
||||
|
||||
/***** 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 | |
|
||||
| Title | varchar(2047) | NO | | NULL | |
|
||||
+--------+---------------+------+-----+---------+----------------+
|
||||
5 rows in set (0,00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS prg_resources ("
|
||||
"RscCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"ItmCod INT NOT NULL DEFAULT -1,"
|
||||
"RscInd INT NOT NULL DEFAULT 0,"
|
||||
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"Title VARCHAR(2047) NOT NULL," // PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE
|
||||
"UNIQUE INDEX(RscCod),"
|
||||
"UNIQUE INDEX(ItmCod,RscInd))");
|
||||
|
||||
/***** Table prj_config *****/
|
||||
/*
|
||||
mysql> DESCRIBE prj_config;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "swad_photo.h"
|
||||
#include "swad_program.h"
|
||||
#include "swad_program_database.h"
|
||||
#include "swad_program_resource.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_setting.h"
|
||||
#include "swad_string.h"
|
||||
|
@ -116,7 +117,6 @@ static void Prg_ShowCourseProgramHighlightingItem (const struct Prg_ItemRange *T
|
|||
static void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
||||
const struct Prg_ItemRange *ToHighlight,
|
||||
long ParentItmCod,long ItmCodBeforeForm,unsigned FormLevel);
|
||||
static bool Prg_CheckIfICanCreateItems (void);
|
||||
static void Prg_PutIconsListItems (__attribute__((unused)) void *Args);
|
||||
static void Prg_PutIconToCreateNewItem (void);
|
||||
static void Prg_PutButtonToCreateNewItem (void);
|
||||
|
@ -149,8 +149,6 @@ static bool Prg_CheckIfMoveDownIsAllowed (unsigned NumItem);
|
|||
static bool Prg_CheckIfMoveLeftIsAllowed (unsigned NumItem);
|
||||
static bool Prg_CheckIfMoveRightIsAllowed (unsigned NumItem);
|
||||
|
||||
static void Prg_PutParams (void *ItmCod);
|
||||
|
||||
static void Prg_GetListItems (void);
|
||||
static void Prg_GetDataOfItemByCod (struct Prg_Item *Item);
|
||||
static void Prg_GetDataOfItem (struct Prg_Item *Item,
|
||||
|
@ -182,6 +180,7 @@ static void Prg_ShowFormToChangeItem (long ItmCod);
|
|||
static void Prg_ShowFormItem (const struct Prg_Item *Item,
|
||||
const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME],
|
||||
const char *Txt);
|
||||
|
||||
static void Prg_InsertItem (const struct Prg_Item *ParentItem,
|
||||
struct Prg_Item *Item,const char *Txt);
|
||||
|
||||
|
@ -279,14 +278,13 @@ static void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
|||
case Prg_PUT_FORM_CHANGE_ITEM:
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
ItmCodBeforeForm,FormLevel);
|
||||
break;
|
||||
}
|
||||
|
||||
/* End range to highlight? */
|
||||
if (Item.Hierarchy.Index == ToHighlight->End) // End of the highlighted range
|
||||
{
|
||||
HTM_TBODY_End (); // Highlighted tbody end
|
||||
if (NumItem < Prg_Gbl.List.NumItems - 1) // Not the last item
|
||||
if (NumItem < Prg_Gbl.List.NumItems - 1) // Not the last item
|
||||
HTM_TBODY_Begin (NULL); // 3rd tbody begin
|
||||
}
|
||||
|
||||
|
@ -294,7 +292,8 @@ static void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
|||
}
|
||||
|
||||
/***** Create item at the end? *****/
|
||||
if (ItmCodBeforeForm <= 0 && CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM)
|
||||
if (ItmCodBeforeForm <= 0 &&
|
||||
CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM)
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CREATE_ITEM,-1L,1);
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -316,7 +315,7 @@ static void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
|||
/******************* Check if I can create program items *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Prg_CheckIfICanCreateItems (void)
|
||||
bool Prg_CheckIfICanCreateItems (void)
|
||||
{
|
||||
return Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM;
|
||||
|
@ -543,9 +542,18 @@ static void Prg_WriteRowWithItemForm (Prg_CreateOrChangeItem_t CreateOrChangeIte
|
|||
ColSpan = (Prg_GetMaxItemLevel () + 4) - FormLevel;
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN %s\"",
|
||||
ColSpan,The_GetColorRows ());
|
||||
/* Form for item data */
|
||||
HTM_ARTICLE_Begin ("item_form");
|
||||
ShowForm[CreateOrChangeItem] (ItmCod);
|
||||
HTM_ARTICLE_End ();
|
||||
|
||||
/* List of item resources */
|
||||
if (CreateOrChangeItem == Prg_PUT_FORM_CHANGE_ITEM)
|
||||
{
|
||||
HTM_ARTICLE_Begin ("rsc_form");
|
||||
PrgRsc_ShowAllResources (ItmCod);
|
||||
HTM_ARTICLE_End ();
|
||||
}
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** End row *****/
|
||||
|
@ -880,7 +888,7 @@ static bool Prg_CheckIfMoveRightIsAllowed (unsigned NumItem)
|
|||
/******************** Params used to edit a program item *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Prg_PutParams (void *ItmCod)
|
||||
void Prg_PutParams (void *ItmCod)
|
||||
{
|
||||
if (ItmCod)
|
||||
if (*((long *) ItmCod) > 0)
|
||||
|
@ -1758,7 +1766,7 @@ static void Prg_ShowFormItem (const struct Prg_Item *Item,
|
|||
|
||||
/* Data */
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
HTM_TEXTAREA_Begin ("id=\"Txt\" name=\"Txt\" rows=\"25\""
|
||||
HTM_TEXTAREA_Begin ("id=\"Txt\" name=\"Txt\" rows=\"10\""
|
||||
" class=\"PRG_TITLE_DESCRIPTION_WIDTH INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
if (Txt)
|
||||
|
@ -1830,7 +1838,7 @@ void Prg_ReceiveFormNewItem (void)
|
|||
|
||||
void Prg_ReceiveFormChgItem (void)
|
||||
{
|
||||
struct Prg_Item OldItem; // Current program item data in database
|
||||
// struct Prg_Item OldItem; // Current program item data in database
|
||||
struct Prg_Item NewItem; // Item data received from form
|
||||
char Description[Cns_MAX_BYTES_TEXT + 1];
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
|
@ -1845,8 +1853,8 @@ void Prg_ReceiveFormChgItem (void)
|
|||
Err_WrongItemExit ();
|
||||
|
||||
/***** Get data of the old (current) program item from database *****/
|
||||
OldItem.Hierarchy.ItmCod = NewItem.Hierarchy.ItmCod;
|
||||
Prg_GetDataOfItemByCod (&OldItem);
|
||||
// OldItem.Hierarchy.ItmCod = NewItem.Hierarchy.ItmCod;
|
||||
// Prg_GetDataOfItemByCod (&OldItem);
|
||||
|
||||
/***** Get start/end date-times *****/
|
||||
NewItem.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||
|
|
|
@ -77,6 +77,8 @@ typedef enum
|
|||
|
||||
void Prg_ShowCourseProgram (void);
|
||||
|
||||
bool Prg_CheckIfICanCreateItems (void);
|
||||
void Prg_PutParams (void *ItmCod);
|
||||
void Prg_RequestCreateItem (void);
|
||||
void Prg_RequestChangeItem (void);
|
||||
void Prg_ReceiveFormNewItem (void);
|
||||
|
|
|
@ -255,6 +255,59 @@ void Prg_DB_GetItemTxt (long ItmCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
|||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get list of item resources from database *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Prg_DB_GetListResources (MYSQL_RES **mysql_res,long ItmCod)
|
||||
{
|
||||
static const char *HiddenSubQuery[Rol_NUM_ROLES] =
|
||||
{
|
||||
[Rol_UNK ] = " AND Hidden='N'",
|
||||
[Rol_GST ] = " AND Hidden='N'",
|
||||
[Rol_USR ] = " AND Hidden='N'",
|
||||
[Rol_STD ] = " AND Hidden='N'",
|
||||
[Rol_NET ] = " AND Hidden='N'",
|
||||
[Rol_TCH ] = "",
|
||||
[Rol_DEG_ADM] = " AND Hidden='N'",
|
||||
[Rol_CTR_ADM] = " AND Hidden='N'",
|
||||
[Rol_INS_ADM] = " AND Hidden='N'",
|
||||
[Rol_SYS_ADM] = "",
|
||||
};
|
||||
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get item resources",
|
||||
"SELECT ItmCod," // row[0]
|
||||
"RscCod," // row[1]
|
||||
"Hidden," // row[2]
|
||||
"Title" // row[3]
|
||||
" FROM prg_resources"
|
||||
" WHERE ItmCod=%ld"
|
||||
"%s"
|
||||
" ORDER BY RscInd",
|
||||
ItmCod,
|
||||
HiddenSubQuery[Gbl.Usrs.Me.Role.Logged]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get item resource data using its code ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Prg_DB_GetDataOfResourceByCod (MYSQL_RES **mysql_res,
|
||||
long ItmCod,long RscCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get item resource data",
|
||||
"SELECT ItmCod," // row[0]
|
||||
"RscCod," // row[1]
|
||||
"Hidden," // row[2]
|
||||
"Title" // row[3]
|
||||
" FROM prg_resources"
|
||||
" WHERE RscCod=%ld"
|
||||
" AND ItmCod=%ld", // Extra check
|
||||
RscCod,ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get number of courses with program items *****************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -47,6 +47,11 @@ void Prg_DB_MoveLeftRightItemRange (const struct Prg_ItemRange *ToMove,
|
|||
unsigned Prg_DB_GetListItems (MYSQL_RES **mysql_res);
|
||||
unsigned Prg_DB_GetDataOfItemByCod (MYSQL_RES **mysql_res,long ItmCod);
|
||||
void Prg_DB_GetItemTxt (long ItmCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
|
||||
unsigned Prg_DB_GetListResources (MYSQL_RES **mysql_res,long ItmCod);
|
||||
unsigned Prg_DB_GetDataOfResourceByCod (MYSQL_RES **mysql_res,
|
||||
long ItmCod,long RscCod);
|
||||
|
||||
unsigned Prg_DB_GetNumCoursesWithItems (HieLvl_Level_t Scope);
|
||||
unsigned Prg_DB_GetNumItems (HieLvl_Level_t Scope);
|
||||
|
||||
|
|
|
@ -0,0 +1,377 @@
|
|||
// swad_program.c: course program
|
||||
|
||||
/*
|
||||
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-2021 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// #define _GNU_SOURCE // For asprintf
|
||||
// #include <linux/limits.h> // For PATH_MAX
|
||||
// #include <stddef.h> // For NULL
|
||||
// #include <stdio.h> // For asprintf
|
||||
// #include <stdlib.h> // For calloc
|
||||
// #include <string.h> // For string functions
|
||||
|
||||
// #include "swad_autolink.h"
|
||||
// #include "swad_box.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_photo.h"
|
||||
#include "swad_program.h"
|
||||
#include "swad_program_database.h"
|
||||
#include "swad_program_resource.h"
|
||||
// #include "swad_role.h"
|
||||
// #include "swad_setting.h"
|
||||
// #include "swad_string.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
extern struct Globals Gbl;
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
#define Prg_NUM_TYPES_FORMS 3
|
||||
typedef enum
|
||||
{
|
||||
Prg_DONT_PUT_FORM_ITEM,
|
||||
Prg_PUT_FORM_CREATE_ITEM,
|
||||
Prg_PUT_FORM_CHANGE_ITEM,
|
||||
} Prg_CreateOrChangeItem_t;
|
||||
|
||||
#define Prg_NUM_MOVEMENTS_UP_DOWN 2
|
||||
typedef enum
|
||||
{
|
||||
Prg_MOVE_UP,
|
||||
Prg_MOVE_DOWN,
|
||||
} Prg_MoveUpDown_t;
|
||||
|
||||
struct Level
|
||||
{
|
||||
unsigned Number; // Numbers for each level from 1 to maximum level
|
||||
bool Hidden; // If each level from 1 to maximum level is hidden
|
||||
};
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
static struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool IsRead; // Is the list already read from database...
|
||||
// ...or it needs to be read?
|
||||
unsigned NumItems; // Number of items
|
||||
struct Prg_ItemHierarchy *Items; // List of items
|
||||
} List;
|
||||
unsigned MaxLevel; // Maximum level of items
|
||||
struct Level *Levels; // Numbers and hidden for each level from 1 to maximum level
|
||||
} Prg_Gbl =
|
||||
{
|
||||
.List =
|
||||
{
|
||||
.IsRead = false,
|
||||
.NumItems = 0,
|
||||
.Items = NULL,
|
||||
},
|
||||
.MaxLevel = 0,
|
||||
.Levels = NULL
|
||||
};
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutIconsListResources (__attribute__((unused)) void *Args);
|
||||
static void PrgSrc_PutIconToCreateNewResource (long ItmCod);
|
||||
static void PrgRsc_PutButtonToCreateNewResource (long ItmCod);
|
||||
|
||||
static void PrgRsc_GetDataOfResourceByCod (struct PrgRsc_Resource *Resource);
|
||||
static void PrgRsc_GetDataOfResource (struct PrgRsc_Resource *Resource,
|
||||
MYSQL_RES **mysql_res);
|
||||
static void PrgRsc_ResetResource (struct PrgRsc_Resource *Resource);
|
||||
static void PrgRsc_WriteRowResource (unsigned NumRsc,struct PrgRsc_Resource *Resource,
|
||||
bool PrintView);
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Show all program items ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_ShowAllResources (long ItmCod)
|
||||
{
|
||||
extern const char *Hlp_COURSE_Program;
|
||||
extern const char *Txt_Resources;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumRsc;
|
||||
unsigned NumResources;
|
||||
struct PrgRsc_Resource Resource;
|
||||
|
||||
/***** Trivial check *****/
|
||||
if (ItmCod <= 0)
|
||||
return;
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin ("100%",Txt_Resources,
|
||||
PrgRsc_PutIconsListResources,&ItmCod,
|
||||
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Get list of item resources from database *****/
|
||||
NumResources = Prg_DB_GetListResources (&mysql_res,ItmCod); // Resources found...
|
||||
|
||||
/***** Table *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (2);
|
||||
HTM_TBODY_Begin (NULL); // 1st tbody start
|
||||
|
||||
/***** Write all item resources *****/
|
||||
for (NumRsc = 1;
|
||||
NumRsc <= NumResources;
|
||||
NumRsc++)
|
||||
{
|
||||
/* Get data of this item resource */
|
||||
PrgRsc_GetDataOfResource (&Resource,&mysql_res);
|
||||
|
||||
/* Show item */
|
||||
PrgRsc_WriteRowResource (NumRsc,&Resource,false); // Not print view
|
||||
|
||||
/* Show form to create/change item */
|
||||
/*
|
||||
if (Item.Hierarchy.ItmCod == ItmCodBeforeForm)
|
||||
switch (CreateOrChangeItem)
|
||||
{
|
||||
case Prg_DONT_PUT_FORM_ITEM:
|
||||
break;
|
||||
case Prg_PUT_FORM_CREATE_ITEM:
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CREATE_ITEM,
|
||||
ParentItmCod,FormLevel);
|
||||
break;
|
||||
case Prg_PUT_FORM_CHANGE_ITEM:
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
ItmCodBeforeForm,FormLevel);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/***** Create item at the end? *****/
|
||||
/*
|
||||
if (ItmCodBeforeForm <= 0 && CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM)
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CREATE_ITEM,-1L,1);
|
||||
*/
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TBODY_End (); // 3rd tbody end
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/***** Button to create a new program item *****/
|
||||
if (Prg_CheckIfICanCreateItems ())
|
||||
PrgRsc_PutButtonToCreateNewResource (ItmCod);
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Put contextual icons in list of item resources ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutIconsListResources (void *ItmCod)
|
||||
{
|
||||
/***** Put icon to create a new item resource *****/
|
||||
if (ItmCod)
|
||||
if (*((long *) ItmCod) > 0)
|
||||
if (Prg_CheckIfICanCreateItems ())
|
||||
PrgSrc_PutIconToCreateNewResource (*((long *) ItmCod));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Put icon to create a new program item ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgSrc_PutIconToCreateNewResource (long ItmCod)
|
||||
{
|
||||
Ico_PutContextualIconToAdd (ActFrmNewPrgRsc,"rsc_form",
|
||||
Prg_PutParams,&ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Put button to create a new item resource ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutButtonToCreateNewResource (long ItmCod)
|
||||
{
|
||||
extern const char *Txt_New_resource;
|
||||
|
||||
Frm_BeginFormAnchor (ActFrmNewPrgRsc,"rsc_form");
|
||||
Prg_PutParams (&ItmCod);
|
||||
Btn_PutConfirmButton (Txt_New_resource);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Put a form to create/edit program resource and show current resources ***/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_RequestCreateResource (void)
|
||||
{
|
||||
// unsigned NumItem;
|
||||
// long ItmCodBeforeForm;
|
||||
// unsigned FormLevel;
|
||||
// struct Prg_Item Item;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
// Prg_GetListItems ();
|
||||
|
||||
/***** Get data of the item from database *****/
|
||||
// Item.Hierarchy.ItmCod = Prg_GetParamItmCod ();
|
||||
// Prg_GetDataOfItemByCod (&Item);
|
||||
// if (Item.Hierarchy.ItmCod <= 0)
|
||||
// Err_WrongItemExit ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
// Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
// Prg_ShowAllItems (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
// &ToHighlight,ParentItmCod,ItmCodBeforeForm,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
// Prg_FreeListItems ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get item resource data using its code ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_GetDataOfResourceByCod (struct PrgRsc_Resource *Resource)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
|
||||
/***** Clear all item resource data *****/
|
||||
PrgRsc_ResetResource (Resource);
|
||||
|
||||
if (Resource->RscCod > 0)
|
||||
{
|
||||
/***** Get data of item resource *****/
|
||||
if (Prg_DB_GetDataOfResourceByCod (&mysql_res,
|
||||
Resource->ItmCod,
|
||||
Resource->RscCod))
|
||||
PrgRsc_GetDataOfResource (Resource,&mysql_res);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Get item resource data ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_GetDataOfResource (struct PrgRsc_Resource *Resource,
|
||||
MYSQL_RES **mysql_res)
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
|
||||
/***** Get data of item resource from database *****/
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (*mysql_res);
|
||||
/*
|
||||
ItmCod row[0]
|
||||
RscCod row[1]
|
||||
Hidden row[2]
|
||||
Title row[3]
|
||||
*/
|
||||
/* Get code of the program item (row[0]) */
|
||||
Resource->ItmCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get code of the item resource (row[1]) */
|
||||
Resource->RscCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
|
||||
/* Get whether the program item is hidden (row(2)) */
|
||||
Resource->Hidden = (row[2][0] == 'Y');
|
||||
|
||||
/* Get the title of the item resource (row[3]) */
|
||||
Str_Copy (Resource->Title,row[3],sizeof (Resource->Title) - 1);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Clear all item resource data ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_ResetResource (struct PrgRsc_Resource *Resource)
|
||||
{
|
||||
Resource->Hidden = false;
|
||||
Resource->Title[0] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Show one program item ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteRowResource (unsigned NumRsc,struct PrgRsc_Resource *Resource,
|
||||
bool PrintView)
|
||||
{
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this item resource *****/
|
||||
if (!PrintView)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"",The_GetColorRows ());
|
||||
// Prg_PutFormsToRemEditOneItem (NumItem,Item);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM RT %s\"",The_GetColorRows ());
|
||||
HTM_Unsigned (NumRsc);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title and text *****/
|
||||
/* Begin title and text */
|
||||
if (PrintView)
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN\"");
|
||||
else
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN %s\"",The_GetColorRows ());
|
||||
|
||||
/* Title */
|
||||
HTM_DIV_Begin ("class=\"DAT\"");
|
||||
HTM_Txt (Resource->Title);
|
||||
HTM_DIV_End ();
|
||||
|
||||
/* End title and text */
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** End row *****/
|
||||
HTM_TR_End ();
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
// swad_program_resource.h: course program (resources)
|
||||
|
||||
#ifndef _SWAD_PRG_RSC
|
||||
#define _SWAD_PRG_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-2021 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// #include <stdbool.h> // For boolean type
|
||||
// #include <time.h> // For time
|
||||
|
||||
// #include "swad_database.h"
|
||||
// #include "swad_date.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE (128 - 1) // 127
|
||||
#define PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE ((PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
/*
|
||||
struct Prg_ItemHierarchy
|
||||
{
|
||||
long ItmCod;
|
||||
unsigned Index;
|
||||
unsigned Level;
|
||||
bool Hidden;
|
||||
};
|
||||
*/
|
||||
struct PrgRsc_Resource
|
||||
{
|
||||
long ItmCod;
|
||||
long RscCod;
|
||||
bool Hidden;
|
||||
char Title[PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE + 1];
|
||||
};
|
||||
/*
|
||||
struct Prg_ItemRange
|
||||
{
|
||||
unsigned Begin; // Index of the first item in the subtree
|
||||
unsigned End; // Index of the last item in the subtree
|
||||
};
|
||||
|
||||
#define Prg_NUM_MOVEMENTS_LEFT_RIGHT 2
|
||||
typedef enum
|
||||
{
|
||||
Prg_MOVE_LEFT,
|
||||
Prg_MOVE_RIGHT,
|
||||
} Prg_MoveLeftRight_t;
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_ShowAllResources (long ItmCod);
|
||||
void PrgRsc_RequestCreateResource (void);
|
||||
|
||||
#endif
|
90
swad_text.c
90
swad_text.c
|
@ -2634,7 +2634,7 @@ const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME] =
|
|||
#elif L==9 // pt
|
||||
"Início"
|
||||
#elif L==10 // tr
|
||||
"Start" // Çeviri lazim!
|
||||
"Başlama"
|
||||
#endif
|
||||
,
|
||||
[Dat_END_TIME] =
|
||||
|
@ -2657,7 +2657,7 @@ const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME] =
|
|||
#elif L==9 // pt
|
||||
"Fim"
|
||||
#elif L==10 // tr
|
||||
"End" // Çeviri lazim!
|
||||
"Son"
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -2773,7 +2773,7 @@ const char *Txt_Availability =
|
|||
#elif L==9 // pt
|
||||
"Disponibilidade";
|
||||
#elif L==10 // tr
|
||||
"Availability"; // Çeviri lazim!
|
||||
"Bulunma";
|
||||
#endif
|
||||
|
||||
const char *Txt_average =
|
||||
|
@ -2796,7 +2796,7 @@ const char *Txt_average =
|
|||
#elif L==9 // pt
|
||||
"média";
|
||||
#elif L==10 // tr
|
||||
"average"; // Çeviri lazim!
|
||||
"ortalama";
|
||||
#endif
|
||||
|
||||
const char *Txt_Average_number_BR_of_ASSIG_BR_per_course =
|
||||
|
@ -3213,7 +3213,7 @@ const char *Txt_Banner =
|
|||
#elif L==9 // pt
|
||||
"Banner";
|
||||
#elif L==10 // tr
|
||||
"Banner"; // Çeviri lazim!
|
||||
"Afiş";
|
||||
#endif
|
||||
|
||||
const char *Txt_Banner_X_removed = // Warning: it is very important to include %s in the following sentences
|
||||
|
@ -3259,7 +3259,7 @@ const char *Txt_Banners =
|
|||
#elif L==9 // pt
|
||||
"Banners";
|
||||
#elif L==10 // tr
|
||||
"Banners"; // Çeviri lazim!
|
||||
"Afişler";
|
||||
#endif
|
||||
|
||||
const char *Txt_Basic_public_profile =
|
||||
|
@ -3457,11 +3457,11 @@ const char *Txt_Briefcases =
|
|||
#elif L==7 // it
|
||||
"Penna USB";
|
||||
#elif L==8 // pl
|
||||
"Briefcases"; // Potrzebujesz tlumaczenie
|
||||
"Teczki";
|
||||
#elif L==9 // pt
|
||||
"Pasta";
|
||||
#elif L==10 // tr
|
||||
"Briefcases"; // Çeviri lazim!
|
||||
"Evrak çantaları";
|
||||
#endif
|
||||
|
||||
const char *Txt_Building =
|
||||
|
@ -3484,7 +3484,7 @@ const char *Txt_Building =
|
|||
#elif L==9 // pt
|
||||
"Edifício";
|
||||
#elif L==10 // tr
|
||||
"Building"; // Çeviri lazim!
|
||||
"Bina";
|
||||
#endif
|
||||
|
||||
const char *Txt_Building_X_removed = // Warning: it is very important to include %s in the following sentences
|
||||
|
@ -3604,7 +3604,7 @@ const char *Txt_BUILDINGS_ORDER[Bld_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Nome abreviado"
|
||||
#elif L==10 // tr
|
||||
"Short name" // Çeviri lazim!
|
||||
"Kısa isim"
|
||||
#endif
|
||||
,
|
||||
[Bld_ORDER_BY_FULL_NAME] =
|
||||
|
@ -3627,7 +3627,7 @@ const char *Txt_BUILDINGS_ORDER[Bld_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Nome completo"
|
||||
#elif L==10 // tr
|
||||
"Full name" // Çeviri lazim!
|
||||
"Tam isim"
|
||||
#endif
|
||||
,
|
||||
[Bld_ORDER_BY_LOCATION] =
|
||||
|
@ -13096,7 +13096,7 @@ const char *Txt_EXAMS_ORDER[Exa_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Início"
|
||||
#elif L==10 // tr
|
||||
"Start" // Çeviri lazim!
|
||||
"Başlama"
|
||||
#endif
|
||||
,
|
||||
[Exa_ORDER_BY_END_DATE] =
|
||||
|
@ -13119,7 +13119,7 @@ const char *Txt_EXAMS_ORDER[Exa_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Fim"
|
||||
#elif L==10 // tr
|
||||
"End" // Çeviri lazim!
|
||||
"Son"
|
||||
#endif
|
||||
,
|
||||
[Exa_ORDER_BY_TITLE] =
|
||||
|
@ -15458,7 +15458,7 @@ const char *Txt_Full_name =
|
|||
#elif L==9 // pt
|
||||
"Nome completo";
|
||||
#elif L==10 // tr
|
||||
"Full name"; // Çeviri lazim!
|
||||
"Tam isim";
|
||||
#endif
|
||||
|
||||
const char *Txt_Full_name_of_the_degree =
|
||||
|
@ -15667,7 +15667,7 @@ const char *Txt_GAMES_ORDER[Gam_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Início"
|
||||
#elif L==10 // tr
|
||||
"Start" // Çeviri lazim!
|
||||
"Başlama"
|
||||
#endif
|
||||
,
|
||||
[Gam_ORDER_BY_END_DATE] =
|
||||
|
@ -15690,7 +15690,7 @@ const char *Txt_GAMES_ORDER[Gam_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Fim"
|
||||
#elif L==10 // tr
|
||||
"End" // Çeviri lazim!
|
||||
"Son"
|
||||
#endif
|
||||
,
|
||||
[Gam_ORDER_BY_TITLE] =
|
||||
|
@ -20376,7 +20376,7 @@ const char *Txt_MATCH_End =
|
|||
#elif L==9 // pt
|
||||
"Fim";
|
||||
#elif L==10 // tr
|
||||
"End"; // Çeviri lazim!
|
||||
"Son";
|
||||
#endif
|
||||
|
||||
const char *Txt_MATCH_Paused =
|
||||
|
@ -20468,7 +20468,7 @@ const char *Txt_MATCH_Start =
|
|||
#elif L==9 // pt
|
||||
"Início";
|
||||
#elif L==10 // tr
|
||||
"Start"; // Çeviri lazim!
|
||||
"Başlama";
|
||||
#endif
|
||||
|
||||
const char *Txt_Match_X_removed = // Warning: it is very important to include %s in the following sentences
|
||||
|
@ -25339,6 +25339,29 @@ const char *Txt_New_record_field =
|
|||
"New record field"; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_New_resource =
|
||||
#if L==1 // ca
|
||||
"Nou recurs";
|
||||
#elif L==2 // de
|
||||
"Neue Ressource";
|
||||
#elif L==3 // en
|
||||
"New resource";
|
||||
#elif L==4 // es
|
||||
"Nuevo recurso";
|
||||
#elif L==5 // fr
|
||||
"Nouvelle ressource";
|
||||
#elif L==6 // gn
|
||||
"Nuevo recurso"; // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"Nuova risorsa";
|
||||
#elif L==8 // pl
|
||||
"Nowy zasób";
|
||||
#elif L==9 // pt
|
||||
"Novo recurso";
|
||||
#elif L==10 // tr
|
||||
"Yeni kaynak";
|
||||
#endif
|
||||
|
||||
const char *Txt_New_room =
|
||||
#if L==1 // ca
|
||||
"Nova sala";
|
||||
|
@ -35579,6 +35602,29 @@ const char *Txt_Reset_survey =
|
|||
"Reset survey"; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_Resources =
|
||||
#if L==1 // ca
|
||||
"Recursos";
|
||||
#elif L==2 // de
|
||||
"Ressourcen";
|
||||
#elif L==3 // en
|
||||
"Resources";
|
||||
#elif L==4 // es
|
||||
"Recursos";
|
||||
#elif L==5 // fr
|
||||
"Ressources";
|
||||
#elif L==6 // gn
|
||||
"Recursos"; // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"Risorse";
|
||||
#elif L==8 // pl
|
||||
"Zasoby";
|
||||
#elif L==9 // pt
|
||||
"Recursos";
|
||||
#elif L==10 // tr
|
||||
"Kaynaklar";
|
||||
#endif
|
||||
|
||||
const char *Txt_Result =
|
||||
#if L==1 // ca
|
||||
"Resultat";
|
||||
|
@ -40314,7 +40360,7 @@ const char *Txt_ROOMS_ORDER[Roo_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Nome abreviado"
|
||||
#elif L==10 // tr
|
||||
"Short name" // Çeviri lazim!
|
||||
"Kısa isim"
|
||||
#endif
|
||||
,
|
||||
[Roo_ORDER_BY_FULL_NAME] =
|
||||
|
@ -40337,7 +40383,7 @@ const char *Txt_ROOMS_ORDER[Roo_NUM_ORDERS] =
|
|||
#elif L==9 // pt
|
||||
"Nome completo"
|
||||
#elif L==10 // tr
|
||||
"Full name" // Çeviri lazim!
|
||||
"Tam isim"
|
||||
#endif
|
||||
,
|
||||
[Roo_ORDER_BY_CAPACITY] =
|
||||
|
@ -43115,7 +43161,7 @@ const char *Txt_Short_name =
|
|||
#elif L==9 // pt
|
||||
"Nome abreviado";
|
||||
#elif L==10 // tr
|
||||
"Short name"; // Çeviri lazim!
|
||||
"Kısa isim";
|
||||
#endif
|
||||
|
||||
const char *Txt_Short_name_of_the_degree =
|
||||
|
@ -45899,7 +45945,7 @@ const char *Txt_Start = // As a verb
|
|||
#elif L==9 // pt
|
||||
"Começar";
|
||||
#elif L==10 // tr
|
||||
"Start"; // Çeviri lazim!
|
||||
"Başlama";
|
||||
#endif
|
||||
|
||||
const char *Txt_Statistic =
|
||||
|
|
Loading…
Reference in New Issue