mirror of https://github.com/acanas/swad-core.git
Version 22.1: Sep 13, 2022 Code refactoring in program resources.
This commit is contained in:
parent
cc58884e9a
commit
89dcb04f11
|
@ -454,7 +454,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
[ActUnhPrgRsc ] = {1922,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_UnhideResource ,NULL},
|
||||
[ActUp_PrgRsc ] = {1923,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_MoveUpResource ,NULL},
|
||||
[ActDwnPrgRsc ] = {1924,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_MoveDownResource ,NULL},
|
||||
[ActChgLnkPrgRsc ] = {1932,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_ChangeResourceLink ,NULL},
|
||||
[ActChgLnkPrgRsc ] = {1932,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_ShowClipboardToChgLink ,NULL},
|
||||
|
||||
[ActEdiTchGui ] = { 785,-1,TabUnk,ActSeeTchGui ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_FormsToSelSendInfo ,NULL},
|
||||
|
||||
|
|
|
@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
|||
|
||||
TODO: Attach pdf files in multimedia.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.0 (2022-09-12)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.1 (2022-09-13)"
|
||||
#define CSS_FILE "swad21.107.1.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 22.1: Sep 13, 2022 Code refactoring in program resources. (329693 lines)
|
||||
Version 22.0: Sep 12, 2022 New action to change resource link. Not implemented. (329606 lines)
|
||||
Version 21.117.1: Sep 12, 2022 Copy link to file into resource clipboard. (329561 lines)
|
||||
Version 21.117: Sep 12, 2022 New database table with clipboards for program resources.
|
||||
|
|
161
swad_program.c
161
swad_program.c
|
@ -115,7 +115,8 @@ static void Prg_PutIconToCreateNewItem (void);
|
|||
static void Prg_PutButtonToCreateNewItem (void);
|
||||
|
||||
static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||
unsigned NumItem,struct Prg_Item *Item);
|
||||
unsigned NumItem,struct Prg_Item *Item,
|
||||
long SelectedRscCod);
|
||||
static void Prg_WriteItemText (long ItmCod,bool LightStyle);
|
||||
static void Prg_WriteRowToCreateItem (long ParentItmCod,unsigned FormLevel);
|
||||
static void Prg_SetTitleClass (char **TitleClass,unsigned Level,bool LightStyle);
|
||||
|
@ -181,7 +182,7 @@ void Prg_ShowCourseProgram (void)
|
|||
Prg_GetListItems ();
|
||||
|
||||
/***** Show course program without highlighting any item *****/
|
||||
Prg_ShowAllItems (Prg_VIEW,-1L);
|
||||
Prg_ShowAllItems (Prg_VIEW,-1L,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -193,7 +194,7 @@ void Prg_EditCourseProgram (void)
|
|||
Prg_GetListItems ();
|
||||
|
||||
/***** Show course program without highlighting any item *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -203,7 +204,8 @@ void Prg_EditCourseProgram (void)
|
|||
/************************* Show all program items ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
||||
void Prg_ShowAllItems (Prg_ListingType_t ListingType,
|
||||
long SelectedItmCod,long SelectedRscCod)
|
||||
{
|
||||
extern const char *Hlp_COURSE_Program;
|
||||
extern const char *Txt_Course_program;
|
||||
|
@ -216,16 +218,18 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
|||
static bool FirstTBodyOpen = false;
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *Args) =
|
||||
{
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = Prg_PutIconsListItems,
|
||||
[Prg_EDIT_ITEMS ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_NEW_END_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_EDIT_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_RECEIVE_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_EDIT_RESOURCES ] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_RES ] = Prg_PutIconsEditItems,
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = Prg_PutIconsListItems,
|
||||
[Prg_EDIT_ITEMS ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_NEW_END_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_NEW_CHILD_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_EDIT_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_RECEIVE_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_EDIT_RESOURCES ] = Prg_PutIconsEditItems,
|
||||
[Prg_SHOW_CLIPBOARD ] = Prg_PutIconsEditItems,
|
||||
[Prg_CHANGE_RESOURCE_LINK] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_RES ] = Prg_PutIconsEditItems,
|
||||
};
|
||||
|
||||
/***** Create numbers and hidden levels *****/
|
||||
|
@ -238,21 +242,23 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
|||
switch (ListingType)
|
||||
{
|
||||
case Prg_EDIT_ITEMS:
|
||||
if (ItmCod > 0)
|
||||
Prg_SetItemRangeWithAllChildren (Prg_GetNumItemFromItmCod (ItmCod),
|
||||
if (SelectedItmCod > 0)
|
||||
Prg_SetItemRangeWithAllChildren (Prg_GetNumItemFromItmCod (SelectedItmCod),
|
||||
&ToHighlight);
|
||||
break;
|
||||
case Prg_RECEIVE_ITEM:
|
||||
// case Prg_EDIT_RESOURCES: // Uncomment to higlight item
|
||||
// case Prg_SHOW_CLIPBOARD: // Uncomment to higlight item
|
||||
// case Prg_CHANGE_RESOURCE_LINK: // Uncomment to higlight item
|
||||
// case Prg_END_EDIT_RES: // Uncomment to higlight item
|
||||
if (ItmCod > 0)
|
||||
Prg_SetItemRangeOnlyItem (Prg_GetNumItemFromItmCod (ItmCod),
|
||||
if (SelectedItmCod > 0)
|
||||
Prg_SetItemRangeOnlyItem (Prg_GetNumItemFromItmCod (SelectedItmCod),
|
||||
&ToHighlight);
|
||||
break;
|
||||
case Prg_FORM_NEW_CHILD_ITEM:
|
||||
ParentItmCod = ItmCod; // Item code here is parent of the item to create
|
||||
NumItem = Prg_GetNumItemFromItmCod (ItmCod);
|
||||
ItmCod = Prg_Gbl.List.Items[Prg_GetLastChild (NumItem)].ItmCod;
|
||||
ParentItmCod = SelectedItmCod; // Item code here is parent of the item to create
|
||||
NumItem = Prg_GetNumItemFromItmCod (SelectedItmCod);
|
||||
SelectedItmCod = Prg_Gbl.List.Items[Prg_GetLastChild (NumItem)].ItmCod;
|
||||
FormLevel = Prg_GetLevelFromNumItem (NumItem) + 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -300,18 +306,20 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
|||
{
|
||||
case Prg_FORM_EDIT_ITEM:
|
||||
case Prg_EDIT_RESOURCES:
|
||||
case Prg_SHOW_CLIPBOARD:
|
||||
case Prg_CHANGE_RESOURCE_LINK:
|
||||
case Prg_END_EDIT_RES:
|
||||
if (Item.Hierarchy.ItmCod != ItmCod)
|
||||
if (Item.Hierarchy.ItmCod != SelectedItmCod)
|
||||
LT = Prg_EDIT_ITEMS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Prg_WriteRowItem (LT,NumItem,&Item);
|
||||
Prg_WriteRowItem (LT,NumItem,&Item,SelectedRscCod);
|
||||
|
||||
/* Show form to create child item? */
|
||||
if (ListingType == Prg_FORM_NEW_CHILD_ITEM &&
|
||||
Item.Hierarchy.ItmCod == ItmCod)
|
||||
Item.Hierarchy.ItmCod == SelectedItmCod)
|
||||
{
|
||||
The_ChangeRowColor ();
|
||||
Prg_WriteRowToCreateItem (ParentItmCod,FormLevel);
|
||||
|
@ -412,10 +420,12 @@ static void Prg_PutIconToViewProgram (void)
|
|||
|
||||
static void Prg_PutIconToCreateNewItem (void)
|
||||
{
|
||||
long ItmCod = -1L;
|
||||
struct Prg_ItmRsc SelectedItmRsc;
|
||||
|
||||
SelectedItmRsc.ItmCod = -1L;
|
||||
SelectedItmRsc.RscCod = -1L;
|
||||
Ico_PutContextualIconToAdd (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&ItmCod);
|
||||
Prg_PutParams,&SelectedItmRsc);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -425,10 +435,12 @@ static void Prg_PutIconToCreateNewItem (void)
|
|||
static void Prg_PutButtonToCreateNewItem (void)
|
||||
{
|
||||
extern const char *Txt_New_item;
|
||||
long ItmCod = -1L;
|
||||
struct Prg_ItmRsc SelectedItmRsc;
|
||||
|
||||
SelectedItmRsc.ItmCod = -1L;
|
||||
SelectedItmRsc.RscCod = -1L;
|
||||
Frm_BeginFormAnchor (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID);
|
||||
Prg_PutParams (&ItmCod);
|
||||
Prg_PutParams (&SelectedItmRsc);
|
||||
Btn_PutConfirmButton (Txt_New_item);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
@ -438,21 +450,24 @@ static void Prg_PutButtonToCreateNewItem (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||
unsigned NumItem,struct Prg_Item *Item)
|
||||
unsigned NumItem,struct Prg_Item *Item,
|
||||
long SelectedRscCod)
|
||||
{
|
||||
static unsigned UniqueId = 0;
|
||||
static bool PutFormsToRemEditOneItem[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = true,
|
||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = true,
|
||||
[Prg_FORM_EDIT_ITEM ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = true,
|
||||
[Prg_RECEIVE_ITEM ] = true,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = true,
|
||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
||||
[Prg_FORM_NEW_CHILD_ITEM ] = true,
|
||||
[Prg_FORM_EDIT_ITEM ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = true,
|
||||
[Prg_RECEIVE_ITEM ] = true,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_SHOW_CLIPBOARD ] = true,
|
||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
bool LightStyle;
|
||||
char *Id;
|
||||
|
@ -460,6 +475,7 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
unsigned NumCol;
|
||||
char *TitleClass;
|
||||
Dat_StartEndTime_t StartEndTime;
|
||||
struct Prg_ItmRsc SelectedItmRsc;
|
||||
|
||||
/***** Check if this item should be shown as hidden *****/
|
||||
Prg_SetHiddenLevel (Item->Hierarchy.Level,Item->Hierarchy.Hidden);
|
||||
|
@ -596,7 +612,9 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
}
|
||||
|
||||
/* List of resources */
|
||||
PrgRsc_ListItemResources (ListingType,Item->Hierarchy.ItmCod);
|
||||
SelectedItmRsc.ItmCod = Item->Hierarchy.ItmCod;
|
||||
SelectedItmRsc.RscCod = SelectedRscCod;
|
||||
PrgRsc_ListItemResources (ListingType,&SelectedItmRsc);
|
||||
|
||||
/* End text and resources */
|
||||
HTM_TD_End ();
|
||||
|
@ -868,21 +886,24 @@ static void Prg_PutFormsToRemEditOneItem (Prg_ListingType_t ListingType,
|
|||
[true ] = ActUnhPrgItm, // Hidden ==> action to unhide
|
||||
};
|
||||
char StrItemIndex[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
struct Prg_ItmRsc SelectedItmRsc;
|
||||
|
||||
/***** Initialize item index string *****/
|
||||
snprintf (StrItemIndex,sizeof (StrItemIndex),"%u",Item->Hierarchy.Index);
|
||||
|
||||
SelectedItmRsc.ItmCod = Item->Hierarchy.ItmCod;
|
||||
SelectedItmRsc.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,&Item->Hierarchy.ItmCod);
|
||||
Prg_PutParams,&SelectedItmRsc);
|
||||
|
||||
/***** Icon to hide/unhide program item *****/
|
||||
Ico_PutContextualIconToHideUnhide (ActionHideUnhide,"prg_highlighted",
|
||||
Prg_PutParams,&Item->Hierarchy.ItmCod,
|
||||
Prg_PutParams,&SelectedItmRsc,
|
||||
Item->Hierarchy.Hidden);
|
||||
|
||||
/***** Icon to edit program item *****/
|
||||
|
@ -890,24 +911,24 @@ static void Prg_PutFormsToRemEditOneItem (Prg_ListingType_t ListingType,
|
|||
{
|
||||
case Prg_FORM_EDIT_ITEM:
|
||||
Ico_PutContextualIconToView (ActSeePrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&Item->Hierarchy.ItmCod);
|
||||
Prg_PutParams,&SelectedItmRsc);
|
||||
break;
|
||||
default:
|
||||
Ico_PutContextualIconToEdit (ActFrmChgPrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&Item->Hierarchy.ItmCod);
|
||||
Prg_PutParams,&SelectedItmRsc);
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Icon to add a new child item inside this item *****/
|
||||
Ico_PutContextualIconToAdd (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID,
|
||||
Prg_PutParams,&Item->Hierarchy.ItmCod);
|
||||
Prg_PutParams,&SelectedItmRsc);
|
||||
|
||||
HTM_BR ();
|
||||
|
||||
/***** Icon to move up the item *****/
|
||||
if (Prg_CheckIfMoveUpIsAllowed (NumItem))
|
||||
Lay_PutContextualLinkOnlyIcon (ActUp_PrgItm,"prg_highlighted",
|
||||
Prg_PutParams,&Item->Hierarchy.ItmCod,
|
||||
Prg_PutParams,&SelectedItmRsc,
|
||||
"arrow-up.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-up.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -915,7 +936,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,&Item->Hierarchy.ItmCod,
|
||||
Prg_PutParams,&SelectedItmRsc,
|
||||
"arrow-down.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-down.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -923,7 +944,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,&Item->Hierarchy.ItmCod,
|
||||
Prg_PutParams,&SelectedItmRsc,
|
||||
"arrow-left.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-left.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -931,7 +952,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,&Item->Hierarchy.ItmCod,
|
||||
Prg_PutParams,&SelectedItmRsc,
|
||||
"arrow-right.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-right.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -1018,11 +1039,16 @@ static bool Prg_CheckIfMoveRightIsAllowed (unsigned NumItem)
|
|||
/******************** Params used to edit a program item *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Prg_PutParams (void *ItmCod)
|
||||
void Prg_PutParams (void *SelectedItmRsc)
|
||||
{
|
||||
if (ItmCod)
|
||||
if (*((long *) ItmCod) > 0)
|
||||
Prg_PutParamItmCod (*((long *) ItmCod));
|
||||
if (SelectedItmRsc)
|
||||
if (((struct Prg_ItmRsc *) SelectedItmRsc)->ItmCod > 0)
|
||||
{
|
||||
Prg_PutParamItmCod (((struct Prg_ItmRsc *) SelectedItmRsc)->ItmCod);
|
||||
|
||||
if (((struct Prg_ItmRsc *) SelectedItmRsc)->RscCod > 0)
|
||||
PrgRsc_PutParamRscCod (((struct Prg_ItmRsc *) SelectedItmRsc)->RscCod);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1249,6 +1275,7 @@ 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_ItmRsc SelectedItmRsc;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
Prg_GetListItems ();
|
||||
|
@ -1260,14 +1287,16 @@ void Prg_ReqRemItem (void)
|
|||
Err_WrongItemExit ();
|
||||
|
||||
/***** Show question and button to remove the program item *****/
|
||||
SelectedItmRsc.ItmCod = Item.Hierarchy.ItmCod;
|
||||
SelectedItmRsc.RscCod = -1L;
|
||||
Ale_ShowAlertAndButton (ActRemPrgItm,NULL,NULL,
|
||||
Prg_PutParams,&Item.Hierarchy.ItmCod,
|
||||
Prg_PutParams,&SelectedItmRsc,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_item,
|
||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_item_X,
|
||||
Item.Title);
|
||||
|
||||
/***** Show program items highlighting subtree *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -1307,7 +1336,7 @@ void Prg_RemoveItem (void)
|
|||
Prg_GetListItems ();
|
||||
|
||||
/***** Show course program without highlighting any item *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -1344,7 +1373,7 @@ static void Prg_HideOrUnhideItem (bool Hide)
|
|||
Prg_DB_HideOrUnhideItem (Item.Hierarchy.ItmCod,Hide);
|
||||
|
||||
/***** Show program items highlighting subtree *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -1407,13 +1436,13 @@ static void Prg_MoveUpDownItem (Prg_MoveUpDown_t UpDown)
|
|||
Prg_GetListItems ();
|
||||
|
||||
/* Show program items highlighting subtree */
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod,-1L);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Show course program without highlighting any item */
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L,-1L);
|
||||
}
|
||||
|
||||
/***** Free list of program items *****/
|
||||
|
@ -1602,13 +1631,13 @@ static void Prg_MoveLeftRightItem (Prg_MoveLeftRight_t LeftRight)
|
|||
Prg_GetListItems ();
|
||||
|
||||
/* Show program items highlighting subtree */
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,Item.Hierarchy.ItmCod,-1L);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Show course program without highlighting any item */
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,-1L,-1L);
|
||||
}
|
||||
|
||||
/***** Free list of program items *****/
|
||||
|
@ -1691,7 +1720,7 @@ void Prg_ViewItemAfterEdit (void)
|
|||
ItmCod = Prg_GetParamItmCod ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_END_EDIT_ITEM,ItmCod);
|
||||
Prg_ShowAllItems (Prg_END_EDIT_ITEM,ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -1712,7 +1741,7 @@ void Prg_RequestChangeItem (void)
|
|||
ItmCod = Prg_GetParamItmCod ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_FORM_EDIT_ITEM,ItmCod);
|
||||
Prg_ShowAllItems (Prg_FORM_EDIT_ITEM,ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -1735,7 +1764,7 @@ void Prg_RequestCreateItem (void)
|
|||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (ParentItmCod > 0 ? Prg_FORM_NEW_CHILD_ITEM :
|
||||
Prg_FORM_NEW_END_ITEM,
|
||||
ParentItmCod);
|
||||
ParentItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -1928,7 +1957,7 @@ void Prg_ReceiveFormChgItem (void)
|
|||
Prg_DB_UpdateItem (&Item,Description);
|
||||
|
||||
/***** Show program items highlighting the item just changed *****/
|
||||
Prg_ShowAllItems (Prg_RECEIVE_ITEM,Item.Hierarchy.ItmCod);
|
||||
Prg_ShowAllItems (Prg_RECEIVE_ITEM,Item.Hierarchy.ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -1980,7 +2009,7 @@ void Prg_ReceiveFormNewItem (void)
|
|||
Prg_GetListItems ();
|
||||
|
||||
/***** Show program items highlighting the item just created *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,NewItem.Hierarchy.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_ITEMS,NewItem.Hierarchy.ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef enum
|
|||
Prg_MOVE_RIGHT,
|
||||
} Prg_MoveLeftRight_t;
|
||||
|
||||
#define Prg_NUM_LISTING_TYPES 10
|
||||
#define Prg_NUM_LISTING_TYPES 12
|
||||
typedef enum
|
||||
{
|
||||
Prg_PRINT, // List items ready to be printed
|
||||
|
@ -85,9 +85,17 @@ typedef enum
|
|||
Prg_RECEIVE_ITEM, // Receive item data after create/edit
|
||||
|
||||
Prg_EDIT_RESOURCES, // List resources of a selected item for edition
|
||||
Prg_SHOW_CLIPBOARD, // Show clipboard in a resource to select a link
|
||||
Prg_CHANGE_RESOURCE_LINK, // Change resource link
|
||||
Prg_END_EDIT_RES, // List resources of a selected item after edition
|
||||
} Prg_ListingType_t;
|
||||
|
||||
struct Prg_ItmRsc // Used in forms to pass an item and a resource as parameters
|
||||
{
|
||||
long ItmCod;
|
||||
long RscCod;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -95,10 +103,11 @@ typedef enum
|
|||
void Prg_ShowCourseProgram (void);
|
||||
void Prg_EditCourseProgram (void);
|
||||
|
||||
void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod);
|
||||
void Prg_ShowAllItems (Prg_ListingType_t ListingType,
|
||||
long SelectedItmCod,long SelectedRscCod);
|
||||
|
||||
bool Prg_CheckIfICanEditProgram (void);
|
||||
void Prg_PutParams (void *ItmCod);
|
||||
void Prg_PutParams (void *SelectedItmRsc);
|
||||
|
||||
void Prg_GetListItems (void);
|
||||
void Prg_FreeListItems (void);
|
||||
|
|
|
@ -53,18 +53,14 @@ typedef enum
|
|||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static long PrgSrc_RscCodToBeRemoved = -1L;
|
||||
|
||||
static const char *PrgRsc_RESOURCE_SECTION_ID = "rsc_section";
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmCod);
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmCod);
|
||||
static void PrgSrc_PutIconToViewResources (long ItmCod);
|
||||
static void PrgSrc_PutIconToEditResources (long ItmCod);
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmRsc);
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmRsc);
|
||||
|
||||
static void PrgRsc_GetDataOfResourceByCod (struct PrgRsc_Resource *Resource);
|
||||
static void PrgRsc_GetDataOfResource (struct PrgRsc_Resource *Resource,
|
||||
|
@ -72,14 +68,17 @@ static void PrgRsc_GetDataOfResource (struct PrgRsc_Resource *Resource,
|
|||
static void PrgRsc_ResetResource (struct PrgRsc_Resource *Resource);
|
||||
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_WriteRowEditResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumRsc,unsigned NumResources,
|
||||
struct PrgRsc_Resource *Resource,
|
||||
struct Prg_ItmRsc *SelectedItmRsc);
|
||||
static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumResources,
|
||||
struct Prg_ItmRsc *SelectedItmRsc);
|
||||
static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
||||
unsigned NumResources,
|
||||
struct PrgRsc_Resource *Resource);
|
||||
static void PrgRsc_PutParams (void *RscCod);
|
||||
static void PrgRsc_PutParamRscCod (long RscCod);
|
||||
struct Prg_ItmRsc *ItmRsc,
|
||||
bool Hidden);
|
||||
static long PrgRsc_GetParamRscCod (void);
|
||||
|
||||
static void PrgRsc_HideOrUnhideResource (bool Hide);
|
||||
|
@ -103,7 +102,7 @@ void PrgRsc_ViewResourcesAfterEdit (void)
|
|||
ItmCod = Prg_GetParamItmCod ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_END_EDIT_RES,ItmCod);
|
||||
Prg_ShowAllItems (Prg_END_EDIT_RES,ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -124,7 +123,7 @@ void PrgRsc_EditResources (void)
|
|||
ItmCod = Prg_GetParamItmCod ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,ItmCod,-1L);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -134,7 +133,8 @@ void PrgRsc_EditResources (void)
|
|||
/****************************** List resources *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||
struct Prg_ItmRsc *SelectedItmRsc)
|
||||
{
|
||||
extern const char *Hlp_COURSE_Program;
|
||||
extern const char *Txt_Remove_resource;
|
||||
|
@ -145,63 +145,71 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
struct PrgRsc_Resource Resource;
|
||||
static bool GetHiddenResources[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = false,
|
||||
[Prg_FORM_EDIT_ITEM ] = false,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = false,
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
||||
[Prg_FORM_NEW_CHILD_ITEM ] = false,
|
||||
[Prg_FORM_EDIT_ITEM ] = false,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_SHOW_CLIPBOARD ] = true,
|
||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||
[Prg_END_EDIT_RES ] = false,
|
||||
};
|
||||
static bool ShowListWhenEmpty[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = true,
|
||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = true,
|
||||
[Prg_FORM_EDIT_ITEM ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = true,
|
||||
[Prg_RECEIVE_ITEM ] = true,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = true,
|
||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
||||
[Prg_FORM_NEW_CHILD_ITEM ] = true,
|
||||
[Prg_FORM_EDIT_ITEM ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = true,
|
||||
[Prg_RECEIVE_ITEM ] = true,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_SHOW_CLIPBOARD ] = true,
|
||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
static bool FeaturedList[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = false,
|
||||
[Prg_FORM_EDIT_ITEM ] = false,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
||||
[Prg_FORM_NEW_CHILD_ITEM ] = false,
|
||||
[Prg_FORM_EDIT_ITEM ] = false,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_SHOW_CLIPBOARD ] = true,
|
||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *Args) =
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *ItmRsc) =
|
||||
{
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = NULL,
|
||||
[Prg_EDIT_ITEMS ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_NEW_END_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_END_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_RECEIVE_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_EDIT_RESOURCES ] = PrgRsc_PutIconsViewResources,
|
||||
[Prg_END_EDIT_RES ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = NULL,
|
||||
[Prg_EDIT_ITEMS ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_NEW_END_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_NEW_CHILD_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_END_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_RECEIVE_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_EDIT_RESOURCES ] = PrgRsc_PutIconsViewResources,
|
||||
[Prg_SHOW_CLIPBOARD ] = PrgRsc_PutIconsViewResources,
|
||||
[Prg_CHANGE_RESOURCE_LINK] = PrgRsc_PutIconsViewResources,
|
||||
[Prg_END_EDIT_RES ] = PrgRsc_PutIconsEditResources,
|
||||
};
|
||||
|
||||
/***** Trivial check *****/
|
||||
if (ItmCod <= 0)
|
||||
if (SelectedItmRsc->ItmCod <= 0)
|
||||
return;
|
||||
|
||||
/***** Get list of item resources from database *****/
|
||||
NumResources = Prg_DB_GetListResources (&mysql_res,ItmCod,
|
||||
NumResources = Prg_DB_GetListResources (&mysql_res,SelectedItmRsc->ItmCod,
|
||||
GetHiddenResources[ListingType]);
|
||||
|
||||
if (NumResources || ShowListWhenEmpty[ListingType])
|
||||
|
@ -217,7 +225,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
case ActReqRemPrgRsc:
|
||||
/* Alert with button to remove resource */
|
||||
Ale_ShowLastAlertAndButton (ActRemPrgRsc,PrgRsc_RESOURCE_SECTION_ID,NULL,
|
||||
PrgRsc_PutParams,&PrgSrc_RscCodToBeRemoved,
|
||||
Prg_PutParams,SelectedItmRsc,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_resource);
|
||||
break;
|
||||
default:
|
||||
|
@ -227,7 +235,7 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin ("100%",Txt_Resources,
|
||||
FunctionToDrawContextualIcons[ListingType],&ItmCod,
|
||||
FunctionToDrawContextualIcons[ListingType],SelectedItmRsc,
|
||||
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Table *****/
|
||||
|
@ -246,7 +254,11 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
switch (ListingType)
|
||||
{
|
||||
case Prg_EDIT_RESOURCES:
|
||||
PrgRsc_WriteRowEditResource (NumRsc,NumResources,&Resource);
|
||||
case Prg_SHOW_CLIPBOARD:
|
||||
case Prg_CHANGE_RESOURCE_LINK:
|
||||
PrgRsc_WriteRowEditResource (ListingType,
|
||||
NumRsc,NumResources,
|
||||
&Resource,SelectedItmRsc);
|
||||
break;
|
||||
default:
|
||||
PrgRsc_WriteRowViewResource (NumRsc,&Resource);
|
||||
|
@ -255,8 +267,17 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
}
|
||||
|
||||
/***** Form to create a new resource *****/
|
||||
if (ListingType == Prg_EDIT_RESOURCES)
|
||||
PrgRsc_WriteRowNewResource (ItmCod,NumResources);
|
||||
switch (ListingType)
|
||||
{
|
||||
case Prg_EDIT_RESOURCES:
|
||||
case Prg_SHOW_CLIPBOARD:
|
||||
case Prg_CHANGE_RESOURCE_LINK:
|
||||
PrgRsc_WriteRowNewResource (ListingType,NumResources,
|
||||
SelectedItmRsc);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TBODY_End ();
|
||||
|
@ -278,38 +299,24 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
/************** Put contextual icons in list of item resources ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmCod)
|
||||
static void PrgRsc_PutIconsViewResources (void *ItmRsc)
|
||||
{
|
||||
/***** Put icon to create a new item resource *****/
|
||||
if (ItmCod)
|
||||
if (*((long *) ItmCod) > 0)
|
||||
if (ItmRsc)
|
||||
if (((struct Prg_ItmRsc *) ItmRsc)->ItmCod > 0)
|
||||
if (Prg_CheckIfICanEditProgram ())
|
||||
PrgSrc_PutIconToViewResources (*((long *) ItmCod));
|
||||
Ico_PutContextualIconToView (ActFrmSeePrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRsc);
|
||||
}
|
||||
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmCod)
|
||||
static void PrgRsc_PutIconsEditResources (void *ItmRsc)
|
||||
{
|
||||
/***** Put icon to create a new item resource *****/
|
||||
if (ItmCod)
|
||||
if (*((long *) ItmCod) > 0)
|
||||
if (ItmRsc)
|
||||
if (((struct Prg_ItmRsc *) ItmRsc)->ItmCod > 0)
|
||||
if (Prg_CheckIfICanEditProgram ())
|
||||
PrgSrc_PutIconToEditResources (*((long *) ItmCod));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Put icon to edit item resources ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgSrc_PutIconToViewResources (long ItmCod)
|
||||
{
|
||||
Ico_PutContextualIconToView (ActFrmSeePrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,&ItmCod);
|
||||
}
|
||||
|
||||
static void PrgSrc_PutIconToEditResources (long ItmCod)
|
||||
{
|
||||
Ico_PutContextualIconToEdit (ActFrmEdiPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,&ItmCod);
|
||||
Ico_PutContextualIconToEdit (ActFrmEdiPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,ItmRsc);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -412,27 +419,35 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
/************************** Edit one item resource ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||
struct PrgRsc_Resource *Resource)
|
||||
static void PrgRsc_WriteRowEditResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumRsc,unsigned NumResources,
|
||||
struct PrgRsc_Resource *Resource,
|
||||
struct Prg_ItmRsc *SelectedItmRsc)
|
||||
{
|
||||
struct Prg_ItmRsc ItmRsc;
|
||||
|
||||
ItmRsc.ItmCod = Resource->ItmCod;
|
||||
ItmRsc.RscCod = Resource->Rsc.Cod;
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this item resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LM %s\"",The_GetColorRows1 ());
|
||||
PrgRsc_PutFormsToRemEditOneResource (NumRsc,NumResources,Resource);
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"",The_GetColorRows1 ());
|
||||
PrgRsc_PutFormsToRemEditOneResource (NumRsc,NumResources,
|
||||
&ItmRsc,Resource->Hidden);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RM %s\"",
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RT %s\"",
|
||||
The_GetSuffix (),The_GetColorRows1 ());
|
||||
HTM_Unsigned (NumRsc + 1);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows1 ());
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 ());
|
||||
Frm_BeginFormAnchor (ActRenPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
PrgRsc_PutParamRscCod (Resource->Rsc.Cod);
|
||||
Prg_PutParams (&ItmRsc);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,Resource->Title,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
|
@ -441,11 +456,24 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
HTM_TD_End ();
|
||||
|
||||
/***** Link to resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows1 ());
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 ());
|
||||
Ico_PutContextualIconToGetLink (ActChgLnkPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
PrgRsc_PutParams,&Resource->Rsc.Cod);
|
||||
Prg_PutParams,&ItmRsc);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Show clipboard to change resource link *****/
|
||||
switch (ListingType)
|
||||
{
|
||||
case Prg_SHOW_CLIPBOARD:
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 ());
|
||||
if (Resource->Rsc.Cod == SelectedItmRsc->RscCod)
|
||||
Ale_ShowAlert (Ale_INFO,"Clipboard for existing resource");
|
||||
HTM_TD_End ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/***** End row *****/
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
@ -454,25 +482,32 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
/************************* Edit a new item resource **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteRowNewResource (long ItmCod,unsigned NumRsc)
|
||||
static void PrgRsc_WriteRowNewResource (Prg_ListingType_t ListingType,
|
||||
unsigned NumResources,
|
||||
struct Prg_ItmRsc *SelectedItmRsc)
|
||||
{
|
||||
struct Prg_ItmRsc ItmRsc;
|
||||
|
||||
ItmRsc.ItmCod = SelectedItmRsc->ItmCod;
|
||||
ItmRsc.RscCod = -1L;
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this item resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LM %s\"",The_GetColorRows1 ());
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"",The_GetColorRows1 ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RM %s\"",
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RT %s\"",
|
||||
The_GetSuffix (),The_GetColorRows1 ());
|
||||
HTM_Unsigned (NumRsc + 1);
|
||||
HTM_Unsigned (NumResources + 1);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows1 ());
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 ());
|
||||
Frm_BeginFormAnchor (ActNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
Prg_PutParamItmCod (ItmCod);
|
||||
Prg_PutParams (&ItmRsc);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,"",
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"placeholder=\"%s\""
|
||||
|
@ -483,11 +518,24 @@ static void PrgRsc_WriteRowNewResource (long ItmCod,unsigned NumRsc)
|
|||
HTM_TD_End ();
|
||||
|
||||
/***** Link to resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows1 ());
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 ());
|
||||
Ico_PutContextualIconToGetLink (ActChgLnkPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
PrgRsc_PutParams,NULL);
|
||||
Prg_PutParams,&ItmRsc);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Show clipboard to change resource link *****/
|
||||
switch (ListingType)
|
||||
{
|
||||
case Prg_SHOW_CLIPBOARD:
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LT %s\"",The_GetColorRows1 ());
|
||||
if (ItmRsc.RscCod == SelectedItmRsc->RscCod)
|
||||
Ale_ShowAlert (Ale_INFO,"Clipboard for new resource");
|
||||
HTM_TD_End ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/***** End row *****/
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
@ -498,7 +546,8 @@ static void PrgRsc_WriteRowNewResource (long ItmCod,unsigned NumRsc)
|
|||
|
||||
static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
||||
unsigned NumResources,
|
||||
struct PrgRsc_Resource *Resource)
|
||||
struct Prg_ItmRsc *ItmRsc,
|
||||
bool Hidden)
|
||||
{
|
||||
static Act_Action_t ActionHideUnhide[2] =
|
||||
{
|
||||
|
@ -513,25 +562,17 @@ static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
|||
case Rol_SYS_ADM:
|
||||
/***** Icon to remove item resource *****/
|
||||
Ico_PutContextualIconToRemove (ActReqRemPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
PrgRsc_PutParams,&Resource->Rsc.Cod);
|
||||
Prg_PutParams,ItmRsc);
|
||||
|
||||
/***** Icon to hide/unhide item resource *****/
|
||||
Ico_PutContextualIconToHideUnhide (ActionHideUnhide,PrgRsc_RESOURCE_SECTION_ID,
|
||||
PrgRsc_PutParams,&Resource->Rsc.Cod,
|
||||
Resource->Hidden);
|
||||
|
||||
/***** Icon to edit program resource *****/
|
||||
// Ico_PutContextualIconToEdit (ActFrmChgPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
// PrgRsc_PutParams,&Resource->Rsc.Cod,);
|
||||
|
||||
/***** Icon to add a new resource after this resource *****/
|
||||
// Ico_PutContextualIconToAdd (ActFrmNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
// PrgRsc_PutParams,&Resource->Rsc.Cod,);
|
||||
Prg_PutParams,ItmRsc,
|
||||
Hidden);
|
||||
|
||||
/***** Icon to move up the item *****/
|
||||
if (NumRsc > 0)
|
||||
Lay_PutContextualLinkOnlyIcon (ActUp_PrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
PrgRsc_PutParams,&Resource->Rsc.Cod,
|
||||
Prg_PutParams,ItmRsc,
|
||||
"arrow-up.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-up.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -539,7 +580,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,
|
||||
PrgRsc_PutParams,&Resource->Rsc.Cod,
|
||||
Prg_PutParams,ItmRsc,
|
||||
"arrow-down.svg",Ico_BLACK);
|
||||
else
|
||||
Ico_PutIconOff ("arrow-down.svg",Ico_BLACK,Txt_Movement_not_allowed);
|
||||
|
@ -552,22 +593,11 @@ static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Params used to edit a program item *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutParams (void *RscCod)
|
||||
{
|
||||
if (RscCod)
|
||||
if (*((long *) RscCod) > 0)
|
||||
PrgRsc_PutParamRscCod (*((long *) RscCod));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Write parameter with code of program item ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutParamRscCod (long RscCod)
|
||||
void PrgRsc_PutParamRscCod (long RscCod)
|
||||
{
|
||||
Par_PutHiddenParamLong (NULL,"RscCod",RscCod);
|
||||
}
|
||||
|
@ -580,6 +610,7 @@ static long PrgRsc_GetParamRscCod (void)
|
|||
{
|
||||
return Par_GetParToLong ("RscCod");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Rename resource ****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -602,7 +633,7 @@ void PrgRsc_CreateResource (void)
|
|||
Resource.Rsc.Cod = Prg_DB_CreateResource (&Resource);
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod,Resource.Rsc.Cod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -634,7 +665,7 @@ void PrgRsc_RenameResource (void)
|
|||
Prg_DB_UpdateResourceTitle (Resource.Rsc.Cod,Resource.ItmCod,NewTitle);
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod,Resource.Rsc.Cod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -662,10 +693,9 @@ void PrgRsc_ReqRemResource (void)
|
|||
Ale_CreateAlert (Ale_QUESTION,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Txt_Do_you_really_want_to_remove_the_resource_X,
|
||||
Resource.Title);
|
||||
PrgSrc_RscCodToBeRemoved = Resource.Rsc.Cod;
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod,Resource.Rsc.Cod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -697,7 +727,7 @@ void PrgRsc_RemoveResource (void)
|
|||
Txt_Resource_X_removed,Resource.Title);
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod,Resource.Rsc.Cod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -734,7 +764,7 @@ static void PrgRsc_HideOrUnhideResource (bool Hide)
|
|||
Prg_DB_HideOrUnhideResource (Resource.Rsc.Cod,Hide);
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod,Resource.Rsc.Cod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -788,7 +818,7 @@ static void PrgRsc_MoveUpDownResource (PrgRsc_MoveUpDown_t UpDown)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod);
|
||||
Prg_ShowAllItems (Prg_EDIT_RESOURCES,Resource.ItmCod,Resource.Rsc.Cod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -842,10 +872,31 @@ static bool PrgRsc_ExchangeResources (const struct PrgRsc_Rsc *Rsc1,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Change resource link ***************************/
|
||||
/***************** Show clipboard to change resource link ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_ChangeResourceLink (void)
|
||||
void PrgRsc_ShowClipboardToChgLink (void)
|
||||
{
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented.");
|
||||
struct PrgRsc_Resource Resource;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
Prg_GetListItems ();
|
||||
|
||||
/***** Get data of the item resource from database *****/
|
||||
Resource.Rsc.Cod = PrgRsc_GetParamRscCod ();
|
||||
if (Resource.Rsc.Cod > 0) // Resource selected ==> get item code from database using resource code
|
||||
PrgRsc_GetDataOfResourceByCod (&Resource);
|
||||
else // No resource selected ==> get item code directly from parameter
|
||||
{
|
||||
PrgRsc_ResetResource (&Resource);
|
||||
Resource.ItmCod = Prg_GetParamItmCod ();
|
||||
}
|
||||
if (Resource.ItmCod <= 0)
|
||||
Err_WrongResourceExit ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_SHOW_CLIPBOARD,Resource.ItmCod,Resource.Rsc.Cod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
}
|
||||
|
|
|
@ -78,7 +78,10 @@ typedef enum
|
|||
void PrgRsc_ViewResourcesAfterEdit (void);
|
||||
void PrgRsc_EditResources (void);
|
||||
|
||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod);
|
||||
void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||
struct Prg_ItmRsc *SelectedItmRsc);
|
||||
|
||||
void PrgRsc_PutParamRscCod (long RscCod);
|
||||
|
||||
void PrgRsc_CreateResource (void);
|
||||
|
||||
|
@ -93,6 +96,6 @@ void PrgRsc_UnhideResource (void);
|
|||
void PrgRsc_MoveUpResource (void);
|
||||
void PrgRsc_MoveDownResource (void);
|
||||
|
||||
void PrgRsc_ChangeResourceLink (void);
|
||||
void PrgRsc_ShowClipboardToChgLink (void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue