[Zope-CMF] LocalFS and IEeditor...
Phil Harris
phil.harris@zope.co.uk
Wed, 12 Dec 2001 14:34:09 -0000
Got the spellchecker if you're interested:
import xmlrpclib, string
def checkSpelling(self,args=None):
text=args['text']
if not text:
return 'Nothing found'
text=string.replace(text,'\015','')
text=string.split(text,'\n')
text=string.join(text,' ')
f=open('c:/temp.out','w')
f.write(str(text))
f.close()
text=string.strip(string.replace(text,'\n',''))
s=xmlrpclib.Server("http://www.stuffeddog.com/speller/speller-rpc.cgi")
t= s.speller.spellCheck(text)
r={}
for a in t:
if not r.has_key(string.lower(a['word'])):
r[string.lower(a['word'])]=a
t=[]
for a in r.values():
t.append(a)
return t
Could be cleaner, the one thing to remember is that the stuffeddog doesn't
like \n ;)
I call this from the page itself with a javascript library (vcXMLRPC):
result=rpcCall('<dtml-var URL1>','checkSpelling',{text:sendContent()})
check(result);
the check function looks like this:
function check(data){
if(data || data == ""){
var resultWindow = document.all("resultsWindow");
resultWindow.innerHTML = "Wait... Loading data....";
res = "";
for(j=0;j<data.length;j++){
res += "Suggestions for <b>\"" + data[j].word +
"\"</b>: ";
arr = data[j].suggestions;
sep='';
for(i=0;i<arr.length;i++){
res = res + sep + arr[i];
sep=', ';
}
res += "<br>";
}
resultWindow.innerHTML = ((res == "") ? "<h3>Spell check
results</h3>No Spelling Errors Found" : '<h3>Spell Check results</h3>'+res);
}
}
Have fun!
Phil
----- Original Message -----
From: "Jon Edwards" <jon@pcgs.freeserve.co.uk>
To: "Zope-Cmf" <zope-cmf@zope.org>
Cc: <paul@zope.com>
Sent: Wednesday, December 12, 2001 2:06 PM
Subject: [Zope-CMF] LocalFS and IEeditor...
> > First, thanks for posting that link! We need to help him get into the
> > CMF. Have you ever corresponded with him?
>
> I too found IEeditor a few days ago and have it working with CMF
Documents.
>
> I've sent him the code and he's going to test it then post it on his site.
> ...but if anyone can't wait, I could post it here too?
>
> It's excellent, though speed of download is a little slow. But there's a
few
> ideas on how to refactor it to improve this.
>
> Also, if there's any XML-RPC gurus out there, it would be great to do a
> Zope/Python script to call HTML-Tidy and/or the Spellchecker at
> http://www.stuffeddog.com/speller/
>
> HTH
>
> Cheers, Jon
>
>
> _______________________________________________
> Zope-CMF maillist - Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
requests