mirror of https://github.com/acanas/swad-core.git
Version 21.116: Sep 02, 2022 Code refactoring in edition of program items.
This commit is contained in:
parent
68e1bc6eb4
commit
fc2e821e23
|
@ -228,7 +228,7 @@ void Acc_CheckIfEmptyAccountExists (void)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List users found *****/
|
||||
for (NumUsr = 1;
|
||||
for (NumUsr = 1, The_ResetRowColor ();
|
||||
NumUsr <= NumUsrs;
|
||||
NumUsr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -523,9 +523,9 @@ static void Agd_ShowEvents (struct Agd_Agenda *Agenda,
|
|||
Agd_WriteHeaderListEvents (Agenda,AgendaType);
|
||||
|
||||
/***** Write all events *****/
|
||||
for (NumEvent = Pagination.FirstItemVisible;
|
||||
for (NumEvent = Pagination.FirstItemVisible, The_ResetRowColor ();
|
||||
NumEvent <= Pagination.LastItemVisible;
|
||||
NumEvent++)
|
||||
NumEvent++, The_ChangeRowColor ())
|
||||
Agd_ShowOneEvent (Agenda,AgendaType,Agenda->LstAgdCods[NumEvent - 1]);
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -592,9 +592,9 @@ static void Agd_ShowEventsToday (struct Agd_Agenda *Agenda,
|
|||
Agd_WriteHeaderListEvents (Agenda,AgendaType);
|
||||
|
||||
/***** Write all events *****/
|
||||
for (NumEvent = 0;
|
||||
for (NumEvent = 0, The_ResetRowColor ();
|
||||
NumEvent < Agenda->Num;
|
||||
NumEvent++)
|
||||
NumEvent++, The_ChangeRowColor ())
|
||||
Agd_ShowOneEvent (Agenda,AgendaType,Agenda->LstAgdCods[NumEvent]);
|
||||
|
||||
/***** End table and box *****/
|
||||
|
@ -876,8 +876,6 @@ static void Agd_ShowOneEvent (struct Agd_Agenda *Agenda,
|
|||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -179,9 +179,9 @@ static void Asg_ShowAllAssignments (struct Asg_Assignments *Assignments)
|
|||
Asg_PutHeadForSeeing (Assignments,false); // Not print view
|
||||
|
||||
/***** Write all assignments *****/
|
||||
for (NumAsg = Pagination.FirstItemVisible;
|
||||
for (NumAsg = Pagination.FirstItemVisible, The_ResetRowColor ();
|
||||
NumAsg <= Pagination.LastItemVisible;
|
||||
NumAsg++)
|
||||
NumAsg++, The_ChangeRowColor ())
|
||||
Asg_ShowOneAssignment (Assignments,
|
||||
Assignments->LstAsgCods[NumAsg - 1],
|
||||
false); // Not print view
|
||||
|
@ -371,7 +371,7 @@ void Asg_PrintOneAssignment (void)
|
|||
|
||||
/***** Table head *****/
|
||||
Asg_PutHeadForSeeing (&Assignments,
|
||||
true); // Print view
|
||||
true); // Print view
|
||||
|
||||
/***** Write assignment *****/
|
||||
Asg_ShowOneAssignment (&Assignments,
|
||||
|
@ -517,8 +517,6 @@ static void Asg_ShowOneAssignment (struct Asg_Assignments *Assignments,
|
|||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
|
||||
The_ChangeRowColor ();
|
||||
|
||||
/***** Mark possible notification as seen *****/
|
||||
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_ASSIGNMENT,AsgCod);
|
||||
}
|
||||
|
|
|
@ -290,9 +290,9 @@ static void Att_ShowAllAttEvents (struct Att_Events *Events)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write all attendance events *****/
|
||||
for (NumAttEvent = Pagination.FirstItemVisible;
|
||||
for (NumAttEvent = Pagination.FirstItemVisible, The_ResetRowColor ();
|
||||
NumAttEvent <= Pagination.LastItemVisible;
|
||||
NumAttEvent++)
|
||||
NumAttEvent++, The_ChangeRowColor ())
|
||||
Att_ShowOneAttEvent (Events,
|
||||
&Events->Lst[NumAttEvent - 1],
|
||||
false);
|
||||
|
@ -570,8 +570,6 @@ static void Att_ShowOneAttEvent (struct Att_Events *Events,
|
|||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -141,7 +141,7 @@ void Bld_SeeBuildings (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write list of buildings *****/
|
||||
for (NumBuilding = 0;
|
||||
for (NumBuilding = 0, The_ResetRowColor ();
|
||||
NumBuilding < Buildings.Num;
|
||||
NumBuilding++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -135,7 +135,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** List the centers *****/
|
||||
for (NumCtr = 0;
|
||||
for (NumCtr = 0, The_ResetRowColor ();
|
||||
NumCtr < NumCtrs;
|
||||
NumCtr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -404,8 +404,6 @@ static void Ctr_ListOneCenterForSeeing (struct Ctr_Center *Ctr,unsigned NumCtr)
|
|||
Hie_WriteStatusCell (Ctr->Status,TxtClassNormal,BgColor,Txt_CENTER_STATUS);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1857,9 +1855,9 @@ void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs)
|
|||
Ctr_PutHeadCentersForSeeing (false); // Order not selectable
|
||||
|
||||
/***** List the centers (one row per center) *****/
|
||||
for (NumCtr = 1;
|
||||
for (NumCtr = 1, The_ResetRowColor ();
|
||||
NumCtr <= NumCtrs;
|
||||
NumCtr++)
|
||||
NumCtr++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get next center */
|
||||
Ctr.CtrCod = DB_GetNextCode (*mysql_res);
|
||||
|
|
|
@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
|||
|
||||
TODO: Attach pdf files in multimedia.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.115 (2022-09-01)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.116 (2022-09-02)"
|
||||
#define CSS_FILE "swad21.107.1.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 21.116: Sep 02, 2022 Code refactoring in edition of program items. (329214 lines)
|
||||
Version 21.115: Sep 01, 2022 Code refactoring in edition of program items. (329212 lines)
|
||||
Version 21.114.1: Jul 25, 2022 Fixed bug removing an item resource. (329264 lines)
|
||||
Version 21.114: Jul 25, 2022 New form and action to create item resource. (329258 lines)
|
||||
|
|
|
@ -133,7 +133,7 @@ void Cty_SeeCtyWithPendingInss (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** List the countries *****/
|
||||
for (NumCty = 0;
|
||||
for (NumCty = 0, The_ResetRowColor ();
|
||||
NumCty < NumCtys;
|
||||
NumCty++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -462,8 +462,6 @@ static void Cty_ListOneCountryForSeeing (struct Cty_Countr *Cty,unsigned NumCty)
|
|||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1831,9 +1829,9 @@ void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys)
|
|||
Cty_PutHeadCountriesForSeeing (false); // Order not selectable
|
||||
|
||||
/***** List the countries (one row per country) *****/
|
||||
for (NumCty = 1;
|
||||
for (NumCty = 1, The_ResetRowColor ();
|
||||
NumCty <= NumCtys;
|
||||
NumCty++)
|
||||
NumCty++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get next country */
|
||||
Cty.CtyCod = DB_GetNextCode (*mysql_res);
|
||||
|
|
|
@ -137,7 +137,7 @@ void Deg_SeeDegWithPendingCrss (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** List the degrees *****/
|
||||
for (NumDeg = 0;
|
||||
for (NumDeg = 0, The_ResetRowColor ();
|
||||
NumDeg < NumDegs;
|
||||
NumDeg++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -866,8 +866,6 @@ static void Deg_ListOneDegreeForSeeing (struct Deg_Degree *Deg,unsigned NumDeg)
|
|||
|
||||
/***** End table row *****/
|
||||
HTM_TR_End ();
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1813,9 +1811,9 @@ void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumDegs)
|
|||
Deg_PutHeadDegreesForSeeing ();
|
||||
|
||||
/***** List the degrees (one row per degree) *****/
|
||||
for (NumDeg = 1;
|
||||
for (NumDeg = 1, The_ResetRowColor ();
|
||||
NumDeg <= NumDegs;
|
||||
NumDeg++)
|
||||
NumDeg++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get next degree */
|
||||
Deg.DegCod = DB_GetNextCode (*mysql_res);
|
||||
|
|
|
@ -316,7 +316,7 @@ static void DegTyp_ListDegreeTypesForSeeing (void)
|
|||
const char *BgColor;
|
||||
|
||||
/***** List degree types with forms for edition *****/
|
||||
for (NumDegTyp = 0;
|
||||
for (NumDegTyp = 0, The_ResetRowColor ();
|
||||
NumDegTyp < Gbl.DegTypes.Num;
|
||||
NumDegTyp++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -138,7 +138,7 @@ void Dup_ListDuplicateUsrs (void)
|
|||
Usr_WriteHeaderFieldsUsrDat (false); // Columns for the data
|
||||
|
||||
/***** List users *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < NumUsrs;
|
||||
NumUsr++)
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ static void Dup_ListSimilarUsrs (void)
|
|||
Usr_WriteHeaderFieldsUsrDat (false); // Columns for the data
|
||||
|
||||
/***** List users *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < NumUsrs;
|
||||
NumUsr++)
|
||||
{
|
||||
|
|
|
@ -277,7 +277,7 @@ void ExaLog_ShowExamLog (const struct ExaPrn_Print *Print)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write clicks *****/
|
||||
for (NumClick = 0;
|
||||
for (NumClick = 0, The_ResetRowColor ();
|
||||
NumClick < NumClicks;
|
||||
NumClick++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -390,12 +390,10 @@ static unsigned ExaPrn_GetSomeQstsFromSetToPrint (struct ExaPrn_Print *Print,
|
|||
Set->NumQstsToPrint);
|
||||
|
||||
/***** Questions in this set *****/
|
||||
for (NumQstInSet = 0;
|
||||
for (NumQstInSet = 0, The_ResetRowColor ();
|
||||
NumQstInSet < NumQstsInSet;
|
||||
NumQstInSet++, (*NumQstsInPrint)++)
|
||||
NumQstInSet++, (*NumQstsInPrint)++, The_ChangeRowColor ())
|
||||
{
|
||||
The_ChangeRowColor ();
|
||||
|
||||
/***** Get question data *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
/*
|
||||
|
|
|
@ -610,7 +610,7 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** List the sessions *****/
|
||||
for (NumExam = 0, UniqueId = 1;
|
||||
for (NumExam = 0, UniqueId = 1, The_ResetRowColor ();
|
||||
NumExam < Exams->Num;
|
||||
NumExam++, UniqueId++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -1821,7 +1821,7 @@ static void ExaRes_ShowExamAnswers (struct UsrData *UsrDat,
|
|||
unsigned QstInd;
|
||||
struct Qst_Question Question;
|
||||
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < Print->NumQsts.All;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -287,7 +287,7 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
|||
ExaSes_ListOneOrMoreSessionsHeading (ICanEditSessions);
|
||||
|
||||
/***** Write rows *****/
|
||||
for (NumSession = 0, UniqueId = 1;
|
||||
for (NumSession = 0, UniqueId = 1, The_ResetRowColor ();
|
||||
NumSession < NumSessions;
|
||||
NumSession++, UniqueId++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -729,7 +729,7 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
|||
ExaSet_PutTableHeadingForSets ();
|
||||
|
||||
/***** Write rows *****/
|
||||
for (NumSet = 0;
|
||||
for (NumSet = 0, The_ResetRowColor ();
|
||||
NumSet < NumSets;
|
||||
NumSet++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write rows *****/
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < NumQsts;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -2185,7 +2185,7 @@ static void For_ListForumThrs (struct For_Forums *Forums,
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List threads *****/
|
||||
for (NumThr = PaginationThrs->FirstItemVisible, NumThrInScreen = 0, UniqueId = 0;
|
||||
for (NumThr = PaginationThrs->FirstItemVisible, NumThrInScreen = 0, UniqueId = 0, The_ResetRowColor ();
|
||||
NumThr <= PaginationThrs->LastItemVisible;
|
||||
NumThr++, NumThrInScreen++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -1717,7 +1717,7 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write rows *****/
|
||||
for (NumQst = 0;
|
||||
for (NumQst = 0, The_ResetRowColor ();
|
||||
NumQst < NumQsts;
|
||||
NumQst++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -409,7 +409,7 @@ static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
|
|||
NumCrssWithIndicatorYes[Ind] = 0;
|
||||
|
||||
/***** List courses *****/
|
||||
for (NumCrs = 0;
|
||||
for (NumCrs = 0, The_ResetRowColor ();
|
||||
NumCrs < NumCrss;
|
||||
NumCrs++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -676,7 +676,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *I
|
|||
|
||||
/***** List courses *****/
|
||||
mysql_data_seek (mysql_res,0);
|
||||
for (NumCrs = 0;
|
||||
for (NumCrs = 0, The_ResetRowColor ();
|
||||
NumCrs < NumCrss;
|
||||
NumCrs++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -157,9 +157,9 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** List the institutions *****/
|
||||
for (NumIns = 0;
|
||||
for (NumIns = 0, The_ResetRowColor ();
|
||||
NumIns < NumInss;
|
||||
NumIns++)
|
||||
NumIns++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get next center */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
@ -187,8 +187,6 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/***** End table and box *****/
|
||||
|
@ -308,9 +306,9 @@ static void Ins_ListInstitutions (void)
|
|||
Ins_PutHeadInstitutionsForSeeing (true); // Order selectable
|
||||
|
||||
/***** Write all institutions and their nuber of users *****/
|
||||
for (NumIns = 0;
|
||||
for (NumIns = 0, The_ResetRowColor ();
|
||||
NumIns < Gbl.Hierarchy.Inss.Num;
|
||||
NumIns++)
|
||||
NumIns++, The_ChangeRowColor ())
|
||||
Ins_ListOneInstitutionForSeeing (&(Gbl.Hierarchy.Inss.Lst[NumIns]),
|
||||
NumIns + 1);
|
||||
|
||||
|
@ -447,8 +445,6 @@ static void Ins_ListOneInstitutionForSeeing (struct Ins_Instit *Ins,unsigned Num
|
|||
Hie_WriteStatusCell (Ins->Status,TxtClassNormal,BgColor,Txt_INSTITUTION_STATUS);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1833,9 +1829,9 @@ void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss)
|
|||
Ins_PutHeadInstitutionsForSeeing (false); // Order not selectable
|
||||
|
||||
/***** List the institutions (one row per institution) *****/
|
||||
for (NumIns = 1;
|
||||
for (NumIns = 1, The_ResetRowColor ();
|
||||
NumIns <= NumInss;
|
||||
NumIns++)
|
||||
NumIns++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get next institution */
|
||||
Ins.InsCod = DB_GetNextCode (*mysql_res);
|
||||
|
|
|
@ -395,7 +395,7 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games,
|
|||
Mch_ListOneOrMoreMatchesHeading (ICanEditMatches);
|
||||
|
||||
/***** Write rows *****/
|
||||
for (NumMatch = 0, UniqueId = 1;
|
||||
for (NumMatch = 0, UniqueId = 1, The_ResetRowColor ();
|
||||
NumMatch < NumMatches;
|
||||
NumMatch++, UniqueId++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -567,7 +567,7 @@ static void MchRes_ListGamesToSelect (struct Gam_Games *Games)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** List the events *****/
|
||||
for (NumGame = 0, UniqueId = 1;
|
||||
for (NumGame = 0, UniqueId = 1, The_ResetRowColor ();
|
||||
NumGame < Games->Num;
|
||||
NumGame++, UniqueId++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -2204,7 +2204,7 @@ static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Get degrees *****/
|
||||
for (NumDeg = 0, NumDegsNotEmpty = 0;
|
||||
for (NumDeg = 0, NumDegsNotEmpty = 0, The_ResetRowColor ();
|
||||
NumDeg < NumDegs;
|
||||
NumDeg++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -1184,7 +1184,7 @@ void Prf_ShowRankingFigure (MYSQL_RES **mysql_res,unsigned NumUsrs)
|
|||
|
||||
HTM_TABLE_Begin (NULL);
|
||||
|
||||
for (NumUsr = 1, Rank = 1;
|
||||
for (NumUsr = 1, Rank = 1, The_ResetRowColor ();
|
||||
NumUsr <= NumUsrs;
|
||||
NumUsr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -1255,7 +1255,7 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
|
||||
HTM_TABLE_Begin (NULL);
|
||||
|
||||
for (NumUsr = 1, Rank = 1;
|
||||
for (NumUsr = 1, Rank = 1, The_ResetRowColor ();
|
||||
NumUsr <= NumUsrs;
|
||||
NumUsr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
129
swad_program.c
129
swad_program.c
|
@ -210,20 +210,22 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
|||
long ParentItmCod = -1L; // Initialized to avoid warning
|
||||
unsigned NumItem;
|
||||
unsigned FormLevel = 0; // Initialized to avoid warning
|
||||
Prg_ListingType_t LT;
|
||||
struct Prg_Item Item;
|
||||
struct Prg_ItemRange ToHighlight;
|
||||
static bool FirstTBodyOpen = false;
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *Args) =
|
||||
{
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = Prg_PutIconsListItems,
|
||||
[Prg_EDIT_ITEMS ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_NEW_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = Prg_PutIconsListItems,
|
||||
[Prg_EDIT_ITEMS ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_NEW_END_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = Prg_PutIconsEditItems,
|
||||
[Prg_FORM_EDIT_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_RECEIVE_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_EDIT_RESOURCES] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_RES ] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_RECEIVE_ITEM ] = Prg_PutIconsEditItems,
|
||||
[Prg_EDIT_RESOURCES ] = Prg_PutIconsEditItems,
|
||||
[Prg_END_EDIT_RES ] = Prg_PutIconsEditItems,
|
||||
};
|
||||
|
||||
/***** Create numbers and hidden levels *****/
|
||||
|
@ -247,23 +249,11 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
|||
Prg_SetItemRangeOnlyItem (Prg_GetNumItemFromItmCod (ItmCod),
|
||||
&ToHighlight);
|
||||
break;
|
||||
case Prg_FORM_NEW_ITEM:
|
||||
if (ItmCod > 0)
|
||||
{
|
||||
ParentItmCod = ItmCod; // Item code here is the code of the parent of the item to create
|
||||
NumItem = Prg_GetNumItemFromItmCod (ItmCod);
|
||||
ItmCod = Prg_Gbl.List.Items[Prg_GetLastChild (NumItem)].ItmCod;
|
||||
FormLevel = Prg_GetLevelFromNumItem (NumItem) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentItmCod = -1L; // No parent item (user clicked on button to add a new first-level item at the end)
|
||||
if (Prg_Gbl.List.NumItems) // There are items already
|
||||
ItmCod = Prg_Gbl.List.Items[Prg_Gbl.List.NumItems - 1].ItmCod;
|
||||
else // No current items
|
||||
ItmCod = -1L;
|
||||
FormLevel = 1;
|
||||
}
|
||||
case Prg_FORM_NEW_CHILD_ITEM:
|
||||
ParentItmCod = ItmCod; // Item code here is parent of the item to create
|
||||
NumItem = Prg_GetNumItemFromItmCod (ItmCod);
|
||||
ItmCod = Prg_Gbl.List.Items[Prg_GetLastChild (NumItem)].ItmCod;
|
||||
FormLevel = Prg_GetLevelFromNumItem (NumItem) + 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -285,9 +275,9 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
|||
FirstTBodyOpen = true;
|
||||
|
||||
/***** Write all program items *****/
|
||||
for (NumItem = 0;
|
||||
for (NumItem = 0, The_ResetRowColor ();
|
||||
NumItem < Prg_Gbl.List.NumItems;
|
||||
NumItem++)
|
||||
NumItem++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get data of this program item */
|
||||
Item.Hierarchy.ItmCod = Prg_Gbl.List.Items[NumItem].ItmCod;
|
||||
|
@ -304,51 +294,41 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,long ItmCod)
|
|||
HTM_TBODY_Begin ("id=\"prg_highlighted\""); // Highlighted tbody start
|
||||
}
|
||||
|
||||
/* Show form to create item */
|
||||
/* Write row with this item */
|
||||
LT = ListingType;
|
||||
switch (ListingType)
|
||||
{
|
||||
case Prg_PRINT:
|
||||
case Prg_VIEW:
|
||||
case Prg_EDIT_ITEMS:
|
||||
Prg_WriteRowItem (ListingType,NumItem,&Item);
|
||||
break;
|
||||
case Prg_FORM_NEW_ITEM:
|
||||
Prg_WriteRowItem (Prg_EDIT_ITEMS,NumItem,&Item);
|
||||
if (Item.Hierarchy.ItmCod == ItmCod)
|
||||
Prg_WriteRowToCreateItem (ParentItmCod,FormLevel);
|
||||
break;
|
||||
case Prg_FORM_EDIT_ITEM:
|
||||
case Prg_END_EDIT_ITEM:
|
||||
case Prg_RECEIVE_ITEM:
|
||||
case Prg_EDIT_RESOURCES:
|
||||
case Prg_END_EDIT_RES:
|
||||
Prg_WriteRowItem (Item.Hierarchy.ItmCod == ItmCod ? ListingType :
|
||||
Prg_EDIT_ITEMS,
|
||||
NumItem,&Item);
|
||||
if (Item.Hierarchy.ItmCod != ItmCod)
|
||||
LT = Prg_EDIT_ITEMS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Prg_WriteRowItem (LT,NumItem,&Item);
|
||||
|
||||
/* Show form to create child item? */
|
||||
if (ListingType == Prg_FORM_NEW_CHILD_ITEM &&
|
||||
Item.Hierarchy.ItmCod == ItmCod)
|
||||
{
|
||||
The_ChangeRowColor ();
|
||||
Prg_WriteRowToCreateItem (ParentItmCod,FormLevel);
|
||||
}
|
||||
|
||||
/* End range to highlight? */
|
||||
if (Item.Hierarchy.Index == ToHighlight.End) // End of the highlighted range
|
||||
{
|
||||
HTM_TBODY_End (); // Highlighted tbody end
|
||||
if (NumItem < Prg_Gbl.List.NumItems - 1) // Not the last item
|
||||
if (NumItem < Prg_Gbl.List.NumItems - 1) // Not the last item
|
||||
HTM_TBODY_Begin (NULL); // 3rd tbody begin
|
||||
}
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/***** Create item at the end? *****/
|
||||
switch (ListingType)
|
||||
{
|
||||
case Prg_FORM_NEW_ITEM:
|
||||
if (ParentItmCod <= 0)
|
||||
Prg_WriteRowToCreateItem (-1L,1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (ListingType == Prg_FORM_NEW_END_ITEM)
|
||||
Prg_WriteRowToCreateItem (-1L,1);
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TBODY_End (); // 3rd tbody end
|
||||
|
@ -461,6 +441,19 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
unsigned NumItem,struct Prg_Item *Item)
|
||||
{
|
||||
static unsigned UniqueId = 0;
|
||||
static bool PutFormsToRemEditOneItem[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = true,
|
||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = true,
|
||||
[Prg_FORM_EDIT_ITEM ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = true,
|
||||
[Prg_RECEIVE_ITEM ] = true,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
bool LightStyle;
|
||||
char *Id;
|
||||
unsigned ColSpan;
|
||||
|
@ -485,21 +478,12 @@ static void Prg_WriteRowItem (Prg_ListingType_t ListingType,
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this program item *****/
|
||||
switch (ListingType)
|
||||
if (PutFormsToRemEditOneItem[ListingType])
|
||||
{
|
||||
case Prg_EDIT_ITEMS:
|
||||
case Prg_FORM_EDIT_ITEM:
|
||||
case Prg_END_EDIT_ITEM:
|
||||
case Prg_RECEIVE_ITEM:
|
||||
case Prg_EDIT_RESOURCES:
|
||||
case Prg_END_EDIT_RES:
|
||||
HTM_TD_Begin ("rowspan=\"2\" class=\"PRG_COL1 LT %s\"",
|
||||
The_GetColorRows ());
|
||||
Prg_PutFormsToRemEditOneItem (ListingType,NumItem,Item);
|
||||
HTM_TD_End ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
HTM_TD_Begin ("rowspan=\"2\" class=\"PRG_COL1 LT %s\"",
|
||||
The_GetColorRows ());
|
||||
Prg_PutFormsToRemEditOneItem (ListingType,NumItem,Item);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Indent depending on the level *****/
|
||||
|
@ -658,9 +642,6 @@ static void Prg_WriteRowToCreateItem (long ParentItmCod,unsigned FormLevel)
|
|||
/***** Title CSS class *****/
|
||||
Prg_SetTitleClass (&TitleClass,FormLevel,false);
|
||||
|
||||
/***** Change color *****/
|
||||
The_ChangeRowColor ();
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -1752,7 +1733,9 @@ void Prg_RequestCreateItem (void)
|
|||
ParentItmCod = Prg_GetParamItmCod ();
|
||||
|
||||
/***** Show current program items, if any *****/
|
||||
Prg_ShowAllItems (Prg_FORM_NEW_ITEM,ParentItmCod);
|
||||
Prg_ShowAllItems (ParentItmCod > 0 ? Prg_FORM_NEW_CHILD_ITEM :
|
||||
Prg_FORM_NEW_END_ITEM,
|
||||
ParentItmCod);
|
||||
|
||||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
|
|
|
@ -71,20 +71,21 @@ typedef enum
|
|||
Prg_MOVE_RIGHT,
|
||||
} Prg_MoveLeftRight_t;
|
||||
|
||||
#define Prg_NUM_LISTING_TYPES 9
|
||||
#define Prg_NUM_LISTING_TYPES 10
|
||||
typedef enum
|
||||
{
|
||||
Prg_PRINT, // List items ready to be printed
|
||||
Prg_VIEW, // List items without any edition
|
||||
Prg_PRINT, // List items ready to be printed
|
||||
Prg_VIEW, // List items without any edition
|
||||
|
||||
Prg_EDIT_ITEMS, // Buttons to edit list of items
|
||||
Prg_FORM_NEW_ITEM, // Form to create a new item
|
||||
Prg_FORM_EDIT_ITEM, // Form to edit a selected item
|
||||
Prg_END_EDIT_ITEM, // List item after edition
|
||||
Prg_RECEIVE_ITEM, // Receive item data after create/edit
|
||||
Prg_EDIT_ITEMS, // Buttons to edit list of items
|
||||
Prg_FORM_NEW_END_ITEM, // Form to create a new first level item at the end
|
||||
Prg_FORM_NEW_CHILD_ITEM, // Form to create a new child item
|
||||
Prg_FORM_EDIT_ITEM, // Form to edit a selected item
|
||||
Prg_END_EDIT_ITEM, // List item after edition
|
||||
Prg_RECEIVE_ITEM, // Receive item data after create/edit
|
||||
|
||||
Prg_EDIT_RESOURCES, // List resources of a selected item for edition
|
||||
Prg_END_EDIT_RES, // List resources of a selected item after edition
|
||||
Prg_EDIT_RESOURCES, // List resources of a selected item for edition
|
||||
Prg_END_EDIT_RES, // List resources of a selected item after edition
|
||||
} Prg_ListingType_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -145,51 +145,55 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
struct PrgRsc_Resource Resource;
|
||||
static bool GetHiddenResources[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_ITEM ] = false,
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = false,
|
||||
[Prg_FORM_EDIT_ITEM ] = false,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES] = true,
|
||||
[Prg_END_EDIT_RES ] = false,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = false,
|
||||
};
|
||||
static bool ShowListWhenEmpty[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = true,
|
||||
[Prg_FORM_NEW_ITEM ] = true,
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = true,
|
||||
[Prg_FORM_NEW_END_ITEM ] = true,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = true,
|
||||
[Prg_FORM_EDIT_ITEM ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = true,
|
||||
[Prg_RECEIVE_ITEM ] = true,
|
||||
[Prg_EDIT_RESOURCES] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = true,
|
||||
[Prg_RECEIVE_ITEM ] = true,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
static bool FeaturedList[Prg_NUM_LISTING_TYPES] =
|
||||
{
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_ITEM ] = false,
|
||||
[Prg_PRINT ] = false,
|
||||
[Prg_VIEW ] = false,
|
||||
[Prg_EDIT_ITEMS ] = false,
|
||||
[Prg_FORM_NEW_END_ITEM ] = false,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = false,
|
||||
[Prg_FORM_EDIT_ITEM ] = false,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
[Prg_END_EDIT_ITEM ] = false,
|
||||
[Prg_RECEIVE_ITEM ] = false,
|
||||
[Prg_EDIT_RESOURCES ] = true,
|
||||
[Prg_END_EDIT_RES ] = true,
|
||||
};
|
||||
static void (*FunctionToDrawContextualIcons[Prg_NUM_LISTING_TYPES]) (void *Args) =
|
||||
{
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = NULL,
|
||||
[Prg_EDIT_ITEMS ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_NEW_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_PRINT ] = NULL,
|
||||
[Prg_VIEW ] = NULL,
|
||||
[Prg_EDIT_ITEMS ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_NEW_END_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_NEW_CHILD_ITEM] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_FORM_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_END_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_RECEIVE_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_EDIT_RESOURCES] = PrgRsc_PutIconsViewResources,
|
||||
[Prg_END_EDIT_RES ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_END_EDIT_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_RECEIVE_ITEM ] = PrgRsc_PutIconsEditResources,
|
||||
[Prg_EDIT_RESOURCES ] = PrgRsc_PutIconsViewResources,
|
||||
[Prg_END_EDIT_RES ] = PrgRsc_PutIconsEditResources,
|
||||
};
|
||||
|
||||
/***** Trivial check *****/
|
||||
|
@ -231,9 +235,9 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
HTM_TBODY_Begin (NULL);
|
||||
|
||||
/***** Write all item resources *****/
|
||||
for (NumRsc = 0;
|
||||
for (NumRsc = 0, The_ResetRowColor1 ();
|
||||
NumRsc < NumResources;
|
||||
NumRsc++)
|
||||
NumRsc++, The_ChangeRowColor1 ())
|
||||
{
|
||||
/* Get data of this item resource */
|
||||
PrgRsc_GetDataOfResource (&Resource,&mysql_res);
|
||||
|
@ -248,8 +252,6 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,long ItmCod)
|
|||
PrgRsc_WriteRowViewResource (NumRsc,&Resource);
|
||||
break;
|
||||
}
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/***** Form to create a new resource *****/
|
||||
|
@ -392,13 +394,13 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RT %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
The_GetSuffix (),The_GetColorRows1 ());
|
||||
HTM_Unsigned (NumRsc + 1);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN PRG_RSC_%s %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
The_GetSuffix (),The_GetColorRows1 ());
|
||||
HTM_Txt (Resource->Title);
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -417,18 +419,18 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
/***** Forms to remove/edit this item resource *****/
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LM %s\"",The_GetColorRows ());
|
||||
HTM_TD_Begin ("class=\"PRG_COL1 LM %s\"",The_GetColorRows1 ());
|
||||
PrgRsc_PutFormsToRemEditOneResource (NumRsc,NumResources,Resource);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Resource number *****/
|
||||
HTM_TD_Begin ("class=\"PRG_NUM PRG_RSC_%s RM %s\"",
|
||||
The_GetSuffix (),The_GetColorRows ());
|
||||
The_GetSuffix (),The_GetColorRows1 ());
|
||||
HTM_Unsigned (NumRsc + 1);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Title *****/
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows ());
|
||||
HTM_TD_Begin ("class=\"PRG_MAIN LM %s\"",The_GetColorRows1 ());
|
||||
Frm_BeginFormAnchor (ActRenPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
PrgRsc_PutParamRscCod (Resource->Rsc.Cod);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,Resource->Title,
|
||||
|
|
|
@ -420,9 +420,9 @@ void Prj_ShowTableSelectedPrjs (void)
|
|||
Prj_ShowTableAllProjectsHead ();
|
||||
|
||||
/***** Write all projects *****/
|
||||
for (NumPrj = 0;
|
||||
for (NumPrj = 0, The_ResetRowColor ();
|
||||
NumPrj < Projects.Num;
|
||||
NumPrj++)
|
||||
NumPrj++, The_ChangeRowColor ())
|
||||
{
|
||||
Prj.PrjCod = Projects.LstPrjCods[NumPrj];
|
||||
Prj_ShowTableAllProjectsOneRow (&Prj);
|
||||
|
@ -508,9 +508,9 @@ static void Prj_ShowPrjsInCurrentPage (void *Projects)
|
|||
Prj_ShowProjectsHead ((struct Prj_Projects *) Projects,Prj_LIST_PROJECTS);
|
||||
|
||||
/***** Write all projects *****/
|
||||
for (NumPrj = Pagination.FirstItemVisible;
|
||||
for (NumPrj = Pagination.FirstItemVisible, The_ResetRowColor ();
|
||||
NumPrj <= Pagination.LastItemVisible;
|
||||
NumPrj++)
|
||||
NumPrj++, The_ChangeRowColor ())
|
||||
{
|
||||
/* Get project data */
|
||||
Prj.PrjCod = ((struct Prj_Projects *) Projects)->LstPrjCods[NumPrj - 1];
|
||||
|
@ -1547,8 +1547,6 @@ static void Prj_ShowOneProject (struct Prj_Projects *Projects,
|
|||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1751,8 +1749,6 @@ static void Prj_ShowTableAllProjectsOneRow (struct Prj_Project *Prj)
|
|||
|
||||
/***** End row *****/
|
||||
HTM_TR_End ();
|
||||
|
||||
The_ChangeRowColor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -858,7 +858,7 @@ void Qst_ListOneOrMoreQstsForEdition (struct Qst_Questions *Questions,
|
|||
Qst_WriteHeadingRowQuestionsForEdition (Questions);
|
||||
|
||||
/***** Write rows *****/
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < Questions->NumQsts;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -1132,7 +1132,7 @@ void Qst_ListOneOrMoreQstsForSelectionForExamSet (struct Exa_Exams *Exams,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write rows *****/
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < NumQsts;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -1214,7 +1214,7 @@ void Qst_ListOneOrMoreQstsForSelectionForGame (struct Gam_Games *Games,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write rows *****/
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < NumQsts;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -2125,7 +2125,7 @@ void Qst_PutFormEditOneQst (struct Qst_Question *Question)
|
|||
OptionsDisabled = Question->Answer.Type != Qst_ANS_UNIQUE_CHOICE &&
|
||||
Question->Answer.Type != Qst_ANS_MULTIPLE_CHOICE &&
|
||||
Question->Answer.Type != Qst_ANS_TEXT;
|
||||
for (NumOpt = 0;
|
||||
for (NumOpt = 0, The_ResetRowColor ();
|
||||
NumOpt < Qst_MAX_OPTIONS_PER_QUESTION;
|
||||
NumOpt++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -1680,7 +1680,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Fields of the record that depends on the course *****/
|
||||
for (NumField = 0;
|
||||
for (NumField = 0, The_ResetRowColor ();
|
||||
NumField < Gbl.Crs.Records.LstFields.Num;
|
||||
NumField++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -211,7 +211,7 @@ void Roo_SeeRooms (void)
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write list of rooms *****/
|
||||
for (NumRoom = 0;
|
||||
for (NumRoom = 0, The_ResetRowColor ();
|
||||
NumRoom < Rooms.Num;
|
||||
NumRoom++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -1211,7 +1211,7 @@ static void Sta_ShowDetailedAccessesList (const struct Sta_Stats *Stats,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write rows back *****/
|
||||
for (NumRow = LastRow, UniqueId = 1;
|
||||
for (NumRow = LastRow, UniqueId = 1, The_ResetRowColor ();
|
||||
NumRow >= FirstRow;
|
||||
NumRow--, UniqueId++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -1352,7 +1352,7 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write rows *****/
|
||||
for (NumHit = 1, Hits.Max = 0.0;
|
||||
for (NumHit = 1, Hits.Max = 0.0, The_ResetRowColor ();
|
||||
NumHit <= NumHits;
|
||||
NumHit++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -2807,7 +2807,7 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Write questions one by one *****/
|
||||
for (NumQst = 0;
|
||||
for (NumQst = 0, The_ResetRowColor ();
|
||||
NumQst < NumQsts;
|
||||
NumQst++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
|
@ -229,7 +229,7 @@ void TstPrn_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
|
|||
HTM_TABLE_BeginWideMarginPadding (10);
|
||||
|
||||
/***** Write one row for each question *****/
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < Print->NumQsts.All;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -537,7 +537,7 @@ void TstPrn_ShowPrintAfterAssess (struct TstPrn_Print *Print)
|
|||
Print->NumQsts.NotBlank = 0;
|
||||
Print->Score = 0.0;
|
||||
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < Print->NumQsts.All;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -2491,7 +2491,7 @@ void TstPrn_ShowPrintAnswers (struct UsrData *UsrDat,
|
|||
struct Qst_Question Question;
|
||||
bool QuestionExists;
|
||||
|
||||
for (QstInd = 0;
|
||||
for (QstInd = 0, The_ResetRowColor ();
|
||||
QstInd < NumQsts;
|
||||
QstInd++, The_ChangeRowColor ())
|
||||
{
|
||||
|
|
64
swad_theme.c
64
swad_theme.c
|
@ -206,35 +206,59 @@ const char *The_GetSuffix (void)
|
|||
/******** Get background colors for rows depending on selected theme *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned The_RowEvenOdd = 0; // To alternate row colors in listings
|
||||
static unsigned The_RowEvenOdd[2] = // To alternate row colors in listings
|
||||
{
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static const char *The_ClassColorRows[2][The_NUM_THEMES] =
|
||||
{
|
||||
[0][The_THEME_WHITE ] = "COLOR0_WHITE",
|
||||
[0][The_THEME_GREY ] = "COLOR0_GREY",
|
||||
[0][The_THEME_PURPLE] = "COLOR0_PURPLE",
|
||||
[0][The_THEME_BLUE ] = "COLOR0_BLUE",
|
||||
[0][The_THEME_YELLOW] = "COLOR0_YELLOW",
|
||||
[0][The_THEME_PINK ] = "COLOR0_PINK",
|
||||
[0][The_THEME_DARK ] = "COLOR0_DARK",
|
||||
|
||||
[1][The_THEME_WHITE ] = "COLOR1_WHITE",
|
||||
[1][The_THEME_GREY ] = "COLOR1_GREY",
|
||||
[1][The_THEME_PURPLE] = "COLOR1_PURPLE",
|
||||
[1][The_THEME_BLUE ] = "COLOR1_BLUE",
|
||||
[1][The_THEME_YELLOW] = "COLOR1_YELLOW",
|
||||
[1][The_THEME_PINK ] = "COLOR1_PINK",
|
||||
[1][The_THEME_DARK ] = "COLOR1_DARK",
|
||||
};
|
||||
|
||||
const char *The_GetColorRows (void)
|
||||
{
|
||||
static const char *The_ClassColorRows[2][The_NUM_THEMES] =
|
||||
{
|
||||
[0][The_THEME_WHITE ] = "COLOR0_WHITE",
|
||||
[0][The_THEME_GREY ] = "COLOR0_GREY",
|
||||
[0][The_THEME_PURPLE] = "COLOR0_PURPLE",
|
||||
[0][The_THEME_BLUE ] = "COLOR0_BLUE",
|
||||
[0][The_THEME_YELLOW] = "COLOR0_YELLOW",
|
||||
[0][The_THEME_PINK ] = "COLOR0_PINK",
|
||||
[0][The_THEME_DARK ] = "COLOR0_DARK",
|
||||
return The_ClassColorRows[The_RowEvenOdd[0]][Gbl.Prefs.Theme];
|
||||
}
|
||||
|
||||
[1][The_THEME_WHITE ] = "COLOR1_WHITE",
|
||||
[1][The_THEME_GREY ] = "COLOR1_GREY",
|
||||
[1][The_THEME_PURPLE] = "COLOR1_PURPLE",
|
||||
[1][The_THEME_BLUE ] = "COLOR1_BLUE",
|
||||
[1][The_THEME_YELLOW] = "COLOR1_YELLOW",
|
||||
[1][The_THEME_PINK ] = "COLOR1_PINK",
|
||||
[1][The_THEME_DARK ] = "COLOR1_DARK",
|
||||
};
|
||||
const char *The_GetColorRows1 (void)
|
||||
{
|
||||
return The_ClassColorRows[The_RowEvenOdd[1]][Gbl.Prefs.Theme];
|
||||
}
|
||||
|
||||
return The_ClassColorRows[The_RowEvenOdd][Gbl.Prefs.Theme];
|
||||
void The_ResetRowColor (void)
|
||||
{
|
||||
The_RowEvenOdd[0] = 0;
|
||||
}
|
||||
|
||||
void The_ResetRowColor1 (void)
|
||||
{
|
||||
The_RowEvenOdd[1] = 0;
|
||||
}
|
||||
|
||||
void The_ChangeRowColor (void)
|
||||
{
|
||||
The_RowEvenOdd = 1 - The_RowEvenOdd;
|
||||
The_RowEvenOdd[0] = 1 - The_RowEvenOdd[0];
|
||||
}
|
||||
|
||||
void The_ChangeRowColor1 (void)
|
||||
{
|
||||
The_RowEvenOdd[1] = 1 - The_RowEvenOdd[1];
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -55,8 +55,15 @@ The_Theme_t The_GetParamTheme (void);
|
|||
The_Theme_t The_GetThemeFromStr (const char *Str);
|
||||
|
||||
const char *The_GetSuffix (void);
|
||||
|
||||
const char *The_GetColorRows (void);
|
||||
const char *The_GetColorRows1 (void);
|
||||
|
||||
void The_ResetRowColor (void);
|
||||
void The_ResetRowColor1 (void);
|
||||
|
||||
void The_ChangeRowColor (void);
|
||||
void The_ChangeRowColor1 (void);
|
||||
|
||||
//-------------------------------- Figures ------------------------------------
|
||||
void The_GetAndShowNumUsrsPerTheme (void);
|
||||
|
|
18
swad_user.c
18
swad_user.c
|
@ -4048,7 +4048,7 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List guests' data *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs;
|
||||
NumUsr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -4118,7 +4118,7 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List students' data *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs;
|
||||
NumUsr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -4190,7 +4190,7 @@ static void Usr_ListMainDataTchs (Rol_Role_t Role,
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List teachers' data *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs;
|
||||
NumUsr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -4288,7 +4288,7 @@ void Usr_ListAllDataGsts (void)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List guests' data *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_GST].Lst[NumUsr].UsrCod;
|
||||
|
@ -4489,7 +4489,7 @@ void Usr_ListAllDataStds (void)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List students' data *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod;
|
||||
|
@ -4554,7 +4554,7 @@ static void Usr_ListUsrsForSelection (Rol_Role_t Role,
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List users' data *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod;
|
||||
|
@ -4691,7 +4691,7 @@ static void Usr_ListRowsAllDataTchs (Rol_Role_t Role,
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List data of teachers *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod;
|
||||
|
@ -4762,7 +4762,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List data of users *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < NumUsrs;
|
||||
NumUsr++, The_ChangeRowColor ())
|
||||
{
|
||||
|
@ -4937,7 +4937,7 @@ void Usr_ListDataAdms (void)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** List data of administrators *****/
|
||||
for (NumUsr = 0;
|
||||
for (NumUsr = 0, The_ResetRowColor ();
|
||||
NumUsr < Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].UsrCod;
|
||||
|
|
Loading…
Reference in New Issue