#ident "$Header$"
+#include <expat.h>
+
#include "glite/jobid/cjobid.h"
#ifdef BUILDING_LB_COMMON
valid datetime not null,
userid char(32) binary not null,
conditions mediumblob not null,
+ flags int not null,
`STD_owner` varchar(200) null,
`STD_network_server` varchar(200) null,
# notif_registrations UPDATE
+mysql -u lbserver $DB_NAME -e "ALTER TABLE notif_registrations ADD flags int not null"
+
mysql -u lbserver $DB_NAME -e "ALTER TABLE notif_registrations ADD STD_owner varchar(200) null" && \
mysql -u lbserver $DB_NAME -e "ALTER TABLE notif_registrations ADD index(STD_owner)"
}
int edg_wll_NotificationToHTML(edg_wll_Context ctx UNUSED_VAR, notifInfo *ni, char **message){
- char *pomA, *pomB;
+ char *pomA, *pomB, *flags;
+
+
pomB = strdup("");
+ flags = edg_wll_stat_flags_to_string(ni->flags);
+printf("flags %d - %s", ni->flags, flags);
TR("Destination", "%s", ni->destination);
TR("Valid until", "%s", ni->valid);
free(cond);
free(pomB);
pomB = pomA;
+ TR("Flags", "%s", flags);
+ free(flags);
if (ni->JDL_VirtualOrganisation && ni->JDL_VirtualOrganisation[0])
TR("JDL VirtualOrganisation", "%s", ni->JDL_VirtualOrganisation);
if (ni->STD_owner && ni->STD_owner[0])
TR("STD network server", "%s", ni->STD_network_server);
asprintf(&pomA, "<html>\r\n\t<body>\r\n"
- "<h2>Norification %s</h2>\r\n"
+ "<h2>Notification %s</h2>\r\n"
"<table halign=\"left\">%s</table>"
"\t</body>\r\n</html>",
ni->notifid, pomB);
static int getNotifInfo(edg_wll_Context ctx, char *notifId, notifInfo *ni){
char *q = NULL;
glite_lbu_Statement notif = NULL;
- char *notifc[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
+ char *notifc[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
- trio_asprintf(&q, "select destination, valid, conditions, "
+ trio_asprintf(&q, "select destination, valid, conditions, flags, "
"JDL_VirtualOrganisation, STD_owner, STD_network_server "
"from notif_registrations "
"where notifid='%s'",
ni->destination = notifc[0];
ni->valid = notifc[1];
ni->conditions = notifc[2];
- ni->JDL_VirtualOrganisation = notifc[3];
- ni->STD_owner = notifc[4];
- ni->STD_network_server = notifc[5];
+ ni->flags = atoi(notifc[3]);
+ ni->JDL_VirtualOrganisation = notifc[4];
+ ni->STD_owner = notifc[5];
+ ni->STD_network_server = notifc[6];
}
else
goto err;
- printf("%s\n%s\n", ni->destination, ni->valid);
-
return 0;
err:
free(fullid);
edg_wlc_JobIdFree(jobId);
edg_wll_FreeStatus(&stat);
- /*GET /notif/[notifId]: Norification info*/
+ /*GET /notif/[notifId]: Notification info*/
} else if (strncmp(requestPTR, "/notif/", strlen("/notif/")) == 0){
notifInfo ni;
char *pomCopy, *pom;
char *destination;
char *valid;
char *conditions;
+ int flags;
char *JDL_VirtualOrganisation;
char *STD_owner;
char *STD_network_server;
#include "lb_proto.h"
#include "glite/lb/context-int.h"
+#include "glite/lb/xml_conversions.h"
#include "glite/lbu/trio.h"
#include "glite/lbu/db.h"
int edg_wll_NotificationToText(edg_wll_Context ctx UNUSED_VAR, notifInfo *ni, char **message){
char *a = NULL, *b = NULL;
asprintf(&a, "Notif_id=%s\n", ni->notifid);
- asprintf(&b, "%sDestination=%s\n", a, ni->destination);
- asprintf(&a, "%sValid_until=%s\n", b, ni->valid);
+ asprintf(&b, "%sDestination=%s\n", a, ni->destination); free(a);
+ asprintf(&a, "%sValid_until=%s\n", b, ni->valid); free(b);
char *cond = escape_text(ni->conditions);
- asprintf(&b, "%sConditions=%s\n", a, cond);
+ asprintf(&b, "%sConditions=%s\n", a, cond); free(a);
free(cond);
- a = b;
- if (ni->JDL_VirtualOrganisation && ni->JDL_VirtualOrganisation[0])
- asprintf(&a, "%sJDL_VirtualOrganisation=%s\n", b, ni->JDL_VirtualOrganisation);
+ char *flags = edg_wll_stat_flags_to_string(ni->flags);
+ asprintf(&a, "%sFlags=%s\n", b, flags); free(b);
+ free(flags);
b = a;
- if (ni->STD_owner && ni->STD_owner[0])
+ if (ni->JDL_VirtualOrganisation && ni->JDL_VirtualOrganisation[0]) {
+ asprintf(&a, "%sJDL_VirtualOrganisation=%s\n", b, ni->JDL_VirtualOrganisation);
+ free(b);
+ }
+ b = a;
+ if (ni->STD_owner && ni->STD_owner[0]) {
asprintf(&a, "%sSTD_owner=%s\n", b, ni->STD_owner);
+ free(b);
+ }
b = a;
- if (ni->STD_network_server && ni->STD_network_server[0])
- asprintf(&a, "%sSTD_network_server=%s\n", b, ni->STD_network_server);
+ if (ni->STD_network_server && ni->STD_network_server[0]) {
+ asprintf(&a, "%sSTD_network_server=%s\n", b, ni->STD_network_server);
+ free(b);
+ }
*message = a;
return 0;
/* Format DB insert statement
*/
trio_asprintf(&q,
- "insert into notif_registrations(notifid,destination,valid,userid,conditions) "
- "values ('%|Ss','%|Ss',%s,'%|Ss', '<and>%|Ss</and>')",
- nid_s, addr_s? addr_s: address_override, time_s, owner, xml_conds);
+ "insert into notif_registrations(notifid,destination,valid,userid,conditions,flags) "
+ "values ('%|Ss','%|Ss',%s,'%|Ss', '<and>%|Ss</and>', '%d')",
+ nid_s, addr_s? addr_s: address_override, time_s, owner, xml_conds, flags);
if ( edg_wll_ExecSQL(ctx, q, NULL) < 0 )
goto rollback;