mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-20 00:02:42 +02:00
Version 16.222.2
This commit is contained in:
parent
d0c3e2da33
commit
a58dfc8205
|
@ -233,13 +233,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.222.1 (2017-05-23)"
|
#define Log_PLATFORM_VERSION "SWAD 16.222.2 (2017-05-24)"
|
||||||
#define CSS_FILE "swad16.222.css"
|
#define CSS_FILE "swad16.222.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.222.2: May 24, 2017 Fixed bug in course records related with new role. (220369 lines)
|
||||||
Version 16.222.1: May 23, 2017 Fixed bugs in records and forums related with new role. (220359 lines)
|
Version 16.222.1: May 23, 2017 Fixed bugs in records and forums related with new role. (220359 lines)
|
||||||
Version 16.222: May 23, 2017 Alerts can be closed. (220313 lines)
|
Version 16.222: May 23, 2017 Alerts can be closed. (220313 lines)
|
||||||
Copy the following icon to icon public directory:
|
Copy the following icon to icon public directory:
|
||||||
|
|
133
swad_record.c
133
swad_record.c
|
@ -1719,66 +1719,63 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
bool ICanEditThisField;
|
bool ICanEditThisField;
|
||||||
char Text[Cns_MAX_BYTES_TEXT + 1];
|
char Text[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_STD) // I am a student
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
{
|
{
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
|
case Rol_STD: // I am a student
|
||||||
if (ItsMe) // It's me
|
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
|
||||||
switch (TypeOfView)
|
if (ItsMe) // It's me
|
||||||
{
|
{
|
||||||
case Rec_CRS_LIST_ONE_RECORD:
|
switch (TypeOfView)
|
||||||
case Rec_CRS_LIST_SEVERAL_RECORDS:
|
{
|
||||||
// When listing records, I can see only my record as student
|
case Rec_CRS_LIST_ONE_RECORD:
|
||||||
TypeOfView = Rec_CRS_MY_RECORD_AS_STUDENT_FORM;
|
case Rec_CRS_LIST_SEVERAL_RECORDS:
|
||||||
break;
|
// When listing records, I can see only my record as student
|
||||||
case Rec_CRS_MY_RECORD_AS_STUDENT_FORM:
|
TypeOfView = Rec_CRS_MY_RECORD_AS_STUDENT_FORM;
|
||||||
case Rec_CRS_MY_RECORD_AS_STUDENT_CHECK:
|
break;
|
||||||
case Rec_CRS_PRINT_ONE_RECORD:
|
case Rec_CRS_MY_RECORD_AS_STUDENT_FORM:
|
||||||
case Rec_CRS_PRINT_SEVERAL_RECORDS:
|
case Rec_CRS_MY_RECORD_AS_STUDENT_CHECK:
|
||||||
break;
|
case Rec_CRS_PRINT_ONE_RECORD:
|
||||||
default:
|
case Rec_CRS_PRINT_SEVERAL_RECORDS:
|
||||||
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
break;
|
||||||
break;
|
default:
|
||||||
}
|
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
||||||
else // It's not me ==> I am a student trying to do something forbidden
|
break;
|
||||||
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (TypeOfView)
|
if (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM)
|
||||||
{
|
/* Check if I can edit any of the record fields */
|
||||||
case Rec_CRS_MY_RECORD_AS_STUDENT_FORM:
|
for (NumField = 0;
|
||||||
for (NumField = 0;
|
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
||||||
NumField < Gbl.CurrentCrs.Records.LstFields.Num;
|
NumField++)
|
||||||
NumField++)
|
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
||||||
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
{
|
||||||
{
|
ICanEdit = true;
|
||||||
ICanEdit = true;
|
Act_FormStart (ActRcvRecCrs);
|
||||||
Act_FormStart (ActRcvRecCrs);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
else // It's not me ==> I am a student trying to do something forbidden
|
||||||
|
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
||||||
break;
|
break;
|
||||||
case Rec_CRS_MY_RECORD_AS_STUDENT_CHECK:
|
case Rol_NET:
|
||||||
break;
|
|
||||||
case Rec_CRS_LIST_ONE_RECORD:
|
|
||||||
ICanEdit = true;
|
|
||||||
Act_FormStartAnchor (ActRcvRecOthUsr,Anchor);
|
|
||||||
Par_PutHiddenParamLong ("OriginalActCod",
|
|
||||||
Act_Actions[ActSeeRecOneStd].ActCod); // Original action, used to know where we came from
|
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
|
||||||
break;
|
break;
|
||||||
case Rec_CRS_LIST_SEVERAL_RECORDS:
|
case Rol_TCH:
|
||||||
ICanEdit = true;
|
case Rol_SYS_ADM:
|
||||||
Act_FormStartAnchor (ActRcvRecOthUsr,Anchor);
|
if (TypeOfView == Rec_CRS_LIST_ONE_RECORD ||
|
||||||
Par_PutHiddenParamLong ("OriginalActCod",
|
TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS)
|
||||||
Act_Actions[ActSeeRecSevStd].ActCod); // Original action, used to know where we came from
|
{
|
||||||
Usr_PutHiddenParUsrCodAll (ActRcvRecOthUsr,Gbl.Usrs.Select[Rol_UNK]);
|
ICanEdit = true;
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
Act_FormStartAnchor (ActRcvRecOthUsr,Anchor);
|
||||||
|
Par_PutHiddenParamLong ("OriginalActCod",
|
||||||
|
Act_Actions[ActSeeRecSevStd].ActCod); // Original action, used to know where we came from
|
||||||
|
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||||
|
if (TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS)
|
||||||
|
Usr_PutHiddenParUsrCodAll (ActRcvRecOthUsr,Gbl.Usrs.Select[Rol_UNK]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Rec_CRS_PRINT_ONE_RECORD:
|
|
||||||
case Rec_CRS_PRINT_SEVERAL_RECORDS:
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
Lay_ShowErrorAndExit ("Wrong role.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||||
|
@ -1816,10 +1813,22 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
// If the field must be shown...
|
// If the field must be shown...
|
||||||
if (ShowField)
|
if (ShowField)
|
||||||
{
|
{
|
||||||
ICanEditThisField = TypeOfView == Rec_CRS_LIST_ONE_RECORD ||
|
/* Can I edit this field? */
|
||||||
TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS ||
|
switch (Gbl.Usrs.Me.LoggedRole)
|
||||||
(TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM &&
|
{
|
||||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD);
|
case Rol_STD:
|
||||||
|
ICanEditThisField = (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM &&
|
||||||
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD);
|
||||||
|
break;
|
||||||
|
case Rol_TCH:
|
||||||
|
case Rol_SYS_ADM:
|
||||||
|
ICanEditThisField = (TypeOfView == Rec_CRS_LIST_ONE_RECORD ||
|
||||||
|
TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ICanEditThisField = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Name of the field */
|
/* Name of the field */
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -1835,7 +1844,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
Txt_RECORD_FIELD_VISIBILITY_RECORD[Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility]);
|
Txt_RECORD_FIELD_VISIBILITY_RECORD[Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility]);
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/***** Get the text of the field *****/
|
/* Get the text of the field */
|
||||||
if (Rec_GetFieldFromCrsRecord (UsrDat->UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,&mysql_res))
|
if (Rec_GetFieldFromCrsRecord (UsrDat->UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,&mysql_res))
|
||||||
{
|
{
|
||||||
ThisFieldHasText = true;
|
ThisFieldHasText = true;
|
||||||
|
@ -1844,8 +1853,8 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
else
|
else
|
||||||
ThisFieldHasText = false;
|
ThisFieldHasText = false;
|
||||||
|
|
||||||
/***** Write form, text, or nothing depending on
|
/* Write form, text, or nothing depending on
|
||||||
the user's role and the visibility of the field *****/
|
the user's role and the visibility of the field */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"REC_C2_BOT REC_DAT_BOLD LEFT_TOP COLOR%u\">",
|
fprintf (Gbl.F.Out,"<td class=\"REC_C2_BOT REC_DAT_BOLD LEFT_TOP COLOR%u\">",
|
||||||
Gbl.RowEvenOdd);
|
Gbl.RowEvenOdd);
|
||||||
if (ICanEditThisField) // Show with form
|
if (ICanEditThisField) // Show with form
|
||||||
|
@ -1858,7 +1867,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
fprintf (Gbl.F.Out,"%s",row[0]);
|
fprintf (Gbl.F.Out,"%s",row[0]);
|
||||||
fprintf (Gbl.F.Out,"</textarea>");
|
fprintf (Gbl.F.Out,"</textarea>");
|
||||||
}
|
}
|
||||||
else // Show without form
|
else // Show without form
|
||||||
{
|
{
|
||||||
if (ThisFieldHasText)
|
if (ThisFieldHasText)
|
||||||
{
|
{
|
||||||
|
@ -1874,7 +1883,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/* Free structure that stores the query result */
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user