Version 23.48.3: Nov 27, 2023 Code refactoring in notices.

This commit is contained in:
acanas 2023-11-27 13:06:18 +01:00
parent 80d9469763
commit 831fdf5d1f
4 changed files with 47 additions and 5398 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3036,13 +3036,13 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
overflow:hidden; overflow:hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
color:#808080; color:#808080;
font-size:12pt; font-size:14pt;
font-weight:bold; font-weight:bold;
} }
.REC_NICK .REC_NICK
{ {
color:#808080; color:#808080;
font-size:12pt; font-size:13pt;
font-weight:bold; font-weight:bold;
} }
@ -3126,7 +3126,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
.REC_NICK .REC_NICK
{ {
color:#808080; color:#808080;
font-size:13pt; font-size:14pt;
font-weight:bold; font-weight:bold;
} }

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.48.2 (2023-11-26)" #define Log_PLATFORM_VERSION "SWAD 23.48.3 (2023-11-27)"
#define CSS_FILE "swad23.48.2.css" #define CSS_FILE "swad23.48.2.css"
#define JS_FILE "swad23.47.3.js" #define JS_FILE "swad23.47.3.js"
/* /*
Version 23.48.3: Nov 27, 2023 Code refactoring in notices. (335746 lines)
Version 23.48.2: Nov 26, 2023 Responsive design in program. (335738 lines) Version 23.48.2: Nov 26, 2023 Responsive design in program. (335738 lines)
Version 23.48.1: Nov 26, 2023 Responsive design in record cards. (335693 lines) Version 23.48.1: Nov 26, 2023 Responsive design in record cards. (335693 lines)
Version 23.48: Nov 23, 2023 Responsive design in record cards. (335777 lines) Version 23.48: Nov 23, 2023 Responsive design in record cards. (335777 lines)

View File

@ -82,6 +82,8 @@ static const unsigned Not_MaxCharsURLOnScreen[Not_NUM_TYPES_LISTING] =
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Not_PutLinkToRSSFile (void);
static bool Not_CheckIfICanEditNotices (void); static bool Not_CheckIfICanEditNotices (void);
static void Not_PutIconsListNotices (__attribute__((unused)) void *Args); static void Not_PutIconsListNotices (__attribute__((unused)) void *Args);
static void Not_PutIconToAddNewNotice (void); static void Not_PutIconToAddNewNotice (void);
@ -316,47 +318,44 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod)
extern const char *Txt_No_notices; extern const char *Txt_No_notices;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
char StrWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 2 + 1]; char StrWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 2 + 1];
char PathRelRSSFile[PATH_MAX + 1];
struct Not_Notice Notice; struct Not_Notice Notice;
unsigned NumNot; unsigned NumNot;
unsigned NumNotices = 0; // Initialized to avoid warning unsigned NumNotices = 0; // Initialized to avoid warning
char RSSLink[Cns_MAX_BYTES_WWW + 1];
/***** Trivial check *****/ /***** Trivial check *****/
if (Gbl.Hierarchy.Level != Hie_CRS) // No course selected if (Gbl.Hierarchy.Level != Hie_CRS) // No course selected
return; return;
/***** Get notices from database *****/
switch (TypeNoticesListing) switch (TypeNoticesListing)
{ {
case Not_LIST_BRIEF_NOTICES: case Not_LIST_BRIEF_NOTICES:
/***** Get notices from database *****/
NumNotices = Not_DB_GetActiveNotices (&mysql_res,Gbl.Hierarchy.Node[Hie_CRS].HieCod); NumNotices = Not_DB_GetActiveNotices (&mysql_res,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
break; break;
case Not_LIST_FULL_NOTICES: case Not_LIST_FULL_NOTICES:
/***** Get notices from database *****/
NumNotices = Not_DB_GetAllNotices (&mysql_res); NumNotices = Not_DB_GetAllNotices (&mysql_res);
/***** Begin box *****/
snprintf (StrWidth,sizeof (StrWidth),"%upx",
Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50);
Box_BoxBegin (StrWidth,Txt_Notices,
Not_PutIconsListNotices,NULL,
Hlp_COMMUNICATION_Notices,Box_NOT_CLOSABLE);
if (!NumNotices)
Ale_ShowAlert (Ale_INFO,Txt_No_notices);
break; break;
} }
if (TypeNoticesListing == Not_LIST_FULL_NOTICES) /***** Show notices *****/
{
/***** Begin box *****/
snprintf (StrWidth,sizeof (StrWidth),"%upx",
Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50);
Box_BoxBegin (StrWidth,Txt_Notices,
Not_PutIconsListNotices,NULL,
Hlp_COMMUNICATION_Notices,Box_NOT_CLOSABLE);
if (!NumNotices)
Ale_ShowAlert (Ale_INFO,Txt_No_notices);
}
/***** Show the notices *****/
for (NumNot = 0; for (NumNot = 0;
NumNot < NumNotices; NumNot < NumNotices;
NumNot++) NumNot++)
{ {
/* Get notice data */
Not_GetNoticeDataFromRow (mysql_res,&Notice,TypeNoticesListing); Not_GetNoticeDataFromRow (mysql_res,&Notice,TypeNoticesListing);
/* Draw the notice */ /* Draw notice */
Not_DrawANotice (TypeNoticesListing,&Notice, Not_DrawANotice (TypeNoticesListing,&Notice,
(Notice.NotCod == HighlightNotCod)); // Highlighted? (Notice.NotCod == HighlightNotCod)); // Highlighted?
} }
@ -365,20 +364,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod)
{ {
case Not_LIST_BRIEF_NOTICES: case Not_LIST_BRIEF_NOTICES:
/***** Link to RSS file *****/ /***** Link to RSS file *****/
/* Create RSS file if not exists */ Not_PutLinkToRSSFile ();
snprintf (PathRelRSSFile,sizeof (PathRelRSSFile),"%s/%ld/%s/%s",
Cfg_PATH_CRS_PUBLIC,
Gbl.Hierarchy.Node[Hie_CRS].HieCod,Cfg_RSS_FOLDER,Cfg_RSS_FILE);
if (!Fil_CheckIfPathExists (PathRelRSSFile))
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Node[Hie_CRS]);
/* Put a link to the RSS file */
HTM_DIV_Begin ("class=\"CM\"");
RSS_BuildRSSLink (RSSLink,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
HTM_A_Begin ("href=\"%s\" target=\"_blank\"",RSSLink);
Ico_PutIcon ("rss-square.svg",Ico_BLACK,"RSS","ICO16x16");
HTM_A_End ();
HTM_DIV_End ();
break; break;
case Not_LIST_FULL_NOTICES: case Not_LIST_FULL_NOTICES:
/***** End box *****/ /***** End box *****/
@ -393,6 +379,31 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod)
Ntf_DB_MarkNotifsInCrsAsSeen (Ntf_EVENT_NOTICE); Ntf_DB_MarkNotifsInCrsAsSeen (Ntf_EVENT_NOTICE);
} }
/*****************************************************************************/
/****************************** Link to RSS file *****************************/
/*****************************************************************************/
static void Not_PutLinkToRSSFile (void)
{
char PathRelRSSFile[PATH_MAX + 1];
char RSSLink[Cns_MAX_BYTES_WWW + 1];
/***** Create RSS file if not exists *****/
snprintf (PathRelRSSFile,sizeof (PathRelRSSFile),"%s/%ld/%s/%s",
Cfg_PATH_CRS_PUBLIC,
Gbl.Hierarchy.Node[Hie_CRS].HieCod,Cfg_RSS_FOLDER,Cfg_RSS_FILE);
if (!Fil_CheckIfPathExists (PathRelRSSFile))
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Node[Hie_CRS]);
/***** Put a link to the RSS file *****/
HTM_DIV_Begin ("class=\"CM\"");
RSS_BuildRSSLink (RSSLink,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
HTM_A_Begin ("href=\"%s\" target=\"_blank\"",RSSLink);
Ico_PutIcon ("rss-square.svg",Ico_BLACK,"RSS","ICO16x16");
HTM_A_End ();
HTM_DIV_End ();
}
/*****************************************************************************/ /*****************************************************************************/
/*********************** Check if I can edit notices *************************/ /*********************** Check if I can edit notices *************************/
/*****************************************************************************/ /*****************************************************************************/