Annotation of loncom/html/res/adm/pages/bookmarkmenu/bookmarklib.js, revision 1.17
1.1 tyszkabe 1: // bookmarklib.js
2: //
1.12 tyszkabe 3: // This is a rewritten version of bookmarklib.js
1.1 tyszkabe 4: //
1.12 tyszkabe 5: // Functions to be combined with the HTML code found in
6: // admbookmarks.pm. The combination will provide a complete
7: // functionality for the bookmarkmenu in accordance to defined
8: // requirements.
9: //
10: // For further information and documentation regarding this program,
11: // please refer to bookmarkmenu_OOD.txt, the design documentation for
12: // bookmarkmenu.
13: //
14: //
15: //
16: // The perl module admbookmarks.pm interacts with this library by
17: // generating a page that includes bookmarklib.js and a JavaScript
18: // function initializeTree() that builds the the tree using successive
19: // newLink() and newFolder() calls and one cache=new newCache() call.
20: // The entire newLink()/newFolder() succession is the string that is
21: // stored in the userspace on Lon-Capa as bookmarks.
22: //
23: //
24: // Created on: 12-28-2000 by Benjamin Tyszka
25: // Edited: 12-29-2000 by Benjamin Tyszka
26: // mm-dd-yyyy by Xxxxxxxx Xxxxxx
27:
28:
1.17 ! tyszkabe 29: clienttitle="";//debug
! 30: clienthref=""; //debug
1.12 tyszkabe 31:
32: //---------------------------------------------------------------------
33: // Tree object
34: //---------------------------------------------------------------------
35: // Basis for user's bookmarks and folders - All properties and methods
36: // pertaining to a user in general are found here. Refer to
37: // bookmarkmenu_OOD.txt for further documenation.
38: function newTree() {
39: this.redraw = redraw;
40: this.treeSave = treeSave;
41: this.bookmarks = new newFolder("bookmarks",true);
42: this.cache = new newCache();
43: }
44:
45: //------------------------------------------refresh folder/link display
46: function redraw() {
47: image_num = -1; // reset to before (-1 not 0) the first image
48: with(frames[4].document) {
49: open(); //--------for 'compliant' browsers
50: clear(); //----------for Mozilla (Netscape6)
51: write("<html>\n" );
52: write("<body bgcolor=dddddd text=000000 link=000000 " );
53: write("vlink=000000 topmargin=0 leftmargin=0 rightmargin=0 ");
54: write("marginheight=0 marginwidth=0>\n" );
55: write("<table border=0 cellspacing=0 cellpadding=0>\n" );
56: }
1.16 tyszkabe 57: // bendebugger=window.open('','HTML_DUMP','scrollbars'); //debug
58: // bendebugger.document.clear(); //debug
59: // bendebugger.document.write('TEXT DOCUMENT: NONE OF THE TAGS SHOULD WORK\n'); //debug
1.12 tyszkabe 60: var objPath="top.tree.bookmarks";
61: depth=0;
62: for(var i=0;i<this.bookmarks.p.length;i++) {
63: if (this.bookmarks.p[i].exists) {
64: if (this.bookmarks.p[i].state=="folder") {
65: var tmpObjPath=objPath+".p["+i+"]";
66: this.bookmarks.p[i].folderDraw(depth+1,tmpObjPath);
67: } else {
68: this.bookmarks.p[i].linkDraw(depth+1,objPath,i); // ----- Can't use
69: // tmpObjPath because of later 'bump'
70: }
71: }
72: }
73: // this.bookmarks.folderDraw(0,"top.tree.bookmarks");
74: top.frames[4].document.write("</table>\n</body>\n</html>");
75: top.frames[4].document.close();
1.16 tyszkabe 76: // bendebugger.document.close(); //debug
77: // return false; //debug
1.12 tyszkabe 78: }
79:
80: //-----------------generate 'save-string' and submit to admbookmarks.pm
81: function treeSave() {
82: saveStrng="";
83: var objPath="window.tree.bookmarks";
84: var n=0;
85: for(var i=0;i<this.bookmarks.p.length;i++) {
86: if (this.bookmarks.p[i].exists) {
87: if (this.bookmarks.p[i].state=="folder") {
88: this.bookmarks.p[i].folderWriteSave("window.tree.bookmarks",n);
89: } else {
90: this.bookmarks.p[i].linkWriteSave("window.tree.bookmarks");
91: }
92: n++;
93: }
94: }
1.15 tyszkabe 95:
1.12 tyszkabe 96: // this.bookmarks.folderWriteSave("window.tree.bookmarks",0);
97: // THE FOLLOWING IS DEBUG INFORMATION
1.15 tyszkabe 98: // bendebugger=window.open('','HTML_DUMP','scrollbars'); //debug
99: // bendebugger.document.clear(); //debug
100: // bendebugger.document.write("THE FOLLOWING STRING WILL BE POSTED TO THE PERL MOD:<br>\n"+saveStrng); //debug
101: // bendebugger.document.close();
1.12 tyszkabe 102: // END OF DEBUG STUFF
1.13 tyszkabe 103: // NOW SUBMIT THE STRING TO PERL MODULE -CHECK ADDRESS CHECK ADDRESS
1.14 tyszkabe 104: top.frames[7].document.saveBookmarks.hiddenbookmarks.value=saveStrng;
105: top.frames[7].document.saveBookmarks.submit;
1.12 tyszkabe 106: }
1.1 tyszkabe 107:
108:
1.12 tyszkabe 109: //---------------------------------------------------------------------
110: // Folder object
111: //---------------------------------------------------------------------
112: // Pertains to a userdefined folder. Refer to
113: // bookmarkmenu_OOD.txt for further documentation.
114: function newFolder(name,opened) {
115: // Folder Properties
116: this.state = "folder";
117: this.name = name;
118: this.opened = opened;
119: if (this.opened) {
1.13 tyszkabe 120: this.icon = "/res/adm/pages/bookmarkmenu/folder_open.gif";
1.12 tyszkabe 121: } else {
1.13 tyszkabe 122: this.icon = "/res/adm/pages/bookmarkmenu/folder_close.gif";
1.12 tyszkabe 123: }
124: this.exists = true;
125: this.highlited = false;
126: this.p = new Array(); // ---- ordered folder contents
127: // Folder Methods
128: this.addLink = addLink;
129: this.addFolder = addFolder;
130: this.insertLink = insertLink;
131: this.swapState = swapState;
132: this.moveTo = moveTo;
133: this.bump = bump;
134: this.folderEdit = folderEdit;
135: this.folderDraw = folderDraw;
136: this.folderWriteSave = folderWriteSave;
137: this.folderHover = folderHover;
138: this.folderClick = folderClick;
139: this.linkClick = linkClick;//--Folder method, because of 'bump'
140: }
141:
142: //------------------------------Add link to last position within folder
143: function addLink(name,url) {
144: // if (this.length!=0) {
145: var location=this.p.length;
146: // alert("THE ADD link:"+name+", location:"+location);
147: // }
148: this.p[location]=new newLink(name,url);
149: // var location=this.length+1;
150: // tree.treeRedraw(); //commented so that we can make tree. one more below
151: }
152:
153: //----------------------Add empty folder to last position within folder
154: function addFolder(name,opened) {
155: // if (this.length!=0) {
156: var location=this.p.length;
157: // alert("THE ADD FOLDER:"+name+", location:"+location);
158: // }
159: this.p[location]=new newFolder(name,opened);
160: // var location=this.length+1;
161: // tree.treeRedraw();
162: }
163:
164: //----------------------------------------Places folder within a folder
165: function insertLink(location,name,url) {
166: this.bump(location);
167: this.p[location]=new newLink(name,url);
168: tree.redraw();
1.1 tyszkabe 169: }
170:
1.12 tyszkabe 171: //----------------------------------Swap folder between open and closed
1.1 tyszkabe 172: function swapState() {
1.12 tyszkabe 173: this.opened=(!this.opened);
174: if (this.opened) {
1.13 tyszkabe 175: this.icon = "/res/adm/pages/bookmarkmenu/folder_open.gif";
1.12 tyszkabe 176: } else {
1.13 tyszkabe 177: this.icon = "/res/adm/pages/bookmarkmenu/folder_close.gif";
1.12 tyszkabe 178: }
179: top.tree.redraw();
1.1 tyszkabe 180: }
181:
1.12 tyszkabe 182: //-------------------recursive, Moves folder and contents to new object
183: // Don't forget to 'bump' before calling moveTo!
184: function moveTo(object1) {
185: //alert('moveto11: from '+this.name+' to: '+object1.name+' o1 exists?'+object1.exists);
186: object1=new newFolder(this.name,this.opened);
187: //alert('moveto22: from '+this.name+' to: '+object1.name+' o1 exists?'+object1.exists);
188: //object1.exists=this.exists;
189: for (var i=0;i<this.p.length;i++) {
190: // alert('moveTo i='+i);
191: if (this.p[i].exists) {
192: //alert('it exists at least!');
193: //alert('vitals, state:: '+this.p[i].state+'\n name: '+this.p[i].name+'\n exists: '+this.p[i].exists+'\n end of stuff');
194: if (this.p[i].state=="folder") {
195: //alert('it must have been a folder: '+this.p[i].state+'\n name: '+this.p[i].name+'\n exists: '+this.p[i].exists+'\n end of stuff');
196: object1.p[i]=this.p[i].moveTo(object1.p[i]);
197: } else {
198: //alert('was not a folder, was a '+this.p[i].state);
199: object1.p[i]=new newLink(this.p[i].name,this.p[i].url);
200: }
201: object1.p[i].exists=this.p[i].exists;
202: // } else {
203: // alert('NO EXISTANCE');
204: // object1.p[i].exists=false;
205: }
206: // object1.p[i].exists=this.p[i].exists;
207: }
208: return object1;
1.1 tyszkabe 209: }
210:
1.12 tyszkabe 211: //---------------------------------------bump all folder/links within a
212: // folder up one from 'location' up
213: function bump(location) {
214: //alert('bump: '+this.name+'--location: '+location);
215: for (var i=this.p.length-1;i>=location;i--) {
216: if (this.p[i].exists) { //saves time by not moving non-existing items
217: if (this.p[i].state=="folder") {
218: this.p[i+1]=this.p[i].moveTo(this.p[i+1]);
219: } else {
220: var name=this.p[i].name;
221: var url =this.p[i].url;
222: this.p[i+1]=new newLink(name,url);
223: this.p[i+1].exists=this.p[i].exists;
224: }
225: // this.p[i].exists=false; // may not be neccessary if I'm careful
226: } else {
227: if (i!=this.p.length-1) {
228: this.p[i+1].exists=false;
229: }
230: }
231: }
232: }
1.1 tyszkabe 233:
1.12 tyszkabe 234: function folderEdit() {
1.1 tyszkabe 235:
1.12 tyszkabe 236: }
1.1 tyszkabe 237:
1.12 tyszkabe 238: //------------------generates folder HTML and recurses through contents
239: function folderDraw(depth,objPath) {
240: image_num+=3;
241: if (this.opened) {
242: with (parent.frames[4].document) {
243: write("<tr><td><a href=JavaScript:"+objPath+".swapState();>" );
1.13 tyszkabe 244: write("<img src=/res/adm/pages/bookmarkmenu/folder_pointer_opened.gif border=0></a>" );
1.12 tyszkabe 245: write("<a href='JavaScript:"+objPath+".folderClick();'" );
246: write("onmouseover="+objPath+".folderHover("+image_num+");>" );
1.13 tyszkabe 247: write("<img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+20*(depth)+" border=0></a>");
1.12 tyszkabe 248: write("<a href='javaScript:"+objPath+".folderClick();'" );
249: write("onmouseover='"+objPath+".folderHover("+image_num+");'>" );
250: write("<img src="+this.icon+" border=0></a>" );
251: write( this.name+"</td></tr>" );
252: }
1.16 tyszkabe 253: // with (bendebugger.document) {
254: // write("<p>|-tr-||-td-||-a href=JavaScript:"+objPath+".swapState();-|\n" );
255: // write("|-img src=/res/adm/pages/bookmarkmenu/folder_pointer_opened.gif border=0-||-/a-|\n" );
256: // write("|-a href='JavaScript:"+objPath+".folderClick();'\n" );
257: // write("onmouseover="+objPath+".folderHover("+image_num+");-|\n" );
258: // write("|-img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+20*(depth)+" border=0-||-/a-|\n");
259: // write("|-a href='javaScript:"+objPath+".folderClick();'" );
260: // write("onmouseover='"+objPath+".folderHover("+image_num+");'-|\n" );
261: // write("|-img src="+this.icon+" border=0-||-/a-|\n" );
262: // write( this.name );
263: // write("|-/td-||-/tr-|\n" );
264: // } //whole thing is a debug
1.12 tyszkabe 265: for(var i=0;i<this.p.length;i++) {
266: if (this.p[i].exists) { // PROGRAM DIED HERE ONCE
267: if (this.p[i].state=="folder") {
268: var tmpObjPath=objPath+".p["+i+"]";
269: this.p[i].folderDraw(depth+1,tmpObjPath);
270: } else {
271: this.p[i].linkDraw(depth+1,objPath,i); // ----- Can't use
272: // tmpObjPath because of later 'bump'
273: }
274: }
275: }
276: } else {
277: with (parent.frames[4].document) {
278: write("<tr><td><a href=JavaScript:"+objPath+".swapState();>" );
1.13 tyszkabe 279: write("<img src=/res/adm/pages/bookmarkmenu/folder_pointer_closed.gif border=0></a>" );
1.12 tyszkabe 280: write("<a href='JavaScript:"+objPath+".folderClick();'" );
281: write(" onmouseover="+objPath+".folderHover("+image_num+");>" );
1.13 tyszkabe 282: write("<img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+20*(depth)+" border=0></a>");
1.12 tyszkabe 283: write("<a href=JavaScript:"+objPath+".folderClick();>" );
284: write("<img src="+this.icon+" border=0></a>" );
285: write( this.name+"</td></tr>" );
286: }
1.16 tyszkabe 287: // with (bendebugger.document) {
288: // write("<p>|-tr-||-td-||-a href=JavaScript:"+objPath+".swapState();-|\n" );
289: // write("|-img src=/res/adm/pages/bookmarkmenu/folder_pointer_closed.gif border=0-||-/a-|\n" );
290: // write("|-a href='JavaScript:"+objPath+".folderClick();'" );
291: // write(" onmouseover="+objPath+".folderHover("+image_num+");-|\n" );
292: // write("|-img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+20*(depth)+" border=0-||-/a-|\n");
293: // write("|-a href=JavaScript:"+objPath+".folderClick();-|\n" );
294: // write("|-img src="+this.icon+" border=0-||-/a-|\n" );
295: // write( this.name );
296: // write("|-/td-||-/tr-|\n" );
297: // }
1.12 tyszkabe 298: }
299: }
1.1 tyszkabe 300:
1.12 tyszkabe 301: //-------------generate folder save string and recurse through contents
302: function folderWriteSave(objPath,pos) {
303: saveStrng += objPath+".addFolder('"+this.name+"',"+this.opened+");\n";
304: var n=0; //-----alt. counter doesn't count non-exists links/marks
305: // alert(saveStrng+" with a length: "+this.p.length); //DEBUG
306: for(var i=0;i<this.p.length;i++) {
307: if (this.p[i].exists) {
308: // alert("something exists"); //DEBUG
309: var tmpObjPath=objPath+".p["+pos+"]";
310: if (this.p[i].state=="folder") {
311: this.p[i].folderWriteSave(tmpObjPath,n);
312: } else {
313: this.p[i].linkWriteSave(tmpObjPath);
314: }
315: n++;
316: }
317: }
318: }
1.1 tyszkabe 319:
1.12 tyszkabe 320: //------------------------swaps icons around when hovering folder image
321: function folderHover(image_num) {
322: if (window.tree.cache.isLoaded) {
323: if (window.tree.cache.lastImg==-2) {
1.13 tyszkabe 324: frames[7].document.images[1].src='/res/adm/pages/bookmarkmenu/folder_trash.gif';
1.12 tyszkabe 325: } else {
326: frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon;
1.1 tyszkabe 327: }
1.12 tyszkabe 328: window.tree.cache.lastImg=image_num;
329: window.tree.cache.icon=this.icon;
1.13 tyszkabe 330: frames[4].document.images[image_num].src="/res/adm/pages/bookmarkmenu/folder_drag.gif";
1.12 tyszkabe 331: }
1.1 tyszkabe 332: }
333:
1.12 tyszkabe 334: //------------------------insert's cache into folder or picks up folder
335: function folderClick() {
336: if (window.tree.cache.isLoaded) {
337: window.tree.cache.cacheEmpty(this,0);
338: // var location=this.p.length+1; // empties cache into folder
339: // this.p[location]=new newFolder('name');
340: // tree.cache.p[1].moveTo(this.p[location]);
341: // tree.cache.isLoaded = false;
342: } else {
343: window.tree.cache.cacheLoad(this);
344: }
345: }
1.1 tyszkabe 346:
1.12 tyszkabe 347: function linkClick(pstn) {
348: if (window.tree.cache.isLoaded) {
349: window.tree.cache.cacheEmpty(this,pstn)
350: } else {
351: window.tree.cache.cacheLoad(this.p[pstn]);
352: }
1.1 tyszkabe 353: }
354:
355:
1.12 tyszkabe 356: //---------------------------------------------------------------------
357: // Link object
358: //---------------------------------------------------------------------
359: // Pertains to a userdefined link. Refer to
360: // bookmarkmenu_OOD.txt for further documentation.
361: function newLink(name, url) {
362: // Link Properties
363: this.state = "link";
364: this.name = name;
365: this.url = url;
366: this.exists = true;
367: this.highlited = false;
1.13 tyszkabe 368: this.icon = "/res/adm/pages/bookmarkmenu/link.gif";
1.12 tyszkabe 369: // Link Methods
370: this.linkGoto = linkGoto;
371: this.linkEdit = linkEdit;
372: this.linkDraw = linkDraw;
373: this.linkWriteSave = linkWriteSave;
374: this.linkHover = linkHover;
375: // this.linkClick = linkClick; --not a link method, now a folder method
376: }
377:
378: function linkGoto() {
1.17 ! tyszkabe 379: self.opener.clientwindow.location.href=this.url;
1.12 tyszkabe 380: }
381:
382: function linkEdit() {
1.1 tyszkabe 383:
384: }
385:
1.12 tyszkabe 386: //------------------------------------generate HTML for individual link
387: function linkDraw(depth,objPath,pstn) {
388: var tmpObjPath = objPath+".p["+pstn+"]";
389: image_num+=2;
390: with (parent.frames[4].document) {
391: write("<tr><td><a href='javaScript:"+objPath+".linkClick("+pstn+");'" );
392: write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'>");
1.13 tyszkabe 393: write("<img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+(20*(depth)+15)+" border=0></a>");
1.12 tyszkabe 394: write("<a href='javaScript:"+objPath+".linkClick("+pstn+");'");
395: write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'>");
1.17 ! tyszkabe 396: write("<img src=/res/adm/pages/bookmarkmenu/link.gif border=0></a>");
1.12 tyszkabe 397: write("<a href='javaScript:"+objPath+".p["+pstn+"].linkGoto();'" );
398: write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'>");
399: write(this.name+"</td></tr>" );
400: }
1.16 tyszkabe 401: // with (bendebugger.document) {
402: // write("<P>|-tr-||-td-||-a href='javaScript:"+objPath+".linkClick("+pstn+");'\n" );
403: // write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'-|\n");
404: // write("|-img src=/res/adm/pages/bookmarkmenu/pix.gif height=25 width="+(20*(depth)+15)+" border=0-||-/a-|\n");
405: // write("|-a href='javaScript:"+objPath+".linkClick("+pstn+");'");
406: // write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'-|\n");
407: // write("|-img src=/res/adm/pages/bookmarkmenu/link.gif border=0-||-/a-|"); //this.icon replaced with link.gif
408: // write("|-a href='javaScript:"+objPath+".p["+pstn+"].linkGoto();'" );
409: // write(" onmouseover='"+objPath+".p["+pstn+"].linkHover("+image_num+");'-|\n");
410: // write(this.name+"|-/td-||-/tr-|\n" );
411: // } //debug
1.12 tyszkabe 412: }
413:
414: //---------------------------generate link information for saving links
415: function linkWriteSave(objPath) {
416: saveStrng+= objPath+".addLink('"+this.name+"','"+this.url+"');\n";
417: }
418:
419: //--------------------------swaps icons around when hovering link image
420: function linkHover(img_num) {
421: if (window.tree.cache.isLoaded) {
422: if (window.tree.cache.lastImg==-2) {
1.13 tyszkabe 423: frames[7].document.images[1].src='/res/adm/pages/bookmarkmenu/folder_trash.gif';
1.12 tyszkabe 424: } else {
425: frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon;
426: }
427: window.tree.cache.lastImg=img_num;
428: window.tree.cache.icon=this.icon;
1.13 tyszkabe 429: frames[4].document.images[img_num].src="/res/adm/pages/bookmarkmenu/link_drag.gif";
1.12 tyszkabe 430: }
1.8 tyszkabe 431: }
432:
1.1 tyszkabe 433:
1.12 tyszkabe 434: //---------------------------------------------------------------------
435: // Cache object
436: //---------------------------------------------------------------------
437: // Contains everything related to dragging/dropping folers and links.
438: // Refer to bookmarkmenu_OOD.txt for further documentation.
439: function newCache() {
440: // Cache Properties
441: this.isLoaded = false;
442: this.state = "";
443: this.lastImg = -1; //I don't know if I can do this yet.
444: //It doesn't seem to cause errors.
445: this.Icon = "";
446: this.folder = new newFolder('cache',false);
447: // Cache Methods
448: this.cacheLoad = cacheLoad;
449: this.cacheEmpty = cacheEmpty;
450: }
451:
452: //----------------------------------------------Load cache for dragging
453: function cacheLoad(object1) {
454: if (object1.state=="folder") {
455: //alert('cacheLoad11 '+object1.name+' is now: '+this.folder.name);
1.13 tyszkabe 456: frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/folder_anim.gif';
1.12 tyszkabe 457: object2=object1.moveTo(this.folder);
458: this.folder=object2;
459: //alert('cacheLoad22 '+object1.name+' is now: '+this.folder.name);
460: } else {
1.13 tyszkabe 461: frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/link_anim.gif';
1.12 tyszkabe 462: this.folder = new newLink(object1.name,object1.url);
463: }
464: this.isLoaded = true;
465: object1.exists = false;
1.10 tyszkabe 466: }
467:
1.12 tyszkabe 468: //---------------------------Places Cache's contents in front of a link
469: function cacheEmpty(object1,position) {
470: object1.bump(position);
471: if (this.folder.state=="folder") {
472: //alert('cacheEmpty11 is emptying named: '+this.folder.name+' to: '+object1.p[position].name);
473: object2=this.folder.moveTo(object1.p[position]);
474: object1.p[position]=object2;
475: //alert('cacheEmpty22 is emptying named: '+this.folder.name+' to:'+object1.p[position].name);
476: } else {
477: object1.p[position] = new newLink(this.folder.name,this.folder.url);
478: }
1.13 tyszkabe 479: frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/folder_static.gif';
1.12 tyszkabe 480: this.isLoaded = false;
481: this.lastImg = -1; //I don't know if I can do this yet.
482: //It doesn't seem to cause errors
483: tree.redraw();
1.8 tyszkabe 484: }
485:
486:
487:
488:
489:
490:
1.12 tyszkabe 491: //---------------------------------------------------------------------
492: // Functions not associated with an object
493: //---------------------------------------------------------------------
1.8 tyszkabe 494:
1.12 tyszkabe 495: function clickTrash() {
496: if (tree.cache.isLoaded) {
497: tree.cache.isLoaded = false;
498: tree.cache.lastImg = -1; // I don't know if this works yet
499: tree.redraw();
1.13 tyszkabe 500: frames[7].document.images[0].src = '/res/adm/pages/bookmarkmenu/folder_static.gif';
501: frames[7].document.images[1].src = '/res/adm/pages/bookmarkmenu/folder_trash.gif';
1.1 tyszkabe 502: }
503: }
504:
1.12 tyszkabe 505: function hoverTrash() {
506: if (window.tree.cache.isLoaded) {
507: frames[4].document.images[window.tree.cache.lastImg].src=window.tree.cache.icon;
508: window.tree.cache.lastImg=-2;
1.13 tyszkabe 509: window.tree.cache.icon='/res/adm/pages/bookmarkmenu/folder_trash.gif';
510: frames[7].document.images[1].src = '/res/adm/pages/bookmarkmenu/folder_trash_hover.gif';
1.12 tyszkabe 511: }
1.8 tyszkabe 512: }
513:
514:
1.12 tyszkabe 515: //-----------------------------------------Generates HTML in each frame
516: function buildBookmarkMenu() {
517: var frmHTML1 = "<html>\n<body background=";
518: var frmHTML2 = ">\n</body>\n</html>";
1.13 tyszkabe 519: frames[0].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/ul_corner.gif"+frmHTML2 );
520: frames[1].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/upper_bar.gif"+frmHTML2 );
521: frames[2].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/ur_corner.gif"+frmHTML2 );
522: frames[3].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/left_bar.gif"+frmHTML2 );
523: frames[5].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/right_bar.gif"+frmHTML2 );
524: frames[6].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/left_bar.gif"+frmHTML2 );
525: frames[8].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/right_bar.gif"+frmHTML2 );
526: frames[9].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/ll_corner.gif"+frmHTML2 );
527: frames[10].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/lower_bar.gif"+frmHTML2);
528: frames[11].document.write(frmHTML1+"/res/adm/pages/bookmarkmenu/lr_corner.gif"+frmHTML2);
1.2 tyszkabe 529: }
530:
531:
1.12 tyszkabe 532:
533: //----------------------------
534: function queryNewLink() {
535: add_link=window.open('','Link','width=360,height=165');
1.17 ! tyszkabe 536: clienthref=this.opener.clientwindow.window.location.pathname;
! 537: clienttitle=this.opener.clientwindow.title;
1.12 tyszkabe 538: with(add_link.document) {
539: open();
540: clear();
541: write("<html><body bgcolor='#bbbbbb'><center>" );
542: write("<form method='post' name='newLink' onSubmit='javascript:opener.addNewLink(newLink.title.value,newLink.address.value);'>\n");
543: write("<table width=340 height=150 bgcolor='#ffffff' " );
544: write("align=center><tr><td>Link Name:<br>" );
545: write("<input type='text' name='title' size=45" );
546: write("value='"+clienttitle+"'><br>Address:<br>" );
547: write("<input type='text' name='address' size='45' " );
548: write("value='"+clienthref+"'>");
549: write("<br><center><input type='submit' value='Save'> " );
550: write("<input type='button' value='Close (no save)' " );
551: write("onclick='javascript:window.close();'></center></td>" );
552: write("</tr></table></form></center></body></html>" );
553: close();
554: }
555: }
556:
557: //----------------------------
558: function queryNewFolder() {
559: add_link=window.open('','Link','width=360,height=165');
560: with(add_link.document) {
561: open();
562: clear();
563: write("<html><body bgcolor='#bbbbbb'><center>" );
564: write("<form method='post' name='newLink' onSubmit='javascript:opener.addNewFolder(newLink.title.value);'>\n");
565: write("<table width=340 height=150 bgcolor='#ffffff' " );
566: write("align=center><tr><td>Folder Name:<br>" );
567: write("<input type='text' name='title' size=45 value=''>" );
568: write("<br><center><input type='submit' value='Save'>" );
569: write("<input type='button' value='Cancel' " );
570: write("onclick='javascript:window.close();'></center></td>" );
571: write("</tr></table></form></center></body></html>" );
572: close();
1.2 tyszkabe 573: }
1.1 tyszkabe 574: }
1.2 tyszkabe 575:
1.12 tyszkabe 576: //---------------------------
577: function addNewLink(title,address) {
578: tree.bookmarks.addLink(title,address);
579: add_link.close();
580: tree.redraw();
581: return true;
582: }
1.2 tyszkabe 583:
1.12 tyszkabe 584: //---------------------------
585: function addNewFolder(title) {
586: tree.bookmarks.addFolder(title);
587: add_link.close();
588: tree.redraw();
589: return true;
1.2 tyszkabe 590: }
591:
592:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>