sprintf (sbuf, "%s_%s", xml_attrval (query, "item"), xml_attrval (query, "ver")); if (!user_perm (current_user, "wftkpdm", sbuf, "edit")) { printf ("<h2>No edit authorization</h2><hr>"); printf ("Sorry, your current user id (%s) doesn't have permission to edit this item version.", xml_attrval (current_user, "name")); printf (" You might want to check with the version owner or with an administrator if you think that this is in error."); exit (0); } |
sprintf (version_file, "%s%s_%s.xml", PROCESS_DEFINITION_REPOSITORY, xml_attrval (query, "item"), xml_attrval (query, "ver")); file = fopen (version_file, "r"); if (!file) { sprintf (sbuf, "Unable to open procdef version file %s.\n", sbuf); complain(); } version = xml_read (file); fclose (file); version_dirty = 1; |
printf ("Content-type: text/html\n\n"); printf ("<html><head><title>wftk update - %s</title><LINK href=\"pdm.css\" rel=\"stylesheet\" type=\"text/css\"></head>\n", xml_attrval (version, "name")); printf ("<body bgcolor=\"ffffff\">\n"); if (!strcmp ("updatedescription", xml_attrval (query, "action"))) { See Updating descriptions } else if (!strcmp ("moveup", xml_attrval (query, "action"))) { See Moving things up in lists } else if (!strcmp ("movedn", xml_attrval (query, "action"))) { See Moving things down in lists } else if (!strcmp ("role", xml_attrval (query, "action"))) { See Adding and modifying roles } else if (!strcmp ("data", xml_attrval (query, "action"))) { See Adding and modifying data items } else if (!strcmp ("task", xml_attrval (query, "action"))) { See Adding and modifying tasks } else if (!strcmp ("if", xml_attrval (query, "action"))) { See Adding and modifying decisions } else if (!strcmp ("alert", xml_attrval (query, "action"))) { See Adding and modifying alerts } else if (!strcmp ("handle", xml_attrval (query, "action"))) { See Adding and modifying situation handlers } else if (!strcmp ("sequence", xml_attrval (query, "action"))) { See Adding and modifying sequences } else if (!strcmp ("parallel", xml_attrval (query, "action"))) { See Adding and modifying parallels } else if (!strcmp ("delete", xml_attrval (query, "action"))) { See Deleting pieces } printf ("</body></html>\n\n"); |
updated_flag = 0; if (strcmp (xml_attrval (version, "name"), xml_attrval (query, "title"))) { xml_set (version, "name", xml_attrval (query, "title")); if (!updated_flag) { printf ("<h2>Description updated</h2><hr><ul>\n"); } printf ("<li> Title was changed to '%s'\n", xml_attrval (query, "title")); updated_flag = 1; } |
if (!updated_flag) { printf ("<h2>Description not updated</h2><hr>\n"); printf ("No update was necessary.\n"); } else { printf ("</ul>\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); } |
See Finding pieces of the item to update if (add_flag) xml = xml_create ("role"); xml_set (xml, "name", xml_attrval (query, "name")); xml_set (xml, "local", xml_attrval (query, "local")); if (!add_flag) { while (holder = xml_first (xml)) xml_delete (holder); } xml_append (xml, xml_createtext (xml_attrval (query, "content"))); if (add_flag) xml_prepend (version, xml); printf ("<h2>Role %s %s</h2><hr>\n", xml_attrval (xml, "name"), add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
initial="yes"
denotes a required startup data item.
See Finding pieces of the item to update if (add_flag) xml = xml_create ("data"); xml_set (xml, "name", xml_attrval (query, "name")); xml_set (xml, "type", xml_attrval (query, "type")); if (strcmp ("", xml_attrval (query, "initial"))) { xml_set (xml, "initial", xml_attrval (query, "initial")); } if (!strcmp ("", xml_attrval (query, "mode"))) { xml_set (xml, "mode", xml_attrval (query, "mode")); } if (!add_flag) { while (holder = xml_first (xml)) xml_delete (holder); } if (strcmp ("", xml_attrval (query, "content"))) xml_append (xml, xml_createtext (xml_attrval (query, "content"))); if (add_flag) xml_append (parent, xml); |
if (add_flag && strcmp (parent->name, "workflow") && strcmp (xml_attrval (xml, "mode"), "local")) { sprintf (sbuf, "workflow.data[%s]", xml_attrval (query, "name")); holder = xml_loc (version, sbuf); if (!holder) { xml = xml_create ("data"); xml_set (xml, "name", xml_attrval (query, "name")); xml_set (xml, "type", xml_attrval (query, "type")); if (strcmp ("", xml_attrval (query, "content"))) xml_append (xml, xml_createtext (xml_attrval (query, "content"))); xml_append (version, xml); } } |
printf ("<h2>Data item %s %s</h2><hr>\n", xml_attrval (xml, "name"), add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
See Finding pieces of the item to update if (add_flag) xml = xml_create ("task"); xml_set (xml, "label", xml_attrval (query, "label")); xml_set (xml, "role", xml_attrval (query, "role")); if (add_flag) xml_append (parent, xml); printf ("<h2>Task %s %s</h2><hr>\n", xml_attrval (xml, "label"), add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
See Finding pieces of the item to update if (add_flag) xml = xml_create ("if"); xml_set (xml, "if", xml_attrval (query, "if")); if (add_flag) xml_append (parent, xml); printf ("<h2>Decision %s</h2><hr>\n", add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
See Finding pieces of the item to update if (add_flag) xml = xml_create ("alert"); xml_set (xml, "type", xml_attrval (query, "type")); xml_set (xml, "to", xml_attrval (query, "to")); if (!add_flag) { while (holder = xml_first (xml)) xml_delete (holder); } xml_append (xml, xml_createtext (xml_attrval (query, "content"))); if (add_flag) xml_append (parent, xml); printf ("<h2>Alert %s</h2><hr>\n", add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
See Finding pieces of the item to update if (add_flag) xml = xml_create ("handle"); xml_set (xml, "situation", xml_attrval (query, "situation")); if (add_flag) xml_append (parent, xml); printf ("<h2>Handler for %s %s</h2><hr>\n", xml_attrval (xml, "situation"), add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
See Finding pieces of the item to update if (add_flag) xml = xml_create ("sequence"); xml_set (xml, "repeat", xml_attrval (query, "repeat")); xml_set (xml, "index", xml_attrval (query, "index")); if (add_flag) xml_append (parent, xml); printf ("<h2>Sequence %s</h2><hr>\n", add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
See Finding pieces of the item to update if (add_flag) xml = xml_create ("parallel"); xml_set (xml, "repeat", xml_attrval (query, "repeat")); xml_set (xml, "index", xml_attrval (query, "index")); if (add_flag) xml_append (parent, xml); printf ("<h2>Parallel %s</h2><hr>\n", add_flag ? "added" : "modified"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
See Finding pieces of the item to update if (add_flag) { printf ("<h2>Huh?</h2><hr>Trying to delete without a location doesn't even make sense.\n"); exit(0); } xml_delete (xml); printf ("<h2>Delete complete</h2><hr>\n"); printf ("The version has been updated.\n"); printf ("<script>parent.frames[0].location = parent.frames[0].location.href;</script>\n"); |
xml
, just as with editing, but if the parent location is
given instead, then it is preserved, and is passed in parent
. No dummy XML is
needed to fool the form builder, so it's not created.
if (strcmp ("", xml_attrval (query, "loc"))) { xml = xml_loc (version, xml_attrval (query, "loc")); if (!xml || xml == version) { sprintf (sbuf, "The location %s doesn't exist in this item.", xml_attrval (query, "loc")); complain (); } add_flag = 0; } else { parent = xml_loc (version, xml_attrval (query, "parentloc")); if (!parent) { sprintf (sbuf, "The parent location %s doesn't exist in this item.", xml_attrval (query, "parentloc")); complain(); } add_flag = 1; } |
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. |