Version 16.2.3

This commit is contained in:
Antonio Cañas Vargas 2016-09-22 22:09:24 +02:00
parent 847d626a47
commit 95adda2536
3 changed files with 60 additions and 27 deletions

View File

@ -135,13 +135,7 @@ static void Acc_ShowFormCheckIfIHaveAccount (void)
extern const char *Txt_ID;
/***** Start frame *****/
Lay_StartRoundFrame (NULL,"Compruebe si ya existe una cuenta para usted",NULL); // TODO: Need translation!!!
/***** Info message *****/
Lay_ShowAlert (Lay_INFO,"Es posible que un profesor o administrador"
" ya haya creado una cuenta para usted."
" Escriba su ID (DNI/cédula)"
" para comprobarlo."); // TODO: Need translation!!!!
Lay_StartRoundFrame (NULL,"Compruebe si ya existe una cuenta vacía asociada a su ID (DNI/cédula)",NULL); // TODO: Need translation!!!
/***** Form to request user's ID for possible account already created *****/
Act_FormStart (ActChkUsrAcc);
@ -165,6 +159,7 @@ static void Acc_ShowFormCheckIfIHaveAccount (void)
void Acc_CheckIfEmptyAccountExists (void)
{
extern const char *Txt_Name;
char NewID[ID_MAX_LENGTH_USR_ID+1];
unsigned NumUsrs;
unsigned NumUsr;
@ -182,7 +177,11 @@ void Acc_CheckIfEmptyAccountExists (void)
/***** Check if there are users with this user's ID *****/
if (ID_CheckIfUsrIDIsValid (NewID))
{
sprintf (Query,"SELECT DISTINCT(usr_IDs.UsrCod) FROM usr_IDs,usr_data"
sprintf (Query,"SELECT usr_data.UsrCod,"
"UPPER(usr_data.FirstName),"
"UPPER(usr_data.Surname1),"
"UPPER(usr_data.Surname2)"
" FROM usr_IDs,usr_data"
" WHERE usr_IDs.UsrID='%s'"
" AND usr_IDs.UsrCod=usr_data.UsrCod"
" AND usr_data.Password=''",
@ -191,39 +190,69 @@ void Acc_CheckIfEmptyAccountExists (void)
if (NumUsrs)
{
/***** Start frame and write message with number of users found *****/
/***** Start frame and write message with number of accounts found *****/
if (NumUsrs == 1)
{
Lay_StartRoundFrame (NULL,"Cuenta encontrada",NULL); // TODO: Need translation!!!
Lay_ShowAlert (Lay_SUCCESS,"Existe una cuenta de usuario vacía asociada a su ID."); // TODO: Need translation!!!
}
Lay_StartRoundFrame (NULL,"1 cuenta vacía asociada a su ID (DNI/cédula)",NULL); // TODO: Need translation!!!
else
{
sprintf (Gbl.Title,"%u cuentas encontradas",
NumUsrs);
sprintf (Gbl.Title,"%u cuentas vacías asociadas a su ID (DNI/cédula)",NumUsrs);
Lay_StartRoundFrame (NULL,Gbl.Title,NULL); // TODO: Need translation!!!
sprintf (Gbl.Message,"Existen %u cuentas vacías asociadas a su ID:", // TODO: Need translation!!!
NumUsrs);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
}
/***** List users found *****/
for (NumUsr = 0;
NumUsr < NumUsrs;
NumUsr++)
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_5\">");
for (NumUsr = 1, Gbl.RowEvenOdd = 0;
NumUsr <= NumUsrs;
NumUsr++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
{
/* Get user's code */
row = mysql_fetch_row (mysql_res);
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
/***** Write number of user in the list *****/
fprintf (Gbl.F.Out,"<tr>"
"<td rowspan=\"2\""
" class=\"USR_LIST_NUM_N RIGHT_TOP COLOR%u\">"
"%u"
"</td>",
Gbl.RowEvenOdd,NumUsr);
fprintf (Gbl.F.Out,"UsrCod = %ld", // TODO: Change this check!!!!!!!!
UsrDat.UsrCod);
fprintf (Gbl.F.Out,"<td class=\"DAT_N LEFT_TOP COLOR%u\">%s: ",
Gbl.RowEvenOdd,Txt_Name);
if (row[1][0] ||
row[2][0] ||
row[3][0])
{
if (row[1][0])
fprintf (Gbl.F.Out,"%c.",row[1][0]);
if (row[2][0])
fprintf (Gbl.F.Out,"%c.",row[2][0]);
if (row[3][0])
fprintf (Gbl.F.Out,"%c.",row[3][0]);
}
else
fprintf (Gbl.F.Out,"?");
fprintf (Gbl.F.Out,"</td>");
/* Button to login with this account */
Lay_PutCreateButton ("Usar cuenta"); // TODO: Need translation!!!
fprintf (Gbl.F.Out,"<td class=\"RIGHT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
Lay_PutCreateButtonInline ("Usar cuenta"); // TODO: Need translation!!!
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/* Courses of this user */
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\" class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
UsrDat.Sex = Usr_SEX_UNKNOWN;
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_TEACHER);
Crs_GetAndWriteCrssOfAUsr (&UsrDat,Rol_STUDENT);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
fprintf (Gbl.F.Out,"</table>");
/***** End frame *****/
Lay_EndRoundFrame ();

View File

@ -139,13 +139,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.2.2 (2016-09-22)"
#define Log_PLATFORM_VERSION "SWAD 16.2.3 (2016-09-22)"
#define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.238.1.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 16.2.3: Sep 22, 2016 Check if an account already exists. Not finished. (204984 lines)
Version 16.2.2: Sep 22, 2016 Fixed bug in photo visibility. (204951 lines)
Version 16.2.1: Sep 22, 2016 Check if an account already exists. Not finished. (204946 lines)
Version 16.2: Sep 22, 2016 New option to check if an account already exists. Not finished. (204901 lines)

View File

@ -3000,6 +3000,7 @@ static long Crs_GetParamOtherCrsCod (void)
void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
{
extern const char *Txt_USER_in_COURSE;
extern const char *Txt_User[Usr_NUM_SEXS];
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Degree;
extern const char *Txt_Year_OF_A_DEGREE;
@ -3035,7 +3036,9 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
Lay_StartRoundFrameTable ("100%",2,NULL);
/* Heading row */
sprintf (Gbl.Title,Txt_USER_in_COURSE,Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
sprintf (Gbl.Title,Txt_USER_in_COURSE,
Role == Rol_UNKNOWN ? Txt_User[Usr_SEX_UNKNOWN] : // Role == Rol_UNKNOWN ==> any role
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
fprintf (Gbl.F.Out,"<tr>"
"<th colspan=\"7\" class=\"LEFT_MIDDLE\">%s:</th>"
"</tr>"