mirror of https://github.com/acanas/swad-core.git
Version 21.114: Jul 25, 2022 New form and action to create item resource.
This commit is contained in:
parent
64896a0f1d
commit
7ae0917363
|
@ -57,7 +57,7 @@ void ID_DB_InsertANewUsrID (long UsrCod,
|
|||
|
||||
void ID_DB_ConfirmUsrID (long UsrCod,const char ID[ID_MAX_BYTES_USR_ID + 1])
|
||||
{
|
||||
DB_QueryINSERT ("can not confirm a user's ID",
|
||||
DB_QueryUPDATE ("can not confirm a user's ID",
|
||||
"UPDATE usr_ids"
|
||||
" SET Confirmed='Y'"
|
||||
" WHERE UsrCod=%ld"
|
||||
|
|
|
@ -446,6 +446,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
|
||||
[ActFrmSeePrgRsc ] = {1925,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_ViewResourcesAfterEdit ,NULL},
|
||||
[ActFrmEdiPrgRsc ] = {1918,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_EditResources ,NULL},
|
||||
[ActNewPrgRsc ] = {1929,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_CreateResource ,NULL},
|
||||
[ActRenPrgRsc ] = {1928,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_RenameResource ,NULL},
|
||||
[ActReqRemPrgRsc ] = {1919,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_ReqRemResource ,NULL},
|
||||
[ActRemPrgRsc ] = {1920,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_RemoveResource ,NULL},
|
||||
|
@ -3767,6 +3768,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActEdiPrg, // #1926
|
||||
ActSeePrgItm, // #1927
|
||||
ActRenPrgRsc, // #1928
|
||||
ActNewPrgRsc, // #1929
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
209
swad_action.h
209
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 1928
|
||||
#define Act_MAX_ACTION_COD 1929
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
||||
|
||||
|
@ -412,114 +412,115 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActRgtPrgItm (ActChgCrsSta + 29)
|
||||
#define ActFrmSeePrgRsc (ActChgCrsSta + 30)
|
||||
#define ActFrmEdiPrgRsc (ActChgCrsSta + 31)
|
||||
#define ActRenPrgRsc (ActChgCrsSta + 32)
|
||||
#define ActReqRemPrgRsc (ActChgCrsSta + 33)
|
||||
#define ActRemPrgRsc (ActChgCrsSta + 34)
|
||||
#define ActHidPrgRsc (ActChgCrsSta + 35)
|
||||
#define ActUnhPrgRsc (ActChgCrsSta + 36)
|
||||
#define ActUp_PrgRsc (ActChgCrsSta + 37)
|
||||
#define ActDwnPrgRsc (ActChgCrsSta + 38)
|
||||
#define ActEdiTchGui (ActChgCrsSta + 39)
|
||||
#define ActSeeSylLec (ActChgCrsSta + 40)
|
||||
#define ActSeeSylPra (ActChgCrsSta + 41)
|
||||
#define ActEdiSylLec (ActChgCrsSta + 42)
|
||||
#define ActEdiSylPra (ActChgCrsSta + 43)
|
||||
#define ActDelItmSylLec (ActChgCrsSta + 44)
|
||||
#define ActDelItmSylPra (ActChgCrsSta + 45)
|
||||
#define ActUp_IteSylLec (ActChgCrsSta + 46)
|
||||
#define ActUp_IteSylPra (ActChgCrsSta + 47)
|
||||
#define ActDwnIteSylLec (ActChgCrsSta + 48)
|
||||
#define ActDwnIteSylPra (ActChgCrsSta + 49)
|
||||
#define ActRgtIteSylLec (ActChgCrsSta + 50)
|
||||
#define ActRgtIteSylPra (ActChgCrsSta + 51)
|
||||
#define ActLftIteSylLec (ActChgCrsSta + 52)
|
||||
#define ActLftIteSylPra (ActChgCrsSta + 53)
|
||||
#define ActInsIteSylLec (ActChgCrsSta + 54)
|
||||
#define ActInsIteSylPra (ActChgCrsSta + 55)
|
||||
#define ActModIteSylLec (ActChgCrsSta + 56)
|
||||
#define ActModIteSylPra (ActChgCrsSta + 57)
|
||||
#define ActNewPrgRsc (ActChgCrsSta + 32)
|
||||
#define ActRenPrgRsc (ActChgCrsSta + 33)
|
||||
#define ActReqRemPrgRsc (ActChgCrsSta + 34)
|
||||
#define ActRemPrgRsc (ActChgCrsSta + 35)
|
||||
#define ActHidPrgRsc (ActChgCrsSta + 36)
|
||||
#define ActUnhPrgRsc (ActChgCrsSta + 37)
|
||||
#define ActUp_PrgRsc (ActChgCrsSta + 38)
|
||||
#define ActDwnPrgRsc (ActChgCrsSta + 39)
|
||||
#define ActEdiTchGui (ActChgCrsSta + 40)
|
||||
#define ActSeeSylLec (ActChgCrsSta + 41)
|
||||
#define ActSeeSylPra (ActChgCrsSta + 42)
|
||||
#define ActEdiSylLec (ActChgCrsSta + 43)
|
||||
#define ActEdiSylPra (ActChgCrsSta + 44)
|
||||
#define ActDelItmSylLec (ActChgCrsSta + 45)
|
||||
#define ActDelItmSylPra (ActChgCrsSta + 46)
|
||||
#define ActUp_IteSylLec (ActChgCrsSta + 47)
|
||||
#define ActUp_IteSylPra (ActChgCrsSta + 48)
|
||||
#define ActDwnIteSylLec (ActChgCrsSta + 49)
|
||||
#define ActDwnIteSylPra (ActChgCrsSta + 50)
|
||||
#define ActRgtIteSylLec (ActChgCrsSta + 51)
|
||||
#define ActRgtIteSylPra (ActChgCrsSta + 52)
|
||||
#define ActLftIteSylLec (ActChgCrsSta + 53)
|
||||
#define ActLftIteSylPra (ActChgCrsSta + 54)
|
||||
#define ActInsIteSylLec (ActChgCrsSta + 55)
|
||||
#define ActInsIteSylPra (ActChgCrsSta + 56)
|
||||
#define ActModIteSylLec (ActChgCrsSta + 57)
|
||||
#define ActModIteSylPra (ActChgCrsSta + 58)
|
||||
|
||||
#define ActEdiBib (ActChgCrsSta + 58)
|
||||
#define ActEdiFAQ (ActChgCrsSta + 59)
|
||||
#define ActEdiCrsLnk (ActChgCrsSta + 60)
|
||||
#define ActEdiBib (ActChgCrsSta + 59)
|
||||
#define ActEdiFAQ (ActChgCrsSta + 60)
|
||||
#define ActEdiCrsLnk (ActChgCrsSta + 61)
|
||||
|
||||
#define ActChgFrcReaCrsInf (ActChgCrsSta + 61)
|
||||
#define ActChgFrcReaTchGui (ActChgCrsSta + 62)
|
||||
#define ActChgFrcReaSylLec (ActChgCrsSta + 63)
|
||||
#define ActChgFrcReaSylPra (ActChgCrsSta + 64)
|
||||
#define ActChgFrcReaBib (ActChgCrsSta + 65)
|
||||
#define ActChgFrcReaFAQ (ActChgCrsSta + 66)
|
||||
#define ActChgFrcReaCrsLnk (ActChgCrsSta + 67)
|
||||
#define ActChgFrcReaCrsInf (ActChgCrsSta + 62)
|
||||
#define ActChgFrcReaTchGui (ActChgCrsSta + 63)
|
||||
#define ActChgFrcReaSylLec (ActChgCrsSta + 64)
|
||||
#define ActChgFrcReaSylPra (ActChgCrsSta + 65)
|
||||
#define ActChgFrcReaBib (ActChgCrsSta + 66)
|
||||
#define ActChgFrcReaFAQ (ActChgCrsSta + 67)
|
||||
#define ActChgFrcReaCrsLnk (ActChgCrsSta + 68)
|
||||
|
||||
#define ActChgHavReaCrsInf (ActChgCrsSta + 68)
|
||||
#define ActChgHavReaTchGui (ActChgCrsSta + 69)
|
||||
#define ActChgHavReaSylLec (ActChgCrsSta + 70)
|
||||
#define ActChgHavReaSylPra (ActChgCrsSta + 71)
|
||||
#define ActChgHavReaBib (ActChgCrsSta + 72)
|
||||
#define ActChgHavReaFAQ (ActChgCrsSta + 73)
|
||||
#define ActChgHavReaCrsLnk (ActChgCrsSta + 74)
|
||||
#define ActChgHavReaCrsInf (ActChgCrsSta + 69)
|
||||
#define ActChgHavReaTchGui (ActChgCrsSta + 70)
|
||||
#define ActChgHavReaSylLec (ActChgCrsSta + 71)
|
||||
#define ActChgHavReaSylPra (ActChgCrsSta + 72)
|
||||
#define ActChgHavReaBib (ActChgCrsSta + 73)
|
||||
#define ActChgHavReaFAQ (ActChgCrsSta + 74)
|
||||
#define ActChgHavReaCrsLnk (ActChgCrsSta + 75)
|
||||
|
||||
#define ActSelInfSrcCrsInf (ActChgCrsSta + 75)
|
||||
#define ActSelInfSrcTchGui (ActChgCrsSta + 76)
|
||||
#define ActSelInfSrcSylLec (ActChgCrsSta + 77)
|
||||
#define ActSelInfSrcSylPra (ActChgCrsSta + 78)
|
||||
#define ActSelInfSrcBib (ActChgCrsSta + 79)
|
||||
#define ActSelInfSrcFAQ (ActChgCrsSta + 80)
|
||||
#define ActSelInfSrcCrsLnk (ActChgCrsSta + 81)
|
||||
#define ActRcvURLCrsInf (ActChgCrsSta + 82)
|
||||
#define ActRcvURLTchGui (ActChgCrsSta + 83)
|
||||
#define ActRcvURLSylLec (ActChgCrsSta + 84)
|
||||
#define ActRcvURLSylPra (ActChgCrsSta + 85)
|
||||
#define ActRcvURLBib (ActChgCrsSta + 86)
|
||||
#define ActRcvURLFAQ (ActChgCrsSta + 87)
|
||||
#define ActRcvURLCrsLnk (ActChgCrsSta + 88)
|
||||
#define ActRcvPagCrsInf (ActChgCrsSta + 89)
|
||||
#define ActRcvPagTchGui (ActChgCrsSta + 90)
|
||||
#define ActRcvPagSylLec (ActChgCrsSta + 91)
|
||||
#define ActRcvPagSylPra (ActChgCrsSta + 92)
|
||||
#define ActRcvPagBib (ActChgCrsSta + 93)
|
||||
#define ActRcvPagFAQ (ActChgCrsSta + 94)
|
||||
#define ActRcvPagCrsLnk (ActChgCrsSta + 95)
|
||||
#define ActEditorCrsInf (ActChgCrsSta + 96)
|
||||
#define ActEditorTchGui (ActChgCrsSta + 97)
|
||||
#define ActEditorSylLec (ActChgCrsSta + 98)
|
||||
#define ActEditorSylPra (ActChgCrsSta + 99)
|
||||
#define ActEditorBib (ActChgCrsSta + 100)
|
||||
#define ActEditorFAQ (ActChgCrsSta + 101)
|
||||
#define ActEditorCrsLnk (ActChgCrsSta + 102)
|
||||
#define ActPlaTxtEdiCrsInf (ActChgCrsSta + 103)
|
||||
#define ActPlaTxtEdiTchGui (ActChgCrsSta + 104)
|
||||
#define ActPlaTxtEdiSylLec (ActChgCrsSta + 105)
|
||||
#define ActPlaTxtEdiSylPra (ActChgCrsSta + 106)
|
||||
#define ActPlaTxtEdiBib (ActChgCrsSta + 107)
|
||||
#define ActPlaTxtEdiFAQ (ActChgCrsSta + 108)
|
||||
#define ActPlaTxtEdiCrsLnk (ActChgCrsSta + 109)
|
||||
#define ActRchTxtEdiCrsInf (ActChgCrsSta + 110)
|
||||
#define ActRchTxtEdiTchGui (ActChgCrsSta + 111)
|
||||
#define ActRchTxtEdiSylLec (ActChgCrsSta + 112)
|
||||
#define ActRchTxtEdiSylPra (ActChgCrsSta + 113)
|
||||
#define ActRchTxtEdiBib (ActChgCrsSta + 114)
|
||||
#define ActRchTxtEdiFAQ (ActChgCrsSta + 115)
|
||||
#define ActRchTxtEdiCrsLnk (ActChgCrsSta + 116)
|
||||
#define ActRcvPlaTxtCrsInf (ActChgCrsSta + 117)
|
||||
#define ActRcvPlaTxtTchGui (ActChgCrsSta + 118)
|
||||
#define ActRcvPlaTxtSylLec (ActChgCrsSta + 119)
|
||||
#define ActRcvPlaTxtSylPra (ActChgCrsSta + 120)
|
||||
#define ActRcvPlaTxtBib (ActChgCrsSta + 121)
|
||||
#define ActRcvPlaTxtFAQ (ActChgCrsSta + 122)
|
||||
#define ActRcvPlaTxtCrsLnk (ActChgCrsSta + 123)
|
||||
#define ActRcvRchTxtCrsInf (ActChgCrsSta + 124)
|
||||
#define ActRcvRchTxtTchGui (ActChgCrsSta + 125)
|
||||
#define ActRcvRchTxtSylLec (ActChgCrsSta + 126)
|
||||
#define ActRcvRchTxtSylPra (ActChgCrsSta + 127)
|
||||
#define ActRcvRchTxtBib (ActChgCrsSta + 128)
|
||||
#define ActRcvRchTxtFAQ (ActChgCrsSta + 129)
|
||||
#define ActRcvRchTxtCrsLnk (ActChgCrsSta + 130)
|
||||
#define ActSelInfSrcCrsInf (ActChgCrsSta + 76)
|
||||
#define ActSelInfSrcTchGui (ActChgCrsSta + 77)
|
||||
#define ActSelInfSrcSylLec (ActChgCrsSta + 78)
|
||||
#define ActSelInfSrcSylPra (ActChgCrsSta + 79)
|
||||
#define ActSelInfSrcBib (ActChgCrsSta + 80)
|
||||
#define ActSelInfSrcFAQ (ActChgCrsSta + 81)
|
||||
#define ActSelInfSrcCrsLnk (ActChgCrsSta + 82)
|
||||
#define ActRcvURLCrsInf (ActChgCrsSta + 83)
|
||||
#define ActRcvURLTchGui (ActChgCrsSta + 84)
|
||||
#define ActRcvURLSylLec (ActChgCrsSta + 85)
|
||||
#define ActRcvURLSylPra (ActChgCrsSta + 86)
|
||||
#define ActRcvURLBib (ActChgCrsSta + 87)
|
||||
#define ActRcvURLFAQ (ActChgCrsSta + 88)
|
||||
#define ActRcvURLCrsLnk (ActChgCrsSta + 89)
|
||||
#define ActRcvPagCrsInf (ActChgCrsSta + 90)
|
||||
#define ActRcvPagTchGui (ActChgCrsSta + 91)
|
||||
#define ActRcvPagSylLec (ActChgCrsSta + 92)
|
||||
#define ActRcvPagSylPra (ActChgCrsSta + 93)
|
||||
#define ActRcvPagBib (ActChgCrsSta + 94)
|
||||
#define ActRcvPagFAQ (ActChgCrsSta + 95)
|
||||
#define ActRcvPagCrsLnk (ActChgCrsSta + 96)
|
||||
#define ActEditorCrsInf (ActChgCrsSta + 97)
|
||||
#define ActEditorTchGui (ActChgCrsSta + 98)
|
||||
#define ActEditorSylLec (ActChgCrsSta + 99)
|
||||
#define ActEditorSylPra (ActChgCrsSta + 100)
|
||||
#define ActEditorBib (ActChgCrsSta + 101)
|
||||
#define ActEditorFAQ (ActChgCrsSta + 102)
|
||||
#define ActEditorCrsLnk (ActChgCrsSta + 103)
|
||||
#define ActPlaTxtEdiCrsInf (ActChgCrsSta + 104)
|
||||
#define ActPlaTxtEdiTchGui (ActChgCrsSta + 105)
|
||||
#define ActPlaTxtEdiSylLec (ActChgCrsSta + 106)
|
||||
#define ActPlaTxtEdiSylPra (ActChgCrsSta + 107)
|
||||
#define ActPlaTxtEdiBib (ActChgCrsSta + 108)
|
||||
#define ActPlaTxtEdiFAQ (ActChgCrsSta + 109)
|
||||
#define ActPlaTxtEdiCrsLnk (ActChgCrsSta + 110)
|
||||
#define ActRchTxtEdiCrsInf (ActChgCrsSta + 111)
|
||||
#define ActRchTxtEdiTchGui (ActChgCrsSta + 112)
|
||||
#define ActRchTxtEdiSylLec (ActChgCrsSta + 113)
|
||||
#define ActRchTxtEdiSylPra (ActChgCrsSta + 114)
|
||||
#define ActRchTxtEdiBib (ActChgCrsSta + 115)
|
||||
#define ActRchTxtEdiFAQ (ActChgCrsSta + 116)
|
||||
#define ActRchTxtEdiCrsLnk (ActChgCrsSta + 117)
|
||||
#define ActRcvPlaTxtCrsInf (ActChgCrsSta + 118)
|
||||
#define ActRcvPlaTxtTchGui (ActChgCrsSta + 119)
|
||||
#define ActRcvPlaTxtSylLec (ActChgCrsSta + 120)
|
||||
#define ActRcvPlaTxtSylPra (ActChgCrsSta + 121)
|
||||
#define ActRcvPlaTxtBib (ActChgCrsSta + 122)
|
||||
#define ActRcvPlaTxtFAQ (ActChgCrsSta + 123)
|
||||
#define ActRcvPlaTxtCrsLnk (ActChgCrsSta + 124)
|
||||
#define ActRcvRchTxtCrsInf (ActChgCrsSta + 125)
|
||||
#define ActRcvRchTxtTchGui (ActChgCrsSta + 126)
|
||||
#define ActRcvRchTxtSylLec (ActChgCrsSta + 127)
|
||||
#define ActRcvRchTxtSylPra (ActChgCrsSta + 128)
|
||||
#define ActRcvRchTxtBib (ActChgCrsSta + 129)
|
||||
#define ActRcvRchTxtFAQ (ActChgCrsSta + 130)
|
||||
#define ActRcvRchTxtCrsLnk (ActChgCrsSta + 131)
|
||||
|
||||
#define ActPrnCrsTT (ActChgCrsSta + 131)
|
||||
#define ActEdiCrsTT (ActChgCrsSta + 132)
|
||||
#define ActChgCrsTT (ActChgCrsSta + 133)
|
||||
#define ActChgCrsTT1stDay (ActChgCrsSta + 134)
|
||||
#define ActPrnCrsTT (ActChgCrsSta + 132)
|
||||
#define ActEdiCrsTT (ActChgCrsSta + 133)
|
||||
#define ActChgCrsTT (ActChgCrsSta + 134)
|
||||
#define ActChgCrsTT1stDay (ActChgCrsSta + 135)
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Assessment tab ********************************/
|
||||
|
|
|
@ -230,7 +230,6 @@ void Agd_DB_RemoveEvent (const struct Agd_Event *AgdEvent)
|
|||
|
||||
long Agd_DB_CreateEvent (const struct Agd_Event *AgdEvent,const char *Txt)
|
||||
{
|
||||
/***** Create a new event *****/
|
||||
return
|
||||
DB_QueryINSERTandReturnCode ("can not create new event",
|
||||
"INSERT INTO agd_agendas"
|
||||
|
|
|
@ -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 21.113 (2022-07-22)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.114 (2022-07-25)"
|
||||
#define CSS_FILE "swad21.107.1.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 21.114: Jul 25, 2022 New form and action to create item resource. (329258 lines)
|
||||
Version 21.113: Jul 22, 2022 New form and action to rename item resource. (329151 lines)
|
||||
Version 21.112.1: Jul 22, 2022 Changes in edition of program items. (329058 lines)
|
||||
Version 21.112: Jul 21, 2022 Code refactoring in hide/unhide icons.
|
||||
|
|
|
@ -148,7 +148,6 @@ static void Prg_GetDataOfItem (struct Prg_Item *Item,
|
|||
MYSQL_RES **mysql_res,
|
||||
unsigned NumRows);
|
||||
static void Prg_ResetItem (struct Prg_Item *Item);
|
||||
static void Prg_PutParamItmCod (long ItmCod);
|
||||
|
||||
static void Prg_HideOrUnhideItem (bool Hide);
|
||||
|
||||
|
@ -1171,7 +1170,7 @@ void Prg_FreeListItems (void)
|
|||
/**************** Write parameter with code of program item ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Prg_PutParamItmCod (long ItmCod)
|
||||
void Prg_PutParamItmCod (long ItmCod)
|
||||
{
|
||||
Par_PutHiddenParamLong (NULL,"ItmCod",ItmCod);
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ void Prg_PutParams (void *ItmCod);
|
|||
|
||||
void Prg_GetListItems (void);
|
||||
void Prg_FreeListItems (void);
|
||||
void Prg_PutParamItmCod (long ItmCod);
|
||||
long Prg_GetParamItmCod (void);
|
||||
unsigned Prg_GetNumItemFromItmCod (long ItmCod);
|
||||
unsigned Prg_GetLevelFromNumItem (unsigned NumItem);
|
||||
|
|
|
@ -425,6 +425,24 @@ void Prg_DB_RemoveCrsItems (long CrsCod)
|
|||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Create a new resource ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
long Prg_DB_CreateResource (const struct PrgRsc_Resource *Resource)
|
||||
{
|
||||
return
|
||||
DB_QueryINSERTandReturnCode ("can not create new resource",
|
||||
"INSERT INTO prg_resources"
|
||||
" (ItmCod,RscInd,Hidden,Title)"
|
||||
" SELECT %ld,COALESCE(MAX(t2.RscInd),0)+1,'N','%s'"
|
||||
" FROM prg_resources AS t2"
|
||||
" WHERE t2.ItmCod=%ld",
|
||||
Resource->ItmCod,
|
||||
Resource->Title,
|
||||
Resource->ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Update resource title **************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -432,18 +450,6 @@ void Prg_DB_RemoveCrsItems (long CrsCod)
|
|||
void Prg_DB_UpdateResourceTitle (long RscCod,long ItmCod,
|
||||
const char NewTitle[PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE + 1])
|
||||
{
|
||||
Ale_ShowAlert (Ale_INFO,
|
||||
"can not update the title of a resource",
|
||||
"UPDATE prg_resources,prg_items"
|
||||
" SET prg_resources.Title='%s'"
|
||||
" WHERE prg_resources.RscCod=%ld"
|
||||
" AND prg_resources.ItmCod=%ld"
|
||||
" AND prg_resources.ItmCod=prg_items.ItmCod"
|
||||
" AND prg_items.CrsCod=%ld",
|
||||
NewTitle,
|
||||
RscCod,
|
||||
ItmCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
DB_QueryUPDATE ("can not update the title of a resource",
|
||||
"UPDATE prg_resources,prg_items"
|
||||
" SET prg_resources.Title='%s'"
|
||||
|
@ -532,6 +538,21 @@ unsigned Prg_DB_GetDataOfResourceByInd (MYSQL_RES **mysql_res,
|
|||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get maximum resource index in an item *******************/
|
||||
/*****************************************************************************/
|
||||
// Resource index can be 1, 2, 3...
|
||||
// Return 0 if no resources
|
||||
/*
|
||||
unsigned Prg_DB_GetMaxRscIndexInItem (long ItmCod)
|
||||
{
|
||||
return DB_QuerySELECTUnsigned ("can not get max resource index",
|
||||
"SELECT MAX(RscInd)"
|
||||
" FROM prg_resources"
|
||||
" WHERE ItmCod=%ld",
|
||||
ItmCod);
|
||||
}
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/************* Get the resource index before/after a given one ***************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -56,6 +56,8 @@ void Prg_DB_RemoveItemRange (const struct Prg_ItemRange *ToRemove);
|
|||
void Prg_DB_RemoveCrsItems (long CrsCod);
|
||||
|
||||
//------------------------------ Resources ------------------------------------
|
||||
long Prg_DB_CreateResource (const struct PrgRsc_Resource *Resource);
|
||||
|
||||
void Prg_DB_UpdateResourceTitle (long RscCod,long ItmCod,
|
||||
const char NewTitle[PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE + 1]);
|
||||
|
||||
|
@ -64,6 +66,7 @@ unsigned Prg_DB_GetListResources (MYSQL_RES **mysql_res,long ItmCod,
|
|||
unsigned Prg_DB_GetDataOfResourceByCod (MYSQL_RES **mysql_res,long RscCod);
|
||||
unsigned Prg_DB_GetDataOfResourceByInd (MYSQL_RES **mysql_res,
|
||||
long ItmCod,unsigned RscInd);
|
||||
// unsigned Prg_DB_GetMaxRscIndexInItem (long ItmCod);
|
||||
unsigned Prg_DB_GetRscIndBefore (long ItmCod,unsigned RscInd);
|
||||
unsigned Prg_DB_GetRscIndAfter (long ItmCod,unsigned RscInd);
|
||||
long Prg_DB_GetRscCodFromRscInd (long ItmCod,unsigned RscInd);
|
||||
|
|
|
@ -74,6 +74,7 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
struct PrgRsc_Resource *Resource);
|
||||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||
struct PrgRsc_Resource *Resource);
|
||||
static void PrgRsc_WriteRowNewResource (long ItmCod,unsigned NumRsc);
|
||||
static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
||||
unsigned NumResources,
|
||||
struct PrgRsc_Resource *Resource);
|
||||
|
@ -255,6 +256,10 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/***** Form to create a new resource *****/
|
||||
if (ListingType == Prg_EDIT_RESOURCES)
|
||||
PrgRsc_WriteRowNewResource (ItmCod,NumResources);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TBODY_End ();
|
||||
HTM_TABLE_End ();
|
||||
|
@ -416,18 +421,18 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this item resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"",The_GetColorRows ());
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LM %s\"",The_GetColorRows ());
|
||||
PrgRsc_PutFormsToRemEditOneResource (NumRsc,NumResources,Resource);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RT %s\"",
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RM %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
HTM_Unsigned (NumRsc + 1);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN %s\"",The_GetColorRows ());
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows ());
|
||||
Frm_BeginFormAnchor (ActRenPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
PrgRsc_PutParamRscCod (Resource->Rsc.Cod);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,Resource->Title,
|
||||
|
@ -441,6 +446,42 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
HTM_TR_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Edit a new item resource **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteRowNewResource (long ItmCod,unsigned NumRsc)
|
||||
{
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this item resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LM %s\"",The_GetColorRows ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RM %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
HTM_Unsigned (NumRsc + 1);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows ());
|
||||
Frm_BeginFormAnchor (ActNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
Prg_PutParamItmCod (ItmCod);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,"",
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"placeholder=\"%s\""
|
||||
" class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
"Nuevo recurso",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** End row *****/
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Put a link (form) to edit one program item *****************/
|
||||
/*****************************************************************************/
|
||||
|
@ -529,6 +570,38 @@ static long PrgRsc_GetParamRscCod (void)
|
|||
{
|
||||
return Par_GetParToLong ("RscCod");
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/******************************** Rename resource ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_CreateResource (void)
|
||||
{
|
||||
struct PrgRsc_Resource Resource;
|
||||
unsigned FormLevel;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
Prg_GetListItems ();
|
||||
|
||||
/***** Get parameters *****/
|
||||
/* Get the code of the program item */
|
||||
if ((Resource.ItmCod = Prg_GetParamItmCod ()) > 0)
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (Resource.ItmCod));
|
||||
else
|
||||
FormLevel = 0;
|
||||
|
||||
/* Get the new title for the new resource */
|
||||
Par_GetParToText ("Title",Resource.Title,PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE);
|
||||
|
||||
/***** Create resource *****/
|
||||
// Resource.Rsc.Ind = Prg_DB_GetMaxRscIndexInItem (Resource.ItmCod) + 1;
|
||||
Resource.Rsc.Cod = Prg_DB_CreateResource (&Resource);
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,NULL,-1L,Resource.ItmCod,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Rename resource ****************************/
|
||||
|
|
|
@ -57,6 +57,8 @@ void PrgRsc_EditResources (void);
|
|||
|
||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod);
|
||||
|
||||
void PrgRsc_CreateResource (void);
|
||||
|
||||
void PrgRsc_RenameResource (void);
|
||||
|
||||
void PrgRsc_ReqRemResource (void);
|
||||
|
|
|
@ -6086,6 +6086,29 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
|
|||
"Editar recursos"
|
||||
#elif L==10 // tr
|
||||
"Kaynakları düzenle"
|
||||
#endif
|
||||
,
|
||||
[ActNewPrgRsc] =
|
||||
#if L==1 // ca
|
||||
"Create resource" // Necessita traducció
|
||||
#elif L==2 // de
|
||||
"Create resource" // Need Übersetzung
|
||||
#elif L==3 // en
|
||||
"Create resource"
|
||||
#elif L==4 // es
|
||||
"Crear recurso"
|
||||
#elif L==5 // fr
|
||||
"Create resource" // Besoin de traduction
|
||||
#elif L==6 // gn
|
||||
"Crear recurso" // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"Create resource" // Bisogno di traduzione
|
||||
#elif L==8 // pl
|
||||
"Create resource" // Potrzebujesz tlumaczenie
|
||||
#elif L==9 // pt
|
||||
"Create resource" // Precisa de tradução
|
||||
#elif L==10 // tr
|
||||
"Create resource" // Çeviri lazim!
|
||||
#endif
|
||||
,
|
||||
[ActRenPrgRsc] =
|
||||
|
|
Loading…
Reference in New Issue