Version 16.220.9

This commit is contained in:
Antonio Cañas Vargas 2017-05-22 11:49:16 +02:00
parent 094932ead5
commit 449fcc10ba
4 changed files with 96 additions and 37 deletions

View File

@ -233,14 +233,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.220.8 (2017-05-21)" #define Log_PLATFORM_VERSION "SWAD 16.220.9 (2017-05-22)"
#define CSS_FILE "swad16.209.3.css" #define CSS_FILE "swad16.209.3.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.220.8: May 21, 2017 Changes related with new role. Not finished. (219663 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: 4 changes necessary in database:
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1644','es','N','Confirmar modif. profesor no editor'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1644','es','N','Confirmar modif. profesor no editor');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1645','es','N','Crear usuario como profesor no editor'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1645','es','N','Crear usuario como profesor no editor');

View File

@ -2082,11 +2082,22 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Marks *****/ /***** Marks *****/
case ActSeeAdmMrk: // Access to a marks zone from menu case ActSeeAdmMrk: // Access to a marks zone from menu
/* Set file browser type acording to last group accessed */ /* Set file browser type acording to last group accessed */
Gbl.FileBrowser.Type = (Gbl.Usrs.Me.LoggedRole == Rol_STD) ? switch (Gbl.Usrs.Me.LoggedRole)
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_SHOW_MARKS_GRP : {
Brw_SHOW_MARKS_CRS) : case Rol_STD:
(Gbl.CurrentCrs.Grps.GrpCod > 0 ? Brw_ADMI_MARKS_GRP : case Rol_NET:
Brw_ADMI_MARKS_CRS); Gbl.FileBrowser.Type = (Gbl.CurrentCrs.Grps.GrpCod > 0) ? Brw_SHOW_MARKS_GRP :
Brw_SHOW_MARKS_CRS;
break;
case Rol_TCH:
case Rol_SYS_ADM:
Gbl.FileBrowser.Type = (Gbl.CurrentCrs.Grps.GrpCod > 0) ? Brw_ADMI_MARKS_GRP :
Brw_ADMI_MARKS_CRS;
break;
default:
Lay_ShowErrorAndExit ("Wrong role.");
break;
}
break; break;
case ActChgToSeeMrk: // Access to see a marks zone case ActChgToSeeMrk: // Access to see a marks zone
/* Set file browser type acording to last group accessed */ /* Set file browser type acording to last group accessed */
@ -3097,10 +3108,12 @@ void Brw_AskEditWorksCrs (void)
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
/***** Get and order lists of users from this course *****/ /***** Get and order lists of users from this course *****/
Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS); Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs + Usr_GetListUsrs (Rol_NET,Sco_SCOPE_CRS);
Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs; Usr_GetListUsrs (Rol_TCH,Sco_SCOPE_CRS);
NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_NET].NumUsrs +
Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs;
/***** Draw class photos to select users *****/ /***** Draw class photos to select users *****/
Lay_StartRoundFrame (NULL,Txt_Users, Lay_StartRoundFrame (NULL,Txt_Users,
@ -3125,6 +3138,7 @@ void Brw_AskEditWorksCrs (void)
/* Put list of users to select some of them */ /* Put list of users to select some of them */
Lay_StartTableCenter (0); Lay_StartTableCenter (0);
Usr_ListUsersToSelect (Rol_TCH); Usr_ListUsersToSelect (Rol_TCH);
Usr_ListUsersToSelect (Rol_NET);
Usr_ListUsersToSelect (Rol_STD); Usr_ListUsersToSelect (Rol_STD);
Lay_EndTable (); Lay_EndTable ();
@ -3143,6 +3157,7 @@ void Brw_AskEditWorksCrs (void)
/***** Free memory for users' list *****/ /***** Free memory for users' list *****/
Usr_FreeUsrsList (Rol_TCH); Usr_FreeUsrsList (Rol_TCH);
Usr_FreeUsrsList (Rol_NET);
Usr_FreeUsrsList (Rol_STD); Usr_FreeUsrsList (Rol_STD);
/***** Free memory used by list of selected users' codes *****/ /***** Free memory used by list of selected users' codes *****/
@ -3389,6 +3404,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
extern const char *Txt_View_record_for_this_course; extern const char *Txt_View_record_for_this_course;
bool ShowPhoto; bool ShowPhoto;
char PhotoURL[PATH_MAX + 1]; char PhotoURL[PATH_MAX + 1];
Act_Action_t NextAction;
/***** Show user's photo *****/ /***** Show user's photo *****/
fprintf (Gbl.F.Out,"<td class=\"OWNER_WORKS_PHOTO\">"); fprintf (Gbl.F.Out,"<td class=\"OWNER_WORKS_PHOTO\">");
@ -3403,8 +3419,21 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"<div class=\"OWNER_WORKS_DATA AUTHOR_TXT\""); fprintf (Gbl.F.Out,"<div class=\"OWNER_WORKS_DATA AUTHOR_TXT\"");
Act_FormStart (UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActSeeRecOneStd : switch (UsrDat->RoleInCurrentCrsDB)
ActSeeRecOneTch); {
case Rol_STD:
NextAction = ActSeeRecOneStd;
break;
case Rol_NET:
case Rol_TCH:
NextAction = ActSeeRecOneTch;
break;
default:
NextAction = ActUnk;
Lay_ShowErrorAndExit ("Wrong role.");
break;
}
Act_FormStart (NextAction);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
/***** Show user's ID *****/ /***** Show user's ID *****/
@ -3972,12 +4001,23 @@ static void Brw_WriteSubtitleOfFileBrowser (void)
break; break;
case Brw_SHOW_MARKS_CRS: case Brw_SHOW_MARKS_CRS:
case Brw_SHOW_MARKS_GRP: case Brw_SHOW_MARKS_GRP:
if (Gbl.Usrs.Me.LoggedRole == Rol_STD) switch (Gbl.Usrs.Me.LoggedRole)
sprintf (Subtitle,"(%s)", {
Txt_accessible_only_for_reading_by_you_and_the_teachers_of_the_course); case Rol_STD:
else sprintf (Subtitle,"(%s)",
sprintf (Subtitle,"(%s)", Txt_accessible_only_for_reading_by_you_and_the_teachers_of_the_course);
Txt_the_marks_of_a_student_chosen_at_random_); break;
case Rol_NET:
case Rol_TCH:
case Rol_SYS_ADM:
sprintf (Subtitle,"(%s)",
Txt_the_marks_of_a_student_chosen_at_random_);
break;
default:
Subtitle[0] = '\0';
Lay_ShowErrorAndExit ("Wrong role.");
break;
}
break; break;
case Brw_ADMI_MARKS_CRS: case Brw_ADMI_MARKS_CRS:
case Brw_ADMI_MARKS_GRP: case Brw_ADMI_MARKS_GRP:
@ -5307,8 +5347,8 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,Brw_ExpandTree_t ExpandTree,
/***** Put icon to download ZIP of folder *****/ /***** Put icon to download ZIP of folder *****/
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
if (Gbl.Usrs.Me.LoggedRole >= Rol_STD && // Only ZIP folders if I am student, teacher... if (Gbl.Usrs.Me.LoggedRole >= Rol_STD && // Only ZIP folders if I am student, teacher...
!SeeMarks && // Do not ZIP folders when seeing marks !SeeMarks && // Do not ZIP folders when seeing marks
!(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0) !(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0)
ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName); ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName);
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
} }
@ -10884,10 +10924,17 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment
return false; // I can not edit this assignment return false; // I can not edit this assignment
return ((Gbl.Usrs.Me.LoggedRole == Rol_STD && // Students can edit switch (Gbl.Usrs.Me.LoggedRole)
Gbl.FileBrowser.Asg.Open) || // inside open assignments {
Gbl.Usrs.Me.LoggedRole >= Rol_TCH); // Teachers can edit case Rol_STD: // Students...
// inside open or closed assignments case Rol_NET: // ...and non-editing teachers...
return Gbl.FileBrowser.Asg.Open; // ...can edit inside open assignments
case Rol_TCH: // Teachers...
return true; // ...can edit inside open or closed assignments
default:
break;
}
return false;
default: default:
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type]; return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
} }
@ -10929,10 +10976,17 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment
return false; // I can not create anything inside this assignment return false; // I can not create anything inside this assignment
return ((Gbl.Usrs.Me.LoggedRole == Rol_STD && // Students can create switch (Gbl.Usrs.Me.LoggedRole)
Gbl.FileBrowser.Asg.Open) || // inside open assignments {
Gbl.Usrs.Me.LoggedRole >= Rol_TCH); // Teachers can create case Rol_STD: // Students...
// inside open or closed assignments case Rol_NET: // ...and non-editing teachers...
return Gbl.FileBrowser.Asg.Open; // ...can create inside open assignments
case Rol_TCH: // Teachers...
return true; // ...can create inside open or closed assignments
default:
break;
}
return false;
default: default:
return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type]; return Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type];
} }
@ -10957,7 +11011,8 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STD: // If I am a student, I can modify the file/folder if I am the publisher case Rol_STD: // If I am a student or a non-editing teacher...
case Rol_NET: // ...I can modify the file/folder if I am the publisher
/***** Get all the distinct publishers of files starting by Gbl.FileBrowser.Priv.FullPathInTree from database *****/ /***** Get all the distinct publishers of files starting by Gbl.FileBrowser.Priv.FullPathInTree from database *****/
sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files" sprintf (Query,"SELECT DISTINCT(PublisherUsrCod) FROM files"
" WHERE FileBrowser=%u AND Cod=%ld" " WHERE FileBrowser=%u AND Cod=%ld"

View File

@ -3757,7 +3757,7 @@ static void For_RestrictAccess (void)
break; break;
case For_FORUM_INSTIT_TCHS: case For_FORUM_INSTIT_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location) >= Rol_TCH); Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location) >= Rol_NET);
break; break;
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
@ -3765,7 +3765,7 @@ static void For_RestrictAccess (void)
break; break;
case For_FORUM_CENTRE_TCHS: case For_FORUM_CENTRE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location) >= Rol_TCH); Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location) >= Rol_NET);
break; break;
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
@ -3773,7 +3773,7 @@ static void For_RestrictAccess (void)
break; break;
case For_FORUM_DEGREE_TCHS: case For_FORUM_DEGREE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location) >= Rol_TCH); Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location) >= Rol_NET);
break; break;
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
@ -3781,7 +3781,7 @@ static void For_RestrictAccess (void)
break; break;
case For_FORUM_COURSE_TCHS: case For_FORUM_COURSE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location) >= Rol_TCH); Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location) >= Rol_NET);
break; break;
default: default:
ICanSeeForum = false; ICanSeeForum = false;

View File

@ -452,6 +452,7 @@ void Gbl_InitializeGlobals (void)
void Gbl_Cleanup (void) void Gbl_Cleanup (void)
{ {
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS]; extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
Rol_Role_t Role;
if (!Gbl.Action.UsesAJAX && if (!Gbl.Action.UsesAJAX &&
!Gbl.WebService.IsWebService && !Gbl.WebService.IsWebService &&
@ -478,10 +479,12 @@ void Gbl_Cleanup (void)
Hld_FreeListHolidays (); Hld_FreeListHolidays ();
Lnk_FreeListLinks (); Lnk_FreeListLinks ();
Plg_FreeListPlugins (); Plg_FreeListPlugins ();
Usr_FreeUsrsList (Rol_GST);
Usr_FreeUsrsList (Rol_STD); for (Role = (Rol_Role_t) 0;
Usr_FreeUsrsList (Rol_TCH); Role < Rol_NUM_ROLES;
Usr_FreeUsrsList (Rol_DEG_ADM); Role++)
Usr_FreeUsrsList (Role);
Usr_FreeListOtherRecipients (); Usr_FreeListOtherRecipients ();
Usr_FreeListsSelectedUsrsCods (); Usr_FreeListsSelectedUsrsCods ();
Syl_FreeListItemsSyllabus (); Syl_FreeListItemsSyllabus ();