Version 15.175.1

This commit is contained in:
Antonio Cañas Vargas 2016-04-03 14:13:20 +02:00
parent 7d9cb81d06
commit f87a296b67
4 changed files with 77 additions and 65 deletions

View File

@ -131,26 +131,24 @@
// TODO: Do not show e-mails of administrators and teachers in lists openly // TODO: Do not show e-mails of administrators and teachers in lists openly
// TODO: Fix bug in marks reported by Francisco Ocaña // TODO: Fix bug in marks reported by Francisco Ocaña
// TODO: Optimize reading of parameters by doing one unique pass creating a dynamic list of parameters and their values
// This is very important when there is a big file in the middle of the list of parameters
// TODO: In Statistics > Degrees, show only degrees with students // TODO: In Statistics > Degrees, show only degrees with students
// TODO: Ask for confirmation when removing a test question? // TODO: Ask for confirmation when removing a test question?
// TODO: Put radio button to remove image when editing one test question // TODO: Fix bug when clicking on Export test questions
// TODO: Put icon to remove image when editing a list of test questions (similar to shuffle icon)
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.175 (2016-04-03)" #define Log_PLATFORM_VERSION "SWAD 15.175.1 (2016-04-03)"
#define CSS_FILE "swad15.173.1.css" #define CSS_FILE "swad15.173.1.css"
#define JS_FILE "swad15.131.3.js" #define JS_FILE "swad15.131.3.js"
// 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.175.2: Apr 03, 2016 Check button to remove image when editing one test question. (? lines)
Version 15.175.1: Apr 03, 2016 Code refactoring related to deleting tests of a course. (197763 lines)
Version 15.175: Apr 03, 2016 Fixed bug when editing a test question. Version 15.175: Apr 03, 2016 Fixed bug when editing a test question.
Lot of code refactoring related to edition of questions. Lot of code refactoring related to edition of questions.
New module swad_image for edition of images. (197754 lines) New module swad_image for edition of images. (197754 lines)

View File

@ -2174,9 +2174,6 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
sprintf (Query,"DELETE FROM crs_info_txt WHERE CrsCod='%ld'",CrsCod); sprintf (Query,"DELETE FROM crs_info_txt WHERE CrsCod='%ld'",CrsCod);
DB_QueryDELETE (Query,"can not remove info of a course"); DB_QueryDELETE (Query,"can not remove info of a course");
/***** Remove all test exams made in course *****/
Tst_RemoveAllExamsMadeInCrs (CrsCod);
/***** Remove exam announcements in the course *****/ /***** Remove exam announcements in the course *****/
/* Mark all exam announcements in the course as deleted */ /* Mark all exam announcements in the course as deleted */
sprintf (Query,"UPDATE exam_announcements SET Status='%u' WHERE CrsCod='%ld'", sprintf (Query,"UPDATE exam_announcements SET Status='%u' WHERE CrsCod='%ld'",
@ -2237,43 +2234,11 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod); For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS,CrsCod);
DB_QueryDELETE (Query,"can not remove threads in forums of a course"); DB_QueryDELETE (Query,"can not remove threads in forums of a course");
/***** Remove tests in the course *****/ /***** Remove all test exams made in the course *****/
/* Remove tests status in the course */ Tst_RemoveCrsExams (CrsCod);
sprintf (Query,"DELETE FROM tst_status WHERE CrsCod='%ld'",CrsCod);
DB_QueryDELETE (Query,"can not remove status of tests of a course");
/* Remove test configuration of the course */ /***** Remove all tests questions in the course *****/
sprintf (Query,"DELETE FROM tst_config WHERE CrsCod='%ld'", Tst_RemoveCrsTests (CrsCod);
CrsCod);
DB_QueryDELETE (Query,"can not remove configuration of tests of a course");
/* Remove associations between test questions and test tags in the course */
sprintf (Query,"DELETE FROM tst_question_tags USING tst_questions,tst_question_tags"
" WHERE tst_questions.CrsCod='%ld'"
" AND tst_questions.QstCod=tst_question_tags.QstCod",
CrsCod);
DB_QueryDELETE (Query,"can not remove tags associated to questions of tests of a course");
/* Remove test tags in the course */
sprintf (Query,"DELETE FROM tst_tags WHERE CrsCod='%ld'",
CrsCod);
DB_QueryDELETE (Query,"can not remove tags of test of a course");
/* Remove test answers in the course */
sprintf (Query,"DELETE FROM tst_answers USING tst_questions,tst_answers"
" WHERE tst_questions.CrsCod='%ld'"
" AND tst_questions.QstCod=tst_answers.QstCod",
CrsCod);
DB_QueryDELETE (Query,"can not remove answers of tests of a course");
/* Remove files with images associated to test questions in the course */
Tst_RemoveImageFilesFromQstsInCrs (CrsCod,
-1L); // All questions in the course
/* Remove test questions in the course */
sprintf (Query,"DELETE FROM tst_questions WHERE CrsCod='%ld'",
CrsCod);
DB_QueryDELETE (Query,"can not remove test questions of a course");
/***** Remove groups in the course *****/ /***** Remove groups in the course *****/
/* Remove all the users in groups in the course */ /* Remove all the users in groups in the course */

View File

@ -4296,23 +4296,20 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
Stem); Stem);
/***** Image *****/ /***** Image *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) fprintf (Gbl.F.Out,"<tr>"
{ "<td class=\"RIGHT_TOP\">"
fprintf (Gbl.F.Out,"<tr>" "<label class=\"%s\">"
"<td class=\"RIGHT_TOP\">" "%s:"
"<label class=\"%s\">" "</label>"
"%s:" "</td>"
"</label>" "<td class=\"LEFT_TOP\">",
"</td>" The_ClassForm[Gbl.Prefs.Theme],
"<td class=\"LEFT_TOP\">", Txt_Image);
The_ClassForm[Gbl.Prefs.Theme], if (Gbl.Test.Image[0])
Txt_Image); Img_ShowImage (Gbl.Test.Image,"TEST_IMG_EDIT_ONE");
if (Gbl.Test.Image[0]) Tst_PutFormToUploadNewQstImage ();
Img_ShowImage (Gbl.Test.Image,"TEST_IMG_EDIT_ONE"); fprintf (Gbl.F.Out,"</td>"
Tst_PutFormToUploadNewQstImage (); "</tr>");
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
/***** Feedback *****/ /***** Feedback *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -7224,11 +7221,11 @@ void Tst_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod)
/******************* Remove all test exams made in a course ******************/ /******************* Remove all test exams made in a course ******************/
/*****************************************************************************/ /*****************************************************************************/
void Tst_RemoveAllExamsMadeInCrs (long CrsCod) void Tst_RemoveCrsExams (long CrsCod)
{ {
char Query[512]; char Query[512];
/***** Remove exams made by the specified user *****/ /***** Remove questions of exams made in the course *****/
sprintf (Query,"DELETE FROM tst_exam_questions" sprintf (Query,"DELETE FROM tst_exam_questions"
" USING tst_exams,tst_exam_questions" " USING tst_exams,tst_exam_questions"
" WHERE tst_exams.CrsCod='%ld'" " WHERE tst_exams.CrsCod='%ld'"
@ -7236,8 +7233,58 @@ void Tst_RemoveAllExamsMadeInCrs (long CrsCod)
CrsCod); CrsCod);
DB_QueryDELETE (Query,"can not remove exams made in a course"); DB_QueryDELETE (Query,"can not remove exams made in a course");
/***** Remove exams made in the course *****/
sprintf (Query,"DELETE FROM tst_exams" sprintf (Query,"DELETE FROM tst_exams"
" WHERE CrsCod='%ld'", " WHERE CrsCod='%ld'",
CrsCod); CrsCod);
DB_QueryDELETE (Query,"can not remove exams made in a course"); DB_QueryDELETE (Query,"can not remove exams made in a course");
} }
/*****************************************************************************/
/******************* Remove all test exams made in a course ******************/
/*****************************************************************************/
void Tst_RemoveCrsTests (long CrsCod)
{
char Query[512];
/***** Remove tests status in the course *****/
sprintf (Query,"DELETE FROM tst_status WHERE CrsCod='%ld'",CrsCod);
DB_QueryDELETE (Query,"can not remove status of tests of a course");
/***** Remove test configuration of the course *****/
sprintf (Query,"DELETE FROM tst_config WHERE CrsCod='%ld'",
CrsCod);
DB_QueryDELETE (Query,"can not remove configuration of tests of a course");
/***** Remove associations between test questions
and test tags in the course *****/
sprintf (Query,"DELETE FROM tst_question_tags"
" USING tst_questions,tst_question_tags"
" WHERE tst_questions.CrsCod='%ld'"
" AND tst_questions.QstCod=tst_question_tags.QstCod",
CrsCod);
DB_QueryDELETE (Query,"can not remove tags associated to questions of tests of a course");
/***** Remove test tags in the course *****/
sprintf (Query,"DELETE FROM tst_tags WHERE CrsCod='%ld'",
CrsCod);
DB_QueryDELETE (Query,"can not remove tags of test of a course");
/***** Remove test answers in the course *****/
sprintf (Query,"DELETE FROM tst_answers USING tst_questions,tst_answers"
" WHERE tst_questions.CrsCod='%ld'"
" AND tst_questions.QstCod=tst_answers.QstCod",
CrsCod);
DB_QueryDELETE (Query,"can not remove answers of tests of a course");
/***** Remove files with images associated
to test questions in the course *****/
Tst_RemoveImageFilesFromQstsInCrs (CrsCod,
-1L); // All questions in the course
/***** Remove test questions in the course *****/
sprintf (Query,"DELETE FROM tst_questions WHERE CrsCod='%ld'",
CrsCod);
DB_QueryDELETE (Query,"can not remove test questions of a course");
}

View File

@ -166,6 +166,8 @@ void Tst_ShowMyTestResults (void);
void Tst_ShowOneTestExam (void); void Tst_ShowOneTestExam (void);
void Tst_RemoveExamsMadeByUsrInAllCrss (long UsrCod); void Tst_RemoveExamsMadeByUsrInAllCrss (long UsrCod);
void Tst_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod); void Tst_RemoveExamsMadeByUsrInCrs (long UsrCod,long CrsCod);
void Tst_RemoveAllExamsMadeInCrs (long CrsCod); void Tst_RemoveCrsExams (long CrsCod);
void Tst_RemoveCrsTests (long CrsCod);
#endif #endif