Version 15.221

This commit is contained in:
Antonio Cañas Vargas 2016-06-08 14:14:31 +02:00
parent c33789107e
commit ef6f3390fe
5 changed files with 74 additions and 74 deletions

View File

@ -134,14 +134,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.220.1 (2016-06-08)" #define Log_PLATFORM_VERSION "SWAD 15.221 (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.220.2: Jun 08, 2016 Single (radio) selection of number of indicators changed to multiple (checkbox) selection. (? 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)
Version 15.219.1: Jun 05, 2016 Highlighted row with number of indicators selected. (202023 lines) Version 15.219.1: Jun 05, 2016 Highlighted row with number of indicators selected. (202023 lines)

View File

@ -50,6 +50,7 @@
#include "swad_image.h" #include "swad_image.h"
#include "swad_import.h" #include "swad_import.h"
#include "swad_icon.h" #include "swad_icon.h"
#include "swad_indicator.h"
#include "swad_institution.h" #include "swad_institution.h"
#include "swad_layout.h" #include "swad_layout.h"
#include "swad_link.h" #include "swad_link.h"
@ -708,7 +709,8 @@ struct Globals
unsigned long RowsPerPage; unsigned long RowsPerPage;
long DegTypCod; long DegTypCod;
long DptCod; long DptCod;
long NumIndicators; char StrIndicatorsSelected[Ind_MAX_SIZE_INDICATORS_SELECTED+1];
bool IndicatorsSelected[1+Ind_NUM_INDICATORS];
struct struct
{ {
Pho_AvgPhotoTypeOfAverage_t TypeOfAverage; Pho_AvgPhotoTypeOfAverage_t TypeOfAverage;
@ -719,13 +721,6 @@ struct Globals
float MaxPercent; float MaxPercent;
} DegPhotos; } DegPhotos;
} Stat; } Stat;
/*
struct
{
Img_Action_t Action;
Img_FileStatus_t Status;
} Image;
*/
}; };
/*****************************************************************************/ /*****************************************************************************/

View File

@ -60,7 +60,7 @@ typedef enum
/***************************** Internal prototypes ***************************/ /***************************** Internal prototypes ***************************/
/*****************************************************************************/ /*****************************************************************************/
static long Ind_GetParamNumIndicators (void); static void Ind_GetParamNumIndicators (void);
static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res); static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res);
static bool Ind_GetIfShowBigList (unsigned NumCrss); static bool Ind_GetIfShowBigList (unsigned NumCrss);
static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss); static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss);
@ -93,6 +93,7 @@ void Ind_ReqIndicatorsCourses (void)
unsigned NumCrss; unsigned NumCrss;
unsigned NumCrssWithIndicatorYes[1+Ind_NUM_INDICATORS]; unsigned NumCrssWithIndicatorYes[1+Ind_NUM_INDICATORS];
unsigned NumCrssToList; unsigned NumCrssToList;
unsigned Ind;
/***** Get scope *****/ /***** Get scope *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
@ -160,7 +161,7 @@ void Ind_ReqIndicatorsCourses (void)
"</tr>"); "</tr>");
/* Selection of the number of indicators */ /* Selection of the number of indicators */
Gbl.Stat.NumIndicators = Ind_GetParamNumIndicators (); Ind_GetParamNumIndicators ();
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"RIGHT_TOP\">" "<td class=\"RIGHT_TOP\">"
"<label class=\"%s\">%s:</label>" "<label class=\"%s\">%s:</label>"
@ -184,10 +185,11 @@ void Ind_ReqIndicatorsCourses (void)
Act_FormEnd (); Act_FormEnd ();
/***** Show the stats of courses *****/ /***** Show the stats of courses *****/
if (Gbl.Stat.NumIndicators < 0) // -1 means any number of indicators for (Ind = 0, NumCrssToList = 0;
NumCrssToList = NumCrss; Ind <= Ind_NUM_INDICATORS;
else Ind++)
NumCrssToList = NumCrssWithIndicatorYes[(unsigned) Gbl.Stat.NumIndicators]; if (Gbl.Stat.IndicatorsSelected[Ind])
NumCrssToList += NumCrssWithIndicatorYes[Ind];
if (Ind_GetIfShowBigList (NumCrssToList)) if (Ind_GetIfShowBigList (NumCrssToList))
{ {
/* Show table */ /* Show table */
@ -198,7 +200,8 @@ void Ind_ReqIndicatorsCourses (void)
Sco_PutParamScope (Gbl.Scope.Current); Sco_PutParamScope (Gbl.Scope.Current);
Par_PutHiddenParamLong ("OthDegTypCod",Gbl.Stat.DegTypCod); Par_PutHiddenParamLong ("OthDegTypCod",Gbl.Stat.DegTypCod);
Par_PutHiddenParamLong ("DptCod",Gbl.Stat.DptCod); Par_PutHiddenParamLong ("DptCod",Gbl.Stat.DptCod);
Par_PutHiddenParamLong ("Indicators",Gbl.Stat.NumIndicators); if (Gbl.Stat.StrIndicatorsSelected[0])
Par_PutHiddenParamString ("Indicators",Gbl.Stat.StrIndicatorsSelected);
Lay_PutConfirmButton (Txt_Show_more_details); Lay_PutConfirmButton (Txt_Show_more_details);
Act_FormEnd (); Act_FormEnd ();
} }
@ -238,7 +241,7 @@ void Ind_ShowIndicatorsCourses (void)
Gbl.Stat.DptCod = Dpt_GetParamDptCod (); Gbl.Stat.DptCod = Dpt_GetParamDptCod ();
/***** Get number of indicators *****/ /***** Get number of indicators *****/
Gbl.Stat.NumIndicators = Ind_GetParamNumIndicators (); Ind_GetParamNumIndicators ();
/***** Get courses from database *****/ /***** Get courses from database *****/
NumCrss = Ind_GetTableOfCourses (&mysql_res); NumCrss = Ind_GetTableOfCourses (&mysql_res);
@ -260,13 +263,48 @@ void Ind_ShowIndicatorsCourses (void)
/*************** Get parameter with the number of indicators *****************/ /*************** Get parameter with the number of indicators *****************/
/*****************************************************************************/ /*****************************************************************************/
static long Ind_GetParamNumIndicators (void) static void Ind_GetParamNumIndicators (void)
{ {
unsigned Ind;
const char *Ptr;
char LongStr[1+10+1]; char LongStr[1+10+1];
long Indicator;
/***** Get parameter with code of department *****/ /***** Get parameter multiple with list of indicators selected *****/
Par_GetParToText ("Indicators",LongStr,1+10); Par_GetParMultiToText ("Indicators",Gbl.Stat.StrIndicatorsSelected,Ind_MAX_SIZE_INDICATORS_SELECTED);
return Str_ConvertStrCodToLongCod (LongStr);
/***** Set which indicators have been selected (checkboxes on) *****/
if (Gbl.Stat.StrIndicatorsSelected[0])
{
/* Reset all indicators */
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
Gbl.Stat.IndicatorsSelected[Ind] = false;
/* Set indicators selected */
for (Ptr = Gbl.Stat.StrIndicatorsSelected;
*Ptr;
)
{
/* Get next indicator selected */
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,1+10);
Indicator = Str_ConvertStrCodToLongCod (LongStr);
/* Set each indicator in list StrIndicatorsSelected as selected */
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
if ((long) Ind == Indicator)
Gbl.Stat.IndicatorsSelected[Ind] = true;
}
}
else
/* Set all indicators */
for (Ind = 0;
Ind <= Ind_NUM_INDICATORS;
Ind++)
Gbl.Stat.IndicatorsSelected[Ind] = true;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -492,7 +530,8 @@ static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss)
Sco_PutParamScope (Gbl.Scope.Current); Sco_PutParamScope (Gbl.Scope.Current);
Par_PutHiddenParamLong ("OthDegTypCod",Gbl.Stat.DegTypCod); Par_PutHiddenParamLong ("OthDegTypCod",Gbl.Stat.DegTypCod);
Par_PutHiddenParamLong ("DptCod",Gbl.Stat.DptCod); Par_PutHiddenParamLong ("DptCod",Gbl.Stat.DptCod);
Par_PutHiddenParamLong ("Indicators",Gbl.Stat.NumIndicators); if (Gbl.Stat.StrIndicatorsSelected[0])
Par_PutHiddenParamString ("Indicators",Gbl.Stat.StrIndicatorsSelected);
Par_PutHiddenParamChar ("ShowBigList",'Y'); Par_PutHiddenParamChar ("ShowBigList",'Y');
/***** Send button *****/ /***** Send button *****/
@ -545,15 +584,13 @@ static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1+
static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1+Ind_NUM_INDICATORS], static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1+Ind_NUM_INDICATORS],
unsigned NumCrss,bool PutForm) unsigned NumCrss,bool PutForm)
{ {
extern const char *Txt_No_of_indicators; extern const char *Txt_Indicators;
extern const char *Txt_Courses; extern const char *Txt_Courses;
extern const char *Txt_Any_number; extern const char *Txt_Total;
unsigned Ind; unsigned Ind;
const char *Class; const char *Class;
const char *ClassNormal = "DAT RIGHT_MIDDLE"; const char *ClassNormal = "DAT_LIGHT RIGHT_MIDDLE";
const char *ClassHighlight = "DAT_N RIGHT_MIDDLE LIGHT_BLUE"; const char *ClassHighlight = "DAT RIGHT_MIDDLE LIGHT_BLUE";
const char *ClassTotalNormal = "DAT_N_LINE_TOP RIGHT_MIDDLE";
const char *ClassTotalHighlight = "DAT_N_LINE_TOP RIGHT_MIDDLE LIGHT_BLUE";
/***** Write number of courses with each number of indicators valid *****/ /***** Write number of courses with each number of indicators valid *****/
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\">" fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\">"
@ -567,21 +604,21 @@ static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
"%s" "%s"
"</th>" "</th>"
"</tr>", "</tr>",
Txt_No_of_indicators, Txt_Indicators,
Txt_Courses); Txt_Courses);
for (Ind = 0; for (Ind = 0;
Ind <= Ind_NUM_INDICATORS; Ind <= Ind_NUM_INDICATORS;
Ind++) Ind++)
{ {
Class = (Ind == Gbl.Stat.NumIndicators) ? ClassHighlight : Class = Gbl.Stat.IndicatorsSelected[Ind] ? ClassHighlight :
ClassNormal; ClassNormal;
fprintf (Gbl.F.Out,"<tr>"); fprintf (Gbl.F.Out,"<tr>");
if (PutForm) if (PutForm)
{ {
fprintf (Gbl.F.Out,"<td class=\"%s\">" fprintf (Gbl.F.Out,"<td class=\"%s\">"
"<input type=\"radio\" name=\"Indicators\" value=\"%u\"", "<input type=\"checkbox\" name=\"Indicators\" value=\"%u\"",
Class,Ind); Class,Ind);
if ((long) Ind == Gbl.Stat.NumIndicators) if (Gbl.Stat.IndicatorsSelected[Ind])
fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />" fprintf (Gbl.F.Out," />"
"</td>"); "</td>");
@ -606,35 +643,23 @@ static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
} }
/***** Write total of courses *****/ /***** Write total of courses *****/
Class = (Gbl.Stat.NumIndicators < 0) ? ClassTotalHighlight :
ClassTotalNormal;
fprintf (Gbl.F.Out,"<tr>"); fprintf (Gbl.F.Out,"<tr>");
if (PutForm) if (PutForm)
{ fprintf (Gbl.F.Out,"<td>"
fprintf (Gbl.F.Out,"<td class=\"%s\">"
"<input type=\"radio\" name=\"Indicators\" value=\"-1\"",
Class);
if (Gbl.Stat.NumIndicators < 0)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />"
"</td>"); "</td>");
} fprintf (Gbl.F.Out,"<td class=\"DAT_N_LINE_TOP RIGHT_MIDDLE\">"
fprintf (Gbl.F.Out,"<td class=\"%s\">"
"%s" "%s"
"</td>" "</td>"
"<td class=\"%s\">" "<td class=\"DAT_N_LINE_TOP RIGHT_MIDDLE\">"
"%u" "%u"
"</td>" "</td>"
"<td class=\"%s\">" "<td class=\"DAT_N_LINE_TOP RIGHT_MIDDLE\">"
"(%.1f%%)" "(%.1f%%)"
"</td>" "</td>"
"</tr>" "</tr>"
"</table>", "</table>",
Class, Txt_Total,
Txt_Any_number,
Class,
NumCrss, NumCrss,
Class,
100.0); 100.0);
} }
@ -960,8 +985,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
/* Get indicators of this course */ /* Get indicators of this course */
Ind_GetIndicatorsCrs (CrsCod,&Indicators); Ind_GetIndicatorsCrs (CrsCod,&Indicators);
if (Gbl.Stat.NumIndicators < 0 || // -1 means any number of indicators if (Gbl.Stat.IndicatorsSelected[Indicators.CountIndicators])
Gbl.Stat.NumIndicators == (long) Indicators.CountIndicators)
{ {
/* Write a row for this course */ /* Write a row for this course */
switch (IndicatorsLayout) switch (IndicatorsLayout)

View File

@ -32,6 +32,8 @@
/*****************************************************************************/ /*****************************************************************************/
#define Ind_NUM_INDICATORS 5 #define Ind_NUM_INDICATORS 5
#define Ind_MAX_SIZE_INDICATORS_SELECTED ((1+Ind_NUM_INDICATORS)*(10+1))
struct Ind_IndicatorsCrs struct Ind_IndicatorsCrs
{ {
unsigned long NumFilesInDocumentZones; unsigned long NumFilesInDocumentZones;

View File

@ -2804,27 +2804,6 @@ const char *Txt_Any_department =
"Qualquer departamento"; "Qualquer departamento";
#endif #endif
const char *Txt_Any_number =
#if L==1
"Qualsevol nombre";
#elif L==2
"Alle Anzahl";
#elif L==3
"Any number";
#elif L==4
"Cualquier n&uacute;mero";
#elif L==5
"Tout nombre";
#elif L==6
"Cualquier n&uacute;mero"; // Okoteve traducción
#elif L==7
"Qualsiasi numero";
#elif L==8
"Wszystkie liczba";
#elif L==9
"Qualquer n&uacute;mero";
#endif
const char *Txt_any_user = const char *Txt_any_user =
#if L==1 #if L==1
"qualsevol usuari"; "qualsevol usuari";