Version 23.19.1: Sep 29, 2023 Code refactoring in file browser.

This commit is contained in:
acanas 2023-09-29 14:42:04 +02:00
parent a24ac1beaa
commit a858f03eb5
4 changed files with 34 additions and 22 deletions

View File

@ -1699,6 +1699,35 @@ bool Asg_CheckIfICanCreateIntoAssigment (const struct Asg_Assignment *Asg)
} }
} }
/*****************************************************************************/
/*************************** Set assignment folder ***************************/
/*****************************************************************************/
void Asg_SetFolder (struct Asg_Assignment *Asg,unsigned Level)
{
const char *Ptr;
unsigned i;
if (Level == 1)
// We are in this case: assignments/assignment-folder
Str_Copy (Asg->Folder,Gbl.FileBrowser.FilFolLnk.Name,
sizeof (Asg->Folder) - 1);
else
{
// We are in this case: assignments/assignment-folder/rest-of-path
for (Ptr = Gbl.FileBrowser.FilFolLnk.Path;
*Ptr && *Ptr != '/';
Ptr++); // Go to first '/'
if (*Ptr == '/')
Ptr++; // Skip '/'
for (i = 0;
i < Brw_MAX_BYTES_FOLDER && *Ptr && *Ptr != '/';
i++, Ptr++)
Asg->Folder[i] = *Ptr; // Copy assignment folder
Asg->Folder[i] = '\0';
}
}
/*****************************************************************************/ /*****************************************************************************/
/************************ Get number of assignments **************************/ /************************ Get number of assignments **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -107,6 +107,7 @@ void Asg_RemoveCrsAssignments (long CrsCod);
void Asg_WriteDatesAssignment (const struct Asg_Assignment *Asg); void Asg_WriteDatesAssignment (const struct Asg_Assignment *Asg);
bool Asg_CheckIfICanCreateIntoAssigment (const struct Asg_Assignment *Asg); bool Asg_CheckIfICanCreateIntoAssigment (const struct Asg_Assignment *Asg);
void Asg_SetFolder (struct Asg_Assignment *Asg,unsigned Level);
unsigned Asg_GetNumAssignments (Hie_Level_t Level,unsigned *NumNotif); unsigned Asg_GetNumAssignments (Hie_Level_t Level,unsigned *NumNotif);

View File

@ -2166,7 +2166,6 @@ void Brw_PutParsFileBrowser (const char *PathInTree,const char *FilFolLnkName,
static void Brw_GetParsPathInTreeAndFileName (void) static void Brw_GetParsPathInTreeAndFileName (void)
{ {
const char *Ptr; const char *Ptr;
unsigned i;
Brw_FileType_t FileType; Brw_FileType_t FileType;
char FileNameToShow[NAME_MAX + 1]; char FileNameToShow[NAME_MAX + 1];
@ -2218,24 +2217,7 @@ static void Brw_GetParsPathInTreeAndFileName (void)
/***** Get data of assignment *****/ /***** Get data of assignment *****/
if (Gbl.FileBrowser.Level && Brw_TypeIsAdmAsg[Gbl.FileBrowser.Type]) if (Gbl.FileBrowser.Level && Brw_TypeIsAdmAsg[Gbl.FileBrowser.Type])
{ {
if (Gbl.FileBrowser.Level == 1) Asg_SetFolder (&Gbl.FileBrowser.Asg,Gbl.FileBrowser.Level);
// We are in this case: assignments/assignment-folder
Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnk.Name,
sizeof (Gbl.FileBrowser.Asg.Folder) - 1);
else
{
// We are in this case: assignments/assignment-folder/rest-of-path
for (Ptr = Gbl.FileBrowser.FilFolLnk.Path;
*Ptr && *Ptr != '/';
Ptr++); // Go to first '/'
if (*Ptr == '/')
Ptr++; // Skip '/'
for (i = 0;
i < Brw_MAX_BYTES_FOLDER && *Ptr && *Ptr != '/';
i++, Ptr++)
Gbl.FileBrowser.Asg.Folder[i] = *Ptr; // Copy assignment folder
Gbl.FileBrowser.Asg.Folder[i] = '\0';
}
Asg_GetAssignmentDataByFolder (&Gbl.FileBrowser.Asg); Asg_GetAssignmentDataByFolder (&Gbl.FileBrowser.Asg);
} }
} }
@ -4076,8 +4058,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
{ {
if (Level == 1) // Main folder of the assignment if (Level == 1) // Main folder of the assignment
{ {
Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnk.Name, Asg_SetFolder (&Gbl.FileBrowser.Asg,Level);
sizeof (Gbl.FileBrowser.Asg.Folder) - 1);
Asg_GetAssignmentDataByFolder (&Gbl.FileBrowser.Asg); Asg_GetAssignmentDataByFolder (&Gbl.FileBrowser.Asg);
// The data of this assignment remains in Gbl.FileBrowser.Asg // The data of this assignment remains in Gbl.FileBrowser.Asg
// for all subsequent rows with Level > 1 (files or folders inside this folder), // for all subsequent rows with Level > 1 (files or folders inside this folder),

View File

@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así? Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/ */
#define Log_PLATFORM_VERSION "SWAD 23.19 (2023-09-29)" #define Log_PLATFORM_VERSION "SWAD 23.19.1 (2023-09-29)"
#define CSS_FILE "swad23.16.1.css" #define CSS_FILE "swad23.16.1.css"
#define JS_FILE "swad22.49.js" #define JS_FILE "swad22.49.js"
/* /*
Version 23.19.1: Sep 29, 2023 Code refactoring in file browser. (336609 lines)
Version 23.19: Sep 29, 2023 Code refactoring in file browser. (336600 lines) Version 23.19: Sep 29, 2023 Code refactoring in file browser. (336600 lines)
Version 23.18: Sep 29, 2023 Code refactoring in file browser. (336670 lines) Version 23.18: Sep 29, 2023 Code refactoring in file browser. (336670 lines)
Version 23.17.5: Sep 28, 2023 Code refactoring in scopes. (336638 lines) Version 23.17.5: Sep 28, 2023 Code refactoring in scopes. (336638 lines)