From 450f429c3231c84e86943716f0a59c00f6376ec1 Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 5 Oct 2023 08:41:46 +0200 Subject: [PATCH] Version 23.26.1: Oct 05, 2023 Code refactoring. --- swad_hidden_visible.c | 101 ++++++++++++++++++++++++++++++++++++++++++ swad_hidden_visible.h | 49 ++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 swad_hidden_visible.c create mode 100644 swad_hidden_visible.h diff --git a/swad_hidden_visible.c b/swad_hidden_visible.c new file mode 100644 index 000000000..082709500 --- /dev/null +++ b/swad_hidden_visible.c @@ -0,0 +1,101 @@ +// swad_hidden_visible.c: types and constants related to hidden/visible + +/* + SWAD (Shared Workspace At a Distance), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2023 Antonio Caņas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General 3 License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/*********************************** Headers *********************************/ +/*****************************************************************************/ + +#include "swad_hidden_visible.h" + +/*****************************************************************************/ +/****************************** Public constants *****************************/ +/*****************************************************************************/ + +/* Hidden in database fields */ +const char HidVis_YN[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = 'Y', + [HidVis_VISIBLE] = 'N', + }; + +const char *HidVis_DateGreenClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "DATE_GREEN_LIGHT", + [HidVis_VISIBLE] = "DATE_GREEN", + }; +const char *HidVis_DateRedClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "DATE_RED_LIGHT", + [HidVis_VISIBLE] = "DATE_RED", + }; +const char *HidVis_DateBlueClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "DATE_BLUE_LIGHT", + [HidVis_VISIBLE] = "DATE_BLUE", + }; +const char *HidVis_TitleClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "ASG_TITLE_LIGHT", + [HidVis_VISIBLE] = "ASG_TITLE", + }; +const char *HidVis_GroupClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "ASG_GRP_LIGHT", + [HidVis_VISIBLE] = "ASG_GRP", + }; +const char *HidVis_LabelClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "ASG_LABEL_LIGHT", + [HidVis_VISIBLE] = "ASG_LABEL", + }; +const char *HidVis_DataClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "DAT_LIGHT", + [HidVis_VISIBLE] = "DAT", + }; +const char *HidVis_MsgClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = "MSG_AUT_LIGHT", + [HidVis_VISIBLE] = "MSG_AUT", + }; +const char *HidVis_PrgClass[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = " PRG_HIDDEN", + [HidVis_VISIBLE] = "", + }; +const char *HidVis_ShownStyle[HidVis_NUM_HIDDEN_VISIBLE] = + { + [HidVis_HIDDEN ] = " style=\"display:none;\"", + [HidVis_VISIBLE] = "", + }; + +/*****************************************************************************/ +/**************** Get if hidden or visible from a character ******************/ +/*****************************************************************************/ + +HidVis_HiddenOrVisible_t HidVid_GetHiddenOrVisible (char Ch) + { + return (Ch == 'Y') ? HidVis_HIDDEN : + HidVis_VISIBLE; + } + diff --git a/swad_hidden_visible.h b/swad_hidden_visible.h new file mode 100644 index 000000000..85128758e --- /dev/null +++ b/swad_hidden_visible.h @@ -0,0 +1,49 @@ +// swad_hidden_visible.h: types and constants related to hidden/visible + +#ifndef _SWAD_HID_VIS +#define _SWAD_HID_VIS +/* + SWAD (Shared Workspace At a Distance in Spanish), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2023 Antonio Caņas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +/*****************************************************************************/ +/***************************** Public constants ******************************/ +/*****************************************************************************/ + +#define HidVis_NUM_HIDDEN_VISIBLE 2 + +/*****************************************************************************/ +/******************************* Public types ********************************/ +/*****************************************************************************/ + +typedef enum + { + HidVis_HIDDEN = 0, + HidVis_VISIBLE = 1, + } HidVis_HiddenOrVisible_t; + +/*****************************************************************************/ +/****************************** Public prototypes ****************************/ +/*****************************************************************************/ + +HidVis_HiddenOrVisible_t HidVid_GetHiddenOrVisible (char c); + +#endif