mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-14 20:54:06 +02:00
Version 17.26.7
This commit is contained in:
parent
7d597c4322
commit
2614cfd359
|
@ -268,7 +268,7 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 17.26.6 (2017-11-30)"
|
#define Log_PLATFORM_VERSION "SWAD 17.26.7 (2017-11-30)"
|
||||||
#define CSS_FILE "swad17.25.4.css"
|
#define CSS_FILE "swad17.25.4.css"
|
||||||
#define JS_FILE "swad17.17.1.js"
|
#define JS_FILE "swad17.17.1.js"
|
||||||
|
|
||||||
|
@ -281,9 +281,10 @@ enscript -1 --color --file-align=2 --highlight --line-numbers -o - * > swad17.26
|
||||||
enscript -2 --landscape --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_bn_2_columnas.ps
|
enscript -2 --landscape --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_bn_2_columnas.ps
|
||||||
enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_color_2_columnas.ps
|
enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_color_2_columnas.ps
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf fuente.ps destino.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
Version 17.26.7: Nov 30, 2017 Fixed bug in surveys. (234438 lines)
|
||||||
Version 17.26.6: Nov 30, 2017 Fixed bug in surveys. (234400 lines)
|
Version 17.26.6: Nov 30, 2017 Fixed bug in surveys. (234400 lines)
|
||||||
Version 17.26.5: Nov 26, 2017 Maximum number of columns in class photo changed from 50 to 100. (234391 lines)
|
Version 17.26.5: Nov 26, 2017 Maximum number of columns in class photo changed from 50 to 100. (234391 lines)
|
||||||
Version 17.26.4: Nov 13, 2017 Session expires in 8 hours. (234388 lines)
|
Version 17.26.4: Nov 13, 2017 Session expires in 8 hours. (234388 lines)
|
||||||
|
|
|
@ -64,7 +64,7 @@ const char *Svy_StrAnswerTypesDB[Svy_NUM_ANS_TYPES] =
|
||||||
|
|
||||||
#define Svy_MAX_ANSWERS_PER_QUESTION 10
|
#define Svy_MAX_ANSWERS_PER_QUESTION 10
|
||||||
|
|
||||||
struct SurveyQuestion
|
struct SurveyQuestion // Must be initialized to 0 before using it
|
||||||
{
|
{
|
||||||
long QstCod;
|
long QstCod;
|
||||||
unsigned QstInd;
|
unsigned QstInd;
|
||||||
|
@ -144,12 +144,15 @@ static void Svy_FreeTextChoiceAnswer (struct SurveyQuestion *SvyQst,unsigned Num
|
||||||
|
|
||||||
static unsigned Svy_GetQstIndFromQstCod (long QstCod);
|
static unsigned Svy_GetQstIndFromQstCod (long QstCod);
|
||||||
static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod);
|
static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod);
|
||||||
static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQst);
|
static void Svy_ListSvyQuestions (struct Survey *Svy,
|
||||||
|
struct SurveyQuestion *SvyQst);
|
||||||
static void Svy_PutParamsToEditQuestion (void);
|
static void Svy_PutParamsToEditQuestion (void);
|
||||||
static void Svy_PutIconToAddNewQuestion (void);
|
static void Svy_PutIconToAddNewQuestion (void);
|
||||||
static void Svy_PutButtonToCreateNewQuestion (void);
|
static void Svy_PutButtonToCreateNewQuestion (void);
|
||||||
static void Svy_WriteQstStem (const char *Stem);
|
static void Svy_WriteQstStem (const char *Stem);
|
||||||
static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst,bool PutFormAnswerSurvey);
|
static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
|
||||||
|
struct SurveyQuestion *SvyQst,
|
||||||
|
bool PutFormAnswerSurvey);
|
||||||
static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs);
|
static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs);
|
||||||
|
|
||||||
static void Svy_PutIconToRemoveOneQst (void);
|
static void Svy_PutIconToRemoveOneQst (void);
|
||||||
|
@ -169,6 +172,9 @@ void Svy_SeeAllSurveys (void)
|
||||||
{
|
{
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Svy_GetParamSvyOrder ();
|
Svy_GetParamSvyOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
|
@ -1483,6 +1489,9 @@ void Svy_AskRemSurvey (void)
|
||||||
struct Survey Svy;
|
struct Survey Svy;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Svy_GetParamSvyOrder ();
|
Svy_GetParamSvyOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
|
@ -1520,6 +1529,9 @@ void Svy_RemoveSurvey (void)
|
||||||
struct Survey Svy;
|
struct Survey Svy;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get survey code *****/
|
/***** Get survey code *****/
|
||||||
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
||||||
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
||||||
|
@ -1577,6 +1589,9 @@ void Svy_AskResetSurvey (void)
|
||||||
struct Survey Svy;
|
struct Survey Svy;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Svy_GetParamSvyOrder ();
|
Svy_GetParamSvyOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
|
@ -1629,6 +1644,9 @@ void Svy_ResetSurvey (void)
|
||||||
struct Survey Svy;
|
struct Survey Svy;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get survey code *****/
|
/***** Get survey code *****/
|
||||||
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
||||||
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
||||||
|
@ -1670,6 +1688,9 @@ void Svy_HideSurvey (void)
|
||||||
struct Survey Svy;
|
struct Survey Svy;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get survey code *****/
|
/***** Get survey code *****/
|
||||||
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
||||||
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
||||||
|
@ -1704,6 +1725,9 @@ void Svy_UnhideSurvey (void)
|
||||||
struct Survey Svy;
|
struct Survey Svy;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get survey code *****/
|
/***** Get survey code *****/
|
||||||
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
||||||
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
||||||
|
@ -1767,6 +1791,9 @@ void Svy_RequestCreatOrEditSvy (void)
|
||||||
bool ItsANewSurvey;
|
bool ItsANewSurvey;
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Svy_GetParamSvyOrder ();
|
Svy_GetParamSvyOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
Grp_GetParamWhichGrps ();
|
||||||
|
@ -2074,6 +2101,9 @@ void Svy_RecFormSurvey (void)
|
||||||
unsigned NumUsrsToBeNotifiedByEMail;
|
unsigned NumUsrsToBeNotifiedByEMail;
|
||||||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get the code of the survey *****/
|
/***** Get the code of the survey *****/
|
||||||
ItsANewSurvey = ((NewSvy.SvyCod = Svy_GetParamSvyCod ()) == -1L);
|
ItsANewSurvey = ((NewSvy.SvyCod = Svy_GetParamSvyCod ()) == -1L);
|
||||||
|
|
||||||
|
@ -2559,6 +2589,8 @@ void Svy_RequestEditQuestion (void)
|
||||||
|
|
||||||
/***** Initialize question to zero *****/
|
/***** Initialize question to zero *****/
|
||||||
Svy_InitQst (&SvyQst);
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
|
/***** Initialize text to empty string *****/
|
||||||
Txt[0] = '\0';
|
Txt[0] = '\0';
|
||||||
|
|
||||||
/***** Get survey code *****/
|
/***** Get survey code *****/
|
||||||
|
@ -2877,7 +2909,8 @@ static unsigned Svy_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res)
|
||||||
/******************* Allocate memory for a choice answer *********************/
|
/******************* Allocate memory for a choice answer *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static bool Svy_AllocateTextChoiceAnswer (struct SurveyQuestion *SvyQst,unsigned NumAns)
|
static bool Svy_AllocateTextChoiceAnswer (struct SurveyQuestion *SvyQst,
|
||||||
|
unsigned NumAns)
|
||||||
{
|
{
|
||||||
Svy_FreeTextChoiceAnswer (SvyQst,NumAns);
|
Svy_FreeTextChoiceAnswer (SvyQst,NumAns);
|
||||||
if ((SvyQst->AnsChoice[NumAns].Text = malloc (Svy_MAX_BYTES_ANSWER + 1)) == NULL)
|
if ((SvyQst->AnsChoice[NumAns].Text = malloc (Svy_MAX_BYTES_ANSWER + 1)) == NULL)
|
||||||
|
@ -2936,7 +2969,7 @@ void Svy_ReceiveQst (void)
|
||||||
bool ThereIsEndOfAnswers;
|
bool ThereIsEndOfAnswers;
|
||||||
bool Error = false;
|
bool Error = false;
|
||||||
|
|
||||||
/***** Initialize new question to zero *****/
|
/***** Initialize question to zero *****/
|
||||||
Svy_InitQst (&SvyQst);
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
|
@ -3152,7 +3185,8 @@ static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod)
|
||||||
/************************ List the questions of a survey *********************/
|
/************************ List the questions of a survey *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQst)
|
static void Svy_ListSvyQuestions (struct Survey *Svy,
|
||||||
|
struct SurveyQuestion *SvyQst)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Surveys_questions;
|
extern const char *Hlp_ASSESSMENT_Surveys_questions;
|
||||||
extern const char *Txt_Questions;
|
extern const char *Txt_Questions;
|
||||||
|
@ -3174,7 +3208,8 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
|
||||||
|
|
||||||
/***** Get data of questions from database *****/
|
/***** Get data of questions from database *****/
|
||||||
sprintf (Query,"SELECT QstCod,QstInd,AnsType,Stem"
|
sprintf (Query,"SELECT QstCod,QstInd,AnsType,Stem"
|
||||||
" FROM svy_questions WHERE SvyCod=%ld ORDER BY QstInd",
|
" FROM svy_questions"
|
||||||
|
" WHERE SvyCod=%ld ORDER BY QstInd",
|
||||||
Svy->SvyCod);
|
Svy->SvyCod);
|
||||||
NumQsts = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get data of a question");
|
NumQsts = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get data of a question");
|
||||||
|
|
||||||
|
@ -3366,7 +3401,9 @@ static void Svy_WriteQstStem (const char *Stem)
|
||||||
/************** Get and write the answers of a survey question ***************/
|
/************** Get and write the answers of a survey question ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst,bool PutFormAnswerSurvey)
|
static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
|
||||||
|
struct SurveyQuestion *SvyQst,
|
||||||
|
bool PutFormAnswerSurvey)
|
||||||
{
|
{
|
||||||
unsigned NumAnswers;
|
unsigned NumAnswers;
|
||||||
unsigned NumAns;
|
unsigned NumAns;
|
||||||
|
@ -3531,6 +3568,9 @@ void Svy_RequestRemoveQst (void)
|
||||||
long SvyCod;
|
long SvyCod;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
/* Get survey code */
|
/* Get survey code */
|
||||||
if ((SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
if ((SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
||||||
|
@ -3567,6 +3607,9 @@ void Svy_RemoveQst (void)
|
||||||
long SvyCod;
|
long SvyCod;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
/* Get survey code */
|
/* Get survey code */
|
||||||
if ((SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
if ((SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
||||||
|
@ -3615,6 +3658,9 @@ void Svy_ReceiveSurveyAnswers (void)
|
||||||
struct Survey Svy;
|
struct Survey Svy;
|
||||||
struct SurveyQuestion SvyQst;
|
struct SurveyQuestion SvyQst;
|
||||||
|
|
||||||
|
/***** Initialize question to zero *****/
|
||||||
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/***** Get survey code *****/
|
/***** Get survey code *****/
|
||||||
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
|
||||||
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
Lay_ShowErrorAndExit ("Code of survey is missing.");
|
||||||
|
@ -3660,8 +3706,10 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
|
||||||
SvyCod);
|
SvyCod);
|
||||||
DB_QuerySELECT (Query,&mysql_res,"can not get questions of a survey");
|
DB_QuerySELECT (Query,&mysql_res,"can not get questions of a survey");
|
||||||
|
|
||||||
if ((NumQsts = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get surveys"))) // The survey has questions
|
if ((NumQsts = (unsigned) DB_QuerySELECT (Query,&mysql_res,
|
||||||
|
"can not get surveys")))
|
||||||
{
|
{
|
||||||
|
// This survey has questions
|
||||||
/***** Get questions *****/
|
/***** Get questions *****/
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < NumQsts;
|
NumQst < NumQsts;
|
||||||
|
@ -3684,12 +3732,13 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
|
||||||
{
|
{
|
||||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,10);
|
Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,10);
|
||||||
if (sscanf (UnsignedStr,"%u",&AnsInd) == 1)
|
if (sscanf (UnsignedStr,"%u",&AnsInd) == 1)
|
||||||
// Parameter exists, so user has marked this answer, so store it in database
|
// Parameter exists ==> user has checked this answer
|
||||||
|
// ==> store it in database
|
||||||
Svy_IncreaseAnswerInDB (QstCod,AnsInd);
|
Svy_IncreaseAnswerInDB (QstCod,AnsInd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // The survey has no questions and answers
|
else // This survey has no questions
|
||||||
Lay_ShowErrorAndExit ("Error: this survey has no questions.");
|
Lay_ShowErrorAndExit ("Error: this survey has no questions.");
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -3711,7 +3760,7 @@ static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
|
||||||
sprintf (Query,"UPDATE svy_answers SET NumUsrs=NumUsrs+1"
|
sprintf (Query,"UPDATE svy_answers SET NumUsrs=NumUsrs+1"
|
||||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||||
QstCod,AnsInd);
|
QstCod,AnsInd);
|
||||||
DB_QueryINSERT (Query,"can not register your answer to the survey");
|
DB_QueryUPDATE (Query,"can not register your answer to the survey");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user