Version 15.149

This commit is contained in:
Antonio Cañas Vargas 2016-03-17 10:39:23 +01:00
parent 8fa31b62cd
commit e8bb925363
7 changed files with 310 additions and 266 deletions

View File

@ -129,13 +129,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.148 (2016-03-17)" #define Log_PLATFORM_VERSION "SWAD 15.149 (2016-03-17)"
#define CSS_FILE "swad15.146.css" #define CSS_FILE "swad15.146.css"
#define JS_FILE "swad15.131.3.js" #define JS_FILE "swad15.131.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.149: Mar 17, 2016 Icon to edit course info integrated in frame.
Code refacgtoring related to course info. (195949 lines)
Version 15.148: Mar 17, 2016 Icon to see/edit file browser integrated in frame. (195914 lines) Version 15.148: Mar 17, 2016 Icon to see/edit file browser integrated in frame. (195914 lines)
Version 15.147.6: Mar 16, 2016 Icon to edit departments integrated in frame. (195862 lines) Version 15.147.6: Mar 16, 2016 Icon to edit departments integrated in frame. (195862 lines)
Version 15.147.5: Mar 16, 2016 Icon to edit institutional links integrated in frame. (195863 lines) Version 15.147.5: Mar 16, 2016 Icon to edit institutional links integrated in frame. (195863 lines)

View File

@ -436,6 +436,7 @@ struct Globals
} Grps; } Grps;
struct struct
{ {
Inf_InfoType_t Type;
struct struct
{ {
char URL[Cns_MAX_BYTES_URL+1]; // URL char URL[Cns_MAX_BYTES_URL+1]; // URL

File diff suppressed because it is too large Load Diff

View File

@ -68,33 +68,29 @@ typedef enum
/*****************************************************************************/ /*****************************************************************************/
void Inf_ShowInfo (void); void Inf_ShowInfo (void);
void Inf_PutIconToEditInfo (void);
void Inf_WriteMsgYouMustReadInfo (void); void Inf_WriteMsgYouMustReadInfo (void);
void Inf_ChangeForceReadInfo (void); void Inf_ChangeForceReadInfo (void);
void Inf_ChangeIHaveReadInfo (void); void Inf_ChangeIHaveReadInfo (void);
bool Inf_CheckIfIHaveReadInfo (Inf_InfoType_t InfoType);
bool Inf_GetIfIMustReadAnyCrsInfoInThisCrs (void); bool Inf_GetIfIMustReadAnyCrsInfoInThisCrs (void);
void Inf_RemoveUsrFromCrsInfoRead (long UsrCod,long CrsCod); void Inf_RemoveUsrFromCrsInfoRead (long UsrCod,long CrsCod);
int Inf_WritePageIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer); int Inf_WritePageIntoHTMLBuffer (char **HTMLBuffer);
void Inf_WriteURLIntoTxtBuffer (Inf_InfoType_t InfoType,char TxtBuffer[Cns_MAX_BYTES_URL+1]); void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_BYTES_URL+1]);
void Inf_SetInfoSrc (void); void Inf_SetInfoSrc (void);
void Inf_FormsToSelSendInfo (void); void Inf_FormsToSelSendInfo (void);
void Inf_FormToEnterIntegratedEditor (Inf_InfoSrc_t InfoSrc,Inf_InfoType_t InfoType); void Inf_FormToEnterIntegratedEditor (Inf_InfoSrc_t InfoSrc);
void Inf_FormToEnterPlainTextEditor (Inf_InfoSrc_t InfoSrc,Inf_InfoType_t InfoType); void Inf_FormToEnterPlainTextEditor (Inf_InfoSrc_t InfoSrc);
void Inf_FormToEnterRichTextEditor (Inf_InfoSrc_t InfoSrc,Inf_InfoType_t InfoType); void Inf_FormToEnterRichTextEditor (Inf_InfoSrc_t InfoSrc);
void Inf_FormToSendPage (Inf_InfoSrc_t InfoSrc,Inf_InfoType_t InfoType); void Inf_FormToSendPage (Inf_InfoSrc_t InfoSrc);
void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc,Inf_InfoType_t InfoType); void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc);
Inf_InfoType_t Inf_AsignInfoType (void);
Inf_InfoSrc_t Inf_GetInfoSrcFromForm (void); Inf_InfoSrc_t Inf_GetInfoSrcFromForm (void);
void Inf_SetInfoSrcIntoDB (long CrsCod,Inf_InfoType_t InfoType,Inf_InfoSrc_t InfoSrc); void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc);
void Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,Inf_InfoSrc_t *InfoSrc,bool *MustBeRead); void Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,
Inf_InfoSrc_t *InfoSrc,bool *MustBeRead);
Inf_InfoType_t Inf_ConvertFromStrDBToInfoType (const char *StrInfoTypeDB); Inf_InfoType_t Inf_ConvertFromStrDBToInfoType (const char *StrInfoTypeDB);
Inf_InfoSrc_t Inf_ConvertFromStrDBToInfoSrc (const char *StrInfoSrcDB); Inf_InfoSrc_t Inf_ConvertFromStrDBToInfoSrc (const char *StrInfoSrcDB);
void Inf_SetInfoTxtIntoDB (long CrsCod,Inf_InfoType_t InfoType, int Inf_WritePlainTextIntoHTMLBuffer (char **HTMLBuffer);
const char *InfoTxtHTML,const char *InfoTxtMD);
void Inf_GetInfoTxtFromDB (Inf_InfoType_t InfoType,
char *InfoTxtHTML,char *InfoTxtMD,size_t MaxLength);
bool Inf_CheckIfInfoTxtIsNotEmpty (long CrsCod,Inf_InfoType_t InfoType);
int Inf_WritePlainTextIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer);
void Inf_EditPlainTxtInfo (void); void Inf_EditPlainTxtInfo (void);
void Inf_EditRichTxtInfo (void); void Inf_EditRichTxtInfo (void);
void Inf_RecAndChangePlainTxtInfo (void); void Inf_RecAndChangePlainTxtInfo (void);

View File

@ -100,13 +100,13 @@ struct
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static Inf_InfoType_t Syl_SetSyllabusTypeAndLoadToMemory (void); static void Syl_SetSyllabusTypeAndLoadToMemory (void);
static void Syl_LoadToMemory (Inf_InfoType_t InfoType); static void Syl_LoadToMemory (void);
static void Syl_ShowSyllabus (Inf_InfoType_t InfoType); static void Syl_ShowSyllabus (void);
static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem, static void Syl_ShowRowSyllabus (unsigned NumItem,
int Level,int *CodItem,const char *Text,bool NewItem); int Level,int *CodItem,const char *Text,bool NewItem);
static void Syl_WriteSyllabusIntoHTMLTmpFile (Inf_InfoType_t InfoType,FILE *FileHTMLTmp); static void Syl_WriteSyllabusIntoHTMLTmpFile (FILE *FileHTMLTmp);
static void Syl_PutFormItemSyllabus (Inf_InfoType_t InfoType,bool NewItem,unsigned NumItem,int Level,int *CodItem,const char *Text); static void Syl_PutFormItemSyllabus (bool NewItem,unsigned NumItem,int Level,int *CodItem,const char *Text);
/*****************************************************************************/ /*****************************************************************************/
/******************** Get parameter to select a syllabus *********************/ /******************** Get parameter to select a syllabus *********************/
@ -185,10 +185,11 @@ void Syl_EditSyllabus (void)
extern const char *Txt_This_syllabus_has_been_edited_by_teachers_of_the_course_; extern const char *Txt_This_syllabus_has_been_edited_by_teachers_of_the_course_;
extern const char *Txt_The_syllabus_lectures_of_the_course_X_is_not_available; extern const char *Txt_The_syllabus_lectures_of_the_course_X_is_not_available;
extern const char *Txt_The_syllabus_practicals_of_the_course_X_is_not_available; extern const char *Txt_The_syllabus_practicals_of_the_course_X_is_not_available;
Inf_InfoType_t InfoType; bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
/***** Set syllabus type and load syllabus from XML file to memory *****/ /***** Set syllabus type and load syllabus from XML file to memory *****/
InfoType = Syl_SetSyllabusTypeAndLoadToMemory (); Syl_SetSyllabusTypeAndLoadToMemory ();
if (Gbl.Action.Act == ActEditorSylLec || if (Gbl.Action.Act == ActEditorSylLec ||
Gbl.Action.Act == ActEditorSylPra) Gbl.Action.Act == ActEditorSylPra)
@ -200,24 +201,28 @@ void Syl_EditSyllabus (void)
{ {
/***** Put link to view *****/ /***** Put link to view *****/
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Lay_PutContextualLink (Inf_ActionsSeeInfo[InfoType],NULL, Lay_PutContextualLink (Inf_ActionsSeeInfo[Gbl.CurrentCrs.Info.Type],NULL,
"eye-on64x64.png", "eye-on64x64.png",
Txt_View,Txt_View); Txt_View,Txt_View);
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
} }
/***** Start of table *****/ /***** Start of table *****/
Lay_StartRoundFrameTable (NULL,1,Txt_INFO_TITLE[InfoType]); Lay_StartRoundFrame (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type],
ICanEdit ? Inf_PutIconToEditInfo :
NULL);
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_1\">");
/***** Write the current syllabus *****/ /***** Write the current syllabus *****/
Syl_ShowSyllabus (InfoType); Syl_ShowSyllabus ();
/***** If the syllabus is empty ==> show form to add a iten to the end *****/ /***** If the syllabus is empty ==> show form to add a iten to the end *****/
if (Gbl.CurrentCrs.Syllabus.EditionIsActive && LstItemsSyllabus.NumItems == 0) if (Gbl.CurrentCrs.Syllabus.EditionIsActive && LstItemsSyllabus.NumItems == 0)
Syl_ShowRowSyllabus (InfoType,0,1,LstItemsSyllabus.Lst[0].CodItem,"",true); Syl_ShowRowSyllabus (0,1,LstItemsSyllabus.Lst[0].CodItem,"",true);
/***** End of table *****/ /***** End of table *****/
Lay_EndRoundFrameTable (); fprintf (Gbl.F.Out,"</table>");
Lay_EndRoundFrame ();
if (!Gbl.CurrentCrs.Syllabus.EditionIsActive) if (!Gbl.CurrentCrs.Syllabus.EditionIsActive)
fprintf (Gbl.F.Out,"<div class=\"DAT_SMALL CENTER_MIDDLE\">" fprintf (Gbl.F.Out,"<div class=\"DAT_SMALL CENTER_MIDDLE\">"
@ -227,7 +232,7 @@ void Syl_EditSyllabus (void)
else else
{ {
sprintf (Gbl.Message, sprintf (Gbl.Message,
InfoType == Inf_LECTURES ? Txt_The_syllabus_lectures_of_the_course_X_is_not_available : Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? Txt_The_syllabus_lectures_of_the_course_X_is_not_available :
Txt_The_syllabus_practicals_of_the_course_X_is_not_available, Txt_The_syllabus_practicals_of_the_course_X_is_not_available,
Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Crs.FullName);
Lay_ShowAlert (Lay_WARNING,Gbl.Message); Lay_ShowAlert (Lay_WARNING,Gbl.Message);
@ -238,15 +243,15 @@ void Syl_EditSyllabus (void)
/************* Set syllabus type depending on the current action *************/ /************* Set syllabus type depending on the current action *************/
/*****************************************************************************/ /*****************************************************************************/
static Inf_InfoType_t Syl_SetSyllabusTypeAndLoadToMemory (void) static void Syl_SetSyllabusTypeAndLoadToMemory (void)
{ {
Inf_InfoType_t InfoType = Inf_LECTURES; // Initialized to avoid warning Gbl.CurrentCrs.Info.Type = Inf_LECTURES;
/***** Set the type of syllabus (lectures or practicals) *****/ /***** Set the type of syllabus (lectures or practicals) *****/
switch (Gbl.Action.Act) switch (Gbl.Action.Act)
{ {
case ActSeeSyl: case ActSeeSyl:
InfoType = (Gbl.CurrentCrs.Syllabus.WhichSyllabus == Syl_LECTURES ? Inf_LECTURES : Gbl.CurrentCrs.Info.Type = (Gbl.CurrentCrs.Syllabus.WhichSyllabus == Syl_LECTURES ? Inf_LECTURES :
Inf_PRACTICALS); Inf_PRACTICALS);
break; break;
case ActSeeSylLec: case ActSeeSylLec:
@ -269,7 +274,7 @@ static Inf_InfoType_t Syl_SetSyllabusTypeAndLoadToMemory (void)
case ActRcvPlaTxtSylLec: case ActRcvPlaTxtSylLec:
case ActRcvRchTxtSylLec: case ActRcvRchTxtSylLec:
Gbl.CurrentCrs.Syllabus.WhichSyllabus = Syl_LECTURES; Gbl.CurrentCrs.Syllabus.WhichSyllabus = Syl_LECTURES;
InfoType = Inf_LECTURES; Gbl.CurrentCrs.Info.Type = Inf_LECTURES;
break; break;
case ActSeeSylPra: case ActSeeSylPra:
case ActEdiSylPra: case ActEdiSylPra:
@ -291,7 +296,7 @@ static Inf_InfoType_t Syl_SetSyllabusTypeAndLoadToMemory (void)
case ActRcvPlaTxtSylPra: case ActRcvPlaTxtSylPra:
case ActRcvRchTxtSylPra: case ActRcvRchTxtSylPra:
Gbl.CurrentCrs.Syllabus.WhichSyllabus = Syl_PRACTICALS; Gbl.CurrentCrs.Syllabus.WhichSyllabus = Syl_PRACTICALS;
InfoType = Inf_PRACTICALS; Gbl.CurrentCrs.Info.Type = Inf_PRACTICALS;
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong action."); Lay_ShowErrorAndExit ("Wrong action.");
@ -300,20 +305,17 @@ static Inf_InfoType_t Syl_SetSyllabusTypeAndLoadToMemory (void)
/***** We are editing a syllabus with the internal editor, /***** We are editing a syllabus with the internal editor,
so change info source to internal editor in database *****/ so change info source to internal editor in database *****/
Inf_SetInfoSrcIntoDB (Gbl.CurrentCrs.Crs.CrsCod, Inf_SetInfoSrcIntoDB (Inf_INFO_SRC_EDITOR);
InfoType,Inf_INFO_SRC_EDITOR);
/***** Load syllabus from XML file to memory *****/ /***** Load syllabus from XML file to memory *****/
Syl_LoadToMemory (InfoType); Syl_LoadToMemory ();
return InfoType;
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Read from XML and load in memory a syllabus of lectures or practicals ***/ /*** Read from XML and load in memory a syllabus of lectures or practicals ***/
/*****************************************************************************/ /*****************************************************************************/
static void Syl_LoadToMemory (Inf_InfoType_t InfoType) static void Syl_LoadToMemory (void)
{ {
char PathFile[PATH_MAX+1]; char PathFile[PATH_MAX+1];
long PostBeginList; long PostBeginList;
@ -326,7 +328,7 @@ static void Syl_LoadToMemory (Inf_InfoType_t InfoType)
/* Path of the private directory for the XML file with the syllabus */ /* Path of the private directory for the XML file with the syllabus */
sprintf (Gbl.CurrentCrs.Syllabus.PathDir,"%s/%s", sprintf (Gbl.CurrentCrs.Syllabus.PathDir,"%s/%s",
Gbl.CurrentCrs.PathPriv, Gbl.CurrentCrs.PathPriv,
InfoType == Inf_LECTURES ? Cfg_SYLLABUS_FOLDER_LECTURES : Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? Cfg_SYLLABUS_FOLDER_LECTURES :
Cfg_SYLLABUS_FOLDER_PRACTICALS); Cfg_SYLLABUS_FOLDER_PRACTICALS);
/***** Open the file with the syllabus *****/ /***** Open the file with the syllabus *****/
@ -477,7 +479,7 @@ int Syl_ReadLevelItemSyllabus (void)
/***************** Show a syllabus of lectures or practicals *****************/ /***************** Show a syllabus of lectures or practicals *****************/
/*****************************************************************************/ /*****************************************************************************/
static void Syl_ShowSyllabus (Inf_InfoType_t InfoType) static void Syl_ShowSyllabus (void)
{ {
unsigned NumItem; unsigned NumItem;
int i; int i;
@ -507,13 +509,13 @@ static void Syl_ShowSyllabus (Inf_InfoType_t InfoType)
NumItem < LstItemsSyllabus.NumItems; NumItem < LstItemsSyllabus.NumItems;
NumItem++) NumItem++)
{ {
Syl_ShowRowSyllabus (InfoType,NumItem, Syl_ShowRowSyllabus (NumItem,
LstItemsSyllabus.Lst[NumItem].Level, LstItemsSyllabus.Lst[NumItem].Level,
LstItemsSyllabus.Lst[NumItem].CodItem, LstItemsSyllabus.Lst[NumItem].CodItem,
LstItemsSyllabus.Lst[NumItem].Text,false); LstItemsSyllabus.Lst[NumItem].Text,false);
if (ShowRowInsertNewItem && NumItem == Gbl.CurrentCrs.Syllabus.NumItem) if (ShowRowInsertNewItem && NumItem == Gbl.CurrentCrs.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 (InfoType,NumItem + 1, Syl_ShowRowSyllabus (NumItem + 1,
LstItemsSyllabus.Lst[NumItem].Level,NULL, LstItemsSyllabus.Lst[NumItem].Level,NULL,
"",true); "",true);
} }
@ -523,7 +525,7 @@ static void Syl_ShowSyllabus (Inf_InfoType_t InfoType)
/******** Write a row (item) of a syllabus of lectures or practicals *********/ /******** Write a row (item) of a syllabus of lectures or practicals *********/
/*****************************************************************************/ /*****************************************************************************/
static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem, static void Syl_ShowRowSyllabus (unsigned NumItem,
int Level,int *CodItem,const char *Text,bool NewItem) int Level,int *CodItem,const char *Text,bool NewItem)
{ {
extern const char *Txt_Move_up_X_and_its_subsections; extern const char *Txt_Move_up_X_and_its_subsections;
@ -561,7 +563,7 @@ static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem,
Lay_PutIconRemovalNotAllowed (); Lay_PutIconRemovalNotAllowed ();
else else
{ {
Act_FormStart (InfoType == Inf_LECTURES ? ActDelItmSylLec : Act_FormStart (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActDelItmSylLec :
ActDelItmSylPra); ActDelItmSylPra);
Syl_PutParamNumItem (NumItem); Syl_PutParamNumItem (NumItem);
Lay_PutIconRemove (); Lay_PutIconRemove ();
@ -574,7 +576,7 @@ static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem,
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
if (Subtree.MovAllowed) if (Subtree.MovAllowed)
{ {
Act_FormStart (InfoType == Inf_LECTURES ? ActUp_IteSylLec : Act_FormStart (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActUp_IteSylLec :
ActUp_IteSylPra); ActUp_IteSylPra);
Syl_PutParamNumItem (NumItem); Syl_PutParamNumItem (NumItem);
sprintf (Gbl.Title, sprintf (Gbl.Title,
@ -603,7 +605,7 @@ static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem,
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
if (Subtree.MovAllowed) if (Subtree.MovAllowed)
{ {
Act_FormStart (InfoType == Inf_LECTURES ? ActDwnIteSylLec : Act_FormStart (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActDwnIteSylLec :
ActDwnIteSylPra); ActDwnIteSylPra);
Syl_PutParamNumItem (NumItem); Syl_PutParamNumItem (NumItem);
sprintf (Gbl.Title, sprintf (Gbl.Title,
@ -632,7 +634,7 @@ static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem,
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
if (Level > 1) if (Level > 1)
{ {
Act_FormStart (InfoType == Inf_LECTURES ? ActRgtIteSylLec : Act_FormStart (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActRgtIteSylLec :
ActRgtIteSylPra); ActRgtIteSylPra);
Syl_PutParamNumItem (NumItem); Syl_PutParamNumItem (NumItem);
sprintf (Gbl.Title,Txt_Increase_level_of_X, sprintf (Gbl.Title,Txt_Increase_level_of_X,
@ -660,7 +662,7 @@ static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem,
if (Level < LastLevel + 1 && if (Level < LastLevel + 1 &&
Level < Syl_MAX_LEVELS_SYLLABUS) Level < Syl_MAX_LEVELS_SYLLABUS)
{ {
Act_FormStart (InfoType == Inf_LECTURES ? ActLftIteSylLec : Act_FormStart (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActLftIteSylLec :
ActLftIteSylPra); ActLftIteSylPra);
Syl_PutParamNumItem (NumItem); Syl_PutParamNumItem (NumItem);
sprintf (Gbl.Title,Txt_Decrease_level_of_X, sprintf (Gbl.Title,Txt_Decrease_level_of_X,
@ -688,7 +690,7 @@ static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem,
} }
if (Gbl.CurrentCrs.Syllabus.EditionIsActive) if (Gbl.CurrentCrs.Syllabus.EditionIsActive)
Syl_PutFormItemSyllabus (InfoType,NewItem,NumItem,Level,CodItem,Text); Syl_PutFormItemSyllabus (NewItem,NumItem,Level,CodItem,Text);
else else
{ {
/***** Indent depending on the level *****/ /***** Indent depending on the level *****/
@ -727,7 +729,7 @@ static void Syl_ShowRowSyllabus (Inf_InfoType_t InfoType,unsigned NumItem,
/*****************************************************************************/ /*****************************************************************************/
// This function is called only from web service // This function is called only from web service
int Syl_WriteSyllabusIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer) int Syl_WriteSyllabusIntoHTMLBuffer (char **HTMLBuffer)
{ {
char FileNameHTMLTmp[PATH_MAX+1]; char FileNameHTMLTmp[PATH_MAX+1];
FILE *FileHTMLTmp; FILE *FileHTMLTmp;
@ -737,7 +739,7 @@ int Syl_WriteSyllabusIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer)
*HTMLBuffer = NULL; *HTMLBuffer = NULL;
/***** Load syllabus from XML file to list of items in memory *****/ /***** Load syllabus from XML file to list of items in memory *****/
Syl_LoadToMemory (InfoType); Syl_LoadToMemory ();
if (LstItemsSyllabus.NumItems) if (LstItemsSyllabus.NumItems)
{ {
@ -755,7 +757,7 @@ int Syl_WriteSyllabusIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer)
} }
/***** Write syllabus in HTML into a temporary file *****/ /***** Write syllabus in HTML into a temporary file *****/
Syl_WriteSyllabusIntoHTMLTmpFile (InfoType,FileHTMLTmp); Syl_WriteSyllabusIntoHTMLTmpFile (FileHTMLTmp);
/***** Write syllabus from list of items in memory to text buffer *****/ /***** Write syllabus from list of items in memory to text buffer *****/
/* Compute length of file */ /* Compute length of file */
@ -800,7 +802,7 @@ int Syl_WriteSyllabusIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer)
/************** Write the syllabus into a temporary HTML file ****************/ /************** Write the syllabus into a temporary HTML file ****************/
/*****************************************************************************/ /*****************************************************************************/
static void Syl_WriteSyllabusIntoHTMLTmpFile (Inf_InfoType_t InfoType,FILE *FileHTMLTmp) static void Syl_WriteSyllabusIntoHTMLTmpFile (FILE *FileHTMLTmp)
{ {
extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES];
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES]; extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
@ -817,7 +819,7 @@ static void Syl_WriteSyllabusIntoHTMLTmpFile (Inf_InfoType_t InfoType,FILE *File
"<body>\n" "<body>\n"
"<table>\n", "<table>\n",
Txt_STR_LANG_ID[Gbl.Prefs.Language], // Language Txt_STR_LANG_ID[Gbl.Prefs.Language], // Language
Txt_INFO_TITLE[InfoType]); // Page title Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type]); // Page title
/***** Set width of columns of the table *****/ /***** Set width of columns of the table *****/
fprintf (FileHTMLTmp,"<colgroup>\n"); fprintf (FileHTMLTmp,"<colgroup>\n");
@ -874,7 +876,7 @@ static void Syl_WriteSyllabusIntoHTMLTmpFile (Inf_InfoType_t InfoType,FILE *File
/*************** Show a form to modify an item of the syllabus ***************/ /*************** Show a form to modify an item of the syllabus ***************/
/*****************************************************************************/ /*****************************************************************************/
static void Syl_PutFormItemSyllabus (Inf_InfoType_t InfoType,bool NewItem,unsigned NumItem,int Level,int *CodItem,const char *Text) static void Syl_PutFormItemSyllabus (bool NewItem,unsigned NumItem,int Level,int *CodItem,const char *Text)
{ {
extern const char *Txt_Enter_a_new_item_here; extern const char *Txt_Enter_a_new_item_here;
@ -907,9 +909,9 @@ static void Syl_PutFormItemSyllabus (Inf_InfoType_t InfoType,bool NewItem,unsign
/***** Text of the item *****/ /***** Text of the item *****/
fprintf (Gbl.F.Out,"<td colspan=\"%d\" class=\"LEFT_MIDDLE COLOR%u\">", fprintf (Gbl.F.Out,"<td colspan=\"%d\" class=\"LEFT_MIDDLE COLOR%u\">",
LstItemsSyllabus.NumLevels - Level + 1,Gbl.RowEvenOdd); LstItemsSyllabus.NumLevels - Level + 1,Gbl.RowEvenOdd);
Act_FormStart (NewItem ? (InfoType == Inf_LECTURES ? ActInsIteSylLec : Act_FormStart (NewItem ? (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActInsIteSylLec :
ActInsIteSylPra) : ActInsIteSylPra) :
(InfoType == Inf_LECTURES ? ActModIteSylLec : (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActModIteSylLec :
ActModIteSylPra)); ActModIteSylPra));
Syl_PutParamNumItem (NumItem); Syl_PutParamNumItem (NumItem);
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Txt\"" fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Txt\""
@ -969,7 +971,9 @@ void Syl_WriteNumItem (char *StrDst,FILE *FileTgt,int Level,int *CodItem)
void Syl_RemoveItemSyllabus (void) void Syl_RemoveItemSyllabus (void)
{ {
char PathFile[PATH_MAX+1],PathOldFile[PATH_MAX+1],PathNewFile[PATH_MAX+1]; char PathFile[PATH_MAX+1];
char PathOldFile[PATH_MAX+1];
char PathNewFile[PATH_MAX+1];
FILE *NewFile; FILE *NewFile;
unsigned NumItem; unsigned NumItem;
@ -1026,7 +1030,9 @@ void Syl_DownItemSyllabus (void)
void Syl_ChangePlaceItemSyllabus (Syl_ChangePosItem_t UpOrDownPos) void Syl_ChangePlaceItemSyllabus (Syl_ChangePosItem_t UpOrDownPos)
{ {
char PathFile[PATH_MAX+1],PathOldFile[PATH_MAX+1],PathNewFile[PATH_MAX+1]; char PathFile[PATH_MAX+1];
char PathOldFile[PATH_MAX+1];
char PathNewFile[PATH_MAX+1];
FILE *NewFile; FILE *NewFile;
unsigned NumItem; unsigned NumItem;
struct MoveSubtrees Subtree; struct MoveSubtrees Subtree;
@ -1208,7 +1214,9 @@ void Syl_LeftItemSyllabus (void)
void Syl_ChangeLevelItemSyllabus (Syl_ChangeLevelItem_t IncreaseOrDecreaseLevel) void Syl_ChangeLevelItemSyllabus (Syl_ChangeLevelItem_t IncreaseOrDecreaseLevel)
{ {
char PathFile[PATH_MAX+1],PathOldFile[PATH_MAX+1],PathNewFile[PATH_MAX+1]; char PathFile[PATH_MAX+1];
char PathOldFile[PATH_MAX+1];
char PathNewFile[PATH_MAX+1];
FILE *NewFile; FILE *NewFile;
/***** Load syllabus from XML file to memory *****/ /***** Load syllabus from XML file to memory *****/
@ -1255,7 +1263,9 @@ void Syl_ChangeLevelItemSyllabus (Syl_ChangeLevelItem_t IncreaseOrDecreaseLevel)
void Syl_InsertItemSyllabus (void) void Syl_InsertItemSyllabus (void)
{ {
char PathFile[PATH_MAX+1],PathOldFile[PATH_MAX+1],PathNewFile[PATH_MAX+1]; char PathFile[PATH_MAX+1];
char PathOldFile[PATH_MAX+1];
char PathNewFile[PATH_MAX+1];
FILE *NewFile; FILE *NewFile;
unsigned NumItem; unsigned NumItem;
char Txt[Syl_MAX_BYTES_TEXT_ITEM+1]; char Txt[Syl_MAX_BYTES_TEXT_ITEM+1];
@ -1312,7 +1322,9 @@ void Syl_InsertItemSyllabus (void)
void Syl_ModifyItemSyllabus (void) void Syl_ModifyItemSyllabus (void)
{ {
char PathFile[PATH_MAX+1],PathOldFile[PATH_MAX+1],PathNewFile[PATH_MAX+1]; char PathFile[PATH_MAX+1];
char PathOldFile[PATH_MAX+1];
char PathNewFile[PATH_MAX+1];
FILE *NewFile; FILE *NewFile;
/***** Load syllabus from XML file to memory *****/ /***** Load syllabus from XML file to memory *****/

View File

@ -72,7 +72,7 @@ void Syl_GetParamItemNumber (void);
void Syl_EditSyllabus (void); void Syl_EditSyllabus (void);
void Syl_FreeListItemsSyllabus (void); void Syl_FreeListItemsSyllabus (void);
int Syl_ReadLevelItemSyllabus (void); int Syl_ReadLevelItemSyllabus (void);
int Syl_WriteSyllabusIntoHTMLBuffer (Inf_InfoType_t InfoType,char **HTMLBuffer); int Syl_WriteSyllabusIntoHTMLBuffer (char **HTMLBuffer);
void Syl_PutParamNumItem (unsigned NumItem); void Syl_PutParamNumItem (unsigned NumItem);
void Syl_WriteNumItem (char *StrDst,FILE *FileTgt,int Level,int *CodItem); void Syl_WriteNumItem (char *StrDst,FILE *FileTgt,int Level,int *CodItem);
void Syl_RemoveItemSyllabus (void); void Syl_RemoveItemSyllabus (void);

View File

@ -1287,7 +1287,8 @@ int swad__getCourseInfo (struct soap *soap,
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Bad info type", "Bad info type",
"Unknown requested info type"); "Unknown requested info type");
Inf_GetInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,InfoType,&InfoSrc,&MustBeRead); Gbl.CurrentCrs.Info.Type = InfoType;
Inf_GetInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,&InfoSrc,&MustBeRead);
getCourseInfo->infoSrc = (char *) soap_malloc (Gbl.soap,strlen (NamesInWSForInfoSrc[InfoSrc]) + 1); getCourseInfo->infoSrc = (char *) soap_malloc (Gbl.soap,strlen (NamesInWSForInfoSrc[InfoSrc]) + 1);
strcpy (getCourseInfo->infoSrc,NamesInWSForInfoSrc[InfoSrc]); strcpy (getCourseInfo->infoSrc,NamesInWSForInfoSrc[InfoSrc]);
@ -1301,11 +1302,11 @@ int swad__getCourseInfo (struct soap *soap,
case Inf_INFO_SRC_NONE: // No info available case Inf_INFO_SRC_NONE: // No info available
break; break;
case Inf_INFO_SRC_EDITOR: // Internal editor (only for syllabus) case Inf_INFO_SRC_EDITOR: // Internal editor (only for syllabus)
switch (InfoType) switch (Gbl.CurrentCrs.Info.Type)
{ {
case Inf_LECTURES: // Syllabus (lectures) case Inf_LECTURES: // Syllabus (lectures)
case Inf_PRACTICALS: // Syllabys (practicals) case Inf_PRACTICALS: // Syllabys (practicals)
Result = Syl_WriteSyllabusIntoHTMLBuffer (InfoType,&(getCourseInfo->infoTxt)); Result = Syl_WriteSyllabusIntoHTMLBuffer (&(getCourseInfo->infoTxt));
break; break;
default: default:
break; break;
@ -1313,14 +1314,14 @@ int swad__getCourseInfo (struct soap *soap,
break; break;
case Inf_INFO_SRC_PLAIN_TEXT: // Plain text case Inf_INFO_SRC_PLAIN_TEXT: // Plain text
case Inf_INFO_SRC_RICH_TEXT: // Rich text (not yet available) case Inf_INFO_SRC_RICH_TEXT: // Rich text (not yet available)
Result = Inf_WritePlainTextIntoHTMLBuffer (InfoType,&(getCourseInfo->infoTxt)); Result = Inf_WritePlainTextIntoHTMLBuffer (&(getCourseInfo->infoTxt));
break; break;
case Inf_INFO_SRC_PAGE: // Web page hosted in SWAD server case Inf_INFO_SRC_PAGE: // Web page hosted in SWAD server
Result = Inf_WritePageIntoHTMLBuffer (InfoType,&(getCourseInfo->infoTxt)); Result = Inf_WritePageIntoHTMLBuffer (&(getCourseInfo->infoTxt));
break; break;
case Inf_INFO_SRC_URL: // Link to a web page case Inf_INFO_SRC_URL: // Link to a web page
getCourseInfo->infoTxt = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_URL+1); getCourseInfo->infoTxt = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_URL+1);
Inf_WriteURLIntoTxtBuffer (InfoType,getCourseInfo->infoTxt); Inf_WriteURLIntoTxtBuffer (getCourseInfo->infoTxt);
break; break;
} }