PackageManager: HTML Log
Modified: trunk/rosapps/packmgr/lib/download.cpp
Modified: trunk/rosapps/packmgr/lib/log.cpp
Modified: trunk/rosapps/packmgr/lib/log.h

Modified: trunk/rosapps/packmgr/lib/download.cpp
--- trunk/rosapps/packmgr/lib/download.cpp	2005-04-23 20:02:39 UTC (rev 14790)
+++ trunk/rosapps/packmgr/lib/download.cpp	2005-04-24 10:37:17 UTC (rev 14791)
@@ -27,7 +27,7 @@
 
 
 // Download a file 
-char* PML_Download (pTree tree, const char* url, const char* server = "tree", const char* filename = NULL) 
+char* PML_Download (pTree tree, const char* url, const char* server = "tree", const char* filename = "packmgr.xml") 
 {
 	UINT i;
 	static char downl [MAX_PATH]; // the full url
@@ -43,6 +43,10 @@
 
 	else if(!strstr(filename, "\\"))
 		GetTempPathA (200, path);
+
+	else
+		strcpy(path, "");
+
 	
 	// create the local file name
 	if(filename)
@@ -51,7 +55,7 @@
 		DeleteFileA (path);
 	}
 	else
-		GetTempFileNameA (path, "pml", 0, path); 
+		GetTempFileNameA (path, "pml", 1, path); 
 
 	// get the url
 	if (!server)
@@ -76,12 +80,11 @@
 
 	// is this a file link ?
 	if (strstr(downl, "file://") || strstr(downl, "File://"))
-	{/*
-		if(downl[strlen(downl)] == '\')
-			downl[strlen(downl)] = '\0';
-	*/
+	{
 		if(!filename)
+		{
 			return &downl[7];
+		}
 
 		else
 		{
@@ -90,6 +93,7 @@
 		}
 	}
 
+
 	// download the file
 	if(URLDownloadToFileA (NULL, downl, path, 0, NULL) != S_OK)
 	{
@@ -116,7 +120,7 @@
 
 	// download the file
 	if(strstr(url, "file://"))
-		filename = PML_Download(tree, url, NULL);
+		filename = PML_Download(tree, url, NULL, NULL);
 
 	else
 		filename = PML_Download(tree, url);
@@ -132,8 +136,7 @@
 	FILE* file = fopen(filename, "r");
 	if(!file) 
 	{
-	MessageBoxA(0,filename,0,0);
-		Log("!  ERROR: Could not open the xml file \"");
+		Log("!  ERROR: Could not open the xml file ");
 		LogAdd(filename);
 		return ERR_GENERIC;
 	}

Modified: trunk/rosapps/packmgr/lib/log.cpp
--- trunk/rosapps/packmgr/lib/log.cpp	2005-04-23 20:02:39 UTC (rev 14790)
+++ trunk/rosapps/packmgr/lib/log.cpp	2005-04-24 10:37:17 UTC (rev 14791)
@@ -28,10 +28,14 @@
 	char version[50];
 	char versionos[50];
 
-	if (!LogCreated) {		
+	if (!LogCreated) 
+	{		
 		file = fopen(LOGFILE, "w");
 		LogCreated = true;
 
+		//HTML Header
+		fputs("<html><head><title>Logfile</title></head><body>", file);
+		
 		// date and time
 		time_t now;
 		now = time(NULL);
@@ -49,32 +53,43 @@
 			KERNEL_VERSION_MINOR,
 			KERNEL_VERSION_PATCH_LEVEL);
 
-		fputs("# ReactOS Package Manager - Log File\n#\n# WARNING: This is still pre-alpha software.\n# Date: ", file);
+		fputs("<h2>ReactOS Package Manager - Log File</h2><br>\n", file);
+		fputs("WARNING: This is still pre-alpha software.<br>\n", file);
+
+		fputs("Date: ", file); 
 		fputs(GTime, file);
-		fputs("\n#\n#", file);
-		fputs(version, file);
-		fputs("\n#", file);
-		fputs(versionos, file);
-		fputs("\n#\n", file);
+		fputs("<br>\n", file);
+
+		fputs(version, file); 
+		fputs("<br>\n", file);
+		fputs(versionos, file); 
+		fputs("<br>\n", file);
 	}
+
 	else		
 		file = fopen(LOGFILE, "a");
 		
-	if (file == NULL) {
-
+	if (file == NULL) 
+	{
 		if (LogCreated)
 			LogCreated = false;
 
-		return;
+		return Log(message);
 	}
+
 	else
 	{
 		// Save log entry (+ add time)
-		fputs("\n", file);
+		fputs("<br>\n", file);
+
 		time_t now;
 		now = time(NULL);
 		strftime(GTime,sizeof GTime,"%I:%M:%S %p  ",localtime(&now));
+
+		fputs("<b>", file);
 		fputs(GTime, file);
+		fputs("</b>", file);
+
 		fputs(message, file);
 		fclose(file);
 	}

Modified: trunk/rosapps/packmgr/lib/log.h
--- trunk/rosapps/packmgr/lib/log.h	2005-04-23 20:02:39 UTC (rev 14790)
+++ trunk/rosapps/packmgr/lib/log.h	2005-04-24 10:37:17 UTC (rev 14791)
@@ -13,7 +13,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#define LOGFILE	"packmgr.log"
+#define LOGFILE	"logfile.html"
 
 extern bool LogCreated;