Working with the enactment history

Previous: Dealing with values ] [ Top:  ] [ Next: Working with roles ]



log: get or write to enactment history
The command-line utility can do two things with the enactment history: it can show it, or it can write a log line to it.
 
if (argsleft < 2) {
   printf ("wftk log: repository and ID of the datasheet are required.\n");
   exit (1);
}

datasheet = wftk_process_load (session, PERIOD_TO_NULL(argv[argp]), argv[argp+1]); argp++; argp++;
if (!datasheet) {
   printf ("Datasheet repository %s can't find datasheet %s", argv[argp-2], argv[argp-1]);
   exit (1);
}

if (argsleft > 0) {
   /* Write log line. */
   wftk_log (session, datasheet, argv[argp++]);
   wftk_process_save (session, datasheet);
   exit (0);
}

list = wftk_enactment (session, datasheet);
if (list) {
   mark = xml_firstelem (list);
   while (mark) {
      printf ("%s [%s]: ", xml_attrval (mark, "at"), xml_attrval (mark, "by"));
      if (!strcmp ("log", mark->name)) {
         printf ("%s\n", xml_attrval (mark, "text"));
      } else if (!strcmp ("task", mark->name)) {
         if (!strcmp ("reject", xml_attrval (mark, "action"))) {
            printf ("REJECT ");
         }
         printf ("task %s %s\n", xml_attrval (mark, "id"), xml_attrval (mark, "label"));
      } else if (!strcmp ("data", mark->name)) {
         printf ("value %s (was '%s')\n", xml_attrval (mark, "id"), xml_attrval (mark, "was"));
      } else {
         printf ("entry '%s'\n", mark->name);
      }
      mark = xml_nextelem (mark);
   }
}
Previous: Dealing with values ] [ Top:  ] [ Next: Working with roles ]


This code and documentation are released under the terms of the GNU license. They are additionally copyright (c) 2000, Vivtek. All rights reserved except those explicitly granted under the terms of the GNU license.