Annotation of loncom/html/res/adm/pages/bookmarkmenu/annotator_toolbar.html, revision 1.1
1.1 ! tyszkabe 1: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
! 2: <html>
! 3: <head>
! 4: <script LANGUAGE="JavaScript">
! 5:
! 6: // This stuff is supplied by the perl mod. It contains all of the user defined bookmarks
! 7: // The builds the object of the users bookmarks.
! 8: function buildUserTree() {
! 9:
! 10: this.main = new addFolder("Stuff", 6);
! 11: this.main.p[1] = new addLink("MSU Engine3ering", "stuf3f.com");
! 12: this.main.p[2] = new addLink("MSU Engine2ering", "stuf2fcom");
! 13: this.main.p[3] = new addFolder("more crap", 5);
! 14: this.main.p[3].p[1] = new addLink("more of a test actually", "www.transam.com");
! 15: this.main.p[3].p[2] = new addLink("ALL CAPS PLEASE!", "www.bullwinkle.com");
! 16: this.main.p[3].p[3] = new addFolder("double nested", 2);
! 17: this.main.p[3].p[3].p[1] = new addLink("Test 12alphbravotango", "http://www.jealousy.com");
! 18: this.main.p[3].p[3].p[2] = new addFolder("empty folder", 1);
! 19: this.main.p[3].p[3].p[2].p[1] = new addLink("buried deeply", "http://www.cooldudze.com");
! 20: this.main.p[3].p[4] = new addLink("simon and Garfunkle", "www.inneptitude.com");
! 21: this.main.p[3].p[5] = new addLink("garbage in garbage out", "www.holy.com");
! 22: this.main.p[4] = new addLink("MSU Engin4eering", "st4uffcom");
! 23: this.main.p[5] = new addFolder("more x2", 3);
! 24: this.main.p[5].p[1] = new addLink("Whack a holy mole", "www.whackamole.com");
! 25: this.main.p[5].p[2] = new addLink("molly moldy mole", "http://www.molemolemole.com");
! 26: this.main.p[5].p[3] = new addLink("Thou art even more holy", "www.holymoly.com");
! 27: this.main.p[6] = new addLink("Google", "http://www.google.com/");
! 28: }
! 29:
! 30:
! 31: // Adds a link to an object.
! 32: function addLink(name, link) {
! 33: this.name = name;
! 34: this.link = link;
! 35: this.state = "link";
! 36: return this;
! 37: }
! 38:
! 39:
! 40: // Adds a folder to an object.
! 41: function addFolder(name, size) {
! 42: this.p = new Array(size);
! 43: this.name = name;
! 44: this.state = "opened";
! 45: return this;
! 46: }
! 47:
! 48:
! 49: // Swaps folder state from open to closed.
! 50: // There's probably a better way to do this.
! 51: function clickOnFolder(folder) {
! 52: if (folder.state == "closed") {
! 53: folder.state = "opened";
! 54: } else {
! 55: folder.state = "closed";
! 56: }
! 57: redrawTree(1, bookmarks.main.p);
! 58: }
! 59:
! 60:
! 61:
! 62: // Recursive function to generate the Tree HTML code
! 63: function drawTree(depth, folder) {
! 64: parent.frames[4].document.write("<TABLE border=0 cellspacing=0 cellpadding=0>");
! 65: for ( var i = 1; i < folder.length; i++) {
! 66: if ( i == folder.length - 1) {
! 67: var shape = "L";
! 68: } else {
! 69: var shape = "T";
! 70: }
! 71: if ( folder[i].state == "link") {
! 72: drawLink(depth, folder[i], shape);
! 73: } else {
! 74: drawFolder(depth, folder[i], shape);
! 75: if ( folder[i].state == "opened" && folder[i].p.length >= 0 ) {
! 76: drawTree( depth+1, folder[i].p);
! 77: }
! 78: }
! 79: }
! 80: parent.frames[4].document.write("</TABLE>");
! 81: }
! 82:
! 83:
! 84:
! 85: // Writes HTML code for individual folder.
! 86: function drawFolder(depth, folder, shape) {
! 87: parent.frames[4].document.write("<TR><TD valign = middle nowrap>");
! 88: while ( depth > 1 ) {
! 89: parent.frames[4].document.write("<IMG src='line_vertical.gif' width=15 height=25>");
! 90: depth--;
! 91: }
! 92: if (shape == "L") {
! 93: parent.frames[4].document.write("<IMG src='line_l_shape.gif' width=15 height=25>");
! 94: } else {
! 95: parent.frames[4].document.write("<IMG src='line_side_T.gif' width=15 height=25>");
! 96: }
! 97: parent.frames[4].document.write("<A href='javascript:clickOnFolder("+this.name+")'><IMG src='folder_"+folder.state+".gif' width=25 height=25 border=noborder>"+this.name.name+"</A>");
! 98: parent.frames[4].document.write("<TD valign=middle align=left nowrap><FONT size=-1 face='Arial, Helvetica'>"+folder.name+"</FONT>");
! 99: }
! 100:
! 101: // Writes HTML code for individual link
! 102: function drawLink(depth, folder, shape) {
! 103: parent.frames[4].document.write("<TR><TD valign = middle nowrap>");
! 104: while ( depth > 1 ) {
! 105: parent.frames[4].document.write("<IMG src='line_vertical.gif' width=15 height=25>");
! 106: depth--;
! 107: }
! 108: if (shape == "L") {
! 109: parent.frames[4].document.write("<IMG src='line_l_shape.gif' width=15 height=25>");
! 110: } else {
! 111: parent.frames[4].document.write("<IMG src='line_side_T.gif' width=15 height=25>");
! 112: }
! 113: parent.frames[4].document.write("<A href='javascript:parent.Exec('clickOnLink',"+folder.link+");'><IMG src='link.gif' width=25 height=25 border=noborder>"+folder.name+"</A>");
! 114: parent.frames[4].document.write("<TD valign=middle align=left nowrap><FONT size=-1 face='Arial, Helvetica'>"+folder.name+"</FONT>");
! 115: }
! 116:
! 117:
! 118: // function dragObject() {
! 119: // }
! 120:
! 121: // function clickOnBookmark() {
! 122: // }
! 123:
! 124: // function saveToLonCapa() {
! 125: // }
! 126:
! 127:
! 128: // Calls Build and draws functions. This function also takes
! 129: // care of housekeeping
! 130: function initializeTree() {
! 131: bookmarks = new buildUserTree();
! 132: drawTree(1, bookmarks.main.p);
! 133: }
! 134:
! 135: function redrawTree() {
! 136: parent.frames[4].document.clear();
! 137: drawTree(1, bookmarks.main.p);
! 138: }
! 139:
! 140:
! 141:
! 142: //var current_mode="preview"
! 143: //var available_mode="edit"
! 144: //var dumb_swap='change_this';
! 145:
! 146: //function swap_mode() {
! 147: // dumb_swap = available_mode;
! 148: // available_mode = current_mode;
! 149: // current_mode = dumb_swap;
! 150:
! 151: // update_button();
! 152: // update_content();
! 153:
! 154: //}
! 155:
! 156: //function update_button() {
! 157: // this.document['previewedit'].src = "button_" + available_mode + ".gif";
! 158: //}
! 159:
! 160: //function update_content() {
! 161: // parent.frames[4].location.href = "annotator_content_" + current_mode + ".html"
! 162: //}
! 163:
! 164: </script>
! 165: </head>
! 166:
! 167:
! 168: <body background="toolbar_bg.gif" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" onLoad="initializeTree();">
! 169:
! 170:
! 171:
! 172: <TABLE width="100%">
! 173:
! 174:
! 175: <!-- FOR THE TIME BEING
! 176: <A href="Javascript:SomeFunction()">
! 177: <IMG src="button_close.gif" align="right" border="0" width="50" height="25">
! 178: </A>
! 179: <IMG name="annotator_led" src="pages/ledoff.gif" align="right">
! 180: -->
! 181:
! 182: [<A href="Javascript:redrawTree(0, bookmarks.main.p)">
! 183: REFRESH
! 184: </A>]
! 185:
! 186:
! 187:
! 188:
! 189:
! 190: </table>
! 191: </body>
! 192: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>