mirror of https://github.com/acanas/swad-core.git
Version 15.203.5
This commit is contained in:
parent
b1423627a6
commit
3788e52ad7
115
swad_ID.c
115
swad_ID.c
|
@ -65,7 +65,8 @@ extern struct Globals Gbl;
|
|||
static bool ID_CheckIfUsrIDIsValidUsingMinDigits (const char *UsrID,unsigned MinDigits);
|
||||
|
||||
static bool ID_ICanSeeAnotherUsrID (struct UsrData *UsrDat);
|
||||
static void ID_PutButtonToConfirmID (void);
|
||||
static void ID_PutButtonToReqConfirmID (struct UsrData *UsrDat,unsigned NumID);
|
||||
static void ID_PutButtonToConfirmID (struct UsrData *UsrDat,unsigned NumID);
|
||||
|
||||
static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe);
|
||||
static bool ID_CheckIfConfirmed (long UsrCod,const char *UsrID);
|
||||
|
@ -387,7 +388,7 @@ void ID_WriteUsrIDs (struct UsrData *UsrDat)
|
|||
|
||||
if (ICanConfirmUsrID &&
|
||||
!UsrDat->IDs.List[NumID].Confirmed)
|
||||
ID_PutButtonToConfirmID ();
|
||||
ID_PutButtonToReqConfirmID (UsrDat,NumID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,12 +427,39 @@ static bool ID_ICanSeeAnotherUsrID (struct UsrData *UsrDat)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Put a button to confirm user's ID ***********************/
|
||||
/******* Put a button to request the confirmation of another user's ID *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ID_PutButtonToConfirmID (void)
|
||||
static void ID_PutButtonToReqConfirmID (struct UsrData *UsrDat,unsigned NumID)
|
||||
{
|
||||
fprintf (Gbl.F.Out," Confirmar ID"); // TODO: Need translation!!!!
|
||||
extern const char *Txt_Confirm;
|
||||
|
||||
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActReqCnfID_Std :
|
||||
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActReqCnfID_Tch :
|
||||
ActReqCnfID_Oth)); // Guest, visitor or admin
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"UsrID\" value=\"%s\" />",
|
||||
UsrDat->IDs.List[NumID].ID);
|
||||
Lay_PutCreateButtonInline (Txt_Confirm);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Put a button to confirm another user's ID ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ID_PutButtonToConfirmID (struct UsrData *UsrDat,unsigned NumID)
|
||||
{
|
||||
extern const char *Txt_Confirm;
|
||||
|
||||
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActCnfID_Std :
|
||||
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActCnfID_Tch :
|
||||
ActCnfID_Oth)); // Guest, visitor or admin
|
||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"UsrID\" value=\"%s\" />",
|
||||
UsrDat->IDs.List[NumID].ID);
|
||||
Lay_PutCreateButton (Txt_Confirm);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -674,7 +702,7 @@ static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
|
||||
if (Pwd_CheckIfICanChangeOtherUsrPassword (UsrDat->UsrCod))
|
||||
{
|
||||
/***** Get new nickname from form *****/
|
||||
/***** Get user's ID from form *****/
|
||||
Par_GetParToText ("UsrID",UsrID,ID_MAX_LENGTH_USR_ID);
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (UsrID);
|
||||
|
@ -878,6 +906,81 @@ static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed
|
|||
DB_QueryINSERT (Query,"can not insert a new ID");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Request the confirmation of another user's ID ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ID_RequestConfirmOtherUsrID (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char UsrID[ID_MAX_LENGTH_USR_ID+1];
|
||||
bool ICanConfirm = false;
|
||||
bool Found;
|
||||
unsigned NumID;
|
||||
unsigned NumIDFound;
|
||||
|
||||
/***** Get other user's code from form and get user's data *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // Not me
|
||||
if (ID_ICanSeeAnotherUsrID (&Gbl.Usrs.Other.UsrDat))
|
||||
ICanConfirm = true;
|
||||
|
||||
if (ICanConfirm)
|
||||
{
|
||||
/***** Get user's ID from form *****/
|
||||
Par_GetParToText ("UsrID",UsrID,ID_MAX_LENGTH_USR_ID);
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (UsrID);
|
||||
Str_ConvertToUpperText (UsrID);
|
||||
|
||||
for (NumID = 0, Found = false;
|
||||
NumID < Gbl.Usrs.Other.UsrDat.IDs.Num && !Found;
|
||||
NumID++)
|
||||
if (!strcmp (UsrID,Gbl.Usrs.Other.UsrDat.IDs.List[NumID].ID))
|
||||
{
|
||||
Found = true;
|
||||
NumIDFound = NumID;
|
||||
}
|
||||
|
||||
if (Found) // Found
|
||||
{
|
||||
if (Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].Confirmed)
|
||||
{
|
||||
/***** ID found and already confirmed *****/
|
||||
sprintf (Gbl.Message,"El ID %s ya había sido confirmado.", // TODO: Need translation!!!
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
/***** Ask for confirmation *****/
|
||||
sprintf (Gbl.Message,"¿Desea confirmar el ID %s?", // TODO: Need translation!!!
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[NumIDFound].ID);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
|
||||
/***** Put button to confirm ID *****/
|
||||
ID_PutButtonToConfirmID (&Gbl.Usrs.Other.UsrDat,NumIDFound);
|
||||
}
|
||||
}
|
||||
else // User's ID not found
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
|
||||
/***** Show user's record *****/
|
||||
Rec_ShowSharedUsrRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat);
|
||||
}
|
||||
else // User not found
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Confirm another user's ID **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ID_ConfirmOtherUsrID (void)
|
||||
{
|
||||
Lay_ShowAlert (Lay_SUCCESS,"Confirmado"); // TODO: Need translation!!!!
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Set a user's ID as confirmed ************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -73,6 +73,9 @@ void ID_RemoveMyUsrID (void);
|
|||
void ID_RemoveOtherUsrID (void);
|
||||
void ID_NewMyUsrID (void);
|
||||
void ID_NewOtherUsrID (void);
|
||||
|
||||
void ID_RequestConfirmOtherUsrID (void);
|
||||
void ID_ConfirmOtherUsrID (void);
|
||||
void ID_ConfirmUsrID (long UsrCod,const char *UsrID);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1007,6 +1007,13 @@ Users:
|
|||
842. ActRcvFrmEnrSevStd Receive a form with IDs of users to be registeres/removed to/from current course
|
||||
843. ActRcvFrmEnrSevTch Receive a form with IDs of users to be registeres/removed to/from current course
|
||||
|
||||
NEW XXX. ActReqCnfID_Oth Request the confirmation of another user's ID
|
||||
NEW XXX. ActReqCnfID_Std Request the confirmation of another user's ID
|
||||
NEW XXX. ActReqCnfID_Tch Request the confirmation of another user's ID
|
||||
NEW XXX. ActCnfID_Oth Confirm another user's ID
|
||||
NEW XXX. ActCnfID_Std Confirm another user's ID
|
||||
NEW XXX. ActCnfID_Tch Confirm another user's ID
|
||||
|
||||
844. ActFrmIDsOth Show form to the change of the IDs of another user
|
||||
845. ActFrmIDsStd Show form to the change of the IDs of another user
|
||||
846. ActFrmIDsTch Show form to the change of the IDs of another user
|
||||
|
@ -2384,6 +2391,13 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActRcvFrmEnrSevStd*/{1428,-1,TabUsr,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReceiveFormAdminStds ,NULL},
|
||||
/* ActRcvFrmEnrSevTch*/{1429,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReceiveFormAdminTchs ,NULL},
|
||||
|
||||
/* ActReqCnfID_Oth */{1565,-1,TabUsr,ActLstOth ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_RequestConfirmOtherUsrID ,NULL},
|
||||
/* ActReqCnfID_Std */{1566,-1,TabUsr,ActLstStd ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_RequestConfirmOtherUsrID ,NULL},
|
||||
/* ActReqCnfID_Tch */{1567,-1,TabUsr,ActLstTch ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_RequestConfirmOtherUsrID ,NULL},
|
||||
/* ActCnfID_Oth */{1568,-1,TabUsr,ActLstOth ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_ConfirmOtherUsrID ,NULL},
|
||||
/* ActCnfID_Std */{1569,-1,TabUsr,ActLstStd ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_ConfirmOtherUsrID ,NULL},
|
||||
/* ActCnfID_Tch */{1570,-1,TabUsr,ActLstTch ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_ConfirmOtherUsrID ,NULL},
|
||||
|
||||
/* ActFrmIDsOth */{1447,-1,TabUsr,ActLstOth ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_ShowFormOthIDs ,NULL},
|
||||
/* ActFrmIDsStd */{1448,-1,TabUsr,ActLstStd ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_ShowFormOthIDs ,NULL},
|
||||
/* ActFrmIDsTch */{1449,-1,TabUsr,ActLstTch ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,ID_ShowFormOthIDs ,NULL},
|
||||
|
@ -4371,6 +4385,12 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
|
|||
ActReqDatTchGrp, // #1562
|
||||
ActChgDatTchGrp, // #1563
|
||||
ActDowTchGrp, // #1564
|
||||
ActReqCnfID_Oth, // #1565
|
||||
ActReqCnfID_Std, // #1566
|
||||
ActReqCnfID_Tch, // #1567
|
||||
ActCnfID_Oth, // #1568
|
||||
ActCnfID_Std, // #1569
|
||||
ActCnfID_Tch, // #1570
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -72,9 +72,9 @@ typedef enum
|
|||
|
||||
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||
|
||||
#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+245+184+144+172+36+28+83)
|
||||
#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+245+184+150+172+36+28+83)
|
||||
|
||||
#define Act_MAX_ACTION_COD 1564
|
||||
#define Act_MAX_ACTION_COD 1570
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
|
||||
|
||||
|
@ -1046,42 +1046,49 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
|
|||
#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+111)
|
||||
#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+112)
|
||||
|
||||
#define ActFrmIDsOth (ActChgNumRowFooGrp+113)
|
||||
#define ActFrmIDsStd (ActChgNumRowFooGrp+114)
|
||||
#define ActFrmIDsTch (ActChgNumRowFooGrp+115)
|
||||
#define ActRemID_Oth (ActChgNumRowFooGrp+116)
|
||||
#define ActRemID_Std (ActChgNumRowFooGrp+117)
|
||||
#define ActRemID_Tch (ActChgNumRowFooGrp+118)
|
||||
#define ActNewID_Oth (ActChgNumRowFooGrp+119)
|
||||
#define ActNewID_Std (ActChgNumRowFooGrp+120)
|
||||
#define ActNewID_Tch (ActChgNumRowFooGrp+121)
|
||||
#define ActFrmPwdOth (ActChgNumRowFooGrp+122)
|
||||
#define ActFrmPwdStd (ActChgNumRowFooGrp+123)
|
||||
#define ActFrmPwdTch (ActChgNumRowFooGrp+124)
|
||||
#define ActChgPwdOth (ActChgNumRowFooGrp+125)
|
||||
#define ActChgPwdStd (ActChgNumRowFooGrp+126)
|
||||
#define ActChgPwdTch (ActChgNumRowFooGrp+127)
|
||||
#define ActFrmMaiOth (ActChgNumRowFooGrp+128)
|
||||
#define ActFrmMaiStd (ActChgNumRowFooGrp+129)
|
||||
#define ActFrmMaiTch (ActChgNumRowFooGrp+130)
|
||||
#define ActRemMaiOth (ActChgNumRowFooGrp+131)
|
||||
#define ActRemMaiStd (ActChgNumRowFooGrp+132)
|
||||
#define ActRemMaiTch (ActChgNumRowFooGrp+133)
|
||||
#define ActNewMaiOth (ActChgNumRowFooGrp+134)
|
||||
#define ActNewMaiStd (ActChgNumRowFooGrp+135)
|
||||
#define ActNewMaiTch (ActChgNumRowFooGrp+136)
|
||||
#define ActReqCnfID_Oth (ActChgNumRowFooGrp+113)
|
||||
#define ActReqCnfID_Std (ActChgNumRowFooGrp+114)
|
||||
#define ActReqCnfID_Tch (ActChgNumRowFooGrp+115)
|
||||
#define ActCnfID_Oth (ActChgNumRowFooGrp+116)
|
||||
#define ActCnfID_Std (ActChgNumRowFooGrp+117)
|
||||
#define ActCnfID_Tch (ActChgNumRowFooGrp+118)
|
||||
|
||||
#define ActRemStdCrs (ActChgNumRowFooGrp+137)
|
||||
#define ActRemTchCrs (ActChgNumRowFooGrp+138)
|
||||
#define ActRemUsrGbl (ActChgNumRowFooGrp+139)
|
||||
#define ActFrmIDsOth (ActChgNumRowFooGrp+119)
|
||||
#define ActFrmIDsStd (ActChgNumRowFooGrp+120)
|
||||
#define ActFrmIDsTch (ActChgNumRowFooGrp+121)
|
||||
#define ActRemID_Oth (ActChgNumRowFooGrp+122)
|
||||
#define ActRemID_Std (ActChgNumRowFooGrp+123)
|
||||
#define ActRemID_Tch (ActChgNumRowFooGrp+124)
|
||||
#define ActNewID_Oth (ActChgNumRowFooGrp+125)
|
||||
#define ActNewID_Std (ActChgNumRowFooGrp+126)
|
||||
#define ActNewID_Tch (ActChgNumRowFooGrp+127)
|
||||
#define ActFrmPwdOth (ActChgNumRowFooGrp+128)
|
||||
#define ActFrmPwdStd (ActChgNumRowFooGrp+129)
|
||||
#define ActFrmPwdTch (ActChgNumRowFooGrp+130)
|
||||
#define ActChgPwdOth (ActChgNumRowFooGrp+131)
|
||||
#define ActChgPwdStd (ActChgNumRowFooGrp+132)
|
||||
#define ActChgPwdTch (ActChgNumRowFooGrp+133)
|
||||
#define ActFrmMaiOth (ActChgNumRowFooGrp+134)
|
||||
#define ActFrmMaiStd (ActChgNumRowFooGrp+135)
|
||||
#define ActFrmMaiTch (ActChgNumRowFooGrp+136)
|
||||
#define ActRemMaiOth (ActChgNumRowFooGrp+137)
|
||||
#define ActRemMaiStd (ActChgNumRowFooGrp+138)
|
||||
#define ActRemMaiTch (ActChgNumRowFooGrp+139)
|
||||
#define ActNewMaiOth (ActChgNumRowFooGrp+140)
|
||||
#define ActNewMaiStd (ActChgNumRowFooGrp+141)
|
||||
#define ActNewMaiTch (ActChgNumRowFooGrp+142)
|
||||
|
||||
#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+140)
|
||||
#define ActRemAllStdCrs (ActChgNumRowFooGrp+141)
|
||||
#define ActRemStdCrs (ActChgNumRowFooGrp+143)
|
||||
#define ActRemTchCrs (ActChgNumRowFooGrp+144)
|
||||
#define ActRemUsrGbl (ActChgNumRowFooGrp+145)
|
||||
|
||||
#define ActReqRemOldUsr (ActChgNumRowFooGrp+142)
|
||||
#define ActRemOldUsr (ActChgNumRowFooGrp+143)
|
||||
#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+146)
|
||||
#define ActRemAllStdCrs (ActChgNumRowFooGrp+147)
|
||||
|
||||
#define ActLstClk (ActChgNumRowFooGrp+144)
|
||||
#define ActReqRemOldUsr (ActChgNumRowFooGrp+148)
|
||||
#define ActRemOldUsr (ActChgNumRowFooGrp+149)
|
||||
|
||||
#define ActLstClk (ActChgNumRowFooGrp+150)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** Social tab *********************************/
|
||||
|
|
|
@ -134,13 +134,15 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.203.4 (2016-04-23)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.203.5 (2016-04-24)"
|
||||
#define CSS_FILE "swad15.203.css"
|
||||
#define JS_FILE "swad15.197.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 15.203.5: Apr 24, 2016 New form to confirm another user's ID. Not finished. (201230 lines)
|
||||
Version 15.203.4: Apr 23, 2016 New form to confirm another user's ID. Not finished. (201140 lines)
|
||||
Version 15.203.3: Apr 23, 2016 New form to confirm another user's ID. Not finished. (201113 lines)
|
||||
Version 15.203.2: Apr 23, 2016 New form to confirm another user's ID. Not finished. (201104 lines)
|
||||
Version 15.203.1: Apr 23, 2016 New form to confirm another user's ID. Not finished. (201090 lines)
|
||||
|
|
Loading…
Reference in New Issue