Version 15.64.16

This commit is contained in:
Antonio Cañas Vargas 2015-12-13 21:12:34 +01:00
parent 7dca129734
commit 6133698d19
2 changed files with 37 additions and 50 deletions

View File

@ -117,12 +117,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.64.15 (2015/12/13)" #define Log_PLATFORM_VERSION "SWAD 15.64.16 (2015/12/13)"
#define CSS_FILE "swad15.64.5.css" #define CSS_FILE "swad15.64.5.css"
// 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.64.16: Dec 13, 2015 Code refactoring in contextual links.
Fixed minor bug in surveys. (187012 lines)
Version 15.64.15: Dec 13, 2015 Code refactoring in contextual links. (187025 lines) Version 15.64.15: Dec 13, 2015 Code refactoring in contextual links. (187025 lines)
Version 15.64.14: Dec 13, 2015 Code refactoring in contextual links. (187037 lines) Version 15.64.14: Dec 13, 2015 Code refactoring in contextual links. (187037 lines)
Version 15.64.13: Dec 13, 2015 Code refactoring in contextual links. (187031 lines) Version 15.64.13: Dec 13, 2015 Code refactoring in contextual links. (187031 lines)

View File

@ -137,7 +137,7 @@ 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_WriteParamEditQst (struct SurveyQuestion *SvyQst); static void Svy_WriteParamEditQst (struct SurveyQuestion *SvyQst);
static void Svy_WriteQstStem (const char *Stem); static void Svy_WriteQstStem (const char *Stem);
static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst); 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_ReceiveAndStoreUserAnswersToASurvey (long SvyCod); static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod);
static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd); static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
@ -761,7 +761,8 @@ static void Svy_PutFormsToRemEditOneSvy (long SvyCod,bool Visible)
static void Svy_PutParams (void) static void Svy_PutParams (void)
{ {
Svy_PutParamSvyCod (Gbl.Svys.SvyCodToEdit); if (Gbl.Svys.SvyCodToEdit > 0)
Svy_PutParamSvyCod (Gbl.Svys.SvyCodToEdit);
Att_PutHiddenParamAttOrderType (); Att_PutHiddenParamAttOrderType ();
Grp_PutParamWhichGrps (); Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
@ -1196,17 +1197,15 @@ void Svy_AskRemSurvey (void)
if (!Svy.Status.ICanEdit) if (!Svy.Status.ICanEdit)
Lay_ShowErrorAndExit ("You can not remove this survey."); Lay_ShowErrorAndExit ("You can not remove this survey.");
/***** Button of confirmation of removing *****/
Act_FormStart (ActRemSvy);
Svy_PutParamSvyCod (Svy.SvyCod);
Svy_PutHiddenParamSvyOrderType ();
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
/***** Ask for confirmation of removing *****/ /***** Ask for confirmation of removing *****/
sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_survey_X, sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_survey_X,
Svy.Title); Svy.Title);
Lay_ShowAlert (Lay_WARNING,Gbl.Message); Lay_ShowAlert (Lay_WARNING,Gbl.Message);
/***** Button of confirmation of removing *****/
Gbl.Svys.SvyCodToEdit = Svy.SvyCod;
Act_FormStart (ActRemSvy);
Svy_PutParams ();
Lay_PutRemoveButton (Txt_Remove_survey); Lay_PutRemoveButton (Txt_Remove_survey);
Act_FormEnd (); Act_FormEnd ();
@ -1296,17 +1295,15 @@ void Svy_AskResetSurvey (void)
if (!Svy.Status.ICanEdit) if (!Svy.Status.ICanEdit)
Lay_ShowErrorAndExit ("You can not reset this survey."); Lay_ShowErrorAndExit ("You can not reset this survey.");
/***** Button of confirmation of reset *****/
Act_FormStart (ActRstSvy);
Svy_PutParamSvyCod (Svy.SvyCod);
Svy_PutHiddenParamSvyOrderType ();
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
/***** Ask for confirmation of reset *****/ /***** Ask for confirmation of reset *****/
sprintf (Gbl.Message,Txt_Do_you_really_want_to_reset_the_survey_X, sprintf (Gbl.Message,Txt_Do_you_really_want_to_reset_the_survey_X,
Svy.Title); Svy.Title);
Lay_ShowAlert (Lay_WARNING,Gbl.Message); Lay_ShowAlert (Lay_WARNING,Gbl.Message);
/***** Button of confirmation of reset *****/
Gbl.Svys.SvyCodToEdit = Svy.SvyCod;
Act_FormStart (ActRstSvy);
Svy_PutParams ();
Lay_PutConfirmButton (Txt_Reset_survey); Lay_PutConfirmButton (Txt_Reset_survey);
Act_FormEnd (); Act_FormEnd ();
@ -1501,16 +1498,11 @@ void Svy_RequestCreatOrEditSvy (void)
} }
/***** Start form *****/ /***** Start form *****/
if (ItsANewSurvey) Gbl.Svys.SvyCodToEdit = ItsANewSurvey ? -1L :
Act_FormStart (ActNewSvy); Svy.SvyCod;
else Act_FormStart (ItsANewSurvey ? ActNewSvy :
{ ActChgSvy);
Act_FormStart (ActChgSvy); Svy_PutParams ();
Svy_PutParamSvyCod (Svy.SvyCod);
}
Svy_PutHiddenParamSvyOrderType ();
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
/***** Start frame *****/ /***** Start frame *****/
Lay_StartRoundFrameTable (NULL,2, Lay_StartRoundFrameTable (NULL,2,
@ -2774,7 +2766,6 @@ 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)
{ {
extern const char *The_ClassFormBold[The_NUM_THEMES];
extern const char *Txt_Questions; extern const char *Txt_Questions;
extern const char *Txt_No_INDEX; extern const char *Txt_No_INDEX;
extern const char *Txt_Type; extern const char *Txt_Type;
@ -2792,7 +2783,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
bool Editing = (Gbl.CurrentAct == ActEdiOneSvy || bool Editing = (Gbl.CurrentAct == ActEdiOneSvy ||
Gbl.CurrentAct == ActEdiOneSvyQst || Gbl.CurrentAct == ActEdiOneSvyQst ||
Gbl.CurrentAct == ActRcvSvyQst); Gbl.CurrentAct == ActRcvSvyQst);
bool FormAnswerSurvey = Svy->Status.ICanAnswer && !Editing; bool PutFormAnswerSurvey = Svy->Status.ICanAnswer && !Editing;
/***** 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"
@ -2800,7 +2791,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
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");
if (FormAnswerSurvey) if (PutFormAnswerSurvey)
{ {
/***** Start form to send answers to survey *****/ /***** Start form to send answers to survey *****/
Act_FormStart (ActAnsSvy); Act_FormStart (ActAnsSvy);
@ -2893,7 +2884,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
fprintf (Gbl.F.Out,"<td class=\"TEST_EDI LEFT_TOP COLOR%u\">", fprintf (Gbl.F.Out,"<td class=\"TEST_EDI LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
Svy_WriteQstStem (row[3]); Svy_WriteQstStem (row[3]);
Svy_WriteAnswersOfAQst (Svy,SvyQst); Svy_WriteAnswersOfAQst (Svy,SvyQst,PutFormAnswerSurvey);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
} }
@ -2909,7 +2900,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
if (FormAnswerSurvey) if (PutFormAnswerSurvey)
{ {
/***** Button to create/modify survey *****/ /***** Button to create/modify survey *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -2923,17 +2914,9 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
/***** Put form to add a new question in this survey *****/ /***** Put form to add a new question in this survey *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"5\">"); "<td colspan=\"5\">");
Act_FormStart (ActEdiOneSvyQst); Gbl.Svys.SvyCodToEdit = Svy->SvyCod;
Svy_PutParamSvyCod (Svy->SvyCod); Lay_PutContextualLink (ActEdiOneSvyQst,Svy_PutParams,"plus64x64.png",
Svy_PutHiddenParamSvyOrderType (); Txt_New_question,Txt_New_question);
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Act_LinkFormSubmit (Txt_New_question,The_ClassFormBold[Gbl.Prefs.Theme]);
Lay_PutIconWithText ("plus64x64.png",
Txt_New_question,
Txt_New_question);
fprintf (Gbl.F.Out,"</a>");
Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
} }
@ -2941,7 +2924,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
/***** Table end *****/ /***** Table end *****/
Lay_EndRoundFrameTable (); Lay_EndRoundFrameTable ();
if (FormAnswerSurvey) if (PutFormAnswerSurvey)
/***** End form *****/ /***** End form *****/
Act_FormEnd (); Act_FormEnd ();
} }
@ -2986,7 +2969,7 @@ 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) static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst,bool PutFormAnswerSurvey)
{ {
unsigned NumAns,NumAnswers; unsigned NumAns,NumAnswers;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -3020,17 +3003,19 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *Sv
/* Selectors and label with the letter of the answer */ /* Selectors and label with the letter of the answer */
fprintf (Gbl.F.Out,"<tr>"); fprintf (Gbl.F.Out,"<tr>");
if (Svy->Status.ICanAnswer) if (PutFormAnswerSurvey)
{ {
/* Write selector to choice this answer */ /* Write selector to choice this answer */
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">"); fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">"
fprintf (Gbl.F.Out,"<input type=\""); "<input type=\"");
if (SvyQst->AnswerType == Svy_ANS_UNIQUE_CHOICE) if (SvyQst->AnswerType == Svy_ANS_UNIQUE_CHOICE)
fprintf (Gbl.F.Out,"radio\" onclick=\"selectUnselectRadio(this,this.form.Ans%010u,%u)\"", fprintf (Gbl.F.Out,"radio\""
" onclick=\"selectUnselectRadio(this,this.form.Ans%010u,%u)\"",
(unsigned) SvyQst->QstCod,NumAnswers); (unsigned) SvyQst->QstCod,NumAnswers);
else // SvyQst->AnswerType == Svy_ANS_MULTIPLE_CHOICE else // SvyQst->AnswerType == Svy_ANS_MULTIPLE_CHOICE
fprintf (Gbl.F.Out,"checkbox\""); fprintf (Gbl.F.Out,"checkbox\"");
fprintf (Gbl.F.Out," name=\"Ans%010u\" value=\"%u\" /></td>", fprintf (Gbl.F.Out," name=\"Ans%010u\" value=\"%u\" />"
"</td>",
(unsigned) SvyQst->QstCod,NumAns); (unsigned) SvyQst->QstCod,NumAns);
} }