2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_syllabus.c: syllabus
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2024-02-07 00:40:28 +01:00
|
|
|
|
Copyright (C) 1999-2024 Antonio Ca<EFBFBD>as Vargas
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-12-30 11:50:29 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <linux/limits.h> // For PATH_MAX
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include <stddef.h> // For NULL
|
2021-12-30 11:50:29 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <stdlib.h> // For free ()
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include <stdsoap2.h> // For SOAP_OK and soap functions
|
2017-01-16 01:51:01 +01:00
|
|
|
|
#include <string.h> // For string functions
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <time.h> // For time ()
|
2021-12-30 11:50:29 +01:00
|
|
|
|
#include <unistd.h> // For SEEK_SET
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2022-11-06 18:11:10 +01:00
|
|
|
|
#include "swad_action_list.h"
|
2017-06-10 21:38:10 +02:00
|
|
|
|
#include "swad_box.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_changelog.h"
|
|
|
|
|
#include "swad_config.h"
|
|
|
|
|
#include "swad_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_forum.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_global.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2021-09-22 00:18:08 +02:00
|
|
|
|
#include "swad_info_database.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_parameter.h"
|
|
|
|
|
#include "swad_string.h"
|
|
|
|
|
#include "swad_xml.h"
|
|
|
|
|
|
2024-03-19 18:39:35 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public constants ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
Syl_WhichSyllabus_t Syl_WhichSyllabus[Syl_NUM_WHICH_SYLLABUS] =
|
|
|
|
|
{
|
|
|
|
|
[Syl_NONE ] = Syl_NONE,
|
|
|
|
|
[Syl_LECTURES ] = Syl_LECTURES,
|
|
|
|
|
[Syl_PRACTICALS] = Syl_PRACTICALS
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define Syl_MAX_LEVELS_SYLLABUS 10
|
2017-01-16 01:51:01 +01:00
|
|
|
|
|
2017-03-08 03:48:23 +01:00
|
|
|
|
#define Syl_MAX_BYTES_ITEM_COD (Syl_MAX_LEVELS_SYLLABUS * (10 + 1) - 1)
|
2017-01-16 01:51:01 +01:00
|
|
|
|
|
2017-03-08 14:12:33 +01:00
|
|
|
|
#define Syl_MAX_CHARS_TEXT_ITEM (1024 - 1) // 1023
|
|
|
|
|
#define Syl_MAX_BYTES_TEXT_ITEM ((Syl_MAX_CHARS_TEXT_ITEM + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 16383
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-09-28 18:28:29 +02:00
|
|
|
|
#define Syl_WIDTH_NUM_SYLLABUS 20
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2022-04-05 21:41:21 +02:00
|
|
|
|
static const char *ClassSyllabus[1 + Syl_MAX_LEVELS_SYLLABUS] =
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-12-15 20:02:34 +01:00
|
|
|
|
[ 0] = "",
|
2022-04-05 21:41:21 +02:00
|
|
|
|
[ 1] = "SYL1",
|
|
|
|
|
[ 2] = "SYL2",
|
|
|
|
|
[ 3] = "SYL3",
|
|
|
|
|
[ 4] = "SYL3",
|
|
|
|
|
[ 5] = "SYL3",
|
|
|
|
|
[ 6] = "SYL3",
|
|
|
|
|
[ 7] = "SYL3",
|
|
|
|
|
[ 8] = "SYL3",
|
|
|
|
|
[ 9] = "SYL3",
|
|
|
|
|
[10] = "SYL3",
|
2014-12-01 23:55:08 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Private types *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
struct ItemSyllabus
|
|
|
|
|
{
|
|
|
|
|
int Level;
|
2017-01-28 15:58:46 +01:00
|
|
|
|
int CodItem[1 + Syl_MAX_LEVELS_SYLLABUS];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool HasChildren;
|
2017-01-28 15:58:46 +01:00
|
|
|
|
char Text[Syl_MAX_BYTES_TEXT_ITEM + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private variables *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-02-24 19:31:55 +01:00
|
|
|
|
struct LstItemsSyllabus Syl_LstItemsSyllabus;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static unsigned Syl_GetParItemNumber (void);
|
2020-04-12 02:47:32 +02:00
|
|
|
|
|
2021-10-24 18:16:12 +02:00
|
|
|
|
static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus);
|
2020-04-12 02:47:32 +02:00
|
|
|
|
static void Syl_ShowRowSyllabus (struct Syl_Syllabus *Syllabus,unsigned NumItem,
|
2015-10-22 14:49:48 +02:00
|
|
|
|
int Level,int *CodItem,const char *Text,bool NewItem);
|
2020-04-12 02:47:32 +02:00
|
|
|
|
static void Syl_PutFormItemSyllabus (struct Syl_Syllabus *Syllabus,
|
|
|
|
|
bool NewItem,unsigned NumItem,int Level,int *CodItem,const char *Text);
|
2024-03-19 18:39:35 +01:00
|
|
|
|
static void Syl_PutParsSyllabus (void *Syllabus);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-01-16 01:51:01 +01:00
|
|
|
|
static void Syl_WriteNumItem (char *StrDst,FILE *FileTgt,int Level,int *CodItem);
|
|
|
|
|
|
2020-04-12 02:47:32 +02:00
|
|
|
|
static void Syl_ChangePlaceItemSyllabus (Syl_ChangePosItem_t UpOrDownPos);
|
|
|
|
|
static void Syl_ChangeLevelItemSyllabus (Syl_ChangeLevelItem_t IncreaseOrDecreaseLevel);
|
|
|
|
|
|
|
|
|
|
static void Syl_OpenSyllabusFile (const struct Syl_Syllabus *Syllabus,
|
2022-10-21 08:46:07 +02:00
|
|
|
|
char PathFile[PATH_MAX + 1],
|
|
|
|
|
FILE **XML);
|
|
|
|
|
static void Syl_CloseXMLFile (FILE **XML);
|
2020-04-12 02:47:32 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Reset syllabus context ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Syl_ResetSyllabus (struct Syl_Syllabus *Syllabus)
|
|
|
|
|
{
|
|
|
|
|
Syllabus->PathDir[0] = '\0';
|
|
|
|
|
Syllabus->NumItem = 0;
|
2023-10-29 12:32:08 +01:00
|
|
|
|
Syllabus->ViewType = Vie_VIEW;
|
2020-04-12 02:47:32 +02:00
|
|
|
|
Syllabus->WhichSyllabus = Syl_DEFAULT_WHICH_SYLLABUS;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-28 02:42:41 +01:00
|
|
|
|
/*****************************************************************************/
|
2017-01-29 21:41:08 +01:00
|
|
|
|
/************* Get parameter about which syllabus I want to see **************/
|
2014-12-28 02:42:41 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
Syl_WhichSyllabus_t Syl_GetParWhichSyllabus (void)
|
2014-12-28 02:42:41 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get which syllabus I want to see *****/
|
2020-04-12 02:47:32 +02:00
|
|
|
|
return (Syl_WhichSyllabus_t)
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_GetParUnsignedLong ("WhichSyllabus",
|
2023-03-10 00:13:55 +01:00
|
|
|
|
0,
|
|
|
|
|
Syl_NUM_WHICH_SYLLABUS - 1,
|
|
|
|
|
(unsigned long) Syl_DEFAULT_WHICH_SYLLABUS);
|
2014-12-28 02:42:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-19 18:39:35 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Put parameter with type of syllabus **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Syl_PutParWhichSyllabus (void *SyllabusSelected)
|
|
|
|
|
{
|
|
|
|
|
if (SyllabusSelected)
|
|
|
|
|
if (*((Syl_WhichSyllabus_t *) SyllabusSelected) != Syl_NONE)
|
|
|
|
|
Par_PutParUnsigned (NULL,"WhichSyllabus",
|
|
|
|
|
(unsigned) *((Syl_WhichSyllabus_t *) SyllabusSelected));
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-27 21:09:34 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Write form to select syllabus **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2024-03-19 18:39:35 +01:00
|
|
|
|
void Syl_PutFormWhichSyllabus (Syl_WhichSyllabus_t WhichSyllabus)
|
2014-12-27 21:09:34 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_SYLLABUS_WHICH_SYLLABUS[Syl_NUM_WHICH_SYLLABUS];
|
2020-04-12 02:47:32 +02:00
|
|
|
|
Syl_WhichSyllabus_t WhichSyl;
|
2014-12-27 21:09:34 +01:00
|
|
|
|
|
2024-03-19 18:39:35 +01:00
|
|
|
|
/***** If no syllabus ==> nothing to do *****/
|
|
|
|
|
switch (Gbl.Crs.Info.Type)
|
|
|
|
|
{
|
|
|
|
|
case Inf_LECTURES:
|
|
|
|
|
case Inf_PRACTICALS:
|
|
|
|
|
break;
|
|
|
|
|
default: // Nothing to do
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-16 00:06:02 +02:00
|
|
|
|
/***** Form to select which syllabus I want to see (lectures/practicals) *****/
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActSeeSyl);
|
2022-04-05 20:47:19 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"SEL_BELOW_TITLE DAT_%s\"",The_GetSuffix ());
|
|
|
|
|
HTM_UL_Begin (NULL);
|
2014-12-27 21:09:34 +01:00
|
|
|
|
|
2024-03-19 18:39:35 +01:00
|
|
|
|
for (WhichSyl = (Syl_WhichSyllabus_t) 1;
|
|
|
|
|
WhichSyl <= (Syl_WhichSyllabus_t) (Syl_NUM_WHICH_SYLLABUS - 1);
|
2021-10-24 18:16:12 +02:00
|
|
|
|
WhichSyl++)
|
|
|
|
|
{
|
2022-04-05 20:47:19 +02:00
|
|
|
|
HTM_LI_Begin (NULL);
|
2021-10-24 18:16:12 +02:00
|
|
|
|
HTM_LABEL_Begin (NULL);
|
2024-05-14 10:19:48 +02:00
|
|
|
|
HTM_INPUT_RADIO ("WhichSyllabus",
|
2024-06-07 10:44:31 +02:00
|
|
|
|
((WhichSyl == WhichSyllabus) ? HTM_CHECKED :
|
|
|
|
|
HTM_NO_ATTR) | HTM_SUBMIT_ON_CLICK,
|
2024-04-30 11:00:46 +02:00
|
|
|
|
"value=\"%u\"",(unsigned) WhichSyl);
|
2021-10-24 18:16:12 +02:00
|
|
|
|
HTM_Txt (Txt_SYLLABUS_WHICH_SYLLABUS[WhichSyl]);
|
|
|
|
|
HTM_LABEL_End ();
|
|
|
|
|
HTM_LI_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_UL_End ();
|
|
|
|
|
HTM_DIV_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-27 21:09:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2017-01-29 21:41:08 +01:00
|
|
|
|
/************ Get parameter item number in edition of syllabus ***************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
static unsigned Syl_GetParItemNumber (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2023-03-07 09:55:39 +01:00
|
|
|
|
return (unsigned) Par_GetParUnsignedLong ("NumI",
|
2023-03-10 00:13:55 +01:00
|
|
|
|
0,
|
|
|
|
|
UINT_MAX,
|
|
|
|
|
0);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-30 14:27:10 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Check if syllabus is not empty ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Return true if info available
|
|
|
|
|
|
2020-04-12 02:47:32 +02:00
|
|
|
|
bool Syl_CheckSyllabus (struct Syl_Syllabus *Syllabus,long CrsCod)
|
2016-05-30 14:27:10 +02:00
|
|
|
|
{
|
2016-05-30 15:25:21 +02:00
|
|
|
|
bool InfoAvailable;
|
2016-05-30 14:27:10 +02:00
|
|
|
|
|
2016-05-30 15:25:21 +02:00
|
|
|
|
/***** Load syllabus from XML file to memory *****/
|
2020-04-12 02:47:32 +02:00
|
|
|
|
Syl_LoadListItemsSyllabusIntoMemory (Syllabus,CrsCod);
|
2016-05-30 15:25:21 +02:00
|
|
|
|
|
|
|
|
|
/***** Number of items > 0 ==> info available *****/
|
2020-02-24 19:31:55 +01:00
|
|
|
|
InfoAvailable = (Syl_LstItemsSyllabus.NumItems != 0);
|
2016-05-30 15:25:21 +02:00
|
|
|
|
|
|
|
|
|
/***** Free memory used to store items *****/
|
|
|
|
|
Syl_FreeListItemsSyllabus ();
|
|
|
|
|
|
|
|
|
|
return InfoAvailable;
|
2016-05-30 14:27:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2020-04-13 12:04:49 +02:00
|
|
|
|
/************** Load syllabus from file to memoruy and edit it ***************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-05-30 14:27:10 +02:00
|
|
|
|
// Return true if info available
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2024-03-19 18:39:35 +01:00
|
|
|
|
bool Syl_CheckAndShowSyllabus (struct Syl_Syllabus *Syllabus)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-05-30 15:25:21 +02:00
|
|
|
|
/***** Load syllabus from XML file to memory *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Syl_LoadListItemsSyllabusIntoMemory (Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-04-13 12:04:49 +02:00
|
|
|
|
switch (Gbl.Action.Act)
|
|
|
|
|
{
|
2024-03-20 00:50:44 +01:00
|
|
|
|
case ActEditorSyl:
|
|
|
|
|
case ActDelItmSyl:
|
|
|
|
|
case ActUp_IteSyl:
|
|
|
|
|
case ActDwnIteSyl:
|
|
|
|
|
case ActRgtIteSyl:
|
|
|
|
|
case ActLftIteSyl:
|
|
|
|
|
case ActInsIteSyl:
|
|
|
|
|
case ActModIteSyl:
|
2023-10-29 12:32:08 +01:00
|
|
|
|
Syllabus->ViewType = Vie_EDIT;
|
2020-04-13 12:04:49 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2023-10-29 12:32:08 +01:00
|
|
|
|
Syllabus->ViewType = Vie_VIEW;
|
2020-04-13 12:04:49 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2023-10-29 12:32:08 +01:00
|
|
|
|
if (Syllabus->ViewType == Vie_EDIT ||
|
2023-10-28 20:51:27 +02:00
|
|
|
|
Syl_LstItemsSyllabus.NumItems)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Write the current syllabus *****/
|
2021-10-24 18:16:12 +02:00
|
|
|
|
Syl_ShowSyllabus (Syllabus);
|
2016-05-30 14:27:10 +02:00
|
|
|
|
return true;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2016-05-30 14:27:10 +02:00
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Edit a syllabus ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Return true if info available
|
|
|
|
|
|
|
|
|
|
void Syl_EditSyllabus (void)
|
|
|
|
|
{
|
2024-03-19 23:39:54 +01:00
|
|
|
|
extern const char *Hlp_COURSE_Syllabus_edit;
|
|
|
|
|
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
|
2020-04-12 02:47:32 +02:00
|
|
|
|
struct Syl_Syllabus Syllabus;
|
|
|
|
|
|
|
|
|
|
/***** Reset syllabus context *****/
|
|
|
|
|
Syl_ResetSyllabus (&Syllabus);
|
|
|
|
|
|
2024-03-19 23:39:54 +01:00
|
|
|
|
/***** Get syllabus type *****/
|
|
|
|
|
Syllabus.WhichSyllabus = Syl_GetParWhichSyllabus ();
|
|
|
|
|
Gbl.Crs.Info.Type = (Syllabus.WhichSyllabus == Syl_LECTURES ? Inf_LECTURES :
|
|
|
|
|
Inf_PRACTICALS);
|
|
|
|
|
|
|
|
|
|
/***** Begin box *****/
|
|
|
|
|
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_COURSE_Syllabus_edit,Box_NOT_CLOSABLE);
|
|
|
|
|
|
|
|
|
|
/***** Edit syllabus *****/
|
|
|
|
|
Syl_CheckAndShowSyllabus (&Syllabus);
|
|
|
|
|
|
|
|
|
|
/***** End box *****/
|
|
|
|
|
Box_BoxEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*** Read from XML and load in memory a syllabus of lectures or practicals ***/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 02:47:32 +02:00
|
|
|
|
void Syl_LoadListItemsSyllabusIntoMemory (struct Syl_Syllabus *Syllabus,
|
|
|
|
|
long CrsCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-01-28 15:58:46 +01:00
|
|
|
|
char PathFile[PATH_MAX + 1];
|
2022-10-21 08:46:07 +02:00
|
|
|
|
FILE *XML = NULL; // XML file for syllabus
|
2014-12-01 23:55:08 +01:00
|
|
|
|
long PostBeginList;
|
|
|
|
|
unsigned NumItem = 0;
|
|
|
|
|
int N;
|
2017-01-28 15:58:46 +01:00
|
|
|
|
int CodItem[1 + Syl_MAX_LEVELS_SYLLABUS]; // To make numeration
|
2014-12-01 23:55:08 +01:00
|
|
|
|
int Result;
|
|
|
|
|
unsigned NumItemsWithChildren = 0;
|
|
|
|
|
|
|
|
|
|
/* Path of the private directory for the XML file with the syllabus */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (Syllabus->PathDir,sizeof (Syllabus->PathDir),"%s/%ld/%s",
|
2019-03-20 01:36:36 +01:00
|
|
|
|
Cfg_PATH_CRS_PRIVATE,CrsCod,
|
2020-04-12 02:47:32 +02:00
|
|
|
|
Syllabus->WhichSyllabus == Syl_LECTURES ? Cfg_SYLLABUS_FOLDER_LECTURES :
|
|
|
|
|
Cfg_SYLLABUS_FOLDER_PRACTICALS);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Open the file with the syllabus *****/
|
2022-10-21 08:46:07 +02:00
|
|
|
|
Syl_OpenSyllabusFile (Syllabus,PathFile,&XML);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Go to the start of the list of items *****/
|
2022-10-21 08:46:07 +02:00
|
|
|
|
if (!Str_FindStrInFile (XML,"<lista>",Str_NO_SKIP_HTML_COMMENTS))
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongSyllabusFormatExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Save the position of the start of the list *****/
|
2022-10-21 08:46:07 +02:00
|
|
|
|
PostBeginList = ftell (XML);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Loop to count the number of items *****/
|
2020-02-24 19:31:55 +01:00
|
|
|
|
for (Syl_LstItemsSyllabus.NumItems = 0;
|
2022-10-21 08:46:07 +02:00
|
|
|
|
Str_FindStrInFile (XML,"<item",Str_NO_SKIP_HTML_COMMENTS);
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.NumItems++);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Allocate memory for the list of items *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((Syl_LstItemsSyllabus.Lst = calloc (Syl_LstItemsSyllabus.NumItems + 1,
|
|
|
|
|
sizeof (*Syl_LstItemsSyllabus.Lst))) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Return to the start of the list *****/
|
2022-10-21 08:46:07 +02:00
|
|
|
|
fseek (XML,PostBeginList,SEEK_SET);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-02-27 00:19:55 +01:00
|
|
|
|
for (N = 1;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
N <= Syl_MAX_LEVELS_SYLLABUS;
|
|
|
|
|
N++)
|
|
|
|
|
CodItem[N] = 0;
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.NumLevels = 1;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** If the syllabus is empty ==> initialize an item to be edited *****/
|
2020-02-24 19:31:55 +01:00
|
|
|
|
if (Syl_LstItemsSyllabus.NumItems == 0)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/* Level of the item */
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.Lst[0].Level = 1;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-02-27 23:44:21 +01:00
|
|
|
|
/* Code (numeration) of the item */
|
2014-12-01 23:55:08 +01:00
|
|
|
|
CodItem[1] = 1;
|
|
|
|
|
for (N = 1;
|
|
|
|
|
N <= Syl_MAX_LEVELS_SYLLABUS;
|
|
|
|
|
N++)
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.Lst[0].CodItem[N] = CodItem[N];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Text of the item */
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.Lst[0].Text[0] = '\0';
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Loop to read and store all items of the syllabus *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
for (NumItem = 0;
|
2020-02-24 19:31:55 +01:00
|
|
|
|
NumItem < Syl_LstItemsSyllabus.NumItems;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumItem++)
|
|
|
|
|
{
|
|
|
|
|
/* Go to the start of the item */
|
2022-10-21 08:46:07 +02:00
|
|
|
|
if (!Str_FindStrInFile (XML,"<item",Str_NO_SKIP_HTML_COMMENTS))
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongSyllabusFormatExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the level */
|
2022-10-21 08:46:07 +02:00
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].Level = Syl_ReadLevelItemSyllabus (XML);
|
2020-02-24 19:31:55 +01:00
|
|
|
|
if (Syl_LstItemsSyllabus.Lst[NumItem].Level > Syl_LstItemsSyllabus.NumLevels)
|
|
|
|
|
Syl_LstItemsSyllabus.NumLevels = Syl_LstItemsSyllabus.Lst[NumItem].Level;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Set the code (number) of the item */
|
2020-02-24 19:31:55 +01:00
|
|
|
|
CodItem[Syl_LstItemsSyllabus.Lst[NumItem].Level]++;
|
2021-10-24 18:16:12 +02:00
|
|
|
|
for (N = Syl_LstItemsSyllabus.Lst[NumItem].Level + 1;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
N <= Syl_MAX_LEVELS_SYLLABUS;
|
|
|
|
|
N++)
|
|
|
|
|
CodItem[N] = 0;
|
2021-10-24 18:16:12 +02:00
|
|
|
|
for (N = 1;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
N <= Syl_MAX_LEVELS_SYLLABUS;
|
|
|
|
|
N++)
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].CodItem[N] = CodItem[N];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the text of the item */
|
2022-10-21 08:46:07 +02:00
|
|
|
|
Result = Str_ReadFileUntilBoundaryStr (XML,Syl_LstItemsSyllabus.Lst[NumItem].Text,
|
2016-04-01 03:09:45 +02:00
|
|
|
|
"</item>",strlen ("</item>"),
|
|
|
|
|
(unsigned long long) Syl_MAX_BYTES_TEXT_ITEM);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (Result == 0) // Str too long
|
|
|
|
|
{
|
2022-10-21 08:46:07 +02:00
|
|
|
|
if (!Str_FindStrInFile (XML,"</item>",Str_NO_SKIP_HTML_COMMENTS)) // End the search
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongSyllabusFormatExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else if (Result == -1)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongSyllabusFormatExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Close the file with the syllabus *****/
|
2022-10-21 08:46:07 +02:00
|
|
|
|
Syl_CloseXMLFile (&XML);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Initialize other fields in the list *****/
|
2020-02-24 19:31:55 +01:00
|
|
|
|
if (Syl_LstItemsSyllabus.NumItems)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
for (NumItem = 0;
|
2020-02-24 19:31:55 +01:00
|
|
|
|
NumItem < Syl_LstItemsSyllabus.NumItems - 1;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumItem++)
|
2020-02-24 19:31:55 +01:00
|
|
|
|
if (Syl_LstItemsSyllabus.Lst[NumItem].Level < Syl_LstItemsSyllabus.Lst[NumItem + 1].Level)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].HasChildren = true;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumItemsWithChildren++;
|
|
|
|
|
}
|
|
|
|
|
else
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].HasChildren = false;
|
|
|
|
|
Syl_LstItemsSyllabus.Lst[Syl_LstItemsSyllabus.NumItems - 1].HasChildren = false;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2020-02-24 19:31:55 +01:00
|
|
|
|
Syl_LstItemsSyllabus.NumItemsWithChildren = NumItemsWithChildren;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Free list of items of a syllabus ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Syl_FreeListItemsSyllabus (void)
|
|
|
|
|
{
|
2020-02-24 19:31:55 +01:00
|
|
|
|
if (Syl_LstItemsSyllabus.Lst)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2020-02-24 19:31:55 +01:00
|
|
|
|
free (Syl_LstItemsSyllabus.Lst);
|
|
|
|
|
Syl_LstItemsSyllabus.Lst = NULL;
|
|
|
|
|
Syl_LstItemsSyllabus.NumItems = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************* Read the level of the current item in a syllabus **************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// XML file with the syllabus must be positioned after <item
|
|
|
|
|
// XML with the syllabus becomes positioned after <item nivel="x">
|
|
|
|
|
|
2022-10-21 08:46:07 +02:00
|
|
|
|
int Syl_ReadLevelItemSyllabus (FILE *XML)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
int Level;
|
2017-01-28 15:58:46 +01:00
|
|
|
|
char StrlLevel[11 + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2022-10-21 08:46:07 +02:00
|
|
|
|
if (!Str_FindStrInFile (XML,"nivel=\"",Str_NO_SKIP_HTML_COMMENTS))
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongSyllabusFormatExit ();
|
2022-10-21 08:46:07 +02:00
|
|
|
|
if (Str_ReadFileUntilBoundaryStr (XML,StrlLevel,"\"",1,
|
2017-01-28 15:58:46 +01:00
|
|
|
|
(unsigned long long) (11 + 1)) != 1)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongSyllabusFormatExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (sscanf (StrlLevel,"%d",&Level) != 1)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongSyllabusFormatExit ();
|
2022-10-21 08:46:07 +02:00
|
|
|
|
Str_FindStrInFile (XML,">",Str_NO_SKIP_HTML_COMMENTS);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (Level < 1)
|
|
|
|
|
Level = 1;
|
|
|
|
|
else if (Level > Syl_MAX_LEVELS_SYLLABUS)
|
|
|
|
|
Level = Syl_MAX_LEVELS_SYLLABUS;
|
|
|
|
|
return Level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Show a syllabus of lectures or practicals *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-10-24 18:16:12 +02:00
|
|
|
|
static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-09-10 23:24:23 +02:00
|
|
|
|
extern const char *Hlp_COURSE_Syllabus_edit;
|
2024-03-19 23:39:54 +01:00
|
|
|
|
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
|
2021-10-24 18:16:12 +02:00
|
|
|
|
extern const char *Txt_Done;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumItem;
|
2023-10-28 20:51:27 +02:00
|
|
|
|
int Col;
|
2023-10-29 12:32:08 +01:00
|
|
|
|
static int NumButtons[Vie_NUM_VIEW_TYPES] =
|
2023-10-28 20:51:27 +02:00
|
|
|
|
{
|
2023-10-29 12:32:08 +01:00
|
|
|
|
[Vie_VIEW] = 0,
|
|
|
|
|
[Vie_EDIT] = 5,
|
2023-10-28 20:51:27 +02:00
|
|
|
|
};
|
2024-03-20 09:39:04 +01:00
|
|
|
|
static Act_Action_t Inf_Actions[Inf_NUM_TYPES] =
|
2024-03-19 18:39:35 +01:00
|
|
|
|
{
|
2024-03-20 09:39:04 +01:00
|
|
|
|
[Inf_INFORMATION ] = ActSeeCrsInf,
|
2024-03-19 18:39:35 +01:00
|
|
|
|
[Inf_TEACHING_GUIDE] = ActSeeTchGui,
|
2024-03-20 00:50:44 +01:00
|
|
|
|
[Inf_LECTURES ] = ActSeeSyl,
|
|
|
|
|
[Inf_PRACTICALS ] = ActSeeSyl,
|
2024-03-19 18:39:35 +01:00
|
|
|
|
[Inf_BIBLIOGRAPHY ] = ActSeeBib,
|
|
|
|
|
[Inf_FAQ ] = ActSeeFAQ,
|
|
|
|
|
[Inf_LINKS ] = ActSeeCrsLnk,
|
|
|
|
|
[Inf_ASSESSMENT ] = ActSeeAss,
|
|
|
|
|
};
|
2024-03-20 00:50:44 +01:00
|
|
|
|
bool ShowRowInsertNewItem = (Gbl.Action.Act == ActInsIteSyl ||
|
|
|
|
|
Gbl.Action.Act == ActModIteSyl ||
|
|
|
|
|
Gbl.Action.Act == ActRgtIteSyl ||
|
|
|
|
|
Gbl.Action.Act == ActLftIteSyl);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2024-03-19 23:39:54 +01:00
|
|
|
|
/***** Begin table *****/
|
|
|
|
|
HTM_TABLE_BeginWide ();
|
|
|
|
|
|
|
|
|
|
/***** Set width of columns of the table *****/
|
|
|
|
|
HTM_Txt ("<colgroup>");
|
|
|
|
|
for (Col = 0;
|
|
|
|
|
Col < NumButtons[Syllabus->ViewType];
|
|
|
|
|
Col++)
|
|
|
|
|
HTM_Txt ("<col width=\"12\" />");
|
|
|
|
|
for (Col = 1;
|
|
|
|
|
Col <= Syl_LstItemsSyllabus.NumLevels;
|
|
|
|
|
Col++)
|
|
|
|
|
HTM_TxtF ("<col width=\"%d\" />",Col * Syl_WIDTH_NUM_SYLLABUS);
|
|
|
|
|
HTM_Txt ("<col width=\"*\" />");
|
|
|
|
|
HTM_Txt ("</colgroup>");
|
|
|
|
|
|
|
|
|
|
if (Syl_LstItemsSyllabus.NumItems)
|
|
|
|
|
/***** Loop writing all items of the syllabus *****/
|
|
|
|
|
for (NumItem = 0;
|
|
|
|
|
NumItem < Syl_LstItemsSyllabus.NumItems;
|
|
|
|
|
NumItem++)
|
|
|
|
|
{
|
|
|
|
|
Syl_ShowRowSyllabus (Syllabus,NumItem,
|
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].Level,
|
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].CodItem,
|
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].Text,false);
|
|
|
|
|
if (ShowRowInsertNewItem && NumItem == Syllabus->NumItem)
|
|
|
|
|
// Mostrar a new row where se puede insert a new item
|
|
|
|
|
Syl_ShowRowSyllabus (Syllabus,NumItem + 1,
|
|
|
|
|
Syl_LstItemsSyllabus.Lst[NumItem].Level,NULL,
|
|
|
|
|
"",true);
|
|
|
|
|
}
|
|
|
|
|
else if (Syllabus->ViewType == Vie_EDIT)
|
|
|
|
|
/***** If the syllabus is empty ==>
|
|
|
|
|
show form to add a iten to the end *****/
|
|
|
|
|
Syl_ShowRowSyllabus (Syllabus,0,
|
|
|
|
|
1,Syl_LstItemsSyllabus.Lst[0].CodItem,"",true);
|
2021-10-24 18:16:12 +02:00
|
|
|
|
|
2024-03-19 23:39:54 +01:00
|
|
|
|
/***** End table *****/
|
|
|
|
|
HTM_TABLE_End ();
|
|
|
|
|
|
|
|
|
|
/***** Button to view *****/
|
|
|
|
|
if (Syllabus->ViewType == Vie_EDIT)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (Inf_Actions[Gbl.Crs.Info.Type]);
|
|
|
|
|
Syl_PutParWhichSyllabus (&Syllabus->WhichSyllabus);
|
|
|
|
|
Btn_PutConfirmButton (Txt_Done);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******** Write a row (item) of a syllabus of lectures or practicals *********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 02:47:32 +02:00
|
|
|
|
static void Syl_ShowRowSyllabus (struct Syl_Syllabus *Syllabus,unsigned NumItem,
|
2015-10-22 14:49:48 +02:00
|
|
|
|
int Level,int *CodItem,const char *Text,bool NewItem)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2015-07-22 18:59:44 +02:00
|
|
|
|
extern const char *Txt_Movement_not_allowed;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static int LastLevel = 0;
|
2017-01-16 01:51:01 +01:00
|
|
|
|
char StrItemCod[Syl_MAX_LEVELS_SYLLABUS * (10 + 1)];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
struct MoveSubtrees Subtree;
|
|
|
|
|
|
|
|
|
|
Subtree.ToGetUp.Ini = Subtree.ToGetUp.End = 0;
|
|
|
|
|
Subtree.ToGetDown.Ini = Subtree.ToGetDown.End = 0;
|
|
|
|
|
Subtree.MovAllowed = false;
|
|
|
|
|
|
2023-03-10 00:13:55 +01:00
|
|
|
|
Syllabus->ParNumItem = NumItem; // Used as parameter in forms
|
2017-09-10 23:24:23 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (!NewItem) // If the item is new (not stored in file), it has no number
|
|
|
|
|
Syl_WriteNumItem (StrItemCod,NULL,Level,CodItem);
|
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Begin the row *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2023-10-29 12:32:08 +01:00
|
|
|
|
switch (Syllabus->ViewType)
|
2023-10-28 20:51:27 +02:00
|
|
|
|
{
|
2023-10-29 12:32:08 +01:00
|
|
|
|
case Vie_VIEW:
|
2023-10-28 20:51:27 +02:00
|
|
|
|
/***** Indent depending on the level *****/
|
|
|
|
|
if (Level > 1)
|
|
|
|
|
{
|
|
|
|
|
HTM_TD_Begin ("colspan=\"%d\" class=\"%s\"",
|
|
|
|
|
Level - 1,The_GetColorRows ());
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
}
|
2021-07-08 15:00:17 +02:00
|
|
|
|
|
2023-10-28 20:51:27 +02:00
|
|
|
|
/***** Code of the item *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"RT %s_%s %s\" style=\"width:%dpx;\"",
|
|
|
|
|
ClassSyllabus[Level],The_GetSuffix (),
|
2024-06-20 10:51:17 +02:00
|
|
|
|
The_GetColorRows (),Level * Syl_WIDTH_NUM_SYLLABUS);
|
2023-10-28 20:51:27 +02:00
|
|
|
|
if (Level == 1)
|
|
|
|
|
HTM_NBSP ();
|
|
|
|
|
HTM_TxtF ("%s ",StrItemCod);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
2023-10-28 20:51:27 +02:00
|
|
|
|
/***** 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);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TD_End ();
|
2023-10-28 20:51:27 +02:00
|
|
|
|
break;
|
2023-10-29 12:32:08 +01:00
|
|
|
|
case Vie_EDIT:
|
2023-10-28 20:51:27 +02:00
|
|
|
|
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
|
2024-03-20 00:50:44 +01:00
|
|
|
|
Ico_PutContextualIconToRemove (ActDelItmSyl,NULL,
|
2024-03-19 18:39:35 +01:00
|
|
|
|
Syl_PutParsSyllabus,Syllabus);
|
2023-10-28 20:51:27 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Icon to get up an item *****/
|
|
|
|
|
Syl_CalculateUpSubtreeSyllabus (&Subtree,NumItem);
|
|
|
|
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
|
|
|
|
if (Subtree.MovAllowed)
|
2024-03-20 00:50:44 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActUp_IteSyl,NULL,
|
2024-03-19 18:39:35 +01:00
|
|
|
|
Syl_PutParsSyllabus,Syllabus,
|
2023-10-28 20:51:27 +02:00
|
|
|
|
"arrow-up.svg",Ico_BLACK);
|
|
|
|
|
else
|
|
|
|
|
Ico_PutIconOff ("arrow-up.svg",Ico_BLACK,
|
|
|
|
|
Txt_Movement_not_allowed);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Icon to get down item *****/
|
|
|
|
|
Syl_CalculateDownSubtreeSyllabus (&Subtree,NumItem);
|
|
|
|
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
|
|
|
|
if (Subtree.MovAllowed)
|
2024-03-20 00:50:44 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActDwnIteSyl,NULL,
|
2024-03-19 18:39:35 +01:00
|
|
|
|
Syl_PutParsSyllabus,Syllabus,
|
2023-10-28 20:51:27 +02:00
|
|
|
|
"arrow-down.svg",Ico_BLACK);
|
|
|
|
|
else
|
|
|
|
|
Ico_PutIconOff ("arrow-down.svg",Ico_BLACK,
|
|
|
|
|
Txt_Movement_not_allowed);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Icon to increase the level of an item *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
|
|
|
|
if (Level > 1)
|
2024-03-20 00:50:44 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActRgtIteSyl,NULL,
|
2024-03-19 18:39:35 +01:00
|
|
|
|
Syl_PutParsSyllabus,Syllabus,
|
2023-10-28 20:51:27 +02:00
|
|
|
|
"arrow-left.svg",Ico_BLACK);
|
|
|
|
|
else
|
|
|
|
|
Ico_PutIconOff ("arrow-left.svg",Ico_BLACK,
|
|
|
|
|
Txt_Movement_not_allowed);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Icon to decrease level item *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ());
|
|
|
|
|
if (Level < LastLevel + 1 &&
|
|
|
|
|
Level < Syl_MAX_LEVELS_SYLLABUS)
|
2024-03-20 00:50:44 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActLftIteSyl,NULL,
|
2024-03-19 18:39:35 +01:00
|
|
|
|
Syl_PutParsSyllabus,Syllabus,
|
2023-10-28 20:51:27 +02:00
|
|
|
|
"arrow-right.svg",Ico_BLACK);
|
|
|
|
|
else
|
|
|
|
|
Ico_PutIconOff ("arrow-right.svg",Ico_BLACK,
|
|
|
|
|
Txt_Movement_not_allowed);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
LastLevel = Level;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2023-10-28 20:51:27 +02:00
|
|
|
|
Syl_PutFormItemSyllabus (Syllabus,NewItem,NumItem,Level,CodItem,Text);
|
|
|
|
|
break;
|
2023-10-29 12:32:08 +01:00
|
|
|
|
default:
|
|
|
|
|
Err_WrongTypeExit ();
|
|
|
|
|
break;
|
2023-10-28 20:51:27 +02:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** End of the row *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2022-03-24 01:18:19 +01:00
|
|
|
|
The_ChangeRowColor ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2014-12-21 14:47:04 +01:00
|
|
|
|
/************** Write the syllabus into a temporary HTML file ****************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|