| |
|
1 |
namespace eval ::xowf::test { |
| |
|
2 |
ad_proc -private question_names_from_input_form {d} { |
| |
|
3 |
|
| |
|
4 |
Parse html reply and extract question names |
| |
|
5 |
(test-item-convention) from the form content. |
| |
|
6 |
|
| |
|
7 |
@return list of question names |
| |
|
8 |
} { |
| |
|
9 |
acs::test::dom_html root [::xowiki::test::get_content $d] { |
| |
|
10 |
set input_names [$root selectNodes {//input/@name}] |
| |
|
11 |
lappend input_names {*}[$root selectNodes {//textarea/@name}] |
| |
|
12 |
ns_log notice "TEXTAREAS [$root selectNodes {//textarea/@name}]" |
| |
|
13 |
} |
| |
|
14 |
ns_log notice "input_names <$input_names>" |
| |
|
15 |
return [lmap input_name [lsort -unique $input_names] { |
| |
|
16 |
set name [lindex [split [lindex $input_name 1] .] 0] |
| |
|
17 |
if {[string match "__*" $name]} continue |
| |
|
18 |
ns_log notice "... check '$name'" |
| |
|
19 |
if {[string range $name end end] ne "_"} continue |
| |
|
20 |
string range $name 0 end-1 |
| |
|
21 |
}] |
| |
|
22 |
} |
| |
|
23 |
} |
| |
|
24 |
# |
| |
|
25 |
# Local variables: |
| |
|
26 |
# mode: tcl |
| |
|
27 |
# tcl-indent-level: 4 |
| |
|
28 |
# indent-tabs-mode: nil |
| |
|
29 |
# End: |