mirror of https://github.com/acanas/swad-core.git
Version 23.39: Oct 27, 2023 Code refactoring in contracted/expanded and rubrics.
This commit is contained in:
parent
4b4b3cbea3
commit
cf66ee4ab8
|
@ -613,7 +613,7 @@ static void Agd_ShowEventsToday (struct Agd_Agenda *Agenda,
|
|||
static void Agd_WriteHeaderListEvents (const struct Agd_Agenda *Agenda,
|
||||
Agd_AgendaType_t AgendaType)
|
||||
{
|
||||
extern const char *Txt_START_END_TIME_HELP[2];
|
||||
extern const char *Txt_START_END_TIME_HELP[Dat_NUM_START_END_TIME];
|
||||
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
||||
extern const char *Txt_Event;
|
||||
extern const char *Txt_Location;
|
||||
|
|
|
@ -3893,8 +3893,8 @@ static void Brw_ListDir (unsigned Level,const char *ParentRowId,
|
|||
IconSubtree = Brw_ICON_TREE_NOTHING;
|
||||
else
|
||||
/***** Check if the tree starting at this subdirectory must be expanded *****/
|
||||
IconSubtree = Brw_DB_GetIfExpandedFolder (Gbl.FileBrowser.FilFolLnk.Full) ? Brw_ICON_TREE_CONTRACT :
|
||||
Brw_ICON_TREE_EXPAND;
|
||||
IconSubtree = Brw_DB_GetIfContractedOrExpandedFolder (Gbl.FileBrowser.FilFolLnk.Full) == ConExp_EXPANDED ? Brw_ICON_TREE_CONTRACT :
|
||||
Brw_ICON_TREE_EXPAND;
|
||||
for (NumFileInSubdir = 0;
|
||||
NumFileInSubdir < NumFilesInSubdir;
|
||||
NumFileInSubdir++)
|
||||
|
@ -5737,7 +5737,7 @@ static void Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (const char
|
|||
{
|
||||
if ((Ptr = strrchr (CopyOfPath,'/'))) // If '/' found (backwards from the end)
|
||||
{
|
||||
if (!Brw_DB_GetIfExpandedFolder (CopyOfPath))
|
||||
if (Brw_DB_GetIfContractedOrExpandedFolder (CopyOfPath) == ConExp_CONTRACTED)
|
||||
Brw_DB_InsertFolderInExpandedFolders (CopyOfPath);
|
||||
// Now Ptr points to the last '/' in SubPath
|
||||
*Ptr = '\0'; // Substitute '/' for '\0' to shorten CopyOfPath
|
||||
|
|
|
@ -2424,7 +2424,7 @@ void Brw_DB_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void)
|
|||
/************* Check if a folder from a file browser is expanded *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Brw_DB_GetIfExpandedFolder (const char Path[PATH_MAX + 1])
|
||||
ConExp_ContractedOrExpanded_t Brw_DB_GetIfContractedOrExpandedFolder (const char Path[PATH_MAX + 1])
|
||||
{
|
||||
long Cod = Brw_GetCodForFileBrowser ();
|
||||
long WorksUsrCod = Brw_GetZoneUsrCodForFileBrowser ();
|
||||
|
@ -2447,7 +2447,8 @@ bool Brw_DB_GetIfExpandedFolder (const char Path[PATH_MAX + 1])
|
|||
(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod,
|
||||
WorksUsrCod,
|
||||
Path);
|
||||
Path) ? ConExp_EXPANDED :
|
||||
ConExp_CONTRACTED;
|
||||
else
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if a folder is expanded",
|
||||
|
@ -2461,7 +2462,8 @@ bool Brw_DB_GetIfExpandedFolder (const char Path[PATH_MAX + 1])
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
Cod,
|
||||
Path);
|
||||
Path) ? ConExp_EXPANDED :
|
||||
ConExp_CONTRACTED;
|
||||
}
|
||||
else // Briefcase
|
||||
return
|
||||
|
@ -2474,7 +2476,8 @@ bool Brw_DB_GetIfExpandedFolder (const char Path[PATH_MAX + 1])
|
|||
" AND Path='%s/')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
Path);
|
||||
Path) ? ConExp_EXPANDED :
|
||||
ConExp_CONTRACTED;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "swad_browser.h"
|
||||
#include "swad_browser_size.h"
|
||||
#include "swad_contracted_expanded.h"
|
||||
#include "swad_search.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -107,7 +108,7 @@ bool Brw_DB_CheckIfFileOrFolderIsSetAsHiddenUsingMetadata (const struct Brw_File
|
|||
//---------------------------- Expanded folders -------------------------------
|
||||
void Brw_DB_InsertFolderInExpandedFolders (const char Path[PATH_MAX + 1]);
|
||||
void Brw_DB_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void);
|
||||
bool Brw_DB_GetIfExpandedFolder (const char Path[PATH_MAX + 1]);
|
||||
ConExp_ContractedOrExpanded_t Brw_DB_GetIfContractedOrExpandedFolder (const char Path[PATH_MAX + 1]);
|
||||
void Brw_DB_RemoveFolderFromExpandedFolders (const char Path[PATH_MAX + 1]);
|
||||
void Brw_DB_RemoveAffectedExpandedFolders (const char Path[PATH_MAX + 1]);
|
||||
void Brw_DB_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
||||
|
|
|
@ -633,10 +633,11 @@ Me sale este error, no s
|
|||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.38.3 (2023-10-27)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.39 (2023-10-27)"
|
||||
#define CSS_FILE "swad23.35.1.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 23.39: Oct 27, 2023 Code refactoring in contracted/expanded and rubrics. (335209 lines)
|
||||
Version 23.38.3: Oct 27, 2023 When clicking on edition of a program item, expand it if contracted. (335155 lines)
|
||||
Version 23.38.2: Oct 27, 2023 Fix bug showing the question just edited. (335152 lines)
|
||||
Version 23.38.1: Oct 27, 2023 Fix issue related to public profile and record card. Reported by Francisco Javier Fernández Baldomero. (335152 lines)
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
// swad_contracted_expanded.h: types and constants related to contracted/expanded
|
||||
|
||||
#ifndef _SWAD_CON_EXP
|
||||
#define _SWAD_CON_EXP
|
||||
/*
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define ConExp_NUM_CONTRACTED_EXPANDED 2
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ConExp_CONTRACTED = 0,
|
||||
ConExp_EXPANDED = 1,
|
||||
} ConExp_ContractedOrExpanded_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
|
@ -35,6 +35,7 @@
|
|||
#include "swad_action_list.h"
|
||||
#include "swad_autolink.h"
|
||||
#include "swad_box.h"
|
||||
#include "swad_contracted_expanded.h"
|
||||
#include "swad_database.h"
|
||||
#include "swad_error.h"
|
||||
#include "swad_figure.h"
|
||||
|
@ -74,7 +75,7 @@ typedef enum
|
|||
struct Level
|
||||
{
|
||||
unsigned Number; // Numbers for each level from 1 to maximum level
|
||||
bool Expanded; // If each level from 1 to maximum level is expanded
|
||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded; // If each level from 1 to maximum level is expanded
|
||||
HidVis_HiddenOrVisible_t HiddenOrVisible; // If each level...
|
||||
// ...from 1 to maximum level...
|
||||
// ...is hidden or visible
|
||||
|
@ -123,11 +124,12 @@ static void Prg_PutIconToViewResourceClipboard (void);
|
|||
|
||||
static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||
unsigned NumItem,struct Prg_Item *Item,
|
||||
bool Expanded,
|
||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
||||
long SelectedItmCod,
|
||||
long SelectedRscCod);
|
||||
static void Prg_PutIconToContractExpandItem (struct Prg_Item *Item,
|
||||
bool Expanded,bool Editing);
|
||||
static void Prg_PutIconToContractOrExpandItem (struct Prg_Item *Item,
|
||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
||||
bool Editing);
|
||||
static void Prg_WriteItemText (long ItmCod,HidVis_HiddenOrVisible_t HiddenOrVisible);
|
||||
static void Prg_WriteRowToCreateItem (long ParentItmCod,unsigned FormLevel);
|
||||
static void Prg_SetTitleClass (char **TitleClass,unsigned Level);
|
||||
|
@ -143,9 +145,9 @@ static unsigned Prg_GetCurrentNumberInLevel (unsigned Level);
|
|||
static void Prg_WriteNumItem (unsigned Level);
|
||||
static void Prg_WriteNumNewItem (unsigned Level);
|
||||
|
||||
static void Prg_SetExpandedLevel (unsigned Level,bool Expanded);
|
||||
static void Prg_SetExpandedLevel (unsigned Level,ConExp_ContractedOrExpanded_t ContractedOrExpanded);
|
||||
static void Prg_SetHiddenLevel (unsigned Level,HidVis_HiddenOrVisible_t HiddenOrVisible);
|
||||
static bool Prg_GetExpandedLevel (unsigned Level);
|
||||
static ConExp_ContractedOrExpanded_t Prg_GetExpandedLevel (unsigned Level);
|
||||
static HidVis_HiddenOrVisible_t Prg_GetHiddenLevel (unsigned Level);
|
||||
|
||||
static bool Prg_CheckIfAllHigherLevelsAreExpanded (unsigned CurrentLevel);
|
||||
|
@ -232,7 +234,7 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,
|
|||
unsigned FormLevel = 0; // Initialized to avoid warning
|
||||
struct Prg_Item Item;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
bool Expanded;
|
||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded;
|
||||
char *Title;
|
||||
static bool FirstTBodyOpen = false;
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *Args) =
|
||||
|
@ -326,14 +328,14 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,
|
|||
}
|
||||
|
||||
/* Set if this level is expanded */
|
||||
Expanded = Prg_DB_GetIfExpandedItem (Item.Hierarchy.ItmCod);
|
||||
Prg_SetExpandedLevel (Item.Hierarchy.Level,Expanded);
|
||||
ContractedOrExpanded = Prg_DB_GetIfContractedOrExpandedItem (Item.Hierarchy.ItmCod);
|
||||
Prg_SetExpandedLevel (Item.Hierarchy.Level,ContractedOrExpanded);
|
||||
|
||||
/* Show this row only if all higher levels are expanded */
|
||||
if (Prg_CheckIfAllHigherLevelsAreExpanded (Item.Hierarchy.Level))
|
||||
{
|
||||
/* Write row with this item */
|
||||
Prg_WriteRowItem (ListingType,NumItem,&Item,Expanded,
|
||||
Prg_WriteRowItem (ListingType,NumItem,&Item,ContractedOrExpanded,
|
||||
SelectedItmCod,SelectedRscCod);
|
||||
The_ChangeRowColor ();
|
||||
|
||||
|
@ -464,7 +466,7 @@ static void Prg_PutIconToViewResourceClipboard (void)
|
|||
|
||||
static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
||||
unsigned NumItem,struct Prg_Item *Item,
|
||||
bool Expanded,
|
||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
||||
long SelectedItmCod,
|
||||
long SelectedRscCod)
|
||||
{
|
||||
|
@ -485,10 +487,10 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
[Prg_CHANGE_RESOURCE_LINK] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
static const char *RowSpan[2] =
|
||||
static const char *RowSpan[ConExp_NUM_CONTRACTED_EXPANDED] =
|
||||
{
|
||||
[false] = "", // Not expanded
|
||||
[true ] = " rowspan=\"2\"", // Expanded
|
||||
[ConExp_CONTRACTED] = "", // Not expanded
|
||||
[ConExp_EXPANDED ] = " rowspan=\"2\"", // Expanded
|
||||
};
|
||||
HidVis_HiddenOrVisible_t HiddenOrVisible = HidVis_HIDDEN; // Initialized to avoid warning
|
||||
char *Id;
|
||||
|
@ -532,28 +534,28 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
NumCol++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"%s\"%s",
|
||||
The_GetColorRows (),RowSpan[Expanded]);
|
||||
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Expand/contract this program item */
|
||||
HTM_TD_Begin ("class=\"LT %s\"%s",
|
||||
The_GetColorRows (),RowSpan[Expanded]);
|
||||
Prg_PutIconToContractExpandItem (Item,Expanded,EditingProgram[ListingType]);
|
||||
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
||||
Prg_PutIconToContractOrExpandItem (Item,ContractedOrExpanded,EditingProgram[ListingType]);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Forms to remove/edit this program item */
|
||||
if (EditingProgram[ListingType])
|
||||
{
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LT %s\"%s",
|
||||
The_GetColorRows (),RowSpan[Expanded]);
|
||||
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
||||
Prg_PutFormsToRemEditOneItem (ListingType,NumItem,Item,HighlightItem);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Item number */
|
||||
HTM_TD_Begin ("class=\"PRG_NUM %s\"%s",
|
||||
The_GetColorRows (),RowSpan[Expanded]);
|
||||
The_GetColorRows (),RowSpan[ContractedOrExpanded]);
|
||||
HTM_DIV_Begin ("class=\"RT %s%s\"",
|
||||
TitleClass,
|
||||
HidVis_PrgClass[HiddenOrVisible]);
|
||||
|
@ -623,7 +625,7 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Second row (text and resources) *****/
|
||||
if (Expanded)
|
||||
if (ContractedOrExpanded == ConExp_EXPANDED)
|
||||
{
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -663,26 +665,28 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
/************************ Put icon to expand an item *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Prg_PutIconToContractExpandItem (struct Prg_Item *Item,
|
||||
bool Expanded,bool Editing)
|
||||
static void Prg_PutIconToContractOrExpandItem (struct Prg_Item *Item,
|
||||
ConExp_ContractedOrExpanded_t ContractedOrExpanded,
|
||||
bool Editing)
|
||||
{
|
||||
static const Act_Action_t NextAction[2][2] =
|
||||
static const Act_Action_t NextAction[ConExp_NUM_CONTRACTED_EXPANDED][2] =
|
||||
{
|
||||
[false][false] = ActExpSeePrgItm, // Contracted, Not editing ==> action to expand
|
||||
[false][true ] = ActExpEdiPrgItm, // Contracted, Editing ==> action to expand
|
||||
[true ][false] = ActConSeePrgItm, // Expanded , Not editing ==> action to contract
|
||||
[true ][true ] = ActConEdiPrgItm, // Expanded , Editing ==> action to contract
|
||||
[ConExp_CONTRACTED][false] = ActExpSeePrgItm, // Contracted, Not editing ==> action to expand
|
||||
[ConExp_CONTRACTED][true ] = ActExpEdiPrgItm, // Contracted, Editing ==> action to expand
|
||||
[ConExp_EXPANDED ][false] = ActConSeePrgItm, // Expanded , Not editing ==> action to contract
|
||||
[ConExp_EXPANDED ][true ] = ActConEdiPrgItm, // Expanded , Editing ==> action to contract
|
||||
};
|
||||
static void (*PutContextualIcon[2]) (const Act_Action_t NextAction,const char *Anchor,
|
||||
void (*FuncPars) (void *Args),void *Args) =
|
||||
static void (*PutContextualIcon[ConExp_NUM_CONTRACTED_EXPANDED]) (const Act_Action_t NextAction,const char *Anchor,
|
||||
void (*FuncPars) (void *Args),void *Args) =
|
||||
{
|
||||
[false] = Ico_PutContextualIconToExpand, // Contracted ==> function to expand
|
||||
[true ] = Ico_PutContextualIconToContract, // Expanded ==> function to contract
|
||||
[ConExp_CONTRACTED] = Ico_PutContextualIconToExpand, // Contracted ==> function to expand
|
||||
[ConExp_EXPANDED ] = Ico_PutContextualIconToContract, // Expanded ==> function to contract
|
||||
};
|
||||
|
||||
/***** Icon to hide/unhide program item *****/
|
||||
PutContextualIcon[Expanded] (NextAction[Expanded][Editing],Prg_HIGHLIGHTED_SECTION_ID,
|
||||
Prg_PutParItmCod,&Item->Hierarchy.ItmCod);
|
||||
PutContextualIcon[ContractedOrExpanded] (NextAction[ContractedOrExpanded][Editing],
|
||||
Prg_HIGHLIGHTED_SECTION_ID,
|
||||
Prg_PutParItmCod,&Item->Hierarchy.ItmCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -901,10 +905,10 @@ static void Prg_WriteNumNewItem (unsigned Level)
|
|||
/********************** Set / Get if a level is hidden ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Prg_SetExpandedLevel (unsigned Level,bool Expanded)
|
||||
static void Prg_SetExpandedLevel (unsigned Level,ConExp_ContractedOrExpanded_t ContractedOrExpanded)
|
||||
{
|
||||
if (Prg_Gbl.Levels)
|
||||
Prg_Gbl.Levels[Level].Expanded = Expanded;
|
||||
Prg_Gbl.Levels[Level].ContractedOrExpanded = ContractedOrExpanded;
|
||||
}
|
||||
|
||||
static void Prg_SetHiddenLevel (unsigned Level,HidVis_HiddenOrVisible_t HiddenOrVisible)
|
||||
|
@ -913,16 +917,16 @@ static void Prg_SetHiddenLevel (unsigned Level,HidVis_HiddenOrVisible_t HiddenOr
|
|||
Prg_Gbl.Levels[Level].HiddenOrVisible = HiddenOrVisible;
|
||||
}
|
||||
|
||||
static bool Prg_GetExpandedLevel (unsigned Level)
|
||||
static ConExp_ContractedOrExpanded_t Prg_GetExpandedLevel (unsigned Level)
|
||||
{
|
||||
/* Level 0 (root) is always expanded */
|
||||
if (Level == 0)
|
||||
return true;
|
||||
return ConExp_EXPANDED;
|
||||
|
||||
if (Prg_Gbl.Levels)
|
||||
return Prg_Gbl.Levels[Level].Expanded;
|
||||
return Prg_Gbl.Levels[Level].ContractedOrExpanded;
|
||||
|
||||
return false;
|
||||
return ConExp_CONTRACTED;
|
||||
}
|
||||
|
||||
static HidVis_HiddenOrVisible_t Prg_GetHiddenLevel (unsigned Level)
|
||||
|
@ -1899,8 +1903,8 @@ void Prg_ReqChangeItem (void)
|
|||
Prg_GetPars (&Item);
|
||||
|
||||
/***** If item is contracted ==> expand it *****/
|
||||
if (!Prg_DB_GetIfExpandedItem (Item.Hierarchy.ItmCod)) // If contracted...
|
||||
Prg_DB_InsertItemInExpandedItems (Item.Hierarchy.ItmCod); // ...expand it
|
||||
if (Prg_DB_GetIfContractedOrExpandedItem (Item.Hierarchy.ItmCod) == ConExp_CONTRACTED) // If contracted...
|
||||
Prg_DB_InsertItemInExpandedItems (Item.Hierarchy.ItmCod); // ...expand it
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_FORM_EDIT_ITEM,Item.Hierarchy.ItmCod,-1L);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "swad_error.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_program.h"
|
||||
#include "swad_program_database.h"
|
||||
#include "swad_program_resource.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -667,7 +668,7 @@ void Prg_DB_InsertItemInExpandedItems (long ItmCod)
|
|||
/******************** Check if a program item is expanded ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Prg_DB_GetIfExpandedItem (long ItmCod)
|
||||
ConExp_ContractedOrExpanded_t Prg_DB_GetIfContractedOrExpandedItem (long ItmCod)
|
||||
{
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if an item is expanded",
|
||||
|
@ -677,7 +678,8 @@ bool Prg_DB_GetIfExpandedItem (long ItmCod)
|
|||
" WHERE UsrCod=%ld"
|
||||
" AND ItmCod=%ld)",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
ItmCod);
|
||||
ItmCod) ? ConExp_EXPANDED :
|
||||
ConExp_CONTRACTED;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_contracted_expanded.h"
|
||||
#include "swad_hierarchy_type.h"
|
||||
#include "swad_program.h"
|
||||
#include "swad_program_resource.h"
|
||||
|
@ -80,7 +81,7 @@ void Prg_DB_UpdateRscInd (long RscCod,int RscInd);
|
|||
void Prg_DB_UpdateRscLink (const struct Prg_Item *Item);
|
||||
|
||||
void Prg_DB_InsertItemInExpandedItems (long ItmCod);
|
||||
bool Prg_DB_GetIfExpandedItem (long ItmCod);
|
||||
ConExp_ContractedOrExpanded_t Prg_DB_GetIfContractedOrExpandedItem (long ItmCod);
|
||||
void Prg_DB_RemoveItemFromExpandedItems (long ItmCod);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -134,7 +134,7 @@ void Rub_SeeAllRubrics (void)
|
|||
Rub_ResetRubrics (&Rubrics);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false);
|
||||
Rub_GetPars (&Rubrics,Rub_DONT_CHECK_RUB_COD);
|
||||
|
||||
/***** Show all rubrics *****/
|
||||
Rub_ListAllRubrics (&Rubrics);
|
||||
|
@ -328,7 +328,7 @@ void Rub_SeeOneRubric (void)
|
|||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rub_GetPars (&Rubrics,Rub_CHECK_RUB_COD);
|
||||
|
||||
/***** Get rubric data *****/
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
|
@ -522,12 +522,12 @@ void Rub_PutPars (void *Rubrics)
|
|||
/****************** Get parameters used to edit a rubric *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rub_GetPars (struct Rub_Rubrics *Rubrics,bool CheckRubCod)
|
||||
void Rub_GetPars (struct Rub_Rubrics *Rubrics,Rub_CheckRubCod_t CheckRubCod)
|
||||
{
|
||||
long (*GetExaCo[2]) (ParCod_Param_t ParCode) =
|
||||
long (*GetExaCo[Rub_NUM_CHECK_RUB_COD]) (ParCod_Param_t ParCode) =
|
||||
{
|
||||
[false] = ParCod_GetPar,
|
||||
[true ] = ParCod_GetAndCheckPar,
|
||||
[Rub_DONT_CHECK_RUB_COD] = ParCod_GetPar,
|
||||
[Rub_CHECK_RUB_COD ] = ParCod_GetAndCheckPar,
|
||||
};
|
||||
|
||||
/***** Get other parameters *****/
|
||||
|
@ -649,7 +649,7 @@ void Rub_AskRemRubric (void)
|
|||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rub_GetPars (&Rubrics,Rub_CHECK_RUB_COD);
|
||||
|
||||
/***** Get data of the rubric from database *****/
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
|
@ -683,7 +683,7 @@ void Rub_RemoveRubric (void)
|
|||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rub_GetPars (&Rubrics,Rub_CHECK_RUB_COD);
|
||||
|
||||
/***** Get data of the rubric from database *****/
|
||||
Rub_GetRubricDataByCod (&Rubrics.Rubric);
|
||||
|
@ -748,7 +748,7 @@ void Rub_ReqCreatOrEditRubric (void)
|
|||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false); // Don't check rubric code
|
||||
Rub_GetPars (&Rubrics,Rub_DONT_CHECK_RUB_COD);
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
|
@ -918,7 +918,7 @@ void Rub_ReceiveFormRubric (void)
|
|||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false);
|
||||
Rub_GetPars (&Rubrics,Rub_DONT_CHECK_RUB_COD);
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
ExistingNewRubric = (Rubrics.Rubric.RubCod > 0) ? Rub_EXISTING_RUBRIC :
|
||||
Rub_NEW_RUBRIC;
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
|
||||
#define RubCri_AFTER_LAST_CRITERION ((unsigned)((1UL << 31) - 1)) // 2^31 - 1, don't change this number because it is used in database
|
||||
|
||||
#define Rub_NUM_CHECK_RUB_COD 2
|
||||
typedef enum
|
||||
{
|
||||
Rub_DONT_CHECK_RUB_COD = 0,
|
||||
Rub_CHECK_RUB_COD = 1,
|
||||
} Rub_CheckRubCod_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -56,7 +63,7 @@ void Rub_ShowRubricMainData (struct Rub_Rubrics *Rubrics,
|
|||
|
||||
void Rub_SetCurrentRubCod (long GamCod);
|
||||
void Rub_PutPars (void *Rubrics);
|
||||
void Rub_GetPars (struct Rub_Rubrics *Rubrics,bool CheckRubCod);
|
||||
void Rub_GetPars (struct Rub_Rubrics *Rubrics,Rub_CheckRubCod_t CheckRubCod);
|
||||
|
||||
void Rub_GetListRubrics (struct Rub_Rubrics *Rubrics);
|
||||
void Rub_GetRubricDataByCod (struct Rub_Rubric *Rubric);
|
||||
|
|
|
@ -252,7 +252,7 @@ void RubCri_ReceiveFormCriterion (void)
|
|||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rub_GetPars (&Rubrics,Rub_CHECK_RUB_COD);
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
|
||||
/***** Get rubric data from database *****/
|
||||
|
@ -399,7 +399,7 @@ static void RubCri_ChangeValueCriterion (RubCri_ValueRange_t ValueRange)
|
|||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rub_GetPars (&Rubrics,Rub_CHECK_RUB_COD);
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
|
@ -440,7 +440,7 @@ void RubCri_ChangeWeight (void)
|
|||
RubCri_ResetCriterion (&Rubrics.Criterion);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,true);
|
||||
Rub_GetPars (&Rubrics,Rub_CHECK_RUB_COD);
|
||||
Rubrics.Criterion.RubCod = Rubrics.Rubric.RubCod;
|
||||
Rubrics.Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
|
@ -1511,7 +1511,7 @@ void RubCri_MoveDownCriterion (void)
|
|||
static void RubCri_GetAndCheckRubricAndCriterion (struct Rub_Rubrics *Rubrics)
|
||||
{
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (Rubrics,true);
|
||||
Rub_GetPars (Rubrics,Rub_CHECK_RUB_COD);
|
||||
Rubrics->Criterion.CriCod = ParCod_GetAndCheckPar (ParCod_Cri);
|
||||
|
||||
/***** Get rubric data from database *****/
|
||||
|
|
|
@ -58,7 +58,7 @@ void RubRsc_GetLinkToRubric (void)
|
|||
Rub_RubricConstructor (&Rubrics.Rubric);
|
||||
|
||||
/***** Get parameters *****/
|
||||
Rub_GetPars (&Rubrics,false);
|
||||
Rub_GetPars (&Rubrics,Rub_DONT_CHECK_RUB_COD);
|
||||
|
||||
/***** Get rubric data *****/
|
||||
if (Rubrics.Rubric.RubCod > 0)
|
||||
|
|
Loading…
Reference in New Issue