Added add_special_xxx
SVN revision: 1286
This commit is contained in:
+18
-15
@@ -6,6 +6,9 @@
|
||||
Contents: Web server program for Electronic Logbook ELOG
|
||||
|
||||
$Log$
|
||||
Revision 1.600 2005/03/29 07:19:37 ritt
|
||||
Added add_special_xxx
|
||||
|
||||
Revision 1.599 2005/03/27 19:57:23 ritt
|
||||
Adjusted code for mxml modifications
|
||||
|
||||
@@ -10057,16 +10060,16 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
|
||||
|
||||
if (new_user) {
|
||||
node = mxml_find_node(lbs->pwd_xml_tree, "/list");
|
||||
node = mxml_add_node(node, ELEMENT_NODE, "user", NULL);
|
||||
node = mxml_add_node(node, "user", NULL);
|
||||
|
||||
mxml_add_node(node, ELEMENT_NODE, "full_name", getparam("new_full_name"));
|
||||
mxml_add_node(node, ELEMENT_NODE, "name", getparam("new_user_name"));
|
||||
mxml_add_node(node, ELEMENT_NODE, "email", getparam("new_user_email"));
|
||||
mxml_add_node(node, "full_name", getparam("new_full_name"));
|
||||
mxml_add_node(node, "name", getparam("new_user_name"));
|
||||
mxml_add_node(node, "email", getparam("new_user_email"));
|
||||
|
||||
if (activate)
|
||||
mxml_add_node(node, ELEMENT_NODE, "password", getparam("encpwd"));
|
||||
mxml_add_node(node, "password", getparam("encpwd"));
|
||||
else
|
||||
mxml_add_node(node, ELEMENT_NODE, "password", new_pwd);
|
||||
mxml_add_node(node, "password", new_pwd);
|
||||
|
||||
} else {
|
||||
/* replace record */
|
||||
@@ -10079,12 +10082,12 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
|
||||
subnode = mxml_find_node(node, "email_notify");
|
||||
if (subnode)
|
||||
mxml_delete_node(subnode);
|
||||
mxml_add_node(node, ELEMENT_NODE, "email_notify", NULL);
|
||||
mxml_add_node(node, "email_notify", NULL);
|
||||
subnode = mxml_find_node(node, "email_notify");
|
||||
for (i = 0; lb_list[i].name[0]; i++) {
|
||||
sprintf(str, "sub_lb%d", i);
|
||||
if (getparam(str) && atoi(getparam(str)))
|
||||
mxml_add_node(subnode, ELEMENT_NODE, "logbook", lb_list[i].name);
|
||||
mxml_add_node(subnode, "logbook", lb_list[i].name);
|
||||
}
|
||||
|
||||
if (get_password_file(lbs, file_name, sizeof(file_name)))
|
||||
@@ -18547,7 +18550,7 @@ BOOL convert_password_file(char *file_name)
|
||||
p++;
|
||||
|
||||
root = mxml_create_root_node();
|
||||
list = mxml_add_node(root, ELEMENT_NODE, "list", NULL);
|
||||
list = mxml_add_node(root, "list", NULL);
|
||||
|
||||
while (*p) {
|
||||
|
||||
@@ -18596,12 +18599,12 @@ BOOL convert_password_file(char *file_name)
|
||||
while (*p && (*p == '\r' || *p == '\n'))
|
||||
p++;
|
||||
|
||||
node = mxml_add_node(list, ELEMENT_NODE, "user", NULL);
|
||||
mxml_add_node(node, ELEMENT_NODE, "name", name);
|
||||
mxml_add_node(node, ELEMENT_NODE, "password", password);
|
||||
mxml_add_node(node, ELEMENT_NODE, "full_name", full_name);
|
||||
mxml_add_node(node, ELEMENT_NODE, "email", email);
|
||||
mxml_add_node(node, ELEMENT_NODE, "email_notify", email_notify);
|
||||
node = mxml_add_node(list, "user", NULL);
|
||||
mxml_add_node(node, "name", name);
|
||||
mxml_add_node(node, "password", password);
|
||||
mxml_add_node(node, "full_name", full_name);
|
||||
mxml_add_node(node, "email", email);
|
||||
mxml_add_node(node, "email_notify", email_notify);
|
||||
}
|
||||
|
||||
while (*p && isspace(*p))
|
||||
|
||||
+22
-6
@@ -516,7 +516,7 @@ PMXML_NODE mxml_create_root_node()
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
PMXML_NODE mxml_add_node_at(PMXML_NODE parent, int node_type, char *node_name, char *value, int index)
|
||||
PMXML_NODE mxml_add_special_node_at(PMXML_NODE parent, int node_type, char *node_name, char *value, int index)
|
||||
/* add a subnode (child) to an existing parent node as a specific position */
|
||||
{
|
||||
PMXML_NODE pnode, pchild;
|
||||
@@ -565,10 +565,26 @@ PMXML_NODE mxml_add_node_at(PMXML_NODE parent, int node_type, char *node_name, c
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
PMXML_NODE mxml_add_node(PMXML_NODE parent, int node_type, char *node_name, char *value)
|
||||
PMXML_NODE mxml_add_special_node(PMXML_NODE parent, int node_type, char *node_name, char *value)
|
||||
/* add a subnode (child) to an existing parent node at the end */
|
||||
{
|
||||
return mxml_add_node_at(parent, node_type, node_name, value, parent->n_children);
|
||||
return mxml_add_special_node_at(parent, node_type, node_name, value, parent->n_children);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
PMXML_NODE mxml_add_node(PMXML_NODE parent, char *node_name, char *value)
|
||||
/* add a subnode (child) to an existing parent node at the end */
|
||||
{
|
||||
return mxml_add_special_node_at(parent, ELEMENT_NODE, node_name, value, parent->n_children);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
PMXML_NODE mxml_add_node_at(PMXML_NODE parent, char *node_name, char *value, int index)
|
||||
/* add a subnode (child) to an existing parent node at the end */
|
||||
{
|
||||
return mxml_add_special_node_at(parent, ELEMENT_NODE, node_name, value, index);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
@@ -1048,7 +1064,7 @@ PMXML_NODE mxml_parse_buffer(char *buf, char *error, int error_size)
|
||||
|
||||
/* found comment */
|
||||
|
||||
pnew = mxml_add_node(ptree, COMMENT_NODE, "Comment", NULL);
|
||||
pnew = mxml_add_special_node(ptree, COMMENT_NODE, "Comment", NULL);
|
||||
pv = p+3;
|
||||
while (*pv == ' ')
|
||||
pv++;
|
||||
@@ -1074,7 +1090,7 @@ PMXML_NODE mxml_parse_buffer(char *buf, char *error, int error_size)
|
||||
} else if (*p == '?') {
|
||||
|
||||
/* found ?...? element */
|
||||
pnew = mxml_add_node(ptree, PROCESSING_INSTRUCTION_NODE, "PI", NULL);
|
||||
pnew = mxml_add_special_node(ptree, PROCESSING_INSTRUCTION_NODE, "PI", NULL);
|
||||
pv = p+1;
|
||||
|
||||
p++;
|
||||
@@ -1141,7 +1157,7 @@ PMXML_NODE mxml_parse_buffer(char *buf, char *error, int error_size)
|
||||
return read_error(HERE, "Unexpected second top level node");
|
||||
|
||||
/* allocate new element structure in parent tree */
|
||||
pnew = mxml_add_node(ptree, ELEMENT_NODE, node_name, NULL);
|
||||
pnew = mxml_add_node(ptree, node_name, NULL);
|
||||
|
||||
while (*p && isspace(*p)) {
|
||||
if (*p == '\n')
|
||||
|
||||
+4
-2
@@ -63,8 +63,10 @@ char *mxml_get_value(PMXML_NODE pnode);
|
||||
char *mxml_get_attribute(PMXML_NODE pnode, char *name);
|
||||
|
||||
int mxml_add_attribute(PMXML_NODE pnode, char *attrib_name, char *attrib_value);
|
||||
PMXML_NODE mxml_add_node(PMXML_NODE parent, int node_type, char *node_name, char *value);
|
||||
PMXML_NODE mxml_add_node_at(PMXML_NODE parent, int node_type, char *node_name, char *value, int index);
|
||||
PMXML_NODE mxml_add_special_node(PMXML_NODE parent, int node_type, char *node_name, char *value);
|
||||
PMXML_NODE mxml_add_special_node_at(PMXML_NODE parent, int node_type, char *node_name, char *value, int index);
|
||||
PMXML_NODE mxml_add_node(PMXML_NODE parent, char *node_name, char *value);
|
||||
PMXML_NODE mxml_add_node_at(PMXML_NODE parent, char *node_name, char *value, int index);
|
||||
|
||||
int mxml_replace_node_name(PMXML_NODE pnode, char *new_name);
|
||||
int mxml_replace_node_value(PMXML_NODE pnode, char *value);
|
||||
|
||||
Reference in New Issue
Block a user