mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-20 00:02:42 +02:00
Version 15.221.1
This commit is contained in:
parent
ef6f3390fe
commit
1cad71ee51
|
@ -134,13 +134,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.221 (2016-06-08)"
|
#define Log_PLATFORM_VERSION "SWAD 15.221.1 (2016-06-08)"
|
||||||
#define CSS_FILE "swad15.218.css"
|
#define CSS_FILE "swad15.218.css"
|
||||||
#define JS_FILE "swad15.216.js"
|
#define JS_FILE "swad15.216.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.221.1: Jun 08, 2016 Fix bug in form of indicators.
|
||||||
|
Speed up database queries to get course info when getting indicators. (? lines)
|
||||||
Version 15.221: Jun 08, 2016 Single (radio) selection of number of indicators changed to multiple (checkbox) selection. (202028 lines)
|
Version 15.221: Jun 08, 2016 Single (radio) selection of number of indicators changed to multiple (checkbox) selection. (202028 lines)
|
||||||
Version 15.220.1: Jun 08, 2016 Code refactoring in form to view indicators of courses. (202031 lines)
|
Version 15.220.1: Jun 08, 2016 Code refactoring in form to view indicators of courses. (202031 lines)
|
||||||
Version 15.220: Jun 08, 2016 Number of indicators now appears inside form. (202029 lines)
|
Version 15.220: Jun 08, 2016 Number of indicators now appears inside form. (202029 lines)
|
||||||
|
|
|
@ -95,7 +95,21 @@ void Ind_ReqIndicatorsCourses (void)
|
||||||
unsigned NumCrssToList;
|
unsigned NumCrssToList;
|
||||||
unsigned Ind;
|
unsigned Ind;
|
||||||
|
|
||||||
/***** Get scope *****/
|
/***** Start frame *****/
|
||||||
|
Lay_StartRoundFrame (NULL,Txt_Indicators_of_courses,NULL);
|
||||||
|
|
||||||
|
/***** Form to update indicators *****/
|
||||||
|
/* Start form */
|
||||||
|
Act_FormStart (ActReqStaCrs);
|
||||||
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
|
||||||
|
|
||||||
|
/* Scope */
|
||||||
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
"<td class=\"RIGHT_MIDDLE\">"
|
||||||
|
"<label class=\"%s\">%s:</label>"
|
||||||
|
"</td>"
|
||||||
|
"<td class=\"LEFT_MIDDLE\">",
|
||||||
|
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
|
||||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
||||||
1 << Sco_SCOPE_CTY |
|
1 << Sco_SCOPE_CTY |
|
||||||
1 << Sco_SCOPE_INS |
|
1 << Sco_SCOPE_INS |
|
||||||
|
@ -104,33 +118,6 @@ void Ind_ReqIndicatorsCourses (void)
|
||||||
1 << Sco_SCOPE_CRS;
|
1 << Sco_SCOPE_CRS;
|
||||||
Gbl.Scope.Default = Sco_SCOPE_CRS;
|
Gbl.Scope.Default = Sco_SCOPE_CRS;
|
||||||
Sco_GetScope ();
|
Sco_GetScope ();
|
||||||
|
|
||||||
/***** Get courses from database *****/
|
|
||||||
/* The result will contain courses with any number of indicators
|
|
||||||
If Gbl.Stat.NumIndicators < 0 ==> all courses in result will be listed
|
|
||||||
If Gbl.Stat.NumIndicators >= 0 ==> only those courses in result
|
|
||||||
with Gbl.Stat.NumIndicators set to yes
|
|
||||||
will be listed */
|
|
||||||
NumCrss = Ind_GetTableOfCourses (&mysql_res);
|
|
||||||
|
|
||||||
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
|
||||||
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
|
||||||
|
|
||||||
/***** Start frame *****/
|
|
||||||
Lay_StartRoundFrame (NULL,Txt_Indicators_of_courses,NULL);
|
|
||||||
|
|
||||||
/***** Form to update indicators *****/
|
|
||||||
/* Start form */
|
|
||||||
Act_FormStart (ActReqStaCrs);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">"
|
|
||||||
"<tr>"
|
|
||||||
"<td class=\"RIGHT_MIDDLE\">"
|
|
||||||
"<label class=\"%s\">%s:</label>"
|
|
||||||
"</td>"
|
|
||||||
"<td class=\"LEFT_MIDDLE\">",
|
|
||||||
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
|
|
||||||
|
|
||||||
Sco_PutSelectorScope (false);
|
Sco_PutSelectorScope (false);
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
@ -160,6 +147,17 @@ void Ind_ReqIndicatorsCourses (void)
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
|
/***** Get courses from database *****/
|
||||||
|
/* The result will contain courses with any number of indicators
|
||||||
|
If Gbl.Stat.NumIndicators < 0 ==> all courses in result will be listed
|
||||||
|
If Gbl.Stat.NumIndicators >= 0 ==> only those courses in result
|
||||||
|
with Gbl.Stat.NumIndicators set to yes
|
||||||
|
will be listed */
|
||||||
|
NumCrss = Ind_GetTableOfCourses (&mysql_res);
|
||||||
|
|
||||||
|
/***** Get vector with numbers of courses with 0, 1, 2... indicators set to yes *****/
|
||||||
|
Ind_GetNumCoursesWithIndicators (NumCrssWithIndicatorYes,NumCrss,mysql_res);
|
||||||
|
|
||||||
/* Selection of the number of indicators */
|
/* Selection of the number of indicators */
|
||||||
Ind_GetParamNumIndicators ();
|
Ind_GetParamNumIndicators ();
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -1345,7 +1343,6 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
|
||||||
|
|
||||||
void Ind_GetIndicatorsCrs (long CrsCod,struct Ind_IndicatorsCrs *Indicators)
|
void Ind_GetIndicatorsCrs (long CrsCod,struct Ind_IndicatorsCrs *Indicators)
|
||||||
{
|
{
|
||||||
bool MustBeRead; // Not used
|
|
||||||
Indicators->CountIndicators = 0;
|
Indicators->CountIndicators = 0;
|
||||||
|
|
||||||
/* Get whether download zones are empty or not */
|
/* Get whether download zones are empty or not */
|
||||||
|
@ -1359,9 +1356,9 @@ void Ind_GetIndicatorsCrs (long CrsCod,struct Ind_IndicatorsCrs *Indicators)
|
||||||
Indicators->NumFilesInSharedZonesGrp;
|
Indicators->NumFilesInSharedZonesGrp;
|
||||||
|
|
||||||
/* Indicator #1: information about syllabus */
|
/* Indicator #1: information about syllabus */
|
||||||
Inf_GetInfoSrcFromDB (CrsCod,Inf_LECTURES ,&(Indicators->SyllabusLecSrc ),&MustBeRead);
|
Indicators->SyllabusLecSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_LECTURES);
|
||||||
Inf_GetInfoSrcFromDB (CrsCod,Inf_PRACTICALS ,&(Indicators->SyllabusPraSrc ),&MustBeRead);
|
Indicators->SyllabusPraSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_PRACTICALS);
|
||||||
Inf_GetInfoSrcFromDB (CrsCod,Inf_TEACHING_GUIDE,&(Indicators->TeachingGuideSrc),&MustBeRead);
|
Indicators->TeachingGuideSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_TEACHING_GUIDE);
|
||||||
Indicators->ThereIsSyllabus = (Indicators->SyllabusLecSrc != Inf_INFO_SRC_NONE) ||
|
Indicators->ThereIsSyllabus = (Indicators->SyllabusLecSrc != Inf_INFO_SRC_NONE) ||
|
||||||
(Indicators->SyllabusPraSrc != Inf_INFO_SRC_NONE) ||
|
(Indicators->SyllabusPraSrc != Inf_INFO_SRC_NONE) ||
|
||||||
(Indicators->TeachingGuideSrc != Inf_INFO_SRC_NONE);
|
(Indicators->TeachingGuideSrc != Inf_INFO_SRC_NONE);
|
||||||
|
@ -1371,7 +1368,7 @@ void Ind_GetIndicatorsCrs (long CrsCod,struct Ind_IndicatorsCrs *Indicators)
|
||||||
/* Indicator #2: information about assignments */
|
/* Indicator #2: information about assignments */
|
||||||
Indicators->NumAssignments = Asg_GetNumAssignmentsInCrs (CrsCod);
|
Indicators->NumAssignments = Asg_GetNumAssignmentsInCrs (CrsCod);
|
||||||
Indicators->NumFilesAssignments = Ind_GetNumFilesOfCrsFileZoneFromDB (Brw_ADMI_ASSIG_USR,CrsCod);
|
Indicators->NumFilesAssignments = Ind_GetNumFilesOfCrsFileZoneFromDB (Brw_ADMI_ASSIG_USR,CrsCod);
|
||||||
Indicators->NumFilesWorks = Ind_GetNumFilesOfCrsFileZoneFromDB (Brw_ADMI_WORKS_USR ,CrsCod);
|
Indicators->NumFilesWorks = Ind_GetNumFilesOfCrsFileZoneFromDB (Brw_ADMI_WORKS_USR,CrsCod);
|
||||||
Indicators->ThereAreAssignments = (Indicators->NumAssignments != 0) ||
|
Indicators->ThereAreAssignments = (Indicators->NumAssignments != 0) ||
|
||||||
(Indicators->NumFilesAssignments != 0) ||
|
(Indicators->NumFilesAssignments != 0) ||
|
||||||
(Indicators->NumFilesWorks != 0);
|
(Indicators->NumFilesWorks != 0);
|
||||||
|
@ -1395,7 +1392,7 @@ void Ind_GetIndicatorsCrs (long CrsCod,struct Ind_IndicatorsCrs *Indicators)
|
||||||
Indicators->CountIndicators++;
|
Indicators->CountIndicators++;
|
||||||
|
|
||||||
/* Indicator #5: information about assessment */
|
/* Indicator #5: information about assessment */
|
||||||
Inf_GetInfoSrcFromDB (CrsCod,Inf_ASSESSMENT,&(Indicators->AssessmentSrc),&MustBeRead);
|
Indicators->AssessmentSrc = Inf_GetInfoSrcFromDB (CrsCod,Inf_ASSESSMENT);
|
||||||
Indicators->ThereIsAssessment = (Indicators->AssessmentSrc != Inf_INFO_SRC_NONE) ||
|
Indicators->ThereIsAssessment = (Indicators->AssessmentSrc != Inf_INFO_SRC_NONE) ||
|
||||||
(Indicators->TeachingGuideSrc != Inf_INFO_SRC_NONE);
|
(Indicators->TeachingGuideSrc != Inf_INFO_SRC_NONE);
|
||||||
if (Indicators->ThereIsAssessment)
|
if (Indicators->ThereIsAssessment)
|
||||||
|
|
46
swad_info.c
46
swad_info.c
|
@ -330,7 +330,7 @@ void Inf_ShowInfo (void)
|
||||||
Gbl.CurrentCrs.Info.Type = Inf_AsignInfoType ();
|
Gbl.CurrentCrs.Info.Type = Inf_AsignInfoType ();
|
||||||
|
|
||||||
/***** Get info source from database *****/
|
/***** Get info source from database *****/
|
||||||
Inf_GetInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,&InfoSrc,&MustBeRead);
|
Inf_GetAndCheckInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,&InfoSrc,&MustBeRead);
|
||||||
|
|
||||||
switch (Gbl.CurrentCrs.Info.Type)
|
switch (Gbl.CurrentCrs.Info.Type)
|
||||||
{
|
{
|
||||||
|
@ -1044,7 +1044,7 @@ void Inf_FormsToSelSendInfo (void)
|
||||||
Gbl.CurrentCrs.Info.Type = Inf_AsignInfoType ();
|
Gbl.CurrentCrs.Info.Type = Inf_AsignInfoType ();
|
||||||
|
|
||||||
/***** Get current info source from database *****/
|
/***** Get current info source from database *****/
|
||||||
Inf_GetInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,&InfoSrcSelected,&MustBeRead);
|
Inf_GetAndCheckInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,&InfoSrcSelected,&MustBeRead);
|
||||||
|
|
||||||
/***** Check if info available *****/
|
/***** Check if info available *****/
|
||||||
for (InfoSrc = (Inf_InfoSrc_t) 0;
|
for (InfoSrc = (Inf_InfoSrc_t) 0;
|
||||||
|
@ -1455,11 +1455,44 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********* Get info source for a type of course info from database ***********/
|
/***** Get and check info source for a type of course info from database *****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
Inf_InfoSrc_t Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType)
|
||||||
|
{
|
||||||
|
char Query[512];
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
Inf_InfoSrc_t InfoSrc;
|
||||||
|
|
||||||
|
/***** Get info source for a specific type of info from database *****/
|
||||||
|
sprintf (Query,"SELECT InfoSrc FROM crs_info_src"
|
||||||
|
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||||
|
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
||||||
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get info source"))
|
||||||
|
{
|
||||||
|
/* Get row */
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
|
/* Get info source (row[0]) */
|
||||||
|
InfoSrc = Inf_ConvertFromStrDBToInfoSrc (row[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
InfoSrc = Inf_INFO_SRC_NONE;
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
return InfoSrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***** Get and check info source for a type of course info from database *****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Inf_GetAndCheckInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
Inf_InfoSrc_t *InfoSrc,bool *MustBeRead)
|
Inf_InfoSrc_t *InfoSrc,bool *MustBeRead)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
@ -1471,8 +1504,7 @@ void Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
*InfoSrc = Inf_INFO_SRC_NONE;
|
*InfoSrc = Inf_INFO_SRC_NONE;
|
||||||
*MustBeRead = false;
|
*MustBeRead = false;
|
||||||
|
|
||||||
/***** Get info source for a specific type of course information
|
/***** Get info source for a specific type of info from database *****/
|
||||||
(bibliography, FAQ, links or evaluation) from database *****/
|
|
||||||
sprintf (Query,"SELECT InfoSrc,MustBeRead FROM crs_info_src"
|
sprintf (Query,"SELECT InfoSrc,MustBeRead FROM crs_info_src"
|
||||||
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
" WHERE CrsCod='%ld' AND InfoType='%s'",
|
||||||
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
CrsCod,Inf_NamesInDBForInfoType[InfoType]);
|
||||||
|
@ -1587,7 +1619,7 @@ Inf_InfoSrc_t Inf_ConvertFromStrDBToInfoSrc (const char *StrInfoSrcDB)
|
||||||
if (!strcmp (StrInfoSrcDB,Inf_NamesInDBForInfoSrc[InfoSrc]))
|
if (!strcmp (StrInfoSrcDB,Inf_NamesInDBForInfoSrc[InfoSrc]))
|
||||||
return InfoSrc;
|
return InfoSrc;
|
||||||
|
|
||||||
return (Inf_InfoSrc_t) 0;
|
return Inf_INFO_SRC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -85,7 +85,8 @@ void Inf_FormToSendPage (Inf_InfoSrc_t InfoSrc);
|
||||||
void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc);
|
void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc);
|
||||||
Inf_InfoSrc_t Inf_GetInfoSrcFromForm (void);
|
Inf_InfoSrc_t Inf_GetInfoSrcFromForm (void);
|
||||||
void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc);
|
void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc);
|
||||||
void Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
Inf_InfoSrc_t Inf_GetInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType);
|
||||||
|
void Inf_GetAndCheckInfoSrcFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
Inf_InfoSrc_t *InfoSrc,bool *MustBeRead);
|
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);
|
||||||
|
|
|
@ -1292,7 +1292,7 @@ int swad__getCourseInfo (struct soap *soap,
|
||||||
"Bad info type",
|
"Bad info type",
|
||||||
"Unknown requested info type");
|
"Unknown requested info type");
|
||||||
Gbl.CurrentCrs.Info.Type = InfoType;
|
Gbl.CurrentCrs.Info.Type = InfoType;
|
||||||
Inf_GetInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,&InfoSrc,&MustBeRead);
|
Inf_GetAndCheckInfoSrcFromDB (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]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user