{= # # # report_alert_response.cfv (Send bug report by email form processing and response message) # # include "templates.util.encoding"; include "templates.util.user_agent"; include "templates.util.html"; include "templates.util.product_bar"; # include "templates.util.alert.compose_bug_report_text"; include "templates.util.alert.alert_util"; include "templates.util.linked_files.linked_files_util"; include "util.post_http"; debug_message("\n\n#### report_alert_response.cfv START \n\n"); debug_message("\n\n" . node_as_string("volatile.sys") . "\n\n"); string alert_id = volatile.sys.alert_id; string email_address = volatile.sys.email_address; string comment = volatile.sys.comment; if (email_address eq "") then ( email_address = "-"; ); if (comment eq "") then ( comment = "No comment sent."; ) else ( # clean comment from any carriage returns! comment = replace_all(comment, "\r", ""); # comment = replace_all(comment, "\n", "__LINE_FEED__"); ); # # # email the alert # # #* KHP 07/Feb/2011 - don't use email but HTTP POST to send the bug report string cmd = ""; v.options.1 = "background"; v.options.2 = "-dp"; v.options.3 = "templates.util.alert.email_bug_report"; v.options.4 = "volatile.generate_mime_files"; v.options.5 = "true"; v.options.6 = "volatile.sys.alert_id"; v.options.7 = alert_id; v.options.8 = "volatile.sys.sender_address"; v.options.9 = email_address; v.options.10 = "volatile.sys.comment"; v.options.11 = comment; string pid = exec(cmd, "v.options", true); *# node bug_report = alert_util_get_bug_report_as_node(alert_id); # echo("bug_report as node:\n" . node_as_string(bug_report)); string hostname = "www.sawmill.net"; string uri = "/cgi-bin/submit_bug_report.cgi"; node item; string label; string item_value; node http_headers = new_node(); node http_parameters = new_node(); @http_parameters{"email"} = email_address; @http_parameters{"subject"} = expand(PRODUCT_NAME) . " Bug Report"; @http_parameters{"comment"} = comment; foreach item bug_report ( # debug_message("#### #### ####\n" . node_as_string(item) . "\n\n"); label = lowercase(@item{"label"}); item_value = @item{"item_value"}; @http_parameters{label} = item_value; ); # echo("http_parameters:\n" . node_as_string(http_parameters)); node http_response = post_http(hostname, uri, false, http_headers, http_parameters); int http_response_code = @http_response{"response_code"}; # echo("HTTP response:\n" . node_as_string(http_response)); # # # Start the html response # # set_doctype(); '\n'; '\n'; '' . lang_stats.bug_report.response_label . '\n'; set_meta_content(); # # # css files # # node misc_file_map = "templates.util.linked_files.file_maps.misc_file_map"; add_css_files(misc_file_map, "report_alert_response"); '\n'; '\n'; '\n'; # # Main header bar # bool is_msie_v6 = get_is_msie_v6(); build_dynamic_product_bar("admin", is_msie_v6, "", "", ""); '
'; '

' . lang_stats.bug_report.response_label . '

'; # # Check if a HTTP error occured # if (http_response_code < 400) then ( '

$lang_stats.bug_report.response_info

\n'; ) else ( # Display the error message '

'; 'HTTP status code: ' . http_response_code . '
'; string_to_html(@http_response{"response"}); '

\n'; ); '
'; '\n'; '\n'; =}