Version 16.222.2

This commit is contained in:
Antonio Cañas Vargas 2017-05-24 01:43:00 +02:00
parent d0c3e2da33
commit a58dfc8205
2 changed files with 73 additions and 63 deletions

View File

@ -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:

View File

@ -1719,10 +1719,12 @@ 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)
{ {
case Rol_STD: // I am a student
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
if (ItsMe) // It's me if (ItsMe) // It's me
{
switch (TypeOfView) switch (TypeOfView)
{ {
case Rec_CRS_LIST_ONE_RECORD: case Rec_CRS_LIST_ONE_RECORD:
@ -1739,13 +1741,9 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action); Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
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);
}
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++)
@ -1755,29 +1753,28 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
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; break;
case Rec_CRS_LIST_ONE_RECORD: 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[ActSeeRecOneStd].ActCod); // Original action, used to know where we came from {
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
break;
case Rec_CRS_LIST_SEVERAL_RECORDS:
ICanEdit = true; ICanEdit = true;
Act_FormStartAnchor (ActRcvRecOthUsr,Anchor); Act_FormStartAnchor (ActRcvRecOthUsr,Anchor);
Par_PutHiddenParamLong ("OriginalActCod", Par_PutHiddenParamLong ("OriginalActCod",
Act_Actions[ActSeeRecSevStd].ActCod); // Original action, used to know where we came from Act_Actions[ActSeeRecSevStd].ActCod); // Original action, used to know where we came from
Usr_PutHiddenParUsrCodAll (ActRcvRecOthUsr,Gbl.Usrs.Select[Rol_UNK]);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
break; if (TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS)
case Rec_CRS_PRINT_ONE_RECORD: Usr_PutHiddenParUsrCodAll (ActRcvRecOthUsr,Gbl.Usrs.Select[Rol_UNK]);
case Rec_CRS_PRINT_SEVERAL_RECORDS: }
break; break;
default: default:
break; Lay_ShowErrorAndExit ("Wrong role.");
} }
/***** Start frame *****/ /***** Start frame *****/
@ -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 && {
case Rol_STD:
ICanEditThisField = (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM &&
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD); 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
@ -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);
} }
} }