diff --git a/swad_changelog.h b/swad_changelog.h index 2bef56da4..e18dd005a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -214,13 +214,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.181.4 (2017-04-18)" +#define Log_PLATFORM_VERSION "SWAD 16.181.5 (2017-04-18)" #define CSS_FILE "swad16.181.css" #define JS_FILE "swad16.181.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.181.5: Apr 18, 2017 Code refactoring in forums. (217646 lines) Version 16.181.4: Apr 18, 2017 Changes in layout of forums. (217621 lines) Version 16.181.3: Apr 18, 2017 Code refactoring in forums. (217604 lines) Version 16.181.2: Apr 18, 2017 Code refactoring in forums. (217590 lines) diff --git a/swad_forum.c b/swad_forum.c index 1b181534c..746d07f87 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -239,6 +239,7 @@ const Act_Action_t For_ActionsDisPstFor[For_NUM_TYPES_FORUM] = }; // Links to go to
+#define For_ID_REMOVE_THREAD_SECTION "remove_thread" #define For_ID_FORUM_THREADS_SECTION "forum_threads" #define For_ID_NEW_THREAD_SECTION "new_thread" #define For_ID_FORUM_POSTS_SECTION "thread_posts" @@ -355,6 +356,7 @@ static void For_WriteFormForumPst (bool IsReply,const char *Subject); static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail); +static bool For_CheckIfICanMoveThreads (void); static long For_GetThrInMyClipboard (void); static bool For_CheckIfThrBelongsToForum (long ThrCod,struct Forum *ForumSelected); static void For_MoveThrToCurrentForum (long ThrCod); @@ -376,6 +378,13 @@ void For_EnbPst (void) /***** Delete post from table of disabled posts *****/ For_DeletePstFromDisabledPstTable (Gbl.Forum.ForumSelected.PstCod); + /***** Show forum list again *****/ + For_ShowForumList (); + + /***** Show threads again *****/ + For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, + Lay_SUCCESS,NULL); + /***** Show the posts again *****/ For_ShowThreadPosts (Lay_SUCCESS,Txt_Post_unbanned); } @@ -397,6 +406,13 @@ void For_DisPst (void) /***** Insert post into table of banned posts *****/ For_InsertPstIntoBannedPstTable (Gbl.Forum.ForumSelected.PstCod); + /***** Show forum list again *****/ + For_ShowForumList (); + + /***** Show threads again *****/ + For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, + Lay_SUCCESS,NULL); + /***** Show the posts again *****/ For_ShowThreadPosts (Lay_SUCCESS,Txt_Post_banned); } @@ -965,25 +981,16 @@ static void For_ShowThreadPosts (Lay_AlertType_t AlertType,const char *Message) long PstCod; bool NewPst = false; bool ICanModerateForum = false; - bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads... - - /***** Show threads *****/ - For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, - Lay_SUCCESS,NULL); /***** Get data of the thread *****/ Thr.ThrCod = Gbl.Forum.ForumSelected.ThrCod; For_GetThrData (&Thr); - /***** Get the page number *****/ - Gbl.Forum.CurrentPagePsts = Pag_GetParamPagNum (Pag_POSTS_FORUM); - - /***** Write title *****/ - /* Get if there is a thread ready to be moved */ - if (ICanMoveThreads) + /***** Get if there is a thread ready to be moved *****/ + if (For_CheckIfICanMoveThreads ()) Gbl.Forum.ThreadToMove = For_GetThrInMyClipboard (); - /* Get thread read time for the current user */ + /***** Get thread read time for the current user *****/ ReadTimeUTC = For_GetThrReadTime (Gbl.Forum.ForumSelected.ThrCod); /***** Show alert after action *****/ @@ -1240,7 +1247,7 @@ static void For_ShowAForumPost (struct Forum *ForumSelected, Gbl.Forum.CurrentPagePsts); } For_PutAllHiddenParamsForum (Gbl.Forum.ForumSet, - Gbl.Forum.SelectedOrder, + Gbl.Forum.ThreadsOrder, Gbl.Forum.ForumSelected.Location, Gbl.Forum.ForumSelected.ThrCod, PstCod); @@ -1258,7 +1265,7 @@ static void For_ShowAForumPost (struct Forum *ForumSelected, For_ID_FORUM_POSTS_SECTION); Pag_PutHiddenParamPagNum (Pag_POSTS_FORUM,Gbl.Forum.CurrentPagePsts); For_PutAllHiddenParamsForum (Gbl.Forum.ForumSet, - Gbl.Forum.SelectedOrder, + Gbl.Forum.ThreadsOrder, Gbl.Forum.ForumSelected.Location, Gbl.Forum.ForumSelected.ThrCod, PstCod); @@ -1492,7 +1499,7 @@ static void For_WriteNumberOfPosts (struct Forum *ForumSelected,long UsrCod) static void For_PutAllHiddenParamsSelectedForum (void) { For_PutAllHiddenParamsForum (Gbl.Forum.ForumSet, - Gbl.Forum.SelectedOrder, + Gbl.Forum.ThreadsOrder, Gbl.Forum.ForumSelected.Location, Gbl.Forum.ForumSelected.ThrCod, -1L); @@ -1570,7 +1577,6 @@ static void For_ShowForumList (void) { extern const char *Hlp_SOCIAL_Forums; extern const char *Txt_Forums; - bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]; MYSQL_RES *mysql_resCtr; MYSQL_RES *mysql_resDeg; @@ -1592,7 +1598,7 @@ static void For_ShowForumList (void) bool ICanSeeDegForum; /***** Get if there is a thread ready to be moved *****/ - if (ICanMoveThreads) // If I have permission to move threads... + if (For_CheckIfICanMoveThreads ()) Gbl.Forum.ThreadToMove = For_GetThrInMyClipboard (); /***** Fill the list with the institutions I belong to *****/ @@ -1779,7 +1785,7 @@ static void For_PutFormWhichForums (void) - all my forums - only the forums of current institution/degree/course *****/ Act_FormStart (ActSeeFor); - For_PutParamForumOrder (Gbl.Forum.SelectedOrder); + For_PutParamForumOrder (Gbl.Forum.ThreadsOrder); fprintf (Gbl.F.Out,"
" "