diff --git a/swad_changelog.h b/swad_changelog.h
index 43cbf130..a5a7a9d4 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -124,7 +124,6 @@
// TODO: Optimize slow query searching messages received
// TODO: FIX BUG: Searching messages received gives unordered list
-// TODO: Add file size to summary in notifications of new files.
// TODO: Put Raśl Hinojosa (iSWAD developer) in a row of marks file of EC (B,C) and publish file
// TODO: Modify WS function getUsers changing: userRole to indicate all users, and a new parameter filter (search string (name, @nickname, mail)) to restring number of users
@@ -134,13 +133,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.234 (2016-06-29)"
+#define Log_PLATFORM_VERSION "SWAD 15.235 (2016-06-29)"
#define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.226.js"
// 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
/*
+ Version 15.235: Jun 29, 2015 Some file metadata are written in content of notifications. (203204 lines)
Version 15.234: Jun 29, 2015 New web service functions getUsers and findUsers. (203169 lines)
Version 15.233.4: Jun 27, 2015 Changes in links in list of notifications. (203065 lines)
Version 15.233.3: Jun 27, 2015 Fixed bug in list of admins. (203074 lines)
diff --git a/swad_file.c b/swad_file.c
index ffc81bcd..0aa17d6b 100644
--- a/swad_file.c
+++ b/swad_file.c
@@ -523,3 +523,43 @@ void Fil_CloseXMLFile (void)
Gbl.F.XML = NULL; // To indicate that it is not open
}
}
+
+/*****************************************************************************/
+/********** Write a quantity of bytes as bytes, KiB, MiB, GiB or TiB *********/
+/*****************************************************************************/
+
+#define Ki 1024.0
+#define Mi 1048576.0
+#define Gi 1073741824.0
+#define Ti 1099511627776.0
+
+void Fil_WriteFileSizeBrief (double SizeInBytes,
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING])
+ {
+ if (SizeInBytes < Ki)
+ sprintf (FileSizeStr,"%.0f B" ,SizeInBytes);
+ else if (SizeInBytes < Mi)
+ sprintf (FileSizeStr,"%.0f KiB",SizeInBytes / Ki);
+ else if (SizeInBytes < Gi)
+ sprintf (FileSizeStr,"%.0f MiB",SizeInBytes / Mi);
+ else if (SizeInBytes < Ti)
+ sprintf (FileSizeStr,"%.0f GiB",SizeInBytes / Gi);
+ else
+ sprintf (FileSizeStr,"%.0f TiB",SizeInBytes / Ti);
+ }
+
+void Fil_WriteFileSizeFull (double SizeInBytes,
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING])
+ {
+ if (SizeInBytes < Ki)
+ sprintf (FileSizeStr,"%.0f B" ,SizeInBytes);
+ else if (SizeInBytes < Mi)
+ sprintf (FileSizeStr,"%.1f KiB",SizeInBytes / Ki);
+ else if (SizeInBytes < Gi)
+ sprintf (FileSizeStr,"%.1f MiB",SizeInBytes / Mi);
+ else if (SizeInBytes < Ti)
+ sprintf (FileSizeStr,"%.1f GiB",SizeInBytes / Gi);
+ else
+ sprintf (FileSizeStr,"%.1f TiB",SizeInBytes / Ti);
+ }
+
diff --git a/swad_file.h b/swad_file.h
index 5e4d30da..7dc78235 100644
--- a/swad_file.h
+++ b/swad_file.h
@@ -52,6 +52,8 @@ struct Files
FILE *XML; // XML file for syllabus, for directory tree
};
+#define Fil_MAX_BYTES_FILE_SIZE_STRING 32
+
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
@@ -73,4 +75,9 @@ void Fil_FastCopyOfFiles (const char *PathSrc,const char *PathTgt);
void Fil_FastCopyOfOpenFiles (FILE *FileSrc,FILE *FileTgt);
void Fil_CloseXMLFile (void);
+void Fil_WriteFileSizeBrief (double SizeInBytes,
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING]);
+void Fil_WriteFileSizeFull (double SizeInBytes,
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING]);
+
#endif
diff --git a/swad_file_browser.c b/swad_file_browser.c
index a28aade4..37244bd9 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -3983,9 +3983,11 @@ static void Brw_ShowSizeOfFileTree (void)
extern const char *Txt_file;
extern const char *Txt_files;
extern const char *Txt_of_PART_OF_A_TOTAL;
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
+ Fil_WriteFileSizeFull ((double) Gbl.FileBrowser.Size.TotalSiz,FileSizeStr);
fprintf (Gbl.F.Out,"
"
- "%u %s; %lu %s; %lu %s; ",
+ "%u %s; %lu %s; %lu %s; %s",
Gbl.FileBrowser.Size.NumLevls,
Gbl.FileBrowser.Size.NumLevls == 1 ? Txt_level :
Txt_levels ,
@@ -3994,15 +3996,16 @@ static void Brw_ShowSizeOfFileTree (void)
Txt_folders,
Gbl.FileBrowser.Size.NumFiles,
Gbl.FileBrowser.Size.NumFiles == 1 ? Txt_file :
- Txt_files);
- Str_WriteSizeInBytesFull ((double) Gbl.FileBrowser.Size.TotalSiz);
+ Txt_files,
+ FileSizeStr);
if (Gbl.FileBrowser.Size.MaxQuota)
{
- fprintf (Gbl.F.Out," (%.1f%% %s ",
- 100.0 * ((double) Gbl.FileBrowser.Size.TotalSiz / (double) Gbl.FileBrowser.Size.MaxQuota),
- Txt_of_PART_OF_A_TOTAL);
- Str_WriteSizeInBytesBrief ((double) Gbl.FileBrowser.Size.MaxQuota);
- fprintf (Gbl.F.Out,")");
+ Fil_WriteFileSizeBrief ((double) Gbl.FileBrowser.Size.MaxQuota,FileSizeStr);
+ fprintf (Gbl.F.Out," (%.1f%% %s %s)",
+ 100.0 * ((double) Gbl.FileBrowser.Size.TotalSiz /
+ (double) Gbl.FileBrowser.Size.MaxQuota),
+ Txt_of_PART_OF_A_TOTAL,
+ FileSizeStr);
}
fprintf (Gbl.F.Out,"
");
}
@@ -6150,14 +6153,18 @@ static void Brw_WriteFileSizeAndDate (Brw_FileType_t FileType,struct FileMetadat
{
extern const char *Txt_Today;
static unsigned UniqueId = 0;
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
/***** Write the file size *****/
- fprintf (Gbl.F.Out,""
- " ",
- Gbl.FileBrowser.TxtStyle,Gbl.RowEvenOdd);
if (FileType == Brw_IS_FILE)
- Str_WriteSizeInBytesBrief ((double) FileMetadata->Size);
- fprintf (Gbl.F.Out," | ");
+ Fil_WriteFileSizeBrief ((double) FileMetadata->Size,FileSizeStr);
+ else
+ FileSizeStr[0] = '\0';
+ fprintf (Gbl.F.Out,""
+ " %s"
+ " | ",
+ Gbl.FileBrowser.TxtStyle,Gbl.RowEvenOdd,
+ FileSizeStr);
/***** Write the date *****/
fprintf (Gbl.F.Out,""
@@ -9193,6 +9200,7 @@ void Brw_ShowFileMetadata (void)
struct UsrData PublisherUsrDat;
char FileNameToShow[NAME_MAX+1];
char URL[PATH_MAX+1];
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
bool Found;
bool ICanView = false;
bool ICanEdit;
@@ -9378,32 +9386,34 @@ void Brw_ShowFileMetadata (void)
Usr_UsrDataDestructor (&PublisherUsrDat);
/***** Write the file size *****/
+ Fil_WriteFileSizeFull ((double) FileMetadata.Size,FileSizeStr);
fprintf (Gbl.F.Out," | "
""
"%s:"
" | "
- "",
- The_ClassForm[Gbl.Prefs.Theme],Txt_File_size);
- Str_WriteSizeInBytesFull ((double) FileMetadata.Size);
- fprintf (Gbl.F.Out," | "
- "
");
+ ""
+ "%s"
+ " | "
+ "",
+ The_ClassForm[Gbl.Prefs.Theme],
+ Txt_File_size,
+ FileSizeStr);
/***** Write the date *****/
fprintf (Gbl.F.Out,""
""
"%s:"
" | "
- "",
- The_ClassForm[Gbl.Prefs.Theme],Txt_Date_of_creation);
-
- fprintf (Gbl.F.Out,"",
+ ""
+ " | "
+ "
",
+ The_ClassForm[Gbl.Prefs.Theme],
+ Txt_Date_of_creation,
(long) FileMetadata.Time,Txt_Today);
- fprintf (Gbl.F.Out,""
- "");
-
/***** Private or public? *****/
fprintf (Gbl.F.Out,""
""
@@ -10425,7 +10435,7 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
}
/*****************************************************************************/
-/*************************** Get file size and date **************************/
+/********************** Get file type, size and date *************************/
/*****************************************************************************/
// Return true if file exists
@@ -11356,49 +11366,75 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t Qu
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
+#define Brw_MAX_BYTES_FILE_CONTENT_STR (100+NAME_MAX + 100+(Usr_MAX_BYTES_NAME+1)*3 + 100+Fil_MAX_BYTES_FILE_SIZE_STRING)
+
void Brw_GetSummaryAndContentOfFile (char *SummaryStr,char **ContentStr,
long FilCod,unsigned MaxChars,bool GetContent)
{
- char Query[256];
- MYSQL_RES *mysql_res;
- MYSQL_ROW row;
- char FullPathInTreeFromDB[PATH_MAX+1];
- char PathUntilFileName[PATH_MAX+1];
- char FileName[NAME_MAX+1];
+ extern const char *Txt_Filename;
+ extern const char *Txt_Uploaded_by;
+ extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
+ extern const char *Txt_File_size;
+ struct FileMetadata FileMetadata;
+ bool Found;
+ bool FileHasPublisher;
+ struct UsrData PublisherUsrDat;
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
+ /***** Return nothing on error *****/
SummaryStr[0] = '\0'; // Return nothing on error
+ *ContentStr = NULL;
- /***** Get subject of message from database *****/
- sprintf (Query,"SELECT Path FROM files WHERE FilCod='%ld'",
- FilCod);
- if (!mysql_query (&Gbl.mysql,Query))
- if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
- {
- /***** Result should have a unique row *****/
- if (mysql_num_rows (mysql_res) == 1)
- {
- /***** Get data of this file *****/
- row = mysql_fetch_row (mysql_res);
+ /***** Get file metadata *****/
+ FileMetadata.FilCod = FilCod;
+ Brw_GetFileMetadataByCod (&FileMetadata);
- /* Path (row[0]) */
- strncpy (FullPathInTreeFromDB,row[0],PATH_MAX);
- FullPathInTreeFromDB[PATH_MAX] = '\0';
- Str_SplitFullPathIntoPathAndFileName (FullPathInTreeFromDB,
- PathUntilFileName,
- FileName);
- strcpy (SummaryStr,FileName);
- if (MaxChars)
- Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
+ /***** Get file type, size and date *****/
+ Gbl.FileBrowser.Type = FileMetadata.FileBrowser;
+ Brw_SetPathFileBrowser ();
+ Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
- if (GetContent)
- { // TODO: Put file metadata into content string
- if ((*ContentStr = (char *) malloc (strlen (FullPathInTreeFromDB)+1)))
- strcpy (*ContentStr,FullPathInTreeFromDB);
- }
- }
+ /***** Copy file name into summary string *****/
+ strcpy (SummaryStr,FileMetadata.FilFolLnkName);
+ if (MaxChars)
+ Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
- mysql_free_result (mysql_res);
- }
+ /***** Copy some file metadata into content string *****/
+ if (GetContent)
+ {
+ if ((*ContentStr = (char *) malloc (Brw_MAX_BYTES_FILE_CONTENT_STR)))
+ {
+ /* Get publisher */
+ if (FileMetadata.PublisherUsrCod > 0)
+ {
+ /* Initialize structure with publisher's data */
+ Usr_UsrDataConstructor (&PublisherUsrDat);
+ PublisherUsrDat.UsrCod = FileMetadata.PublisherUsrCod;
+ FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat);
+ }
+ else
+ /* Unknown publisher */
+ FileHasPublisher = false;
+
+ /* File size */
+ if (Found)
+ Fil_WriteFileSizeFull ((double) FileMetadata.Size,FileSizeStr);
+
+ /* Fill content string */
+ sprintf (*ContentStr,"%s: %s " // File name
+ "%s: %s " // Publisher
+ "%s: %s", // File size
+ Txt_Filename,FileMetadata.FilFolLnkName,
+ Txt_Uploaded_by,FileHasPublisher ? PublisherUsrDat.FullName :
+ Txt_ROLES_SINGUL_Abc[Rol_UNKNOWN][Usr_SEX_UNKNOWN],
+ Txt_File_size,Found ? FileSizeStr :
+ "Not found");
+
+ /* Free memory used for publisher's data */
+ if (FileMetadata.PublisherUsrCod > 0)
+ Usr_UsrDataDestructor (&PublisherUsrDat);
+ }
+ }
}
/*****************************************************************************/
diff --git a/swad_mark.c b/swad_mark.c
index d22da17f..2020876f 100644
--- a/swad_mark.c
+++ b/swad_mark.c
@@ -619,11 +619,10 @@ void Mrk_ShowMyMarks (void)
/***** Get number of rows of header or footer *****/
Mrk_GetNumRowsHeaderAndFooter (&Marks);
-
/***** Set the student whose marks will be shown *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // If I am logged as student...
- UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs
- else // If I am logged as teacher, administrator, superuser...
+ UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs
+ else // If I am logged as teacher, administrator, superuser...
{
/* Select a random student from the course */
if (Gbl.CurrentCrs.Grps.GrpCod > 0) // Group zone
diff --git a/swad_statistic.c b/swad_statistic.c
index 01655214..599fa30e 100644
--- a/swad_statistic.c
+++ b/swad_statistic.c
@@ -5355,15 +5355,22 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
char StrNumFilesPerCrs[10+1];
char StrNumFilesPerUsr[10+1];
struct Sta_SizeOfFileZones SizeOfFileZones;
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
+ char FileSizePerCrsStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
+ char FileSizePerUsrStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
char *Class = (FileZone == Brw_UNKNOWN) ? "DAT_N_LINE_TOP" :
"DAT";
Sta_GetSizeOfFileZoneFromDB (Gbl.Scope.Current,FileZone,&SizeOfFileZones);
+
+ Fil_WriteFileSizeFull ((double) SizeOfFileZones.Size,FileSizeStr);
+
if (SizeOfFileZones.NumCrss == -1)
{
strcpy (StrNumCrss ,"-");
strcpy (StrNumFoldersPerCrs,"-");
strcpy (StrNumFilesPerCrs ,"-");
+ strcpy (FileSizePerCrsStr ,"-");
}
else
{
@@ -5376,6 +5383,10 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.NumFiles /
(double) SizeOfFileZones.NumCrss :
0.0);
+ Fil_WriteFileSizeFull (SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.Size /
+ (double) SizeOfFileZones.NumCrss :
+ 0.0,
+ FileSizePerCrsStr);
}
if (SizeOfFileZones.NumGrps == -1)
@@ -5388,6 +5399,7 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
strcpy (StrNumUsrs ,"-");
strcpy (StrNumFoldersPerUsr,"-");
strcpy (StrNumFilesPerUsr ,"-");
+ strcpy (FileSizePerUsrStr ,"-");
}
else
{
@@ -5400,7 +5412,12 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.NumFiles /
(double) SizeOfFileZones.NumUsrs :
0.0);
+ Fil_WriteFileSizeFull (SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.Size /
+ (double) SizeOfFileZones.NumUsrs :
+ 0.0,
+ FileSizePerUsrStr);
}
+
fprintf (Gbl.F.Out," |
"
""
"%s"
@@ -5423,7 +5440,28 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
" | "
"%lu"
" | "
- "",
+ " | "
+ "%s"
+ " | "
+ ""
+ "%s"
+ " | "
+ ""
+ "%s"
+ " | "
+ ""
+ "%s"
+ " | "
+ ""
+ "%s"
+ " | "
+ ""
+ "%s"
+ " | "
+ ""
+ "%s"
+ " | "
+ "
",
Class,NameOfFileZones,
Class,StrNumCrss,
Class,StrNumGrps,
@@ -5431,44 +5469,13 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
Class,SizeOfFileZones.MaxLevels,
Class,SizeOfFileZones.NumFolders,
Class,SizeOfFileZones.NumFiles,
- Class);
- Str_WriteSizeInBytesFull ((double) SizeOfFileZones.Size);
- fprintf (Gbl.F.Out,""
- ""
- "%s"
- " | "
- ""
- "%s"
- " | "
- "",
+ Class,FileSizeStr,
Class,StrNumFoldersPerCrs,
Class,StrNumFilesPerCrs,
- Class);
- if (SizeOfFileZones.NumCrss == -1)
- fprintf (Gbl.F.Out,"-");
- else
- Str_WriteSizeInBytesFull (SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.Size /
- (double) SizeOfFileZones.NumCrss :
- 0.0);
- fprintf (Gbl.F.Out," | "
- ""
- "%s"
- " | "
- ""
- "%s"
- " | "
- "",
+ Class,FileSizePerCrsStr,
Class,StrNumFoldersPerUsr,
Class,StrNumFilesPerUsr,
- Class);
- if (SizeOfFileZones.NumUsrs == -1)
- fprintf (Gbl.F.Out,"-");
- else
- Str_WriteSizeInBytesFull (SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.Size /
- (double) SizeOfFileZones.NumUsrs :
- 0.0);
- fprintf (Gbl.F.Out," | "
- "");
+ Class,FileSizePerUsrStr);
}
/*****************************************************************************/
diff --git a/swad_string.c b/swad_string.c
index 1cccfead..bdca4ee2 100644
--- a/swad_string.c
+++ b/swad_string.c
@@ -2759,53 +2759,6 @@ void Str_ConvertToValidFileName (char *Str)
}
}
-/*****************************************************************************/
-/********** Write a quantity of bytes as bytes, KiB, MiB, GiB or TiB *********/
-/*****************************************************************************/
-
-#define Ki 1024.0
-#define Mi 1048576.0
-#define Gi 1073741824.0
-#define Ti 1099511627776.0
-
-void Str_WriteSizeInBytesBrief (double SizeInBytes)
- {
- if (SizeInBytes < Ki)
- fprintf (Gbl.F.Out,"%.0f B",
- SizeInBytes);
- else if (SizeInBytes < Mi)
- fprintf (Gbl.F.Out,"%.0f KiB",
- SizeInBytes / Ki);
- else if (SizeInBytes < Gi)
- fprintf (Gbl.F.Out,"%.0f MiB",
- SizeInBytes / Mi);
- else if (SizeInBytes < Ti)
- fprintf (Gbl.F.Out,"%.0f GiB",
- SizeInBytes / Gi);
- else
- fprintf (Gbl.F.Out,"%.0f TiB",
- SizeInBytes / Ti);
- }
-
-void Str_WriteSizeInBytesFull (double SizeInBytes)
- {
- if (SizeInBytes < Ki)
- fprintf (Gbl.F.Out,"%.0f B",
- SizeInBytes);
- else if (SizeInBytes < Mi)
- fprintf (Gbl.F.Out,"%.1f KiB",
- SizeInBytes / Ki);
- else if (SizeInBytes < Gi)
- fprintf (Gbl.F.Out,"%.1f MiB",
- SizeInBytes / Mi);
- else if (SizeInBytes < Ti)
- fprintf (Gbl.F.Out,"%.1f GiB",
- SizeInBytes / Gi);
- else
- fprintf (Gbl.F.Out,"%.1f TiB",
- SizeInBytes / Ti);
- }
-
/*****************************************************************************/
/******************* Create a random alphanumeric string *********************/
/*****************************************************************************/
diff --git a/swad_string.h b/swad_string.h
index 0398f677..6b3845b9 100644
--- a/swad_string.h
+++ b/swad_string.h
@@ -115,8 +115,7 @@ int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
unsigned long long MaxLength);
bool Str_ConvertFilFolLnkNameToValid (char *FileName);
void Str_ConvertToValidFileName (char *Str);
-void Str_WriteSizeInBytesBrief (double SizeInBytes);
-void Str_WriteSizeInBytesFull (double SizeInBytes);
+
void Str_CreateRandomAlphanumStr (char *Str,size_t Length);
void Str_GetMailBox (const char *Email,char *MailBox,size_t MaxLength);
diff --git a/swad_syllabus.h b/swad_syllabus.h
index ffb63940..897ef1b6 100644
--- a/swad_syllabus.h
+++ b/swad_syllabus.h
@@ -98,8 +98,5 @@ void Syl_WriteStartFileSyllabus (FILE *FileSyllabus);
void Syl_WriteAllItemsFileSyllabus (FILE *FileSyllabus);
void Syl_WriteItemFileSyllabus (FILE *FileSyllabus,int Level,const char *Text);
void Syl_WriteEndFileSyllabus (FILE *FileSyllabus);
-void Fil_CloseXMLFile (void);
-void XML_WriteStartFile (FILE *FileTgt,const char *Type,bool Credits);
-void XML_WriteEndFile (FILE *FileTgt,const char *Type);
#endif
diff --git a/swad_web_service.c b/swad_web_service.c
index 52596a8a..87fe8e32 100644
--- a/swad_web_service.c
+++ b/swad_web_service.c
@@ -112,6 +112,7 @@ cp -f /home/acanas/swad/swad/swad /var/www/cgi-bin/
#include "swad_search.h"
#include "swad_user.h"
#include "swad_web_service.h"
+#include "swad_xml.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
diff --git a/swad_zip.c b/swad_zip.c
index a8b402ca..536ab981 100644
--- a/swad_zip.c
+++ b/swad_zip.c
@@ -575,6 +575,7 @@ static void ZIP_ShowLinkToDownloadZIP (const char *FileName,const char *URL,
extern const char *Txt_File_size;
extern const char *Txt_FILE_uncompressed;
char FileNameShort[NAME_MAX+1];
+ char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING];
/***** Limit length of the name of the file *****/
strncpy (FileNameShort,FileName,NAME_MAX);
@@ -620,18 +621,21 @@ static void ZIP_ShowLinkToDownloadZIP (const char *FileName,const char *URL,
URL,FileName,FileName);
/***** Write the file size *****/
+ Fil_WriteFileSizeFull ((double) FileSize,FileSizeStr);
fprintf (Gbl.F.Out,""
""
"%s:"
" | "
- "",
- The_ClassForm[Gbl.Prefs.Theme],Txt_File_size);
- Str_WriteSizeInBytesFull ((double) FileSize);
+ " | "
+ "%s",
+ The_ClassForm[Gbl.Prefs.Theme],
+ Txt_File_size,
+ FileSizeStr);
if (UncompressedSize)
{
- fprintf (Gbl.F.Out," (");
- Str_WriteSizeInBytesFull ((double) UncompressedSize);
- fprintf (Gbl.F.Out," %s)",Txt_FILE_uncompressed);
+ Fil_WriteFileSizeFull ((double) UncompressedSize,FileSizeStr);
+ fprintf (Gbl.F.Out," (%s %s)",
+ FileSizeStr,Txt_FILE_uncompressed);
}
fprintf (Gbl.F.Out," | "
"
");