Version18.73.7

This commit is contained in:
Antonio Cañas Vargas 2019-03-12 13:23:46 +01:00
parent cb5cb4297f
commit da510f608d
2 changed files with 108 additions and 72 deletions

View File

@ -422,17 +422,16 @@ Lo de mutear anuncios, en principio prefiero hacer una opci
// Para bloquear/desbloquear se usará un icono candado // Para bloquear/desbloquear se usará un icono candado
// Para preasignado/no preasignado usar otro icono (usuario/usuario tachado, por ej.) // Para preasignado/no preasignado usar otro icono (usuario/usuario tachado, por ej.)
// TODO: Select users individually in action to send email
// TODO: Actualizar ayuda en GitHub, por ejemplo Preferencias ahora es Ajustes. // TODO: Actualizar ayuda en GitHub, por ejemplo Preferencias ahora es Ajustes.
// TODO: Change in usability of Announcements of exams, suggested by Javier Fernández Baldomero. // TODO: Change in usability of Announcements of exams, suggested by Javier Fernández Baldomero.
// TODO: Los usuarios que no tienes permiso para ver su perfil público, se debería mostrar algo, una mínima ficha sin tinmeline o algo así
// TODO: Al pulsar sobre una convocatoria de examen / aviso --> ir a la sección de esa convocatoria/aviso en lugar de mostrarlo repetido y destacado arriba // TODO: Al pulsar sobre una convocatoria de examen / aviso --> ir a la sección de esa convocatoria/aviso en lugar de mostrarlo repetido y destacado arriba
// TODO: Intentar aumentar la velocidad de carga del timeline (comprobar ralentización al mostrar la titulación de cada usuario) // TODO: Intentar aumentar la velocidad de carga del timeline (comprobar ralentización al mostrar la titulación de cada usuario)
// TODO: Poner opción en lista de estudiantes para enviar correo electrónico // TODO: Los usuarios que no tienes permiso para ver su perfil público, se debería mostrar algo, una mínima ficha sin tinmeline o algo así
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
@ -453,10 +452,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.73.6 (2019-03-12)" #define Log_PLATFORM_VERSION "SWAD 18.73.7 (2019-03-12)"
#define CSS_FILE "swad18.68.3.css" #define CSS_FILE "swad18.68.3.css"
#define JS_FILE "swad18.64.js" #define JS_FILE "swad18.64.js"
/* /*
Version 18.73.7: Mar 12, 2019 Code refactoring irelated to list of users and options. (239614 lines)
Version 18.73.6: Mar 12, 2019 Create new email message from list of users. This option will be active when email action allows selecting individual users. (239580 lines) Version 18.73.6: Mar 12, 2019 Create new email message from list of users. This option will be active when email action allows selecting individual users. (239580 lines)
Copy the following icon to icon public directory: Copy the following icon to icon public directory:
sudo cp icon/marker.svg /var/www/html/swad/icon/ sudo cp icon/marker.svg /var/www/html/swad/icon/

View File

@ -236,7 +236,9 @@ static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void);
static void Usr_PutLinkToSeeAdmins (void); static void Usr_PutLinkToSeeAdmins (void);
static void Usr_PutLinkToSeeGuests (void); static void Usr_PutLinkToSeeGuests (void);
static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole); static bool Usr_SetOptionsListUsrsAllowed (Rol_Role_t UsrsRole,
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]);
static void Usr_PutOptionsListUsrs (const bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]);
static void Usr_ShowOneListUsrsOption (Usr_ListUsrsOption_t ListUsrsAction, static void Usr_ShowOneListUsrsOption (Usr_ListUsrsOption_t ListUsrsAction,
const char *Label); const char *Label);
static Usr_ListUsrsOption_t Usr_GetListUsrsOption (Usr_ListUsrsOption_t DefaultAction); static Usr_ListUsrsOption_t Usr_GetListUsrsOption (Usr_ListUsrsOption_t DefaultAction);
@ -7549,7 +7551,8 @@ void Usr_SeeGuests (void)
extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Scope; extern const char *Txt_Scope;
extern const char *Txt_Continue; bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS];
bool PutForm;
/***** Put contextual links *****/ /***** Put contextual links *****/
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
@ -7618,8 +7621,12 @@ void Usr_SeeGuests (void)
-1L, -1L,
-1L); -1L);
/* Set options allowed */
PutForm = Usr_SetOptionsListUsrsAllowed (Rol_GST,ICanChooseOption);
/* Start form */ /* Start form */
Frm_StartForm (ActDoActOnSevGst); if (PutForm)
Frm_StartForm (ActDoActOnSevGst);
/* Start table */ /* Start table */
Tbl_StartTableWide (0); Tbl_StartTableWide (0);
@ -7630,10 +7637,10 @@ void Usr_SeeGuests (void)
case Usr_LIST_AS_CLASS_PHOTO: case Usr_LIST_AS_CLASS_PHOTO:
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
Rol_GST, Rol_GST,
true); // Put checkbox to select users PutForm); // Put checkbox to select users?
break; break;
case Usr_LIST_AS_LISTING: case Usr_LIST_AS_LISTING:
Usr_ListMainDataGsts (true); // Put checkbox to select users Usr_ListMainDataGsts (PutForm); // Put checkbox to select users?
break; break;
default: default:
break; break;
@ -7643,12 +7650,11 @@ void Usr_SeeGuests (void)
Tbl_EndTable (); Tbl_EndTable ();
/***** Which action, show records, follow...? *****/ /***** Which action, show records, follow...? *****/
if (Usr_PutActionsSeveralUsrs (Rol_GST)) if (PutForm)
/* Send button */ {
Btn_PutConfirmButton (Txt_Continue); Usr_PutOptionsListUsrs (ICanChooseOption);
Frm_EndForm ();
/* End form */ }
Frm_EndForm ();
} }
} }
else // Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs == 0 else // Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs == 0
@ -7675,7 +7681,8 @@ void Usr_SeeStudents (void)
extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Scope; extern const char *Txt_Scope;
extern const char *Txt_Continue; bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS];
bool PutForm;
/***** Put contextual links *****/ /***** Put contextual links *****/
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
@ -7779,10 +7786,15 @@ void Usr_SeeStudents (void)
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod : Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
-1L); -1L);
/* Set options allowed */
PutForm = Usr_SetOptionsListUsrsAllowed (Rol_STD,ICanChooseOption);
/* Start form */ /* Start form */
Frm_StartForm (ActDoActOnSevStd); if (PutForm)
Grp_PutParamsCodGrps (); {
Frm_StartForm (ActDoActOnSevStd);
Grp_PutParamsCodGrps ();
}
/* Start table */ /* Start table */
Tbl_StartTableWide (0); Tbl_StartTableWide (0);
@ -7793,10 +7805,10 @@ void Usr_SeeStudents (void)
case Usr_LIST_AS_CLASS_PHOTO: case Usr_LIST_AS_CLASS_PHOTO:
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
Rol_STD, Rol_STD,
true); // Put checkbox to select users PutForm); // Put checkbox to select users?
break; break;
case Usr_LIST_AS_LISTING: case Usr_LIST_AS_LISTING:
Usr_ListMainDataStds (true); // Put checkbox to select users Usr_ListMainDataStds (PutForm); // Put checkbox to select users?
break; break;
default: default:
break; break;
@ -7806,12 +7818,11 @@ void Usr_SeeStudents (void)
Tbl_EndTable (); Tbl_EndTable ();
/***** Which action, show records, follow...? *****/ /***** Which action, show records, follow...? *****/
if (Usr_PutActionsSeveralUsrs (Rol_STD)) if (PutForm)
/* Send button */ {
Btn_PutConfirmButton (Txt_Continue); Usr_PutOptionsListUsrs (ICanChooseOption);
Frm_EndForm ();
/* End form */ }
Frm_EndForm ();
} }
} }
else // Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs == 0 else // Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs == 0
@ -7841,8 +7852,9 @@ void Usr_SeeTeachers (void)
extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Scope; extern const char *Txt_Scope;
extern const char *Txt_Continue;
unsigned NumUsrs; unsigned NumUsrs;
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS];
bool PutForm;
/***** Put contextual links *****/ /***** Put contextual links *****/
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
@ -7946,9 +7958,15 @@ void Usr_SeeTeachers (void)
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod : Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
-1L); -1L);
/* Set options allowed */
PutForm = Usr_SetOptionsListUsrsAllowed (Rol_TCH,ICanChooseOption);
/* Start form */ /* Start form */
Frm_StartForm (ActDoActOnSevTch); if (PutForm)
Grp_PutParamsCodGrps (); {
Frm_StartForm (ActDoActOnSevTch);
Grp_PutParamsCodGrps ();
}
/* Start table */ /* Start table */
Tbl_StartTableWide (0); Tbl_StartTableWide (0);
@ -7960,10 +7978,10 @@ void Usr_SeeTeachers (void)
/* List teachers and non-editing teachers */ /* List teachers and non-editing teachers */
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
Rol_TCH, Rol_TCH,
true); // Put checkbox to select users PutForm); // Put checkbox to select users?
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
Rol_NET, Rol_NET,
true); // Put checkbox to select users PutForm); // Put checkbox to select users?
break; break;
case Usr_LIST_AS_LISTING: case Usr_LIST_AS_LISTING:
/* Initialize field names */ /* Initialize field names */
@ -7971,9 +7989,9 @@ void Usr_SeeTeachers (void)
/* List teachers and non-editing teachers */ /* List teachers and non-editing teachers */
Usr_ListMainDataTchs (Rol_TCH, Usr_ListMainDataTchs (Rol_TCH,
true); // Put checkbox to select users PutForm); // Put checkbox to select users?
Usr_ListMainDataTchs (Rol_NET, Usr_ListMainDataTchs (Rol_NET,
true); // Put checkbox to select users PutForm); // Put checkbox to select users?
break; break;
default: default:
break; break;
@ -7983,12 +8001,11 @@ void Usr_SeeTeachers (void)
Tbl_EndTable (); Tbl_EndTable ();
/***** Which action, show records, follow...? *****/ /***** Which action, show records, follow...? *****/
if (Usr_PutActionsSeveralUsrs (Rol_TCH)) if (PutForm)
/* Send button */ {
Btn_PutConfirmButton (Txt_Continue); Usr_PutOptionsListUsrs (ICanChooseOption);
Frm_EndForm ();
/* End form */ }
Frm_EndForm ();
} }
} }
else // NumUsrs == 0 else // NumUsrs == 0
@ -8010,37 +8027,15 @@ void Usr_SeeTeachers (void)
} }
/*****************************************************************************/ /*****************************************************************************/
/*************** Put different actions to do with several users **************/ /**************** Set allowed options to do with several users ***************/
/*****************************************************************************/ /*****************************************************************************/
// Returns true if at least one action can be shown // Returns true if any option is allowed
static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole) static bool Usr_SetOptionsListUsrsAllowed (Rol_Role_t UsrsRole,
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS])
{ {
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_View_records;
extern const char *Txt_View_homework;
extern const char *Txt_View_attendance;
extern const char *Txt_Send_message;
extern const char *Txt_Create_email_message;
extern const char *Txt_Follow;
extern const char *Txt_Unfollow;
const char *Label[Usr_LIST_USRS_NUM_OPTIONS] =
{
NULL, // Usr_OPTION_UNKNOWN
Txt_View_records, // Usr_OPTION_RECORDS
Txt_View_homework, // Usr_OPTION_HOMEWORK
Txt_View_attendance, // Usr_OPTION_ATTENDANCE
Txt_Send_message, // Usr_OPTION_MESSAGE
Txt_Create_email_message, // Usr_OPTION_EMAIL // TODO: Not activated. Active it when email to users allows selecting individual users
Txt_Follow, // Usr_OPTION_FOLLOW
Txt_Unfollow, // Usr_OPTION_UNFOLLOW
};
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS];
Usr_ListUsrsOption_t Opt; Usr_ListUsrsOption_t Opt;
bool OptionsShown; bool OptionsAllowed;
/***** Get the selected option from form *****/
Gbl.Usrs.Selected.Option = Usr_GetListUsrsOption (Usr_LIST_USRS_DEFAULT_OPTION);
/***** Check which options I can choose *****/ /***** Check which options I can choose *****/
/* Set default (I can not choose options) */ /* Set default (I can not choose options) */
@ -8089,26 +8084,67 @@ static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole)
return false; return false;
} }
/***** Count allowed options *****/
OptionsAllowed = false;
for (Opt = (Usr_ListUsrsOption_t) 1; // Skip unknown option
!OptionsAllowed &&
Opt <= (Usr_ListUsrsOption_t) (Usr_LIST_USRS_NUM_OPTIONS - 1);
Opt++)
if (ICanChooseOption[Opt])
OptionsAllowed = true;
return OptionsAllowed;
}
/*****************************************************************************/
/*************** Put different options to do with several users **************/
/*****************************************************************************/
// Returns true if at least one action can be shown
static void Usr_PutOptionsListUsrs (const bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS])
{
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_View_records;
extern const char *Txt_View_homework;
extern const char *Txt_View_attendance;
extern const char *Txt_Send_message;
extern const char *Txt_Create_email_message;
extern const char *Txt_Follow;
extern const char *Txt_Unfollow;
extern const char *Txt_Continue;
const char *Label[Usr_LIST_USRS_NUM_OPTIONS] =
{
NULL, // Usr_OPTION_UNKNOWN
Txt_View_records, // Usr_OPTION_RECORDS
Txt_View_homework, // Usr_OPTION_HOMEWORK
Txt_View_attendance, // Usr_OPTION_ATTENDANCE
Txt_Send_message, // Usr_OPTION_MESSAGE
Txt_Create_email_message, // Usr_OPTION_EMAIL // TODO: Not activated. Active it when email to users allows selecting individual users
Txt_Follow, // Usr_OPTION_FOLLOW
Txt_Unfollow, // Usr_OPTION_UNFOLLOW
};
Usr_ListUsrsOption_t Opt;
/***** Get the selected option from form *****/
Gbl.Usrs.Selected.Option = Usr_GetListUsrsOption (Usr_LIST_USRS_DEFAULT_OPTION);
/***** Write list of options *****/ /***** Write list of options *****/
/* Start list of options */ /* Start list of options */
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT %s\" style=\"margin:12px;\">", fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT %s\" style=\"margin:12px;\">",
The_ClassFormInBox[Gbl.Prefs.Theme]); The_ClassFormInBox[Gbl.Prefs.Theme]);
/* Show option items */ /* Show option items */
OptionsShown = false;
for (Opt = (Usr_ListUsrsOption_t) 1; // Skip unknown option for (Opt = (Usr_ListUsrsOption_t) 1; // Skip unknown option
Opt <= (Usr_ListUsrsOption_t) (Usr_LIST_USRS_NUM_OPTIONS - 1); Opt <= (Usr_ListUsrsOption_t) (Usr_LIST_USRS_NUM_OPTIONS - 1);
Opt++) Opt++)
if (ICanChooseOption[Opt]) if (ICanChooseOption[Opt])
{
Usr_ShowOneListUsrsOption (Opt,Label[Opt]); Usr_ShowOneListUsrsOption (Opt,Label[Opt]);
OptionsShown = true;
}
/* End list of options */ /* End list of options */
fprintf (Gbl.F.Out,"</ul>"); fprintf (Gbl.F.Out,"</ul>");
return OptionsShown; /***** Put button to confirm *****/
Btn_PutConfirmButton (Txt_Continue);
} }
/*****************************************************************************/ /*****************************************************************************/