File:  [Repository] / zogiLib / js / Attic / option.js
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Tue Nov 8 10:13:31 2005 UTC (19 years, 7 months ago) by casties
Branches: MAIN
CVS tags: HEAD
New version with only local state (no session or sub-session handling) and better template handling.
Currently only image and book template.


var digilibWin = null;

function findWin() {
    // put a reference of the current digilib window in digilibWin
    if (window.setParameter) {
        digilibWin = window;
        return;
    }
    // we try window.opener later because it might cause an exception
    if (window.opener) {
        if (window.opener.setParameter) {
            digilibWin = window.opener;
            return;
        }
    }
    alert("unable to find setParameter!");
}

findWin();

function setDLParam(e, s) {
    /*var tt = "";
    for (var t in s) {tt += "par:"+t+" = "+s[t]+", ";}
    alert(tt);'*/
    if (digilibWin) {
        var nam;
        var val;
        if (s.type && (s.type == "select-one")) {
            nam = s.name;
            val = s.options[s.selectedIndex].value;
        } else if (s.name && s.value) {
            nam = s.name;
            val = s.value;
        }
        if (nam && val) {
            digilibWin.setParameter(nam, val);
            digilibWin.display();
        }
    } else {
        alert("unable to find parent window!");
    }
    return true;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>