printf ("Content-type: text/html\n\n"); printf ("<html><head><title>WFTK PDM works in progress</title></head>\n"); printf ("<body bgcolor=\"ffffff\">\n"); printf ("<h2>Open process definition</h2><hr>\n"); printf ("<font size=+1>Work in progress</font>\n"); xml = user_list (current_user, "wftkpdm", NULL, "edit"); See Loading the repository index from index.xml holder = xml_firstelem (xml); while (holder) { strcpy (sbuf, xml_attrval (holder, "object")); mark = strrchr (sbuf, '_'); if (mark) { *mark++ = '\0'; } else { mark = ""; } item = xml_firstelem (directory); while (item) { if (!strcmp (xml_attrval (item, "id"), sbuf)) { xml_set (holder, "title", xml_attrval (item, "title")); break; } item = xml_nextelem (item); } if (!strcmp ("", xml_attrval (holder, "title"))) { xml_set (holder, "title", xml_attrval (holder, "object")); } holder = xml_nextelem (holder); } /* Here we'll sort things. Later. */ printf ("<form action=\"%s?command=delete\" method=POST>\n", xml_attrval (environment, "SCRIPT_NAME")); holder = xml_firstelem (xml); while (holder) { if (!strcmp (holder->name, "object")) { strcpy (sbuf, xml_attrval (holder, "object")); mark = strrchr (sbuf, '_'); if (mark) { *mark++ = '\0'; } else { mark = ""; } printf (" <input type=checkbox name=\"itemver_%s_%s\"> ", sbuf, mark); printf ("<a href=\"%s?command=edit&item=%s&ver=%s\">%s</a>", xml_attrval (environment, "SCRIPT_NAME"), sbuf, mark, xml_attrval (holder, "title")); printf (" (ver '%s') |
group-include
s. It assumes
that the directory is already loaded. It makes use of the global 'holder' to mark items as
already displayed, and 'xml' to track which subfolders it's already displayed (the latter
serves to prevent problems should we have a cycle in our folder structure.)
void show_list (XML * for_whom, const char * class, const char * object, const char * permission) { XML * list; XML * listee; XML * item; XML * included; list = user_list (for_whom, class, object, permission); listee = xml_firstelem (list); while (listee) { item = xml_firstelem (directory); while (item) { if (!strcmp ("object", listee->name) && !strcmp (xml_attrval (item, "id"), xml_attrval (listee, "object"))) { if (strcmp ("", xml_attrval (holder, xml_attrval (item, "id")))) { xml_set (listee, "invalid", "yep"); break; } xml_set (holder, xml_attrval (item, "id"), "!"); xml_set (listee, "title", xml_attrval (item, "title")); break; } item = xml_nextelem (item); } if (!strcmp ("", xml_attrval (listee, "title"))) { xml_set (listee, "invalid", "yep"); } listee = xml_nextelem (listee); } /* Here we'll sort things. Later. */ printf ("<ul>\n"); listee = xml_firstelem (list); while (listee) { if (!strcmp ("group-include", listee->name)) { if (!strcmp ("", xml_attrval (xml, xml_attrval (listee, "name")))) { xml_set (xml, xml_attrval (listee, "name"), "!"); included = group_get (xml_attrval (listee, "name")); if (included) { printf ("<li> Via group <i>%s</i>:\n", xml_attrval (included, "name")); show_list (included, class, object, permission); xml_free (included); } } } else if (!strcmp ("", xml_attrval (listee, "invalid"))) { printf ("<li> <a href=\"%s?command=view&item=%s\">%s</a>\n", xml_attrval (environment, "SCRIPT_NAME"), xml_attrval (listee, "object"), xml_attrval (listee, "title")); } listee = xml_nextelem (listee); } xml_free (list); printf ("</ul>\n"); } |
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. |