Formatting outlines and such

Previous: Building command hrefs ] [ Top: The procdef manager ] [ Next: update: Actually changing procdef versions! ]

The outline_format function is used for, well, formatting outlines which correspond to actions in the process. There may be other uses at some point.

It returns an integer value which is the number of nodes displayed. The primary use of this is to do something special if there are no nodes. (As is the case when a fresh procdef is created and we display its empty action outline.)
 
int outline_format (XML * action)
{
   XML * child;
   int count = 0;

   if (!strcmp (action->name, "workflow")) {
      printf ("<table border=0 cellpadding=0 cellborder=0>\n");
      child = xml_firstelem (action);
      while (child) {
         if (strcmp (child->name, "data") && strcmp (child->name, "role")) {
            count += outline_format (child);
         }
         child = xml_nextelem (child);
      }
      printf ("</table>\n");
   } else if (!strcmp (action->name, "sequence")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=sequence.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf (">");
      print_element (action);
      printf ("</a>\n");
      printf ("<table border=0 cellpadding=0 cellborder=0>\n");
      child = xml_firstelem (action);
      while (child) {
         count += outline_format (child);
         child = xml_nextelem (child);
      }
      printf ("</table></td></tr>\n");
   } else if (!strcmp (action->name, "parallel")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=parallel.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf (">");
      print_element (action);
      printf ("</a>\n");
      printf ("<table border=0 cellpadding=0 cellborder=0>\n");
      child = xml_firstelem (action);
      while (child) {
         count += outline_format (child);
         child = xml_nextelem (child);
      }
      printf ("</table></td></tr>\n");
   } else if (!strcmp (action->name, "task")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=task.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf (">");
      print_element (action);
      printf ("</a> (%s)\n", xml_attrval (action, "role"));
      printf ("<table border=0 cellpadding=0 cellborder=0>\n");
      child = xml_firstelem (action);
      while (child) {
         if (!strcmp (child->name, "data")) {
            printf ("<tr><td class=\"data\"><img src=\"result.gif\"></td>");
            printf ("<td class=\"data\"><a href=\"");
            print_edit_command (child);
            printf ("\"");
            print_target ();
            printf (">%s</a></td>", xml_attrval (child, "name"));
            printf ("</tr>\n");
            count ++;
         }
         child = xml_nextelem (child);
      }
      printf ("</table></td></tr>\n");
   } else if (!strcmp (action->name, "if")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=if.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf ("><b>If</b> %s</a>\n", xml_attrval (action, "expr"));
      printf ("<table border=0 cellpadding=0 cellborder=0>\n");
      child = xml_firstelem (action);
      while (child) {
         count += outline_format (child);
         child = xml_nextelem (child);
      }
      printf ("</table></td></tr>\n");
   } else if (!strcmp (action->name, "alert")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=alert.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf (">");
      print_element (action);
      printf ("</a></td></tr>\n");
   } else if (!strcmp (action->name, "data")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=data.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf (">");
      print_element (action);
      printf ("</a></td></tr>\n");
   } else if (!strcmp (action->name, "situation")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=sit.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf (">");
      print_element (action);
      printf ("</a></td></tr>\n");
   } else if (!strcmp (action->name, "handle")) {
      count ++;
      printf ("<tr><td valign=top align=center><img src=sit.gif></td><td><a href=\"");
      print_edit_command (action);
      printf ("\"");
      print_target ();
      printf (">");
      print_element (action);
      printf ("</a>\n");
      printf ("<table border=0 cellpadding=0 cellborder=0>\n");
      child = xml_firstelem (action);
      while (child) {
         count += outline_format (child);
         child = xml_nextelem (child);
      }
      printf ("</table></td></tr>\n");
   }
   return (count);
}
Previous: Building command hrefs ] [ Top: lpml alpha ] [ Next: update: Actually changing procdef versions! ]


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.