Version 16.45.3

This commit is contained in:
Antonio Cañas Vargas 2016-10-27 22:26:52 +02:00
parent db4c7737b0
commit 79de994a4b
5 changed files with 49 additions and 35 deletions

View File

@ -154,13 +154,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.45.2 (2016-10-27)"
#define Log_PLATFORM_VERSION "SWAD 16.45.3 (2016-10-27)"
#define CSS_FILE "swad16.32.1.css"
#define JS_FILE "swad15.238.1.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.45.3: Oct 27, 2016 Code refactoring in course forums. (205906 lines)
Version 16.45.2: Oct 27, 2016 Code refactoring related with scopes. (205896 lines)
Version 16.45.1: Oct 27, 2016 Fixed bugs in surveys. (? lines)
Version 16.45: Oct 27, 2016 Changes in database table for surveys. Not finished. (205927 lines)

View File

@ -2244,39 +2244,8 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
sprintf (Query,"DELETE FROM notices WHERE CrsCod='%ld'",CrsCod);
DB_QueryDELETE (Query,"can not remove notices in a course");
/***** Remove all the threads and posts in course forums *****/
/* Remove disabled posts */
sprintf (Query,"DELETE FROM forum_disabled_post"
" USING forum_thread,forum_post,forum_disabled_post"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND forum_thread.Location='%ld'"
" AND forum_thread.ThrCod=forum_post.ThrCod"
" AND forum_post.PstCod=forum_disabled_post.PstCod",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove disabled posts in forums of a course");
/* Remove posts */
sprintf (Query,"DELETE FROM forum_post USING forum_thread,forum_post"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND forum_thread.Location='%ld'"
" AND forum_thread.ThrCod=forum_post.ThrCod",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove posts in forums of a course");
/* Remove threads read */
sprintf (Query,"DELETE FROM forum_thr_read USING forum_thread,forum_thr_read"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND forum_thread.Location='%ld'"
" AND forum_thread.ThrCod=forum_thr_read.ThrCod",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove read threads in forums of a course");
/* Remove threads */
sprintf (Query,"DELETE FROM forum_thread"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND Location='%ld'",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove threads in forums of a course");
/***** Remove all the threads and posts in forums of a course *****/
For_RemoveCrsForums (CrsCod);
/***** Remove all test exams made in the course *****/
Tst_RemoveCrsExams (CrsCod);

View File

@ -4412,3 +4412,45 @@ void For_RemoveUsrFromThrClipboard (long UsrCod)
sprintf (Query,"DELETE FROM forum_thr_clip WHERE UsrCod='%ld'",UsrCod);
DB_QueryDELETE (Query,"can not remove a thread from the clipboard of a user");
}
/*****************************************************************************/
/********** Remove all the threads and posts in forums of a course ***********/
/*****************************************************************************/
void For_RemoveCrsForums (long CrsCod)
{
char Query[512];
/***** Remove disabled posts *****/
sprintf (Query,"DELETE FROM forum_disabled_post"
" USING forum_thread,forum_post,forum_disabled_post"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND forum_thread.Location='%ld'"
" AND forum_thread.ThrCod=forum_post.ThrCod"
" AND forum_post.PstCod=forum_disabled_post.PstCod",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove disabled posts in forums of a course");
/***** Remove posts *****/
sprintf (Query,"DELETE FROM forum_post USING forum_thread,forum_post"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND forum_thread.Location='%ld'"
" AND forum_thread.ThrCod=forum_post.ThrCod",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove posts in forums of a course");
/***** Remove threads read *****/
sprintf (Query,"DELETE FROM forum_thr_read USING forum_thread,forum_thr_read"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND forum_thread.Location='%ld'"
" AND forum_thread.ThrCod=forum_thr_read.ThrCod",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove read threads in forums of a course");
/***** Remove threads *****/
sprintf (Query,"DELETE FROM forum_thread"
" WHERE (forum_thread.ForumType='%u' OR forum_thread.ForumType='%u')"
" AND Location='%ld'",
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove threads in forums of a course");
}

View File

@ -140,4 +140,6 @@ void For_RemoveExpiredThrsClipboards (void);
void For_RemoveThrCodFromThrClipboard (long ThrCod);
void For_RemoveUsrFromThrClipboard (long UsrCod);
void For_RemoveCrsForums (long CrsCod);
#endif

View File

@ -98,7 +98,7 @@ void Svy_RecFormSurvey (void);
bool Svy_CheckIfSvyIsAssociatedToGrp (long SvyCod,long GrpCod);
void Svy_RemoveGroup (long GrpCod);
void Svy_RemoveGroupsOfType (long GrpTypCod);
void Svy_RemoveSurveys (long CrsCod);
void Svy_RemoveSurveys (Sco_Scope_t Scope,long Cod);
void Svy_RequestEditQuestion (void);
void Svy_ReceiveQst (void);