mirror of https://github.com/acanas/swad-core.git
Version 15.232
This commit is contained in:
parent
fdbe90405c
commit
7a38e83e9f
|
@ -121,6 +121,7 @@
|
|||
// TODO: Messages in msg_content_deleted older than a certain time should be deleted to ensure the protection of personal data
|
||||
// TODO: FIX BUG: A teacher uploads a document in course documents zone, then he/she unregister from course, then he/she search for his/her documents, a document is shown in results but he/she can not view it
|
||||
// TODO: Add Stack Exchange to webs/networks
|
||||
// TODO: Degree in list of notifications should link to internal degree
|
||||
|
||||
// TODO: Modify WS function getUsers changing: userRole to indicate all users, and a new parameter filter (search string (name, @nickname, mail)) to restring number of users
|
||||
// TODO: Add a new WS function to count the nunmber of users to return in call to function getUsers
|
||||
|
@ -129,13 +130,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.231.4 (2016-06-24)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.232 (2016-06-27)"
|
||||
#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.232: Jun 27, 2015 Search any user, independently on role. (203657 lines)
|
||||
Version 15.231.4: Jun 24, 2015 Fix bug (buffer overflow) when getting users. (203474 lines)
|
||||
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)
|
||||
|
|
|
@ -334,7 +334,7 @@ void Con_ShowGlobalConnectedUsrs (void)
|
|||
extern const char *Txt_session;
|
||||
extern const char *Txt_sessions;
|
||||
extern const char *Txt_user[Usr_NUM_SEXS];
|
||||
extern const char *Txt_users;
|
||||
extern const char *Txt_users[Usr_NUM_SEXS];
|
||||
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
unsigned StdsTotal = Con_GetConnectedStdsTotal ();
|
||||
|
@ -369,7 +369,7 @@ void Con_ShowGlobalConnectedUsrs (void)
|
|||
fprintf (Gbl.F.Out,"%u %s:",
|
||||
UsrsTotal,
|
||||
(UsrsTotal == 1) ? Txt_user[Usr_SEX_UNKNOWN] :
|
||||
Txt_users);
|
||||
Txt_users[Usr_SEX_UNKNOWN]);
|
||||
|
||||
/***** Write total number of students *****/
|
||||
if (StdsTotal)
|
||||
|
|
|
@ -9187,7 +9187,7 @@ void Brw_ShowFileMetadata (void)
|
|||
extern const char *Txt_Identified_views;
|
||||
extern const char *Txt_Public_views;
|
||||
extern const char *Txt_user[Usr_NUM_SEXS];
|
||||
extern const char *Txt_users;
|
||||
extern const char *Txt_users[Usr_NUM_SEXS];
|
||||
extern const char *Txt_Save_file_properties;
|
||||
struct FileMetadata FileMetadata;
|
||||
struct UsrData PublisherUsrDat;
|
||||
|
@ -9487,7 +9487,7 @@ void Brw_ShowFileMetadata (void)
|
|||
FileMetadata.NumViewsFromLoggedUsrs,
|
||||
FileMetadata.NumLoggedUsrs,
|
||||
(FileMetadata.NumLoggedUsrs == 1) ? Txt_user[Usr_SEX_UNKNOWN] :
|
||||
Txt_users);
|
||||
Txt_users[Usr_SEX_UNKNOWN]);
|
||||
|
||||
/***** Write number of public views *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
|
|
@ -209,6 +209,7 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Sco
|
|||
extern const char *Txt_centres;
|
||||
extern const char *Txt_degrees;
|
||||
extern const char *Txt_courses;
|
||||
extern const char *Txt_users[Usr_NUM_SEXS];
|
||||
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
extern const char *Txt_my_documents;
|
||||
extern const char *Txt_documents_in_my_courses;
|
||||
|
@ -221,6 +222,7 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Sco
|
|||
Txt_centres, // Sch_SEARCH_CENTRES
|
||||
Txt_degrees, // Sch_SEARCH_DEGREES
|
||||
Txt_courses, // Sch_SEARCH_COURSES
|
||||
Txt_users[Usr_SEX_UNKNOWN], // Sch_SEARCH_USERS
|
||||
Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_UNKNOWN], // Sch_SEARCH_TEACHERS
|
||||
Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_UNKNOWN], // Sch_SEARCH_STUDENTS
|
||||
Txt_ROLES_PLURAL_abc[Rol__GUEST_][Usr_SEX_UNKNOWN], // Sch_SEARCH_GUESTS
|
||||
|
@ -296,6 +298,7 @@ static bool Sch_CheckIfIHavePermissionToSearch (Sch_WhatToSearch_t WhatToSearch)
|
|||
0x1FF, // Sch_SEARCH_CENTRES
|
||||
0x1FF, // Sch_SEARCH_DEGREES
|
||||
0x1FF, // Sch_SEARCH_COURSES
|
||||
0x1FF, // Sch_SEARCH_USERS
|
||||
0x1FF, // Sch_SEARCH_TEACHERS
|
||||
0x1FF, // Sch_SEARCH_STUDENTS
|
||||
0x1FF, // Sch_SEARCH_GUESTS
|
||||
|
@ -627,6 +630,9 @@ static void Sch_SearchInDB (void)
|
|||
case Sch_SEARCH_COURSES:
|
||||
NumResults = Sch_SearchCoursesInDB (RangeQuery);
|
||||
break;
|
||||
case Sch_SEARCH_USERS:
|
||||
NumResults = Sch_SearchUsrsInDB (Rol_UNKNOWN); // Here Rol_UNKNOWN means any user
|
||||
break;
|
||||
case Sch_SEARCH_TEACHERS:
|
||||
NumResults = Sch_SearchUsrsInDB (Rol_TEACHER);
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
/******************************** Public types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Sch_NUM_WHAT_TO_SEARCH 11
|
||||
#define Sch_NUM_WHAT_TO_SEARCH 12
|
||||
typedef enum
|
||||
{
|
||||
Sch_SEARCH_ALL = 0,
|
||||
|
@ -45,12 +45,13 @@ typedef enum
|
|||
Sch_SEARCH_CENTRES = 2,
|
||||
Sch_SEARCH_DEGREES = 3,
|
||||
Sch_SEARCH_COURSES = 4,
|
||||
Sch_SEARCH_TEACHERS = 5,
|
||||
Sch_SEARCH_STUDENTS = 6,
|
||||
Sch_SEARCH_GUESTS = 7,
|
||||
Sch_SEARCH_OPEN_DOCUMENTS = 8,
|
||||
Sch_SEARCH_DOCUM_IN_MY_COURSES = 9,
|
||||
Sch_SEARCH_MY_DOCUMENTS = 10,
|
||||
Sch_SEARCH_USERS = 5,
|
||||
Sch_SEARCH_TEACHERS = 6,
|
||||
Sch_SEARCH_STUDENTS = 7,
|
||||
Sch_SEARCH_GUESTS = 8,
|
||||
Sch_SEARCH_OPEN_DOCUMENTS = 9,
|
||||
Sch_SEARCH_DOCUM_IN_MY_COURSES = 10,
|
||||
Sch_SEARCH_MY_DOCUMENTS = 11,
|
||||
} Sch_WhatToSearch_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
82
swad_text.c
82
swad_text.c
|
@ -49433,26 +49433,88 @@ const char *Txt_Users =
|
|||
"Utilizadores";
|
||||
#endif
|
||||
|
||||
const char *Txt_users =
|
||||
const char *Txt_users[Usr_NUM_SEXS] =
|
||||
{ // Usr_SEX_UNKNOWN
|
||||
#if L==1
|
||||
"usuaris";
|
||||
"usuaris"
|
||||
#elif L==2
|
||||
"Benutzer";
|
||||
"Benutzer"
|
||||
#elif L==3
|
||||
"users";
|
||||
"users"
|
||||
#elif L==4
|
||||
"usuarios";
|
||||
"usuarios"
|
||||
#elif L==5
|
||||
"utilisateurs";
|
||||
"utilisateurs"
|
||||
#elif L==6
|
||||
"puruhára";
|
||||
"puruhára"
|
||||
#elif L==7
|
||||
"utenti";
|
||||
"utenti"
|
||||
#elif L==8
|
||||
"użytkownicy";
|
||||
"użytkownicy"
|
||||
#elif L==9
|
||||
"utilizadores";
|
||||
"utilizadores"
|
||||
#endif
|
||||
, // Usr_SEX_FEMALE
|
||||
#if L==1
|
||||
"usuarias"
|
||||
#elif L==2
|
||||
"Benutzer"
|
||||
#elif L==3
|
||||
"users"
|
||||
#elif L==4
|
||||
"usuarias"
|
||||
#elif L==5
|
||||
"utilisateuses"
|
||||
#elif L==6
|
||||
"usuarias" // Okoteve traducción
|
||||
#elif L==7
|
||||
"utenti"
|
||||
#elif L==8
|
||||
"użytkownicy"
|
||||
#elif L==9
|
||||
"utilizadoras"
|
||||
#endif
|
||||
, // Usr_SEX_MALE
|
||||
#if L==1
|
||||
"usuaris"
|
||||
#elif L==2
|
||||
"Benutzer"
|
||||
#elif L==3
|
||||
"users"
|
||||
#elif L==4
|
||||
"usuarios"
|
||||
#elif L==5
|
||||
"utilisateurs"
|
||||
#elif L==6
|
||||
"puruhára"
|
||||
#elif L==7
|
||||
"utenti"
|
||||
#elif L==8
|
||||
"użytkownicy"
|
||||
#elif L==9
|
||||
"utilizadores"
|
||||
#endif
|
||||
, // Usr_SEX_ALL
|
||||
#if L==1
|
||||
"usuaris"
|
||||
#elif L==2
|
||||
"Benutzer"
|
||||
#elif L==3
|
||||
"users"
|
||||
#elif L==4
|
||||
"usuarios"
|
||||
#elif L==5
|
||||
"utilisateurs"
|
||||
#elif L==6
|
||||
"puruhára"
|
||||
#elif L==7
|
||||
"utenti"
|
||||
#elif L==8
|
||||
"użytkownicy"
|
||||
#elif L==9
|
||||
"utilizadores"
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_X_users_have_been_eliminated = // Warning: it is very important to include %u in the following sentences
|
||||
#if L==1
|
||||
|
|
120
swad_user.c
120
swad_user.c
|
@ -3814,7 +3814,108 @@ static void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
// else ==> 2 columns are retrieved: UsrCod, Sex
|
||||
// Search is faster (aproximately x2) using temporary tables
|
||||
|
||||
if (Role == Rol__GUEST_) // Guests (scope is not used)
|
||||
switch (Role)
|
||||
{
|
||||
case Rol_UNKNOWN: // Here Rol_UNKNOWN means any rol (role does not matter)
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
/* Search users from the whole platform */
|
||||
sprintf (Query,"SELECT DISTINCT candidate_users.UsrCod,usr_data.Sex"
|
||||
" FROM candidate_users,usr_data"
|
||||
" WHERE candidate_users.UsrCod=usr_data.UsrCod"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod");
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
/* Search users in courses from the current country */
|
||||
sprintf (Query,"SELECT DISTINCT candidate_users.UsrCod,usr_data.Sex"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,institutions,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod='%ld'"
|
||||
" AND candidate_users.UsrCod=usr_data.UsrCod"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
/* Search users in courses from the current institution */
|
||||
sprintf (Query,"SELECT DISTINCT candidate_users.UsrCod,usr_data.Sex"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,centres,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod='%ld'"
|
||||
" AND candidate_users.UsrCod=usr_data.UsrCod"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
/* Search users in courses from the current centre */
|
||||
sprintf (Query,"SELECT DISTINCT candidate_users.UsrCod,usr_data.Sex"
|
||||
" FROM candidate_users,crs_usr,courses,degrees,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod='%ld'"
|
||||
" AND candidate_users.UsrCod=usr_data.UsrCod"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
/* Search users in courses from the current degree */
|
||||
sprintf (Query,"SELECT DISTINCT candidate_users.UsrCod,usr_data.Sex"
|
||||
" FROM candidate_users,crs_usr,courses,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
" AND courses.DegCod='%ld'"
|
||||
" AND candidate_users.UsrCod=usr_data.UsrCod"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
/* Search users in courses from the current course */
|
||||
sprintf (Query,"SELECT DISTINCT candidate_users.UsrCod,usr_data.Sex,crs_usr.Accepted"
|
||||
" FROM candidate_users,crs_usr,usr_data"
|
||||
" WHERE candidate_users.UsrCod=crs_usr.UsrCod"
|
||||
" AND crs_usr.CrsCod='%ld'"
|
||||
" AND candidate_users.UsrCod=usr_data.UsrCod"
|
||||
" ORDER BY "
|
||||
"usr_data.Surname1,"
|
||||
"usr_data.Surname2,"
|
||||
"usr_data.FirstName,"
|
||||
"usr_data.UsrCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Rol__GUEST_: // Guests (scope is not used)
|
||||
/* Search users with no courses */
|
||||
switch (Gbl.Usrs.Me.LoggedRole)
|
||||
{
|
||||
|
@ -3861,7 +3962,9 @@ static void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
Pri_VisibilityDB[Pri_VISIBILITY_WORLD ]);
|
||||
break;
|
||||
}
|
||||
else // Students / Teachers
|
||||
break;
|
||||
case Rol_STUDENT:
|
||||
case Rol_TEACHER:
|
||||
/*
|
||||
To achieve maximum speed, it's important to do the things in this order:
|
||||
1) Search for user's name (UsrQuery) getting candidate users
|
||||
|
@ -4485,6 +4588,11 @@ static void Usr_SearchListUsrs (Rol_Role_t Role)
|
|||
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong role.");
|
||||
break;
|
||||
}
|
||||
|
||||
// if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
||||
// Lay_ShowAlert (Lay_INFO,Query);
|
||||
|
@ -6308,6 +6416,8 @@ void Usr_ListAllDataTchs (void)
|
|||
|
||||
unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
|
||||
{
|
||||
extern const char *Txt_user[Usr_NUM_SEXS];
|
||||
extern const char *Txt_users[Usr_NUM_SEXS];
|
||||
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||
|
@ -6331,8 +6441,10 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
|
|||
/* Number of users found */
|
||||
Sex = Usr_GetSexOfUsrsLst (Role);
|
||||
sprintf (Gbl.Title,"%u %s",
|
||||
NumUsrs,(NumUsrs == 1) ? Txt_ROLES_SINGUL_abc[Role][Sex] :
|
||||
Txt_ROLES_PLURAL_abc[Role][Sex]);
|
||||
NumUsrs,(Role == Rol_UNKNOWN) ? ((NumUsrs == 1) ? Txt_user[Sex] :
|
||||
Txt_users[Sex]) :
|
||||
((NumUsrs == 1) ? Txt_ROLES_SINGUL_abc[Role][Sex] :
|
||||
Txt_ROLES_PLURAL_abc[Role][Sex]));
|
||||
Lay_StartRoundFrameTable (NULL,2,Gbl.Title);
|
||||
|
||||
/***** Heading row with column names *****/
|
||||
|
|
Loading…
Reference in New Issue