Version 15.33.1

This commit is contained in:
Antonio Cañas Vargas 2015-11-01 18:54:10 +01:00
parent fbba451a99
commit 7dba78b2d1
4 changed files with 113 additions and 65 deletions

View File

@ -57,9 +57,9 @@ extern struct Globals Gbl;
/***************************** Internal prototypes ***************************/ /***************************** Internal prototypes ***************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ann_ListAnnouncements (void); static void Ann_DrawAnAnnouncement (long AnnCod,const char *Subject,const char *Content,
static void Ann_ShowAnnouncement (long AnnCod,const char *Subject,const char *Content, unsigned Roles,bool ShowAllAnnouncements,
unsigned Roles,bool ShowAllAnnouncements); bool ICanEditAnnouncements);
static void Ann_PutHiddenParamAnnCod (long AnnCod); static void Ann_PutHiddenParamAnnCod (long AnnCod);
static long Ann_GetParamAnnCod (void); static long Ann_GetParamAnnCod (void);
static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const char *Content); static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const char *Content);
@ -71,25 +71,8 @@ static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const cha
void Ann_ShowAllAnnouncements (void) void Ann_ShowAllAnnouncements (void)
{ {
extern const char *Txt_New_announcement; extern const char *Txt_New_announcement;
extern const char *Txt_All_announcements;
/***** Put link (form) to create a new announcement *****/ extern const char *Txt_No_announcements;
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
{
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Act_PutContextualLink (ActWriAnn,NULL,"new",Txt_New_announcement);
fprintf (Gbl.F.Out,"</div>");
}
/***** List announcements *****/
Ann_ListAnnouncements ();
}
/*****************************************************************************/
/************************** Show global announcements ************************/
/*****************************************************************************/
static void Ann_ListAnnouncements (void)
{
char Query[256]; char Query[256];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -99,12 +82,27 @@ static void Ann_ListAnnouncements (void)
unsigned Roles; unsigned Roles;
char Subject[Cns_MAX_BYTES_SUBJECT+1]; char Subject[Cns_MAX_BYTES_SUBJECT+1];
char Content[Cns_MAX_BYTES_TEXT+1]; char Content[Cns_MAX_BYTES_TEXT+1];
bool ICanEditAnnouncements = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
/***** Select announcements *****/ /***** Put link (form) to create a new announcement *****/
if (ICanEditAnnouncements)
{
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Act_PutContextualLink (ActWriAnn,NULL,"new",Txt_New_announcement);
fprintf (Gbl.F.Out,"</div>");
}
/***** Get announcements from database *****/
sprintf (Query,"SELECT AnnCod,Roles,Subject,Content FROM announcements" sprintf (Query,"SELECT AnnCod,Roles,Subject,Content FROM announcements"
" ORDER BY AnnCod DESC"); " ORDER BY AnnCod DESC");
NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements"); NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements");
if (NumAnnouncements)
/***** Start frame *****/
Lay_StartRoundFrame ("550px",Txt_All_announcements);
else
Lay_ShowAlert (Lay_INFO,Txt_No_announcements);
/***** Show the announcements *****/ /***** Show the announcements *****/
for (NumAnn = 0; for (NumAnn = 0;
NumAnn < NumAnnouncements; NumAnn < NumAnnouncements;
@ -130,8 +128,16 @@ static void Ann_ListAnnouncements (void)
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,50); Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,50);
/* Show the announcement */ /* Show the announcement */
Ann_ShowAnnouncement (AnnCod,Subject,Content,Roles,true); Ann_DrawAnAnnouncement (AnnCod,Subject,Content,Roles,true,
ICanEditAnnouncements);
} }
/***** End frame *****/
if (NumAnnouncements)
Lay_EndRoundFrame ();
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -184,7 +190,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,50); Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,50);
/* Show the announcement */ /* Show the announcement */
Ann_ShowAnnouncement (AnnCod,Subject,Content,0,false); Ann_DrawAnAnnouncement (AnnCod,Subject,Content,0,false,false);
} }
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
@ -195,8 +201,9 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
/****************** Draw an announcement as a yellow note ********************/ /****************** Draw an announcement as a yellow note ********************/
/*****************************************************************************/ /*****************************************************************************/
static void Ann_ShowAnnouncement (long AnnCod,const char *Subject,const char *Content, static void Ann_DrawAnAnnouncement (long AnnCod,const char *Subject,const char *Content,
unsigned Roles,bool ShowAllAnnouncements) unsigned Roles,bool ShowAllAnnouncements,
bool ICanEditAnnouncements)
{ {
extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Users; extern const char *Txt_Users;
@ -210,6 +217,23 @@ static void Ann_ShowAnnouncement (long AnnCod,const char *Subject,const char *Co
fprintf (Gbl.F.Out,"<div class=\"NOTICE_CONTAINER_ACTIVE\"" fprintf (Gbl.F.Out,"<div class=\"NOTICE_CONTAINER_ACTIVE\""
" style=\"width:500px;\">"); " style=\"width:500px;\">");
if (ICanEditAnnouncements)
{
/* Form to remove announcement */
Act_FormStart (ActRemAnn);
Ann_PutHiddenParamAnnCod (AnnCod);
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT ICON_HIGHLIGHT\">"
"<input type=\"image\""
" src=\"%s/delon16x16.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON16x16\" />"
"</div>",
Gbl.Prefs.IconsURL,
Txt_Remove,
Txt_Remove);
Act_FormEnd ();
}
/***** Write the content of the announcement *****/ /***** Write the content of the announcement *****/
fprintf (Gbl.F.Out,"<div class=\"NOTICE_SUBJECT_ACTIVE\">%s</div>", fprintf (Gbl.F.Out,"<div class=\"NOTICE_SUBJECT_ACTIVE\">%s</div>",
Subject); Subject);
@ -238,20 +262,6 @@ static void Ann_ShowAnnouncement (long AnnCod,const char *Subject,const char *Co
fprintf (Gbl.F.Out," %s",Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN]); fprintf (Gbl.F.Out," %s",Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN]);
} }
fprintf (Gbl.F.Out,"</p>"); fprintf (Gbl.F.Out,"</p>");
/* Form to remove announcement */
Act_FormStart (ActRemAnn);
Ann_PutHiddenParamAnnCod (AnnCod);
Act_LinkFormSubmit (Txt_Remove,The_ClassForm[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<img src=\"%s/delon16x16.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON16x16\" />"
" %s</a>",
Gbl.Prefs.IconsURL,
Txt_Remove,
Txt_Remove,
Txt_Remove);
Act_FormEnd ();
} }
else else
{ {

View File

@ -109,11 +109,12 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.33 (2015/11/01)" #define Log_PLATFORM_VERSION "SWAD 15.33.1 (2015/11/01)"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.33.1: Nov 01, 2015 New layout of announcements. (186755 lines)
Version 15.33: Nov 01, 2015 New layout of notices. (186708 lines) Version 15.33: Nov 01, 2015 New layout of notices. (186708 lines)
Version 15.32.2: Oct 31, 2015 Fixed bug in form submit. (186618 lines) Version 15.32.2: Oct 31, 2015 Fixed bug in form submit. (186618 lines)
Version 15.32.1: Oct 31, 2015 Dates in holidays are shown in big-endian. Version 15.32.1: Oct 31, 2015 Dates in holidays are shown in big-endian.

View File

@ -66,12 +66,12 @@ const unsigned Not_MaxCharsURLOnScreen[Not_NUM_TYPES_LISTING] =
/*****************************************************************************/ /*****************************************************************************/
static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
bool ICanEditNotices,
long NotCod, long NotCod,
time_t TimeUTC, time_t TimeUTC,
const char *Content, const char *Content,
long UsrCod, long UsrCod,
Not_Status_t NoticeStatus); Not_Status_t NoticeStatus,
bool ICanEditNotices);
static long Not_InsertNoticeInDB (const char *Content); static long Not_InsertNoticeInDB (const char *Content);
static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail); static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail);
static void Not_PutHiddenParamNotCod (long NotCod); static void Not_PutHiddenParamNotCod (long NotCod);
@ -284,9 +284,9 @@ void Not_ShowANotice (void)
void Not_ShowNotices (Not_Listing_t TypeNoticesListing) void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
{ {
extern const char *Txt_No_notices;
extern const char *Txt_New_notice; extern const char *Txt_New_notice;
extern const char *Txt_All_notices; extern const char *Txt_All_notices;
extern const char *Txt_No_notices;
char Query[512]; char Query[512];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -305,12 +305,9 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
/***** A course must be selected (Gbl.CurrentCrs.Crs.CrsCod > 0) *****/ /***** A course must be selected (Gbl.CurrentCrs.Crs.CrsCod > 0) *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{ {
ICanEditNotices = ( ICanEditNotices = (TypeNoticesListing == Not_LIST_FULL_NOTICES &&
TypeNoticesListing == Not_LIST_FULL_NOTICES &&
(Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
);
if (ICanEditNotices) if (ICanEditNotices)
{ {
@ -352,9 +349,10 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
NoticeStatus = (Not_Status_t) UnsignedNum; NoticeStatus = (Not_Status_t) UnsignedNum;
/* Draw the notice */ /* Draw the notice */
Not_DrawANotice (TypeNoticesListing,ICanEditNotices, Not_DrawANotice (TypeNoticesListing,
Gbl.CurrentCrs.Notices.HighlightNotCod, Gbl.CurrentCrs.Notices.HighlightNotCod,
TimeUTC,Content,UsrCod,NoticeStatus); TimeUTC,Content,UsrCod,NoticeStatus,
ICanEditNotices);
} }
/* Free structure that stores the query result */ /* Free structure that stores the query result */
@ -386,11 +384,10 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
{ {
if (NumNotices) if (NumNotices)
{ {
/***** Start frame *****/
sprintf (StrWidth,"%upx", sprintf (StrWidth,"%upx",
Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50); Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50);
Lay_StartRoundFrameTable (StrWidth,2,Txt_All_notices); Lay_StartRoundFrame (StrWidth,Txt_All_notices);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"CENTER_TOP\">");
} }
else else
Lay_ShowAlert (Lay_INFO,Txt_No_notices); Lay_ShowAlert (Lay_INFO,Txt_No_notices);
@ -449,17 +446,15 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
NoticeStatus = (Not_Status_t) UnsignedNum; NoticeStatus = (Not_Status_t) UnsignedNum;
/* Draw the notice */ /* Draw the notice */
Not_DrawANotice (TypeNoticesListing,ICanEditNotices, Not_DrawANotice (TypeNoticesListing,
NotCod, NotCod,
TimeUTC,Content,UsrCod,NoticeStatus); TimeUTC,Content,UsrCod,NoticeStatus,
ICanEditNotices);
} }
if (TypeNoticesListing == Not_LIST_FULL_NOTICES && NumNotices) if (TypeNoticesListing == Not_LIST_FULL_NOTICES && NumNotices)
{ /***** End frame *****/
fprintf (Gbl.F.Out,"</td>" Lay_EndRoundFrame ();
"</tr>");
Lay_EndRoundFrameTable ();
}
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
@ -476,12 +471,12 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
/*****************************************************************************/ /*****************************************************************************/
static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
bool ICanEditNotices,
long NotCod, long NotCod,
time_t TimeUTC, time_t TimeUTC,
const char *Content, const char *Content,
long UsrCod, long UsrCod,
Not_Status_t NoticeStatus) Not_Status_t NoticeStatus,
bool ICanEditNotices)
{ {
extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_NOTICE_Active_SINGULAR; extern const char *Txt_NOTICE_Active_SINGULAR;
@ -524,7 +519,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
{ {
if (ICanEditNotices) if (ICanEditNotices)
{ {
/* Form to delete notice */ /* Form to remove notice */
Act_FormStart (ActRemNot); Act_FormStart (ActRemNot);
Not_PutHiddenParamNotCod (NotCod); Not_PutHiddenParamNotCod (NotCod);
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT ICON_HIGHLIGHT\">" fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT ICON_HIGHLIGHT\">"

View File

@ -2002,6 +2002,27 @@ const char *Txt_All =
"Tudo"; "Tudo";
#endif #endif
const char *Txt_All_announcements =
#if L==0
"Tots els anuncis";
#elif L==1
"Alle Bekanntmachungen";
#elif L==2
"All announcements";
#elif L==3
"Todos los anuncios";
#elif L==4
"Tous les annonces";
#elif L==5
"Todos los anuncios"; // Okoteve traducción
#elif L==6
"Tutti i annunci";
#elif L==7
"Wszystkie og&lstrok;oszenia";
#elif L==8
"Todos os an&uacute;ncios";
#endif
const char *Txt_all_degrees = const char *Txt_all_degrees =
#if L==0 #if L==0
"Totes les titulacions"; "Totes les titulacions";
@ -22925,6 +22946,27 @@ const char *Txt_No =
"N&atilde;o"; "N&atilde;o";
#endif #endif
const char *Txt_No_announcements =
#if L==0
"No hay anuncis";
#elif L==1
"Keine Bekanntmachungen";
#elif L==2
"No announcements";
#elif L==3
"No hay anuncios";
#elif L==4
"Il n'y a pas d'annonces";
#elif L==5
"No hay anuncios"; // Okoteve traducción
#elif L==6
"Non ci sono annunci";
#elif L==7
"Brak og&lstrok;oszenia";
#elif L==8
"N&atilde;o h&aacute; an&uacute;ncios";
#endif
const char *Txt_No_announcements_of_exams_of_X = // Warning: it is very important to include %s in the following sentences const char *Txt_No_announcements_of_exams_of_X = // Warning: it is very important to include %s in the following sentences
#if L==0 #if L==0
"No hay convocatorias de examen de <strong>%s</strong>."; // Necessita traduccio "No hay convocatorias de examen de <strong>%s</strong>."; // Necessita traduccio