Version 16.235.3

This commit is contained in:
Antonio Cañas Vargas 2017-06-06 20:27:46 +02:00
parent 82964a2b29
commit de00527146
2 changed files with 95 additions and 17 deletions

View File

@ -242,14 +242,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.235.2 (2017-06-04)" #define Log_PLATFORM_VERSION "SWAD 16.235.3 (2017-06-04)"
#define CSS_FILE "swad16.235.1.css" #define CSS_FILE "swad16.235.1.css"
#define JS_FILE "swad16.206.3.js" #define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.235.2: Jun 04, 2017 Non-editing teacher can access and edit works of students. (221032 lines) Version 16.235.3: Jun 04, 2017 Non-editing teachers can not select/unselect groups to which they don't belong. (221107 lines)
Version 16.235.2: Jun 04, 2017 Non-editing teachers can access and edit works of students. (221032 lines)
Version 16.235.1: Jun 04, 2017 Limited length of connected users at right column. (221027 lines) Version 16.235.1: Jun 04, 2017 Limited length of connected users at right column. (221027 lines)
Version 16.235: Jun 04, 2017 Fixed bug in notifications about enrolment as a non-editing teacher. Version 16.235: Jun 04, 2017 Fixed bug in notifications about enrolment as a non-editing teacher.
Fixed bugs and code refactoring related to users enrolment. (221018 lines) Fixed bugs and code refactoring related to users enrolment. (221018 lines)

View File

@ -419,15 +419,40 @@ static void Grp_PutCheckboxAllGrps (void)
{ {
extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_All_groups; extern const char *Txt_All_groups;
bool ICanSelUnselGroup;
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_NET:
ICanSelUnselGroup = false;
break;
case Rol_STD:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
ICanSelUnselGroup = true;
break;
default:
ICanSelUnselGroup = false;
break;
}
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT\">" fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT\">"
"<label class=\"%s\">" "<label class=\"%s\">"
"<input type=\"checkbox\"" "<input type=\"checkbox\""
" id=\"AllGroups\" name=\"AllGroups\" value=\"Y\"", " id=\"AllGroups\" name=\"AllGroups\" value=\"Y\"",
The_ClassForm[Gbl.Prefs.Theme]); The_ClassForm[Gbl.Prefs.Theme]);
if (Gbl.Usrs.ClassPhoto.AllGroups) if (ICanSelUnselGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); {
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'GrpCods')\" />" if (Gbl.Usrs.ClassPhoto.AllGroups)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'GrpCods')\"");
}
else
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />"
"&nbsp;%s" "&nbsp;%s"
"</label>" "</label>"
"</div>", "</div>",
@ -2007,6 +2032,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp)
unsigned NumGrpSel; unsigned NumGrpSel;
struct ListCodGrps LstGrpsIBelong; struct ListCodGrps LstGrpsIBelong;
bool IBelongToThisGroup; bool IBelongToThisGroup;
bool ICanSelUnselGroup;
struct Group *Grp; struct Group *Grp;
Rol_Role_t Role; Rol_Role_t Role;
@ -2017,14 +2043,39 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp)
Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,GrpTyp->GrpTypCod, Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,GrpTyp->GrpTypCod,
Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong); Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong);
/***** List the groups *****/ /***** List the groups of this type *****/
for (NumGrpThisType = 0; for (NumGrpThisType = 0;
NumGrpThisType < GrpTyp->NumGrps; NumGrpThisType < GrpTyp->NumGrps;
NumGrpThisType++) NumGrpThisType++)
{ {
/* Pointer to group */
Grp = &(GrpTyp->LstGrps[NumGrpThisType]); Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
/* Check if I belong to his group */
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong); IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
/* Check if I can select / unselect this group */
if (IBelongToThisGroup)
ICanSelUnselGroup = true;
else
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_NET:
ICanSelUnselGroup = IBelongToThisGroup;
break;
case Rol_STD:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
ICanSelUnselGroup = true;
break;
default:
ICanSelUnselGroup = false;
break;
}
/* Put checkbox to select the group */ /* Put checkbox to select the group */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_MIDDLE"); "<td class=\"LEFT_MIDDLE");
@ -2046,7 +2097,11 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp)
fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," checked=\"checked\"");
break; break;
} }
fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllGroups')\" /></td>"); if (ICanSelUnselGroup)
fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllGroups')\"");
else
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," /></td>");
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup);
@ -2059,23 +2114,45 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp)
/***** Write rows to select the students who don't belong to any group *****/ /***** Write rows to select the students who don't belong to any group *****/
/* To get the students who don't belong to a type of group, use group code -(GrpTyp->GrpTypCod) */ /* To get the students who don't belong to a type of group, use group code -(GrpTyp->GrpTypCod) */
/* Write checkbox to select the group */ /* Write checkbox to select the group */
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_NET:
ICanSelUnselGroup = false;
break;
case Rol_STD:
case Rol_TCH:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
ICanSelUnselGroup = true;
break;
default:
ICanSelUnselGroup = false;
break;
}
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_MIDDLE\">" "<td class=\"LEFT_MIDDLE\">"
"<input type=\"checkbox\" id=\"Grp%ld\" name=\"GrpCods\"" "<input type=\"checkbox\" id=\"Grp%ld\" name=\"GrpCods\""
" value=\"%ld\"", " value=\"%ld\"",
-(GrpTyp->GrpTypCod), -(GrpTyp->GrpTypCod),
-(GrpTyp->GrpTypCod)); -(GrpTyp->GrpTypCod));
if (Gbl.Usrs.ClassPhoto.AllGroups) if (ICanSelUnselGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); {
if (Gbl.Usrs.ClassPhoto.AllGroups)
fprintf (Gbl.F.Out," checked=\"checked\"");
else
for (NumGrpSel = 0;
NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++)
if (Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == -(GrpTyp->GrpTypCod))
{
fprintf (Gbl.F.Out," checked=\"checked\"");
break;
}
}
else else
for (NumGrpSel = 0; fprintf (Gbl.F.Out," disabled=\"disabled\"");
NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++)
if (Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == -(GrpTyp->GrpTypCod))
{
fprintf (Gbl.F.Out," checked=\"checked\"");
break;
}
fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllGroups')\" />" fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllGroups')\" />"
"</td>"); "</td>");