diff --git a/swad_changelog.h b/swad_changelog.h index be7706e22..0cce936f5 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -238,13 +238,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.251.13 (2017-09-06)" +#define Log_PLATFORM_VERSION "SWAD 16.252 (2017-09-08)" #define CSS_FILE "swad16.251.8.css" #define JS_FILE "swad16.206.3.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.252: Sep 08, 2017 Icons to move up and down questions in a game. (226852 lines) Version 16.251.13:Sep 07, 2017 Option Remote Control moved after Test. (226873 lines) Version 16.251.12:Sep 07, 2017 Module swad_game is renamed swad_game. (226872 lines) Version 16.251.11:Sep 07, 2017 Listing games for remote control. Not finished. (226868 lines) diff --git a/swad_game.c b/swad_game.c index 193bc913c..171b2af05 100644 --- a/swad_game.c +++ b/swad_game.c @@ -139,7 +139,7 @@ static unsigned Gam_GetNumUsrsWhoAnswered (long GamCod,long QstCod,unsigned AnsI static void Gam_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs); // static void Gam_PutIconToRemoveOneQst (void); -static void Gam_PutParamsRemoveOneQst (void); +static void Gam_PutParamsOneQst (void); static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod); static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd); @@ -2725,12 +2725,14 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Game *Game, extern const char *Txt_Code; extern const char *Txt_Tags; extern const char *Txt_Question; - extern const char *Txt_Edit_question; + extern const char *Txt_Move_up_X; + extern const char *Txt_Move_down_X; extern const char *Txt_TST_STR_ANSWER_TYPES[Tst_NUM_ANS_TYPES]; unsigned NumQst; MYSQL_ROW row; unsigned UniqueId; long QstCod; + char StrNumQst[10 + 1]; /***** Write the heading *****/ Tbl_StartTableWideMargin (2); @@ -2790,16 +2792,25 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Game *Game, Ico_PutIconRemove (); Act_FormEnd (); + /* Write icon to move up the question */ + sprintf (StrNumQst,"%u",NumQst + 1); + + sprintf (Gbl.Title,Txt_Move_up_X,StrNumQst); + Lay_PutContextualLink (ActEdiOneTstQst,NULL,Gam_PutParamsOneQst, + "up_on16x16.gif", + Gbl.Title,NULL, + NULL); + + /* Write icon to move down the question */ + sprintf (Gbl.Title,Txt_Move_down_X,StrNumQst); + Lay_PutContextualLink (ActEdiOneTstQst,NULL,Gam_PutParamsOneQst, + "down_on16x16.gif", + Gbl.Title,NULL, + NULL); + /* Write icon to edit the question */ - Act_FormStart (ActEdiOneTstQst); - Gam_PutParamQstCod (QstCod); - fprintf (Gbl.F.Out,"", - Gbl.Prefs.IconsURL, - Txt_Edit_question, - Txt_Edit_question); - Act_FormEnd (); + Gbl.Test.QstCod = QstCod; + Ico_PutContextualIconToEdit (ActEdiOneTstQst,Tst_PutParamQstCod); fprintf (Gbl.F.Out,""); @@ -3092,10 +3103,10 @@ static void Gam_PutIconToRemoveOneQst (void) } */ /*****************************************************************************/ -/****************** Put parameter to remove one question *********************/ +/**************** Put parameter to move/remove one question ******************/ /*****************************************************************************/ -static void Gam_PutParamsRemoveOneQst (void) +static void Gam_PutParamsOneQst (void) { Gam_PutParamGameCod (Gbl.Games.CurrentGamCod); Gam_PutParamQstCod (Gbl.Games.CurrentQstCod); @@ -3131,7 +3142,7 @@ void Gam_RequestRemoveQst (void) sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_question_X, (unsigned long) (QstInd + 1)); Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt, - ActRemGamQst,NULL,NULL,Gam_PutParamsRemoveOneQst, + ActRemGamQst,NULL,NULL,Gam_PutParamsOneQst, Btn_REMOVE_BUTTON,Txt_Remove_question); /***** Show current game *****/ diff --git a/swad_icon.c b/swad_icon.c index 93ce0edef..19abb99dd 100644 --- a/swad_icon.c +++ b/swad_icon.c @@ -358,4 +358,3 @@ void Ico_PutIconRemove (void) Txt_Remove, Txt_Remove); } - diff --git a/swad_survey.c b/swad_survey.c index c32a044d5..4c82822bc 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -145,6 +145,7 @@ static void Svy_FreeTextChoiceAnswer (struct SurveyQuestion *SvyQst,unsigned Num static unsigned Svy_GetQstIndFromQstCod (long QstCod); static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod); static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQst); +static void Svy_PutParamsToEditQuestion (void); static void Svy_PutIconToAddNewQuestion (void); static void Svy_PutButtonToCreateNewQuestion (void); static void Svy_WriteQstStem (const char *Stem); @@ -3159,7 +3160,6 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ extern const char *Txt_SURVEY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES]; extern const char *Txt_This_survey_has_no_questions; extern const char *Txt_Done; - extern const char *Txt_Edit_question; char Query[256]; MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -3227,27 +3227,20 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ if (Svy->Status.ICanEdit) { + fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); + /* Write icon to remove the question */ - fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); Act_FormStart (ActReqRemSvyQst); Svy_PutParamSvyCod (Svy->SvyCod); Svy_PutParamQstCod (SvyQst->QstCod); Ico_PutIconRemove (); Act_FormEnd (); - fprintf (Gbl.F.Out,""); /* Write icon to edit the question */ - fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); - Act_FormStart (ActEdiOneSvyQst); - Svy_PutParamSvyCod (Svy->SvyCod); - Svy_PutParamQstCod (SvyQst->QstCod); - fprintf (Gbl.F.Out,"", - Gbl.Prefs.IconsURL, - Txt_Edit_question, - Txt_Edit_question); - Act_FormEnd (); + Gbl.Svys.SvyCodToEdit = Svy->SvyCod; + Gbl.Svys.SvyQstCodToEdit = SvyQst->QstCod; + Ico_PutContextualIconToEdit (ActEdiOneSvyQst,Svy_PutParamsToEditQuestion); + fprintf (Gbl.F.Out,""); } @@ -3303,6 +3296,16 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ Box_EndBox (); } +/*****************************************************************************/ +/******************** Put parameters to edit a question **********************/ +/*****************************************************************************/ + +static void Svy_PutParamsToEditQuestion (void) + { + Svy_PutParamSvyCod (Gbl.Svys.SvyCodToEdit); + Svy_PutParamQstCod (Gbl.Svys.SvyQstCodToEdit); + } + /*****************************************************************************/ /***************** Put icon to add a new question to survey ******************/ /*****************************************************************************/ diff --git a/swad_test.c b/swad_test.c index 75feac7b3..5f34999c4 100644 --- a/swad_test.c +++ b/swad_test.c @@ -257,7 +257,6 @@ static void Tst_PutParamsRemoveOneQst (void); static void Tst_PutParamsRemoveQst (void); static long Tst_GetQstCod (void); -static void Tst_PutParamQstCod (void); static void Tst_InsertOrUpdateQstIntoDB (void); static void Tst_InsertTagsIntoDB (void); @@ -2826,7 +2825,6 @@ static void Tst_ListOneOrMoreQuestionsForEdition (unsigned long NumRows, extern const char *Txt_TST_STR_ORDER_SHORT[Tst_NUM_TYPES_ORDER_QST]; extern const char *Txt_TST_STR_ANSWER_TYPES[Tst_NUM_ANS_TYPES]; extern const char *Txt_Shuffle; - extern const char *Txt_Edit_question; extern const char *Txt_Today; Tst_QuestionsOrder_t Order; unsigned long NumRow; @@ -2941,15 +2939,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (unsigned long NumRows, Act_FormEnd (); /* Write icon to edit the question */ - Act_FormStart (ActEdiOneTstQst); - Tst_PutParamQstCod (); - fprintf (Gbl.F.Out,"", - Gbl.Prefs.IconsURL, - Txt_Edit_question, - Txt_Edit_question); - Act_FormEnd (); + Ico_PutContextualIconToEdit (ActEdiOneTstQst,Tst_PutParamQstCod); fprintf (Gbl.F.Out,""); @@ -6459,7 +6449,7 @@ static long Tst_GetQstCod (void) /************ Put parameter with question code to edit, remove... ************/ /*****************************************************************************/ -static void Tst_PutParamQstCod (void) +void Tst_PutParamQstCod (void) { Par_PutHiddenParamLong ("QstCod",Gbl.Test.QstCod); } diff --git a/swad_test.h b/swad_test.h index b38b5a3fb..c8c632d63 100644 --- a/swad_test.h +++ b/swad_test.h @@ -188,6 +188,9 @@ double Tst_GetFloatAnsFromStr (char *Str); void Tst_RequestRemoveQst (void); void Tst_RemoveQst (void); void Tst_ChangeShuffleQst (void); + +void Tst_PutParamQstCod (void); + void Tst_InsertOrUpdateQstTagsAnsIntoDB (void); void Tst_FreeTagsList (void); diff --git a/swad_text.c b/swad_text.c index c255e1723..aa55bb35f 100644 --- a/swad_text.c +++ b/swad_text.c @@ -10318,27 +10318,6 @@ const char *Txt_Edit_my_webs_networks = "Editar as minhas webs / redes"; #endif -const char *Txt_Edit_question = -#if L==1 - "Editar pregunta"; -#elif L==2 - "Frage bearbeiten"; -#elif L==3 - "Edit question"; -#elif L==4 - "Editar pregunta"; -#elif L==5 - "Éditer question"; -#elif L==6 - "Editar pregunta"; // Okoteve traducción -#elif L==7 - "Editare domanda"; -#elif L==8 - "Edytuj pytanie"; -#elif L==9 - "Editar questão"; -#endif - const char *Txt_Edit_record_fields = #if L==1 "Editar camps de fitxes";