static int exclusive_zombies = 1;
static char **msg_brokers = NULL;
static char **msg_prefixes = NULL;
+char * html_header = NULL;
+static int html_header_forced = 0;
static struct option opts[] = {
{"super-user", 1, NULL, 'R'},
// {"super-users-file", 1, NULL,'F'},
{"msg-conf", 1, NULL,'F'},
+ {"html-header", 1, NULL,'H'},
{"no-index", 1, NULL, 'x'},
{"strict-locking",0, NULL, 'O'},
{"limits", 1, NULL, 'L'},
{NULL,0,NULL,0}
};
-static const char *get_opt_string = "Ac:k:C:V:p:a:drm:ns:i:S:D:J:jR:F:xOL:N:X:Y:T:t:e:f:zb:gPBo:q:W:Z:GI:l:E"
+static const char *get_opt_string = "Ac:k:C:V:p:a:drm:ns:i:S:D:J:jR:F:xOL:N:X:Y:T:t:e:f:zb:gPBo:q:W:Z:GI:l:EH:"
#ifdef GLITE_LB_SERVER_WITH_WS
"w:"
#endif
"\t-l,--policy\tauthorization policy file\n"
"\t-E,--exclusive-zombies-off\twith 'exclusive' flag, allow reusing IDs of purged jobs\n"
"\t-F,--msg-conf\t path to configuration file with messaging settings\n"
+ "\t-H,--html-header\t path to HTML header file for customized/branded HTML output\n"
,me);
}
case 'i': strcpy(pidfile,optarg); pidfile_forced = 1; break;
case 'R': add_root(ctx, optarg, ADMIN_ACCESS); break;
case 'F': msg_conf = strdup(optarg); break;
+ case 'H': html_header = strdup(optarg); html_header_forced = 1; break;
case 'x': noIndex = atoi(optarg);
if (noIndex < 0 || noIndex > 2) { usage(name); return 1; }
break;
return 1;
}
+ if (!html_header) {
+ char *html_header_prefix = getenv("GLITE_LB_LOCATION_ETC");
+ if (!html_header_prefix) html_header_prefix=strdup("/etc/glite-lb");
+ asprintf(&html_header, "%s/html_header.html", html_header_prefix);
+ free(html_header_prefix);
+ }
+ if (html_header) {
+ char *et, *ed;
+ FILE *fp = fopen("file","r");
+ if( fp ) {
+ fclose(fp);
+ glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_DEBUG, "Using HTML header file %s", html_header);
+ } else {
+ glite_common_log(LOG_CATEGORY_CONTROL, html_header_forced ? LOG_PRIORITY_ERROR : LOG_PRIORITY_INFO, "Cannot open HTML header file %s", html_header);
+ }
+ ctx->html_header_file=html_header;
+ }
+
if (msg_conf) {
int retv_msg;
glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_DEBUG, "Parsing MSG conf file: %s", msg_conf);
/* construct Message-Body of Response-Line for edg_wll_UserJobs */
int edg_wll_UserInfoToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wlc_JobId *jobsOut, edg_wll_JobStat *statsOut, char **message, int text)
{
- char *pomA = NULL, *pomB, *pomC;
+ char *pomA = NULL, *pomB, *pomC, *header = NULL;
int i, total = 0, bufsize, written = 0, linlen, wassub = 0, lineoverhead;
JobIdSorter *order;
-
+ FILE *header_file;
while (jobsOut && jobsOut[total]) total++;
}
else {
qsort(order, total, sizeof(JobIdSorter), jobstat_cmp);
+
+ if (header_file = fopen(ctx->html_header_file, "r")) getdelim( &header, 0, '\0', header_file);
- linlen = asprintf(&pomA, "<HTML>\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<TITLE>User Jobs</TITLE>\n<BODY>\n"
- "<h2><B>User Jobs</B></h2>\nTotal of %d<P><UL>\n",total);
+ linlen = asprintf(&pomA, "<HTML>\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<TITLE>User Jobs</TITLE>\n<HEAD>\n%s\n</HEAD>\n<BODY>\n"
+ "<h2><B>User Jobs</B></h2>\nTotal of %d<P><UL>\n", header ? header : "", total);
+
+ free(header);
asprintf(&pomC, "</UL>User subject: %s<p>\n"
"</BODY>\n</HTML>",