[Zope] using xml-rpc with javascript to access zope
Sean Hastings
whysean at softhome.net
Wed Oct 6 17:43:03 EDT 2004
No problem. I am always willing to share some code that I have written. For
me, a code example is the best explanation.
> -----Original Message-----
> From: Laura McCord [mailto:Laura.McCord at doucet-austin.com]
> Sent: Wednesday, October 06, 2004 4:02 PM
> To: Sean Hastings; zope at zope.org
> Subject: RE: [Zope] using xml-rpc with javascript to access zope
>
>
> Wow, it worked great. Thanks so much it really solved a lot of my
> issues.
>
> Thanks Again,
> Laura
>
> -----Original Message-----
> From: Sean Hastings [mailto:whysean at softhome.net]
> Sent: Wednesday, October 06, 2004 10:24 AM
> To: Laura McCord
> Subject: RE: [Zope] using xml-rpc with javascript to access zope
>
>
> Oops, forgot to give you the JavaScript part:
>
> <script language="Javascript1.1">
> <!--
> function Pop(url)
> {
> Popup =
> window.open(url,"poppy",'titlebar=0,toolbar=0,location=0,directories=0,s
> tatu
> s=0,menubar=0,scrollbars=1,resizable=0,width=400,height=500');
> Popup.moveTo(500,25);
> Popup.focus();
> }
>
> // -->
> </script>
>
>
> --Sean
>
> > -----Original Message-----
> > From: Laura McCord [mailto:Laura.McCord at doucet-austin.com]
> > Sent: Wednesday, October 06, 2004 10:33 AM
> > To: Sean Hastings
> > Subject: RE: [Zope] using xml-rpc with javascript to access zope
> >
> >
> > Hmmm... I will look into the popup idea. I have been using DHTML popup
>
> > boxes do you think that this will have any effect on the performance
> > or do you foresee any complications with using DHTML?
> >
> > Thanks for the idea.
> >
> > -Laura
> >
> >
> > -----Original Message-----
> > From: Sean Hastings [mailto:whysean at softhome.net]
> > Sent: Wednesday, October 06, 2004 9:10 AM
> > To: Laura McCord
> > Subject: RE: [Zope] using xml-rpc with javascript to access zope
> >
> >
> > If you do this as a popup, you could just send a request to Zope for a
>
> > page to fill it. More complicated would be to have Javascript write an
>
> > iframe into your page, and the target it with the request to Zope. I
> > don't know anything about xml-rpc, but if Zope is already able to pull
>
> > your info from its source, and Javascript won't - then either of the
> > above should work.
> >
> > --Sean
> >
> > > -----Original Message-----
> > > From: Laura McCord [mailto:Laura.McCord at doucet-austin.com]
> > > Sent: Wednesday, October 06, 2004 9:56 AM
> > > To: Sean Hastings
> > > Subject: RE: [Zope] using xml-rpc with javascript to access zope
> > >
> > >
> > >
> > > I just posted more information describing what I need. But here it
> > > is
> > > again:
> > >
> > > Well, the whole reason I am trying to do it this way, is because I
> > > am accessing ldap information through xml-rpc and I am not storing
> > > this information into a database because I was told that it would
> > > not be a good idea to have this information stored into two places.
> > > So, I have a perl script running as an xml-rpc server on my local
> > > machine and I have a python script that calls the xml-rpc methods:
> > >
> > > def userInfo(userName):
> > > server = xmlrpclib.Server("http://tweety:8080/RPC2")
> > > email = server.da.emailInfo(userName)
> > > office = server.da.officeInfo(userName)
> > > pwd = server.da.pwdInfo(userName)
> > > acct = server.da.acctInfo(userName)
> > > dir = server.da.dirInfo(userName)
> > > info = {'email' : email,
> > > 'office': office,
> > > 'pwd' : pwd,
> > > 'acct' : acct,
> > > 'dir' : dir }
> > > return info
> > >
> > > Normally, in my zope page template I would call this method like
> > > this <div tal:define="info python:here.userInfo(username)"> However,
>
> > > because I have about a hundred users and all of the users are
> > > displayed on one page it takes the pages 2 minutes to load which is
> > > way too long. So, next to each user record I have a link that when
> > > clicked will expand the user's record by displaying detailed
> > > information (I am using DHTML contractible headers for this part).
> > > Well, at the same time the detailed information is being displayed
> > > by the link I want my external method userInfo to trigger so this
> > > information is not processed until I access a user's detailed
> > > information. So, in this case the xml-rpc call is not made unless it
>
> > > is requested and all users won't be processed at once resulting in
> > > less time to load a page.
> > >
> > > Maybe someone can offer me a better solution other than this since
> > > it seems too difficult.
> > >
> > > Thanks for all the help.
> > >
> > > -Laura
> > >
> > > Maybe this will help you visualize what I have designed.
> > >
> > > *(link) username officeLocation ComputerTheyAreUsing ComputerModel
> > > *(link) username officeLocation ComputerTheyAreUsing ComputerModel
> > > *(link) username officeLocation ComputerTheyAreUsing ComputerModel
> > > *(link) username officeLocation ComputerTheyAreUsing ComputerModel
> > > *(link) username officeLocation ComputerTheyAreUsing ComputerModel
> > > <!-- the detailed information below will display when the above
> > > link
> >
> > > next to the user's name is clicked -->
> > > username userpassword useremail useraccount userdirectory
> > >
> > >
> > > -----Original Message-----
> > > From: Sean Hastings [mailto:whysean at softhome.net]
> > > Sent: Wednesday, October 06, 2004 8:32 AM
> > > To: Laura McCord; Chris McDonough; zope at zope.org
> > > Subject: RE: [Zope] using xml-rpc with javascript to access zope
> > >
> > >
> > > Can you describe the behavior you are trying to get from the user's
> > > perspective?
> > >
> > > I am about 110% certain that there must be a simpler way. Maybe a
> > > popup window, or a frame that reloads within your page, or
> > > JavaScript calling a URL that does not return anything at all so the
>
> > > effect is to
> >
> > > just send info to the server - would any of these do the trick?
> > >
> > > --Sean
> > >
> > > > -----Original Message-----
> > > > From: zope-bounces+whysean=softhome.net at zope.org
> > > > [mailto:zope-bounces+whysean=softhome.net at zope.org]On Behalf Of
> > > > Laura McCord
> > > > Sent: Wednesday, October 06, 2004 9:08 AM
> > > > To: Chris McDonough; zope at zope.org
> > > > Subject: RE: [Zope] using xml-rpc with javascript to access zope
> > > >
> > > >
> > > > Hi Chris,
> > > >
> > > > >If not, I'd suggest trying to implement this in very, very small
> > > > pieces. e.g. make a JavaScript function that does something
> > > > simple like, >calls an XML-RPC method that returns "1+1" and then
> > > > displays the result 2 within the DOM using JavaScript, then build
> > > > up from there
> > > > >incrementally.
> > > >
> > > > Yes, this is my biggest problem, how do I call a simple xml-rpc
> > > > method
> > >
> > > > from javascript?
> > > >
> > > > The xml-rpc server is not a zope server it is a perl script that
> > > > is running on my local computer.
> > > >
> > > > Ideally this is what I what to do, I want to click on a link and
> > > > onclick will call a javascript function and that function will
> > > > call a xml-rpc method, this will all occur in my zope page
> > > > template. Sounds basic, but I don't know where to start.
> > > >
> > > > I just started learning xml-rpc so I don't know all of the
> > > > technicalities behind it, so I am so sorry for not explaining
> > > > myself
> >
> > > > correctly before.
> > > >
> > > > Thank You,
> > > > Laura
> > >
> >
>
More information about the Zope
mailing list