Annotation of loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm, revision 1.8
1.1 tyszkabe 1: #!/usr/bin/perl -T
2: #
1.2 tyszkabe 3: # This will take annotations and then plug them into a page.
1.1 tyszkabe 4: #
1.2 tyszkabe 5: # 08/25/00 Ben Tyszka
1.1 tyszkabe 6: #
7: #
1.2 tyszkabe 8: #
9: ##################
1.1 tyszkabe 10:
1.5 tyszkabe 11: package Apache::admbookmarks;
1.1 tyszkabe 12:
13: use strict;
1.2 tyszkabe 14: use Apache::Constants qw(:common);
1.8 ! tyszkabe 15: use Apache::lonnet();
1.1 tyszkabe 16:
1.4 tyszkabe 17: # --------------------------------------------------------------Put bookmarks
1.1 tyszkabe 18:
1.4 tyszkabe 19: sub write_bookmarks {
1.3 tyszkabe 20: my $marks=shift;
1.4 tyszkabe 21: Apache::lonnet::put("bookmarks",('bookmarks' => $marks));
1.2 tyszkabe 22: return;
1.1 tyszkabe 23: }
24:
1.4 tyszkabe 25: # --------------------------------------------------------------Get bookmarks
1.2 tyszkabe 26:
1.4 tyszkabe 27: sub get_bookmarks {
1.5 tyszkabe 28: my %bookmark=Apache::lonnet::get('bookmarks',('bookmarks'));
29: return %bookmark;
1.2 tyszkabe 30: }
31:
1.4 tyszkabe 32: # ---------------------------------------------------Construct bookmark editor
1.2 tyszkabe 33:
34: sub construct_editor {
35: return(<<END_HTML)
1.4 tyszkabe 36: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
37: <html>
38: <head>
39: <title>
1.8 ! tyszkabe 40: Bookmark Tree Viewer/Editor
1.4 tyszkabe 41: </title>
42:
43: <script LANGUAGE="JavaScript">
44: var addressCache = "";
45: var dragCache = "";
46: var lastDrug = "";
47: var lastIcon = "";
48: var image_num=0;
1.6 tyszkabe 49: var saveVar="";
1.4 tyszkabe 50:
51: function buildUserTree() {
52: this.dropCache = "";
53: this.dragCache = "";
54: //-------------------------------------------------------------------------------
55: // The following is data that is supplied by the Perl Module
56: //-------------------------------------------------------------------------------
57: this.bookmarks = new addFolder("Stuff", 6, "bookmarks");
58: this.bookmarks.p[1]=new addLink("MSU Engine3ering", "http://www.egr.msu.edu", "bookmarks", 1);
59: this.bookmarks.p[2]=new addLink("MSU Engine2ering", "http://www.egr.msu.edu/~tyszkabe", "bookmarks", 2);
60: this.bookmarks.p[3]=new addFolder("more crap", 5, "bookmarks.p[3]");
61: this.bookmarks.p[3].p[1]=new addLink("more of a test","http://www.transam.com","bookmarks.p[3]",1);
62: this.bookmarks.p[3].p[2]=new addLink("ALL CAPS PLEASE!","http://www.bullwinkle.com","bookmarks.p[3]",2);
63: this.bookmarks.p[3].p[3]=new addFolder("double nested", 2, "bookmarks.p[3].p[3]");
64: this.bookmarks.p[3].p[3].p[1]=new addLink("Test 12","http://www.jealousy.com","bookmarks.p[3].p[3]",1);
65: this.bookmarks.p[3].p[3].p[2]=new addFolder("empty folder",1,"bookmarks.p[3].p[3].p[2]");
66: this.bookmarks.p[3].p[3].p[2].p[1]=new addLink("bury","http://www.cool.com","bookmarks.p[3].p[3].p[2]",1);
67: this.bookmarks.p[3].p[4]=new addLink("simon and Garfunkle","www.inneptitude.com","bookmarks.p[3]",4);
68: this.bookmarks.p[3].p[5]=new addLink("garbage in garbage out","www.holy.com","bookmarks.p[3]",5);
69: this.bookmarks.p[4]=new addLink("MSU Engin4eering","st4uffcom","bookmarks",4);
70: this.bookmarks.p[5]=new addFolder("more x2",3,"bookmarks.p[5]");
71: this.bookmarks.p[5].p[1]=new addLink("Whack a holy mole","www.whackamole.com","bookmarks.p[5]",1);
72: this.bookmarks.p[5].p[2]=new addLink("molly moldy mole","http://www.molemolemole.com","bookmarks.p[5]",2);
73: this.bookmarks.p[5].p[3]=new addLink("Thou art even more holy","www.holymoly.com","bookmarks.p[5]",3);
74: this.bookmarks.p[6]=new addLink("Google","http://www.google.com/","bookmarks",6);
75: }
76: </script>
1.8 ! tyszkabe 77: <script src="/res/adm/pages/bookmarkmenu/bookmarklib.js" language="JavaScript"></script>
! 78: <script language="JavaScript">
! 79: bookmarkpal = new buildUserTree();
! 80: </script>
1.4 tyszkabe 81: </head>
1.6 tyszkabe 82: <FRAMESET rows="25, *, 40, 25" topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 frameborder="0" border="0" framespacing="0" >
1.4 tyszkabe 83: <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 84: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_ul.html" marginwidth="0" marginheight="0" scrolling="no">
85: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_uu.html" marginwidth="0" marginheight="0" scrolling="no">
86: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_ur.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 87: </FRAMESET>
88: <FRAMESET name="contentb" cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 89: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_left.html" marginwidth="0" marginheight="0" scrolling="no">
1.7 tyszkabe 90: <FRAME name="content" src="/res/adm/pages/bookmarkmenu/loading_bookmarks.html" marginwidth="0" marginheight="0" scrolling="yes">
1.5 tyszkabe 91: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_right.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 92: </FRAMESET>
93: <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 94: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_left.html" marginwidth="0" marginheight="0" scrolling="no">
95: <FRAME name="toolbar" src="/res/adm/pages/bookmarkmenu/bookmarkmenu_toolbar.html" marginwidth="0" marginheight="0" scrolling="no">
96: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_right.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 97: </FRAMESET>
98: <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 99: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_ll.html" marginwidth="0" marginheight="0" scrolling="no">
100: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_bb.html" marginwidth="0" marginheight="0" scrolling="no">
101: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_lr.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 102: </FRAMESET>
103: </FRAMESET>
104: </html>
1.2 tyszkabe 105: END_HTML
1.1 tyszkabe 106: }
107:
1.5 tyszkabe 108: # ---------------------------------------------------------------Construct Error window
109:
110: sub construct_error {
111: my $error_message=shift;
112: return(<<END_ERROR)
113: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
114: <html>
115: <head>
116: <title>
117: Bookmark Tree Viewer/Editor V3
118: </title>
119: </head>
120: <body bgcolor="#BBBBBB">
121: <table bgcolor="#FFFFFF" width="100%" height="90%" align="center">
122: <td>
123: <i>
124: $error_message
125: </i>
126: </td>
127: </table>
128: <center>
129: <form>
130: <input type=button name="close" value="close window" onClick="javascript:window.close();">
131: </form>
132: </center>
133: </body>
134: </html>
135: END_ERROR
136: }
137:
1.6 tyszkabe 138: # --------------------------------------------Construct toolbar (after saving)
139:
140: sub construct_toolbar {
141: return(<<END_TOOLBAR)
142: <html>
143: <body>
1.7 tyszkabe 144: <div align="bottom">
145: <center>
146: Bookmarks saved.
147: [ <a href="/res/adm/pages/bookmarkmenu/bookmarkmenu_toolbar.html" target="toolbar">Continue</a> ]
148: </center>
149: </div>
1.6 tyszkabe 150: </body>
151: </html>
152: END_TOOLBAR
153: }
154:
1.2 tyszkabe 155: # ----------------------------------------------------------------Main Handler
1.1 tyszkabe 156:
157: sub handler {
1.6 tyszkabe 158: my $r=shift;
159: my %marks;
160: my $save_mark;
161: my $page;
162: $r->content_type('text/html');
163: $r->send_http_header;
1.8 ! tyszkabe 164: if (exists($ENV{'form.hidden_bookmarks'})) {
! 165: write_bookmarks($ENV{'form.hidden_bookmarks'});
1.6 tyszkabe 166: $page=construct_toolbar();
167: } else {
1.5 tyszkabe 168: %marks=get_bookmarks();
169: if (exists($marks{"con_lost"})) {
170: $page = construct_editor($marks{"bookmarks"}); # Delete this line and uncomment next
171: # in order to re-enable connection detection
1.6 tyszkabe 172: # $page=construct_error("Connection broken with home server. Please contact your system administrator");
1.5 tyszkabe 173: } else {
174: $page = construct_editor($marks{"bookmarks"});
1.1 tyszkabe 175: }
1.6 tyszkabe 176: }
177: $r->print($page);
178: return OK;
1.1 tyszkabe 179: }
180:
181: 1;
182: __END__
1.8 ! tyszkabe 183:
! 184:
! 185:
! 186:
! 187:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>