mirror of https://github.com/acanas/swad-core.git
Version 21.108: Jul 18, 2022 Changes in edition of program items.
This commit is contained in:
parent
942db928ce
commit
88a6c1f748
|
@ -1773,6 +1773,14 @@ a:hover img.CENTER_PHOTO_SHOW
|
|||
to {opacity:1;}
|
||||
}
|
||||
|
||||
.PRG_RSC_WHITE,
|
||||
.PRG_RSC_GREY,
|
||||
.PRG_RSC_PURPLE,
|
||||
.PRG_RSC_BLUE,
|
||||
.PRG_RSC_YELLOW,
|
||||
.PRG_RSC_PINK {color:#202020; font-size:14pt; font-weight:bold;}
|
||||
.PRG_RSC_DARK {color:#e0e0e0; font-size:14pt; font-weight:bold;}
|
||||
|
||||
/********************************** Notice ***********************************/
|
||||
.NOTICE_CONT
|
||||
{
|
|
@ -442,7 +442,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
[ActLftPrgItm ] = {1834,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prg_MoveLeftItem ,NULL},
|
||||
[ActRgtPrgItm ] = {1833,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prg_MoveRightItem ,NULL},
|
||||
|
||||
[ActFrmNewPrgRsc ] = {1918,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prg_RequestChangeItem ,NULL},
|
||||
[ActFrmEdiPrgRsc ] = {1918,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_EditResources ,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},
|
||||
[ActHidPrgRsc ] = {1921,-1,TabUnk,ActSeePrg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrgRsc_HideResource ,NULL},
|
||||
|
@ -3752,7 +3752,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
-1, // #1915 (obsolete action)
|
||||
-1, // #1916 (obsolete action)
|
||||
ActChgUsrPho, // #1917
|
||||
ActFrmNewPrgRsc, // #1918
|
||||
ActFrmEdiPrgRsc, // #1918
|
||||
ActReqRemPrgRsc, // #1919
|
||||
ActRemPrgRsc, // #1920
|
||||
ActHidPrgRsc, // #1921
|
||||
|
|
|
@ -408,7 +408,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActDwnPrgItm (ActChgCrsSta + 25)
|
||||
#define ActLftPrgItm (ActChgCrsSta + 26)
|
||||
#define ActRgtPrgItm (ActChgCrsSta + 27)
|
||||
#define ActFrmNewPrgRsc (ActChgCrsSta + 28)
|
||||
#define ActFrmEdiPrgRsc (ActChgCrsSta + 28)
|
||||
#define ActReqRemPrgRsc (ActChgCrsSta + 29)
|
||||
#define ActRemPrgRsc (ActChgCrsSta + 30)
|
||||
#define ActHidPrgRsc (ActChgCrsSta + 31)
|
||||
|
|
|
@ -606,10 +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 21.107 (2022-07-15)"
|
||||
#define CSS_FILE "swad21.103.6.css"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.108 (2022-07-18)"
|
||||
#define CSS_FILE "swad21.107.1.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 21.108: Jul 18, 2022 Changes in edition of program items. (328908 lines)
|
||||
Version 21.107.1: Jul 17, 2022 Changes in layout of resources of program item. (? lines)
|
||||
Version 21.107: Jul 15, 2022 Move up/down resource of program item. (328953 lines)
|
||||
Version 21.106: Jul 14, 2022 Hide/unhide resource of program item. (328816 lines)
|
||||
Version 21.105: Jul 14, 2022 Removing resource from program item. (328617 lines)
|
||||
|
|
246
swad_program.c
246
swad_program.c
|
@ -110,9 +110,8 @@ static void Prg_PutIconToCreateNewItem (void);
|
|||
static void Prg_PutButtonToCreateNewItem (void);
|
||||
|
||||
static void Prg_WriteRowItem (unsigned NumItem,struct Prg_Item *Item,
|
||||
bool PrintView);
|
||||
static void Prg_WriteRowWithItemForm (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
||||
long ItmCod,unsigned FormLevel);
|
||||
Prg_ShowItemForm_t ShowItemForm);
|
||||
static void Prg_WriteRowToCreateItem (long ItmCod,unsigned FormLevel);
|
||||
static void Prg_SetTitleClass (char **TitleClass,unsigned Level,bool LightStyle);
|
||||
static void Prg_FreeTitleClass (char *TitleClass);
|
||||
|
||||
|
@ -143,7 +142,6 @@ static void Prg_GetDataOfItem (struct Prg_Item *Item,
|
|||
unsigned NumRows);
|
||||
static void Prg_ResetItem (struct Prg_Item *Item);
|
||||
static void Prg_PutParamItmCod (long ItmCod);
|
||||
static long Prg_GetParamItmCod (void);
|
||||
|
||||
static void Prg_HideOrUnhideItem (bool Hide);
|
||||
|
||||
|
@ -189,16 +187,16 @@ void Prg_ShowCourseProgram (void)
|
|||
void Prg_ShowCourseProgramHighlightingItem (const struct Prg_ItemRange *ToHighlight)
|
||||
{
|
||||
/***** Show all program items *****/
|
||||
Prg_ShowAllItems (Prg_DONT_PUT_FORM_ITEM,ToHighlight,-1L,-1L,0);
|
||||
Prg_ShowAllItems (Prg_ITEM_VIEW,ToHighlight,-1L,-1L,0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Show all program items ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
||||
void Prg_ShowAllItems (Prg_ShowItemForm_t ShowItemForm,
|
||||
const struct Prg_ItemRange *ToHighlight,
|
||||
long ParentItmCod,long ItmCodBeforeForm,unsigned FormLevel)
|
||||
long ParentItmCod,long ItmCod,unsigned FormLevel)
|
||||
{
|
||||
extern const char *Hlp_COURSE_Program;
|
||||
extern const char *Txt_Course_program;
|
||||
|
@ -245,23 +243,30 @@ void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
|||
HTM_TBODY_Begin ("id=\"prg_highlighted\""); // Highlighted tbody start
|
||||
}
|
||||
|
||||
/* Show item */
|
||||
Prg_WriteRowItem (NumItem,&Item,false); // Not print view
|
||||
|
||||
/* Show form to create/change item */
|
||||
if (Item.Hierarchy.ItmCod == ItmCodBeforeForm)
|
||||
switch (CreateOrChangeItem)
|
||||
{
|
||||
case Prg_DONT_PUT_FORM_ITEM:
|
||||
break;
|
||||
case Prg_PUT_FORM_CREATE_ITEM:
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CREATE_ITEM,
|
||||
ParentItmCod,FormLevel);
|
||||
break;
|
||||
case Prg_PUT_FORM_CHANGE_ITEM:
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
ItmCodBeforeForm,FormLevel);
|
||||
}
|
||||
/* Show form to create item */
|
||||
switch (ShowItemForm)
|
||||
{
|
||||
case Prg_ITEM_PRINT:
|
||||
case Prg_ITEM_VIEW:
|
||||
case Prg_ITEM_EDIT_BUTTONS:
|
||||
Prg_WriteRowItem (NumItem,&Item,Prg_ITEM_EDIT_BUTTONS);
|
||||
break;
|
||||
case Prg_ITEM_CREATE_FORM:
|
||||
Prg_WriteRowItem (NumItem,&Item,Prg_ITEM_EDIT_BUTTONS);
|
||||
if (Item.Hierarchy.ItmCod == ItmCod)
|
||||
Prg_WriteRowToCreateItem (ParentItmCod,FormLevel);
|
||||
break;
|
||||
case Prg_ITEM_CHANGE_FORM:
|
||||
Prg_WriteRowItem (NumItem,&Item,
|
||||
Item.Hierarchy.ItmCod == ItmCod ? Prg_ITEM_CHANGE_FORM :
|
||||
Prg_ITEM_EDIT_BUTTONS);
|
||||
break;
|
||||
case Prg_ITEM_CHANGE_RESOURCES:
|
||||
Prg_WriteRowItem (NumItem,&Item,
|
||||
Item.Hierarchy.ItmCod == ItmCod ? Prg_ITEM_CHANGE_RESOURCES :
|
||||
Prg_ITEM_EDIT_BUTTONS);
|
||||
break;
|
||||
}
|
||||
|
||||
/* End range to highlight? */
|
||||
if (Item.Hierarchy.Index == ToHighlight->End) // End of the highlighted range
|
||||
|
@ -275,9 +280,8 @@ void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
|||
}
|
||||
|
||||
/***** Create item at the end? *****/
|
||||
if (ItmCodBeforeForm <= 0 &&
|
||||
CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM)
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CREATE_ITEM,-1L,1);
|
||||
if (ItmCod <= 0 && ShowItemForm == Prg_ITEM_CREATE_FORM)
|
||||
Prg_WriteRowToCreateItem (-1L,1);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TBODY_End (); // 3rd tbody end
|
||||
|
@ -350,7 +354,7 @@ static void Prg_PutButtonToCreateNewItem (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Prg_WriteRowItem (unsigned NumItem,struct Prg_Item *Item,
|
||||
bool PrintView)
|
||||
Prg_ShowItemForm_t ShowItemForm)
|
||||
{
|
||||
static unsigned UniqueId = 0;
|
||||
bool LightStyle;
|
||||
|
@ -378,12 +382,19 @@ static void Prg_WriteRowItem (unsigned NumItem,struct Prg_Item *Item,
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this program item *****/
|
||||
if (!PrintView)
|
||||
{
|
||||
HTM_TD_Begin ("rowspan=\"2\" class=\"PRG_COL1 LT %s\"",The_GetColorRows ());
|
||||
Prg_PutFormsToRemEditOneItem (NumItem,Item);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
switch (ShowItemForm)
|
||||
{
|
||||
case Prg_ITEM_EDIT_BUTTONS:
|
||||
case Prg_ITEM_CHANGE_FORM:
|
||||
case Prg_ITEM_CHANGE_RESOURCES:
|
||||
HTM_TD_Begin ("rowspan=\"2\" class=\"PRG_COL1 LT %s\"",
|
||||
The_GetColorRows ());
|
||||
Prg_PutFormsToRemEditOneItem (NumItem,Item);
|
||||
HTM_TD_End ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Indent depending on the level *****/
|
||||
for (NumCol = 1;
|
||||
|
@ -402,13 +413,18 @@ static void Prg_WriteRowItem (unsigned NumItem,struct Prg_Item *Item,
|
|||
|
||||
/***** Title *****/
|
||||
ColSpan = (Prg_GetMaxItemLevel () + 2) - Item->Hierarchy.Level;
|
||||
if (PrintView)
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN %s\"",
|
||||
ColSpan,TitleClass);
|
||||
else
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN %s %s\"",
|
||||
ColSpan,TitleClass,The_GetColorRows ());
|
||||
HTM_Txt (Item->Title);
|
||||
switch (ShowItemForm)
|
||||
{
|
||||
case Prg_ITEM_PRINT:
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN %s\"",
|
||||
ColSpan,TitleClass);
|
||||
break;
|
||||
default:
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN %s %s\"",
|
||||
ColSpan,TitleClass,The_GetColorRows ());
|
||||
break;
|
||||
}
|
||||
HTM_Txt (Item->Title);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Start/end date/time *****/
|
||||
|
@ -420,26 +436,31 @@ static void Prg_WriteRowItem (unsigned NumItem,struct Prg_Item *Item,
|
|||
{
|
||||
if (asprintf (&Id,"scd_date_%u_%u",(unsigned) StartEndTime,UniqueId) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
if (PrintView)
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"PRG_DATE LT %s_%s\"",
|
||||
Id,
|
||||
LightStyle ? (Item->Open ? "DATE_GREEN_LIGHT" :
|
||||
"DATE_RED_LIGHT") :
|
||||
(Item->Open ? "DATE_GREEN" :
|
||||
"DATE_RED"),
|
||||
The_GetSuffix ());
|
||||
else
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"PRG_DATE LT %s_%s %s\"",
|
||||
Id,
|
||||
LightStyle ? (Item->Open ? "DATE_GREEN_LIGHT" :
|
||||
"DATE_RED_LIGHT") :
|
||||
(Item->Open ? "DATE_GREEN" :
|
||||
"DATE_RED"),
|
||||
The_GetSuffix (),
|
||||
The_GetColorRows ());
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Item->TimeUTC[StartEndTime],
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||
true,true,true,0x7);
|
||||
switch (ShowItemForm)
|
||||
{
|
||||
case Prg_ITEM_PRINT:
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"PRG_DATE LT %s_%s\"",
|
||||
Id,
|
||||
LightStyle ? (Item->Open ? "DATE_GREEN_LIGHT" :
|
||||
"DATE_RED_LIGHT") :
|
||||
(Item->Open ? "DATE_GREEN" :
|
||||
"DATE_RED"),
|
||||
The_GetSuffix ());
|
||||
break;
|
||||
default:
|
||||
HTM_TD_Begin ("id=\"%s\" class=\"PRG_DATE LT %s_%s %s\"",
|
||||
Id,
|
||||
LightStyle ? (Item->Open ? "DATE_GREEN_LIGHT" :
|
||||
"DATE_RED_LIGHT") :
|
||||
(Item->Open ? "DATE_GREEN" :
|
||||
"DATE_RED"),
|
||||
The_GetSuffix (),
|
||||
The_GetColorRows ());
|
||||
break;
|
||||
}
|
||||
Dat_WriteLocalDateHMSFromUTC (Id,Item->TimeUTC[StartEndTime],
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
||||
true,true,true,0x7);
|
||||
HTM_TD_End ();
|
||||
free (Id);
|
||||
}
|
||||
|
@ -452,27 +473,51 @@ static void Prg_WriteRowItem (unsigned NumItem,struct Prg_Item *Item,
|
|||
|
||||
/* Begin text and resources */
|
||||
ColSpan += 2;
|
||||
if (PrintView)
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN\"",
|
||||
ColSpan);
|
||||
else
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN %s\"",
|
||||
ColSpan,The_GetColorRows ());
|
||||
switch (ShowItemForm)
|
||||
{
|
||||
case Prg_ITEM_PRINT:
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN\"",ColSpan);
|
||||
break;
|
||||
default:
|
||||
HTM_TD_Begin ("colspan=\"%u\" class=\"PRG_MAIN %s\"",
|
||||
ColSpan,The_GetColorRows ());
|
||||
break;
|
||||
}
|
||||
|
||||
/* Text */
|
||||
Prg_DB_GetItemTxt (Item->Hierarchy.ItmCod,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||
ALn_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
HTM_DIV_Begin ("class=\"PAR PRG_TXT_%s%s\"",
|
||||
The_GetSuffix (),
|
||||
LightStyle ? " PRG_HIDDEN" :
|
||||
"");
|
||||
HTM_Txt (Txt);
|
||||
HTM_DIV_End ();
|
||||
/* Item text / form */
|
||||
switch (ShowItemForm)
|
||||
{
|
||||
case Prg_ITEM_CHANGE_FORM:
|
||||
/* Form to change item title, dates and text */
|
||||
HTM_ARTICLE_Begin ("item_form");
|
||||
Prg_ShowFormToChangeItem (Item->Hierarchy.ItmCod);
|
||||
HTM_ARTICLE_End ();
|
||||
break;
|
||||
default:
|
||||
/* Text */
|
||||
Prg_DB_GetItemTxt (Item->Hierarchy.ItmCod,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||
ALn_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
HTM_DIV_Begin ("class=\"PAR PRG_TXT_%s%s\"",
|
||||
The_GetSuffix (),
|
||||
LightStyle ? " PRG_HIDDEN" :
|
||||
"");
|
||||
HTM_Txt (Txt);
|
||||
HTM_DIV_End ();
|
||||
break;
|
||||
}
|
||||
|
||||
/* List of resources */
|
||||
PrgRsc_ShowResources (Item->Hierarchy.ItmCod);
|
||||
switch (ShowItemForm)
|
||||
{
|
||||
case Prg_ITEM_CHANGE_RESOURCES:
|
||||
PrgRsc_ListResourcesToEdit (Item->Hierarchy.ItmCod);
|
||||
break;
|
||||
default:
|
||||
PrgRsc_ListResourcesToShow (Item->Hierarchy.ItmCod);
|
||||
break;
|
||||
}
|
||||
|
||||
/* End text and resources */
|
||||
HTM_TD_End ();
|
||||
|
@ -488,29 +533,17 @@ static void Prg_WriteRowItem (unsigned NumItem,struct Prg_Item *Item,
|
|||
/**************************** Show item form *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Prg_WriteRowWithItemForm (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
||||
long ItmCod,unsigned FormLevel)
|
||||
static void Prg_WriteRowToCreateItem (long ItmCod,unsigned FormLevel)
|
||||
{
|
||||
char *TitleClass;
|
||||
unsigned ColSpan;
|
||||
unsigned NumCol;
|
||||
static void (*ShowForm[Prg_NUM_TYPES_FORMS])(long ItmCod) =
|
||||
{
|
||||
[Prg_DONT_PUT_FORM_ITEM ] = NULL,
|
||||
[Prg_PUT_FORM_CREATE_ITEM] = Prg_ShowFormToCreateItem,
|
||||
[Prg_PUT_FORM_CHANGE_ITEM] = Prg_ShowFormToChangeItem,
|
||||
};
|
||||
|
||||
/***** Trivial check *****/
|
||||
if (CreateOrChangeItem == Prg_DONT_PUT_FORM_ITEM)
|
||||
return;
|
||||
|
||||
/***** Title CSS class *****/
|
||||
Prg_SetTitleClass (&TitleClass,FormLevel,false);
|
||||
|
||||
/***** Change color row? *****/
|
||||
if (CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM)
|
||||
The_ChangeRowColor ();
|
||||
/***** Change color *****/
|
||||
The_ChangeRowColor ();
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -531,8 +564,7 @@ static void Prg_WriteRowWithItemForm (Prg_CreateOrChangeItem_t CreateOrChangeIte
|
|||
/***** Item number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM %s RT %s\"",
|
||||
TitleClass,The_GetColorRows ());
|
||||
if (CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM)
|
||||
Prg_WriteNumNewItem (FormLevel);
|
||||
Prg_WriteNumNewItem (FormLevel);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Show form to create new item as child *****/
|
||||
|
@ -541,12 +573,8 @@ static void Prg_WriteRowWithItemForm (Prg_CreateOrChangeItem_t CreateOrChangeIte
|
|||
ColSpan,The_GetColorRows ());
|
||||
/* Form for item data */
|
||||
HTM_ARTICLE_Begin ("item_form");
|
||||
ShowForm[CreateOrChangeItem] (ItmCod);
|
||||
Prg_ShowFormToCreateItem (ItmCod);
|
||||
HTM_ARTICLE_End ();
|
||||
|
||||
/* List of item resources */
|
||||
if (CreateOrChangeItem == Prg_PUT_FORM_CHANGE_ITEM)
|
||||
PrgRsc_EditResources (ItmCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** End row *****/
|
||||
|
@ -1065,7 +1093,7 @@ static void Prg_PutParamItmCod (long ItmCod)
|
|||
/***************** Get parameter with code of program item *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static long Prg_GetParamItmCod (void)
|
||||
long Prg_GetParamItmCod (void)
|
||||
{
|
||||
return Par_GetParToLong ("ItmCod");
|
||||
}
|
||||
|
@ -1597,7 +1625,7 @@ void Prg_RequestCreateItem (void)
|
|||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
Prg_ShowAllItems (Prg_PUT_FORM_CREATE_ITEM,
|
||||
Prg_ShowAllItems (Prg_ITEM_CREATE_FORM,
|
||||
&ToHighlight,ParentItmCod,ItmCodBeforeForm,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
|
@ -1606,7 +1634,7 @@ void Prg_RequestCreateItem (void)
|
|||
|
||||
void Prg_RequestChangeItem (void)
|
||||
{
|
||||
long ItmCodBeforeForm;
|
||||
long ItmCod;
|
||||
unsigned FormLevel;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
|
||||
|
@ -1614,17 +1642,15 @@ void Prg_RequestChangeItem (void)
|
|||
Prg_GetListItems ();
|
||||
|
||||
/***** Get the code of the program item *****/
|
||||
ItmCodBeforeForm = Prg_GetParamItmCod ();
|
||||
|
||||
if (ItmCodBeforeForm > 0)
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (ItmCodBeforeForm));
|
||||
if ((ItmCod = Prg_GetParamItmCod ()) > 0)
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (ItmCod));
|
||||
else
|
||||
FormLevel = 0;
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
Prg_ShowAllItems (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
&ToHighlight,-1L,ItmCodBeforeForm,FormLevel);
|
||||
Prg_ShowAllItems (Prg_ITEM_CHANGE_FORM,
|
||||
&ToHighlight,-1L,ItmCod,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
|
|
@ -64,14 +64,6 @@ struct Prg_ItemRange
|
|||
unsigned End; // Index of the last item in the subtree
|
||||
};
|
||||
|
||||
#define Prg_NUM_TYPES_FORMS 3
|
||||
typedef enum
|
||||
{
|
||||
Prg_DONT_PUT_FORM_ITEM,
|
||||
Prg_PUT_FORM_CREATE_ITEM,
|
||||
Prg_PUT_FORM_CHANGE_ITEM,
|
||||
} Prg_CreateOrChangeItem_t;
|
||||
|
||||
#define Prg_NUM_MOVEMENTS_LEFT_RIGHT 2
|
||||
typedef enum
|
||||
{
|
||||
|
@ -79,6 +71,16 @@ typedef enum
|
|||
Prg_MOVE_RIGHT,
|
||||
} Prg_MoveLeftRight_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Prg_ITEM_PRINT,
|
||||
Prg_ITEM_VIEW,
|
||||
Prg_ITEM_EDIT_BUTTONS,
|
||||
Prg_ITEM_CREATE_FORM,
|
||||
Prg_ITEM_CHANGE_FORM,
|
||||
Prg_ITEM_CHANGE_RESOURCES,
|
||||
} Prg_ShowItemForm_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -86,15 +88,16 @@ typedef enum
|
|||
void Prg_ShowCourseProgram (void);
|
||||
void Prg_ShowCourseProgramHighlightingItem (const struct Prg_ItemRange *ToHighlight);
|
||||
|
||||
void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem,
|
||||
void Prg_ShowAllItems (Prg_ShowItemForm_t ShowItemForm,
|
||||
const struct Prg_ItemRange *ToHighlight,
|
||||
long ParentItmCod,long ItmCodBeforeForm,unsigned FormLevel);
|
||||
long ParentItmCod,long ItmCod,unsigned FormLevel);
|
||||
|
||||
bool Prg_CheckIfICanCreateItems (void);
|
||||
void Prg_PutParams (void *ItmCod);
|
||||
|
||||
void Prg_GetListItems (void);
|
||||
void Prg_FreeListItems (void);
|
||||
long Prg_GetParamItmCod (void);
|
||||
unsigned Prg_GetNumItemFromItmCod (long ItmCod);
|
||||
unsigned Prg_GetLevelFromNumItem (unsigned NumItem);
|
||||
|
||||
|
|
|
@ -559,7 +559,7 @@ void Prg_DB_RemoveResource (const struct PrgRsc_Resource *Resource)
|
|||
"DELETE FROM prg_resources"
|
||||
" WHERE RscCod=%ld"
|
||||
" AND ItmCod=%ld", // Extra check
|
||||
Resource->RscCod,
|
||||
Resource->Rsc.Cod,
|
||||
Resource->ItmCod);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// swad_program.c: course program
|
||||
// swad_program_resource.c: course program (resources)
|
||||
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance),
|
||||
|
@ -25,31 +25,12 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// #define _GNU_SOURCE // For asprintf
|
||||
// #include <linux/limits.h> // For PATH_MAX
|
||||
// #include <stddef.h> // For NULL
|
||||
// #include <stdio.h> // For asprintf
|
||||
// #include <stdlib.h> // For calloc
|
||||
// #include <string.h> // For string functions
|
||||
|
||||
// #include "swad_autolink.h"
|
||||
// #include "swad_box.h"
|
||||
// #include "swad_database.h"
|
||||
#include "swad_error.h"
|
||||
// #include "swad_figure.h"
|
||||
#include "swad_form.h"
|
||||
#include "swad_global.h"
|
||||
// #include "swad_hierarchy_level.h"
|
||||
// #include "swad_HTML.h"
|
||||
// #include "swad_pagination.h"
|
||||
// #include "swad_parameter.h"
|
||||
// #include "swad_photo.h"
|
||||
#include "swad_program.h"
|
||||
#include "swad_program_database.h"
|
||||
#include "swad_program_resource.h"
|
||||
// #include "swad_role.h"
|
||||
// #include "swad_setting.h"
|
||||
// #include "swad_string.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
|
@ -60,28 +41,6 @@ extern struct Globals Gbl;
|
|||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
#define Prg_NUM_TYPES_FORMS 3
|
||||
typedef enum
|
||||
{
|
||||
Prg_DONT_PUT_FORM_ITEM,
|
||||
Prg_PUT_FORM_CREATE_ITEM,
|
||||
Prg_PUT_FORM_CHANGE_ITEM,
|
||||
} Prg_CreateOrChangeItem_t;
|
||||
|
||||
#define Prg_NUM_MOVEMENTS_UP_DOWN 2
|
||||
typedef enum
|
||||
{
|
||||
Prg_MOVE_UP,
|
||||
Prg_MOVE_DOWN,
|
||||
} Prg_MoveUpDown_t;
|
||||
|
||||
struct Level
|
||||
{
|
||||
unsigned Number; // Numbers for each level from 1 to maximum level
|
||||
bool Hidden; // If each level from 1 to maximum level is hidden
|
||||
};
|
||||
*/
|
||||
|
||||
#define PrgRsc_NUM_MOVEMENTS_UP_DOWN 2
|
||||
typedef enum
|
||||
|
@ -93,30 +52,6 @@ typedef enum
|
|||
/*****************************************************************************/
|
||||
/***************************** Private variables *****************************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
static struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool IsRead; // Is the list already read from database...
|
||||
// ...or it needs to be read?
|
||||
unsigned NumItems; // Number of items
|
||||
struct Prg_ItemHierarchy *Items; // List of items
|
||||
} List;
|
||||
unsigned MaxLevel; // Maximum level of items
|
||||
struct Level *Levels; // Numbers and hidden for each level from 1 to maximum level
|
||||
} Prg_Gbl =
|
||||
{
|
||||
.List =
|
||||
{
|
||||
.IsRead = false,
|
||||
.NumItems = 0,
|
||||
.Items = NULL,
|
||||
},
|
||||
.MaxLevel = 0,
|
||||
.Levels = NULL
|
||||
};
|
||||
*/
|
||||
|
||||
static long PrgSrc_RscCodToBeRemoved = -1L;
|
||||
|
||||
|
@ -127,8 +62,7 @@ static const char *PrgRsc_RESOURCE_SECTION_ID = "rsc_section";
|
|||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutIconsListResources (__attribute__((unused)) void *Args);
|
||||
static void PrgSrc_PutIconToCreateNewResource (long ItmCod);
|
||||
static void PrgRsc_PutButtonToCreateNewResource (long ItmCod);
|
||||
static void PrgSrc_PutIconToEditResources (long ItmCod);
|
||||
|
||||
static void PrgRsc_GetDataOfResourceByCod (struct PrgRsc_Resource *Resource);
|
||||
static void PrgRsc_GetDataOfResource (struct PrgRsc_Resource *Resource,
|
||||
|
@ -151,12 +85,41 @@ static void PrgRsc_MoveUpDownResource (PrgRsc_MoveUpDown_t UpDown);
|
|||
static bool PrgRsc_ExchangeResources (const struct PrgRsc_Rsc *Rsc1,
|
||||
const struct PrgRsc_Rsc *Rsc2);
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Edit resources *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_EditResources (void)
|
||||
{
|
||||
long ItmCod;
|
||||
unsigned FormLevel;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
Prg_GetListItems ();
|
||||
|
||||
/***** Get the code of the program item *****/
|
||||
if ((ItmCod = Prg_GetParamItmCod ()) > 0)
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (ItmCod));
|
||||
else
|
||||
FormLevel = 0;
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
Prg_ShowAllItems (Prg_ITEM_CHANGE_RESOURCES,
|
||||
&ToHighlight,-1L,ItmCod,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Show resources *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_ShowResources (long ItmCod)
|
||||
void PrgRsc_ListResourcesToShow (long ItmCod)
|
||||
{
|
||||
extern const char *Txt_Resources;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumRsc;
|
||||
unsigned NumResources;
|
||||
|
@ -166,18 +129,18 @@ void PrgRsc_ShowResources (long ItmCod)
|
|||
if (ItmCod <= 0)
|
||||
return;
|
||||
|
||||
/***** Get list of item resources from database *****/
|
||||
if ((NumResources = Prg_DB_GetListResources (&mysql_res,ItmCod,
|
||||
false))) // Don't get hidden resources
|
||||
{
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin ("100%",NULL,
|
||||
NULL,NULL,
|
||||
NULL,Box_NOT_CLOSABLE);
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin ("100%",Txt_Resources,
|
||||
PrgRsc_PutIconsListResources,&ItmCod,
|
||||
NULL,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Get list of item resources from database *****/
|
||||
if ((NumResources = Prg_DB_GetListResources (&mysql_res,ItmCod,
|
||||
false))) // Don't get hidden resources
|
||||
{
|
||||
/***** Table *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (2);
|
||||
HTM_TBODY_Begin (NULL); // 1st tbody start
|
||||
HTM_TBODY_Begin (NULL);
|
||||
|
||||
/***** Write all item resources *****/
|
||||
for (NumRsc = 1;
|
||||
|
@ -192,19 +155,15 @@ void PrgRsc_ShowResources (long ItmCod)
|
|||
}
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TBODY_End (); // 3rd tbody end
|
||||
HTM_TBODY_End ();
|
||||
HTM_TABLE_End ();
|
||||
}
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
}
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Edit resources *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_EditResources (long ItmCod)
|
||||
void PrgRsc_ListResourcesToEdit (long ItmCod)
|
||||
{
|
||||
extern const char *Hlp_COURSE_Program;
|
||||
extern const char *Txt_Remove_resource;
|
||||
|
@ -241,7 +200,7 @@ void PrgRsc_EditResources (long ItmCod)
|
|||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin ("100%",Txt_Resources,
|
||||
PrgRsc_PutIconsListResources,&ItmCod,
|
||||
NULL,NULL,
|
||||
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Table *****/
|
||||
|
@ -262,19 +221,10 @@ void PrgRsc_EditResources (long ItmCod)
|
|||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/***** Create item at the end? *****/
|
||||
/*
|
||||
if (ItmCodBeforeForm <= 0 && CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM)
|
||||
Prg_WriteRowWithItemForm (Prg_PUT_FORM_CREATE_ITEM,-1L,1);
|
||||
*/
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TBODY_End ();
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/***** Button to create a new program item *****/
|
||||
PrgRsc_PutButtonToCreateNewResource (ItmCod);
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
||||
|
@ -292,60 +242,17 @@ static void PrgRsc_PutIconsListResources (void *ItmCod)
|
|||
if (ItmCod)
|
||||
if (*((long *) ItmCod) > 0)
|
||||
if (Prg_CheckIfICanCreateItems ())
|
||||
PrgSrc_PutIconToCreateNewResource (*((long *) ItmCod));
|
||||
PrgSrc_PutIconToEditResources (*((long *) ItmCod));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Put icon to create a new program item ********************/
|
||||
/********************* Put icon to edit item resources ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgSrc_PutIconToCreateNewResource (long ItmCod)
|
||||
static void PrgSrc_PutIconToEditResources (long ItmCod)
|
||||
{
|
||||
Ico_PutContextualIconToAdd (ActFrmNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,&ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Put button to create a new item resource ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_PutButtonToCreateNewResource (long ItmCod)
|
||||
{
|
||||
extern const char *Txt_New_resource;
|
||||
|
||||
Frm_BeginFormAnchor (ActFrmNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
Prg_PutParams (&ItmCod);
|
||||
Btn_PutConfirmButton (Txt_New_resource);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Put a form to create/edit program resource and show current resources ***/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_RequestCreateResource (void)
|
||||
{
|
||||
// unsigned NumItem;
|
||||
// long ItmCodBeforeForm;
|
||||
// unsigned FormLevel;
|
||||
// struct Prg_Item Item;
|
||||
|
||||
/***** Get list of program items *****/
|
||||
// Prg_GetListItems ();
|
||||
|
||||
/***** Get data of the item from database *****/
|
||||
// Item.Hierarchy.ItmCod = Prg_GetParamItmCod ();
|
||||
// Prg_GetDataOfItemByCod (&Item);
|
||||
// if (Item.Hierarchy.ItmCod <= 0)
|
||||
// Err_WrongItemExit ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
// Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
// Prg_ShowAllItems (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
// &ToHighlight,ParentItmCod,ItmCodBeforeForm,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
// Prg_FreeListItems ();
|
||||
Ico_PutContextualIconToEdit (ActFrmEdiPrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
Prg_PutParams,&ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -411,10 +318,10 @@ static void PrgRsc_GetDataOfResource (struct PrgRsc_Resource *Resource,
|
|||
|
||||
static void PrgRsc_ResetResource (struct PrgRsc_Resource *Resource)
|
||||
{
|
||||
Resource->ItmCod = -1L;
|
||||
Resource->Rsc.Cod = -1L;
|
||||
Resource->Rsc.Ind = 0;
|
||||
Resource->Hidden = false;
|
||||
Resource->ItmCod = -1L;
|
||||
Resource->Rsc.Cod = -1L;
|
||||
Resource->Rsc.Ind = 0;
|
||||
Resource->Hidden = false;
|
||||
Resource->Title[0] = '\0';
|
||||
}
|
||||
|
||||
|
@ -429,12 +336,14 @@ static void PrgRsc_WriteRowShowResource (unsigned NumRsc,
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM RT %s\"",The_GetColorRows ());
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RT %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
HTM_Unsigned (NumRsc);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN %s\"",The_GetColorRows ());
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN PRG_RSC_%s %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
HTM_Txt (Resource->Title);
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -458,12 +367,14 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
HTM_TD_End ();
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM RT %s\"",The_GetColorRows ());
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RT %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 PRG_RSC_%s %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
HTM_Txt (Resource->Title);
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -480,10 +391,6 @@ static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
|||
struct PrgRsc_Resource *Resource)
|
||||
{
|
||||
extern const char *Txt_Movement_not_allowed;
|
||||
// char StrItemIndex[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
|
||||
/***** Initialize item index string *****/
|
||||
// snprintf (StrItemIndex,sizeof (StrItemIndex),"%u",Item->Hierarchy.Index);
|
||||
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
|
@ -509,8 +416,6 @@ static void PrgRsc_PutFormsToRemEditOneResource (unsigned NumRsc,
|
|||
// Ico_PutContextualIconToAdd (ActFrmNewPrgItm,"item_form",
|
||||
// Prg_PutParams,&Item->Hierarchy.ItmCod);
|
||||
|
||||
HTM_BR ();
|
||||
|
||||
/***** Put icon to move up the item *****/
|
||||
if (NumRsc > 0)
|
||||
Lay_PutContextualLinkOnlyIcon (ActUp_PrgRsc,PrgRsc_RESOURCE_SECTION_ID,
|
||||
|
@ -572,7 +477,7 @@ void PrgRsc_ReqRemResource (void)
|
|||
{
|
||||
extern const char *Txt_Do_you_really_want_to_remove_the_resource_X;
|
||||
struct PrgRsc_Resource Resource;
|
||||
long ItmCodBeforeForm;
|
||||
long ItmCod;
|
||||
unsigned FormLevel;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
|
||||
|
@ -592,13 +497,13 @@ void PrgRsc_ReqRemResource (void)
|
|||
PrgSrc_RscCodToBeRemoved = Resource.Rsc.Cod;
|
||||
|
||||
/***** Get the code of the program item *****/
|
||||
ItmCodBeforeForm = Resource.ItmCod;
|
||||
ItmCod = Resource.ItmCod;
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (Resource.ItmCod));
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
Prg_ShowAllItems (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
&ToHighlight,-1L,ItmCodBeforeForm,FormLevel);
|
||||
Prg_ShowAllItems (Prg_ITEM_CHANGE_RESOURCES,
|
||||
&ToHighlight,-1L,ItmCod,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -612,7 +517,7 @@ void PrgRsc_RemoveResource (void)
|
|||
{
|
||||
extern const char *Txt_Resource_X_removed;
|
||||
struct PrgRsc_Resource Resource;
|
||||
long ItmCodBeforeForm;
|
||||
long ItmCod;
|
||||
unsigned FormLevel;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
|
||||
|
@ -633,13 +538,13 @@ void PrgRsc_RemoveResource (void)
|
|||
Txt_Resource_X_removed,Resource.Title);
|
||||
|
||||
/***** Get the code of the program item *****/
|
||||
ItmCodBeforeForm = Resource.ItmCod;
|
||||
ItmCod = Resource.ItmCod;
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (Resource.ItmCod));
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
Prg_ShowAllItems (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
&ToHighlight,-1L,ItmCodBeforeForm,FormLevel);
|
||||
Prg_ShowAllItems (Prg_ITEM_CHANGE_RESOURCES,
|
||||
&ToHighlight,-1L,ItmCod,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -662,7 +567,7 @@ void PrgRsc_UnhideResource (void)
|
|||
static void PrgRsc_HideOrUnhideResource (bool Hide)
|
||||
{
|
||||
struct PrgRsc_Resource Resource;
|
||||
long ItmCodBeforeForm;
|
||||
long ItmCod;
|
||||
unsigned FormLevel;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
|
||||
|
@ -679,13 +584,13 @@ static void PrgRsc_HideOrUnhideResource (bool Hide)
|
|||
Prg_DB_HideOrUnhideResource (Resource.Rsc.Cod,Hide);
|
||||
|
||||
/***** Get the code of the program item *****/
|
||||
ItmCodBeforeForm = Resource.ItmCod;
|
||||
ItmCod = Resource.ItmCod;
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (Resource.ItmCod));
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
Prg_ShowAllItems (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
&ToHighlight,-1L,ItmCodBeforeForm,FormLevel);
|
||||
Prg_ShowAllItems (Prg_ITEM_CHANGE_RESOURCES,
|
||||
&ToHighlight,-1L,ItmCod,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
@ -710,7 +615,7 @@ static void PrgRsc_MoveUpDownResource (PrgRsc_MoveUpDown_t UpDown)
|
|||
extern const char *Txt_Movement_not_allowed;
|
||||
struct PrgRsc_Resource Resource;
|
||||
struct PrgRsc_Rsc Rsc2;
|
||||
long ItmCodBeforeForm;
|
||||
long ItmCod;
|
||||
unsigned FormLevel;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
bool Success = false;
|
||||
|
@ -742,13 +647,13 @@ static void PrgRsc_MoveUpDownResource (PrgRsc_MoveUpDown_t UpDown)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||
|
||||
/***** Get the code of the program item *****/
|
||||
ItmCodBeforeForm = Resource.ItmCod;
|
||||
ItmCod = Resource.ItmCod;
|
||||
FormLevel = Prg_GetLevelFromNumItem (Prg_GetNumItemFromItmCod (Resource.ItmCod));
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_SetItemRangeEmpty (&ToHighlight);
|
||||
Prg_ShowAllItems (Prg_PUT_FORM_CHANGE_ITEM,
|
||||
&ToHighlight,-1L,ItmCodBeforeForm,FormLevel);
|
||||
Prg_ShowAllItems (Prg_ITEM_CHANGE_RESOURCES,
|
||||
&ToHighlight,-1L,ItmCod,FormLevel);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// #include <stdbool.h> // For boolean type
|
||||
// #include <time.h> // For time
|
||||
|
||||
// #include "swad_database.h"
|
||||
// #include "swad_date.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -58,8 +52,10 @@ struct PrgRsc_Resource
|
|||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void PrgRsc_ShowResources (long ItmCod);
|
||||
void PrgRsc_EditResources (long ItmCod);
|
||||
void PrgRsc_EditResources (void);
|
||||
|
||||
void PrgRsc_ListResourcesToShow (long ItmCod);
|
||||
void PrgRsc_ListResourcesToEdit (long ItmCod);
|
||||
void PrgRsc_RequestCreateResource (void);
|
||||
|
||||
void PrgRsc_ReqRemResource (void);
|
||||
|
|
|
@ -5697,27 +5697,27 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
|
|||
"Move right program item" // Çeviri lazim!
|
||||
#endif
|
||||
,
|
||||
[ActFrmNewPrgRsc] =
|
||||
[ActFrmEdiPrgRsc] =
|
||||
#if L==1 // ca
|
||||
"Request new resource" // Necessita traducció
|
||||
"Edit resources" // Necessita traducció
|
||||
#elif L==2 // de
|
||||
"Request new resource" // Need Übersetzung
|
||||
"Edit resources" // Need Übersetzung
|
||||
#elif L==3 // en
|
||||
"Request new resource"
|
||||
"Edit resources"
|
||||
#elif L==4 // es
|
||||
"Solicitar nuevo recurso"
|
||||
"Editar recursos"
|
||||
#elif L==5 // fr
|
||||
"Request new resource" // Besoin de traduction
|
||||
"Edit resources" // Besoin de traduction
|
||||
#elif L==6 // gn
|
||||
"Solicitar nuevo recurso" // Okoteve traducción
|
||||
"Editar recursos" // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"Request new resource" // Bisogno di traduzione
|
||||
"Edit resources" // Bisogno di traduzione
|
||||
#elif L==8 // pl
|
||||
"Request new resource" // Potrzebujesz tlumaczenie
|
||||
"Edit resources" // Potrzebujesz tlumaczenie
|
||||
#elif L==9 // pt
|
||||
"Request new resource" // Precisa de tradução
|
||||
"Edit resources" // Precisa de tradução
|
||||
#elif L==10 // tr
|
||||
"Request new resource" // Çeviri lazim!
|
||||
"Edit resources" // Çeviri lazim!
|
||||
#endif
|
||||
,
|
||||
[ActReqRemPrgRsc] =
|
||||
|
|
Loading…
Reference in New Issue