4 let pp_request (req: Http_types.request) =
9 | "/locate" -> "Locate"
12 let pp_error title msg =
13 sprintf "<hr size='1' /><div><b class='error'>%s:</b> %s</div>" title msg
15 (** pretty print a list of URIs to an HELM theory file *)
16 let theory_of_result req result =
18 Helm_registry.get_opt_default Helm_registry.get_int 10
19 "search_engine.max_results_no"
21 let results_no = List.length result in
22 let query_kind = pp_request req in
23 let template query_kind summary results =
25 "<div class='resultsbar'>
28 <td class='left'><b class='query_kind'>%s</b></td>
29 <td class='right'>%s</td>
37 query_kind summary results
39 if results_no > 0 then
40 let mode = if results_no > max_results_no then "linkonly" else "typeonly" in
42 let idx = ref (results_no + 1) in
48 <td valign=\"top\">%d.</td>
49 <td><ht:OBJECT uri=\"%s\" mode=\"%s\"/></td>
55 (sprintf "<b>%d</b> result%s found"
56 results_no (if results_no > 1 then "s" else ""))
58 "<table xmlns:ht=\"http://www.cs.unibo.it/helm/namespaces/helm-theory\">
63 template query_kind "no results found" ""
65 let html_of_interpretations interps =
67 sprintf "<input type=\"radio\" name=\"param.interp\" value=\"%d\" />" n
70 String.concat "<br />"
72 (fun (id, value) -> sprintf "<span>%s = %s</span>" id value)
75 let rec aux n = function
77 | interp::tl -> ((radio_button n)^(text interp))::(aux (n+1) tl)
79 String.concat "<br />" (aux 0 interps)