Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon1.gif   Javascript for Bookmark Link for one-click submission to elog, posted by Fred Hooper on Sat Jan 31 09:33:35 2004 elogsubmit-template.js
    icon2.gif   Re: Javascript for Bookmark Link for one-click submission to elog, posted by Stefan Ritt on Wed Feb 4 12:00:14 2004 
Message ID: 465     Entry time: Wed Feb 4 12:00:14 2004     In reply to: 464
Icon: Reply  Author: Stefan Ritt  Author Email: stefan.ritt@psi.ch 
Category: Other  OS: Linux | Windows | Mac OSX | Other  ELOG Version: 2.5.0 
Subject: Re: Javascript for Bookmark Link for one-click submission to elog 
I find this script very nice. Indeed JavaScript can be very powerful to do such 
things. I added some JavaScript support to the elogd server itself. If one opens 
the "New" page like

http://localhost/demo/?cmd=New&js=test.js

then the JavaScript "test.js" (which has to be present in 
themes/default/test.js) gets inserted into the page header and executed. This 
can be used to add custom form validation, which is more powerful than the built 
in checking if required attributes are present.

Then I tried to redo the bookmark script with the new method. A server-side 
script has of course more space than just a bookmark. I started with a bookmark 
like:

javascript:window.open("http://localhost/demo/?cmd=New&js=test.js");

which even works on IE6. The script "test.js" contains:

function a()
{
  var d=opener.document;
  alert("test.js");
  alert(d.location.href);
  alert(d.getSelection());
}

a();

While the first alert() works, the others fail. It seems like the "opener" 
method does not correctly dereference the right window. If anybody has some 
idea, please let me know.

The new version of elogd which supports the "js=" command can be found here:

http://midas.psi.ch/cgi-bin/cvsweb/elog/src/elogd.c?rev=1.235
ELOG V3.1.5-3fb85fa6