Annotation of loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm, revision 1.4

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.3       tyszkabe   11: package Apache::bookmarks;
1.1       tyszkabe   12: 
                     13: use strict;
                     14: use CGI qw(:all);
1.2       tyszkabe   15: use Apache::Constants qw(:common);
1.1       tyszkabe   16: use Apache::lonnet;
                     17: 
1.4     ! tyszkabe   18: # --------------------------------------------------------------Put bookmarks
1.1       tyszkabe   19: 
1.4     ! tyszkabe   20: sub write_bookmarks {
1.3       tyszkabe   21:     my $marks=shift;
1.4     ! tyszkabe   22:     Apache::lonnet::put("bookmarks",('bookmarks' => $marks));
1.2       tyszkabe   23:     return;
1.1       tyszkabe   24: }
                     25: 
1.4     ! tyszkabe   26: # --------------------------------------------------------------Get bookmarks
1.2       tyszkabe   27: 
1.4     ! tyszkabe   28: sub get_bookmarks {
        !            29:     my $bookmark=Apache::lonnet::get('bookmarks',('bookmarks'));
1.3       tyszkabe   30:     return $bookmark;
1.2       tyszkabe   31: }
                     32: 
1.4     ! tyszkabe   33: # ---------------------------------------------------Construct bookmark editor
1.2       tyszkabe   34: 
                     35: sub construct_editor {
                     36:     return(<<END_HTML) 
1.4     ! tyszkabe   37: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
        !            38: <html>
        !            39: <head>
        !            40: <title>
        !            41: Bookmark Tree Viewer/Editor  V3
        !            42: </title>
        !            43: 
        !            44: <script LANGUAGE="JavaScript">
        !            45: var addressCache = "";
        !            46: var dragCache = "";
        !            47: var lastDrug = "";
        !            48: var lastIcon = "";
        !            49: var image_num=0;
        !            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>
        !            77: <script src="/res/adm/pages/bookmarkmenu/bookmarklib.js" lanuage="JavaScript"></script>
        !            78: </head>
        !            79: <FRAMESET rows="25, *, 30, 25" topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 frameborder="0" border="0" framespacing="0" >
        !            80:  <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
        !            81:   <FRAME src="annotator_ul.html" marginwidth="0" marginheight="0" scrolling="no">
        !            82:   <FRAME src="annotator_uu.html" marginwidth="0" marginheight="0" scrolling="no">
        !            83:   <FRAME src="annotator_ur.html" marginwidth="0" marginheight="0" scrolling="no">
        !            84:  </FRAMESET>
        !            85:  <FRAMESET name="contentb" cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
        !            86:   <FRAME src="annotator_left.html" marginwidth="0" marginheight="0" scrolling="no">
        !            87:   <FRAME name="content" src="loading_bookmarks.html" marginwidth="0" marginheight="0" scrolling="auto">
        !            88:   <FRAME src="annotator_right.html" marginwidth="0" marginheight="0" scrolling="no">
        !            89:  </FRAMESET>
        !            90:  <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
        !            91:   <FRAME src="annotator_left.html" marginwidth="0" marginheight="0" scrolling="no">
        !            92:   <FRAME name="toolbar" src="annotator_toolbar.html" marginwidth="0" marginheight="0" scrolling="no">
        !            93:   <FRAME src="annotator_right.html" marginwidth="0" marginheight="0" scrolling="no">
        !            94:  </FRAMESET>
        !            95:  <FRAMESET cols="25, *, 25" frameborder="0" borders="0" framespacing="0">
        !            96:   <FRAME src="annotator_ll.html" marginwidth="0" marginheight="0" scrolling="no">
        !            97:   <FRAME src="annotator_bb.html" marginwidth="0" marginheight="0" scrolling="no">
        !            98:   <FRAME src="annotator_lr.html" marginwidth="0" marginheight="0" scrolling="no">
        !            99:  </FRAMESET>
        !           100: </FRAMESET>
        !           101: </html>
1.2       tyszkabe  102: END_HTML
1.1       tyszkabe  103: }
                    104: 
1.2       tyszkabe  105: # ----------------------------------------------------------------Main Handler
1.1       tyszkabe  106: 
                    107: sub handler {
                    108:     my $r=shift;
1.3       tyszkabe  109:     my $marks;
1.2       tyszkabe  110:     $r->content_type('text/html');
                    111:     $r->send_http_header;
1.3       tyszkabe  112:     if ($save_mark=param("save_mark")) {
1.4     ! tyszkabe  113:          write_bookmarks($save_mark);
1.3       tyszkabe  114: 	 $marks=$save_mark
1.1       tyszkabe  115:     }
1.4     ! tyszkabe  116: //    if (my $get_mark=param("get_mark")) {
1.3       tyszkabe  117:          unless ($get_mark eq $save_mark) {
1.4     ! tyszkabe  118:               $marks=get_bookmarks();
        !           119: //	 }
1.3       tyszkabe  120: 	 my $page = construct_editor($marks);
1.2       tyszkabe  121: 	 $r->print($page);
1.1       tyszkabe  122:     }
                    123:     return OK;
                    124: }
                    125: 
                    126: 1;
                    127: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>