Version 14.62.2

This commit is contained in:
Antonio Cañas Vargas 2015-01-20 20:35:33 +01:00
parent 13c0639822
commit 3b7c87c603
2 changed files with 54 additions and 18 deletions

View File

@ -39,11 +39,12 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.61 (2015/01/20)" #define Log_PLATFORM_VERSION "SWAD 14.62.2 (2015/01/20)"
// 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 | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1
/* /*
Version 14.62.2: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (175407 lines)
Version 14.62.1: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (175371 lines) Version 14.62.1: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (175371 lines)
Version 14.62: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (175296 lines) Version 14.62: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (175296 lines)
3 changes necessary in database: 3 changes necessary in database:

View File

@ -8177,8 +8177,7 @@ void Brw_ShowFileMetadata (void)
char FileNameToShow[NAME_MAX+1]; char FileNameToShow[NAME_MAX+1];
char URL[PATH_MAX+1]; char URL[PATH_MAX+1];
bool Found; bool Found;
bool IsHidden = false; bool ICanView = false;
bool ICanView;
bool ICanEdit; bool ICanEdit;
bool ICanChangePublic = false; bool ICanChangePublic = false;
bool ICanChangeLicense = false; bool ICanChangeLicense = false;
@ -8201,17 +8200,36 @@ void Brw_ShowFileMetadata (void)
/* Add entry to the table of files/folders */ /* Add entry to the table of files/folders */
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType, FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT); Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
Brw_GetFileMetadataByCod (&FileMetadata); // Brw_GetFileMetadataByCod (&FileMetadata);
} }
/***** Check if I can view this file. /***** Check if I can view this file.
It could be marked as hidden by teachers *****/ It could be marked as hidden or in a hidden folder *****/
if (Gbl.FileBrowser.Type == Brw_FILE_BRW_SEE_DOCUMENTS_CRS || ICanView = true;
Gbl.FileBrowser.Type == Brw_FILE_BRW_SEE_DOCUMENTS_GRP) switch (Gbl.FileBrowser.Type)
IsHidden = Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); {
case Brw_FILE_BRW_SEE_DOCUMENTS_INS:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADMIN)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_FILE_BRW_SEE_DOCUMENTS_CTR:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADMIN)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_FILE_BRW_SEE_DOCUMENTS_DEG:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADMIN)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_FILE_BRW_SEE_DOCUMENTS_CRS:
case Brw_FILE_BRW_SEE_DOCUMENTS_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_TEACHER)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
default:
break;
}
} }
ICanView = Found && (!IsHidden || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER);
if (ICanView) if (ICanView)
{ {
if (FileMetadata.FileType == Brw_IS_FILE || if (FileMetadata.FileType == Brw_IS_FILE ||
@ -8583,8 +8601,7 @@ void Brw_DownloadFile (void)
struct FileMetadata FileMetadata; struct FileMetadata FileMetadata;
char URL[PATH_MAX+1]; char URL[PATH_MAX+1];
bool Found; bool Found;
bool IsHidden = false; bool ICanView = false;
bool ICanView;
/***** Get parameters related to file browser *****/ /***** Get parameters related to file browser *****/
Brw_GetParAndInitFileBrowser (); Brw_GetParAndInitFileBrowser ();
@ -8600,18 +8617,36 @@ void Brw_DownloadFile (void)
/* Add entry to the table of files/folders */ /* Add entry to the table of files/folders */
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType, FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT); Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
Brw_GetFileMetadataByCod (&FileMetadata); // Brw_GetFileMetadataByCod (&FileMetadata);
} }
/***** Check if I can view this file. /***** Check if I can view this file.
It could be marked as hidden by teachers *****/ It could be marked as hidden or in a hidden folder *****/
if (Gbl.FileBrowser.Type == Brw_FILE_BRW_SEE_DOCUMENTS_CRS || ICanView = true;
Gbl.FileBrowser.Type == Brw_FILE_BRW_SEE_DOCUMENTS_GRP) switch (Gbl.FileBrowser.Type)
IsHidden = Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); {
case Brw_FILE_BRW_SEE_DOCUMENTS_INS:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADMIN)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_FILE_BRW_SEE_DOCUMENTS_CTR:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADMIN)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_FILE_BRW_SEE_DOCUMENTS_DEG:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADMIN)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_FILE_BRW_SEE_DOCUMENTS_CRS:
case Brw_FILE_BRW_SEE_DOCUMENTS_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_TEACHER)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
default:
break;
}
} }
ICanView = Found &&
(!IsHidden || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER);
if (ICanView) if (ICanView)
{ {
if (FileMetadata.FileType == Brw_IS_FILE || if (FileMetadata.FileType == Brw_IS_FILE ||