NParams = coa_GetElementCount(cnx, create_params);
for (i=0;i<NParams;i+=2)
if (!strcmp(coa_GetElement(cnx, create_params, i),"evaluation_mode"))
evalmode = ap_pstrdup(p, coa_GetElement(cnx,create_params, i+1));

@co_call(par_area,'"text_document"',"create",par_area=>par_area,par_class=>par_class,par_id=>-1,create_params=>create_params,dont_set_acl=>dont_set_acl);

__GET_RETURNED_INTEGER(new_id)

__SEND_MESG_DEBUG("new_id=%d",new_id)

security_state = cnx->check_security;
cnx->check_security = 0;

__SEND_MESG_DEBUG("before update")

@co_call(par_area,par_class,"update",par_area=>par_area,par_class=>par_class,par_id=>new_id,par_prop=>'"evaluation_mode"',new_value=>evalmode,version=>-1);

__SEND_MESG_DEBUG("after update")

cnx->check_security = security_state;

__RETURN_INTEGER(new_id)