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