mirror of https://github.com/acanas/swad-core.git
Version 22.4: Sep 15, 2022 Changes in edition of program items.
This commit is contained in:
parent
30516d43da
commit
dc7e9fc917
|
@ -2235,7 +2235,7 @@ static void Att_ReqListOrPrintUsrsAttendanceCrs (void *TypeOfView)
|
|||
Att_FreeListAttEvents (&Events);
|
||||
break;
|
||||
default:
|
||||
Err_WrongTypeOfViewExit ();
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2303,7 +2303,7 @@ static void Att_ListOrPrintMyAttendanceCrs (Att_TypeOfView_t TypeOfView)
|
|||
NULL,Box_NOT_CLOSABLE);
|
||||
break;
|
||||
default:
|
||||
Err_WrongTypeOfViewExit ();
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2333,7 +2333,7 @@ static void Att_ListOrPrintMyAttendanceCrs (Att_TypeOfView_t TypeOfView)
|
|||
Att_FreeListAttEvents (&Events);
|
||||
break;
|
||||
default:
|
||||
Err_WrongTypeOfViewExit ();
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2419,7 +2419,7 @@ static void Att_ListOrPrintUsrsAttendanceCrs (void *TypeOfView)
|
|||
NULL,Box_NOT_CLOSABLE);
|
||||
break;
|
||||
default:
|
||||
Err_WrongTypeOfViewExit ();
|
||||
Err_WrongTypeExit ();
|
||||
}
|
||||
|
||||
/***** List events to select *****/
|
||||
|
@ -2453,7 +2453,7 @@ static void Att_ListOrPrintUsrsAttendanceCrs (void *TypeOfView)
|
|||
Grp_FreeListCodSelectedGrps ();
|
||||
break;
|
||||
default:
|
||||
Err_WrongTypeOfViewExit ();
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9103,6 +9103,25 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
|||
FileMetadata->NumLoggedUsrs = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Get summary and content of a file **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_GetFileNameFromFilCod (long FilCod,char FileName[NAME_MAX + 1])
|
||||
{
|
||||
struct 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,NAME_MAX);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get file type, size and date *************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -233,6 +233,7 @@ void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char
|
|||
void Brw_ChgFileMetadata (void);
|
||||
void Brw_GetFileMetadataByPath (struct FileMetadata *FileMetadata);
|
||||
void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata);
|
||||
void Brw_GetFileNameFromFilCod (long FilCod,char FileName[NAME_MAX + 1]);
|
||||
bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata);
|
||||
void Brw_GetAndUpdateFileViews (struct FileMetadata *FileMetadata);
|
||||
void Brw_UpdateMyFileViews (long FilCod);
|
||||
|
|
|
@ -298,7 +298,7 @@ unsigned Brw_DB_GetFileMetadataByPath (MYSQL_RES **mysql_res,const char *Path)
|
|||
/*****************************************************************************/
|
||||
/********************* Get file metadata using its code **********************/
|
||||
/*****************************************************************************/
|
||||
// FileMetadata.FilCod must be filled
|
||||
|
||||
// This function only gets metadata stored in table files,
|
||||
// does not get size, time, numviews...
|
||||
|
||||
|
@ -321,6 +321,29 @@ unsigned Brw_DB_GetFileMetadataByCod (MYSQL_RES **mysql_res,long FilCod)
|
|||
FilCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get file name using its code ************************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
unsigned Brw_DB_GetFileNameByCod (MYSQL_RES **mysql_res,long FilCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get file metadata",
|
||||
"SELECT FilCod," // row[0]
|
||||
"FileBrowser," // row[1]
|
||||
"Cod," // row[2]
|
||||
"ZoneUsrCod," // row[3]
|
||||
"PublisherUsrCod," // row[4]
|
||||
"FileType," // row[5]
|
||||
"Path," // row[6]
|
||||
"Hidden," // row[7]
|
||||
"Public," // row[8]
|
||||
"License" // row[9]
|
||||
" FROM brw_files"
|
||||
" WHERE FilCod=%ld",
|
||||
FilCod);
|
||||
}
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/************************ Get the publisher of a subtree *********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -606,11 +606,12 @@ 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.3 (2022-09-14)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.4 (2022-09-15)"
|
||||
#define CSS_FILE "swad22.3.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 22.3: Sep 14, 2022 Listing program resource clipboard. (? lines)
|
||||
Version 22.4: Sep 15, 2022 Changes in edition of program items. (329940 lines)
|
||||
Version 22.3: Sep 14, 2022 Listing program resource clipboard. (329918 lines)
|
||||
4 changes necessary in database:
|
||||
ALTER TABLE prg_clipboards CHANGE COLUMN Type Type ENUM('non','asg','cfe','exa','gam','svy','doc','mrk','att','for') NOT NULL DEFAULT 'non';
|
||||
ALTER TABLE prg_resources DROP COLUMN Type;
|
||||
|
|
|
@ -249,12 +249,12 @@ void Err_WrongGroupExit (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Write error message and exit when wrong order *****************/
|
||||
/************* Write error message and exit when wrong type ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Err_WrongTypeOfViewExit (void)
|
||||
void Err_WrongTypeExit (void)
|
||||
{
|
||||
Err_ShowErrorAndExit ("Wrong type of view.");
|
||||
Err_ShowErrorAndExit ("Wrong type.");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -54,7 +54,7 @@ void Err_WrongCopySrcExit (void);
|
|||
void Err_WrongNumberOfRowsExit (void);
|
||||
void Err_WrongGrpTypExit (void);
|
||||
void Err_WrongGroupExit (void);
|
||||
void Err_WrongTypeOfViewExit (void);
|
||||
void Err_WrongTypeExit (void);
|
||||
void Err_WrongBannerExit (void);
|
||||
void Err_WrongLinkExit (void);
|
||||
void Err_WrongHolidayExit (void);
|
||||
|
|
|
@ -419,12 +419,10 @@ static void Prg_PutIconToViewProgram (void)
|
|||
|
||||
static void Prg_PutIconToCreateNewItem (void)
|
||||
{
|
||||
struct Prg_ItmRscCodes SelectedItmRscCodes;
|
||||
long ItmCod = -1L;
|
||||
|
||||
SelectedItmRscCodes.ItmCod = -1L;
|
||||
SelectedItmRscCodes.RscCod = -1L;
|
||||
Ico_PutContextualIconToAdd (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&SelectedItmRscCodes);
|
||||
Prg_PutParamItmCod,&ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -434,12 +432,10 @@ static void Prg_PutIconToCreateNewItem (void)
|
|||
static void Prg_PutButtonToCreateNewItem (void)
|
||||
{
|
||||
extern const char *Txt_New_item;
|
||||
struct Prg_ItmRscCodes SelectedItmRscCodes;
|
||||
long ItmCod = -1L;
|
||||
|
||||
SelectedItmRscCodes.ItmCod = -1L;
|
||||
SelectedItmRscCodes.RscCod = -1L;
|
||||
Frm_BeginFormAnchor (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID);
|
||||
Prg_PutParams (&SelectedItmRscCodes);
|
||||
Prg_PutParamItmCod (&ItmCod);
|
||||
Btn_PutConfirmButton (Txt_New_item);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
@ -474,7 +470,6 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
unsigned NumCol;
|
||||
char *TitleClass;
|
||||
Dat_StartEndTime_t StartEndTime;
|
||||
struct Prg_ItmRscCodes SelectedItmRscCodes;
|
||||
|
||||
/***** Check if this item should be shown as hidden *****/
|
||||
Prg_SetHiddenLevel (Item->Hierarchy.Level,Item->Hierarchy.Hidden);
|
||||
|
@ -611,9 +606,7 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
}
|
||||
|
||||
/* List of resources */
|
||||
SelectedItmRscCodes.ItmCod = Item->Hierarchy.ItmCod;
|
||||
SelectedItmRscCodes.RscCod = SelectedRscCod;
|
||||
PrgRsc_ListItemResources (ListingType,&SelectedItmRscCodes);
|
||||
PrgRsc_ListItemResources (ListingType,Item->Hierarchy.ItmCod,SelectedRscCod);
|
||||
|
||||
/* End text and resources */
|
||||
HTM_TD_End ();
|
||||
|
@ -885,24 +878,21 @@ static void Prg_PutFormsToRemEditOneItem (Prg_ListingType_t ListingType,
|
|||
[true ] = ActUnhPrgItm, // Hidden ==> action to unhide
|
||||
};
|
||||
char StrItemIndex[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
struct Prg_ItmRscCodes SelectedItmRscCodes;
|
||||
|
||||
/***** Initialize item index string *****/
|
||||
snprintf (StrItemIndex,sizeof (StrItemIndex),"%u",Item->Hierarchy.ItmInd);
|
||||
|
||||
SelectedItmRscCodes.ItmCod = Item->Hierarchy.ItmCod;
|
||||
SelectedItmRscCodes.RscCod = -1L;
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_TCH:
|
||||
case Rol_SYS_ADM:
|
||||
/***** Icon to remove program item *****/
|
||||
Ico_PutContextualIconToRemove (ActReqRemPrgItm,NULL,
|
||||
Prg_PutParams,&SelectedItmRscCodes);
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod);
|
||||
|
||||
/***** Icon to hide/unhide program item *****/
|
||||
Ico_PutContextualIconToHideUnhide (ActionHideUnhide,"prg_highlighted",
|
||||
Prg_PutParams,&SelectedItmRscCodes,
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod,
|
||||
Item->Hierarchy.Hidden);
|
||||
|
||||
/***** Icon to edit program item *****/
|
||||
|
@ -910,24 +900,24 @@ static void Prg_PutFormsToRemEditOneItem (Prg_ListingType_t ListingType,
|
|||
{
|
||||
case Prg_FORM_EDIT_ITEM:
|
||||
Ico_PutContextualIconToView (ActSeePrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&SelectedItmRscCodes);
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod);
|
||||
break;
|
||||
default:
|
||||
Ico_PutContextualIconToEdit (ActFrmChgPrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&SelectedItmRscCodes);
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod);
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Icon to add a new child item inside this item *****/
|
||||
Ico_PutContextualIconToAdd (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&SelectedItmRscCodes);
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod);
|
||||
|
||||
HTM_BR ();
|
||||
|
||||
/***** Icon to move up the item *****/
|
||||
if (Prg_CheckIfMoveUpIsAllowed (NumItem))
|
||||
Lay_PutContextualLinkOnlyIcon (ActUp_PrgItm,"prg_highlighted",
|
||||
Prg_PutParams,&SelectedItmRscCodes,
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod,
|
||||
"arrow-up.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-up.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -935,7 +925,7 @@ static void Prg_PutFormsToRemEditOneItem (Prg_ListingType_t ListingType,
|
|||
/***** Icon to move down the item *****/
|
||||
if (Prg_CheckIfMoveDownIsAllowed (NumItem))
|
||||
Lay_PutContextualLinkOnlyIcon (ActDwnPrgItm,"prg_highlighted",
|
||||
Prg_PutParams,&SelectedItmRscCodes,
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod,
|
||||
"arrow-down.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-down.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -943,7 +933,7 @@ static void Prg_PutFormsToRemEditOneItem (Prg_ListingType_t ListingType,
|
|||
/***** Icon to move left item (increase level) *****/
|
||||
if (Prg_CheckIfMoveLeftIsAllowed (NumItem))
|
||||
Lay_PutContextualLinkOnlyIcon (ActLftPrgItm,"prg_highlighted",
|
||||
Prg_PutParams,&SelectedItmRscCodes,
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod,
|
||||
"arrow-left.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-left.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -951,7 +941,7 @@ static void Prg_PutFormsToRemEditOneItem (Prg_ListingType_t ListingType,
|
|||
/***** Icon to move right item (indent, decrease level) *****/
|
||||
if (Prg_CheckIfMoveRightIsAllowed (NumItem))
|
||||
Lay_PutContextualLinkOnlyIcon (ActRgtPrgItm,"prg_highlighted",
|
||||
Prg_PutParams,&SelectedItmRscCodes,
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod,
|
||||
"arrow-right.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-right.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -1038,30 +1028,31 @@ static bool Prg_CheckIfMoveRightIsAllowed (unsigned NumItem)
|
|||
/******************** Params used to edit a program item *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Prg_PutParams (void *ItmRscCodes)
|
||||
void Prg_PutParamItmCod (void *ItmCod)
|
||||
{
|
||||
if (ItmRscCodes)
|
||||
{
|
||||
/* If a resource is present, put resource code.
|
||||
If no resource present, but item is, put item code. */
|
||||
if (((struct Prg_ItmRscCodes *) ItmRscCodes)->RscCod > 0)
|
||||
PrgRsc_PutParamRscCod (((struct Prg_ItmRscCodes *) ItmRscCodes)->RscCod);
|
||||
else if (((struct Prg_ItmRscCodes *) ItmRscCodes)->ItmCod > 0)
|
||||
Prg_PutParamItmCod (((struct Prg_ItmRscCodes *) ItmRscCodes)->ItmCod);
|
||||
}
|
||||
if (ItmCod)
|
||||
if (*((long *) ItmCod) > 0)
|
||||
Par_PutHiddenParamLong (NULL,"ItmCod",*((long *) ItmCod));
|
||||
}
|
||||
|
||||
void Prg_PutParamRscCod (void *RscCod)
|
||||
{
|
||||
if (RscCod)
|
||||
if (*((long *) RscCod) > 0)
|
||||
Par_PutHiddenParamLong (NULL,"RscCod",*((long *) RscCod));
|
||||
}
|
||||
|
||||
void Prg_GetParams (struct Prg_Item *Item)
|
||||
{
|
||||
/***** Try to get item resource *****/
|
||||
Item->Resource.Hierarchy.RscCod = PrgRsc_GetParamRscCod ();
|
||||
Item->Resource.Hierarchy.RscCod = Par_GetParToLong ("RscCod");
|
||||
|
||||
/***** Get data of the program item from database *****/
|
||||
PrgRsc_GetDataOfResourceByCod (Item);
|
||||
|
||||
if (Item->Hierarchy.ItmCod <= 0) // No resource specified
|
||||
/***** Try to get data of the program item from database *****/
|
||||
Item->Hierarchy.ItmCod = Prg_GetParamItmCod ();
|
||||
Item->Hierarchy.ItmCod = Par_GetParToLong ("ItmCod");
|
||||
|
||||
/***** Get data of the program item from database *****/
|
||||
Prg_GetDataOfItemByCod (Item);
|
||||
|
@ -1238,24 +1229,6 @@ void Prg_ResetItem (struct Prg_Item *Item)
|
|||
Item->Resource.Title[0] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Write parameter with code of program item ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Prg_PutParamItmCod (long ItmCod)
|
||||
{
|
||||
Par_PutHiddenParamLong (NULL,"ItmCod",ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get parameter with code of program item *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
long Prg_GetParamItmCod (void)
|
||||
{
|
||||
return Par_GetParToLong ("ItmCod");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Get number of item in list from item code ******************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1298,7 +1271,6 @@ void Prg_ReqRemItem (void)
|
|||
extern const char *Txt_Do_you_really_want_to_remove_the_item_X;
|
||||
extern const char *Txt_Remove_item;
|
||||
struct Prg_Item Item;
|
||||
struct Prg_ItmRscCodes SelectedItmRscCodes;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
Prg_GetListItems ();
|
||||
|
@ -1309,10 +1281,8 @@ void Prg_ReqRemItem (void)
|
|||
Err_WrongItemExit ();
|
||||
|
||||
/***** Show question and button to remove the program item *****/
|
||||
SelectedItmRscCodes.ItmCod = Item.Hierarchy.ItmCod;
|
||||
SelectedItmRscCodes.RscCod = -1L;
|
||||
Ale_ShowAlertAndButton (ActRemPrgItm,NULL,NULL,
|
||||
Prg_PutParams,&SelectedItmRscCodes,
|
||||
Prg_PutParamItmCod,&Item.Hierarchy.ItmCod,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_item,
|
||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_item_X,
|
||||
Item.Title);
|
||||
|
@ -1820,7 +1790,7 @@ static void Prg_ShowFormToCreateItem (long ParentItmCod)
|
|||
|
||||
/***** Begin form *****/
|
||||
Frm_BeginFormAnchor (ActNewPrgItm,"prg_highlighted");
|
||||
Prg_PutParamItmCod (ParentItem.Hierarchy.ItmCod);
|
||||
Prg_PutParamItmCod (&ParentItem.Hierarchy.ItmCod);
|
||||
|
||||
/***** Begin box and table *****/
|
||||
Box_BoxTableBegin ("100%",Txt_New_item,
|
||||
|
@ -1864,7 +1834,7 @@ static void Prg_ShowFormToChangeItem (long ItmCod)
|
|||
|
||||
/***** Begin form *****/
|
||||
Frm_BeginFormAnchor (ActChgPrgItm,"prg_highlighted");
|
||||
Prg_PutParamItmCod (Item.Hierarchy.ItmCod);
|
||||
Prg_PutParamItmCod (&Item.Hierarchy.ItmCod);
|
||||
|
||||
/***** Begin box and table *****/
|
||||
Box_BoxTableBegin ("100%",
|
||||
|
|
|
@ -130,12 +130,6 @@ typedef enum
|
|||
Prg_END_EDIT_RES, // List resources of a selected item after edition
|
||||
} Prg_ListingType_t;
|
||||
|
||||
struct Prg_ItmRscCodes // Used in forms to pass an item and a resource as parameters
|
||||
{
|
||||
long ItmCod;
|
||||
long RscCod;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -148,7 +142,8 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,
|
|||
|
||||
bool Prg_CheckIfICanEditProgram (void);
|
||||
|
||||
void Prg_PutParams (void *ItmRsc);
|
||||
void Prg_PutParamRscCod (void *RscCod);
|
||||
void Prg_PutParamItmCod (void *ItmCod);
|
||||
void Prg_GetParams (struct Prg_Item *Item);
|
||||
|
||||
void Prg_GetListItems (void);
|
||||
|
@ -156,8 +151,6 @@ void Prg_FreeListItems (void);
|
|||
|
||||
void Prg_ResetItem (struct Prg_Item *Item);
|
||||
|
||||
void Prg_PutParamItmCod (long ItmCod);
|
||||
long Prg_GetParamItmCod (void);
|
||||
unsigned Prg_GetNumItemFromItmCod (long ItmCod);
|
||||
unsigned Prg_GetLevelFromNumItem (unsigned NumItem);
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ static const char *PrgRsc_RESOURCE_SECTION_ID = "rsc_section";
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmRscCodes);
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmRscCodes);
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmCod);
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmCod);
|
||||
|
||||
static void PrgRsc_GetDataOfResource (struct Prg_Item *Item,
|
||||
MYSQL_RES **mysql_res);
|
||||
|
@ -96,24 +96,25 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
const struct Prg_Item *Item);
|
||||
static void PrgRsc_WriteRowEditResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumRsc,unsigned NumResources,
|
||||
const struct Prg_Item *Item,
|
||||
struct Prg_ItmRscCodes *SelectedItmRscCodes);
|
||||
struct Prg_Item *Item,
|
||||
long SelectedRscCod);
|
||||
static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumResources,
|
||||
struct Prg_ItmRscCodes *SelectedItmRscCodes);
|
||||
static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
||||
unsigned NumResources,
|
||||
struct Prg_ItmRscCodes *ItmRscCodes,
|
||||
bool Hidden);
|
||||
struct Prg_Item *Item,
|
||||
long SelectedRscCod);
|
||||
static void PrgRsc_PutFormsToRemEditOneResource (struct Prg_Item *Item,
|
||||
unsigned NumRsc,
|
||||
unsigned NumResources);
|
||||
static void PrgRsc_HideOrUnhideResource (bool Hide);
|
||||
|
||||
static void PrgRsc_MoveUpDownResource (PrgRsc_MoveUpDown_t UpDown);
|
||||
static bool PrgRsc_ExchangeResources (const struct Prg_ResourceHierarchy *Rsc1,
|
||||
const struct Prg_ResourceHierarchy *Rsc2);
|
||||
|
||||
static void PrgRsc_ShowClipboard (const struct Prg_Item *Item);
|
||||
static void PrgRsc_ShowClipboard (struct Prg_Item *Item);
|
||||
static void PrgRsc_WriteRowClipboard (unsigned NumLink,
|
||||
const struct PrgRsc_Link *Link);
|
||||
static void PrgRsc_WriteLinkName (const struct PrgRsc_Link *Link);
|
||||
static void PrgRsc_GetDataOfLinkFromClipboard (struct PrgRsc_Link *Link,
|
||||
MYSQL_RES **mysql_res);
|
||||
|
||||
|
@ -164,7 +165,7 @@ void PrgRsc_EditResources (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||
struct Prg_ItmRscCodes *SelectedItmRscCodes)
|
||||
long ItmCod,long SelectedRscCod)
|
||||
{
|
||||
extern const char *Hlp_COURSE_Program;
|
||||
extern const char *Txt_Remove_resource;
|
||||
|
@ -218,7 +219,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
|||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *ItmRsc) =
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *ItmCod) =
|
||||
{
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = NULL,
|
||||
|
@ -235,11 +236,11 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
|||
};
|
||||
|
||||
/***** Trivial check *****/
|
||||
if (SelectedItmRscCodes->ItmCod <= 0)
|
||||
if (ItmCod <= 0)
|
||||
return;
|
||||
|
||||
/***** Get list of item resources from database *****/
|
||||
NumResources = Prg_DB_GetListResources (&mysql_res,SelectedItmRscCodes->ItmCod,
|
||||
NumResources = Prg_DB_GetListResources (&mysql_res,ItmCod,
|
||||
GetHiddenResources[ListingType]);
|
||||
|
||||
if (NumResources || ShowListWhenEmpty[ListingType])
|
||||
|
@ -255,7 +256,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
|||
case ActReqRemPrgRsc:
|
||||
/* Alert with button to remove resource */
|
||||
Ale_ShowLastAlertAndButton (ActRemPrgRsc,PrgRsc_RESOURCE_SECTION_ID,NULL,
|
||||
Prg_PutParams,SelectedItmRscCodes,
|
||||
Prg_PutParamRscCod,&SelectedRscCod,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_resource);
|
||||
break;
|
||||
default:
|
||||
|
@ -265,7 +266,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
|||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin ("100%",Txt_Resources,
|
||||
FunctionToDrawContextualIcons[ListingType],SelectedItmRscCodes,
|
||||
FunctionToDrawContextualIcons[ListingType],&ItmCod,
|
||||
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Table *****/
|
||||
|
@ -288,7 +289,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
|||
case Prg_CHANGE_RESOURCE_LINK:
|
||||
PrgRsc_WriteRowEditResource (ListingType,
|
||||
NumRsc,NumResources,
|
||||
&Item,SelectedItmRscCodes);
|
||||
&Item,SelectedRscCod);
|
||||
break;
|
||||
default:
|
||||
PrgRsc_WriteRowViewResource (NumRsc,&Item);
|
||||
|
@ -302,8 +303,10 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
|||
case Prg_EDIT_RESOURCES:
|
||||
case Prg_SHOW_CLIPBOARD:
|
||||
case Prg_CHANGE_RESOURCE_LINK:
|
||||
Prg_ResetItem (&Item);
|
||||
Item.Hierarchy.ItmCod = ItmCod;
|
||||
PrgRsc_WriteRowNewResource (ListingType,NumResources,
|
||||
SelectedItmRscCodes);
|
||||
&Item,SelectedRscCod);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -329,24 +332,24 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
|||
/************** Put contextual icons in list of item resources ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmRscCodes)
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmCod)
|
||||
{
|
||||
/***** Put icon to create a new item resource *****/
|
||||
if (ItmRscCodes)
|
||||
if (((struct Prg_ItmRscCodes *) ItmRscCodes)->ItmCod > 0)
|
||||
if (ItmCod)
|
||||
if (*(long *) ItmCod > 0)
|
||||
if (Prg_CheckIfICanEditProgram ())
|
||||
Ico_PutContextualIconToView (ActFrmSeePrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRscCodes);
|
||||
Prg_PutParamItmCod,ItmCod);
|
||||
}
|
||||
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmRscCodes)
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmCod)
|
||||
{
|
||||
/***** Put icon to create a new item resource *****/
|
||||
if (ItmRscCodes)
|
||||
if (((struct Prg_ItmRscCodes *) ItmRscCodes)->ItmCod > 0)
|
||||
if (ItmCod)
|
||||
if (*(long *) ItmCod > 0)
|
||||
if (Prg_CheckIfICanEditProgram ())
|
||||
Ico_PutContextualIconToEdit (ActFrmEdiPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRscCodes);
|
||||
Prg_PutParamItmCod,ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -444,21 +447,15 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
|
||||
static void PrgRsc_WriteRowEditResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumRsc,unsigned NumResources,
|
||||
const struct Prg_Item *Item,
|
||||
struct Prg_ItmRscCodes *SelectedItmRscCodes)
|
||||
struct Prg_Item *Item,
|
||||
long SelectedRscCod)
|
||||
{
|
||||
struct Prg_ItmRscCodes ItmRscCodes;
|
||||
|
||||
ItmRscCodes.ItmCod = Item->Hierarchy.ItmCod;
|
||||
ItmRscCodes.RscCod = Item->Resource.Hierarchy.RscCod;
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this item resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"",The_GetColorRows1 (1));
|
||||
PrgRsc_PutFormsToRemEditOneResource (NumRsc,NumResources,
|
||||
&ItmRscCodes,Item->Resource.Hierarchy.Hidden);
|
||||
PrgRsc_PutFormsToRemEditOneResource (Item,NumRsc,NumResources);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Resource number *****/
|
||||
|
@ -470,7 +467,7 @@ static void PrgRsc_WriteRowEditResource (Prg_ListingType_t ListingType,
|
|||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 (1));
|
||||
Frm_BeginFormAnchor (ActRenPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
Prg_PutParams (&ItmRscCodes);
|
||||
Prg_PutParamRscCod (&Item->Resource.Hierarchy.RscCod);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,Item->Resource.Title,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
|
@ -481,7 +478,7 @@ static void PrgRsc_WriteRowEditResource (Prg_ListingType_t ListingType,
|
|||
/***** Icon to edit link *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN RT %s\"",The_GetColorRows1 (1));
|
||||
Ico_PutContextualIconToGetLink (ActSeeCliPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,&ItmRscCodes);
|
||||
Prg_PutParamRscCod,&Item->Resource.Hierarchy.RscCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Link *****/
|
||||
|
@ -492,7 +489,7 @@ static void PrgRsc_WriteRowEditResource (Prg_ListingType_t ListingType,
|
|||
|
||||
/* Show clipboard to change resource link */
|
||||
if (ListingType == Prg_SHOW_CLIPBOARD &&
|
||||
Item->Resource.Hierarchy.RscCod == SelectedItmRscCodes->RscCod)
|
||||
Item->Resource.Hierarchy.RscCod == SelectedRscCod)
|
||||
PrgRsc_ShowClipboard (Item);
|
||||
|
||||
HTM_TD_End ();
|
||||
|
@ -507,16 +504,9 @@ static void PrgRsc_WriteRowEditResource (Prg_ListingType_t ListingType,
|
|||
|
||||
static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumResources,
|
||||
struct Prg_ItmRscCodes *SelectedItmRscCodes)
|
||||
struct Prg_Item *Item,
|
||||
long SelectedRscCod)
|
||||
{
|
||||
struct Prg_Item Item;
|
||||
struct Prg_ItmRscCodes ItmRscCodes;
|
||||
|
||||
Prg_ResetItem (&Item);
|
||||
Item.Hierarchy.ItmCod = SelectedItmRscCodes->ItmCod;
|
||||
ItmRscCodes.ItmCod = Item.Hierarchy.ItmCod;
|
||||
ItmRscCodes.RscCod = Item.Resource.Hierarchy.RscCod;
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -533,7 +523,7 @@ static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
|||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 (1));
|
||||
Frm_BeginFormAnchor (ActNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
Prg_PutParams (&ItmRscCodes);
|
||||
Prg_PutParamItmCod (&Item->Hierarchy.ItmCod);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,"",
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"placeholder=\"%s\""
|
||||
|
@ -546,7 +536,7 @@ static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
|||
/***** Icon to edit link *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN RT %s\"",The_GetColorRows1 (1));
|
||||
Ico_PutContextualIconToGetLink (ActSeeCliPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,&ItmRscCodes);
|
||||
Prg_PutParamItmCod,&Item->Hierarchy.ItmCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Link *****/
|
||||
|
@ -554,8 +544,8 @@ static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
|||
|
||||
/* Show clipboard to change resource link */
|
||||
if (ListingType == Prg_SHOW_CLIPBOARD &&
|
||||
SelectedItmRscCodes->RscCod <= 0) // No resource selected
|
||||
PrgRsc_ShowClipboard (&Item);
|
||||
SelectedRscCod <= 0) // No resource selected
|
||||
PrgRsc_ShowClipboard (Item);
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -567,10 +557,9 @@ static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
|||
/**************** Put a link (form) to edit one program item *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
||||
unsigned NumResources,
|
||||
struct Prg_ItmRscCodes *ItmRscCodes,
|
||||
bool Hidden)
|
||||
static void PrgRsc_PutFormsToRemEditOneResource (struct Prg_Item *Item,
|
||||
unsigned NumRsc,
|
||||
unsigned NumResources)
|
||||
{
|
||||
static Act_Action_t ActionHideUnhide[2] =
|
||||
{
|
||||
|
@ -585,17 +574,17 @@ static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
|||
case Rol_SYS_ADM:
|
||||
/***** Icon to remove item resource *****/
|
||||
Ico_PutContextualIconToRemove (ActReqRemPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRscCodes);
|
||||
Prg_PutParamRscCod,&Item->Resource.Hierarchy.RscCod);
|
||||
|
||||
/***** Icon to hide/unhide item resource *****/
|
||||
Ico_PutContextualIconToHideUnhide (ActionHideUnhide,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRscCodes,
|
||||
Hidden);
|
||||
Prg_PutParamRscCod,&Item->Resource.Hierarchy.RscCod,
|
||||
Item->Resource.Hierarchy.Hidden);
|
||||
|
||||
/***** Icon to move up the item *****/
|
||||
if (NumRsc > 0)
|
||||
Lay_PutContextualLinkOnlyIcon (ActUp_PrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRscCodes,
|
||||
Prg_PutParamRscCod,&Item->Resource.Hierarchy.RscCod,
|
||||
"arrow-up.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-up.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -603,7 +592,7 @@ static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
|||
/***** Put icon to move down the item *****/
|
||||
if (NumRsc < NumResources - 1)
|
||||
Lay_PutContextualLinkOnlyIcon (ActDwnPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRscCodes,
|
||||
Prg_PutParamRscCod,&Item->Resource.Hierarchy.RscCod,
|
||||
"arrow-down.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-down.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -625,15 +614,6 @@ void PrgRsc_PutParamRscCod (long RscCod)
|
|||
Par_PutHiddenParamLong (NULL,"RscCod",RscCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get parameter with code of item resource ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
long PrgRsc_GetParamRscCod (void)
|
||||
{
|
||||
return Par_GetParToLong ("RscCod");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Rename resource ****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -916,20 +896,16 @@ void PrgRsc_ShowClipboardToChgLink (void)
|
|||
/***************** Show clipboard to change resource link ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_ShowClipboard (const struct Prg_Item *Item)
|
||||
static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumLink;
|
||||
unsigned NumLinks;
|
||||
struct PrgRsc_Link Link;
|
||||
struct Prg_ItmRscCodes ItmRscCodes;
|
||||
|
||||
ItmRscCodes.ItmCod = Item->Hierarchy.ItmCod;
|
||||
ItmRscCodes.RscCod = Item->Resource.Hierarchy.RscCod;
|
||||
|
||||
/***** Begin form *****/
|
||||
Frm_BeginFormAnchor (ActChgLnkPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
Prg_PutParams (&ItmRscCodes);
|
||||
Prg_PutParamRscCod (&Item->Resource.Hierarchy.RscCod);
|
||||
|
||||
/***** Begin list *****/
|
||||
HTM_UL_Begin ("class=\"PRG_CLIPBOARD\"");
|
||||
|
@ -987,16 +963,55 @@ static void PrgRsc_WriteRowClipboard (unsigned NumLink,
|
|||
/***** Type *****/
|
||||
Ico_PutIconOn (Prg_ResourceTypesLogos[Link->Type],Ico_BLACK,Prg_ResourceTypesDB[Link->Type]);
|
||||
|
||||
/***** Code *****/
|
||||
if (Link->Cod > 0)
|
||||
HTM_Long (Link->Cod);
|
||||
else
|
||||
HTM_Txt ("sin enlace"); // TODO: Need translation!!!!!
|
||||
/***** Name *****/
|
||||
PrgRsc_WriteLinkName (Link);
|
||||
|
||||
HTM_LABEL_End ();
|
||||
HTM_LI_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Write link name (filename, assignment title...) ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteLinkName (const struct PrgRsc_Link *Link)
|
||||
{
|
||||
char FileName[NAME_MAX + 1];
|
||||
|
||||
/***** Trivial check: code should be > 0 *****/
|
||||
if (Link->Cod <= 0)
|
||||
{
|
||||
HTM_Txt ("sin enlace"); // TODO: Need translation!!!!!
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Link->Type)
|
||||
{
|
||||
case PrgRsc_NONE:
|
||||
HTM_Txt ("sin enlace"); // TODO: Need translation!!!!!
|
||||
break;
|
||||
case PrgRsc_ASSIGNMENT:
|
||||
case PrgRsc_CALL_FOR_EXAM:
|
||||
case PrgRsc_EXAM:
|
||||
case PrgRsc_GAME:
|
||||
case PrgRsc_SURVEY:
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
break;
|
||||
case PrgRsc_DOCUMENT:
|
||||
Brw_GetFileNameFromFilCod (Link->Cod,FileName);
|
||||
HTM_Txt (FileName);
|
||||
break;
|
||||
case PrgRsc_MARKS:
|
||||
case PrgRsc_ATTENDANCE_EVENT:
|
||||
case PrgRsc_FORUM_THREAD:
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
break;
|
||||
default:
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Show clipboard to change resource link ********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -45,12 +45,11 @@ void PrgRsc_ViewResourcesAfterEdit (void);
|
|||
void PrgRsc_EditResources (void);
|
||||
|
||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||
struct Prg_ItmRscCodes *SelectedItmRscCodes);
|
||||
long SelectedItmCod,long SelectedRscCod);
|
||||
|
||||
void PrgRsc_GetDataOfResourceByCod (struct Prg_Item *Item);
|
||||
|
||||
void PrgRsc_PutParamRscCod (long RscCod);
|
||||
long PrgRsc_GetParamRscCod (void);
|
||||
|
||||
void PrgRsc_CreateResource (void);
|
||||
|
||||
|
|
|
@ -35677,7 +35677,7 @@ const char *Txt_Resource_X_removed = // Warning: it is very important to include
|
|||
#elif L==2 // de
|
||||
"Ressource <strong>%s</strong> entfernt.";
|
||||
#elif L==3 // en
|
||||
"Resource <strong>s</strong> removed.";
|
||||
"Resource <strong>%s</strong> removed.";
|
||||
#elif L==4 // es
|
||||
"Recurso <strong>%s</strong> eliminado.";
|
||||
#elif L==5 // fr
|
||||
|
|
Loading…
Reference in New Issue