--- loncom/html/res/adm/pages/bookmarkmenu/bookmarklib.js 2001/04/30 11:28:05 1.18 +++ loncom/html/res/adm/pages/bookmarkmenu/bookmarklib.js 2006/04/20 04:08:04 1.21 @@ -1,4 +1,30 @@ +// The LearningOnline Network with CAPA // bookmarklib.js +// +// $Id: bookmarklib.js,v 1.21 2006/04/20 04:08:04 albertel Exp $ +// +// Copyright Michigan State University Board of Trustees +// +// This file is part of the LearningOnline Network with CAPA (LON-CAPA). +// +// LON-CAPA is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// LON-CAPA is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with LON-CAPA; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// /home/httpd/html/adm/gpl.txt +// +// http://www.lon-capa.org/ +// // // This is a rewritten version of bookmarklib.js // @@ -322,7 +348,11 @@ function folderHover(image_num) { if (window.tree.cache.lastImg==-2) { frames[7].document.images[1].src='/res/adm/pages/bookmarkmenu/folder_trash.gif'; } else { - frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon; + if (typeof(window.tree.cache.lastImg)!='undefined') { + if (window.tree.cache.lastImg>=0) { + frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon; + } + } } window.tree.cache.lastImg=image_num; window.tree.cache.icon=this.icon; @@ -375,7 +405,11 @@ function newLink(name, url) { } function linkGoto() { - self.opener.clientwindow.location.href=this.url; + if (typeof(self.opener.clientwindow) != 'undefined') { + self.opener.clientwindow.location.href=this.url; + } else { + self.opener.location.href=this.url; + } } function linkEdit() { @@ -421,7 +455,11 @@ function linkHover(img_num) { if (window.tree.cache.lastImg==-2) { frames[7].document.images[1].src='/res/adm/pages/bookmarkmenu/folder_trash.gif'; } else { + if (typeof(window.tree.cache.lastImg)!='undefined') { + if (window.tree.cache.lastImg>=0) { frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon; + } + } } window.tree.cache.lastImg=img_num; window.tree.cache.icon=this.icon; @@ -502,8 +540,12 @@ function clickTrash() { } function hoverTrash() { - if (window.tree.cache.isLoaded) { - frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon; + if (window.tree.cache.isLoaded) { + if (typeof(window.tree.cache.lastImg)!='undefined') { + if (window.tree.cache.lastImg>=0) { + frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon; + } + } window.tree.cache.lastImg=-2; window.tree.cache.icon='/res/adm/pages/bookmarkmenu/folder_trash.gif'; frames[7].document.images[1].src = '/res/adm/pages/bookmarkmenu/folder_trash_hover.gif';