Version 23.51.2: Dec 06, 2023 Responsive design in notifications.

This commit is contained in:
acanas 2023-12-07 00:07:44 +01:00
parent 11468e411c
commit b8c13f58b7
8 changed files with 125 additions and 85 deletions

View File

@ -4362,29 +4362,40 @@ legend {font-size:12pt;}
} }
/********** Author of assignments, attendance, messages, surveys... **********/ /********** Author of assignments, attendance, messages, surveys... **********/
.AUTHOR_1_LINE
{ @media only screen and (max-width: 600px)
display:inline-block; { /* For mobile-phones */
box-sizing:border-box; .AUTHOR_1_LINE, .AUTHOR_2_LINES
max-width:100px; {
height:20px; display:none;
text-align:left; }
vertical-align:middle;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
} }
.AUTHOR_2_LINES @media only screen and (min-width: 600px)
{ { /* For tablets and desktop */
display:inline-block; .AUTHOR_1_LINE
box-sizing:border-box; {
max-width:60px; display:inline-block;
height:40px; box-sizing:border-box;
text-align:left; max-width:100px;
vertical-align:middle; height:20px;
white-space:nowrap; text-align:left;
overflow:hidden; vertical-align:middle;
text-overflow:ellipsis; white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
.AUTHOR_2_LINES
{
display:inline-block;
box-sizing:border-box;
max-width:60px;
height:40px;
text-align:left;
vertical-align:middle;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
} }
/************************** Owner of assignments and works *******************/ /************************** Owner of assignments and works *******************/
@ -4782,6 +4793,29 @@ legend {font-size:12pt;}
width:32px; width:32px;
} }
/********************************* Notifications *****************************/
@media only screen and (max-width: 600px)
{ /* For mobile-phones */
.Ntf_TYPE {display:none;}
.Ntf_LOCATION {
display:inline-block;
max-width:80px;
overflow:hidden;
text-overflow:ellipsis;
text-align:left;
vertical-align:bottom;
}
}
@media only screen and (min-width: 600px)
{ /* For tablets and desktop */
.Ntf_TYPE {display:inline;}
.Ntf_LOCATION {
display:inline-block;
text-align:left;
vertical-align:bottom;
}
}
/************************************ Forum **********************************/ /************************************ Forum **********************************/
.FOR_IMG_CONT .FOR_IMG_CONT
{ {

View File

@ -633,10 +633,11 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/ */
#define Log_PLATFORM_VERSION "SWAD 23.51.1 (2023-12-06)" #define Log_PLATFORM_VERSION "SWAD 23.51.2 (2023-12-06)"
#define CSS_FILE "swad23.50.1.css" #define CSS_FILE "swad23.51.2.css"
#define JS_FILE "swad23.47.3.js" #define JS_FILE "swad23.47.3.js"
/* /*
Version 23.51.2: Dec 06, 2023 Responsive design in notifications. (335778 lines)
Version 23.51.1: Dec 06, 2023 Code refactoring in notifications. (335743 lines) Version 23.51.1: Dec 06, 2023 Code refactoring in notifications. (335743 lines)
Version 23.51: Dec 06, 2023 Code refactoring in notifications and hierarchy. (335718 lines) Version 23.51: Dec 06, 2023 Code refactoring in notifications and hierarchy. (335718 lines)
Version 23.50.1: Nov 28, 2023 Responsive design in announcements and notices. (335630 lines) Version 23.50.1: Nov 28, 2023 Responsive design in announcements and notices. (335630 lines)

View File

@ -303,10 +303,10 @@ void Ico_PutContextualIconToView (Act_Action_t NextAction,const char *Anchor,
"list.svg",Ico_BLACK); "list.svg",Ico_BLACK);
} }
void Ico_PutContextualIconToConfigure (Act_Action_t NextAction, void Ico_PutContextualIconToConfigure (Act_Action_t NextAction,const char *Anchor,
void (*FuncPars) (void *Args),void *Args) void (*FuncPars) (void *Args),void *Args)
{ {
Lay_PutContextualLinkOnlyIcon (NextAction,NULL, Lay_PutContextualLinkOnlyIcon (NextAction,Anchor,
FuncPars,Args, FuncPars,Args,
"cog.svg",Ico_BLACK); "cog.svg",Ico_BLACK);
} }

View File

@ -90,7 +90,7 @@ void Ico_PutContextualIconToViewFiles (Act_Action_t NextAction,
void (*FuncPars) (void *Args),void *Args); void (*FuncPars) (void *Args),void *Args);
void Ico_PutContextualIconToView (Act_Action_t NextAction,const char *Anchor, void Ico_PutContextualIconToView (Act_Action_t NextAction,const char *Anchor,
void (*FuncPars) (void *Args),void *Args); void (*FuncPars) (void *Args),void *Args);
void Ico_PutContextualIconToConfigure (Act_Action_t NextAction, void Ico_PutContextualIconToConfigure (Act_Action_t NextAction,const char *Anchor,
void (*FuncPars) (void *Args),void *Args); void (*FuncPars) (void *Args),void *Args);
void Ico_PutContextualIconToHideUnhide (const Act_Action_t NextAction[HidVis_NUM_HIDDEN_VISIBLE], void Ico_PutContextualIconToHideUnhide (const Act_Action_t NextAction[HidVis_NUM_HIDDEN_VISIBLE],
const char *Anchor, const char *Anchor,

View File

@ -2639,7 +2639,7 @@ void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassTxt,const char *ClassBg)
/***** Write date and time *****/ /***** Write date and time *****/
Dat_WriteLocalDateHMSFromUTC (Id,TimeUTC, Dat_WriteLocalDateHMSFromUTC (Id,TimeUTC,
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA, Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
true,true,false,0x6); true,true,false,0x6);
/***** End cell *****/ /***** End cell *****/

View File

@ -286,9 +286,9 @@ static const char *Ntf_Icons[Ntf_NUM_NOTIFY_EVENTS] =
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ntf_PutContextualLinks (bool AllNotifications,
unsigned NumNotifications);
static void Ntf_PutIconsNotif (__attribute__((unused)) void *Args); static void Ntf_PutIconsNotif (__attribute__((unused)) void *Args);
static void Ntf_WriteFormAllNotifications (bool AllNotifications);
static void Ntf_WriteHeading (void); static void Ntf_WriteHeading (void);
static void Ntf_GetNotif (MYSQL_RES *mysql_res, static void Ntf_GetNotif (MYSQL_RES *mysql_res,
Ntf_NotifyEvent_t *NotifyEvent, Ntf_NotifyEvent_t *NotifyEvent,
@ -328,9 +328,6 @@ static void Ntf_GetParsNotifyEvents (void);
void Ntf_ShowMyNotifications (void) void Ntf_ShowMyNotifications (void)
{ {
extern const char *Hlp_START_Notifications; extern const char *Hlp_START_Notifications;
extern const char *Txt_Mark_all_NOTIFICATIONS_as_read;
extern const char *Txt_Settings;
extern const char *Txt_Domains;
extern const char *Txt_Notifications; extern const char *Txt_Notifications;
extern const char *Txt_You_have_no_notifications; extern const char *Txt_You_have_no_notifications;
extern const char *Txt_You_have_no_unread_notifications; extern const char *Txt_You_have_no_unread_notifications;
@ -350,22 +347,7 @@ void Ntf_ShowMyNotifications (void)
NumNotifications = Ntf_DB_GetMyNotifications (&mysql_res,AllNotifications); NumNotifications = Ntf_DB_GetMyNotifications (&mysql_res,AllNotifications);
/***** Contextual menu *****/ /***** Contextual menu *****/
Mnu_ContextMenuBegin (); Ntf_PutContextualLinks (AllNotifications,NumNotifications);
Ntf_WriteFormAllNotifications (AllNotifications); // Show all notifications
if (NumNotifications) // TODO: Show message only when I don't have notificacions at all
Lay_PutContextualLinkIconText (ActMrkNtfSee,NULL,
NULL,NULL,
"eye.svg",Ico_BLACK,
Txt_Mark_all_NOTIFICATIONS_as_read,NULL); // Mark notifications as read
Lay_PutContextualLinkIconText (ActReqEdiSet,Ntf_NOTIFICATIONS_ID,
NULL,NULL,
"cog.svg",Ico_BLACK,
Txt_Settings,NULL); // Change notification settings
Lay_PutContextualLinkIconText (ActSeeMai,NULL,
NULL,NULL,
"envelope.svg",Ico_BLACK,
Txt_Domains,NULL); // View allowed mail domains
Mnu_ContextMenuEnd ();
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Notifications, Box_BoxBegin (NULL,Txt_Notifications,
@ -417,33 +399,57 @@ void Ntf_ShowMyNotifications (void)
Ntf_DB_UpdateMyLastAccessToNotifications (); Ntf_DB_UpdateMyLastAccessToNotifications ();
} }
/*****************************************************************************/
/*************************** Put contextual links ****************************/
/*****************************************************************************/
static void Ntf_PutContextualLinks (bool AllNotifications,
unsigned NumNotifications)
{
extern const char *Txt_Show_all_notifications;
extern const char *Txt_Show_all_NOTIFICATIONS;
extern const char *Txt_Mark_all_NOTIFICATIONS_as_read;
extern const char *Txt_Domains;
Mnu_ContextMenuBegin ();
/***** Show all notifications *****/
Lay_PutContextualCheckbox (ActSeeNtf,NULL,
"All",
AllNotifications,false,
Txt_Show_all_notifications,
Txt_Show_all_NOTIFICATIONS);
/***** Mark notifications as read *****/
if (NumNotifications) // TODO: Show message only when I don't have notificacions at all
Lay_PutContextualLinkIconText (ActMrkNtfSee,NULL,
NULL,NULL,
"eye.svg",Ico_BLACK,
Txt_Mark_all_NOTIFICATIONS_as_read,NULL);
/***** View allowed mail domains *****/
Lay_PutContextualLinkIconText (ActSeeMai,NULL,
NULL,NULL,
"envelope.svg",Ico_BLACK,
Txt_Domains,NULL);
Mnu_ContextMenuEnd ();
}
/*****************************************************************************/ /*****************************************************************************/
/****************** Put contextual icons in notifications ********************/ /****************** Put contextual icons in notifications ********************/
/*****************************************************************************/ /*****************************************************************************/
static void Ntf_PutIconsNotif (__attribute__((unused)) void *Args) static void Ntf_PutIconsNotif (__attribute__((unused)) void *Args)
{ {
/***** Edit notification settings *****/
Ico_PutContextualIconToConfigure (ActReqEdiSet,Ntf_NOTIFICATIONS_ID,
NULL,NULL);
/***** Put icon to show a figure *****/ /***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_NOTIFY_EVENTS); Fig_PutIconToShowFigure (Fig_NOTIFY_EVENTS);
} }
/*****************************************************************************/
/********** Write a form to select whether show all notifications ************/
/*****************************************************************************/
static void Ntf_WriteFormAllNotifications (bool AllNotifications)
{
extern const char *Txt_Show_all_notifications;
extern const char *Txt_Show_all_NOTIFICATIONS;
Lay_PutContextualCheckbox (ActSeeNtf,
NULL,
"All",
AllNotifications,false,
Txt_Show_all_notifications,
Txt_Show_all_NOTIFICATIONS);
}
/*****************************************************************************/ /*****************************************************************************/
/**************************** Write table heading ****************************/ /**************************** Write table heading ****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -457,11 +463,11 @@ static void Ntf_WriteHeading (void)
extern const char *Txt_Email; extern const char *Txt_Email;
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TH_Span (Txt_Event ,HTM_HEAD_LEFT ,1,2,NULL); HTM_TH_Span (Txt_Event ,HTM_HEAD_LEFT ,1,2,NULL);
HTM_TH (Txt_MSG_From,HTM_HEAD_LEFT ); HTM_TH (Txt_MSG_From,HTM_HEAD_LEFT );
HTM_TH (Txt_Location,HTM_HEAD_LEFT ); HTM_TH (Txt_Location,HTM_HEAD_LEFT );
HTM_TH (Txt_Date ,HTM_HEAD_CENTER); HTM_TH (Txt_Date ,HTM_HEAD_RIGHT);
HTM_TH (Txt_Email ,HTM_HEAD_LEFT ); HTM_TH (Txt_Email ,HTM_HEAD_LEFT );
HTM_TR_End (); HTM_TR_End ();
} }
@ -603,7 +609,7 @@ static void Ntf_WriteNotif (Ntf_NotifyEvent_t NotifyEvent,
switch (PutForm) switch (PutForm)
{ {
case Frm_DONT_PUT_FORM: case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s\"",Class.Txt); HTM_SPAN_Begin ("class=\"Ntf_TYPE %s\"",Class.Txt);
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]); HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_SPAN_End (); HTM_SPAN_End ();
break; break;
@ -611,9 +617,8 @@ static void Ntf_WriteNotif (Ntf_NotifyEvent_t NotifyEvent,
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,UsrDat,Cod,&Forums); Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,UsrDat,Cod,&Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM : PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM; Frm_DONT_PUT_FORM;
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent], HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"", "class=\"Ntf_TYPE LT %s_%s\"",
Class.Link,The_GetSuffix ()); Class.Link,The_GetSuffix ());
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]); HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_BUTTON_End (); HTM_BUTTON_End ();
@ -644,12 +649,12 @@ static void Ntf_WriteNotif (Ntf_NotifyEvent_t NotifyEvent,
switch (PutForm) switch (PutForm)
{ {
case Frm_DONT_PUT_FORM: case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s_%s\"", HTM_DIV_Begin ("class=\"Ntf_LOCATION %s_%s\"",
Class.Txt,The_GetSuffix ()); Class.Txt,The_GetSuffix ());
break; break;
case Frm_PUT_FORM: case Frm_PUT_FORM:
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent], HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"", "class=\"Ntf_LOCATION %s_%s\"",
Class.Link,The_GetSuffix ()); Class.Link,The_GetSuffix ());
break; break;
} }
@ -657,11 +662,11 @@ static void Ntf_WriteNotif (Ntf_NotifyEvent_t NotifyEvent,
For_ResetForums (&Forums); For_ResetForums (&Forums);
For_GetThreadForumTypeAndHieCodOfAPost (Cod,&Forums.Forum); For_GetThreadForumTypeAndHieCodOfAPost (Cod,&Forums.Forum);
For_SetForumName (&Forums.Forum,ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language For_SetForumName (&Forums.Forum,ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
HTM_TxtF ("%s: %s",Txt_Forum,ForumName); HTM_TxtF ("%s: %s",Txt_Forum,ForumName);
switch (PutForm) switch (PutForm)
{ {
case Frm_DONT_PUT_FORM: case Frm_DONT_PUT_FORM:
HTM_SPAN_End (); HTM_DIV_End ();
break; break;
case Frm_PUT_FORM: case Frm_PUT_FORM:
HTM_BUTTON_End (); HTM_BUTTON_End ();
@ -681,12 +686,12 @@ static void Ntf_WriteNotif (Ntf_NotifyEvent_t NotifyEvent,
switch (PutForm) switch (PutForm)
{ {
case Frm_DONT_PUT_FORM: case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s_%s\"", HTM_DIV_Begin ("class=\"Ntf_LOCATION %s_%s\"",
Class.Txt,The_GetSuffix ()); Class.Txt,The_GetSuffix ());
break; break;
case Frm_PUT_FORM: case Frm_PUT_FORM:
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent], HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"", "class=\"Ntf_LOCATION %s_%s\"",
Class.Link,The_GetSuffix ()); Class.Link,The_GetSuffix ());
break; break;
} }
@ -696,7 +701,7 @@ static void Ntf_WriteNotif (Ntf_NotifyEvent_t NotifyEvent,
Level--) Level--)
if (Hie[Level].HieCod > 0) if (Hie[Level].HieCod > 0)
{ {
HTM_TxtF ("%s: %s", HTM_TxtF ("%s: %s",
Txt_HIERARCHY_SINGUL_Abc[Level], Txt_HIERARCHY_SINGUL_Abc[Level],
Hie[Level].ShrtName); Hie[Level].ShrtName);
break; break;
@ -707,7 +712,7 @@ static void Ntf_WriteNotif (Ntf_NotifyEvent_t NotifyEvent,
switch (PutForm) switch (PutForm)
{ {
case Frm_DONT_PUT_FORM: case Frm_DONT_PUT_FORM:
HTM_SPAN_End (); HTM_DIV_End ();
break; break;
case Frm_PUT_FORM: case Frm_PUT_FORM:
HTM_BUTTON_End (); HTM_BUTTON_End ();

View File

@ -1273,7 +1273,7 @@ void Prj_PutIconsListProjects (void *Projects)
/***** Put form to go to configuration of projects *****/ /***** Put form to go to configuration of projects *****/
if (ICanConfigAllProjects) if (ICanConfigAllProjects)
Ico_PutContextualIconToConfigure (ActCfgPrj, Ico_PutContextualIconToConfigure (ActCfgPrj,NULL,
NULL,NULL); NULL,NULL);
/***** Link to get resource link *****/ /***** Link to get resource link *****/

View File

@ -450,7 +450,7 @@ void Tst_PutIconsTests (__attribute__((unused)) void *Args)
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
/***** Put icon to go to test configuration *****/ /***** Put icon to go to test configuration *****/
Ico_PutContextualIconToConfigure (ActCfgTst, Ico_PutContextualIconToConfigure (ActCfgTst,NULL,
NULL,NULL); NULL,NULL);
/***** Put icon to edit tags *****/ /***** Put icon to edit tags *****/