mirror of https://github.com/acanas/swad-core.git
Version 23.40: Oct 28, 2023 Code refactoring in view/edit.
This commit is contained in:
parent
cf66ee4ab8
commit
e1135c77b7
|
@ -214,7 +214,7 @@ void Brw_RecLinkFileBrowser (void);
|
||||||
void Brw_SetDocumentAsVisible (void);
|
void Brw_SetDocumentAsVisible (void);
|
||||||
void Brw_SetDocumentAsHidden (void);
|
void Brw_SetDocumentAsHidden (void);
|
||||||
HidVis_HiddenOrVisible_t Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_FileType_t FileType,
|
HidVis_HiddenOrVisible_t Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_FileType_t FileType,
|
||||||
const char *Path);
|
const char *Path);
|
||||||
void Brw_ShowFileMetadata (void);
|
void Brw_ShowFileMetadata (void);
|
||||||
|
|
||||||
void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL);
|
void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL);
|
||||||
|
|
|
@ -633,10 +633,11 @@ Me sale este error, no s
|
||||||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 23.39 (2023-10-27)"
|
#define Log_PLATFORM_VERSION "SWAD 23.40 (2023-10-28)"
|
||||||
#define CSS_FILE "swad23.35.1.css"
|
#define CSS_FILE "swad23.35.1.css"
|
||||||
#define JS_FILE "swad22.49.js"
|
#define JS_FILE "swad22.49.js"
|
||||||
/*
|
/*
|
||||||
|
Version 23.40: Oct 28, 2023 Code refactoring in view/edit. (335273 lines)
|
||||||
Version 23.39: Oct 27, 2023 Code refactoring in contracted/expanded and rubrics. (335209 lines)
|
Version 23.39: Oct 27, 2023 Code refactoring in contracted/expanded and rubrics. (335209 lines)
|
||||||
Version 23.38.3: Oct 27, 2023 When clicking on edition of a program item, expand it if contracted. (335155 lines)
|
Version 23.38.3: Oct 27, 2023 When clicking on edition of a program item, expand it if contracted. (335155 lines)
|
||||||
Version 23.38.2: Oct 27, 2023 Fix bug showing the question just edited. (335152 lines)
|
Version 23.38.2: Oct 27, 2023 Fix bug showing the question just edited. (335152 lines)
|
||||||
|
|
|
@ -40,8 +40,4 @@ typedef enum
|
||||||
ConExp_EXPANDED = 1,
|
ConExp_EXPANDED = 1,
|
||||||
} ConExp_ContractedOrExpanded_t;
|
} ConExp_ContractedOrExpanded_t;
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************************** Public prototypes ****************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include "swad_role.h"
|
#include "swad_role.h"
|
||||||
#include "swad_setting.h"
|
#include "swad_setting.h"
|
||||||
#include "swad_string.h"
|
#include "swad_string.h"
|
||||||
|
#include "swad_view_edit.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************** External global variables from others modules ****************/
|
/************** External global variables from others modules ****************/
|
||||||
|
@ -128,8 +129,8 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||||
long SelectedItmCod,
|
long SelectedItmCod,
|
||||||
long SelectedRscCod);
|
long SelectedRscCod);
|
||||||
static void Prg_PutIconToContractOrExpandItem (struct Prg_Item *Item,
|
static void Prg_PutIconToContractOrExpandItem (struct Prg_Item *Item,
|
||||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
||||||
bool Editing);
|
VieEdi_ViewOrEdit_t ViewingOrEditing);
|
||||||
static void Prg_WriteItemText (long ItmCod,HidVis_HiddenOrVisible_t HiddenOrVisible);
|
static void Prg_WriteItemText (long ItmCod,HidVis_HiddenOrVisible_t HiddenOrVisible);
|
||||||
static void Prg_WriteRowToCreateItem (long ParentItmCod,unsigned FormLevel);
|
static void Prg_WriteRowToCreateItem (long ParentItmCod,unsigned FormLevel);
|
||||||
static void Prg_SetTitleClass (char **TitleClass,unsigned Level);
|
static void Prg_SetTitleClass (char **TitleClass,unsigned Level);
|
||||||
|
@ -472,20 +473,20 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||||
{
|
{
|
||||||
extern const char *HidVis_PrgClass[HidVis_NUM_HIDDEN_VISIBLE];
|
extern const char *HidVis_PrgClass[HidVis_NUM_HIDDEN_VISIBLE];
|
||||||
static unsigned UniqueId = 0;
|
static unsigned UniqueId = 0;
|
||||||
static bool EditingProgram[Prg_NUM_LISTING_TYPES] =
|
static VieEdi_ViewOrEdit_t ViewingOrEditingProgram[Prg_NUM_LISTING_TYPES] =
|
||||||
{
|
{
|
||||||
[Prg_PRINT ] = false,
|
[Prg_PRINT ] = VieEdi_VIEW,
|
||||||
[Prg_VIEW ] = false,
|
[Prg_VIEW ] = VieEdi_VIEW,
|
||||||
[Prg_EDIT_ITEMS ] = true,
|
[Prg_EDIT_ITEMS ] = VieEdi_EDIT,
|
||||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
[Prg_FORM_NEW_END_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_FORM_NEW_CHILD_ITEM ] = true,
|
[Prg_FORM_NEW_CHILD_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_FORM_EDIT_ITEM ] = true,
|
[Prg_FORM_EDIT_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_END_EDIT_ITEM ] = true,
|
[Prg_END_EDIT_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_RECEIVE_ITEM ] = true,
|
[Prg_RECEIVE_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_EDIT_RESOURCES ] = true,
|
[Prg_EDIT_RESOURCES ] = VieEdi_EDIT,
|
||||||
[Prg_EDIT_RESOURCE_LINK ] = true,
|
[Prg_EDIT_RESOURCE_LINK ] = VieEdi_EDIT,
|
||||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
[Prg_CHANGE_RESOURCE_LINK] = VieEdi_EDIT,
|
||||||
[Prg_END_EDIT_RES ] = true,
|
[Prg_END_EDIT_RES ] = VieEdi_EDIT,
|
||||||
};
|
};
|
||||||
static const char *RowSpan[ConExp_NUM_CONTRACTED_EXPANDED] =
|
static const char *RowSpan[ConExp_NUM_CONTRACTED_EXPANDED] =
|
||||||
{
|
{
|
||||||
|
@ -512,7 +513,8 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EditingProgram[ListingType] || HiddenOrVisible == HidVis_VISIBLE)
|
if (ViewingOrEditingProgram[ListingType] == VieEdi_EDIT ||
|
||||||
|
HiddenOrVisible == HidVis_VISIBLE)
|
||||||
{
|
{
|
||||||
/***** Increase number in level *****/
|
/***** Increase number in level *****/
|
||||||
Prg_IncreaseNumberInLevel (Item->Hierarchy.Level);
|
Prg_IncreaseNumberInLevel (Item->Hierarchy.Level);
|
||||||
|
@ -541,11 +543,12 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||||
/* Expand/contract this program item */
|
/* Expand/contract this program item */
|
||||||
HTM_TD_Begin ("class=\"LT %s\"%s",
|
HTM_TD_Begin ("class=\"LT %s\"%s",
|
||||||
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
||||||
Prg_PutIconToContractOrExpandItem (Item,ContractedOrExpanded,EditingProgram[ListingType]);
|
Prg_PutIconToContractOrExpandItem (Item,ContractedOrExpanded,
|
||||||
|
ViewingOrEditingProgram[ListingType]);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Forms to remove/edit this program item */
|
/* Forms to remove/edit this program item */
|
||||||
if (EditingProgram[ListingType])
|
if (ViewingOrEditingProgram[ListingType] == VieEdi_EDIT)
|
||||||
{
|
{
|
||||||
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"%s",
|
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"%s",
|
||||||
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
||||||
|
@ -666,15 +669,15 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Prg_PutIconToContractOrExpandItem (struct Prg_Item *Item,
|
static void Prg_PutIconToContractOrExpandItem (struct Prg_Item *Item,
|
||||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
||||||
bool Editing)
|
VieEdi_ViewOrEdit_t ViewingOrEditing)
|
||||||
{
|
{
|
||||||
static const Act_Action_t NextAction[ConExp_NUM_CONTRACTED_EXPANDED][2] =
|
static const Act_Action_t NextAction[ConExp_NUM_CONTRACTED_EXPANDED][2] =
|
||||||
{
|
{
|
||||||
[ConExp_CONTRACTED][false] = ActExpSeePrgItm, // Contracted, Not editing ==> action to expand
|
[ConExp_CONTRACTED][VieEdi_VIEW] = ActExpSeePrgItm, // Contracted, Not editing ==> action to expand
|
||||||
[ConExp_CONTRACTED][true ] = ActExpEdiPrgItm, // Contracted, Editing ==> action to expand
|
[ConExp_CONTRACTED][VieEdi_EDIT] = ActExpEdiPrgItm, // Contracted, Editing ==> action to expand
|
||||||
[ConExp_EXPANDED ][false] = ActConSeePrgItm, // Expanded , Not editing ==> action to contract
|
[ConExp_EXPANDED ][VieEdi_VIEW] = ActConSeePrgItm, // Expanded , Not editing ==> action to contract
|
||||||
[ConExp_EXPANDED ][true ] = ActConEdiPrgItm, // Expanded , Editing ==> action to contract
|
[ConExp_EXPANDED ][VieEdi_EDIT] = ActConEdiPrgItm, // Expanded , Editing ==> action to contract
|
||||||
};
|
};
|
||||||
static void (*PutContextualIcon[ConExp_NUM_CONTRACTED_EXPANDED]) (const Act_Action_t NextAction,const char *Anchor,
|
static void (*PutContextualIcon[ConExp_NUM_CONTRACTED_EXPANDED]) (const Act_Action_t NextAction,const char *Anchor,
|
||||||
void (*FuncPars) (void *Args),void *Args) =
|
void (*FuncPars) (void *Args),void *Args) =
|
||||||
|
@ -684,7 +687,7 @@ static void Prg_PutIconToContractOrExpandItem (struct Prg_Item *Item,
|
||||||
};
|
};
|
||||||
|
|
||||||
/***** Icon to hide/unhide program item *****/
|
/***** Icon to hide/unhide program item *****/
|
||||||
PutContextualIcon[ContractedOrExpanded] (NextAction[ContractedOrExpanded][Editing],
|
PutContextualIcon[ContractedOrExpanded] (NextAction[ContractedOrExpanded][ViewingOrEditing],
|
||||||
Prg_HIGHLIGHTED_SECTION_ID,
|
Prg_HIGHLIGHTED_SECTION_ID,
|
||||||
Prg_PutParItmCod,&Item->Hierarchy.ItmCod);
|
Prg_PutParItmCod,&Item->Hierarchy.ItmCod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "swad_program.h"
|
#include "swad_program.h"
|
||||||
#include "swad_program_database.h"
|
#include "swad_program_database.h"
|
||||||
#include "swad_resource_database.h"
|
#include "swad_resource_database.h"
|
||||||
|
#include "swad_view_edit.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************** External global variables from others modules ****************/
|
/************** External global variables from others modules ****************/
|
||||||
|
@ -79,9 +80,11 @@ static void PrgRsc_GetResourceDataFromRow (MYSQL_RES *mysql_res,
|
||||||
static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
||||||
const struct Prg_Item *Item);
|
const struct Prg_Item *Item);
|
||||||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||||
struct Prg_Item *Item,bool EditLink);
|
struct Prg_Item *Item,
|
||||||
|
VieEdi_ViewOrEdit_t ViewOrEditLink);
|
||||||
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
||||||
struct Prg_Item *Item,bool EditLink);
|
struct Prg_Item *Item,
|
||||||
|
VieEdi_ViewOrEdit_t ViewOrEditLink);
|
||||||
static void PrgRsc_PutFormsToRemEditOneResource (struct Prg_Item *Item,
|
static void PrgRsc_PutFormsToRemEditOneResource (struct Prg_Item *Item,
|
||||||
unsigned NumRsc,
|
unsigned NumRsc,
|
||||||
unsigned NumResources);
|
unsigned NumResources);
|
||||||
|
@ -152,37 +155,42 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
unsigned NumRsc;
|
unsigned NumRsc;
|
||||||
unsigned NumResources;
|
unsigned NumResources;
|
||||||
bool EditingResourcesOfThisItem;
|
VieEdi_ViewOrEdit_t ViewingOrEditingResourcesOfThisItem;
|
||||||
char *Title;
|
char *Title;
|
||||||
static bool Editing[Prg_NUM_LISTING_TYPES] =
|
static VieEdi_ViewOrEdit_t ViewingOrEditing[Prg_NUM_LISTING_TYPES] =
|
||||||
{
|
{
|
||||||
[Prg_PRINT ] = false,
|
[Prg_PRINT ] = VieEdi_VIEW,
|
||||||
[Prg_VIEW ] = false,
|
[Prg_VIEW ] = VieEdi_VIEW,
|
||||||
[Prg_EDIT_ITEMS ] = true,
|
[Prg_EDIT_ITEMS ] = VieEdi_EDIT,
|
||||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
[Prg_FORM_NEW_END_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_FORM_NEW_CHILD_ITEM ] = true,
|
[Prg_FORM_NEW_CHILD_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_FORM_EDIT_ITEM ] = true,
|
[Prg_FORM_EDIT_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_END_EDIT_ITEM ] = true,
|
[Prg_END_EDIT_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_RECEIVE_ITEM ] = true,
|
[Prg_RECEIVE_ITEM ] = VieEdi_EDIT,
|
||||||
[Prg_EDIT_RESOURCES ] = true,
|
[Prg_EDIT_RESOURCES ] = VieEdi_EDIT,
|
||||||
[Prg_EDIT_RESOURCE_LINK ] = true,
|
[Prg_EDIT_RESOURCE_LINK ] = VieEdi_EDIT,
|
||||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
[Prg_CHANGE_RESOURCE_LINK] = VieEdi_EDIT,
|
||||||
[Prg_END_EDIT_RES ] = true,
|
[Prg_END_EDIT_RES ] = VieEdi_EDIT,
|
||||||
};
|
};
|
||||||
static bool EditingResources[Prg_NUM_LISTING_TYPES] =
|
static VieEdi_ViewOrEdit_t ViewingOrEditingResources[Prg_NUM_LISTING_TYPES] =
|
||||||
{
|
{
|
||||||
[Prg_PRINT ] = false,
|
[Prg_PRINT ] = VieEdi_VIEW,
|
||||||
[Prg_VIEW ] = false,
|
[Prg_VIEW ] = VieEdi_VIEW,
|
||||||
[Prg_EDIT_ITEMS ] = false,
|
[Prg_EDIT_ITEMS ] = VieEdi_VIEW,
|
||||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
[Prg_FORM_NEW_END_ITEM ] = VieEdi_VIEW,
|
||||||
[Prg_FORM_NEW_CHILD_ITEM ] = false,
|
[Prg_FORM_NEW_CHILD_ITEM ] = VieEdi_VIEW,
|
||||||
[Prg_FORM_EDIT_ITEM ] = false,
|
[Prg_FORM_EDIT_ITEM ] = VieEdi_VIEW,
|
||||||
[Prg_END_EDIT_ITEM ] = false,
|
[Prg_END_EDIT_ITEM ] = VieEdi_VIEW,
|
||||||
[Prg_RECEIVE_ITEM ] = false,
|
[Prg_RECEIVE_ITEM ] = VieEdi_VIEW,
|
||||||
[Prg_EDIT_RESOURCES ] = true,
|
[Prg_EDIT_RESOURCES ] = VieEdi_EDIT,
|
||||||
[Prg_EDIT_RESOURCE_LINK ] = true,
|
[Prg_EDIT_RESOURCE_LINK ] = VieEdi_EDIT,
|
||||||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
[Prg_CHANGE_RESOURCE_LINK] = VieEdi_EDIT,
|
||||||
[Prg_END_EDIT_RES ] = false,
|
[Prg_END_EDIT_RES ] = VieEdi_VIEW,
|
||||||
|
};
|
||||||
|
static void (*PrgRsc_PutIconsResources[VieEdi_NUM_VIEW_EDIT]) (void *ItmCod) =
|
||||||
|
{
|
||||||
|
PrgRsc_PutIconsViewResources,
|
||||||
|
PrgRsc_PutIconsEditResources,
|
||||||
};
|
};
|
||||||
|
|
||||||
/***** Trivial check *****/
|
/***** Trivial check *****/
|
||||||
|
@ -191,9 +199,9 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
|
|
||||||
/***** Get list of item resources from database *****/
|
/***** Get list of item resources from database *****/
|
||||||
NumResources = Prg_DB_GetListResources (&mysql_res,Item->Hierarchy.ItmCod,
|
NumResources = Prg_DB_GetListResources (&mysql_res,Item->Hierarchy.ItmCod,
|
||||||
EditingResources[ListingType]);
|
ViewingOrEditingResources[ListingType] == VieEdi_EDIT);
|
||||||
|
|
||||||
if (NumResources || Editing[ListingType])
|
if (NumResources || ViewingOrEditing[ListingType] == VieEdi_EDIT)
|
||||||
{
|
{
|
||||||
if (Item->Hierarchy.ItmCod == SelectedItmCod)
|
if (Item->Hierarchy.ItmCod == SelectedItmCod)
|
||||||
{
|
{
|
||||||
|
@ -211,24 +219,27 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
EditingResourcesOfThisItem = EditingResources[ListingType] &&
|
ViewingOrEditingResourcesOfThisItem = ViewingOrEditingResources[ListingType] == VieEdi_EDIT &&
|
||||||
(Item->Hierarchy.ItmCod == SelectedItmCod);
|
(Item->Hierarchy.ItmCod == SelectedItmCod) ? VieEdi_EDIT :
|
||||||
|
VieEdi_VIEW;
|
||||||
|
|
||||||
if (Editing[ListingType])
|
switch (ViewingOrEditing[ListingType])
|
||||||
{
|
{
|
||||||
if (asprintf (&Title,Txt_Resources_of_X,Item->Title) < 0)
|
case VieEdi_VIEW:
|
||||||
Err_NotEnoughMemoryExit ();
|
Box_BoxBegin ("100%",NULL,
|
||||||
Box_BoxBegin ("100%",Title,
|
NULL,NULL,
|
||||||
EditingResourcesOfThisItem ? PrgRsc_PutIconsViewResources :
|
NULL,Box_NOT_CLOSABLE);
|
||||||
PrgRsc_PutIconsEditResources,
|
break;
|
||||||
&Item->Hierarchy.ItmCod,
|
case VieEdi_EDIT:
|
||||||
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
if (asprintf (&Title,Txt_Resources_of_X,Item->Title) < 0)
|
||||||
free (Title);
|
Err_NotEnoughMemoryExit ();
|
||||||
|
Box_BoxBegin ("100%",Title,
|
||||||
|
PrgRsc_PutIconsResources[ViewingOrEditingResourcesOfThisItem],
|
||||||
|
&Item->Hierarchy.ItmCod,
|
||||||
|
Hlp_COURSE_Program,Box_NOT_CLOSABLE);
|
||||||
|
free (Title);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Box_BoxBegin ("100%",NULL,
|
|
||||||
NULL,NULL,
|
|
||||||
NULL,Box_NOT_CLOSABLE);
|
|
||||||
|
|
||||||
/***** Table *****/
|
/***** Table *****/
|
||||||
HTM_TABLE_BeginWidePadding (2);
|
HTM_TABLE_BeginWidePadding (2);
|
||||||
|
@ -243,21 +254,27 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
|
||||||
PrgRsc_GetResourceDataFromRow (mysql_res,Item);
|
PrgRsc_GetResourceDataFromRow (mysql_res,Item);
|
||||||
|
|
||||||
/* Show item */
|
/* Show item */
|
||||||
if (EditingResourcesOfThisItem)
|
switch (ViewingOrEditingResourcesOfThisItem)
|
||||||
PrgRsc_WriteRowEditResource (NumRsc,NumResources,Item,
|
{
|
||||||
(ListingType == Prg_EDIT_RESOURCE_LINK &&
|
case VieEdi_VIEW:
|
||||||
Item->Resource.Hierarchy.RscCod == SelectedRscCod)); // Edit this link?
|
PrgRsc_WriteRowViewResource (NumRsc,Item);
|
||||||
else
|
break;
|
||||||
PrgRsc_WriteRowViewResource (NumRsc,Item);
|
case VieEdi_EDIT:
|
||||||
|
PrgRsc_WriteRowEditResource (NumRsc,NumResources,Item,
|
||||||
|
(ListingType == Prg_EDIT_RESOURCE_LINK &&
|
||||||
|
Item->Resource.Hierarchy.RscCod == SelectedRscCod) ? VieEdi_EDIT :
|
||||||
|
VieEdi_VIEW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Form to create a new resource *****/
|
/***** Form to create a new resource *****/
|
||||||
if (EditingResourcesOfThisItem)
|
if (ViewingOrEditingResourcesOfThisItem == VieEdi_EDIT)
|
||||||
{
|
{
|
||||||
Prg_ResetResource (Item);
|
Prg_ResetResource (Item);
|
||||||
PrgRsc_WriteRowNewResource (NumResources,Item,
|
PrgRsc_WriteRowNewResource (NumResources,Item,
|
||||||
(ListingType == Prg_EDIT_RESOURCE_LINK &&
|
(ListingType == Prg_EDIT_RESOURCE_LINK &&
|
||||||
Item->Resource.Hierarchy.RscCod == SelectedRscCod)); // Edit this link?
|
Item->Resource.Hierarchy.RscCod == SelectedRscCod) ? VieEdi_EDIT :
|
||||||
|
VieEdi_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
|
@ -395,7 +412,8 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||||
struct Prg_Item *Item,bool EditLink)
|
struct Prg_Item *Item,
|
||||||
|
VieEdi_ViewOrEdit_t ViewOrEditLink)
|
||||||
{
|
{
|
||||||
/***** Begin row *****/
|
/***** Begin row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
@ -427,17 +445,20 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
|
|
||||||
/* Edit link showing clipboard / Show current link */
|
/* Edit link showing clipboard / Show current link */
|
||||||
if (EditLink)
|
switch (ViewOrEditLink)
|
||||||
{
|
{
|
||||||
/* Show clipboard to change resource link */
|
case VieEdi_VIEW:
|
||||||
Frm_BeginFormAnchor (ActChgLnkPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
/* Show current link */
|
||||||
ParCod_PutPar (ParCod_Rsc,Item->Resource.Hierarchy.RscCod);
|
Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM_TO_GO);
|
||||||
Rsc_ShowClipboardToChangeLink (&Item->Resource.Link);
|
break;
|
||||||
Frm_EndForm ();
|
case VieEdi_EDIT:
|
||||||
|
/* Show clipboard to change resource link */
|
||||||
|
Frm_BeginFormAnchor (ActChgLnkPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||||
|
ParCod_PutPar (ParCod_Rsc,Item->Resource.Hierarchy.RscCod);
|
||||||
|
Rsc_ShowClipboardToChangeLink (&Item->Resource.Link);
|
||||||
|
Frm_EndForm ();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
/* Show current link */
|
|
||||||
Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM_TO_GO);
|
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
@ -450,7 +471,8 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
||||||
struct Prg_Item *Item,bool EditLink)
|
struct Prg_Item *Item,
|
||||||
|
VieEdi_ViewOrEdit_t ViewOrEditLink)
|
||||||
{
|
{
|
||||||
extern const char *Txt_New_resource;
|
extern const char *Txt_New_resource;
|
||||||
|
|
||||||
|
@ -483,7 +505,7 @@ static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
/* Edit link showing clipboard? */
|
/* Edit link showing clipboard? */
|
||||||
if (EditLink)
|
if (ViewOrEditLink == VieEdi_EDIT)
|
||||||
{
|
{
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
|
|
||||||
|
|
344
swad_syllabus.c
344
swad_syllabus.c
|
@ -136,7 +136,7 @@ void Syl_ResetSyllabus (struct Syl_Syllabus *Syllabus)
|
||||||
{
|
{
|
||||||
Syllabus->PathDir[0] = '\0';
|
Syllabus->PathDir[0] = '\0';
|
||||||
Syllabus->NumItem = 0;
|
Syllabus->NumItem = 0;
|
||||||
Syllabus->EditionIsActive = false;
|
Syllabus->ViewingOrEditing = VieEdi_VIEW;
|
||||||
Syllabus->WhichSyllabus = Syl_DEFAULT_WHICH_SYLLABUS;
|
Syllabus->WhichSyllabus = Syl_DEFAULT_WHICH_SYLLABUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,14 +244,15 @@ bool Syl_CheckAndEditSyllabus (struct Syl_Syllabus *Syllabus)
|
||||||
case ActLftIteSylLec: case ActLftIteSylPra:
|
case ActLftIteSylLec: case ActLftIteSylPra:
|
||||||
case ActInsIteSylLec: case ActInsIteSylPra:
|
case ActInsIteSylLec: case ActInsIteSylPra:
|
||||||
case ActModIteSylLec: case ActModIteSylPra:
|
case ActModIteSylLec: case ActModIteSylPra:
|
||||||
Syllabus->EditionIsActive = true;
|
Syllabus->ViewingOrEditing = VieEdi_EDIT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Syllabus->EditionIsActive = false;
|
Syllabus->ViewingOrEditing = VieEdi_VIEW;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Syllabus->EditionIsActive || Syl_LstItemsSyllabus.NumItems)
|
if (Syllabus->ViewingOrEditing == VieEdi_EDIT ||
|
||||||
|
Syl_LstItemsSyllabus.NumItems)
|
||||||
{
|
{
|
||||||
/***** Write the current syllabus *****/
|
/***** Write the current syllabus *****/
|
||||||
Syl_ShowSyllabus (Syllabus);
|
Syl_ShowSyllabus (Syllabus);
|
||||||
|
@ -521,81 +522,84 @@ static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus)
|
||||||
extern const char *Hlp_COURSE_Syllabus;
|
extern const char *Hlp_COURSE_Syllabus;
|
||||||
extern const char *Txt_Done;
|
extern const char *Txt_Done;
|
||||||
unsigned NumItem;
|
unsigned NumItem;
|
||||||
int i;
|
int Col;
|
||||||
int NumButtons = Syllabus->EditionIsActive ? 5 :
|
static const char **HelpLink[VieEdi_NUM_VIEW_EDIT] =
|
||||||
0;
|
{
|
||||||
|
[VieEdi_VIEW] = &Hlp_COURSE_Syllabus,
|
||||||
|
[VieEdi_EDIT] = &Hlp_COURSE_Syllabus_edit,
|
||||||
|
};
|
||||||
|
static int NumButtons[VieEdi_NUM_VIEW_EDIT] =
|
||||||
|
{
|
||||||
|
[VieEdi_VIEW] = 0,
|
||||||
|
[VieEdi_EDIT] = 5,
|
||||||
|
};
|
||||||
bool ShowRowInsertNewItem = (Gbl.Action.Act == ActInsIteSylLec || Gbl.Action.Act == ActInsIteSylPra ||
|
bool ShowRowInsertNewItem = (Gbl.Action.Act == ActInsIteSylLec || Gbl.Action.Act == ActInsIteSylPra ||
|
||||||
Gbl.Action.Act == ActModIteSylLec || Gbl.Action.Act == ActModIteSylPra ||
|
Gbl.Action.Act == ActModIteSylLec || Gbl.Action.Act == ActModIteSylPra ||
|
||||||
Gbl.Action.Act == ActRgtIteSylLec || Gbl.Action.Act == ActRgtIteSylPra ||
|
Gbl.Action.Act == ActRgtIteSylLec || Gbl.Action.Act == ActRgtIteSylPra ||
|
||||||
Gbl.Action.Act == ActLftIteSylLec || Gbl.Action.Act == ActLftIteSylPra);
|
Gbl.Action.Act == ActLftIteSylLec || Gbl.Action.Act == ActLftIteSylPra);
|
||||||
bool ICanEdit = Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
bool ICanEdit = Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM;
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM;
|
||||||
bool PutIconToEdit = ICanEdit && !Syllabus->EditionIsActive;
|
bool PutIconToEdit = Syllabus->ViewingOrEditing == VieEdi_VIEW && ICanEdit;
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
if (PutIconToEdit)
|
Box_BoxBegin (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type],
|
||||||
Box_BoxBegin (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type],
|
PutIconToEdit ? Inf_PutIconToEditInfo :
|
||||||
Inf_PutIconToEditInfo,&Gbl.Crs.Info.Type,
|
NULL,
|
||||||
Syllabus->EditionIsActive ? Hlp_COURSE_Syllabus_edit :
|
PutIconToEdit ? &Gbl.Crs.Info.Type :
|
||||||
Hlp_COURSE_Syllabus,
|
NULL,
|
||||||
Box_NOT_CLOSABLE);
|
*HelpLink[Syllabus->ViewingOrEditing],Box_NOT_CLOSABLE);
|
||||||
else
|
|
||||||
Box_BoxBegin (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type],
|
|
||||||
NULL,NULL,
|
|
||||||
Syllabus->EditionIsActive ? Hlp_COURSE_Syllabus_edit :
|
|
||||||
Hlp_COURSE_Syllabus,
|
|
||||||
Box_NOT_CLOSABLE);
|
|
||||||
|
|
||||||
Syl_PutFormWhichSyllabus (Syllabus->WhichSyllabus);
|
/****** Form to select syllabus *****/
|
||||||
|
Syl_PutFormWhichSyllabus (Syllabus->WhichSyllabus);
|
||||||
|
|
||||||
/***** Begin table *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginWide ();
|
HTM_TABLE_BeginWide ();
|
||||||
|
|
||||||
/***** Set width of columns of the table *****/
|
/***** Set width of columns of the table *****/
|
||||||
HTM_Txt ("<colgroup>");
|
HTM_Txt ("<colgroup>");
|
||||||
for (i = 0;
|
for (Col = 0;
|
||||||
i < NumButtons;
|
Col < NumButtons[Syllabus->ViewingOrEditing];
|
||||||
i++)
|
Col++)
|
||||||
HTM_Txt ("<col width=\"12\" />");
|
HTM_Txt ("<col width=\"12\" />");
|
||||||
for (i = 1;
|
for (Col = 1;
|
||||||
i <= Syl_LstItemsSyllabus.NumLevels;
|
Col <= Syl_LstItemsSyllabus.NumLevels;
|
||||||
i++)
|
Col++)
|
||||||
HTM_TxtF ("<col width=\"%d\" />",i * Syl_WIDTH_NUM_SYLLABUS);
|
HTM_TxtF ("<col width=\"%d\" />",Col * Syl_WIDTH_NUM_SYLLABUS);
|
||||||
HTM_Txt ("<col width=\"*\" />");
|
HTM_Txt ("<col width=\"*\" />");
|
||||||
HTM_Txt ("</colgroup>");
|
HTM_Txt ("</colgroup>");
|
||||||
|
|
||||||
if (Syl_LstItemsSyllabus.NumItems)
|
if (Syl_LstItemsSyllabus.NumItems)
|
||||||
/***** Loop writing all items of the syllabus *****/
|
/***** Loop writing all items of the syllabus *****/
|
||||||
for (NumItem = 0;
|
for (NumItem = 0;
|
||||||
NumItem < Syl_LstItemsSyllabus.NumItems;
|
NumItem < Syl_LstItemsSyllabus.NumItems;
|
||||||
NumItem++)
|
NumItem++)
|
||||||
{
|
{
|
||||||
Syl_ShowRowSyllabus (Syllabus,NumItem,
|
Syl_ShowRowSyllabus (Syllabus,NumItem,
|
||||||
Syl_LstItemsSyllabus.Lst[NumItem].Level,
|
Syl_LstItemsSyllabus.Lst[NumItem].Level,
|
||||||
Syl_LstItemsSyllabus.Lst[NumItem].CodItem,
|
Syl_LstItemsSyllabus.Lst[NumItem].CodItem,
|
||||||
Syl_LstItemsSyllabus.Lst[NumItem].Text,false);
|
Syl_LstItemsSyllabus.Lst[NumItem].Text,false);
|
||||||
if (ShowRowInsertNewItem && NumItem == Syllabus->NumItem)
|
if (ShowRowInsertNewItem && NumItem == Syllabus->NumItem)
|
||||||
// Mostrar a new row where se puede insert a new item
|
// Mostrar a new row where se puede insert a new item
|
||||||
Syl_ShowRowSyllabus (Syllabus,NumItem + 1,
|
Syl_ShowRowSyllabus (Syllabus,NumItem + 1,
|
||||||
Syl_LstItemsSyllabus.Lst[NumItem].Level,NULL,
|
Syl_LstItemsSyllabus.Lst[NumItem].Level,NULL,
|
||||||
"",true);
|
"",true);
|
||||||
}
|
}
|
||||||
else if (Syllabus->EditionIsActive)
|
else if (Syllabus->ViewingOrEditing == VieEdi_EDIT)
|
||||||
/***** If the syllabus is empty ==>
|
/***** If the syllabus is empty ==>
|
||||||
show form to add a iten to the end *****/
|
show form to add a iten to the end *****/
|
||||||
Syl_ShowRowSyllabus (Syllabus,0,
|
Syl_ShowRowSyllabus (Syllabus,0,
|
||||||
1,Syl_LstItemsSyllabus.Lst[0].CodItem,"",true);
|
1,Syl_LstItemsSyllabus.Lst[0].CodItem,"",true);
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
|
||||||
if (Syllabus->EditionIsActive)
|
|
||||||
{
|
|
||||||
/***** Button to view *****/
|
/***** Button to view *****/
|
||||||
Frm_BeginForm (Inf_ActionsSeeInfo[Gbl.Crs.Info.Type]);
|
if (Syllabus->ViewingOrEditing == VieEdi_EDIT)
|
||||||
Btn_PutConfirmButton (Txt_Done);
|
{
|
||||||
Frm_EndForm ();
|
Frm_BeginForm (Inf_ActionsSeeInfo[Gbl.Crs.Info.Type]);
|
||||||
}
|
Btn_PutConfirmButton (Txt_Done);
|
||||||
|
Frm_EndForm ();
|
||||||
|
}
|
||||||
|
|
||||||
/***** End box *****/
|
/***** End box *****/
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
|
@ -625,115 +629,115 @@ static void Syl_ShowRowSyllabus (struct Syl_Syllabus *Syllabus,unsigned NumItem,
|
||||||
/***** Begin the row *****/
|
/***** Begin the row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
if (Syllabus->EditionIsActive)
|
switch (Syllabus->ViewingOrEditing)
|
||||||
{
|
{
|
||||||
if (NewItem)
|
case VieEdi_VIEW:
|
||||||
{
|
/***** Indent depending on the level *****/
|
||||||
HTM_TD_Begin ("colspan=\"5\" class=\"%s\"",
|
if (Level > 1)
|
||||||
The_GetColorRows ());
|
{
|
||||||
HTM_TD_End ();
|
HTM_TD_Begin ("colspan=\"%d\" class=\"%s\"",
|
||||||
}
|
Level - 1,The_GetColorRows ());
|
||||||
else
|
HTM_TD_End ();
|
||||||
{
|
}
|
||||||
/***** Icon to remove the row *****/
|
|
||||||
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
/***** Code of the item *****/
|
||||||
if (Syl_LstItemsSyllabus.Lst[NumItem].HasChildren)
|
HTM_TD_Begin ("class=\"RT %s_%s %s\" style=\"width:%dpx;\"",
|
||||||
Ico_PutIconRemovalNotAllowed ();
|
ClassSyllabus[Level],The_GetSuffix (),
|
||||||
else
|
The_GetColorRows (),
|
||||||
Ico_PutContextualIconToRemove (Gbl.Crs.Info.Type == Inf_LECTURES ? ActDelItmSylLec :
|
Level * Syl_WIDTH_NUM_SYLLABUS);
|
||||||
ActDelItmSylPra,NULL,
|
if (Level == 1)
|
||||||
Syl_PutParNumItem,&Syllabus->ParNumItem);
|
HTM_NBSP ();
|
||||||
|
HTM_TxtF ("%s ",StrItemCod);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Icon to get up an item *****/
|
/***** Text of the item *****/
|
||||||
Syl_CalculateUpSubtreeSyllabus (&Subtree,NumItem);
|
HTM_TD_Begin ("colspan=\"%d\" class=\"LT %s_%s %s\"",
|
||||||
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
Syl_LstItemsSyllabus.NumLevels - Level + 1,
|
||||||
if (Subtree.MovAllowed)
|
ClassSyllabus[Level],The_GetSuffix (),
|
||||||
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActUp_IteSylLec :
|
The_GetColorRows ());
|
||||||
ActUp_IteSylPra,
|
HTM_Txt (Text);
|
||||||
NULL,
|
|
||||||
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
|
||||||
"arrow-up.svg",Ico_BLACK);
|
|
||||||
else
|
|
||||||
Ico_PutIconOff ("arrow-up.svg",Ico_BLACK,
|
|
||||||
Txt_Movement_not_allowed);
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
break;
|
||||||
|
case VieEdi_EDIT:
|
||||||
|
if (NewItem)
|
||||||
|
{
|
||||||
|
HTM_TD_Begin ("colspan=\"5\" class=\"%s\"",
|
||||||
|
The_GetColorRows ());
|
||||||
|
HTM_TD_End ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/***** Icon to remove the row *****/
|
||||||
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
||||||
|
if (Syl_LstItemsSyllabus.Lst[NumItem].HasChildren)
|
||||||
|
Ico_PutIconRemovalNotAllowed ();
|
||||||
|
else
|
||||||
|
Ico_PutContextualIconToRemove (Gbl.Crs.Info.Type == Inf_LECTURES ? ActDelItmSylLec :
|
||||||
|
ActDelItmSylPra,NULL,
|
||||||
|
Syl_PutParNumItem,&Syllabus->ParNumItem);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Icon to get down item *****/
|
/***** Icon to get up an item *****/
|
||||||
Syl_CalculateDownSubtreeSyllabus (&Subtree,NumItem);
|
Syl_CalculateUpSubtreeSyllabus (&Subtree,NumItem);
|
||||||
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
||||||
if (Subtree.MovAllowed)
|
if (Subtree.MovAllowed)
|
||||||
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActDwnIteSylLec :
|
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActUp_IteSylLec :
|
||||||
ActDwnIteSylPra,
|
ActUp_IteSylPra,
|
||||||
NULL,
|
NULL,
|
||||||
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
||||||
"arrow-down.svg",Ico_BLACK);
|
"arrow-up.svg",Ico_BLACK);
|
||||||
else
|
else
|
||||||
Ico_PutIconOff ("arrow-down.svg",Ico_BLACK,
|
Ico_PutIconOff ("arrow-up.svg",Ico_BLACK,
|
||||||
Txt_Movement_not_allowed);
|
Txt_Movement_not_allowed);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Icon to increase the level of an item *****/
|
/***** Icon to get down item *****/
|
||||||
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
Syl_CalculateDownSubtreeSyllabus (&Subtree,NumItem);
|
||||||
if (Level > 1)
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
||||||
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActRgtIteSylLec :
|
if (Subtree.MovAllowed)
|
||||||
ActRgtIteSylPra,
|
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActDwnIteSylLec :
|
||||||
NULL,
|
ActDwnIteSylPra,
|
||||||
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
NULL,
|
||||||
"arrow-left.svg",Ico_BLACK);
|
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
||||||
else
|
"arrow-down.svg",Ico_BLACK);
|
||||||
Ico_PutIconOff ("arrow-left.svg",Ico_BLACK,
|
else
|
||||||
Txt_Movement_not_allowed);
|
Ico_PutIconOff ("arrow-down.svg",Ico_BLACK,
|
||||||
HTM_TD_End ();
|
Txt_Movement_not_allowed);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Icon to decrease level item *****/
|
/***** Icon to increase the level of an item *****/
|
||||||
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
||||||
if (Level < LastLevel + 1 &&
|
if (Level > 1)
|
||||||
Level < Syl_MAX_LEVELS_SYLLABUS)
|
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActRgtIteSylLec :
|
||||||
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActLftIteSylLec :
|
ActRgtIteSylPra,
|
||||||
ActLftIteSylPra,
|
NULL,
|
||||||
NULL,
|
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
||||||
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
"arrow-left.svg",Ico_BLACK);
|
||||||
"arrow-right.svg",Ico_BLACK);
|
else
|
||||||
else
|
Ico_PutIconOff ("arrow-left.svg",Ico_BLACK,
|
||||||
Ico_PutIconOff ("arrow-right.svg",Ico_BLACK,
|
Txt_Movement_not_allowed);
|
||||||
Txt_Movement_not_allowed);
|
HTM_TD_End ();
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
LastLevel = Level;
|
/***** Icon to decrease level item *****/
|
||||||
}
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
||||||
}
|
if (Level < LastLevel + 1 &&
|
||||||
|
Level < Syl_MAX_LEVELS_SYLLABUS)
|
||||||
|
Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActLftIteSylLec :
|
||||||
|
ActLftIteSylPra,
|
||||||
|
NULL,
|
||||||
|
Syl_PutParNumItem,&Syllabus->ParNumItem,
|
||||||
|
"arrow-right.svg",Ico_BLACK);
|
||||||
|
else
|
||||||
|
Ico_PutIconOff ("arrow-right.svg",Ico_BLACK,
|
||||||
|
Txt_Movement_not_allowed);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
if (Syllabus->EditionIsActive)
|
LastLevel = Level;
|
||||||
Syl_PutFormItemSyllabus (Syllabus,NewItem,NumItem,Level,CodItem,Text);
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/***** Indent depending on the level *****/
|
|
||||||
if (Level > 1)
|
|
||||||
{
|
|
||||||
HTM_TD_Begin ("colspan=\"%d\" class=\"%s\"",
|
|
||||||
Level - 1,The_GetColorRows ());
|
|
||||||
HTM_TD_End ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Code of the item *****/
|
Syl_PutFormItemSyllabus (Syllabus,NewItem,NumItem,Level,CodItem,Text);
|
||||||
HTM_TD_Begin ("class=\"RT %s_%s %s\" style=\"width:%dpx;\"",
|
break;
|
||||||
ClassSyllabus[Level],The_GetSuffix (),
|
}
|
||||||
The_GetColorRows (),
|
|
||||||
Level * Syl_WIDTH_NUM_SYLLABUS);
|
|
||||||
if (Level == 1)
|
|
||||||
HTM_NBSP ();
|
|
||||||
HTM_TxtF ("%s ",StrItemCod);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Text of the item *****/
|
|
||||||
HTM_TD_Begin ("colspan=\"%d\" class=\"LT %s_%s %s\"",
|
|
||||||
Syl_LstItemsSyllabus.NumLevels - Level + 1,
|
|
||||||
ClassSyllabus[Level],The_GetSuffix (),
|
|
||||||
The_GetColorRows ());
|
|
||||||
HTM_Txt (Text);
|
|
||||||
HTM_TD_End ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End of the row *****/
|
/***** End of the row *****/
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -931,7 +935,7 @@ void Syl_RemoveItemSyllabus (void)
|
||||||
/***** Load syllabus from XML file to memory *****/
|
/***** Load syllabus from XML file to memory *****/
|
||||||
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
||||||
|
|
||||||
Syllabus.EditionIsActive = true;
|
Syllabus.ViewingOrEditing = VieEdi_EDIT;
|
||||||
|
|
||||||
/***** Get item number *****/
|
/***** Get item number *****/
|
||||||
Syllabus.NumItem = Syl_GetParItemNumber ();
|
Syllabus.NumItem = Syl_GetParItemNumber ();
|
||||||
|
@ -1008,7 +1012,7 @@ static void Syl_ChangePlaceItemSyllabus (Syl_ChangePosItem_t UpOrDownPos)
|
||||||
/***** Load syllabus from XML file to memory *****/
|
/***** Load syllabus from XML file to memory *****/
|
||||||
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
||||||
|
|
||||||
Syllabus.EditionIsActive = true;
|
Syllabus.ViewingOrEditing = VieEdi_EDIT;
|
||||||
|
|
||||||
/***** Get item number *****/
|
/***** Get item number *****/
|
||||||
Syllabus.NumItem = Syl_GetParItemNumber ();
|
Syllabus.NumItem = Syl_GetParItemNumber ();
|
||||||
|
@ -1194,7 +1198,7 @@ static void Syl_ChangeLevelItemSyllabus (Syl_ChangeLevelItem_t IncreaseOrDecreas
|
||||||
/***** Load syllabus from XML file to memory *****/
|
/***** Load syllabus from XML file to memory *****/
|
||||||
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
||||||
|
|
||||||
Syllabus.EditionIsActive = true;
|
Syllabus.ViewingOrEditing = VieEdi_EDIT;
|
||||||
|
|
||||||
/***** Get item number *****/
|
/***** Get item number *****/
|
||||||
Syllabus.NumItem = Syl_GetParItemNumber ();
|
Syllabus.NumItem = Syl_GetParItemNumber ();
|
||||||
|
@ -1257,7 +1261,7 @@ void Syl_InsertItemSyllabus (void)
|
||||||
/***** Load syllabus from XML file to memory *****/
|
/***** Load syllabus from XML file to memory *****/
|
||||||
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
||||||
|
|
||||||
Syllabus.EditionIsActive = true;
|
Syllabus.ViewingOrEditing = VieEdi_EDIT;
|
||||||
|
|
||||||
/***** Get item number *****/
|
/***** Get item number *****/
|
||||||
Syllabus.NumItem = Syl_GetParItemNumber ();
|
Syllabus.NumItem = Syl_GetParItemNumber ();
|
||||||
|
@ -1326,14 +1330,14 @@ void Syl_ModifyItemSyllabus (void)
|
||||||
/***** Load syllabus from XML file to memory *****/
|
/***** Load syllabus from XML file to memory *****/
|
||||||
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
Syl_LoadListItemsSyllabusIntoMemory (&Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
||||||
|
|
||||||
Syllabus.EditionIsActive = true;
|
Syllabus.ViewingOrEditing = VieEdi_EDIT;
|
||||||
|
|
||||||
/***** Get item number *****/
|
/***** Get item number *****/
|
||||||
Syllabus.NumItem = Syl_GetParItemNumber ();
|
Syllabus.NumItem = Syl_GetParItemNumber ();
|
||||||
|
|
||||||
/***** Get item body *****/
|
/***** Get item body *****/
|
||||||
Par_GetParHTML ("Txt",Syl_LstItemsSyllabus.Lst[Syllabus.NumItem].Text,
|
Par_GetParHTML ("Txt",Syl_LstItemsSyllabus.Lst[Syllabus.NumItem].Text,
|
||||||
Syl_MAX_BYTES_TEXT_ITEM);
|
Syl_MAX_BYTES_TEXT_ITEM);
|
||||||
|
|
||||||
/***** Create a new file where make the update *****/
|
/***** Create a new file where make the update *****/
|
||||||
Syl_BuildPathFileSyllabus (&Syllabus,PathFile);
|
Syl_BuildPathFileSyllabus (&Syllabus,PathFile);
|
||||||
|
|
|
@ -23,6 +23,12 @@
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************************* Headers ***********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include "swad_view_edit.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************ Public constants and types *************************/
|
/************************ Public constants and types *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -69,9 +75,9 @@ struct MoveSubtrees
|
||||||
struct Syl_Syllabus
|
struct Syl_Syllabus
|
||||||
{
|
{
|
||||||
char PathDir[PATH_MAX + 1];
|
char PathDir[PATH_MAX + 1];
|
||||||
unsigned NumItem; // Item being edited
|
unsigned NumItem; // Item being edited
|
||||||
unsigned ParNumItem; // Used as parameter in forms
|
unsigned ParNumItem; // Used as parameter in forms
|
||||||
bool EditionIsActive;
|
VieEdi_ViewOrEdit_t ViewingOrEditing;
|
||||||
Syl_WhichSyllabus_t WhichSyllabus;
|
Syl_WhichSyllabus_t WhichSyllabus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
// swad_view_edit.h: types and constants related to view/edit
|
||||||
|
|
||||||
|
#ifndef _SWAD_VIE_EDI
|
||||||
|
#define _SWAD_VIE_EDI
|
||||||
|
/*
|
||||||
|
SWAD (Shared Workspace At a Distance in Spanish),
|
||||||
|
is a web platform developed at the University of Granada (Spain),
|
||||||
|
and used to support university teaching.
|
||||||
|
|
||||||
|
This file is part of SWAD core.
|
||||||
|
Copyright (C) 1999-2023 Antonio Cañas Vargas
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Public constants ******************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define VieEdi_NUM_VIEW_EDIT 2
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************************* Public types ********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
VieEdi_VIEW = 0,
|
||||||
|
VieEdi_EDIT = 1,
|
||||||
|
} VieEdi_ViewOrEdit_t;
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue