Version20.30

This commit is contained in:
acanas 2021-02-11 23:27:48 +01:00
parent 97a99ecbee
commit a436a97d82
13 changed files with 268 additions and 295 deletions

View File

@ -3336,10 +3336,7 @@ int swad__getNotifications (struct soap *soap,
Ntf_NotifyEvent_t NotifyEvent;
long EventTime;
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
long Cod;
struct For_Forum ForumSelected;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
@ -3424,13 +3421,13 @@ int swad__getNotifications (struct soap *soap,
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventTime = EventTime;
/* Get course (row[7]) */
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[7]);
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[7]);
Crs_GetDataOfCourseByCod (&Hie.Crs);
/* Get user's code of the user who caused the event (row[3]) */
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[3]);
if (API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Crs.CrsCod)) // Get some user's data from database
if (API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Hie.Crs.CrsCod)) // Get some user's data from database
{
getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname =
(char *) soap_malloc (soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
@ -3473,16 +3470,16 @@ int swad__getNotifications (struct soap *soap,
}
/* Get institution (row[4]) */
Ins.InsCod = Str_ConvertStrCodToLongCod (row[4]);
Ins_GetDataOfInstitutionByCod (&Ins);
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[4]);
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
/* Get centre (row[5]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[5]);
Ctr_GetDataOfCentreByCod (&Ctr);
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[5]);
Ctr_GetDataOfCentreByCod (&Hie.Ctr);
/* Get degree (row[6]) */
Deg.DegCod = Str_ConvertStrCodToLongCod (row[6]);
Deg_GetDataOfDegreeByCod (&Deg);
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[6]);
Deg_GetDataOfDegreeByCod (&Hie.Deg);
/* Get message/post/... code (row[8]) */
Cod = Str_ConvertStrCodToLongCod (row[8]);
@ -3501,18 +3498,18 @@ int swad__getNotifications (struct soap *soap,
sprintf (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"%s: %s",
Txt_Forum,ForumName);
}
else if (Crs.CrsCod > 0)
else if (Hie.Crs.CrsCod > 0)
sprintf (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"%s: %s",
Txt_Course,Crs.ShrtName);
else if (Deg.DegCod > 0)
Txt_Course,Hie.Crs.ShrtName);
else if (Hie.Deg.DegCod > 0)
sprintf (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"%s: %s",
Txt_Degree,Deg.ShrtName);
else if (Ctr.CtrCod > 0)
Txt_Degree,Hie.Deg.ShrtName);
else if (Hie.Ctr.CtrCod > 0)
sprintf (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"%s: %s",
Txt_Centre,Ctr.ShrtName);
else if (Ins.InsCod > 0)
Txt_Centre,Hie.Ctr.ShrtName);
else if (Hie.Ins.InsCod > 0)
sprintf (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"%s: %s",
Txt_Institution,Ins.ShrtName);
Txt_Institution,Hie.Ins.ShrtName);
else
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"-",
Ntf_MAX_BYTES_NOTIFY_LOCATION);
@ -3525,7 +3522,7 @@ int swad__getNotifications (struct soap *soap,
/* Get summary and content */
ContentStr = NULL;
Ntf_GetNotifSummaryAndContent (SummaryStr,&ContentStr,NotifyEvent,
Cod,Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
Cod,Hie.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
true);
Length = strlen (SummaryStr);

View File

@ -601,7 +601,7 @@ TODO: DNI de un estudiante sale err
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
TODO: Salvador Romero Cortés: @acanas opción para editar posts
Version 20.30: Feb 11, 2021 Code refactoring in hierarchy. (? lines)
Version 20.30: Feb 11, 2021 Code refactoring in hierarchy. (305853 lines)
Version 20.29.3: Feb 11, 2021 Code refactoring in timeline. (305826 lines)
Version 20.29.2: Feb 11, 2021 Code refactoring in timeline. (305806 lines)
Version 20.29.1: Feb 11, 2021 Code refactoring in timeline. (305780 lines)

View File

@ -155,11 +155,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
extern const char *The_ClassFormLinkInBoxBold[The_NUM_THEMES];
extern const char *Txt_My_courses;
extern const char *Txt_System;
struct Cty_Countr Cty;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
bool IsLastItemInLevel[1 + 5];
bool Highlight; // Highlight because degree, course, etc. is selected
MYSQL_RES *mysql_resCty;
@ -218,32 +214,32 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
row = mysql_fetch_row (mysql_resCty);
/***** Get data of this institution *****/
Cty.CtyCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Cty_GetDataOfCountryByCod (&Cty))
Hie.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Cty_GetDataOfCountryByCod (&Hie.Cty))
Lay_ShowErrorAndExit ("Country not found.");
/***** Write link to country *****/
Highlight = (Gbl.Hierarchy.Ins.InsCod <= 0 &&
Gbl.Hierarchy.Cty.CtyCod == Cty.CtyCod);
Gbl.Hierarchy.Cty.CtyCod == Hie.Cty.CtyCod);
HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight :
ClassNormal);
IsLastItemInLevel[1] = (NumCty == NumCtys - 1);
Lay_IndentDependingOnLevel (1,IsLastItemInLevel);
Frm_StartForm (ActMyCrs);
Cty_PutParamCtyCod (Cty.CtyCod);
Cty_PutParamCtyCod (Hie.Cty.CtyCod);
HTM_BUTTON_SUBMIT_Begin (Act_GetActionText (ActSeeCtyInf),
Highlight ? ClassHighlight :
ClassNormal,
NULL);
Cty_DrawCountryMap (&Cty,"ICO16x16");
HTM_TxtF ("&nbsp;%s",Cty.Name[Gbl.Prefs.Language]);
Cty_DrawCountryMap (&Hie.Cty,"ICO16x16");
HTM_TxtF ("&nbsp;%s",Hie.Cty.Name[Gbl.Prefs.Language]);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my institutions in this country *****/
NumInss = (unsigned) Usr_GetInssFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,
Cty.CtyCod,&mysql_resIns);
Hie.Cty.CtyCod,&mysql_resIns);
for (NumIns = 0;
NumIns < NumInss;
NumIns++)
@ -252,32 +248,32 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
row = mysql_fetch_row (mysql_resIns);
/***** Get data of this institution *****/
Ins.InsCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Ins_GetDataOfInstitutionByCod (&Ins))
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
Lay_ShowErrorAndExit ("Institution not found.");
/***** Write link to institution *****/
Highlight = (Gbl.Hierarchy.Ctr.CtrCod <= 0 &&
Gbl.Hierarchy.Ins.InsCod == Ins.InsCod);
Gbl.Hierarchy.Ins.InsCod == Hie.Ins.InsCod);
HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight :
ClassNormal);
IsLastItemInLevel[2] = (NumIns == NumInss - 1);
Lay_IndentDependingOnLevel (2,IsLastItemInLevel);
Frm_StartForm (ActMyCrs);
Ins_PutParamInsCod (Ins.InsCod);
Ins_PutParamInsCod (Hie.Ins.InsCod);
HTM_BUTTON_SUBMIT_Begin (Act_GetActionText (ActSeeInsInf),
Highlight ? ClassHighlight :
ClassNormal,
NULL);
Lgo_DrawLogo (Hie_Lvl_INS,Ins.InsCod,Ins.ShrtName,16,NULL,true);
HTM_TxtF ("&nbsp;%s",Ins.ShrtName);
Lgo_DrawLogo (Hie_Lvl_INS,Hie.Ins.InsCod,Hie.Ins.ShrtName,16,NULL,true);
HTM_TxtF ("&nbsp;%s",Hie.Ins.ShrtName);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my centres in this institution *****/
NumCtrs = (unsigned) Usr_GetCtrsFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,
Ins.InsCod,&mysql_resCtr);
Hie.Ins.InsCod,&mysql_resCtr);
for (NumCtr = 0;
NumCtr < NumCtrs;
NumCtr++)
@ -286,32 +282,32 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
row = mysql_fetch_row (mysql_resCtr);
/***** Get data of this centre *****/
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Ctr_GetDataOfCentreByCod (&Ctr))
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Ctr_GetDataOfCentreByCod (&Hie.Ctr))
Lay_ShowErrorAndExit ("Centre not found.");
/***** Write link to centre *****/
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_CTR &&
Gbl.Hierarchy.Ctr.CtrCod == Ctr.CtrCod);
Gbl.Hierarchy.Ctr.CtrCod == Hie.Ctr.CtrCod);
HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight :
ClassNormal);
IsLastItemInLevel[3] = (NumCtr == NumCtrs - 1);
Lay_IndentDependingOnLevel (3,IsLastItemInLevel);
Frm_StartForm (ActMyCrs);
Ctr_PutParamCtrCod (Ctr.CtrCod);
Ctr_PutParamCtrCod (Hie.Ctr.CtrCod);
HTM_BUTTON_SUBMIT_Begin (Act_GetActionText (ActSeeCtrInf),
Highlight ? ClassHighlight :
ClassNormal,
NULL);
Lgo_DrawLogo (Hie_Lvl_CTR,Ctr.CtrCod,Ctr.ShrtName,16,NULL,true);
HTM_TxtF ("&nbsp;%s",Ctr.ShrtName);
Lgo_DrawLogo (Hie_Lvl_CTR,Hie.Ctr.CtrCod,Hie.Ctr.ShrtName,16,NULL,true);
HTM_TxtF ("&nbsp;%s",Hie.Ctr.ShrtName);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my degrees in this centre *****/
NumDegs = (unsigned) Usr_GetDegsFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,
Ctr.CtrCod,&mysql_resDeg);
Hie.Ctr.CtrCod,&mysql_resDeg);
for (NumDeg = 0;
NumDeg < NumDegs;
NumDeg++)
@ -320,32 +316,32 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
row = mysql_fetch_row (mysql_resDeg);
/***** Get data of this degree *****/
Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Deg_GetDataOfDegreeByCod (&Deg))
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
Lay_ShowErrorAndExit ("Degree not found.");
/***** Write link to degree *****/
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_DEG &&
Gbl.Hierarchy.Deg.DegCod == Deg.DegCod);
Gbl.Hierarchy.Deg.DegCod == Hie.Deg.DegCod);
HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight :
ClassNormal);
IsLastItemInLevel[4] = (NumDeg == NumDegs - 1);
Lay_IndentDependingOnLevel (4,IsLastItemInLevel);
Frm_StartForm (ActMyCrs);
Deg_PutParamDegCod (Deg.DegCod);
Deg_PutParamDegCod (Hie.Deg.DegCod);
HTM_BUTTON_SUBMIT_Begin (Act_GetActionText (ActSeeDegInf),
Highlight ? ClassHighlight :
ClassNormal,
NULL);
Lgo_DrawLogo (Hie_Lvl_DEG,Deg.DegCod,Deg.ShrtName,16,NULL,true);
HTM_TxtF ("&nbsp;%s",Deg.ShrtName);
Lgo_DrawLogo (Hie_Lvl_DEG,Hie.Deg.DegCod,Hie.Deg.ShrtName,16,NULL,true);
HTM_TxtF ("&nbsp;%s",Hie.Deg.ShrtName);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my courses in this degree *****/
NumCrss = (unsigned) Usr_GetCrssFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,
Deg.DegCod,&mysql_resCrs);
Hie.Deg.DegCod,&mysql_resCrs);
for (NumCrs = 0;
NumCrs < NumCrss;
NumCrs++)
@ -354,31 +350,31 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
row = mysql_fetch_row (mysql_resCrs);
/***** Get data of this course *****/
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
Lay_ShowErrorAndExit ("Course not found.");
/***** Write link to course *****/
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_CRS &&
Gbl.Hierarchy.Crs.CrsCod == Crs.CrsCod);
Gbl.Hierarchy.Crs.CrsCod == Hie.Crs.CrsCod);
HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight :
ClassNormal);
IsLastItemInLevel[5] = (NumCrs == NumCrss - 1);
Lay_IndentDependingOnLevel (5,IsLastItemInLevel);
Frm_StartForm (ActMyCrs);
Crs_PutParamCrsCod (Crs.CrsCod);
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Crs.ShrtName),
Crs_PutParamCrsCod (Hie.Crs.CrsCod);
HTM_BUTTON_SUBMIT_Begin (Hie_BuildGoToMsg (Hie.Crs.ShrtName),
Highlight ? ClassHighlight :
ClassNormal,
NULL);
Hie_FreeGoToMsg ();
Ico_PutIcon ("chalkboard-teacher.svg",Crs.FullName,"ICO16x16");
HTM_TxtF ("&nbsp;%s",Crs.ShrtName);
Ico_PutIcon ("chalkboard-teacher.svg",Hie.Crs.FullName,"ICO16x16");
HTM_TxtF ("&nbsp;%s",Hie.Crs.ShrtName);
HTM_BUTTON_End ();
Frm_EndForm ();
/***** Put link to register students *****/
Enr_PutButtonInlineToRegisterStds (Crs.CrsCod);
Enr_PutButtonInlineToRegisterStds (Hie.Crs.CrsCod);
HTM_LI_End ();
}

View File

@ -37,6 +37,7 @@
#include "swad_exam_announcement.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_hierarchy.h"
#include "swad_HTML.h"
#include "swad_logo.h"
#include "swad_notification.h"
@ -1762,22 +1763,20 @@ static void ExaAnn_GetNotifContentExamAnn (const struct ExaAnn_ExamAnnouncements
extern const char *Txt_EXAM_ANNOUNCEMENT_Material_allowed;
extern const char *Txt_EXAM_ANNOUNCEMENT_Other_information;
extern const char *Txt_hours_ABBREVIATION;
struct Ins_Instit Ins;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
char StrExamDate[Cns_MAX_BYTES_DATE + 1];
/***** Get data of course *****/
Crs.CrsCod = ExamAnns->ExamAnn.CrsCod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = ExamAnns->ExamAnn.CrsCod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
/***** Get data of degree *****/
Deg.DegCod = Crs.DegCod;
Deg_GetDataOfDegreeByCod (&Deg);
Hie.Deg.DegCod = Hie.Crs.DegCod;
Deg_GetDataOfDegreeByCod (&Hie.Deg);
/***** Get data of institution *****/
Ins.InsCod = Deg_GetInsCodOfDegreeByCod (Deg.DegCod);
Ins_GetDataOfInstitutionByCod (&Ins);
Hie.Ins.InsCod = Deg_GetInsCodOfDegreeByCod (Hie.Deg.DegCod);
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
/***** Convert struct date to a date string *****/
Dat_ConvDateToDateStr (&ExamAnns->ExamAnn.ExamDate,StrExamDate);
@ -1798,8 +1797,8 @@ static void ExaAnn_GetNotifContentExamAnn (const struct ExaAnn_ExamAnnouncements
"%s: %s<br />"
"%s: %s<br />"
"%s: %s",
Txt_Institution,Ins.FullName,
Txt_Degree,Deg.FullName,
Txt_Institution,Hie.Ins.FullName,
Txt_Degree,Hie.Deg.FullName,
Txt_EXAM_ANNOUNCEMENT_Course,ExamAnns->ExamAnn.CrsFullName,
Txt_EXAM_ANNOUNCEMENT_Year_or_semester,Txt_YEAR_OF_DEGREE[ExamAnns->ExamAnn.Year],
Txt_EXAM_ANNOUNCEMENT_Session,ExamAnns->ExamAnn.Session,

View File

@ -6848,10 +6848,7 @@ static void Brw_WriteCurrentClipboard (void)
extern const char *Txt_folder;
extern const char *Txt_link;
extern const char *Txt_all_files_inside_the_root_folder;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
struct GroupData GrpDat;
struct Prj_Project Prj;
struct UsrData UsrDat;
@ -6873,151 +6870,151 @@ static void Brw_WriteCurrentClipboard (void)
switch (Gbl.FileBrowser.Clipboard.FileBrowser)
{
case Brw_ADMI_DOC_INS:
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
Ins_GetDataOfInstitutionByCod (&Ins);
Hie.Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
Txt_institution,Ins.ShrtName);
Txt_institution,Hie.Ins.ShrtName);
break;
case Brw_ADMI_SHR_INS:
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
Ins_GetDataOfInstitutionByCod (&Ins);
Hie.Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
Txt_institution,Ins.ShrtName);
Txt_institution,Hie.Ins.ShrtName);
break;
case Brw_ADMI_DOC_CTR:
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
Ctr_GetDataOfCentreByCod (&Ctr);
Hie.Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
Ctr_GetDataOfCentreByCod (&Hie.Ctr);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
Txt_centre,Ctr.ShrtName);
Txt_centre,Hie.Ctr.ShrtName);
break;
case Brw_ADMI_SHR_CTR:
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
Ctr_GetDataOfCentreByCod (&Ctr);
Hie.Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
Ctr_GetDataOfCentreByCod (&Hie.Ctr);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
Txt_centre,Ctr.ShrtName);
Txt_centre,Hie.Ctr.ShrtName);
break;
case Brw_ADMI_DOC_DEG:
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
Deg_GetDataOfDegreeByCod (&Deg);
Hie.Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
Deg_GetDataOfDegreeByCod (&Hie.Deg);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
Txt_degree,Deg.ShrtName);
Txt_degree,Hie.Deg.ShrtName);
break;
case Brw_ADMI_SHR_DEG:
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
Deg_GetDataOfDegreeByCod (&Deg);
Hie.Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
Deg_GetDataOfDegreeByCod (&Hie.Deg);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
Txt_degree,Deg.ShrtName);
Txt_degree,Hie.Deg.ShrtName);
break;
case Brw_ADMI_DOC_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
Txt_course,Crs.ShrtName);
Txt_course,Hie.Crs.ShrtName);
break;
case Brw_ADMI_DOC_GRP:
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_documents_management_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
break;
case Brw_ADMI_TCH_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_teachers_files_area,
Txt_course,Crs.ShrtName);
Txt_course,Hie.Crs.ShrtName);
break;
case Brw_ADMI_TCH_GRP:
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_teachers_files_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
break;
case Brw_ADMI_SHR_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
Txt_course,Crs.ShrtName);
Txt_course,Hie.Crs.ShrtName);
break;
case Brw_ADMI_SHR_GRP:
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_shared_files_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
break;
case Brw_ADMI_ASG_USR:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Txt_assignments_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_user[Gbl.Usrs.Me.UsrDat.Sex],Gbl.Usrs.Me.UsrDat.FullName);
break;
case Brw_ADMI_WRK_USR:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Txt_works_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_user[Gbl.Usrs.Me.UsrDat.Sex],Gbl.Usrs.Me.UsrDat.FullName);
break;
case Brw_ADMI_ASG_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Txt_assignments_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_user[UsrDat.Sex],UsrDat.FullName);
Usr_UsrDataDestructor (&UsrDat);
break;
case Brw_ADMI_WRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Txt_works_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_user[UsrDat.Sex],UsrDat.FullName);
Usr_UsrDataDestructor (&UsrDat);
break;
@ -7026,33 +7023,33 @@ static void Brw_WriteCurrentClipboard (void)
Prj_AllocMemProject (&Prj);
Prj.PrjCod = Gbl.FileBrowser.Clipboard.Cod;
Prj_GetDataOfProjectByCod (&Prj);
Crs.CrsCod = Prj.CrsCod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Prj.CrsCod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Gbl.FileBrowser.Clipboard.FileBrowser == Brw_ADMI_DOC_PRJ ? Txt_project_documents :
Txt_project_assessment,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_project,Prj.Title);
Prj_FreeMemProject (&Prj);
break;
case Brw_ADMI_MRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_marks_management_area,
Txt_course,Crs.ShrtName);
Txt_course,Hie.Crs.ShrtName);
break;
case Brw_ADMI_MRK_GRP:
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = GrpDat.CrsCod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_marks_management_area,
Txt_course,Crs.ShrtName,
Txt_course,Hie.Crs.ShrtName,
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
break;
case Brw_ADMI_BRF_USR:
@ -7864,10 +7861,7 @@ static void Brw_PasteClipboard (void)
extern const char *Txt_Links_copied;
extern const char *Txt_Folders_copied;
extern const char *Txt_You_can_not_paste_file_or_folder_here;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
struct GroupData GrpDat;
struct UsrData UsrDat;
long PrjCod;
@ -7888,39 +7882,39 @@ static void Brw_PasteClipboard (void)
{
case Brw_ADMI_DOC_INS:
case Brw_ADMI_SHR_INS:
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Ins_GetDataOfInstitutionByCod (&Ins))
Hie.Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Ins_GetDataOfInstitutionByCod (&Hie.Ins))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%02u/%u/%s",
Cfg_PATH_INS_PRIVATE,
(unsigned) (Ins.InsCod % 100),
(unsigned) Ins.InsCod,
(unsigned) (Hie.Ins.InsCod % 100),
(unsigned) Hie.Ins.InsCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
else
Lay_ShowErrorAndExit ("The copy source does not exist.");
break;
case Brw_ADMI_DOC_CTR:
case Brw_ADMI_SHR_CTR:
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
if (Ctr_GetDataOfCentreByCod (&Ctr))
Hie.Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
if (Ctr_GetDataOfCentreByCod (&Hie.Ctr))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%02u/%u/%s",
Cfg_PATH_CTR_PRIVATE,
(unsigned) (Ctr.CtrCod % 100),
(unsigned) Ctr.CtrCod,
(unsigned) (Hie.Ctr.CtrCod % 100),
(unsigned) Hie.Ctr.CtrCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
else
Lay_ShowErrorAndExit ("The copy source does not exist.");
break;
case Brw_ADMI_DOC_DEG:
case Brw_ADMI_SHR_DEG:
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
if (Deg_GetDataOfDegreeByCod (&Deg))
Hie.Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
if (Deg_GetDataOfDegreeByCod (&Hie.Deg))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%02u/%u/%s",
Cfg_PATH_DEG_PRIVATE,
(unsigned) (Deg.DegCod % 100),
(unsigned) Deg.DegCod,
(unsigned) (Hie.Deg.DegCod % 100),
(unsigned) Hie.Deg.DegCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
else
Lay_ShowErrorAndExit ("The copy source does not exist.");
@ -7929,11 +7923,11 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_TCH_CRS:
case Brw_ADMI_SHR_CRS:
case Brw_ADMI_MRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Crs_GetDataOfCourseByCod (&Hie.Crs))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,
Cfg_PATH_CRS_PRIVATE,Hie.Crs.CrsCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
else
Lay_ShowErrorAndExit ("The copy source does not exist.");
@ -7944,11 +7938,11 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_MRK_GRP:
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.Cod;
Grp_GetDataOfGroupByCod (&GrpDat);
Crs.CrsCod = GrpDat.CrsCod;
if (Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = GrpDat.CrsCod;
if (Crs_GetDataOfCourseByCod (&Hie.Crs))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,Cfg_FOLDER_GRP,
Cfg_PATH_CRS_PRIVATE,Hie.Crs.CrsCod,Cfg_FOLDER_GRP,
GrpDat.GrpCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
else
@ -7956,15 +7950,15 @@ static void Brw_PasteClipboard (void)
break;
case Brw_ADMI_ASG_CRS:
case Brw_ADMI_WRK_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Crs_GetDataOfCourseByCod (&Hie.Crs))
{
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Check that user exists
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s/%02u/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,Cfg_FOLDER_USR,
Cfg_PATH_CRS_PRIVATE,Hie.Crs.CrsCod,Cfg_FOLDER_USR,
(unsigned) (Gbl.FileBrowser.Clipboard.WorksUsrCod % 100),
Gbl.FileBrowser.Clipboard.WorksUsrCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
@ -7975,11 +7969,11 @@ static void Brw_PasteClipboard (void)
break;
case Brw_ADMI_ASG_USR:
case Brw_ADMI_WRK_USR:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
if (Crs_GetDataOfCourseByCod (&Hie.Crs))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s/%02u/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,Cfg_FOLDER_USR,
Cfg_PATH_CRS_PRIVATE,Hie.Crs.CrsCod,Cfg_FOLDER_USR,
(unsigned) (Gbl.Usrs.Me.UsrDat.UsrCod % 100),
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
@ -7989,11 +7983,11 @@ static void Brw_PasteClipboard (void)
case Brw_ADMI_DOC_PRJ:
case Brw_ADMI_ASS_PRJ:
PrjCod = Gbl.FileBrowser.Clipboard.Cod;
Crs.CrsCod = Prj_GetCourseOfProject (PrjCod);
if (Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = Prj_GetCourseOfProject (PrjCod);
if (Crs_GetDataOfCourseByCod (&Hie.Crs))
snprintf (PathOrg,sizeof (PathOrg),
"%s/%ld/%s/%02u/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Crs.CrsCod,Cfg_FOLDER_PRJ,
Cfg_PATH_CRS_PRIVATE,Hie.Crs.CrsCod,Cfg_FOLDER_PRJ,
(unsigned) (PrjCod % 100),
PrjCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);

View File

@ -41,6 +41,7 @@
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_hierarchy.h"
#include "swad_HTML.h"
#include "swad_layout.h"
#include "swad_logo.h"
@ -2168,10 +2169,7 @@ void For_SetForumName (const struct For_Forum *Forum,
extern const char *Txt_only_teachers;
extern const char *Txt_only_teachers_NO_HTML[1 + Lan_NUM_LANGUAGES];
extern const char *Txt_Unknown_FORUM;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
switch (Forum->Type)
{
@ -2199,66 +2197,66 @@ void For_SetForumName (const struct For_Forum *Forum,
Txt_only_teachers_NO_HTML[Language]);
break;
case For_FORUM_INSTIT_USRS:
Ins.InsCod = Forum->Location;
if (!Ins_GetDataOfInstitutionByCod (&Ins))
Hie.Ins.InsCod = Forum->Location;
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
Lay_ShowErrorAndExit ("Institution not found.");
Str_Copy (ForumName,Ins.ShrtName,
Str_Copy (ForumName,Hie.Ins.ShrtName,
For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_INSTIT_TCHS:
Ins.InsCod = Forum->Location;
if (!Ins_GetDataOfInstitutionByCod (&Ins))
Hie.Ins.InsCod = Forum->Location;
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
Lay_ShowErrorAndExit ("Institution not found.");
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
"%s%s",Ins.ShrtName,
"%s%s",Hie.Ins.ShrtName,
UseHTMLEntities ? Txt_only_teachers :
Txt_only_teachers_NO_HTML[Language]);
break;
case For_FORUM_CENTRE_USRS:
Ctr.CtrCod = Forum->Location;
if (!Ctr_GetDataOfCentreByCod (&Ctr))
Hie.Ctr.CtrCod = Forum->Location;
if (!Ctr_GetDataOfCentreByCod (&Hie.Ctr))
Lay_ShowErrorAndExit ("Centre not found.");
Str_Copy (ForumName,Ctr.ShrtName,
Str_Copy (ForumName,Hie.Ctr.ShrtName,
For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_CENTRE_TCHS:
Ctr.CtrCod = Forum->Location;
if (!Ctr_GetDataOfCentreByCod (&Ctr))
Hie.Ctr.CtrCod = Forum->Location;
if (!Ctr_GetDataOfCentreByCod (&Hie.Ctr))
Lay_ShowErrorAndExit ("Centre not found.");
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
"%s%s",Ctr.ShrtName,
"%s%s",Hie.Ctr.ShrtName,
UseHTMLEntities ? Txt_only_teachers :
Txt_only_teachers_NO_HTML[Language]);
break;
case For_FORUM_DEGREE_USRS:
Deg.DegCod = Forum->Location;
if (!Deg_GetDataOfDegreeByCod (&Deg))
Hie.Deg.DegCod = Forum->Location;
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
Lay_ShowErrorAndExit ("Degree not found.");
Str_Copy (ForumName,Deg.ShrtName,
Str_Copy (ForumName,Hie.Deg.ShrtName,
For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_DEGREE_TCHS:
Deg.DegCod = Forum->Location;
if (!Deg_GetDataOfDegreeByCod (&Deg))
Hie.Deg.DegCod = Forum->Location;
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
Lay_ShowErrorAndExit ("Degree not found.");
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
"%s%s",Deg.ShrtName,
"%s%s",Hie.Deg.ShrtName,
UseHTMLEntities ? Txt_only_teachers :
Txt_only_teachers_NO_HTML[Language]);
break;
case For_FORUM_COURSE_USRS:
Crs.CrsCod = Forum->Location;
if (!Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = Forum->Location;
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
Lay_ShowErrorAndExit ("Course not found.");
Str_Copy (ForumName,Crs.ShrtName,
Str_Copy (ForumName,Hie.Crs.ShrtName,
For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_COURSE_TCHS:
Crs.CrsCod = Forum->Location;
if (!Crs_GetDataOfCourseByCod (&Crs))
Hie.Crs.CrsCod = Forum->Location;
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
Lay_ShowErrorAndExit ("Course not found.");
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
"%s%s",Crs.ShrtName,
"%s%s",Hie.Crs.ShrtName,
UseHTMLEntities ? Txt_only_teachers :
Txt_only_teachers_NO_HTML[Language]);
break;

View File

@ -660,9 +660,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
MYSQL_ROW row;
unsigned NumRow;
unsigned NumRows;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Hie_Hierarchy Hie;
/***** Get institutions, centres, degrees admin by user from database *****/
NumRows = (unsigned) DB_QuerySELECT (&mysql_res,"can not get institutions,"
@ -725,38 +723,38 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
HTM_TxtF ("&nbsp;%s",Txt_all_degrees);
break;
case Hie_Lvl_INS: // Institution
Ins.InsCod = Str_ConvertStrCodToLongCod (row[1]);
if (Ins.InsCod > 0)
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[1]);
if (Hie.Ins.InsCod > 0)
{
/* Get data of institution */
Ins_GetDataOfInstitutionByCod (&Ins);
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
/* Write institution logo and name */
Ins_DrawInstitutionLogoAndNameWithLink (&Ins,ActSeeInsInf,
Ins_DrawInstitutionLogoAndNameWithLink (&Hie.Ins,ActSeeInsInf,
"BT_LINK DAT_SMALL_NOBR","LT");
}
break;
case Hie_Lvl_CTR: // Centre
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[1]);
if (Ctr.CtrCod > 0)
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[1]);
if (Hie.Ctr.CtrCod > 0)
{
/* Get data of centre */
Ctr_GetDataOfCentreByCod (&Ctr);
Ctr_GetDataOfCentreByCod (&Hie.Ctr);
/* Write centre logo and name */
Ctr_DrawCentreLogoAndNameWithLink (&Ctr,ActSeeCtrInf,
Ctr_DrawCentreLogoAndNameWithLink (&Hie.Ctr,ActSeeCtrInf,
"BT_LINK DAT_SMALL_NOBR","LT");
}
break;
case Hie_Lvl_DEG: // Degree
Deg.DegCod = Str_ConvertStrCodToLongCod (row[1]);
if (Deg.DegCod > 0)
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[1]);
if (Hie.Deg.DegCod > 0)
{
/* Get data of degree */
Deg_GetDataOfDegreeByCod (&Deg);
Deg_GetDataOfDegreeByCod (&Hie.Deg);
/* Write degree logo and name */
Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf,
Deg_DrawDegreeLogoAndNameWithLink (&Hie.Deg,ActSeeDegInf,
"BT_LINK DAT_SMALL_NOBR","LT");
}
break;

View File

@ -647,7 +647,7 @@ void Ins_GetBasicListOfInstitutions (long CtyCod)
/***** Create list with institutions *****/
if ((Gbl.Hierarchy.Inss.Lst = (struct Ins_Instit *)
calloc (NumRows,sizeof (struct Ins_Instit))) == NULL)
calloc (NumRows,sizeof (struct Ins_Instit))) == NULL)
Lay_NotEnoughMemoryExit ();
/***** Get the institutions *****/
@ -731,7 +731,7 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
/***** Create list with institutions *****/
if ((Gbl.Hierarchy.Inss.Lst = (struct Ins_Instit *)
calloc (NumRows,sizeof (struct Ins_Instit))) == NULL)
calloc (NumRows,sizeof (struct Ins_Instit))) == NULL)
Lay_NotEnoughMemoryExit ();
/***** Get the institutions *****/

View File

@ -1713,21 +1713,19 @@ static void Lay_WriteFootFromHTMLFile (void)
void Lay_WriteHeaderClassPhoto (bool PrintView,bool DrawingClassPhoto,
long InsCod,long DegCod,long CrsCod)
{
struct Ins_Instit Ins;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
/***** Get data of institution *****/
Ins.InsCod = InsCod;
Ins_GetDataOfInstitutionByCod (&Ins);
Hie.Ins.InsCod = InsCod;
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
/***** Get data of degree *****/
Deg.DegCod = DegCod;
Deg_GetDataOfDegreeByCod (&Deg);
Hie.Deg.DegCod = DegCod;
Deg_GetDataOfDegreeByCod (&Hie.Deg);
/***** Get data of course *****/
Crs.CrsCod = CrsCod;
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = CrsCod;
Crs_GetDataOfCourseByCod (&Hie.Crs);
/***** Begin table *****/
HTM_TABLE_BeginWidePadding (10);
@ -1738,8 +1736,8 @@ void Lay_WriteHeaderClassPhoto (bool PrintView,bool DrawingClassPhoto,
if (InsCod > 0)
{
if (!PrintView)
HTM_A_Begin ("href=\"%s\" target=\"_blank\"",Ins.WWW);
Lgo_DrawLogo (Hie_Lvl_INS,Ins.InsCod,Ins.ShrtName,40,NULL,true);
HTM_A_Begin ("href=\"%s\" target=\"_blank\"",Hie.Ins.WWW);
Lgo_DrawLogo (Hie_Lvl_INS,Hie.Ins.InsCod,Hie.Ins.ShrtName,40,NULL,true);
if (!PrintView)
HTM_A_End ();
}
@ -1751,26 +1749,26 @@ void Lay_WriteHeaderClassPhoto (bool PrintView,bool DrawingClassPhoto,
{
if (!PrintView)
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"CLASSPHOTO_TITLE\"",
Ins.WWW);
HTM_Txt (Ins.FullName);
Hie.Ins.WWW);
HTM_Txt (Hie.Ins.FullName);
if (!PrintView)
HTM_A_End ();
}
if (DegCod > 0)
{
if (Ins.InsCod > 0)
if (Hie.Ins.InsCod > 0)
HTM_Txt (" - ");
if (!PrintView)
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"CLASSPHOTO_TITLE\"",
Deg.WWW);
HTM_Txt (Deg.FullName);
Hie.Deg.WWW);
HTM_Txt (Hie.Deg.FullName);
if (!PrintView)
HTM_A_End ();
}
HTM_BR ();
if (CrsCod > 0)
{
HTM_Txt (Crs.FullName);
HTM_Txt (Hie.Crs.FullName);
if (DrawingClassPhoto && !Gbl.Usrs.ClassPhoto.AllGroups)
{
HTM_BR ();
@ -1785,8 +1783,8 @@ void Lay_WriteHeaderClassPhoto (bool PrintView,bool DrawingClassPhoto,
{
if (!PrintView)
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"CLASSPHOTO_TITLE\"",
Deg.WWW);
Lgo_DrawLogo (Hie_Lvl_DEG,Deg.DegCod,Deg.ShrtName,40,NULL,true);
Hie.Deg.WWW);
Lgo_DrawLogo (Hie_Lvl_DEG,Hie.Deg.DegCod,Hie.Deg.ShrtName,40,NULL,true);
if (!PrintView)
HTM_A_End ();
}

View File

@ -34,6 +34,7 @@
#include "swad_database.h"
#include "swad_exam_log.h"
#include "swad_global.h"
#include "swad_hierarchy.h"
#include "swad_HTML.h"
#include "swad_log.h"
#include "swad_profile.h"
@ -262,10 +263,7 @@ void Log_GetAndShowLastClicks (void)
Act_Action_t Action;
const char *ClassRow;
time_t TimeDiff;
struct Cty_Countr Cty;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Hie_Hierarchy Hie;
/***** Get last clicks from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get last clicks",
@ -319,56 +317,56 @@ void Log_GetAndShowLastClicks (void)
TimeDiff = (time_t) 0;
/* Get country code (row[4]) */
Cty.CtyCod = Str_ConvertStrCodToLongCod (row[4]);
Cty_GetCountryName (Cty.CtyCod,Gbl.Prefs.Language,
Cty.Name[Gbl.Prefs.Language]);
Hie.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[4]);
Cty_GetCountryName (Hie.Cty.CtyCod,Gbl.Prefs.Language,
Hie.Cty.Name[Gbl.Prefs.Language]);
/* Get institution code (row[5]) */
Ins.InsCod = Str_ConvertStrCodToLongCod (row[5]);
Ins_GetShortNameOfInstitution (&Ins);
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[5]);
Ins_GetShortNameOfInstitution (&Hie.Ins);
/* Get centre code (row[6]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[6]);
Ctr_GetShortNameOfCentreByCod (&Ctr);
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[6]);
Ctr_GetShortNameOfCentreByCod (&Hie.Ctr);
/* Get degree code (row[7]) */
Deg.DegCod = Str_ConvertStrCodToLongCod (row[7]);
Deg_GetShortNameOfDegreeByCod (&Deg);
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[7]);
Deg_GetShortNameOfDegreeByCod (&Hie.Deg);
/* Print table row */
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LC_CLK %s\"",ClassRow);
HTM_Txt (row[0]); // Click
HTM_Txt (row[0]); // Click
HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_TIM %s\"",ClassRow); // Elapsed time
HTM_TD_Begin ("class=\"LC_TIM %s\"",ClassRow); // Elapsed time
Dat_WriteHoursMinutesSecondsFromSeconds (TimeDiff);
HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_ROL %s\"",ClassRow);
HTM_Txt ( // Role
HTM_Txt ( // Role
Txt_ROLES_SINGUL_Abc[Rol_ConvertUnsignedStrToRole (row[3])][Usr_SEX_UNKNOWN]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_CTY %s\"",ClassRow);
HTM_Txt (Cty.Name[Gbl.Prefs.Language]); // Country
HTM_Txt (Hie.Cty.Name[Gbl.Prefs.Language]); // Country
HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_INS %s\"",ClassRow);
HTM_Txt (Ins.ShrtName); // Institution
HTM_Txt (Hie.Ins.ShrtName); // Institution
HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_CTR %s\"",ClassRow);
HTM_Txt (Ctr.ShrtName); // Centre
HTM_Txt (Hie.Ctr.ShrtName); // Centre
HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_DEG %s\"",ClassRow);
HTM_Txt (Deg.ShrtName); // Degree
HTM_Txt (Hie.Deg.ShrtName); // Degree
HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_ACT %s\"",ClassRow);
HTM_Txt (Act_GetActionText (Action)); // Action
HTM_Txt (Act_GetActionText (Action)); // Action
HTM_TD_End ();
HTM_TR_End ();

View File

@ -43,6 +43,7 @@
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_hierarchy.h"
#include "swad_HTML.h"
#include "swad_mark.h"
#include "swad_message.h"
@ -323,10 +324,7 @@ void Ntf_ShowMyNotifications (void)
bool AllNotifications;
Ntf_NotifyEvent_t NotifyEvent = (Ntf_NotifyEvent_t) 0; // Initialized to avoid warning
struct UsrData UsrDat;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
long Cod;
struct For_Forums Forums;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
@ -414,20 +412,20 @@ void Ntf_ShowMyNotifications (void)
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get user's data from the database
/* Get institution code (row[2]) */
Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
Ins_GetDataOfInstitutionByCod (&Ins);
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
/* Get centre code (row[3]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]);
Ctr_GetDataOfCentreByCod (&Ctr);
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]);
Ctr_GetDataOfCentreByCod (&Hie.Ctr);
/* Get degree code (row[4]) */
Deg.DegCod = Str_ConvertStrCodToLongCod (row[4]);
Deg_GetDataOfDegreeByCod (&Deg);
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[4]);
Deg_GetDataOfDegreeByCod (&Hie.Deg);
/* Get course code (row[5]) */
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[5]);
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[5]);
Crs_GetDataOfCourseByCod (&Hie.Crs);
/* Get message/post/... code (row[6]) */
Cod = Str_ConvertStrCodToLongCod (row[6]);
@ -481,7 +479,7 @@ void Ntf_ShowMyNotifications (void)
HTM_TD_Begin ("class=\"%s LT\" style=\"width:25px;\"",ClassBackground);
if (PutLink)
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Hie.Crs.CrsCod,&UsrDat,Cod,&Forums);
if (PutLink)
{
@ -498,7 +496,7 @@ void Ntf_ShowMyNotifications (void)
HTM_TD_Begin ("class=\"%s LT\"",ClassBackground);
if (PutLink)
{
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Hie.Crs.CrsCod,&UsrDat,Cod,&Forums);
HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL);
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_BUTTON_End ();
@ -523,7 +521,7 @@ void Ntf_ShowMyNotifications (void)
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{
if (PutLink)
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Hie.Crs.CrsCod,&UsrDat,Cod,&Forums);
if (PutLink)
HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL);
@ -541,21 +539,21 @@ void Ntf_ShowMyNotifications (void)
else
{
if (PutLink)
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Hie.Crs.CrsCod,&UsrDat,Cod,&Forums);
if (PutLink)
HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL);
else
HTM_SPAN_Begin ("class=\"%s\"",ClassText);
if (Crs.CrsCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Course,Crs.ShrtName);
else if (Deg.DegCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Degree,Deg.ShrtName);
else if (Ctr.CtrCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Centre,Ctr.ShrtName);
else if (Ins.InsCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Institution,Ins.ShrtName);
if (Hie.Crs.CrsCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Course,Hie.Crs.ShrtName);
else if (Hie.Deg.DegCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Degree,Hie.Deg.ShrtName);
else if (Hie.Ctr.CtrCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Centre,Hie.Ctr.ShrtName);
else if (Hie.Ins.InsCod > 0)
HTM_TxtF ("%s:&nbsp;%s",Txt_Institution,Hie.Ins.ShrtName);
else
HTM_Hyphen ();
@ -585,7 +583,7 @@ void Ntf_ShowMyNotifications (void)
ContentStr = NULL;
Ntf_GetNotifSummaryAndContent (SummaryStr,&ContentStr,NotifyEvent,
Cod,Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
Cod,Hie.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
false);
HTM_TR_Begin (NULL);
@ -1586,10 +1584,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
Lan_Language_t ToUsrLanguage;
struct UsrData FromUsrDat;
Ntf_NotifyEvent_t NotifyEvent = (Ntf_NotifyEvent_t) 0; // Initialized to avoid warning
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Deg_Degree Deg;
struct Crs_Course Crs;
struct Hie_Hierarchy Hie;
long Cod;
struct For_Forum ForumSelected;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
@ -1665,20 +1660,20 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FromUsrDat,Usr_DONT_GET_PREFS); // Get origin user's data from the database
/* Get institution code (row[2]) */
Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
Ins_GetDataOfInstitutionByCod (&Ins);
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
Ins_GetDataOfInstitutionByCod (&Hie.Ins);
/* Get centre code (row[3]) */
Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]);
Ctr_GetDataOfCentreByCod (&Ctr);
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[3]);
Ctr_GetDataOfCentreByCod (&Hie.Ctr);
/* Get degree code (row[4]) */
Deg.DegCod = Str_ConvertStrCodToLongCod (row[4]);
Deg_GetDataOfDegreeByCod (&Deg);
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[4]);
Deg_GetDataOfDegreeByCod (&Hie.Deg);
/* Get course code (row[5]) */
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[5]);
Crs_GetDataOfCourseByCod (&Crs);
Hie.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[5]);
Crs_GetDataOfCourseByCod (&Hie.Crs);
/* Get message/post/... code (row[6]) */
Cod = Str_ConvertStrCodToLongCod (row[6]);
@ -1716,10 +1711,10 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
case Ntf_EVENT_NOTICE:
case Ntf_EVENT_MESSAGE:
case Ntf_EVENT_SURVEY:
if (Crs.CrsCod > 0)
if (Hie.Crs.CrsCod > 0)
fprintf (FileMail,"%s: %s\n",
Txt_Course_NO_HTML[ToUsrLanguage],
Crs.FullName);
Hie.Crs.FullName);
break;
case Ntf_EVENT_FORUM_POST_COURSE:
case Ntf_EVENT_FORUM_REPLY:
@ -1782,7 +1777,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
*NumMails = 1;
/* Update statistics about notifications */
Ntf_UpdateNumNotifSent (Deg.DegCod,Crs.CrsCod,NotifyEvent,*NumNotif,*NumMails);
Ntf_UpdateNumNotifSent (Hie.Deg.DegCod,Hie.Crs.CrsCod,NotifyEvent,*NumNotif,*NumMails);
}
/***** Mark all the pending notifications of this user as 'sent' *****/

View File

@ -229,8 +229,8 @@ static void SysCfg_Map (void)
unsigned Zoom;
unsigned NumCtrs;
unsigned NumCtr;
struct Ctr_Centre Ctr;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
/***** Leaflet CSS *****/
Map_LeafletCSS ();

View File

@ -3864,12 +3864,12 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
struct Ins_Instit Ins;
struct Ctr_Centre Ctr;
struct Dpt_Department Dpt;
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
bool ShowData = (ItsMe || UsrDat->Accepted ||
Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
struct Ctr_Centre Ctr;
struct Dpt_Department Dpt;
/***** Start row *****/
HTM_TR_Begin (NULL);