--- loncom/html/res/adm/pages/bookmarkmenu/bookmarklib.js 2000/09/26 14:51:03 1.4 +++ loncom/html/res/adm/pages/bookmarkmenu/bookmarklib.js 2001/04/30 11:28:05 1.18 @@ -1,328 +1,594 @@ // bookmarklib.js // -// Functions combined with the HTML code in admbookmarks.pm +// This is a rewritten version of bookmarklib.js // +// Functions to be combined with the HTML code found in +// admbookmarks.pm. The combination will provide a complete +// functionality for the bookmarkmenu in accordance to defined +// requirements. +// +// For further information and documentation regarding this program, +// please refer to bookmarkmenu_OOD.txt, the design documentation for +// bookmarkmenu. +// +// +// +// The perl module admbookmarks.pm interacts with this library by +// generating a page that includes bookmarklib.js and a JavaScript +// function initializeTree() that builds the the tree using successive +// newLink() and newFolder() calls and one cache=new newCache() call. +// The entire newLink()/newFolder() succession is the string that is +// stored in the userspace on Lon-Capa as bookmarks. +// +// +// Created on: 12-28-2000 by Benjamin Tyszka +// Edited: 12-29-2000 by Benjamin Tyszka +// mm-dd-yyyy by Xxxxxxxx Xxxxxx + + +//clienttitle="Enter title here";//debug +//clienthref="Enter url here"; //debug + +//function ugh_oh( msg, url, ln ) { +// alert("Error: "+msg+" in "+url+" at line: "+ln); +// return true; +//} + +//alert("Does alert even work?"); + +//window.onerror=ugh_oh; +//this.onerror=ugh_oh; -//------------------------------------------------------------------------------- -// Here are all of the bookmark methods: -//------------------------------------------------------------------------------- - -//-------------------------------------------------------Adds a link to an object -function addLink(name, link, address, position) { - this.lname = name; - this.link = link; - this.address = address; - this.position = position; - this.state = "link"; - this.icon = "/res/adm/pages/bookmarkmenu/link.gif"; - this.pressed = "/res/adm/pages/bookmarkmenu/link_pressed.gif"; - this.hover = hover; - this.remove = remove - this.exists = true; -} - -//-----------------------------------------------------Adds a folder to an object -function addFolder(name, size, address) { - this.p = new Array(size); - this.lname = name; - this.address = address; - this.state = "opened"; - this.icon = "/res/adm/pages/bookmarkmenu/folder_opened.gif"; - this.pressed = "/res/adm/pages/bookmarkmenu/folder_opened_pressed.gif"; - this.swapState = swapState; - this.clickFolder = clickFolder; - this.clickLink = clickLink; - this.hover = hover; - this.remove = remove; - this.bump = bump; - this.insertLink = insertLink; - this.insertFolder = insertFolder; - this.exists = true; + +//--------------------------------------------------------------------- +// Tree object +//--------------------------------------------------------------------- +// Basis for user's bookmarks and folders - All properties and methods +// pertaining to a user in general are found here. Refer to +// bookmarkmenu_OOD.txt for further documenation. +function newTree() { + this.redraw = redraw; + this.treeSave = treeSave; + this.bookmarks = new newFolder("bookmarks",true); + this.cache = new newCache(); +} + +//------------------------------------------refresh folder/link display +function redraw() { + image_num = -1; // reset to before (-1 not 0) the first image + with(frames[4].document) { + open(); //--------for 'compliant' browsers + clear(); //----------for Mozilla (Netscape6) + write("\n" ); + write("
\n" ); + write("" ); + write("" ); + write("" ); + write(""); + write("" ); + write("" ); + write( this.name+" | " ); } - object2.p[n].state=object1.state; - object2.p[n].icon=object1.icon; - object2.p[n].pressed=object1.pressed; - object2.p[n].exists=object1.exists; +// with (bendebugger.document) { +// write("" ); + write("" ); + write("" ); + write(""); + write("" ); + write("" ); + write( this.name+" | " ); + } +// with (bendebugger.document) { +// write(""); + write(""); + write(""); + write(""); + write(""); + write(this.name+" | " ); + } +// with (bendebugger.document) { +// write("
"); - image_num++; - parent.frames[4].document.write(""); - - parent.frames[4].document.write(""); - image_num++; - parent.frames[4].document.write(" | "+folder.lname+" |
Debug: Beginning save process...
"); // debug - saveVar="this.bookmarks=new addFolder('Stuff',"+bookmarkpal.bookmarks.p.length+",'bookmarks')writing variable...
"+saveVar+"...done
"); // debug - parent.frames[7].document.saveBookmarks.hidden_bookmarks=saveVar; - return true; + +//-----------------------------------------Generates HTML in each frame +function buildBookmarkMenu() { + var frmHTML1 = "\n\n\n"; + frames[0].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/ul_corner.gif"+frmHTML2 ); + frames[1].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/upper_bar.gif"+frmHTML2 ); + frames[2].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/ur_corner.gif"+frmHTML2 ); + frames[3].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/left_bar.gif"+frmHTML2 ); + frames[5].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/right_bar.gif"+frmHTML2 ); + frames[6].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/left_bar.gif"+frmHTML2 ); + frames[8].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/right_bar.gif"+frmHTML2 ); + frames[9].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/ll_corner.gif"+frmHTML2 ); + frames[10].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/lower_bar.gif"+frmHTML2); + frames[11].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/lr_corner.gif"+frmHTML2); } -//---------------------------------------------------------generate save string -function saveTree(depth_string,folder) { - for (var i=1; i