Version 22.120.17:Sep 10, 2023 Code refactoring related to hidden-visible in surveys.

This commit is contained in:
acanas 2023-09-10 17:17:16 +02:00
parent 8165d5ca08
commit 87bd725069
5 changed files with 19 additions and 36 deletions

View File

@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
*/
#define Log_PLATFORM_VERSION "SWAD 22.120.16 (2023-09-10)"
#define Log_PLATFORM_VERSION "SWAD 22.120.17 (2023-09-10)"
#define CSS_FILE "swad22.120.4.css"
#define JS_FILE "swad22.49.js"
/*
Version 22.120.17:Sep 10, 2023 Code refactoring related to hidden-visible in surveys. (337563 lines)
Version 22.120.16:Sep 10, 2023 Code refactoring in project visibility. (337575 lines)
Version 22.120.15:Sep 10, 2023 Code refactoring related to hidden-visible in projects. (337580 lines)
Version 22.120.14:Sep 10, 2023 Code refactoring related to hidden-visible in program resources. (337590 lines)

View File

@ -40,7 +40,6 @@
//-------------------------------- Rubrics ------------------------------------
long Rub_DB_CreateRubric (const struct Rub_Rubric *Rubric);
void Rub_DB_UpdateRubric (const struct Rub_Rubric *Rubric);
void Rub_DB_HideOrUnhideRubric (long RubCod,bool Hide);
unsigned Rub_DB_GetListRubrics (MYSQL_RES **mysql_res);
unsigned Rub_DB_GetRubricDataByCod (MYSQL_RES **mysql_res,long RubCod);

View File

@ -96,6 +96,8 @@ static void Svy_GetListSurveys (struct Svy_Surveys *Surveys);
static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
unsigned *HiddenAllowed);
static void Svy_HideUnhideSurvey (HidVis_HiddenOrVisible_t HiddenOrVisible);
static void Svy_SetDefaultAndAllowedScope (struct Svy_Survey *Svy);
static void Svy_ShowLstGrpsToEditSurvey (long SvyCod);
static void Svy_CreateSurvey (struct Svy_Survey *Svy,const char *Txt);
@ -1546,41 +1548,20 @@ void Svy_ResetSurvey (void)
}
/*****************************************************************************/
/******************************** Hide a survey ******************************/
/*************************** Hide/unhide a survey ****************************/
/*****************************************************************************/
void Svy_HideSurvey (void)
{
struct Svy_Surveys Surveys;
/***** Reset surveys *****/
Svy_ResetSurveys (&Surveys);
/***** Get parameters *****/
Surveys.SelectedOrder = Svy_GetParSvyOrder ();
Grp_GetParWhichGroups ();
Surveys.CurrentPage = Pag_GetParPagNum (Pag_SURVEYS);
/***** Get survey code *****/
Surveys.Svy.SvyCod = ParCod_GetAndCheckPar (ParCod_Svy);
/***** Get data of the survey from database *****/
Svy_GetSurveyDataByCod (&Surveys.Svy);
if (!Surveys.Svy.Status.ICanEdit)
Err_NoPermissionExit ();
/***** Hide survey *****/
Svy_DB_HideOrUnhideSurvey (Surveys.Svy.SvyCod,true);
/***** Show surveys again *****/
Svy_ListAllSurveys (&Surveys);
Svy_HideUnhideSurvey (HidVis_HIDDEN);
}
/*****************************************************************************/
/******************************** Show a survey ******************************/
/*****************************************************************************/
void Svy_UnhideSurvey (void)
{
Svy_HideUnhideSurvey (HidVis_VISIBLE);
}
static void Svy_HideUnhideSurvey (HidVis_HiddenOrVisible_t HiddenOrVisible)
{
struct Svy_Surveys Surveys;
@ -1601,7 +1582,7 @@ void Svy_UnhideSurvey (void)
Err_NoPermissionExit ();
/***** Show survey *****/
Svy_DB_HideOrUnhideSurvey (Surveys.Svy.SvyCod,false);
Svy_DB_HideOrUnhideSurvey (Surveys.Svy.SvyCod,HiddenOrVisible);
/***** Show surveys again *****/
Svy_ListAllSurveys (&Surveys);

View File

@ -105,17 +105,18 @@ void Svy_DB_UpdateSurvey (const struct Svy_Survey *Svy,const char *Txt)
}
/*****************************************************************************/
/****************************** Hide a project *******************************/
/*************************** Hide/unhide a survey ****************************/
/*****************************************************************************/
void Svy_DB_HideOrUnhideSurvey (long SvyCod,bool Hide)
void Svy_DB_HideOrUnhideSurvey (long SvyCod,
HidVis_HiddenOrVisible_t HiddenOrVisible)
{
DB_QueryUPDATE ("can not hide/unhide survey",
"UPDATE svy_surveys"
" SET Hidden='%c'"
" WHERE SvyCod=%ld",
Hide ? 'Y' :
'N',
HiddenOrVisible == HidVis_HIDDEN ? 'Y' :
'N',
SvyCod);
}

View File

@ -40,7 +40,8 @@
//-------------------------------- Surveys ------------------------------------
long Svy_DB_CreateSurvey (const struct Svy_Survey *Svy,const char *Txt);
void Svy_DB_UpdateSurvey (const struct Svy_Survey *Svy,const char *Txt);
void Svy_DB_HideOrUnhideSurvey (long SvyCod,bool Hide);
void Svy_DB_HideOrUnhideSurvey (long SvyCod,
HidVis_HiddenOrVisible_t HiddenOrVisible);
void Svy_DB_UpdateNumUsrsNotifiedByEMailAboutSurvey (long SvyCod,
unsigned NumUsrsToBeNotifiedByEMail);