From 5ca525cde291cfdc9eeb6286eba50666ea0620ad Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Wed, 16 Apr 2003 17:59:08 +0000 Subject: [PATCH] 1. param.name=value parameters added to the getpage method 2. index.html modified to use all the param.name parameters --- helm/searchEngine/html/index.html | 50 +++++++++++++++++++++++++++++-- helm/searchEngine/searchEngine.ml | 21 +++++++++---- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/helm/searchEngine/html/index.html b/helm/searchEngine/html/index.html index 5d6dbf387..7fd3824c1 100644 --- a/helm/searchEngine/html/index.html +++ b/helm/searchEngine/html/index.html @@ -43,13 +43,57 @@ function initialize() numeroazioniannullate=0; } -// @processorURL@ will be substituted by the searchEngine using -// the correct value +// @variable@ will be substituted by the searchEngine with the param.variable +// argument value var processorURL="@processorURL@"; +var getterURL="@getterURL@"; +var thkeys="@thkeys@"; +var proofcheckerURL="@proofcheckerURL@"; +var draw_graphURL="@draw_graphURL@"; +var uri_set_queueURL="@uri_set_queueURL@"; +var UNICODEvsSYMBOL="@UNICODEvsSYMBOL@"; +var keys="@keys@"; +var thkeys="@thkeys@"; +var embedkeys="@embedkeys@"; +var doctype_public="@doctype-public@"; +var encoding="@encoding@"; +var thencoding="@thencoding@"; +var media_type="@media-type@"; +var thmedia_type="@thmedia-type@"; +var interfaceURL="@interfaceURL@"; +var thinterfaceURL="@thinterfaceURL@"; +var CICURI="@CICURI@"; +var naturalLanguage="@naturalLanguage@"; +var annotations="@annotations@"; +var topurl="@topurl@"; function ask_uwobo(url) { - return (top.topurl+"/ask_uwobo?url="+escape(processorURL + "apply?xmluri=" + escape(url) + "&keys=T1%2CT2%2CL%2CE¶m.processorURL="+escape(processorURL)+"¶m.getterURL=http%3A//mowgli.cs.unibo.it%3A58081/¶m.proofcheckerURL=http%3A//mowgli.cs.unibo.it%3A58084/¶m.draw_graphURL=http%3A//mowgli.cs.unibo.it%3A58083/¶m.uri_set_queueURL=http%3A//mowgli.cs.unibo.it%3A58082/¶m.UNICODEvsSYMBOL=unicode¶m.keys=d_c%2CC1%2CHC2%2CL¶m.thkeys=T1%2CT2%2CL%2CE¶m.embedkeys=d_c%2CTC1%2CHC2%2CL¶m.doctype-public=-//W3C//DTD%20XHTML%201.0%20Transitional//EN¶m.encoding=iso-8859-1¶m.thencoding=iso-8859-1¶m.media-type=text/html¶m.thmedia-type=text/html¶m.interfaceURL=http%3A//helm.cs.unibo.it/helm/html/cic/index.html¶m.thinterfaceURL=http%3A//helm.cs.unibo.it/helm/html/theory/index.html¶m.CICURI=dummy:query_result¶m.naturalLanguage=yes¶m.annotations=no¶m.topurl=http://helm.cs.unibo.it/helm&prop.method=html")); + return (top.topurl+"/ask_uwobo?url="+ + escape(processorURL + "apply?" + + "xmluri=" + escape(url) + + "&keys=" + escape(thkeys) + + "¶m.processorURL=" + escape(processorURL) + + "¶m.getterURL=" + escape(getterURL) + + "¶m.proofcheckerURL=" + escape(proofcheckerURL) + + "¶m.draw_graphURL=" + escape(draw_graphURL) + + "¶m.uri_set_queueURL=" + escape(uri_set_queueURL) + + "¶m.UNICODEvsSYMBOL=" + escape(UNICODEvsSYMBOL) + + "¶m.keys=" + escape(keys) + + "¶m.thkeys=" + escape(thkeys) + + "¶m.embedkeys=" + escape(embedkeys) + + "¶m.doctype-public=" + escape(doctype_public) + + "¶m.encoding=" + escape(encoding) + + "¶m.thencoding=" + escape(thencoding) + + "¶m.media-type=" + escape(media_type) + + "¶m.thmedia-type=" + escape(thmedia_type) + + "¶m.interfaceURL=" + escape(interfaceURL) + + "¶m.thinterfaceURL=" + escape(thinterfaceURL) + + "¶m.CICURI=" + escape(CICURI) + + "¶m.naturalLanguage=" + escape(naturalLanguage) + + "¶m.annotations=" + escape(annotations) + + "¶m.topurl=" + escape(topurl) + + "&prop.method=html")); } function help(w) // quando invocata, visualizza l' help relativo ad un oggetto. Di solito รจ legata ad un evento onFocus o onMouseOver. { diff --git a/helm/searchEngine/searchEngine.ml b/helm/searchEngine/searchEngine.ml index abf9eaa36..77280d77a 100644 --- a/helm/searchEngine/searchEngine.ml +++ b/helm/searchEngine/searchEngine.ml @@ -29,7 +29,7 @@ Http_common.debug := true;; (* Http_common.debug := true;; *) (** accepted HTTP servers for ask_uwobo method forwarding *) -let valid_servers = [ "mowgli.cs.unibo.it:58080" ] ;; +let valid_servers = [ "mowgli.cs.unibo.it:58080" ; "localhost:58080" ] ;; open Printf;; @@ -98,14 +98,12 @@ let fold_file f init fname = let iter_file f = fold_file (fun _ line -> f line) () let (title_tag_RE, choices_tag_RE, msg_tag_RE, id_to_uris_RE, id_RE, - interpretations_RE, interpretations_labels_RE, results_RE, new_aliases_RE, - processorURL_RE) + interpretations_RE, interpretations_labels_RE, results_RE, new_aliases_RE) = (Pcre.regexp "@TITLE@", Pcre.regexp "@CHOICES@", Pcre.regexp "@MSG@", Pcre.regexp "@ID_TO_URIS@", Pcre.regexp "@ID@", Pcre.regexp "@INTERPRETATIONS@", Pcre.regexp "@INTERPRETATIONS_LABELS@", - Pcre.regexp "@RESULTS@", Pcre.regexp "@NEW_ALIASES@", - Pcre.regexp "@processorURL@") + Pcre.regexp "@RESULTS@", Pcre.regexp "@NEW_ALIASES@") let server_and_port_url_RE = Pcre.regexp "^http://([^/]+)/.*$" let port = @@ -166,7 +164,18 @@ let callback (req: Http_types.request) outchan = (fun line -> output_string outchan ((apply_substs - [processorURL_RE, req#param "processorURL"] line) ^ + (List.map + (function (key,value) -> + let key' = + (Pcre.extract ~pat:"param\\.(.*)" key).(1) + in + Pcre.regexp ("@" ^ key' ^ "@"), value + ) + (List.filter + (fun (key,_) as p-> Pcre.pmatch ~pat:"^param\\." key) + req#params) + ) + line) ^ "\n")) fname end else -- 2.39.2