Version 16.220.10

This commit is contained in:
Antonio Cañas Vargas 2017-05-22 12:23:08 +02:00
parent 449fcc10ba
commit f266182842
12 changed files with 131 additions and 75 deletions

View File

@ -406,6 +406,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
/***** Check if I have permission to see another user's IDs *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_NET:
case Rol_TCH:
/* Check 1: I can see the IDs of users who do not exist in database */
if (UsrDat->UsrCod <= 0) // User does not exist (when creating a new user)
@ -413,7 +414,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
/* Check 2: I can see the IDs of confirmed students */
if (UsrDat->RoleInCurrentCrsDB == Rol_STD && // A student
UsrDat->Accepted) // who accepted registration
UsrDat->Accepted) // who accepted registration
return true;
/* Check 3: I can see the IDs of users with user's data empty */
@ -448,12 +449,23 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
extern const char *The_ClassFormBold[The_NUM_THEMES];
extern const char *Txt_Confirm_ID;
Act_Action_t NextAction;
/***** Start form *****/
Act_FormStartAnchor ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActCnfID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActCnfID_Tch :
ActCnfID_Oth),
Anchor);
switch (UsrDat->RoleInCurrentCrsDB)
{
case Rol_STD:
NextAction = ActCnfID_Std;
break;
case Rol_NET:
case Rol_TCH:
NextAction = ActCnfID_Tch;
break;
default: // Guest, visitor or admin
NextAction = ActCnfID_Oth;
break;
}
Act_FormStartAnchor (NextAction,Anchor);
if (Gbl.Action.Original != ActUnk)
{
Par_PutHiddenParamLong ("OriginalActCod",
@ -490,6 +502,7 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
void ID_PutLinkToChangeUsrIDs (void)
{
extern const char *Txt_Change_IDs;
Act_Action_t NextAction;
/***** Link for changing the password *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
@ -498,13 +511,26 @@ void ID_PutLinkToChangeUsrIDs (void)
Txt_Change_IDs,Txt_Change_IDs,
NULL);
else // Not me
Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActFrmIDsStd :
(Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActFrmIDsTch :
ActFrmIDsOth), // Guest, visitor or admin
NULL,Usr_PutParamOtherUsrCodEncrypted,
{
switch (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB)
{
case Rol_STD:
NextAction = ActFrmIDsStd;
break;
case Rol_NET:
case Rol_TCH:
NextAction = ActFrmIDsTch;
break;
default: // Guest, visitor or admin
NextAction = ActFrmIDsOth;
break;
}
Lay_PutContextualLink (NextAction,NULL,
Usr_PutParamOtherUsrCodEncrypted,
"arroba64x64.gif",
Txt_Change_IDs,Txt_Change_IDs,
NULL);
}
}
/*****************************************************************************/
@ -559,6 +585,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
extern const char *Txt_If_there_are_multiple_versions_of_the_ID_;
extern const char *Txt_The_ID_is_used_in_order_to_facilitate_;
unsigned NumID;
Act_Action_t NextAction;
/***** List existing user's IDs *****/
for (NumID = 0;
@ -587,9 +614,20 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActRemID_Me);
else
{
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActRemID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActRemID_Tch :
ActRemID_Oth)); // Guest, visitor or admin
switch (UsrDat->RoleInCurrentCrsDB)
{
case Rol_STD:
NextAction = ActRemID_Std;
break;
case Rol_NET:
case Rol_TCH:
NextAction = ActRemID_Tch;
break;
default: // Guest, visitor or admin
NextAction = ActRemID_Oth;
break;
}
Act_FormStart (NextAction);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
}
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"UsrID\" value=\"%s\" />",
@ -641,9 +679,20 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewIDMe);
else
{
Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActNewID_Std :
(UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActNewID_Tch :
ActNewID_Oth)); // Guest, visitor or admin
switch (UsrDat->RoleInCurrentCrsDB)
{
case Rol_STD:
NextAction = ActNewID_Std;
break;
case Rol_NET:
case Rol_TCH:
NextAction = ActNewID_Tch;
break;
default: // Guest, visitor or admin
NextAction = ActNewID_Oth;
break;
}
Act_FormStart (NextAction);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
}
fprintf (Gbl.F.Out,"<div class=\"FORM_ACCOUNT\">"

View File

@ -233,13 +233,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.220.9 (2017-05-22)"
#define Log_PLATFORM_VERSION "SWAD 16.220.10 (2017-05-22)"
#define CSS_FILE "swad16.209.3.css"
#define JS_FILE "swad16.206.3.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 16.220.10:May 22, 2017 Changes related with new role. Not finished. (219775 lines)
Version 16.220.9: May 22, 2017 Changes related with new role. Not finished. (219720 lines)
Version 16.220.8: May 22, 2017 Changes related with new role. Not finished. (219663 lines)
4 changes necessary in database:

View File

@ -4709,7 +4709,8 @@ static void Brw_PutCheckboxFullTree (void)
Lay_PutContextualCheckbox (Brw_ActSeeAdm[Gbl.FileBrowser.Type],
Brw_PutParamsFullTree,
"FullTree",Gbl.FileBrowser.FullTree,
"FullTree",
Gbl.FileBrowser.FullTree,false,
Txt_Show_all_files,Txt_Show_all_files);
}

View File

@ -1635,14 +1635,14 @@ void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrS
void Grp_ReqRegisterInGrps (void)
{
/***** Show list of groups to register/remove me *****/
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STD));
Grp_ShowLstGrpsToChgMyGrps ();
}
/*****************************************************************************/
/***************** Show list of groups to register/remove me *****************/
/*****************************************************************************/
void Grp_ShowLstGrpsToChgMyGrps (bool ShowWarningsToStudents)
void Grp_ShowLstGrpsToChgMyGrps (void)
{
extern const char *Hlp_USERS_Groups;
extern const char *Txt_My_groups;
@ -1664,7 +1664,7 @@ void Grp_ShowLstGrpsToChgMyGrps (bool ShowWarningsToStudents)
/***** Show warnings to students *****/
// Students are required to join groups with mandatory enrolment; teachers don't
if (ShowWarningsToStudents)
if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
Grp_ShowWarningToStdsToChangeGrps ();
}

View File

@ -153,7 +153,7 @@ void Grp_RemUsrFromAllGrps (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrV
void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrSvy_t Grp_AsgOrSvy);
void Grp_ReqRegisterInGrps (void);
void Grp_ShowLstGrpsToChgMyGrps (bool ShowWarningsToStudents);
void Grp_ShowLstGrpsToChgMyGrps (void);
void Grp_ShowLstGrpsToChgOtherUsrsGrps (long UsrCod);
void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes);

View File

@ -1116,8 +1116,9 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
break;
case Ind_INDICATORS_FULL:
/* Get number of users */
NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod);
NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod); // Students
NumTchs = Usr_GetNumUsrsInCrs (Rol_NET,CrsCod) + // Non-editing teachers
Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod); // Teachers
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s LEFT_MIDDLE COLOR%u\">"

View File

@ -299,7 +299,7 @@ extern const char *Hlp_ASSESSMENT_System_edit;
static void Inf_PutButtonToEditInfo (void);
static void Inf_PutIconToViewInfo (void);
static void Inf_PutCheckboxForceStdsToReadInfo (bool MustBeRead);
static void Inf_PutCheckboxForceStdsToReadInfo (bool MustBeRead,bool Disabled);
static void Inf_PutCheckboxConfirmIHaveReadInfo (void);
static bool Inf_CheckIfIHaveReadInfo (void);
static bool Inf_GetMustBeReadFromForm (void);
@ -340,6 +340,7 @@ void Inf_ShowInfo (void)
extern const char *Txt_No_information;
Inf_InfoSrc_t InfoSrc;
bool MustBeRead;
bool Disabled;
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
bool ShowWarningNoInfo = false;
@ -384,13 +385,15 @@ void Inf_ShowInfo (void)
fprintf (Gbl.F.Out,"</div>");
}
break;
case Rol_NET:
case Rol_TCH:
case Rol_SYS_ADM:
/* Put checkbox to force students to read this couse info */
if (InfoSrc != Inf_INFO_SRC_NONE)
{
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Inf_PutCheckboxForceStdsToReadInfo (MustBeRead);
Disabled = (Gbl.Usrs.Me.LoggedRole == Rol_NET); // Non-editing teachers can not change the status of checkbox
Inf_PutCheckboxForceStdsToReadInfo (MustBeRead,Disabled);
fprintf (Gbl.F.Out,"</div>");
}
break;
@ -480,13 +483,14 @@ void Inf_PutIconToEditInfo (void)
/********** Put a form (checkbox) to force students to read info *************/
/*****************************************************************************/
static void Inf_PutCheckboxForceStdsToReadInfo (bool MustBeRead)
static void Inf_PutCheckboxForceStdsToReadInfo (bool MustBeRead,bool Disabled)
{
extern const char *Txt_Force_students_to_read_this_information;
Lay_PutContextualCheckbox (Inf_ActionsChangeForceReadInfo[Gbl.CurrentCrs.Info.Type],
NULL,
"MustBeRead",MustBeRead,
"MustBeRead",
MustBeRead,Disabled,
Txt_Force_students_to_read_this_information,
Txt_Force_students_to_read_this_information);
}
@ -502,7 +506,8 @@ static void Inf_PutCheckboxConfirmIHaveReadInfo (void)
Lay_PutContextualCheckbox (Inf_ActionsIHaveReadInfo[Gbl.CurrentCrs.Info.Type],
NULL,
"IHaveRead",IHaveRead,
"IHaveRead",
IHaveRead,false,
Txt_I_have_read_this_information,
Txt_I_have_read_this_information);
}

View File

@ -66,6 +66,7 @@ extern struct Globals Gbl;
static void Ins_Configuration (bool PrintView);
static void Ins_PutIconsToPrintAndUpload (void);
static void Ins_ShowNumUsrsInCrssOfIns (Rol_Role_t Role);
static void Ins_ListInstitutions (void);
static bool Ins_CheckIfICanCreateInstitutions (void);
@ -298,7 +299,6 @@ static void Ins_Configuration (bool PrintView)
extern const char *Txt_Courses;
extern const char *Txt_Departments;
extern const char *Txt_Users_of_the_institution;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
unsigned NumCty;
bool PutLink = !PrintView && Gbl.CurrentIns.Ins.WWW[0];
@ -573,45 +573,11 @@ static void Ins_Configuration (bool PrintView)
Txt_Departments,
Dpt_GetNumDepartmentsInInstitution (Gbl.CurrentIns.Ins.InsCod));
/***** Number of teachers in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_TCH,Gbl.CurrentIns.Ins.InsCod));
/***** Number of students in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_STD,Gbl.CurrentIns.Ins.InsCod));
/***** Number of users in courses of this institution *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s + %s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Rol_UNK,Gbl.CurrentIns.Ins.InsCod));
Ins_ShowNumUsrsInCrssOfIns (Rol_TCH);
Ins_ShowNumUsrsInCrssOfIns (Rol_NET);
Ins_ShowNumUsrsInCrssOfIns (Rol_STD);
Ins_ShowNumUsrsInCrssOfIns (Rol_UNK);
}
/***** End table *****/
@ -636,6 +602,30 @@ static void Ins_PutIconsToPrintAndUpload (void)
Log_PutIconToChangeLogo (Sco_SCOPE_INS);
}
/*****************************************************************************/
/************** Number of users in courses of this institution ***************/
/*****************************************************************************/
static void Ins_ShowNumUsrsInCrssOfIns (Rol_Role_t Role)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Users_in_courses;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
(Role == Rol_UNK) ? Txt_Users_in_courses :
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfIns (Role,Gbl.CurrentIns.Ins.InsCod));
}
/*****************************************************************************/
/**************** List the institutions of the current country ***************/
/*****************************************************************************/

View File

@ -1169,7 +1169,8 @@ void Lay_PutContextualLink (Act_Action_t NextAction,const char *Anchor,
void Lay_PutContextualCheckbox (Act_Action_t NextAction,
void (*FuncParams) (),
const char *CheckboxName,bool Checked,
const char *CheckboxName,
bool Checked,bool Disabled,
const char *Title,const char *Text)
{
extern const char *The_ClassFormBold[The_NUM_THEMES];
@ -1197,8 +1198,12 @@ void Lay_PutContextualCheckbox (Act_Action_t NextAction,
CheckboxName);
if (Checked)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
Gbl.Form.Id);
if (Disabled)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
else
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
fprintf (Gbl.F.Out," />");
if (Text)
if (Text[0])
fprintf (Gbl.F.Out,"&nbsp;%s",

View File

@ -71,7 +71,8 @@ void Lay_PutContextualLink (Act_Action_t NextAction,const char *Anchor,
const char *OnSubmit);
void Lay_PutContextualCheckbox (Act_Action_t NextAction,
void (*FuncParams) (),
const char *CheckboxName,bool Checked,
const char *CheckboxName,
bool Checked,bool Disabled,
const char *Title,const char *Text);
void Lay_PutIconLink (const char *Icon,const char *Title,const char *Text,
const char *LinkStyle,const char *OnSubmit);

View File

@ -669,7 +669,8 @@ static void Ntf_WriteFormAllNotifications (bool AllNotifications)
extern const char *Txt_Show_all_NOTIFICATIONS;
Lay_PutContextualCheckbox (ActSeeNtf,NULL,
"All",AllNotifications,
"All",
AllNotifications,false,
Txt_Show_all_notifications,
Txt_Show_all_NOTIFICATIONS);
}

View File

@ -1562,7 +1562,8 @@ static void Rec_WriteFormShowOfficeHoursOneTch (bool ShowOfficeHours)
extern const char *Txt_Show_office_hours;
Lay_PutContextualCheckbox (ActSeeRecOneTch,Rec_PutParamsShowOfficeHoursOneTch,
"ShowOfficeHours",ShowOfficeHours,
"ShowOfficeHours",
ShowOfficeHours,false,
Txt_Show_office_hours,
Txt_Show_office_hours);
}
@ -1572,7 +1573,8 @@ static void Rec_WriteFormShowOfficeHoursSeveralTchs (bool ShowOfficeHours)
extern const char *Txt_Show_office_hours;
Lay_PutContextualCheckbox (ActSeeRecSevTch,Rec_PutParamsShowOfficeHoursSeveralTchs,
"ShowOfficeHours",ShowOfficeHours,
"ShowOfficeHours",
ShowOfficeHours,false,
Txt_Show_office_hours,
Txt_Show_office_hours);
}
@ -2453,7 +2455,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
{
// Don't show groups if I don't belong to course
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Grp_ShowLstGrpsToChgMyGrps ((Gbl.Usrs.Me.LoggedRole == Rol_STD));
Grp_ShowLstGrpsToChgMyGrps ();
}
else
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);