Version20.5

This commit is contained in:
acanas 2020-10-14 00:59:24 +02:00
parent f8d8833d35
commit 1284fabfdc
14 changed files with 185 additions and 208 deletions

View File

@ -72,8 +72,10 @@ static bool ID_CheckIfUsrIDIsValidUsingMinDigits (const char *UsrID,unsigned Min
static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID, static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
const char *Anchor); const char *Anchor);
static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, static void ID_ShowFormChangeUsrID (bool ItsMe,bool IShouldFillInID);
bool ItsMe,bool IShouldFillInID);
static void ID_PutParamsRemoveMyID (void *ID);
static void ID_PutParamsRemoveOtherID (void *ID);
static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe); static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe);
static bool ID_CheckIfConfirmed (long UsrCod,const char *UsrID); static bool ID_CheckIfConfirmed (long UsrCod,const char *UsrID);
@ -523,8 +525,7 @@ void ID_ShowFormChangeMyID (bool IShouldFillInID)
Hlp_PROFILE_Account,Box_NOT_CLOSABLE); Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
/***** Show form to change ID *****/ /***** Show form to change ID *****/
ID_ShowFormChangeUsrID (&Gbl.Usrs.Me.UsrDat, ID_ShowFormChangeUsrID (true, // ItsMe
true, // ItsMe
IShouldFillInID); IShouldFillInID);
/***** End box *****/ /***** End box *****/
@ -556,8 +557,7 @@ void ID_ShowFormChangeOtherUsrID (void)
Hlp_PROFILE_Account,Box_NOT_CLOSABLE); Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
/***** Show form to change ID *****/ /***** Show form to change ID *****/
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat, ID_ShowFormChangeUsrID (false, // ItsMe
false, // ItsMe
false); // IShouldFillInID false); // IShouldFillInID
/***** End box *****/ /***** End box *****/
@ -571,8 +571,7 @@ void ID_ShowFormChangeOtherUsrID (void)
/*********************** Show form to change my user's ID ********************/ /*********************** Show form to change my user's ID ********************/
/*****************************************************************************/ /*****************************************************************************/
static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, static void ID_ShowFormChangeUsrID (bool ItsMe,bool IShouldFillInID)
bool ItsMe,bool IShouldFillInID)
{ {
extern const char *Hlp_PROFILE_Account; extern const char *Hlp_PROFILE_Account;
extern const char *Txt_Please_fill_in_your_ID; extern const char *Txt_Please_fill_in_your_ID;
@ -584,6 +583,8 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
extern const char *Txt_The_ID_is_used_in_order_to_facilitate_; extern const char *Txt_The_ID_is_used_in_order_to_facilitate_;
unsigned NumID; unsigned NumID;
Act_Action_t NextAction; Act_Action_t NextAction;
const struct UsrData *UsrDat = (ItsMe ? &Gbl.Usrs.Me.UsrDat :
&Gbl.Usrs.Other.UsrDat);
/***** Show possible alerts *****/ /***** Show possible alerts *****/
Ale_ShowAlerts (ID_ID_SECTION_ID); Ale_ShowAlerts (ID_ID_SECTION_ID);
@ -622,7 +623,8 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
{ {
/* Form to remove user's ID */ /* Form to remove user's ID */
if (ItsMe) if (ItsMe)
Frm_StartFormAnchor (ActRemMyID,ID_ID_SECTION_ID); Ico_PutContextualIconToRemove (ActRemMyID,ID_ID_SECTION_ID,
ID_PutParamsRemoveMyID,UsrDat->IDs.List[NumID].ID);
else else
{ {
switch (UsrDat->Roles.InCurrentCrs.Role) switch (UsrDat->Roles.InCurrentCrs.Role)
@ -638,12 +640,9 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
NextAction = ActRemID_Oth; NextAction = ActRemID_Oth;
break; break;
} }
Frm_StartFormAnchor (NextAction,ID_ID_SECTION_ID); Ico_PutContextualIconToRemove (NextAction,ID_ID_SECTION_ID,
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); ID_PutParamsRemoveOtherID,UsrDat->IDs.List[NumID].ID);
} }
Par_PutHiddenParamString (NULL,"UsrID",UsrDat->IDs.List[NumID].ID);
Ico_PutIconRemove ();
Frm_EndForm ();
} }
} }
@ -724,6 +723,21 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
HTM_TABLE_End (); HTM_TABLE_End ();
} }
static void ID_PutParamsRemoveMyID (void *ID)
{
if (ID)
Par_PutHiddenParamString (NULL,"UsrID",(char *) ID);
}
static void ID_PutParamsRemoveOtherID (void *ID)
{
if (ID)
{
Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
Par_PutHiddenParamString (NULL,"UsrID",(char *) ID);
}
}
/*****************************************************************************/ /*****************************************************************************/
/********************** Remove one of my user's IDs **************************/ /********************** Remove one of my user's IDs **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -555,7 +555,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.4 (2020-10-13)" #define Log_PLATFORM_VERSION "SWAD 20.5 (2020-10-14)"
#define CSS_FILE "swad20.1.1.css" #define CSS_FILE "swad20.1.1.css"
#define JS_FILE "swad19.254.js" #define JS_FILE "swad19.254.js"
/* /*
@ -581,6 +581,7 @@ TODO: En los resultados de una partida, cuando la pregunta ha sido modificada, n
TODO: Poder editar las partidas, al menos el título, y si es posible, también los grupos. TODO: Poder editar las partidas, al menos el título, y si es posible, también los grupos.
Version 20.5: Oct 14, 2020 Code refactoring in remove icon. (304491 lines)
Version 20.4: Oct 13, 2020 Code refactoring in remove icon. Version 20.4: Oct 13, 2020 Code refactoring in remove icon.
New action to edit a match. Not finished. (304517 lines) New action to edit a match. Not finished. (304517 lines)
Version 20.3.1: Oct 13, 2020 Code refactoring in file browser. (? lines) Version 20.3.1: Oct 13, 2020 Code refactoring in file browser. (? lines)

View File

@ -75,7 +75,7 @@ static void Dpt_EditDepartmentsInternal (void);
static void Dpt_GetListDepartments (struct Dpt_Departments *Departments,long InsCod); static void Dpt_GetListDepartments (struct Dpt_Departments *Departments,long InsCod);
static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departments); static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departments);
static void Dpt_PutParamDptCod (long DptCod); static void Dpt_PutParamDptCod (void *DptCod);
static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName); static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName);
static bool Dpt_CheckIfDepartmentNameExists (const char *FieldName,const char *Name,long DptCod); static bool Dpt_CheckIfDepartmentNameExists (const char *FieldName,const char *Name,long DptCod);
@ -557,12 +557,8 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
if (Dpt->NumTchs) // Department has teachers ==> deletion forbidden if (Dpt->NumTchs) // Department has teachers ==> deletion forbidden
Ico_PutIconRemovalNotAllowed (); Ico_PutIconRemovalNotAllowed ();
else else
{ Ico_PutContextualIconToRemove (ActRemDpt,NULL,
Frm_StartForm (ActRemDpt); Dpt_PutParamDptCod,&Dpt->DptCod);
Dpt_PutParamDptCod (Dpt->DptCod);
Ico_PutIconRemove ();
Frm_EndForm ();
}
HTM_TD_End (); HTM_TD_End ();
/* Department code */ /* Department code */
@ -573,7 +569,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
/* Institution */ /* Institution */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgDptIns); Frm_StartForm (ActChgDptIns);
Dpt_PutParamDptCod (Dpt->DptCod); Dpt_PutParamDptCod (&Dpt->DptCod);
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
"name=\"OthInsCod\" class=\"HIE_SEL_NARROW\""); "name=\"OthInsCod\" class=\"HIE_SEL_NARROW\"");
HTM_OPTION (HTM_Type_STRING,"0",Dpt->InsCod == 0,false, HTM_OPTION (HTM_Type_STRING,"0",Dpt->InsCod == 0,false,
@ -591,7 +587,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
/* Department short name */ /* Department short name */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActRenDptSho); Frm_StartForm (ActRenDptSho);
Dpt_PutParamDptCod (Dpt->DptCod); Dpt_PutParamDptCod (&Dpt->DptCod);
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Dpt->ShrtName, HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Dpt->ShrtName,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"class=\"INPUT_SHORT_NAME\""); "class=\"INPUT_SHORT_NAME\"");
@ -601,7 +597,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
/* Department full name */ /* Department full name */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActRenDptFul); Frm_StartForm (ActRenDptFul);
Dpt_PutParamDptCod (Dpt->DptCod); Dpt_PutParamDptCod (&Dpt->DptCod);
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Dpt->FullName, HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Dpt->FullName,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"class=\"INPUT_FULL_NAME\""); "class=\"INPUT_FULL_NAME\"");
@ -611,7 +607,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
/* Department WWW */ /* Department WWW */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgDptWWW); Frm_StartForm (ActChgDptWWW);
Dpt_PutParamDptCod (Dpt->DptCod); Dpt_PutParamDptCod (&Dpt->DptCod);
HTM_INPUT_URL ("WWW",Dpt->WWW,HTM_SUBMIT_ON_CHANGE, HTM_INPUT_URL ("WWW",Dpt->WWW,HTM_SUBMIT_ON_CHANGE,
"class=\"INPUT_WWW_NARROW\" required=\"required\""); "class=\"INPUT_WWW_NARROW\" required=\"required\"");
Frm_EndForm (); Frm_EndForm ();
@ -633,9 +629,10 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
/****************** Write parameter with code of department ******************/ /****************** Write parameter with code of department ******************/
/*****************************************************************************/ /*****************************************************************************/
static void Dpt_PutParamDptCod (long DptCod) static void Dpt_PutParamDptCod (void *DptCod)
{ {
Par_PutHiddenParamLong (NULL,Dpt_PARAM_DPT_COD_NAME,DptCod); if (DptCod)
Par_PutHiddenParamLong (NULL,Dpt_PARAM_DPT_COD_NAME,*((long *) DptCod));
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -330,8 +330,8 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
static void For_PutIconNewPost (void *Forums); static void For_PutIconNewPost (void *Forums);
static void For_PutAllHiddenParamsNewPost (void *Forums); static void For_PutAllHiddenParamsNewPost (void *Forums);
static void For_ShowAForumPost (const struct For_Forums *Forums, static void For_ShowAForumPost (struct For_Forums *Forums,
unsigned PstNum,long PstCod, unsigned PstNum,
bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1], bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1],
bool NewPst,bool ICanModerateForum); bool NewPst,bool ICanModerateForum);
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC, static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
@ -340,6 +340,8 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
struct Media *Media); struct Media *Media);
static void For_WriteNumberOfPosts (const struct For_Forums *Forums,long UsrCod); static void For_WriteNumberOfPosts (const struct For_Forums *Forums,long UsrCod);
static void For_PutParamsForum (void *Forums);
static void For_PutParamForumSet (For_ForumSet_t ForumSet); static void For_PutParamForumSet (For_ForumSet_t ForumSet);
static void For_PutParamForumLocation (long Location); static void For_PutParamForumLocation (long Location);
static void For_PutHiddenParamThrCod (long ThrCod); static void For_PutHiddenParamThrCod (long ThrCod);
@ -1003,7 +1005,6 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
time_t ReadTimeUTC; // Read time of thread for the current user time_t ReadTimeUTC; // Read time of thread for the current user
time_t CreatTimeUTC; // Creation time of post time_t CreatTimeUTC; // Creation time of post
struct Pagination PaginationPsts; struct Pagination PaginationPsts;
long PstCod;
bool NewPst = false; bool NewPst = false;
bool ICanModerateForum = false; bool ICanModerateForum = false;
@ -1096,7 +1097,7 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
{ {
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
if (sscanf (row[0],"%ld",&PstCod) != 1) if (sscanf (row[0],"%ld",&Forums->PstCod) != 1)
Lay_ShowErrorAndExit ("Wrong code of post."); Lay_ShowErrorAndExit ("Wrong code of post.");
CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[1]); CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
@ -1115,7 +1116,7 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
CreatTimeUTC); CreatTimeUTC);
/* Show post */ /* Show post */
For_ShowAForumPost (Forums,NumPst,PstCod, For_ShowAForumPost (Forums,NumPst,
(NumRow == NumRows),LastSubject, (NumRow == NumRows),LastSubject,
NewPst,ICanModerateForum); NewPst,ICanModerateForum);
@ -1125,7 +1126,7 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
case For_FORUM_COURSE_TCHS: case For_FORUM_COURSE_TCHS:
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
Ntf_MarkNotifAsSeen (Ntf_EVENT_FORUM_POST_COURSE, Ntf_MarkNotifAsSeen (Ntf_EVENT_FORUM_POST_COURSE,
PstCod,Gbl.Hierarchy.Crs.CrsCod, Forums->PstCod,Gbl.Hierarchy.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
break; break;
default: default:
@ -1133,7 +1134,7 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
} }
if (Thread.NumMyPosts) if (Thread.NumMyPosts)
Ntf_MarkNotifAsSeen (Ntf_EVENT_FORUM_REPLY, Ntf_MarkNotifAsSeen (Ntf_EVENT_FORUM_REPLY,
PstCod,-1L, Forums->PstCod,-1L,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
@ -1189,8 +1190,8 @@ static void For_PutAllHiddenParamsNewPost (void *Forums)
/**************************** Show a post from forum *************************/ /**************************** Show a post from forum *************************/
/*****************************************************************************/ /*****************************************************************************/
static void For_ShowAForumPost (const struct For_Forums *Forums, static void For_ShowAForumPost (struct For_Forums *Forums,
unsigned PstNum,long PstCod, unsigned PstNum,
bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1], bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1],
bool NewPst,bool ICanModerateForum) bool NewPst,bool ICanModerateForum)
{ {
@ -1210,7 +1211,6 @@ static void For_ShowAForumPost (const struct For_Forums *Forums,
char Content[Cns_MAX_BYTES_LONG_TEXT + 1]; char Content[Cns_MAX_BYTES_LONG_TEXT + 1];
struct Media Media; struct Media Media;
bool Enabled; bool Enabled;
bool ItsMe;
/***** Initialize structure with user's data *****/ /***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat); Usr_UsrDataConstructor (&UsrDat);
@ -1219,10 +1219,10 @@ static void For_ShowAForumPost (const struct For_Forums *Forums,
Med_MediaConstructor (&Media); Med_MediaConstructor (&Media);
/***** Check if post is enabled *****/ /***** Check if post is enabled *****/
Enabled = For_GetIfPstIsEnabled (PstCod); Enabled = For_GetIfPstIsEnabled (Forums->PstCod);
/***** Get data of post *****/ /***** Get data of post *****/
For_GetPstData (PstCod,&UsrDat.UsrCod,&CreatTimeUTC, For_GetPstData (Forums->PstCod,&UsrDat.UsrCod,&CreatTimeUTC,
Subject,OriginalContent,&Media); Subject,OriginalContent,&Media);
if (Enabled) if (Enabled)
@ -1273,13 +1273,7 @@ static void For_ShowAForumPost (const struct For_Forums *Forums,
Frm_StartFormAnchor (Enabled ? For_ActionsDisPstFor[Forums->Forum.Type] : Frm_StartFormAnchor (Enabled ? For_ActionsDisPstFor[Forums->Forum.Type] :
For_ActionsEnbPstFor[Forums->Forum.Type], For_ActionsEnbPstFor[Forums->Forum.Type],
For_FORUM_POSTS_SECTION_ID); For_FORUM_POSTS_SECTION_ID);
For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current For_PutParamsForum (Forums);
Forums->CurrentPagePsts, // Page of posts = current
Forums->ForumSet,
Forums->ThreadsOrder,
Forums->Forum.Location,
Forums->ThrCod,
PstCod);
Ico_PutIconLink (Enabled ? "eye-green.svg" : Ico_PutIconLink (Enabled ? "eye-green.svg" :
"eye-slash-red.svg", "eye-slash-red.svg",
Str_BuildStringLong (Enabled ? Txt_FORUM_Post_X_allowed_Click_to_ban_it : Str_BuildStringLong (Enabled ? Txt_FORUM_Post_X_allowed_Click_to_ban_it :
@ -1301,28 +1295,12 @@ static void For_ShowAForumPost (const struct For_Forums *Forums,
/***** Form to remove post *****/ /***** Form to remove post *****/
if (LastPst) if (LastPst)
{ if (Usr_ItsMe (UsrDat.UsrCod))
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
if (ItsMe)
{
// Post can be removed if post is the last (without answers) and it's mine // Post can be removed if post is the last (without answers) and it's mine
if (PstNum == 1) // First and unique post in thread Ico_PutContextualIconToRemove (For_ActionsDelPstFor[Forums->Forum.Type],
Frm_StartFormAnchor (For_ActionsDelPstFor[Forums->Forum.Type], PstNum == 1 ? For_FORUM_THREADS_SECTION_ID : // First and unique post in thread
For_FORUM_THREADS_SECTION_ID); For_FORUM_POSTS_SECTION_ID, // Last of several posts in thread
else // Last of several posts in thread For_PutParamsForum,Forums);
Frm_StartFormAnchor (For_ActionsDelPstFor[Forums->Forum.Type],
For_FORUM_POSTS_SECTION_ID);
For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
Forums->CurrentPagePsts, // Page of posts = current
Forums->ForumSet,
Forums->ThreadsOrder,
Forums->Forum.Location,
Forums->ThrCod,
PstCod);
Ico_PutIconRemove ();
Frm_EndForm ();
}
}
HTM_TD_End (); HTM_TD_End ();
/***** Write author *****/ /***** Write author *****/
@ -1499,6 +1477,18 @@ static void For_WriteNumberOfPosts (const struct For_Forums *Forums,long UsrCod)
/************ Put all the hidden parameters related to forums ****************/ /************ Put all the hidden parameters related to forums ****************/
/*****************************************************************************/ /*****************************************************************************/
static void For_PutParamsForum (void *Forums)
{
if (Forums)
For_PutAllHiddenParamsForum (((struct For_Forums *) Forums)->CurrentPageThrs, // Page of threads = current
((struct For_Forums *) Forums)->CurrentPagePsts, // Page of posts = current
((struct For_Forums *) Forums)->ForumSet,
((struct For_Forums *) Forums)->ThreadsOrder,
((struct For_Forums *) Forums)->Forum.Location,
((struct For_Forums *) Forums)->ThrCod,
((struct For_Forums *) Forums)->PstCod);
}
void For_PutAllHiddenParamsForum (unsigned NumPageThreads, void For_PutAllHiddenParamsForum (unsigned NumPageThreads,
unsigned NumPagePosts, unsigned NumPagePosts,
For_ForumSet_t ForumSet, For_ForumSet_t ForumSet,
@ -3329,6 +3319,10 @@ static void For_ListForumThrs (struct For_Forums *Forums,
/***** Initialize structure with user's data *****/ /***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat); Usr_UsrDataConstructor (&UsrDat);
/***** Initialize forums context *****/
Forums->CurrentPagePsts = 1; // Page of posts = first
Forums->PstCod = -1L;
for (NumThr = PaginationThrs->FirstItemVisible, NumThrInScreen = 0, UniqueId = 0, Gbl.RowEvenOdd = 0; for (NumThr = PaginationThrs->FirstItemVisible, NumThrInScreen = 0, UniqueId = 0, Gbl.RowEvenOdd = 0;
NumThr <= PaginationThrs->LastItemVisible; NumThr <= PaginationThrs->LastItemVisible;
NumThr++, NumThrInScreen++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd) NumThr++, NumThrInScreen++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
@ -3336,6 +3330,7 @@ static void For_ListForumThrs (struct For_Forums *Forums,
/***** Get the data of this thread *****/ /***** Get the data of this thread *****/
Thr.ThrCod = ThrCods[NumThrInScreen]; Thr.ThrCod = ThrCods[NumThrInScreen];
For_GetThreadData (&Thr); For_GetThreadData (&Thr);
Forums->ThrCod = Thr.ThrCod;
Style = (Thr.NumUnreadPosts ? "AUTHOR_TXT_NEW" : Style = (Thr.NumUnreadPosts ? "AUTHOR_TXT_NEW" :
"AUTHOR_TXT"); "AUTHOR_TXT");
BgColor = (Thr.ThrCod == ThreadInMyClipboard) ? "LIGHT_GREEN" : BgColor = (Thr.ThrCod == ThreadInMyClipboard) ? "LIGHT_GREEN" :
@ -3368,17 +3363,8 @@ static void For_ListForumThrs (struct For_Forums *Forums,
(1 << Gbl.Usrs.Me.Role.Logged)) // If I have permission to remove thread in this forum... (1 << Gbl.Usrs.Me.Role.Logged)) // If I have permission to remove thread in this forum...
{ {
HTM_BR (); HTM_BR ();
Frm_StartFormAnchor (For_ActionsReqDelThr[Forums->Forum.Type], Ico_PutContextualIconToRemove (For_ActionsReqDelThr[Forums->Forum.Type],For_REMOVE_THREAD_SECTION_ID,
For_REMOVE_THREAD_SECTION_ID); For_PutParamsForum,Forums);
For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
1, // Page of posts = first
Forums->ForumSet,
Forums->ThreadsOrder,
Forums->Forum.Location,
Thr.ThrCod,
-1L);
Ico_PutIconRemove ();
Frm_EndForm ();
} }
/***** Put button to cut the thread for moving it to another forum *****/ /***** Put button to cut the thread for moving it to another forum *****/

View File

@ -2127,13 +2127,8 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games,
/* Put icon to remove the question */ /* Put icon to remove the question */
if (ICanEditQuestions) if (ICanEditQuestions)
{ Ico_PutContextualIconToRemove (ActReqRemGamQst,NULL,
Frm_StartForm (ActReqRemGamQst); Gam_PutParamsOneQst,Games);
Gam_PutParams (Games);
Gam_PutParamQstInd (QstInd);
Ico_PutIconRemove ();
Frm_EndForm ();
}
else else
Ico_PutIconRemovalNotAllowed (); Ico_PutIconRemovalNotAllowed ();

View File

@ -514,17 +514,6 @@ void Ico_PutIconRemovalNotAllowed (void)
Ico_PutIconOff ("trash.svg",Txt_Removal_not_allowed); Ico_PutIconOff ("trash.svg",Txt_Removal_not_allowed);
} }
/*****************************************************************************/
/************************ Put an icon to remove ******************************/
/*****************************************************************************/
void Ico_PutIconRemove (void)
{
extern const char *Txt_Remove;
Ico_PutIconLink ("trash.svg",Txt_Remove);
}
/*****************************************************************************/ /*****************************************************************************/
/*************************** Put an icon to cut ******************************/ /*************************** Put an icon to cut ******************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -101,7 +101,6 @@ void Ico_PutCalculateIcon (const char *Title);
void Ico_PutCalculateIconWithText (const char *Text); void Ico_PutCalculateIconWithText (const char *Text);
void Ico_PutIconRemovalNotAllowed (void); void Ico_PutIconRemovalNotAllowed (void);
void Ico_PutIconRemove (void);
void Ico_PutIconCut (void); void Ico_PutIconCut (void);
void Ico_PutIconPaste (void); void Ico_PutIconPaste (void);

View File

@ -91,8 +91,11 @@ static void Mai_CreateMailDomain (struct Mail *Mai);
static void Mai_PutFormToSelectUsrsToListEmails (__attribute__((unused)) void *Args); static void Mai_PutFormToSelectUsrsToListEmails (__attribute__((unused)) void *Args);
static void Mai_ListEmails (__attribute__((unused)) void *Args); static void Mai_ListEmails (__attribute__((unused)) void *Args);
static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, static void Mai_ShowFormChangeUsrEmail (bool ItsMe,
bool IMustFillInEmail,bool IShouldConfirmEmail); bool IMustFillInEmail,
bool IShouldConfirmEmail);
static void Mai_PutParamsRemoveMyEmail (void *Email);
static void Mai_PutParamsRemoveOtherEmail (void *Email);
static void Mai_RemoveEmail (struct UsrData *UsrDat); static void Mai_RemoveEmail (struct UsrData *UsrDat);
static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]); static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
@ -1174,9 +1177,9 @@ void Mai_ShowFormChangeMyEmail (bool IMustFillInEmail,bool IShouldConfirmEmail)
Hlp_PROFILE_Account,Box_NOT_CLOSABLE); Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
/***** Show form to change email *****/ /***** Show form to change email *****/
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Me.UsrDat, Mai_ShowFormChangeUsrEmail (true, // ItsMe
true, // ItsMe IMustFillInEmail,
IMustFillInEmail,IShouldConfirmEmail); IShouldConfirmEmail);
/***** End box *****/ /***** End box *****/
Box_BoxEnd (); Box_BoxEnd ();
@ -1207,8 +1210,7 @@ void Mai_ShowFormChangeOtherUsrEmail (void)
Hlp_PROFILE_Account,Box_NOT_CLOSABLE); Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
/***** Show form to change email *****/ /***** Show form to change email *****/
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat, Mai_ShowFormChangeUsrEmail (false, // ItsMe
false, // ItsMe
false, // IMustFillInEmail false, // IMustFillInEmail
false); // IShouldConfirmEmail false); // IShouldConfirmEmail
@ -1223,8 +1225,9 @@ void Mai_ShowFormChangeOtherUsrEmail (void)
/********************** Show form to change user's email *********************/ /********************** Show form to change user's email *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, static void Mai_ShowFormChangeUsrEmail (bool ItsMe,
bool IMustFillInEmail,bool IShouldConfirmEmail) bool IMustFillInEmail,
bool IShouldConfirmEmail)
{ {
extern const char *Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_address; extern const char *Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_address;
extern const char *Txt_Please_confirm_your_email_address; extern const char *Txt_Please_confirm_your_email_address;
@ -1243,6 +1246,8 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
unsigned NumEmail; unsigned NumEmail;
bool Confirmed; bool Confirmed;
Act_Action_t NextAction; Act_Action_t NextAction;
const struct UsrData *UsrDat = (ItsMe ? &Gbl.Usrs.Me.UsrDat :
&Gbl.Usrs.Other.UsrDat);
/***** Show possible alerts *****/ /***** Show possible alerts *****/
Ale_ShowAlerts (Mai_EMAIL_SECTION_ID); Ale_ShowAlerts (Mai_EMAIL_SECTION_ID);
@ -1299,7 +1304,8 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
/* Form to remove email */ /* Form to remove email */
if (ItsMe) if (ItsMe)
Frm_StartFormAnchor (ActRemMyMai,Mai_EMAIL_SECTION_ID); Ico_PutContextualIconToRemove (ActRemMyMai,Mai_EMAIL_SECTION_ID,
Mai_PutParamsRemoveMyEmail,row[0]);
else else
{ {
switch (UsrDat->Roles.InCurrentCrs.Role) switch (UsrDat->Roles.InCurrentCrs.Role)
@ -1315,12 +1321,9 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
NextAction = ActRemMaiOth; NextAction = ActRemMaiOth;
break; break;
} }
Frm_StartFormAnchor (NextAction,Mai_EMAIL_SECTION_ID); Ico_PutContextualIconToRemove (NextAction,Mai_EMAIL_SECTION_ID,
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Mai_PutParamsRemoveOtherEmail,row[0]);
} }
Par_PutHiddenParamString (NULL,"Email",row[0]);
Ico_PutIconRemove ();
Frm_EndForm ();
/* Email */ /* Email */
HTM_Txt (row[0]); HTM_Txt (row[0]);
@ -1418,6 +1421,21 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
HTM_TABLE_End (); HTM_TABLE_End ();
} }
static void Mai_PutParamsRemoveMyEmail (void *Email)
{
if (Email)
Par_PutHiddenParamString (NULL,"Email",Email);
}
static void Mai_PutParamsRemoveOtherEmail (void *Email)
{
if (Email)
{
Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
Par_PutHiddenParamString (NULL,"Email",Email);
}
}
/*****************************************************************************/ /*****************************************************************************/
/******************** Remove one of my user's emails *************************/ /******************** Remove one of my user's emails *************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -61,8 +61,10 @@ const char *Nck_NICKNAME_SECTION_ID = "nickname_section";
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool ItsMe, static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
bool IMustFillNickname); bool IMustFillNickname);
static void Nck_PutParamsRemoveMyNick (void *Nick);
static void Nck_PutParamsRemoveOtherNick (void *Nick);
static void Nck_RemoveNicknameFromDB (long UsrCod,const char *Nickname); static void Nck_RemoveNicknameFromDB (long UsrCod,const char *Nickname);
@ -192,8 +194,7 @@ long Nck_GetUsrCodFromNickname (const char *Nickname)
void Nck_ShowFormChangeMyNickname (bool IMustFillNickname) void Nck_ShowFormChangeMyNickname (bool IMustFillNickname)
{ {
Nck_ShowFormChangeUsrNickname (&Gbl.Usrs.Me.UsrDat, Nck_ShowFormChangeUsrNickname (true, // ItsMe
true, // ItsMe
IMustFillNickname); IMustFillNickname);
} }
@ -203,8 +204,7 @@ void Nck_ShowFormChangeMyNickname (bool IMustFillNickname)
void Nck_ShowFormChangeOtherUsrNickname (void) void Nck_ShowFormChangeOtherUsrNickname (void)
{ {
Nck_ShowFormChangeUsrNickname (&Gbl.Usrs.Other.UsrDat, Nck_ShowFormChangeUsrNickname (false, // ItsMe
false, // ItsMe
false); // IMustFillNickname false); // IMustFillNickname
} }
@ -212,7 +212,7 @@ void Nck_ShowFormChangeOtherUsrNickname (void)
/*********************** Show form to change my nickname *********************/ /*********************** Show form to change my nickname *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool ItsMe, static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
bool IMustFillNickname) bool IMustFillNickname)
{ {
extern const char *Hlp_PROFILE_Account; extern const char *Hlp_PROFILE_Account;
@ -231,6 +231,8 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
unsigned NumNick; unsigned NumNick;
Act_Action_t NextAction; Act_Action_t NextAction;
char NicknameWithArroba[1 + Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1]; char NicknameWithArroba[1 + Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
const struct UsrData *UsrDat = (ItsMe ? &Gbl.Usrs.Me.UsrDat :
&Gbl.Usrs.Other.UsrDat);
/***** Start section *****/ /***** Start section *****/
HTM_SECTION_Begin (Nck_NICKNAME_SECTION_ID); HTM_SECTION_Begin (Nck_NICKNAME_SECTION_ID);
@ -295,7 +297,8 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
/* Form to remove old nickname */ /* Form to remove old nickname */
if (ItsMe) if (ItsMe)
Frm_StartFormAnchor (ActRemMyNck,Nck_NICKNAME_SECTION_ID); Ico_PutContextualIconToRemove (ActRemMyNck,Nck_NICKNAME_SECTION_ID,
Nck_PutParamsRemoveMyNick,row[0]);
else else
{ {
switch (UsrDat->Roles.InCurrentCrs.Role) switch (UsrDat->Roles.InCurrentCrs.Role)
@ -311,12 +314,9 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
NextAction = ActRemOldNicOth; NextAction = ActRemOldNicOth;
break; break;
} }
Frm_StartFormAnchor (NextAction,Nck_NICKNAME_SECTION_ID); Ico_PutContextualIconToRemove (NextAction,Nck_NICKNAME_SECTION_ID,
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Nck_PutParamsRemoveOtherNick,row[0]);
} }
Par_PutHiddenParamString (NULL,"Nick",row[0]);
Ico_PutIconRemove ();
Frm_EndForm ();
} }
/* Nickname */ /* Nickname */
@ -421,6 +421,21 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
HTM_SECTION_End (); HTM_SECTION_End ();
} }
static void Nck_PutParamsRemoveMyNick (void *Nick)
{
if (Nick)
Par_PutHiddenParamString (NULL,"Nick",Nick);
}
static void Nck_PutParamsRemoveOtherNick (void *Nick)
{
if (Nick)
{
Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
Par_PutHiddenParamString (NULL,"Nick",Nick);
}
}
/*****************************************************************************/ /*****************************************************************************/
/***************************** Remove my nickname ****************************/ /***************************** Remove my nickname ****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -272,16 +272,14 @@ void Rec_ListFieldsRecordsForEdition (void)
/* Write icon to remove the field */ /* Write icon to remove the field */
HTM_TD_Begin ("class=\"BM\""); HTM_TD_Begin ("class=\"BM\"");
Frm_StartForm (ActReqRemFie); Ico_PutContextualIconToRemove (ActReqRemFie,NULL,
Par_PutHiddenParamLong (NULL,"FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Rec_PutParamFieldCod,&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
Ico_PutIconRemove ();
Frm_EndForm ();
HTM_TD_End (); HTM_TD_End ();
/* Name of the field */ /* Name of the field */
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
Frm_StartForm (ActRenFie); Frm_StartForm (ActRenFie);
Par_PutHiddenParamLong (NULL,"FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
HTM_INPUT_TEXT ("FieldName",Rec_MAX_CHARS_NAME_FIELD, HTM_INPUT_TEXT ("FieldName",Rec_MAX_CHARS_NAME_FIELD,
Gbl.Crs.Records.LstFields.Lst[NumField].Name, Gbl.Crs.Records.LstFields.Lst[NumField].Name,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
@ -292,7 +290,7 @@ void Rec_ListFieldsRecordsForEdition (void)
/* Number of lines in the form */ /* Number of lines in the form */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgRowFie); Frm_StartForm (ActChgRowFie);
Par_PutHiddenParamLong (NULL,"FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
snprintf (StrNumLines,sizeof (StrNumLines), snprintf (StrNumLines,sizeof (StrNumLines),
"%u", "%u",
Gbl.Crs.Records.LstFields.Lst[NumField].NumLines); Gbl.Crs.Records.LstFields.Lst[NumField].NumLines);
@ -305,7 +303,7 @@ void Rec_ListFieldsRecordsForEdition (void)
/* Visibility of a field */ /* Visibility of a field */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgVisFie); Frm_StartForm (ActChgVisFie);
Par_PutHiddenParamLong (NULL,"FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
"name=\"Visibility\""); "name=\"Visibility\"");
for (Vis = (Rec_VisibilityRecordFields_t) 0; for (Vis = (Rec_VisibilityRecordFields_t) 0;

View File

@ -3322,16 +3322,15 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys,
{ {
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
/* Write icon to remove the question */ /* Initialize context */
Frm_StartForm (ActReqRemSvyQst);
Svy_PutParamSvyCod (Svy->SvyCod);
Svy_PutParamQstCod (SvyQst.QstCod);
Ico_PutIconRemove ();
Frm_EndForm ();
/* Write icon to edit the question */
Surveys->SvyCod = Svy->SvyCod; Surveys->SvyCod = Svy->SvyCod;
Surveys->QstCod = SvyQst.QstCod; Surveys->QstCod = SvyQst.QstCod;
/* Write icon to remove the question */
Ico_PutContextualIconToRemove (ActReqRemSvyQst,NULL,
Svy_PutParamsToEditQuestion,Surveys);
/* Write icon to edit the question */
Ico_PutContextualIconToEdit (ActEdiOneSvyQst,NULL, Ico_PutContextualIconToEdit (ActEdiOneSvyQst,NULL,
Svy_PutParamsToEditQuestion,Surveys); Svy_PutParamsToEditQuestion,Surveys);

View File

@ -153,7 +153,7 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test,
static void Tst_ListOneQstToEdit (struct Tst_Test *Test); static void Tst_ListOneQstToEdit (struct Tst_Test *Test);
static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test, static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
MYSQL_RES *mysql_res); MYSQL_RES *mysql_res);
static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test); static void Tst_WriteHeadingRowQuestionsForEdition (struct Tst_Test *Test);
static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst); static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst);
static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exams, static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exams,
unsigned NumQsts, unsigned NumQsts,
@ -210,10 +210,8 @@ static Tst_AnswerType_t Tst_ConvertFromUnsignedStrToAnsTyp (const char *Unsigned
static void Tst_GetQstFromForm (struct Tst_Question *Question); static void Tst_GetQstFromForm (struct Tst_Question *Question);
static void Tst_MoveMediaToDefinitiveDirectories (struct Tst_Question *Question); static void Tst_MoveMediaToDefinitiveDirectories (struct Tst_Question *Question);
static void Tst_PutParamsRemoveSelectedQsts (void *Test);
static void Tst_PutIconToRemoveOneQst (void *QstCod); static void Tst_PutIconToRemoveOneQst (void *QstCod);
static void Tst_PutParamsRemoveOnlyThisQst (void *QstCod); static void Tst_PutParamsRemoveOnlyThisQst (void *QstCod);
static void Tst_PutParamsRemoveOneQstWhileEditing (void *Test);
static void Tst_RemoveOneQstFromDB (long CrsCod,long QstCod); static void Tst_RemoveOneQstFromDB (long CrsCod,long QstCod);
static void Tst_InsertOrUpdateQstIntoDB (struct Tst_Question *Question); static void Tst_InsertOrUpdateQstIntoDB (struct Tst_Question *Question);
@ -1254,7 +1252,7 @@ static void Tst_PutIconsEditBankQsts (void *Test)
case ActRemOneTstQst: // Remove a question case ActRemOneTstQst: // Remove a question
case ActChgShfTstQst: // Change shuffle of a question case ActChgShfTstQst: // Change shuffle of a question
Ico_PutContextualIconToRemove (ActReqRemSevTstQst,NULL, Ico_PutContextualIconToRemove (ActReqRemSevTstQst,NULL,
Tst_PutParamsRemoveSelectedQsts,Test); Tst_PutParamsEditQst,Test);
break; break;
default: default:
break; break;
@ -2223,7 +2221,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
/*********** Write heading row in listing of questions for edition ***********/ /*********** Write heading row in listing of questions for edition ***********/
/*****************************************************************************/ /*****************************************************************************/
static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test) static void Tst_WriteHeadingRowQuestionsForEdition (struct Tst_Test *Test)
{ {
extern const char *Txt_No_INDEX; extern const char *Txt_No_INDEX;
extern const char *Txt_Code; extern const char *Txt_Code;
@ -2258,8 +2256,7 @@ static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test)
if (Test->NumQsts > 1) if (Test->NumQsts > 1)
{ {
Frm_StartForm (ActLstTstQst); Frm_StartForm (ActLstTstQst);
Dat_WriteParamsIniEndDates (); Tst_PutParamsEditQst (Test);
Tst_WriteParamEditQst (Test);
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order); Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order);
HTM_BUTTON_SUBMIT_Begin (Txt_TST_STR_ORDER_FULL[Order],"BT_LINK TIT_TBL",NULL); HTM_BUTTON_SUBMIT_Begin (Txt_TST_STR_ORDER_FULL[Order],"BT_LINK TIT_TBL",NULL);
if (Order == Test->SelectedOrder) if (Order == Test->SelectedOrder)
@ -2300,14 +2297,8 @@ static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst)
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
/* Write icon to remove the question */ /* Write icon to remove the question */
Frm_StartForm (ActReqRemOneTstQst); Ico_PutContextualIconToRemove (ActReqRemOneTstQst,NULL,
Tst_PutParamQstCod (&Test->Question.QstCod); Tst_PutParamsEditQst,Test);
if (Test->NumQsts == 1)
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If there are only one row, don't list again after removing
Dat_WriteParamsIniEndDates ();
Tst_WriteParamEditQst (Test);
Ico_PutIconRemove ();
Frm_EndForm ();
/* Write icon to edit the question */ /* Write icon to edit the question */
Ico_PutContextualIconToEdit (ActEdiOneTstQst,NULL, Ico_PutContextualIconToEdit (ActEdiOneTstQst,NULL,
@ -2348,11 +2339,7 @@ static void Tst_WriteQuestionListing (struct Tst_Test *Test,unsigned NumQst)
Test->Question.Answer.Type == Tst_ANS_MULTIPLE_CHOICE) Test->Question.Answer.Type == Tst_ANS_MULTIPLE_CHOICE)
{ {
Frm_StartForm (ActChgShfTstQst); Frm_StartForm (ActChgShfTstQst);
Tst_PutParamQstCod (&Test->Question.QstCod); Tst_PutParamsEditQst (Test);
Dat_WriteParamsIniEndDates ();
Tst_WriteParamEditQst (Test);
if (Test->NumQsts == 1)
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If editing only one question, don't edit others
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Test->SelectedOrder); Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Test->SelectedOrder);
HTM_INPUT_CHECKBOX ("Shuffle",HTM_SUBMIT_ON_CHANGE, HTM_INPUT_CHECKBOX ("Shuffle",HTM_SUBMIT_ON_CHANGE,
"value=\"Y\"%s", "value=\"Y\"%s",
@ -2685,18 +2672,26 @@ static void Tst_WriteQuestionRowForSelection (unsigned NumQst,
} }
/*****************************************************************************/ /*****************************************************************************/
/*********** Write hidden parameters for edition of test questions ***********/ /************ Put hidden parameters for edition of test questions ************/
/*****************************************************************************/ /*****************************************************************************/
void Tst_WriteParamEditQst (const struct Tst_Test *Test) void Tst_PutParamsEditQst (void *Test)
{ {
Par_PutHiddenParamChar ("AllTags",Test->Tags.All ? 'Y' : if (Test)
'N'); {
Par_PutHiddenParamString (NULL,"ChkTag",Test->Tags.List ? Test->Tags.List : Par_PutHiddenParamChar ("AllTags",((struct Tst_Test *) Test)->Tags.All ? 'Y' :
""); 'N');
Par_PutHiddenParamChar ("AllAnsTypes",Test->AnswerTypes.All ? 'Y' : Par_PutHiddenParamString (NULL,"ChkTag",((struct Tst_Test *) Test)->Tags.List ? ((struct Tst_Test *) Test)->Tags.List :
'N'); "");
Par_PutHiddenParamString (NULL,"AnswerType",Test->AnswerTypes.List); Par_PutHiddenParamChar ("AllAnsTypes",((struct Tst_Test *) Test)->AnswerTypes.All ? 'Y' :
'N');
Par_PutHiddenParamString (NULL,"AnswerType",((struct Tst_Test *) Test)->AnswerTypes.List);
Tst_PutParamQstCod (&((struct Tst_Test *) Test)->Question.QstCod);
// if (Test->NumQsts == 1)
// Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If there are only one row, don't list again after removing
Dat_WriteParamsIniEndDates ();
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4745,9 +4740,9 @@ void Tst_RequestRemoveSelectedQsts (void)
{ {
/***** Show question and button to remove question *****/ /***** Show question and button to remove question *****/
Ale_ShowAlertAndButton (ActRemSevTstQst,NULL,NULL, Ale_ShowAlertAndButton (ActRemSevTstQst,NULL,NULL,
Tst_PutParamsRemoveSelectedQsts,&Test, Tst_PutParamsEditQst,&Test,
Btn_REMOVE_BUTTON,Txt_Remove_questions, Btn_REMOVE_BUTTON,Txt_Remove_questions,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_selected_questions); Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_selected_questions);
} }
else else
Ale_ShowAlert (Ale_ERROR,"Wrong parameters."); Ale_ShowAlert (Ale_ERROR,"Wrong parameters.");
@ -4759,16 +4754,6 @@ void Tst_RequestRemoveSelectedQsts (void)
Tst_TstDestructor (&Test); Tst_TstDestructor (&Test);
} }
/*****************************************************************************/
/**************** Put parameters to remove selected questions ****************/
/*****************************************************************************/
static void Tst_PutParamsRemoveSelectedQsts (void *Test)
{
Dat_WriteParamsIniEndDates ();
Tst_WriteParamEditQst ((struct Tst_Test *) Test);
}
/*****************************************************************************/ /*****************************************************************************/
/************************** Remove several questions *************************/ /************************** Remove several questions *************************/
/*****************************************************************************/ /*****************************************************************************/
@ -4864,7 +4849,7 @@ void Tst_RequestRemoveOneQst (void)
Test.Question.QstCod); Test.Question.QstCod);
else else
Ale_ShowAlertAndButton (ActRemOneTstQst,NULL,NULL, Ale_ShowAlertAndButton (ActRemOneTstQst,NULL,NULL,
Tst_PutParamsRemoveOneQstWhileEditing,&Test, Tst_PutParamsEditQst,&Test,
Btn_REMOVE_BUTTON,Txt_Remove_question, Btn_REMOVE_BUTTON,Txt_Remove_question,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X, Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X,
Test.Question.QstCod); Test.Question.QstCod);
@ -4892,20 +4877,6 @@ static void Tst_PutParamsRemoveOnlyThisQst (void *QstCod)
} }
} }
/*****************************************************************************/
/***** Put parameters to remove question when editing several questions ******/
/*****************************************************************************/
static void Tst_PutParamsRemoveOneQstWhileEditing (void *Test)
{
if (Test)
{
Tst_PutParamQstCod (&(((struct Tst_Test *) Test)->Question.QstCod));
Dat_WriteParamsIniEndDates ();
Tst_WriteParamEditQst ((struct Tst_Test *) Test);
}
}
/*****************************************************************************/ /*****************************************************************************/
/***************************** Remove a question *****************************/ /***************************** Remove a question *****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -125,7 +125,7 @@ void Tst_ListQuestionsToSelectForGame (struct Gam_Games *Games);
void Tst_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *PrintedQuestion, void Tst_GenerateChoiceIndexes (struct TstPrn_PrintedQuestion *PrintedQuestion,
bool Shuffle); bool Shuffle);
void Tst_WriteParamEditQst (const struct Tst_Test *Test); void Tst_PutParamsEditQst (void *Test);
unsigned Tst_GetNumAnswersQst (long QstCod); unsigned Tst_GetNumAnswersQst (long QstCod);
void Tst_GetAnswersQst (struct Tst_Question *Question,MYSQL_RES **mysql_res, void Tst_GetAnswersQst (struct Tst_Question *Question,MYSQL_RES **mysql_res,

View File

@ -65,7 +65,7 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TsI_PutParamsExportQsts (void *TestPtr); static void TsI_PutParamsExportQsts (void *Test);
static void TsI_PutCreateXMLParam (void); static void TsI_PutCreateXMLParam (void);
static void TsI_ExportQuestion (struct Tst_Question *Question,FILE *FileXML); static void TsI_ExportQuestion (struct Tst_Question *Question,FILE *FileXML);
@ -103,18 +103,13 @@ void TsI_PutIconToExportQuestions (struct Tst_Test *Test)
/****************** Put params to export test questions **********************/ /****************** Put params to export test questions **********************/
/*****************************************************************************/ /*****************************************************************************/
static void TsI_PutParamsExportQsts (void *TestPtr) static void TsI_PutParamsExportQsts (void *Test)
{ {
struct Tst_Test *Test; if (Test)
if (TestPtr)
{ {
Test = (struct Tst_Test *) TestPtr; Tst_PutParamsEditQst (Test);
Dat_WriteParamsIniEndDates ();
Tst_WriteParamEditQst (Test);
Par_PutHiddenParamChar ("OnlyThisQst",'N'); Par_PutHiddenParamChar ("OnlyThisQst",'N');
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Test->SelectedOrder); Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) (((struct Tst_Test *) Test)->SelectedOrder));
TsI_PutCreateXMLParam (); TsI_PutCreateXMLParam ();
} }
} }