X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FsearchEngine%2Fhtml%2Findex.html;h=8cb492b1360cd39b4d98d6b794cfdebe24c585a0;hb=fb783535ecfe90b6277605d8c8df395389acaf75;hp=d26024e56a08d6b045a812c32eb5f2f87d5d74a7;hpb=fb12bdf2cf0ecbf50726b70d6a3097cb933319a0;p=helm.git diff --git a/helm/searchEngine/html/index.html b/helm/searchEngine/html/index.html index d26024e56..8cb492b13 100644 --- a/helm/searchEngine/html/index.html +++ b/helm/searchEngine/html/index.html @@ -46,13 +46,15 @@ function help(w) // quando invocata, visualizza l' help relativo ad un oggetto. { hw.document.close(); switch (w) { + case -10: hw.document.write("Insert an Id or an Uri here.") + break; case -9: hw.document.write("By clicking this you may add or remove aliases as you wish.") break; case -81: hw.document.write("Allows you to recover your last input") break; case -8: hw.document.write("Allows you to delete your last input") break; - case -7: hw.document.write("Erases your query and starts a new pre-defined query.") + case -7: hw.document.write("Erases your query and starts a new pre-defined query, you will keep your list of aliases.") break; case -6: hw.document.write("Puts this string in the current cursor position. This button works only with Internet Explorer.") break; @@ -98,6 +100,61 @@ function tpa(quotpath) {quotpath=quotpath.replace(">",">");} return (quotpath); } +function idcheck(ident) + { + lettera=/[a-zA-Z]/; + partediid=/[a-zA-Z0-9_\-\']/; + if (!lettera.test(ident.charAt(0))){alert("an Id must begin with a letter.");return(0)} + while (ident.length>0) + { + ident=ident.substring(1,(ident.length)); + if (ident.length>0){ + if (!partediid.test(ident.charAt(0))){alert(ident.charAt(0)+" is not a valid character for an Id.");return(0);} + }} + return(1) + } +function uricheck(ident) + { + cifra=/[0-9]/ + cic=ident.substring(0,5);//alert(cic); + if (cic!="cic:/"){alert("an Uri must begin with the string 'cic:/'");return(0);} + ident=ident.substring(5,ident.length);//alert(ident); + if (ident.indexOf(".")<0){alert("an Uri must contain a '.'");return(0);} + ident1=ident.substring(0,ident.indexOf("."));//alert(ident1); + ident2=ident.substring(ident.indexOf(".")+1,ident.length);//alert(ident2); + while (ident1.length>0) + { + if (ident1.indexOf("/")>-1) + { + if (idcheck(ident1.substring(0,ident1.indexOf("/")))==0){return (0)} + ident1=ident1.substring(ident1.indexOf("/")+1,ident1.length);//alert(ident1); + } + else {if (idcheck(ident1)==0){return (0)} + ident1="";} + } + if (ident2=="con"||ident2=="var"){return(1)} + if (ident2.substring(0,6)!="ind#1/"){alert ("syntax error in the Uri.");return(0);} + ident2=ident2.substring(6,ident2.length);//alert(ident2); + if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);} + if (ident2.indexOf("/")>-1) + { + while (ident2.charAt(0)!="/") + { + //alert(ident2); + if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);} + ident2=ident2.substring(1,ident2.length); + } + } + while (ident2.length>0) + { + //alert(ident2); + ident2=ident2.substring(1,ident2.length); + if (ident2.length>0){ + if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);} + }} + + return(1) + } function gramcheck(how,what) // esegue il controllo sintattico sulla stringa "what", controllando che rispetti i requisiti indicati dalla clausola "how". Se qualcosa non รจ ok, la variabile "wrong" viene posta ad 1 e la stringa da aggiungere viene ignorata, mentre viene visualizzato un apposito messaggio di errore. { var slash=0; @@ -214,12 +271,12 @@ function aggcw() // invocata automaticamente ad ogni modifica della variabile "q ltr=pq.slice(pq.indexOf("[?")); ltr=ltr.substring(ltr.indexOf("[?"),(ltr.length-ltr.indexOf("[?"))-(ltr.length-ltr.indexOf("]")-1)); wto=ltr.substring(2,5); - if (wto=="set") {window.open(top.topurl+"/getpage?url=set.html","cw");pq="";} - else if (wto=="val") {window.open(top.topurl+"/getpage?url=val.html","cw");pq="";} - else if (wto=="bol") {window.open(top.topurl+"/getpage?url=boole.html","cw");pq="";} + if (wto=="set") {window.open(top.topurl+action+"set.html","cw");pq="";} + else if (wto=="val") {window.open(top.topurl+action+"val.html","cw");pq="";} + else if (wto=="bol") {window.open(top.topurl+action+"boole.html","cw");pq="";} else pq=pq.substring(pq.indexOf("[?")+2,pq.length); } - else {window.open(top.topurl+"/getpage?url=blank.html","cw");pq="";} + else {window.open(top.topurl+action+"blank.html","cw");pq="";} } } function aggform() // aggiorna il form nel frame centrale. Invocata ad ogni cambio della variabile "query". @@ -293,7 +350,7 @@ function annulla() qw.document.write(query); aggform(); sw.apply(); - if (query=="*"){cw.location=top.topurl+"/getpage?url=set.html";ltr="*";} else {aggcw();} + if (query=="*"){cw.location=top.topurl+action+"set.html";ltr="*";} else {aggcw();} cw.focus(); } } @@ -302,34 +359,34 @@ function parse() // prende la stringa che si sta tentando di inserire nella quer while (fb.indexOf("[set]")>-1){ if (fb.indexOf("set")>0) { - fb=fb.replace("[set]","[?set"+top.storeps+"]"); + fb=fb.replace("[set]","[?set"+top.storeps+"]"); top.storeps++; } } while (fb.indexOf("[val]")>-1){ if (fb.indexOf("val")>0) { - fb=fb.replace("[val]","[?val"+top.storepv+"]"); + fb=fb.replace("[val]","[?val"+top.storepv+"]"); top.storepv++; } } while (fb.indexOf("[boole]")>-1){ if (fb.indexOf("boole")>0) { - fb=fb.replace("[boole]","[?bol"+top.storepb+"]"); + fb=fb.replace("[boole]","[?bol"+top.storepb+"]"); top.storepb++; } } } function aggq() // aggiorna la query sostituendo l' ultimo link editato con la stringa inserita, poi aggiorna tutti i frame. { - //window.open(top.topurl+"/getpage?url=summary.html","cw"); + //window.open(top.topurl+action+"summary.html","cw"); qw.document.close(); fb=stadd; nst=ltr.substring(5,(ltr.length-1));// alert(nst+" "+ltr); - query=query.replace(""+ltr+"",ltr); - query=query.replace(""+ltr+"",ltr); - query=query.replace(""+ltr+"",ltr); + query=query.replace(""+ltr+"",ltr); + query=query.replace(""+ltr+"",ltr); + query=query.replace(""+ltr+"",ltr); parse(); query=query.replace(ltr,fb); actinput++;storia[actinput]=query;numeroazioniannullate=0;//alert (actinput+" "+storia.length); @@ -337,10 +394,13 @@ function aggq() // aggiorna la query sostituendo l' ultimo link editato con la s aggcw(); cw.focus(); } - var topurl=document.location.protocol+'//'+document.location.host; +var topurl=document.location.protocol+'//'+document.location.host; +//var topurl=""; +var action="/getpage?url="; +//var action="";