Version 15.231.3

This commit is contained in:
Antonio Cañas Vargas 2016-06-24 20:34:58 +02:00
parent 73df78c0cf
commit 576ead2e18
12 changed files with 73 additions and 76 deletions

View File

@ -129,13 +129,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.231.2 (2016-06-24)"
#define Log_PLATFORM_VERSION "SWAD 15.231.3 (2016-06-24)"
#define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.226.js"
// 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
/*
Version 15.231.3: Jun 24, 2015 Parameter name used for "Scope" now depends on context. (203472 lines)
Version 15.231.2: Jun 24, 2015 Search is restricted by default to the smaller (down in hierarchy) scope. (203475 lines)
Version 15.231.1: Jun 24, 2015 All users can search guests. (203429 lines)
Version 15.231: Jun 24, 2015 Speed up in search of users by using temporary tables. (203427 lines)

View File

@ -88,7 +88,7 @@ void Con_ShowConnectedUsrs (void)
/***** Get scope *****/
Sco_SetScopesForListingStudents ();
Sco_GetScope ();
Sco_GetScope ("ScopeCon");
/***** Start frame *****/
/* Current time */
@ -120,7 +120,7 @@ static void Con_PutIconToUpdateConnected (void)
extern const char *Txt_Update;
Act_FormStart (ActLstCon);
Sco_PutParamScope (Gbl.Scope.Current);
Sco_PutParamScope ("ScopeCon",Gbl.Scope.Current);
Act_LinkFormSubmitAnimated (Txt_Update,The_ClassFormBold[Gbl.Prefs.Theme]);
Lay_PutCalculateIcon (Txt_Update);
Act_FormEnd ();
@ -498,7 +498,7 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
{
/* Put form to change scope */
Act_FormStart (ActLstCon);
Sco_PutSelectorScope (true);
Sco_PutSelectorScope ("ScopeCon",true);
Act_FormEnd ();
}
else
@ -668,7 +668,7 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Ro
Act_FormStartUnique (ActLstCon); // Must be unique because
// the list of connected users
// is dynamically updated via AJAX
Sco_PutParamScope (Sco_SCOPE_CRS);
Sco_PutParamScope ("ScopeCon",Sco_SCOPE_CRS);
Act_LinkFormSubmitUnique (Txt_Connected_users,The_ClassConnected[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<img src=\"%s/ellipsis32x32.gif\""
" alt=\"%s\" title=\"%s\" class=\"ICON40x40\" />"

View File

@ -104,7 +104,7 @@ static void Crs_PutButtonToGoToCrs (struct Course *Crs);
static void Crs_PutButtonToRegisterInCrs (struct Course *Crs);
static void Crs_PutLinkToSearchCourses (void);
static void Crs_PutLinkToSearchCoursesParams (void);
static void Sch_PutLinkToSearchCoursesParams (void);
static void Crs_PutParamOtherCrsCod (long CrsCod);
static long Crs_GetParamOtherCrsCod (void);
@ -2887,14 +2887,14 @@ static void Crs_PutLinkToSearchCourses (void)
(Gbl.CurrentIns.Ins.InsCod > 0 ? ActInsReqSch :
(Gbl.CurrentCty.Cty.CtyCod > 0 ? ActCtyReqSch :
ActSysReqSch)))),
Crs_PutLinkToSearchCoursesParams,
Sch_PutLinkToSearchCoursesParams,
"search64x64.gif",
Txt_Search_courses,Txt_Search_courses);
}
static void Crs_PutLinkToSearchCoursesParams (void)
static void Sch_PutLinkToSearchCoursesParams (void) // TODO: Move to search module
{
Sco_PutParamScope (Sco_SCOPE_SYS);
Sco_PutParamScope ("ScopeSch",Sco_SCOPE_SYS);
Par_PutHiddenParamUnsigned ("WhatToSearch",(unsigned) Sch_SEARCH_COURSES);
}

View File

@ -2244,7 +2244,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
Sco_GetScope ("ScopeEnr");
/***** Start frame *****/
Lay_StartRoundFrame ("100%",Txt_Enrollment_requests,NULL);
@ -2261,7 +2261,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
"</td>"
"<td class=\"LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
Sco_PutSelectorScope (true);
Sco_PutSelectorScope ("ScopeEnr",true);
fprintf (Gbl.F.Out,"</td>"
"</tr>");

View File

@ -117,7 +117,7 @@ void Ind_ReqIndicatorsCourses (void)
"</td>"
"<td class=\"LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
Sco_PutSelectorScope (true);
Sco_PutSelectorScope ("ScopeInd",true);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
@ -185,7 +185,7 @@ void Ind_ReqIndicatorsCourses (void)
/* Button to show more details */
Act_FormStart (ActSeeAllStaCrs);
Sco_PutParamScope (Gbl.Scope.Current);
Sco_PutParamScope ("ScopeInd",Gbl.Scope.Current);
Par_PutHiddenParamLong ("OthDegTypCod",Gbl.Stat.DegTypCod);
Par_PutHiddenParamLong ("DptCod",Gbl.Stat.DptCod);
if (Gbl.Stat.StrIndicatorsSelected[0])
@ -215,7 +215,7 @@ static void Ind_GetParamsIndicators (void)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
Sco_GetScope ("ScopeInd");
/***** Get degree type code *****/
Gbl.Stat.DegTypCod = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? DT_GetParamOtherDegTypCod () :
@ -525,7 +525,7 @@ static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss)
/***** Put form to confirm that I want to see the big list *****/
Act_FormStart (Gbl.Action.Act);
Sco_PutParamScope (Gbl.Scope.Current);
Sco_PutParamScope ("ScopeInd",Gbl.Scope.Current);
Par_PutHiddenParamLong ("OthDegTypCod",Gbl.Stat.DegTypCod);
Par_PutHiddenParamLong ("DptCod",Gbl.Stat.DptCod);
if (Gbl.Stat.StrIndicatorsSelected[0])

View File

@ -754,7 +754,7 @@ static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs)
/***** Rank in form to go to ranking *****/
Act_FormStart (ActSeeUseGbl);
Sco_PutParamScope (Sco_SCOPE_SYS);
Sco_PutParamScope ("ScopeSta",Sco_SCOPE_SYS);
Par_PutHiddenParamUnsigned ("FigureType",(unsigned) Sta_USERS_RANKING);
Act_LinkFormSubmit (Gbl.Title,The_ClassForm[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"#%lu</a>",Rank);

View File

@ -73,7 +73,7 @@ extern struct Globals Gbl;
/** Put a selector to choice between ranges when getting users for listing ***/
/*****************************************************************************/
void Sco_PutSelectorScope (bool SendOnChange)
void Sco_PutSelectorScope (const char *ParamName,bool SendOnChange)
{
extern const char *Txt_System;
extern const char *Txt_Country;
@ -84,7 +84,7 @@ void Sco_PutSelectorScope (bool SendOnChange)
Sco_Scope_t Scope;
bool WriteScope;
fprintf (Gbl.F.Out,"<select name=\"Scope\"");
fprintf (Gbl.F.Out,"<select name=\"%s\"",ParamName);
if (SendOnChange)
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
@ -180,47 +180,43 @@ void Sco_PutSelectorScope (bool SendOnChange)
/************* Put hidden parameter with location range *********************/
/*****************************************************************************/
void Sco_PutParamScope (Sco_Scope_t Scope)
void Sco_PutParamScope (const char *ParamName,Sco_Scope_t Scope)
{
Par_PutHiddenParamUnsigned ("Scope",(unsigned) Scope);
Par_PutHiddenParamUnsigned (ParamName,(unsigned) Scope);
}
/*****************************************************************************/
/************************* Get users range for listing ***********************/
/*****************************************************************************/
void Sco_GetScope (void)
void Sco_GetScope (const char *ParamName)
{
static bool AlreadyGotScope = false;
char UnsignedStr[10+1];
if (!AlreadyGotScope)
{
/***** Get parameter location range if exists *****/
Par_GetParToText ("Scope",UnsignedStr,10);
if ((Gbl.Scope.Current = Sco_GetScopeFromUnsignedStr (UnsignedStr)) == Sco_SCOPE_UNK)
Gbl.Scope.Current = Gbl.Scope.Default;
/***** Get parameter location range if exists *****/
Par_GetParToText (ParamName,UnsignedStr,10);
if ((Gbl.Scope.Current = Sco_GetScopeFromUnsignedStr (UnsignedStr)) == Sco_SCOPE_UNK)
Gbl.Scope.Current = Gbl.Scope.Default;
/***** Avoid impossible scopes *****/
if (Gbl.Scope.Current == Sco_SCOPE_CRS && Gbl.CurrentCrs.Crs.CrsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_DEG;
/***** Avoid impossible scopes *****/
if (Gbl.Scope.Current == Sco_SCOPE_CRS && Gbl.CurrentCrs.Crs.CrsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_DEG;
if (Gbl.Scope.Current == Sco_SCOPE_DEG && Gbl.CurrentDeg.Deg.DegCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_CTR;
if (Gbl.Scope.Current == Sco_SCOPE_DEG && Gbl.CurrentDeg.Deg.DegCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_CTR;
if (Gbl.Scope.Current == Sco_SCOPE_CTR && Gbl.CurrentCtr.Ctr.CtrCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_INS;
if (Gbl.Scope.Current == Sco_SCOPE_CTR && Gbl.CurrentCtr.Ctr.CtrCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_INS;
if (Gbl.Scope.Current == Sco_SCOPE_INS && Gbl.CurrentIns.Ins.InsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_CTY;
if (Gbl.Scope.Current == Sco_SCOPE_INS && Gbl.CurrentIns.Ins.InsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_CTY;
if (Gbl.Scope.Current == Sco_SCOPE_CTY && Gbl.CurrentCty.Cty.CtyCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_SYS;
if (Gbl.Scope.Current == Sco_SCOPE_CTY && Gbl.CurrentCty.Cty.CtyCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_SYS;
/***** Avoid forbidden scopes *****/
if ((Gbl.Scope.Allowed & (1 << Gbl.Scope.Current)) == 0)
Gbl.Scope.Current = Sco_SCOPE_UNK;
}
/***** Avoid forbidden scopes *****/
if ((Gbl.Scope.Allowed & (1 << Gbl.Scope.Current)) == 0)
Gbl.Scope.Current = Sco_SCOPE_UNK;
}
/*****************************************************************************/

View File

@ -54,9 +54,9 @@ typedef enum
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Sco_PutSelectorScope (bool SendOnChange);
void Sco_PutParamScope (Sco_Scope_t Scope);
void Sco_GetScope (void);
void Sco_PutSelectorScope (const char *ParamName,bool SendOnChange);
void Sco_PutParamScope (const char *ParamName,Sco_Scope_t Scope);
void Sco_GetScope (const char *ParamName);
void Sco_SetScopesForListingGuests (void);
void Sco_SetScopesForListingStudents (void);

View File

@ -247,8 +247,8 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Sco
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = DefaultScope;
Sco_GetScope ();
Sco_PutSelectorScope (false);
Sco_GetScope ("ScopeSch");
Sco_PutSelectorScope ("ScopeSch",false);
fprintf (Gbl.F.Out,"</div>");
/***** String to find *****/
@ -353,8 +353,8 @@ void Sch_PutFormToSearchInPageTopHeading (void)
Gbl.Scope.Default = Sco_SCOPE_SYS;
}
Act_FormStart (ActionSearch);
Sco_GetScope ();
Sco_PutParamScope (Gbl.Scope.Current);
Sco_GetScope ("ScopeSch");
Sco_PutParamScope ("ScopeSch",Gbl.Scope.Current);
Sch_PutInputStringToSearch ("head_search_text");
Sch_PutMagnifyingGlassButton ("search-white64x64.png");
Act_FormEnd ();

View File

@ -647,8 +647,8 @@ void Sta_AskShowGblHits (void)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
Sco_PutSelectorScope (false);
Sco_GetScope ("ScopeSta");
Sco_PutSelectorScope ("ScopeSta",false);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
@ -894,7 +894,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
Sco_GetScope ("ScopeSta");
/***** Show form again *****/
Sta_AskShowGblHits ();
@ -2057,7 +2057,7 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES
else // Gbl.Action.Act == ActSeeAccGbl
{
Par_PutHiddenParamUnsigned ("Role",(unsigned) Gbl.Stat.Role);
Sco_PutParamScope (Gbl.Scope.Current);
Sco_PutParamScope ("ScopeSta",Gbl.Scope.Current);
}
fprintf (Gbl.F.Out,"%s: ",Txt_Color_of_the_graphic);
@ -3800,8 +3800,8 @@ void Sta_ReqUseOfPlatform (void)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
Sco_PutSelectorScope (false);
Sco_GetScope ("ScopeSta");
Sco_PutSelectorScope ("ScopeSta",false);
/***** Type of statistic *****/
fprintf (Gbl.F.Out,"<br />"

View File

@ -1546,8 +1546,8 @@ void Svy_RequestCreatOrEditSvy (void)
Txt_Scope);
if (!Svy_SetDefaultAndAllowedForEdition ())
Lay_ShowErrorAndExit ("You don't have permission to edit surveys here.");
Sco_GetScope ();
Sco_PutSelectorScope (false);
Sco_GetScope ("ScopeSvy");
Sco_PutSelectorScope ("ScopeSvy",false);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
@ -1746,7 +1746,7 @@ void Svy_RecFormSurvey (void)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
Sco_GetScope ("ScopeSvy");
switch (Gbl.Scope.Current)
{

View File

@ -5431,7 +5431,7 @@ void Usr_PutExtraParamsUsrList (Act_Action_t NextAction)
case ActLstGst:
case ActLstStd:
case ActLstTch:
Sco_PutParamScope (Gbl.Scope.Current);
Sco_PutParamScope ("ScopeUsr",Gbl.Scope.Current);
break;
case ActSeeOneAtt:
case ActRecAttStd:
@ -5896,7 +5896,7 @@ void Usr_ListAllDataGsts (void)
/***** Get scope *****/
Sco_SetScopesForListingGuests ();
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/****** Get and order list of guests ******/
Usr_GetGstsLst (Gbl.Scope.Current);
@ -6017,7 +6017,7 @@ void Usr_ListAllDataStds (void)
/***** Get scope *****/
Sco_SetScopesForListingStudents ();
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/****** Get and order list of students in current course ******/
Usr_GetListUsrs (Rol_STUDENT,Gbl.Scope.Current);
@ -6243,7 +6243,7 @@ void Usr_ListAllDataTchs (void)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/***** Get and order list of teachers *****/
Usr_GetListUsrs (Rol_TEACHER,Gbl.Scope.Current);
@ -6454,7 +6454,7 @@ void Usr_ListDataAdms (void)
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG;
Gbl.Scope.Default = Sco_SCOPE_DEG;
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/***** Get and order list of administrators *****/
Usr_GetAdmsLst (Gbl.Scope.Current);
@ -6467,7 +6467,7 @@ void Usr_ListDataAdms (void)
"<label class=\"%s\">%s: </label>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
Act_FormStart (ActLstOth);
Sco_PutSelectorScope (true);
Sco_PutSelectorScope ("ScopeUsr",true);
Usr_PutParamListWithPhotos ();
Act_FormEnd ();
fprintf (Gbl.F.Out,"</div>");
@ -6478,7 +6478,7 @@ void Usr_ListDataAdms (void)
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\""
" style=\"margin-bottom:8px;\">");
Act_FormStart (ActLstOth);
Sco_PutParamScope (Gbl.Scope.Current);
Sco_PutParamScope ("ScopeUsr",Gbl.Scope.Current);
Usr_PutCheckboxListWithPhotos ();
Act_FormEnd ();
fprintf (Gbl.F.Out,"</div>");
@ -6921,7 +6921,7 @@ void Usr_SeeGuests (void)
/***** Get scope *****/
Sco_SetScopesForListingGuests ();
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/***** Get and order list of students in current scope *****/
Usr_GetGstsLst (Gbl.Scope.Current);
@ -6950,7 +6950,7 @@ void Usr_SeeGuests (void)
Usr_PutParamListWithPhotos ();
fprintf (Gbl.F.Out,"<label class=\"%s\">%s: </label>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
Sco_PutSelectorScope (true);
Sco_PutSelectorScope ("ScopeUsr",true);
Act_FormEnd ();
fprintf (Gbl.F.Out,"</div>");
break;
@ -7063,7 +7063,7 @@ void Usr_SeeStudents (void)
/***** Get scope *****/
Sco_SetScopesForListingStudents ();
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS &&
(Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
@ -7101,7 +7101,7 @@ void Usr_SeeStudents (void)
Usr_PutParamListWithPhotos ();
fprintf (Gbl.F.Out,"<label class=\"%s\">%s: </label>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
Sco_PutSelectorScope (true);
Sco_PutSelectorScope ("ScopeUsr",true);
Act_FormEnd ();
fprintf (Gbl.F.Out,"</div>");
break;
@ -7231,7 +7231,7 @@ void Usr_SeeTeachers (void)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS);
/***** Get and order list of teachers *****/
@ -7254,7 +7254,7 @@ void Usr_SeeTeachers (void)
Usr_PutParamListWithPhotos ();
fprintf (Gbl.F.Out,"<label class=\"%s\">%s: </label>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Scope);
Sco_PutSelectorScope (true);
Sco_PutSelectorScope ("ScopeUsr",true);
Act_FormEnd ();
fprintf (Gbl.F.Out,"</div>");
@ -7391,7 +7391,7 @@ static void Usr_ShowStdsAllDataParams (void)
static void Usr_ShowTchsAllDataParams (void)
{
Sco_PutParamScope (Gbl.Scope.Current);
Sco_PutParamScope ("ScopeUsr",Gbl.Scope.Current);
Usr_PutParamListWithPhotos ();
Usr_PutExtraParamsUsrList (ActLstTchAll);
}
@ -7427,7 +7427,7 @@ void Usr_SeeGstClassPhotoPrn (void)
/***** Get scope *****/
Sco_SetScopesForListingGuests ();
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/***** Get and order list of students *****/
Usr_GetGstsLst (Gbl.Scope.Current);
@ -7466,7 +7466,7 @@ void Usr_SeeStdClassPhotoPrn (void)
/***** Get scope *****/
Sco_SetScopesForListingStudents ();
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/****** Get groups to show ******/
Grp_GetParCodsSeveralGrpsToShowUsrs ();
@ -7525,7 +7525,7 @@ void Usr_SeeTchClassPhotoPrn (void)
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
Sco_GetScope ("ScopeUsr");
/***** Get and order list of teachers *****/
Usr_GetListUsrs (Rol_TEACHER,Gbl.Scope.Current);