" );
+ 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("|-tr-||-td-||-a href=JavaScript:"+objPath+".swapState();-|\n" );
+// write("|-img src=/res/adm/pages/bookmarkmenu/folder_pointer_closed.gif border=0-||-/a-|\n" );
+// write("|-a href='JavaScript:"+objPath+".folderClick();'" );
+// write(" onmouseover="+objPath+".folderHover("+image_num+");-|\n" );
+// write("|-img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+20*(depth)+" border=0-||-/a-|\n");
+// write("|-a href=JavaScript:"+objPath+".folderClick();-|\n" );
+// write("|-img src="+this.icon+" border=0-||-/a-|\n" );
+// write( this.name );
+// write("|-/td-||-/tr-|\n" );
+// }
+ }
}
+//-------------generate folder save string and recurse through contents
+function folderWriteSave(objPath,pos) {
+ saveStrng += objPath+".addFolder('"+this.name+"',"+this.opened+");\n";
+ var n=0; //-----alt. counter doesn't count non-exists links/marks
+// alert(saveStrng+" with a length: "+this.p.length); //DEBUG
+ for(var i=0;i=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;
+ frames[4].document.images[image_num].src="/res/adm/pages/bookmarkmenu/folder_drag.gif";
+ }
}
+//------------------------insert's cache into folder or picks up folder
+function folderClick() {
+ if (window.tree.cache.isLoaded) {
+ window.tree.cache.cacheEmpty(this,0);
+ // var location=this.p.length+1; // empties cache into folder
+ // this.p[location]=new newFolder('name');
+ // tree.cache.p[1].moveTo(this.p[location]);
+ // tree.cache.isLoaded = false;
+ } else {
+ window.tree.cache.cacheLoad(this);
+ }
+}
-//---------------------------delete link&folder from within other links&folders
-function remove() {
- this.exists = false;
+function linkClick(pstn) {
+ if (window.tree.cache.isLoaded) {
+ window.tree.cache.cacheEmpty(this,pstn)
+ } else {
+ window.tree.cache.cacheLoad(this.p[pstn]);
+ }
}
-//---------------------Function that deletes link from dragging it to the trash
-function clickTrash() {
- dragCache = "";
- redrawTree();
+
+//---------------------------------------------------------------------
+// Link object
+//---------------------------------------------------------------------
+// Pertains to a userdefined link. Refer to
+// bookmarkmenu_OOD.txt for further documentation.
+function newLink(name, url) {
+ // Link Properties
+ this.state = "link";
+ this.name = name;
+ this.url = url;
+ this.exists = true;
+ this.highlited = false;
+ this.icon = "/res/adm/pages/bookmarkmenu/link.gif";
+ // Link Methods
+ this.linkGoto = linkGoto;
+ this.linkEdit = linkEdit;
+ this.linkDraw = linkDraw;
+ this.linkWriteSave = linkWriteSave;
+ this.linkHover = linkHover;
+// this.linkClick = linkClick; --not a link method, now a folder method
+}
+
+function linkGoto() {
+ if (typeof(self.opener.clientwindow) != 'undefined') {
+ self.opener.clientwindow.location.href=this.url;
+ } else {
+ self.opener.location.href=this.url;
+ }
}
-//-----------------------------------------------------------------------------
-// These functions should be incorporated as methods
-// and the trash should be a folder. I'll work on that later.
-//-----------------------------------------------------------------------------
-function hoverTrash() {
-// if ( dragCache != "" ) {
-// parent.frames[6].document.images[0].src = lastIcon;
-// lastIcon = "folder_trash.gif";
-// }
-}
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------Add new link
-function newLink() {
- var clienthref=opener.clientwindow.location.pathname;
- var clienttitle=opener.opener.document.title;
- add_link=window.open('','Link','width=360,height=165,scrollbars=0');
- savedoc=add_link.document;
- var instr='New Link';
- instr+='';
- instr+='';
- savedoc.write(instr);
- savedoc.close();
+function linkEdit() {
+
}
-//--------------------------------------Add the just-named link at end of bookmarks
-function addNewLink(title,address) {
- nextPosition=bookmarkpal.bookmarks.p.length;
- bookmarkpal.bookmarks.p[nextPosition]=new addLink(title,address,"bookmarks",nextPosition);
- add_link.close();
- redrawTree();
-}
-
-//-----------------------Add the just-named link and then position within bookmarks
-function addNewLink_b(title,address) {
- dragCache="/res/adm/pages/bookmarkmenu/folder_opened.gif";
- lastIcon="/res/adm/pages/bookmarkmenu/folder_opened.gif";
- lastDrug="-1";
- addressCache=new addLink(title,address,"doesnotmatter",1);
- add_link.close();
-}
-
-//----------------------------------------------------------------Add new Folder
-function newFolder() {
- add_link=window.open('','Link','width=360,height=165,scrollbars=0');
- savedoc=add_link.document;
- var instr='New Folder';
- instr+='';
- instr+='';
- savedoc.write(instr);
- savedoc.close();
+//------------------------------------generate HTML for individual link
+function linkDraw(depth,objPath,pstn) {
+ var tmpObjPath = objPath+".p["+pstn+"]";
+ image_num+=2;
+ with (parent.frames[4].document) {
+ write("");
+ write("");
+ write("");
+ write("");
+ write("");
+ write(this.name+" |
" );
+ }
+// with (bendebugger.document) {
+// write("|-tr-||-td-||-a href='javaScript:"+objPath+".linkClick("+pstn+");'\n" );
+// write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'-|\n");
+// write("|-img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+(20*(depth)+15)+" border=0-||-/a-|\n");
+// write("|-a href='javaScript:"+objPath+".linkClick("+pstn+");'");
+// write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'-|\n");
+// write("|-img src=/res/adm/pages/bookmarkmenu/link.gif border=0-||-/a-|"); //this.icon replaced with link.gif
+// write("|-a href='javaScript:"+objPath+".p["+pstn+"].linkGoto();'" );
+// write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'-|\n");
+// write(this.name+"|-/td-||-/tr-|\n" );
+// } //debug
+}
+
+//---------------------------generate link information for saving links
+function linkWriteSave(objPath) {
+ saveStrng+= objPath+".addLink('"+this.name+"','"+this.url+"');\n";
+}
+
+//--------------------------swaps icons around when hovering link image
+function linkHover(img_num) {
+ if (window.tree.cache.isLoaded) {
+ 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;
+ frames[4].document.images[img_num].src="/res/adm/pages/bookmarkmenu/link_drag.gif";
+ }
}
-//----------------------Add the just-named folder at the end of the bookmarks list
-function addNewFolder(title) {
- nextPosition=bookmarkpal.bookmarks.p.length;
- nextAddress="bookmarks.p["+nextPosition+"]";
- bookmarkpal.bookmarks.p[nextPosition]=new addFolder(title,1,nextAddress);
- add_link.close();
- redrawTree();
+
+//---------------------------------------------------------------------
+// Cache object
+//---------------------------------------------------------------------
+// Contains everything related to dragging/dropping folers and links.
+// Refer to bookmarkmenu_OOD.txt for further documentation.
+function newCache() {
+ // Cache Properties
+ this.isLoaded = false;
+ this.state = "";
+ this.lastImg = -1; //I don't know if I can do this yet.
+ //It doesn't seem to cause errors.
+ this.Icon = "";
+ this.folder = new newFolder('cache',false);
+ // Cache Methods
+ this.cacheLoad = cacheLoad;
+ this.cacheEmpty = cacheEmpty;
+}
+
+//----------------------------------------------Load cache for dragging
+function cacheLoad(object1) {
+ if (object1.state=="folder") {
+//alert('cacheLoad11 '+object1.name+' is now: '+this.folder.name);
+ frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/folder_anim.gif';
+ object2=object1.moveTo(this.folder);
+ this.folder=object2;
+//alert('cacheLoad22 '+object1.name+' is now: '+this.folder.name);
+ } else {
+ frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/link_anim.gif';
+ this.folder = new newLink(object1.name,object1.url);
+ }
+ this.isLoaded = true;
+ object1.exists = false;
}
-//---------------------------------Add the just-named folder and then position it
-function addNewFolder_b(title) {
- dragCache="/res/adm/pages/bookmarkmenu/folder_opened.gif";
- lastIcon="/res/adm/pages/bookmarkmenu/folder_opened.gif";
- lastDrug="-1";
- addressCache=new addFolder("doesnotmatter",1,"doesnotmatter");
- addressCache.p[0]=new addFolder(title,1,"doesnotmatter");
- addressCache.p[0].exists=true; //this and line above are debug
- add_link.close();
+//---------------------------Places Cache's contents in front of a link
+function cacheEmpty(object1,position) {
+ object1.bump(position);
+ if (this.folder.state=="folder") {
+//alert('cacheEmpty11 is emptying named: '+this.folder.name+' to: '+object1.p[position].name);
+ object2=this.folder.moveTo(object1.p[position]);
+ object1.p[position]=object2;
+//alert('cacheEmpty22 is emptying named: '+this.folder.name+' to:'+object1.p[position].name);
+ } else {
+ object1.p[position] = new newLink(this.folder.name,this.folder.url);
+ }
+ frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/folder_static.gif';
+ this.isLoaded = false;
+ this.lastImg = -1; //I don't know if I can do this yet.
+ //It doesn't seem to cause errors
+ tree.redraw();
}
@@ -289,120 +525,112 @@ function addNewFolder_b(title) {
+//---------------------------------------------------------------------
+// Functions not associated with an object
+//---------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// The following are construction functions.
-//-----------------------------------------------------------------------------
-
-//--------------------------------------------------generate the Tree HTML code
-function drawTree(depth, folder) {
- for (var i=0; i=0) {
- drawTree(depth+1,folder[i].p);
- }
+function clickTrash() {
+ if (tree.cache.isLoaded) {
+ tree.cache.isLoaded = false;
+ tree.cache.lastImg = -1; // I don't know if this works yet
+ tree.redraw();
+ frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/folder_static.gif';
+ frames[7].document.images[1].src = '/res/adm/pages/bookmarkmenu/folder_trash.gif';
+ }
+}
+
+function hoverTrash() {
+ 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';
}
}
-//----------------------------------------Writes HTML code for individual folder
-function drawFolder(depth, folder) {
- parent.frames[4].document.write("");
- parent.frames[4].document.write("");
- image_num++;
- if ( depth != 1 ) {
- image_num++;
- parent.frames[4].document.write("");
- }
- parent.frames[4].document.write("");
- image_num++;
- parent.frames[4].document.write(" | "+folder.lname+" |
");
-}
-
-//--------------------------------------Writes HTML code for individual link
-function drawLink(depth, folder) {
- parent.frames[4].document.write("");
- image_num++;
- parent.frames[4].document.write("");
-
- parent.frames[4].document.write("");
- image_num++;
- parent.frames[4].document.write(" | "+folder.lname+" |
");
-}
-
-//--------------------Calls Build and draws functions. This function also takes
-// care of housekeeping
-function initializeTree() {
-// bookmarkpal = new buildUserTree();
- redrawTree();
-}
-
-//--------------------------------Redraws screen without initiallizing anything
-function redrawTree() {
- parent.frames[4].document.clear(); //---although depreciated, mozilla still needs it
- parent.frames[4].document.open();
- image_num=0;
- parent.frames[4].document.write("");
- drawTree(1,bookmarkpal.bookmarks.p); //----giving error: bookmarkpal not defined
- parent.frames[4].document.write("");
-}
-
-//-----------------------------------------------------------------------------
-// Saves bookmarks by building and then 'put'ing the string that generates the
-// bookmarks
-//-----------------------------------------------------------------------------
-
-//--------------recovers old bookmarks this is a debug function remove it later
-function recover() {
- parent.frames[7].document.saveBookmarks.hiddenbookmarks.value='recover';
- parent.frames[7].document.saveBookmarks.submit();
+
+//-----------------------------------------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);
}
-//----------------------------------------------------------starts save process
-function save() {
-// parent.frames[4].document.clear(); // debug
-// parent.frames[4].document.write("Debug: Beginning save process...
"); // debug
-// saveVar="this.bookmarks=new addFolder(\"Stuff\","+bookmarkpal.bookmarks.p.length+",\"bookmarks\");\n";
- saveVar=" ";
- saveTree("bookmarks",bookmarkpal.bookmarks.p);
-// parent.frames[4].document.write("writing variable...
"+saveVar+"...done
"); // debug
- parent.frames[7].document.saveBookmarks.hiddenbookmarks.value=saveVar;
- return true;
-}
+//----------------------------
+function queryNewLink() {
+ add_link=window.open('','Link','width=360,height=165');
+ clienthref="[ENTER ADDRESS HERE]";
+ clienttitle="[ENTER NAME HERE]";
+// this.onerror=ugh_oh; // this doesn't seem to work properly
+// clienthref=this.opener.clientwindow.window.location.pathname;
+// clienttitle=this.opener.clientwindow.title;
+ with(add_link.document) {
+ open();
+ clear();
+ write("" );
+ write("" );
+ close();
+ }
+}
-//---------------------------------------------------------generate save string
-function saveTree(depth_string,folder) {
- var n=0; // n renumbers links because
- for (var i=0; i=0) {
- saveTree(depth_string+".p["+n+"]",folder[i].p);
- }
- }
- n++;
- }
+//----------------------------
+function queryNewFolder() {
+ add_link=window.open('','Link','width=360,height=165');
+ with(add_link.document) {
+ open();
+ clear();
+ write("" );
+ write("" );
+ close();
}
}
+//---------------------------
+function addNewLink(title,address) {
+ tree.bookmarks.addLink(title,address);
+ add_link.close();
+ tree.redraw();
+ return true;
+}
-//-------------------------Writes javascript code for generating individual folder
-function saveFolder(depth_string, folder) {
- saveVar+="this."+depth_string+"=new addFolder(\""+folder.lname+"\","+folder.p.length+",\""+depth_string+"\");\n";
+//---------------------------
+function addNewFolder(title) {
+ tree.bookmarks.addFolder(title);
+ add_link.close();
+ tree.redraw();
+ return true;
}
-//-------------------------Writes javascript code for generating individual link
-function saveLink(depth_string,link,newpos) {
- saveVar+="this."+depth_string+".p["+newpos+"]=new addLink(\""+link.lname+"\",\""+link.link+"\",\""+depth_string+"\","+newpos+");\n";
-}