wftk_session_setuser
. Caveat callor.
Anyway, the enactment itself is just a child of the main datasheet element which is an "enactment" node. If there isn't
one, we create it, pretty much the same as the state.
WFTK_EXPORT XML * wftk_enactment (XML * session, XML * datasheet) { XML * en; en = xml_loc (datasheet, ".enactment"); if (!en) { en = xml_create ("enactment"); xml_append_pretty (datasheet, en); } return (en); } |
WFTK_EXPORT int wftk_enactment_write (XML * session, XML * datasheet, XML * xml, const char * attribute, const char * value) { XML * copy; XML_ATTR * attr; XML * en = wftk_enactment (session, datasheet); if (!en) return 0; if (!xml) return 0; copy = xml_create (xml_name (xml)); attr = xml_attrfirst (xml); while (attr) { xml_set (copy, xml_attrname (attr), xml_attrvalue (attr)); attr = xml_attrnext (attr); } if (wftk_session_getuser(session)) { xml_set (copy, "by", xml_attrval (wftk_session_getuser(session), "id")); } xml_set_nodup (copy, "at", _wftk_value_special (session, datasheet, "!now")); if (attribute && value) { xml_set (copy, attribute, value); } xml_append_pretty (en, copy); return 1; } |
WFTK_EXPORT int wftk_log (XML * session, XML * datasheet, char * log) { int retval; XML * logxml = xml_create ("log"); xml_set (logxml, "text", log); retval = wftk_enactment_write (session, datasheet, logxml, NULL, NULL); xml_free (logxml); return (retval); } |
This code and documentation are released under the terms of the GNU license. They are copyright (c) 2000-2004, Vivtek. All rights reserved except those explicitly granted under the terms of the GNU license. |