Version 16.180.1

This commit is contained in:
Antonio Cañas Vargas 2017-04-17 12:19:58 +02:00
parent 2cbfa71475
commit a895afca0a
3 changed files with 130 additions and 90 deletions

View File

@ -214,13 +214,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.180 (2017-04-17)"
#define Log_PLATFORM_VERSION "SWAD 16.180.1 (2017-04-17)"
#define CSS_FILE "swad16.177.css"
#define JS_FILE "swad16.144.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 16.180.1: Apr 17, 2017 New '+' icon in list of thread posts to add a new post. (217558 lines)
Version 16.180: Apr 17, 2017 Code refactoring in forums. (217521 lines)
Version 16.179: Apr 16, 2017 Code refactoring in forums. (217444 lines)
Version 16.178.1: Apr 16, 2017 Code refactoring in forums. (217601 lines)

View File

@ -242,6 +242,7 @@ const Act_Action_t For_ActionsDisPstFor[For_NUM_TYPES_FORUM] =
#define For_ID_FORUM_THREADS_SECTION "forum_threads"
#define For_ID_NEW_THREAD_SECTION "new_thread"
#define For_ID_FORUM_POSTS_SECTION "thread_posts"
#define For_ID_NEW_POST_SECTION "new_post"
// Forum images will be saved with:
// - maximum width of For_IMAGE_SAVED_MAX_HEIGHT
@ -284,9 +285,7 @@ static unsigned For_GetNumMyPstInThr (long ThrCod);
static time_t For_GetThrReadTime (long ThrCod);
static void For_DeleteThrFromReadThrs (long ThrCod);
static void For_ShowThreadPosts (long ThrCod);
static void For_PutIconsForums (void);
static void For_PutIconNewThread (void);
static void For_PutIconNewPost (void);
static void For_ShowAForumPost (struct Forum *WhichForum,struct ForumThread *Thr,unsigned PstNum,long PstCod,
bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1],
@ -299,6 +298,9 @@ static void For_WriteNumberOfPosts (struct Forum *WhichForum,long UsrCod);
static void For_PutParamWhichForum (void);
static void For_PutParamForumOrder (void);
static void For_PutIconsForums (void);
static void For_PutFormWhichForums (void);
static void For_PutParamForumInsCtrDegCrs (void);
@ -331,24 +333,12 @@ static unsigned For_GetNumOfThreadsInForumNewerThan (struct Forum *WhichForum,
static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr);
static unsigned For_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time);
static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted);
static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject);
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail);
static long For_GetThrInMyClipboard (void);
static bool For_CheckIfThrBelongsToForum (long ThrCod,struct Forum *WhichForum);
static void For_MoveThrToCurrentForum (long ThrCod);
static void For_InsertThrInClipboard (long ThrCod);
static void For_RemoveExpiredThrsClipboards (void);
static void For_RemoveThrCodFromThrClipboard (long ThrCod);
static void For_WriteNumberOfThrs (unsigned NumThrs,unsigned NumThrsWithNewPosts);
static void For_WriteNumThrsAndPsts (unsigned NumThrs,unsigned NumThrsWithNewPosts,unsigned NumPosts);
static void For_WriteNumberOfThrs (unsigned NumThrs,unsigned NumThrsWithNewPosts);
static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted);
static void For_PutIconNewThread (void);
static unsigned For_GetNumThrsInForum (struct Forum *WhichForum);
static unsigned For_GetNumPstsInForum (struct Forum *WhichForum);
static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],
long ThrCodHighlighted,
struct Pagination *PaginationThrs);
@ -361,6 +351,17 @@ static long For_GetParamThrCod (void);
static void For_PutHiddenParamPstCod (long PstCod);
static long For_GetParamPstCod (void);
static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject);
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail);
static long For_GetThrInMyClipboard (void);
static bool For_CheckIfThrBelongsToForum (long ThrCod,struct Forum *WhichForum);
static void For_MoveThrToCurrentForum (long ThrCod);
static void For_InsertThrInClipboard (long ThrCod);
static void For_RemoveExpiredThrsClipboards (void);
static void For_RemoveThrCodFromThrClipboard (long ThrCod);
/*****************************************************************************/
/****************************** Enable a forum post **************************/
/*****************************************************************************/
@ -1005,7 +1006,8 @@ static void For_ShowThreadPosts (long ThrCod)
/***** Start frame *****/
fprintf (Gbl.F.Out,"<section id=\"%s\">",For_ID_FORUM_POSTS_SECTION);
sprintf (FrameTitle,"%s: %s",Txt_Thread,Thr.Subject);
Lay_StartRoundFrame (NULL,FrameTitle,NULL,Hlp_SOCIAL_Forums);
Lay_StartRoundFrame (NULL,FrameTitle,For_PutIconNewPost,
Hlp_SOCIAL_Forums);
/***** Get posts of a thread from database *****/
sprintf (Query,"SELECT PstCod,UNIX_TIMESTAMP(CreatTime)"
@ -1119,8 +1121,10 @@ static void For_ShowThreadPosts (long ThrCod)
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
/***** Form to write a new message in the thread *****/
/***** Form to write a new post in the thread *****/
fprintf (Gbl.F.Out,"<section id=\"%s\">",For_ID_NEW_POST_SECTION);
For_WriteFormForumPst (true,ThrCod,LastSubject);
fprintf (Gbl.F.Out,"</section>");
/***** End frame *****/
Lay_EndRoundFrame ();
@ -1128,27 +1132,16 @@ static void For_ShowThreadPosts (long ThrCod)
}
/*****************************************************************************/
/********************** Put contextual icons in forums ***********************/
/*********************** Put icon to write a new post ************************/
/*****************************************************************************/
static void For_PutIconsForums (void)
static void For_PutIconNewPost (void)
{
/***** Put icon to show a figure *****/
Gbl.Stat.FigureType = Sta_FORUMS;
Sta_PutIconToShowFigure ();
}
/*****************************************************************************/
/********************** Put icon to write a new thread ***********************/
/*****************************************************************************/
static void For_PutIconNewThread (void)
{
extern const char *Txt_New_thread;
extern const char *Txt_New_post;
fprintf (Gbl.F.Out,"<a href=\"#%s\" title=\"%s\">",
For_ID_NEW_THREAD_SECTION,Txt_New_thread);
Lay_PutIconWithText ("plus64x64.png",Txt_New_thread,NULL);
For_ID_NEW_POST_SECTION,Txt_New_post);
Lay_PutIconWithText ("plus64x64.png",Txt_New_post,NULL);
fprintf (Gbl.F.Out,"</a>");
}
@ -1718,6 +1711,17 @@ static void For_ShowForumList (void)
Lay_EndRoundFrame ();
}
/*****************************************************************************/
/********************** Put contextual icons in forums ***********************/
/*****************************************************************************/
static void For_PutIconsForums (void)
{
/***** Put icon to show a figure *****/
Gbl.Stat.FigureType = Sta_FORUMS;
Sta_PutIconToShowFigure ();
}
/*****************************************************************************/
/*************** Put form to select which forums I want to see ***************/
/*****************************************************************************/
@ -2348,6 +2352,62 @@ static unsigned For_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time)
return (unsigned) DB_QueryCOUNT (Query,"can not check if there are new posts in a thread of a forum");
}
/*****************************************************************************/
/*************** Get and write total number of threads and posts *************/
/*****************************************************************************/
static void For_WriteNumThrsAndPsts (unsigned NumThrs,unsigned NumThrsWithNewPosts,unsigned NumPosts)
{
extern const char *Txt_thread;
extern const char *Txt_threads;
extern const char *Txt_post;
extern const char *Txt_posts;
extern const char *Txt_with_new_posts;
/***** Write number of threads and number of posts *****/
fprintf (Gbl.F.Out," [");
if (NumThrs == 1)
{
fprintf (Gbl.F.Out,"1 %s",Txt_thread);
if (NumThrsWithNewPosts)
fprintf (Gbl.F.Out,", 1 %s",Txt_with_new_posts);
fprintf (Gbl.F.Out,"; ");
if (NumPosts == 1)
fprintf (Gbl.F.Out,"1 %s",Txt_post);
else
fprintf (Gbl.F.Out,"%u %s",NumPosts,Txt_posts);
}
else
{
fprintf (Gbl.F.Out,"%u %s",NumThrs,Txt_threads);
if (NumThrsWithNewPosts)
fprintf (Gbl.F.Out,", %u %s",NumThrsWithNewPosts,Txt_with_new_posts);
fprintf (Gbl.F.Out,"; %u %s",NumPosts,Txt_posts);
}
fprintf (Gbl.F.Out,"]");
}
/*****************************************************************************/
/************** Get and write total number of threads and posts **************/
/*****************************************************************************/
static void For_WriteNumberOfThrs (unsigned NumThrs,unsigned NumThrsWithNewPosts)
{
extern const char *Txt_thread;
extern const char *Txt_threads;
extern const char *Txt_with_new_posts;
/***** Write number of threads and number of posts *****/
fprintf (Gbl.F.Out," [");
if (NumThrs == 1)
fprintf (Gbl.F.Out,"1 %s",Txt_thread);
else
fprintf (Gbl.F.Out,"%u %s",NumThrs,Txt_threads);
if (NumThrsWithNewPosts)
fprintf (Gbl.F.Out,", %u %s",NumThrsWithNewPosts,Txt_with_new_posts);
fprintf (Gbl.F.Out,"]");
}
/*****************************************************************************/
/********************** Show available threads of a forum ********************/
/*****************************************************************************/
@ -2546,7 +2606,7 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted)
&PaginationThrs);
}
/***** Put a form to write the first message of a new thread *****/
/***** Put a form to write the first post of a new thread *****/
fprintf (Gbl.F.Out,"<section id=\"%s\">",For_ID_NEW_THREAD_SECTION);
For_WriteFormForumPst (false,-1,NULL);
fprintf (Gbl.F.Out,"</section>");
@ -2557,59 +2617,17 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted)
}
/*****************************************************************************/
/************** Get and write total number of threads and posts **************/
/********************** Put icon to write a new thread ***********************/
/*****************************************************************************/
static void For_WriteNumberOfThrs (unsigned NumThrs,unsigned NumThrsWithNewPosts)
static void For_PutIconNewThread (void)
{
extern const char *Txt_thread;
extern const char *Txt_threads;
extern const char *Txt_with_new_posts;
extern const char *Txt_New_thread;
/***** Write number of threads and number of posts *****/
fprintf (Gbl.F.Out," [");
if (NumThrs == 1)
fprintf (Gbl.F.Out,"1 %s",Txt_thread);
else
fprintf (Gbl.F.Out,"%u %s",NumThrs,Txt_threads);
if (NumThrsWithNewPosts)
fprintf (Gbl.F.Out,", %u %s",NumThrsWithNewPosts,Txt_with_new_posts);
fprintf (Gbl.F.Out,"]");
}
/*****************************************************************************/
/*************** Get and write total number of threads and posts *************/
/*****************************************************************************/
static void For_WriteNumThrsAndPsts (unsigned NumThrs,unsigned NumThrsWithNewPosts,unsigned NumPosts)
{
extern const char *Txt_thread;
extern const char *Txt_threads;
extern const char *Txt_post;
extern const char *Txt_posts;
extern const char *Txt_with_new_posts;
/***** Write number of threads and number of posts *****/
fprintf (Gbl.F.Out," [");
if (NumThrs == 1)
{
fprintf (Gbl.F.Out,"1 %s",Txt_thread);
if (NumThrsWithNewPosts)
fprintf (Gbl.F.Out,", 1 %s",Txt_with_new_posts);
fprintf (Gbl.F.Out,"; ");
if (NumPosts == 1)
fprintf (Gbl.F.Out,"1 %s",Txt_post);
else
fprintf (Gbl.F.Out,"%u %s",NumPosts,Txt_posts);
}
else
{
fprintf (Gbl.F.Out,"%u %s",NumThrs,Txt_threads);
if (NumThrsWithNewPosts)
fprintf (Gbl.F.Out,", %u %s",NumThrsWithNewPosts,Txt_with_new_posts);
fprintf (Gbl.F.Out,"; %u %s",NumPosts,Txt_posts);
}
fprintf (Gbl.F.Out,"]");
fprintf (Gbl.F.Out,"<a href=\"#%s\" title=\"%s\">",
For_ID_NEW_THREAD_SECTION,Txt_New_thread);
Lay_PutIconWithText ("plus64x64.png",Txt_New_thread,NULL);
fprintf (Gbl.F.Out,"</a>");
}
/*****************************************************************************/

View File

@ -24327,6 +24327,27 @@ const char *Txt_New_plugin =
"Novo plugin";
#endif
const char *Txt_New_post =
#if L==1
"Novo missatge";
#elif L==2
"Neue Nachricht";
#elif L==3
"New post";
#elif L==4
"Nuevo mensaje";
#elif L==5
"Nouveau message";
#elif L==6
"Nuevo mensaje"; // Okoteve traducción
#elif L==7
"Nuovo post";
#elif L==8
"Nowy post";
#elif L==9
"Novo post";
#endif
const char *Txt_New_question =
#if L==1
"Nova pregunta";
@ -29621,13 +29642,13 @@ const char *Txt_Post_X_banned_Click_to_unban_it = // Warning: it is very importa
#if L==1
"Mensaje %u no permitido. Pulse para permitirlo."; // Necessita traduccio
#elif L==2
"Post %u banned. Click to unban it."; // Need Übersetzung
"Post %u banned. Click to unban it."; // Need Übersetzung
#elif L==3
"Post %u banned. Click to unban it.";
#elif L==4
"Mensaje %u no permitido. Pulse para permitirlo.";
#elif L==5
"Post %u banned. Click to unban it."; // Besoin de traduction
"Post %u banned. Click to unban it."; // Besoin de traduction
#elif L==6
"Mensaje %u no permitido. Pulse para permitirlo."; // Okoteve traducción
#elif L==7
@ -29635,7 +29656,7 @@ const char *Txt_Post_X_banned_Click_to_unban_it = // Warning: it is very importa
#elif L==8
"Post %u zakazany.Kliknij, aby to odbanowac.";
#elif L==9
"Post %u banned. Click to unban it."; // Necessita de tradução
"Post %u banned. Click to unban it."; // Necessita de tradução
#endif
const char *Txt_Post_sent =