mirror of https://github.com/acanas/swad-core.git
Version 16.228
This commit is contained in:
parent
588c0a5c92
commit
95b28e3c41
|
@ -233,14 +233,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.227.2 (2017-05-30)"
|
#define Log_PLATFORM_VERSION "SWAD 16.228 (2017-05-30)"
|
||||||
#define CSS_FILE "swad16.226.css"
|
#define CSS_FILE "swad16.226.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.227.3: May 30, 2017 Behaviour of registering non-editing teachers in groups similar to registering students. (? lines)
|
Version 16.228: May 30, 2017 Non-editing teachers can not change their selection of groups.
|
||||||
|
Removed alert with origin of copy when pasting. (220722 lines)
|
||||||
Version 16.227.2: May 30, 2017 Button to upload photo integrated in alert. (220694 lines)
|
Version 16.227.2: May 30, 2017 Button to upload photo integrated in alert. (220694 lines)
|
||||||
Version 16.227.1: May 30, 2017 Button to check email integrated in alert. (220693 lines)
|
Version 16.227.1: May 30, 2017 Button to check email integrated in alert. (220693 lines)
|
||||||
Version 16.227: May 30, 2017 Changes in selector or roles in record cards. (220694 lines)
|
Version 16.227: May 30, 2017 Changes in selector or roles in record cards. (220694 lines)
|
||||||
|
|
|
@ -7438,9 +7438,6 @@ void Brw_PasteIntoFileBrowser (void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Write the origin of the copy *****/
|
|
||||||
Brw_WriteCurrentClipboard ();
|
|
||||||
|
|
||||||
/***** Copy files recursively *****/
|
/***** Copy files recursively *****/
|
||||||
Brw_PasteClipboard ();
|
Brw_PasteClipboard ();
|
||||||
|
|
||||||
|
|
73
swad_group.c
73
swad_group.c
|
@ -90,7 +90,8 @@ static void Grp_WriteHeadingGroups (void);
|
||||||
static void Grp_PutIconToEditGroups (void);
|
static void Grp_PutIconToEditGroups (void);
|
||||||
|
|
||||||
static void Grp_ShowWarningToStdsToChangeGrps (void);
|
static void Grp_ShowWarningToStdsToChangeGrps (void);
|
||||||
static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp);
|
static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp,
|
||||||
|
unsigned *NumGrpsThisTypeIBelong);
|
||||||
static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod);
|
static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod);
|
||||||
static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp);
|
static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp);
|
||||||
static void Grp_WriteGrpHead (struct GroupType *GrpTyp);
|
static void Grp_WriteGrpHead (struct GroupType *GrpTyp);
|
||||||
|
@ -1651,11 +1652,13 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
|
||||||
extern const char *Txt_No_groups_have_been_created_in_the_course_X;
|
extern const char *Txt_No_groups_have_been_created_in_the_course_X;
|
||||||
extern const char *Txt_Create_group;
|
extern const char *Txt_Create_group;
|
||||||
unsigned NumGrpTyp;
|
unsigned NumGrpTyp;
|
||||||
|
unsigned NumGrpsThisTypeIBelong;
|
||||||
unsigned NumGrpsIBelong = 0;
|
unsigned NumGrpsIBelong = 0;
|
||||||
bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card)
|
bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card)
|
||||||
bool ICanEdit = !Gbl.Form.Inside &&
|
bool ICanEdit = !Gbl.Form.Inside &&
|
||||||
(Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
|
(Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
|
||||||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
|
||||||
|
bool ICanChangeMySelection = false;
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups
|
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups
|
||||||
{
|
{
|
||||||
|
@ -1686,14 +1689,19 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
|
||||||
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If there are groups of this type
|
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If there are groups of this type
|
||||||
NumGrpsIBelong += Grp_ListGrpsForChange (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]);
|
{
|
||||||
|
ICanChangeMySelection |= Grp_ListGrpsForChange (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
|
&NumGrpsThisTypeIBelong);
|
||||||
|
NumGrpsIBelong += NumGrpsThisTypeIBelong;
|
||||||
|
}
|
||||||
Lay_EndTable ();
|
Lay_EndTable ();
|
||||||
|
|
||||||
/***** End form *****/
|
/***** End form *****/
|
||||||
if (PutFormToChangeGrps)
|
if (PutFormToChangeGrps)
|
||||||
{
|
{
|
||||||
Lay_PutConfirmButton (NumGrpsIBelong ? Txt_Change_my_groups :
|
if (ICanChangeMySelection)
|
||||||
Txt_Enrol_in_groups);
|
Lay_PutConfirmButton (NumGrpsIBelong ? Txt_Change_my_groups :
|
||||||
|
Txt_Enrol_in_groups);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1774,15 +1782,16 @@ static void Grp_ShowWarningToStdsToChangeGrps (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** List the groups of a type to register in ********************/
|
/*************** List the groups of a type to register in ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns the number of groups of this type I belong to
|
// Returns true if I can change my selection
|
||||||
|
|
||||||
static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
|
static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp,
|
||||||
|
unsigned *NumGrpsThisTypeIBelong)
|
||||||
{
|
{
|
||||||
struct ListCodGrps LstGrpsIBelong;
|
struct ListCodGrps LstGrpsIBelong;
|
||||||
unsigned NumGrpThisType;
|
unsigned NumGrpThisType;
|
||||||
struct Group *Grp;
|
struct Group *Grp;
|
||||||
bool IBelongToThisGroup;
|
bool IBelongToThisGroup;
|
||||||
unsigned NumGrpsIBelong;
|
bool ICanChangeMySelection = false;
|
||||||
|
|
||||||
/***** Write heading *****/
|
/***** Write heading *****/
|
||||||
Grp_WriteGrpHead (GrpTyp);
|
Grp_WriteGrpHead (GrpTyp);
|
||||||
|
@ -1790,7 +1799,7 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
|
||||||
/***** Query in the database the group of this type that I belong to *****/
|
/***** Query in the database the group of this type that I belong to *****/
|
||||||
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);
|
||||||
NumGrpsIBelong = LstGrpsIBelong.NumGrps;
|
*NumGrpsThisTypeIBelong = LstGrpsIBelong.NumGrps;
|
||||||
|
|
||||||
/***** List the groups *****/
|
/***** List the groups *****/
|
||||||
for (NumGrpThisType = 0;
|
for (NumGrpThisType = 0;
|
||||||
|
@ -1800,20 +1809,18 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
|
||||||
Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
|
Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
|
||||||
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
|
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
|
||||||
|
|
||||||
/* Put icon to select the group */
|
/* Put radio item or checkbox to select the group */
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"LEFT_MIDDLE");
|
"<td class=\"LEFT_MIDDLE");
|
||||||
if (IBelongToThisGroup)
|
if (IBelongToThisGroup)
|
||||||
fprintf (Gbl.F.Out," LIGHT_BLUE");
|
fprintf (Gbl.F.Out," LIGHT_BLUE");
|
||||||
fprintf (Gbl.F.Out,"\">"
|
fprintf (Gbl.F.Out,"\">"
|
||||||
"<input type=\"");
|
"<input type=\"");
|
||||||
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STD && // If user is a student
|
||||||
// If user is a student and the enrolment is single
|
!GrpTyp->MultipleEnrolment && // ...and the enrolment is single
|
||||||
// and there are more than a group, put a radio item
|
GrpTyp->NumGrps > 1) // ...and there are more than a group
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
|
|
||||||
!GrpTyp->MultipleEnrolment &&
|
|
||||||
GrpTyp->NumGrps > 1)
|
|
||||||
{
|
{
|
||||||
|
/* Put a radio item */
|
||||||
fprintf (Gbl.F.Out,"radio\" id=\"Grp%ld\" name=\"GrpCod%ld\""
|
fprintf (Gbl.F.Out,"radio\" id=\"Grp%ld\" name=\"GrpCod%ld\""
|
||||||
" value=\"%ld\"",
|
" value=\"%ld\"",
|
||||||
Grp->GrpCod,GrpTyp->GrpTypCod,
|
Grp->GrpCod,GrpTyp->GrpTypCod,
|
||||||
|
@ -1822,18 +1829,40 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
|
||||||
fprintf (Gbl.F.Out," onclick=\"selectUnselectRadio(this,this.form.GrpCod%ld,%u)\"",
|
fprintf (Gbl.F.Out," onclick=\"selectUnselectRadio(this,this.form.GrpCod%ld,%u)\"",
|
||||||
GrpTyp->GrpTypCod,GrpTyp->NumGrps);
|
GrpTyp->GrpTypCod,GrpTyp->NumGrps);
|
||||||
}
|
}
|
||||||
else // Put a checkbox item
|
else
|
||||||
|
/* Put a checkbox item */
|
||||||
fprintf (Gbl.F.Out,"checkbox\" id=\"Grp%ld\" name=\"GrpCod%ld\""
|
fprintf (Gbl.F.Out,"checkbox\" id=\"Grp%ld\" name=\"GrpCod%ld\""
|
||||||
" value=\"%ld\"",
|
" value=\"%ld\"",
|
||||||
Grp->GrpCod,GrpTyp->GrpTypCod,
|
Grp->GrpCod,GrpTyp->GrpTypCod,
|
||||||
Grp->GrpCod);
|
Grp->GrpCod);
|
||||||
|
|
||||||
if (IBelongToThisGroup)
|
if (IBelongToThisGroup)
|
||||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
fprintf (Gbl.F.Out," checked=\"checked\""); // Group selected
|
||||||
else if ((Gbl.Usrs.Me.LoggedRole == Rol_STD) &&
|
|
||||||
((!Grp->Open) || (Grp->NumStudents >= Grp->MaxStudents)))
|
switch (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB)
|
||||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
{
|
||||||
fprintf (Gbl.F.Out," /></td>");
|
case Rol_STD:
|
||||||
|
if (Grp->Open) // If group is open
|
||||||
|
{
|
||||||
|
if (IBelongToThisGroup || // I belong to group
|
||||||
|
Grp->NumStudents < Grp->MaxStudents) // Group is not full
|
||||||
|
ICanChangeMySelection = true; // I can register/unregister in this group
|
||||||
|
else // I don't belong to group and it's full
|
||||||
|
fprintf (Gbl.F.Out," disabled=\"disabled\""); // I can not register in this group
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Rol_NET:
|
||||||
|
fprintf (Gbl.F.Out," disabled=\"disabled\""); // I can not register/unregister
|
||||||
|
break;
|
||||||
|
case Rol_TCH:
|
||||||
|
ICanChangeMySelection = true; // I can not register/unregister
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Lay_ShowErrorAndExit ("Wrong role.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fprintf (Gbl.F.Out," />"
|
||||||
|
"</td>");
|
||||||
|
|
||||||
Grp_WriteRowGrp (Grp,IBelongToThisGroup);
|
Grp_WriteRowGrp (Grp,IBelongToThisGroup);
|
||||||
|
|
||||||
|
@ -1843,7 +1872,7 @@ static unsigned Grp_ListGrpsForChange (struct GroupType *GrpTyp)
|
||||||
/***** Free memory with the list of groups a the that belongs the user *****/
|
/***** Free memory with the list of groups a the that belongs the user *****/
|
||||||
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
||||||
|
|
||||||
return NumGrpsIBelong;
|
return ICanChangeMySelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue