mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-10 10:45:23 +02:00
Version 15.159.3
This commit is contained in:
parent
29cf976bb8
commit
a9e1f021bb
|
@ -58,11 +58,13 @@ extern struct Globals Gbl;
|
|||
/***************************** Internal prototypes ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Ann_PutIconToAddNewAnnouncement (void);
|
||||
static void Ann_PutButtonToAddNewAnnouncement (void);
|
||||
static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
|
||||
const char *Subject,const char *Content,
|
||||
unsigned Roles,
|
||||
bool ShowAllAnnouncements,
|
||||
bool ICanEditAnnouncements);
|
||||
bool ICanEdit);
|
||||
static void Ann_PutHiddenParamAnnCod (long AnnCod);
|
||||
static long Ann_GetParamAnnCod (void);
|
||||
static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const char *Content);
|
||||
|
@ -73,7 +75,6 @@ static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const cha
|
|||
|
||||
void Ann_ShowAllAnnouncements (void)
|
||||
{
|
||||
extern const char *Txt_New_announcement;
|
||||
extern const char *Txt_Announcements;
|
||||
extern const char *Txt_No_announcements;
|
||||
char Query[256];
|
||||
|
@ -87,19 +88,10 @@ void Ann_ShowAllAnnouncements (void)
|
|||
char Content[Cns_MAX_BYTES_TEXT+1];
|
||||
unsigned UnsignedNum;
|
||||
Ann_Status_t Status;
|
||||
bool ICanEditAnnouncements = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||
|
||||
/***** Put link (form) to create a new announcement *****/
|
||||
if (ICanEditAnnouncements)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||
Lay_PutContextualLink (ActWriAnn,NULL,"plus64x64.png",
|
||||
Txt_New_announcement,Txt_New_announcement);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||
|
||||
/***** Get announcements from database *****/
|
||||
if (ICanEditAnnouncements)
|
||||
if (ICanEdit)
|
||||
/* Select all announcements */
|
||||
sprintf (Query,"SELECT AnnCod,Status,Roles,Subject,Content"
|
||||
" FROM announcements"
|
||||
|
@ -122,10 +114,12 @@ void Ann_ShowAllAnnouncements (void)
|
|||
(unsigned) (1 << Rol_UNKNOWN));
|
||||
NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements");
|
||||
|
||||
if (NumAnnouncements)
|
||||
/***** Start frame *****/
|
||||
Lay_StartRoundFrame ("550px",Txt_Announcements,NULL);
|
||||
else
|
||||
/***** Start frame *****/
|
||||
Lay_StartRoundFrame ("550px",Txt_Announcements,
|
||||
ICanEdit ? Ann_PutIconToAddNewAnnouncement :
|
||||
NULL);
|
||||
|
||||
if (!NumAnnouncements)
|
||||
Lay_ShowAlert (Lay_INFO,Txt_No_announcements);
|
||||
|
||||
/***** Show the announcements *****/
|
||||
|
@ -160,17 +154,45 @@ void Ann_ShowAllAnnouncements (void)
|
|||
|
||||
/* Show the announcement */
|
||||
Ann_DrawAnAnnouncement (AnnCod,Status,Subject,Content,
|
||||
Roles,true,ICanEditAnnouncements);
|
||||
Roles,true,ICanEdit);
|
||||
}
|
||||
|
||||
/***** Button to add new announcement *****/
|
||||
if (ICanEdit)
|
||||
Ann_PutButtonToAddNewAnnouncement ();
|
||||
|
||||
/***** End frame *****/
|
||||
if (NumAnnouncements)
|
||||
Lay_EndRoundFrame ();
|
||||
Lay_EndRoundFrame ();
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Put icon to add a new announcement *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Ann_PutIconToAddNewAnnouncement (void)
|
||||
{
|
||||
extern const char *Txt_New_announcement;
|
||||
|
||||
Lay_PutContextualLink (ActWriAnn,NULL,"plus64x64.png",
|
||||
Txt_New_announcement,NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Put button to add a new announcement ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Ann_PutButtonToAddNewAnnouncement (void)
|
||||
{
|
||||
extern const char *Txt_New_announcement;
|
||||
|
||||
Act_FormStart (ActWriAnn);
|
||||
Lay_PutConfirmButton (Txt_New_announcement);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Show global announcements ************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -239,7 +261,7 @@ static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
|
|||
const char *Subject,const char *Content,
|
||||
unsigned Roles,
|
||||
bool ShowAllAnnouncements,
|
||||
bool ICanEditAnnouncements)
|
||||
bool ICanEdit)
|
||||
{
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
extern const char *Txt_Users;
|
||||
|
@ -275,7 +297,7 @@ static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
|
|||
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"width:500px;\">",
|
||||
ContainerClass[Status]);
|
||||
|
||||
if (ICanEditAnnouncements)
|
||||
if (ICanEdit)
|
||||
{
|
||||
/* Form to remove announcement */
|
||||
Act_FormStart (ActRemAnn);
|
||||
|
|
|
@ -134,13 +134,15 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.159.2 (2016-03-21)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.159.3 (2016-03-21)"
|
||||
#define CSS_FILE "swad15.157.css"
|
||||
#define JS_FILE "swad15.131.3.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 15.159.3: Mar 21, 2016 Icon to add new announcement integrated in frame.
|
||||
Button to add new announcement. (196427 lines)
|
||||
Version 15.159.2: Mar 21, 2016 Button to add new notice. (196410 lines)
|
||||
Version 15.159.1: Mar 21, 2016 Icon to add new notice integrated in frame. (196395 lines)
|
||||
Version 15.159: Mar 21, 2016 Number of sent/received messages integrated in frame title. (196372 lines)
|
||||
|
|
Loading…
Reference in New Issue
Block a user