Show related jobid with notification details
authorZdeněk Šustr <sustr4@cesnet.cz>
Thu, 2 Aug 2012 15:01:30 +0000 (15:01 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Thu, 2 Aug 2012 15:01:30 +0000 (15:01 +0000)
Show number of registrations in notification listiting

org.glite.lb.server/src/lb_html.c
org.glite.lb.server/src/lb_proto.c
org.glite.lb.server/src/lb_proto.h

index 1076192..f651c13 100644 (file)
@@ -198,6 +198,7 @@ int edg_wll_UserNotifsToHTML(edg_wll_Context ctx UNUSED_VAR, char **notifids, ch
        asprintf(&ret, "<HTML>\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<TITLE>Notifications</TITLE>\n<HEAD>\n<HEAD>\n%s\n</HEAD>\n<body>\r\n"
                        "<h2><B>%s</B></h2>\r\n"
                        "<P>%s%s%s"
+                       "<P>Total of %d"
                         "<ul>%s</ul>"
                        "\t</body>\r\n</HTML>",
                        header,
@@ -205,7 +206,7 @@ int edg_wll_UserNotifsToHTML(edg_wll_Context ctx UNUSED_VAR, char **notifids, ch
                        mylink ? mylink : "",
                        alllink ? alllink : "",
                        foreignlink ? foreignlink : "",
-                        pomA ? pomA : "No registrations found"
+                        i, pomA ? pomA : "No registrations found"
         );
         free(pomA);
        free(mylink);
@@ -266,6 +267,11 @@ int edg_wll_NotificationToHTML(edg_wll_Context ctx UNUSED_VAR, notifInfo *ni, ch
        TR("Destination", "%s", ni->destination, NULL);
        TR("Valid until", "%s", ni->valid, NULL);
        TR("Flags", "%s", flags, NULL);
+       if (strcmp(ni->jobid,"all_jobs")) {
+               TRL("Job ID", "%s", ni->jobid, NULL); }
+       else {
+               TR("Job ID", "%s", "&mdash;", NULL);
+       }
         free(flags);
 
        if (! edg_wll_Condition_Dump(ni, &cond, 0)){
@@ -634,7 +640,7 @@ char *edg_wll_ErrorToHTML(edg_wll_Context ctx,int code)
 
        e = edg_wll_Error(ctx,&et,&ed);
        header = get_html_header(ctx, 0);
-       asprintf(&out, "<HTML>\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<TITLE>Error</TITLE>\n<HEAD>\n<HEAD>\n%s\n</HEAD>\n"
+       asprintf(&out, "<HTML>\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<HEAD>\n<TITLE>Error</TITLE>\n%s\n</HEAD>\n"
                "<body><h1>%s</h1>\n"
                "%d: %s (%s)</body></html>",header,msg,e,et,ed);
 
index c89f628..a951f85 100644 (file)
@@ -284,14 +284,14 @@ err:
 static int getNotifInfo(edg_wll_Context ctx, char *notifId, notifInfo *ni){
        char *q = NULL;
         glite_lbu_Statement notif = NULL;
-       char *notifc[5] = {NULL, NULL, NULL, NULL, NULL};
+       char *notifc[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
 
        char *can_peername = NULL;
        int retval = HTTP_OK;
 
-       trio_asprintf(&q, "select n.destination, n.valid, n.conditions, n.flags, u.cert_subj "
-                "from notif_registrations as n, users as u "
-                "where (n.notifid='%s') AND (n.userid=u.userid)", notifId);
+       trio_asprintf(&q, "select n.destination, n.valid, n.conditions, n.flags, u.cert_subj, j.jobid "
+                "from notif_registrations as n, users as u, notif_jobs as j "
+                "where (n.notifid='%s') AND (n.userid=u.userid) AND (n.notifid=j.notifid)", notifId);
        glite_common_log_msg(LOG_CATEGORY_LB_SERVER_DB, LOG_PRIORITY_DEBUG, q);
        if (edg_wll_ExecSQL(ctx, q, &notif) < 0) return HTTP_INTERNAL;
         free(q); q = NULL;
@@ -308,6 +308,7 @@ static int getNotifInfo(edg_wll_Context ctx, char *notifId, notifInfo *ni){
                        parseJobQueryRec(ctx, notifc[2], strlen(notifc[2]), &(ni->conditions));
                        ni->flags = atoi(notifc[3]);
                        ni->owner = notifc[4];
+                       ni->jobid = notifc[5];
                }
                else {
                        retval = HTTP_UNAUTH;
@@ -339,6 +340,7 @@ static void freeNotifInfo(notifInfo *ni){
        }
        if (ni->conditions_text) free(ni->conditions_text);
        if (ni->owner) free(ni->owner);
+       if (ni->jobid) free(ni->jobid);
 }
 
 static int getJobsRSS(edg_wll_Context ctx, char *feedType, edg_wll_JobStat **statesOut){
index 3d29d94..b55f59b 100644 (file)
@@ -47,6 +47,7 @@ typedef struct _notifInfo{
        char *conditions_text;
        int  flags;
        char *owner;
+       char *jobid;
 } notifInfo;
 
 typedef enum _http_admin_option{