Commit 4e75710d authored by Claes Sjofors's avatar Claes Sjofors

Wb history to html conversion fixes

parent 77c0cd3c
......@@ -40,6 +40,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <gtk/gtk.h>
#include "pwr.h"
......
......@@ -40,6 +40,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include "pwr.h"
#include "pwr_class.h"
......
......@@ -50,7 +50,7 @@
#include "wb_wnav_msg.h"
typedef struct {
vector<string> v;
vector<VItem> v;
} log_sCbCtx;
......@@ -187,6 +187,8 @@ void wb_log::generate_html( char *filename, pwr_tStatus *sts)
CoLog::dget( 0, 0, gen_cb, &cbctx);
filter( cbctx.v);
dcli_translate_filename( fname, filename);
strcpy( help_fname, fname);
......@@ -217,8 +219,10 @@ void wb_log::generate_html( char *filename, pwr_tStatus *sts)
fprintf( fp, "<h2>Workbench History</h2>\n<xmp> %s %s</xmp><br>\n<a href=\"%s\">Help</a>\n<XMP>\n\n", pname, timstr, help_filename);
fprintf( fp, "%-20s %-10s %-20s %-20s %s\n", "Date", "User", "Action", "Item", "Comment");
fprintf( fp, "----------------------------------------------------------------------------------------------\n");
for ( int i = cbctx.v.size() - 1; i >= 0; i--)
fprintf( fp, "%s\n", cbctx.v[i].c_str());
for ( int i = cbctx.v.size() - 1; i >= 0; i--) {
if ( !cbctx.v[i].disable)
fprintf( fp, "%s\n", cbctx.v[i].text.c_str());
}
fprintf( fp, "</XMP>\n</BODY>\n</HTML>\n");
fclose( fp);
......@@ -253,7 +257,7 @@ GeBuild Ge graph built. Built graph displayed in item.\n\
GeExport Ge graph exported to java. Exported graph displayed in item.\n\
UpdateClasses Classes updated.\n\
CreatePackage Distribution package created. Created package displayed in item.\n\
CopyPackage Package distributed to process or operator station. Package displayed in item.\n\
&CopyPackage Package distributed to process or operator station. Package displayed in item.\n\
</XMP>\n\
</body>\n\
</html>\n");
......@@ -262,6 +266,25 @@ CopyPackage Package distributed to process or operator station. Package displaye
}
}
void wb_log::filter( vector<VItem> &v)
{
#if 0
int last_volumebuild = 0;
for ( int i = 0; i < (int)v.size(); i++) {
if ( strncmp( v[0].text.c_str(), "VolumeBuild", 9) == 0) {
for ( int j = i - 1; j > last_config_save; j--) {
}
last_volumebuild = i;
}
if ( !v[i].has_comment)
v[i].disable = true;
}
#endif
}
void wb_log::gen_cb( void *ctx, pwr_tTime time, char *s1, char *s2, char *s3, char *s4)
{
log_sCbCtx *cbctx = (log_sCbCtx *)ctx;
......@@ -271,7 +294,10 @@ void wb_log::gen_cb( void *ctx, pwr_tTime time, char *s1, char *s2, char *s3, ch
time_AtoAscii( &time, time_eFormat_DateAndTime, timstr, sizeof(timstr));
snprintf( str, sizeof(str), "%-20s %-10s %-20s %-20s %s", timstr, s2, s1, s3, s4 ? s4 : "");
string s(str);
VItem s(str);
if ( s4 && strcmp( s4, "") != 0)
s.has_comment = true;
cbctx->v.push_back(s);
}
......@@ -37,11 +37,15 @@
#ifndef wb_log_h
#define wb_log_h
#include <vector>
#include <string>
#include "pwr.h"
#include "cow_log.h"
#define wlog_cLogFile "$pwrp_db/wb_history.log"
using namespace std;
typedef enum {
wlog_eCategory_,
wlog_eCategory_WbLogin,
......@@ -61,6 +65,13 @@ typedef enum {
wlog_eCategory__,
} wlog_eCategory;
class VItem {
public:
VItem( char *t) : text(t), has_comment(false), disable(false) {}
string text;
bool has_comment;
bool disable;
};
class wb_log;
class wb_session;
......@@ -79,6 +90,7 @@ class wb_log
static void pull() { CoLog::dpull();}
static void generate_html( char *filename, pwr_tStatus *sts);
static void gen_cb( void *ctx, pwr_tTime time, char *s1, char *s2, char *s3, char *s4);
static void filter( vector<VItem> &v);
};
......
......@@ -39,6 +39,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <vector>
#include "pwr.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment