Annotation of loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm, revision 1.9
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 {
1.9 ! tyszkabe 35: my $bookmarks=shift;
1.2 tyszkabe 36: return(<<END_HTML)
1.4 tyszkabe 37: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
38: <html>
39: <head>
40: <title>
1.8 tyszkabe 41: Bookmark Tree Viewer/Editor
1.4 tyszkabe 42: </title>
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: //-------------------------------------------------------------------------------
1.9 ! tyszkabe 55: // The FOLLOWING data is supplied by the Perl Module
! 56: //-------------------------------------------------------------------------------
! 57: $bookmarks
! 58: //-------------------------------------------------------------------------------
! 59: // The PRECEDING data is supplied by the Perl Module
1.4 tyszkabe 60: //-------------------------------------------------------------------------------
61: }
62: </script>
1.8 tyszkabe 63: <script src="/res/adm/pages/bookmarkmenu/bookmarklib.js" language="JavaScript"></script>
64: <script language="JavaScript">
65: bookmarkpal = new buildUserTree();
66: </script>
1.4 tyszkabe 67: </head>
1.6 tyszkabe 68: <FRAMESET rows="25, *, 40, 25" topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 frameborder="0" border="0" framespacing="0" >
1.4 tyszkabe 69: <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 70: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_ul.html" marginwidth="0" marginheight="0" scrolling="no">
71: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_uu.html" marginwidth="0" marginheight="0" scrolling="no">
72: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_ur.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 73: </FRAMESET>
74: <FRAMESET name="contentb" cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 75: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_left.html" marginwidth="0" marginheight="0" scrolling="no">
1.7 tyszkabe 76: <FRAME name="content" src="/res/adm/pages/bookmarkmenu/loading_bookmarks.html" marginwidth="0" marginheight="0" scrolling="yes">
1.5 tyszkabe 77: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_right.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 78: </FRAMESET>
79: <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 80: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_left.html" marginwidth="0" marginheight="0" scrolling="no">
81: <FRAME name="toolbar" src="/res/adm/pages/bookmarkmenu/bookmarkmenu_toolbar.html" marginwidth="0" marginheight="0" scrolling="no">
82: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_right.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 83: </FRAMESET>
84: <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
1.5 tyszkabe 85: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_ll.html" marginwidth="0" marginheight="0" scrolling="no">
86: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_bb.html" marginwidth="0" marginheight="0" scrolling="no">
87: <FRAME src="/res/adm/pages/bookmarkmenu/bookmarkmenu_lr.html" marginwidth="0" marginheight="0" scrolling="no">
1.4 tyszkabe 88: </FRAMESET>
89: </FRAMESET>
90: </html>
1.2 tyszkabe 91: END_HTML
1.1 tyszkabe 92: }
93:
1.5 tyszkabe 94: # ---------------------------------------------------------------Construct Error window
95:
96: sub construct_error {
97: my $error_message=shift;
98: return(<<END_ERROR)
99: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
100: <html>
101: <head>
102: <title>
103: Bookmark Tree Viewer/Editor V3
104: </title>
105: </head>
106: <body bgcolor="#BBBBBB">
107: <table bgcolor="#FFFFFF" width="100%" height="90%" align="center">
108: <td>
109: <i>
110: $error_message
111: </i>
112: </td>
113: </table>
114: <center>
115: <form>
116: <input type=button name="close" value="close window" onClick="javascript:window.close();">
117: </form>
118: </center>
119: </body>
120: </html>
121: END_ERROR
122: }
123:
1.6 tyszkabe 124: # --------------------------------------------Construct toolbar (after saving)
125:
126: sub construct_toolbar {
127: return(<<END_TOOLBAR)
128: <html>
129: <body>
1.7 tyszkabe 130: <div align="bottom">
131: <center>
132: Bookmarks saved.
133: [ <a href="/res/adm/pages/bookmarkmenu/bookmarkmenu_toolbar.html" target="toolbar">Continue</a> ]
134: </center>
135: </div>
1.6 tyszkabe 136: </body>
137: </html>
138: END_TOOLBAR
139: }
140:
1.2 tyszkabe 141: # ----------------------------------------------------------------Main Handler
1.1 tyszkabe 142:
143: sub handler {
1.6 tyszkabe 144: my $r=shift;
145: my %marks;
146: my $save_mark;
147: my $page;
148: $r->content_type('text/html');
149: $r->send_http_header;
1.9 ! tyszkabe 150: if (exists($ENV{'form.hiddenbookmarks'})) {
! 151: $marks{'bookmarks'}=$ENV{'form.hiddenbookmarks'};
! 152: write_bookmarks($marks{'bookmarks'});
! 153: if ($marks{'bookmarks'} eq 'recover') { #if statement is all debug stuff
! 154: my $recover=recovermarks();
! 155: $r->print("BOOKMARK RECOVERY");
! 156: write_bookmarks($recover);
! 157: }
! 158: $page=construct_toolbar();
1.6 tyszkabe 159: } else {
1.9 ! tyszkabe 160: %marks=get_bookmarks();
! 161: if (exists($marks{"con_lost"})) {
! 162: #$page = construct_editor($marks{'bookmarks'}); # Delete this line and uncomment next
! 163: # in order to re-enable connection detection
! 164: $page=construct_error("Connection broken with home server. Please contact your system administrator");
! 165: } else {
! 166: $page = construct_editor($marks{'bookmarks'});
! 167: }
1.6 tyszkabe 168: }
169: $r->print($page);
170: return OK;
1.1 tyszkabe 171: }
1.9 ! tyszkabe 172:
! 173: ####################################
! 174: #
! 175: # The following was used for debugging when the bookmarks get corrupted
! 176: # ben 10/12/2000
! 177: sub recovermarks {
! 178: return(<<END_MARKS);
! 179: this.bookmarks = new addFolder("Stuff", 6, "bookmarks");
! 180: this.bookmarks.p[0]=new addLink("MSU Engine3ering", "http://www.egr.msu.edu", "bookmarks", 0);
! 181: this.bookmarks.p[1]=new addLink("MSU Engine2ering", "http://www.egr.msu.edu/~tyszkabe", "bookmarks", 1);
! 182: this.bookmarks.p[2]=new addFolder("more crap", 5, "bookmarks.p[2]");
! 183: this.bookmarks.p[2].p[0]=new addLink("more of a test","http://www.transam.com","bookmarks.p[2]",0);
! 184: this.bookmarks.p[2].p[1]=new addLink("ALL CAPS PLEASE!","http://www.bullwinkle.com","bookmarks.p[2]",1);
! 185: this.bookmarks.p[2].p[2]=new addFolder("double nested", 2, "bookmarks.p[2].p[2]");
! 186: this.bookmarks.p[2].p[2].p[0]=new addLink("Test 12","http://www.jealousy.com","bookmarks.p[2].p[2]",0);
! 187: this.bookmarks.p[2].p[2].p[1]=new addFolder("empty folder",2,"bookmarks.p[2].p[2].p[1]");
! 188: this.bookmarks.p[2].p[2].p[1].p[0]=new addLink("bury","http://www.cool.com","bookmarks.p[2].p[2].p[1]",0);
! 189: this.bookmarks.p[2].p[3]=new addLink("simon and Garfunkle","www.inneptitude.com","bookmarks.p[2]",3);
! 190: this.bookmarks.p[2].p[4]=new addLink("garbage in garbage out","www.holy.com","bookmarks.p[2]",4);
! 191: this.bookmarks.p[3]=new addLink("MSU Engin4eering","st4uffcom","bookmarks",3);
! 192: this.bookmarks.p[4]=new addFolder("more x2",3,"bookmarks.p[4]");
! 193: this.bookmarks.p[4].p[0]=new addLink("Whack a holy mole","www.whackamole.com","bookmarks.p[4]",0);
! 194: this.bookmarks.p[4].p[1]=new addLink("molly moldy mole","http://www.molemolemole.com","bookmarks.p[4]",1);
! 195: this.bookmarks.p[4].p[2]=new addLink("Thou art even more holy","www.holymoly.com","bookmarks.p[4]",2);
! 196: this.bookmarks.p[5]=new addLink("Google","http://www.google.com/","bookmarks",5);
! 197: END_MARKS
! 198: }
! 199: #
! 200: #
! 201: ##########################################
1.1 tyszkabe 202:
203: 1;
204: __END__
1.8 tyszkabe 205:
206:
207:
208:
209:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>