Annotation of rat/lonratmenu.pm, revision 1.15

1.1       raeburn     1: # The LearningOnline Network with CAPA
                      2: # Build menu bar for Advanced RAT. Uses javascript code originally in
                      3: # static file: rat/client/code.html, now in  rat/client/ratcode.js  
                      4: #
1.15    ! bisitz      5: # $Id: lonratmenu.pm,v 1.14 2009/06/09 15:01:28 bisitz Exp $
1.10      raeburn     6: #
1.1       raeburn     7: # Copyright Michigan State University Board of Trustees
                      8: #
                      9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                     10: #
                     11: # LON-CAPA is free software; you can redistribute it and/or modify
                     12: # it under the terms of the GNU General Public License as published by
                     13: # the Free Software Foundation; either version 2 of the License, or
                     14: # (at your option) any later version.
                     15: #
                     16: # LON-CAPA is distributed in the hope that it will be useful,
                     17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     19: # GNU General Public License for more details.
                     20: #
                     21: # You should have received a copy of the GNU General Public License
                     22: # along with LON-CAPA; if not, write to the Free Software
                     23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     24: #
                     25: # /home/httpd/html/adm/gpl.txt
                     26: #
                     27: # http://www.lon-capa.org/
                     28: #
                     29: package Apache::lonratmenu;
                     30: 
                     31: use strict;
                     32: use Apache::Constants qw(:common);
                     33: use Apache::File;
                     34: use Apache::loncommon;
1.15    ! bisitz     35: use Apache::lonhtmlcommon;
        !            36: use Apache::lonlocal;
1.1       raeburn    37: use Apache::lonnet;
                     38: 
                     39: sub handler {
                     40:     my $r = shift;
                     41:     my $include = $Apache::lonnet::perlvar{'lonIncludes'};
                     42:     my $jsh=Apache::File->new($include."/ratcode.js");
1.4       albertel   43:     my $js = join('',<$jsh>);
1.5       albertel   44:     my %loaditem = ('onunload' => "leave();",);
1.15    ! bisitz     45: 
1.3       www        46:     my $readfile=$r->uri;
                     47:     $readfile=~s/\/loadonly\/adveditmenu$//;
1.15    ! bisitz     48: 
        !            49:     # Breadcrumbs
        !            50:     my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
        !            51:                    'text' => 'Construction Space'},
        !            52:                   {'href' => '',
        !            53:                    'text' => 'RAT'},
        !            54:                   {'href' => '',
        !            55:                    'text' => 'Advanced Editor'}];
        !            56: 
        !            57:     my $help=&Apache::loncommon::help_open_menu(
        !            58:         'Sequence_Advanced_Editor_Creation',
        !            59:         'Sequence_Advanced_Editor_Creation',6,'RAT');
        !            60: 
        !            61: 
        !            62:     # Compile available Advanced RAT functions
        !            63:     my $functions = '<div class="LC_columnSection">';
        !            64: 
        !            65:     $functions .= $help; # FIXME: Move help to bread_crumbs_component
        !            66: 
        !            67:     $functions .=
        !            68:        &Apache::lonhtmlcommon::start_funclist(&mt('Display Actions'))
        !            69:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            70:            '<a href="javascript:togglemode();">'
        !            71:           .&mt('Toggle display').'</a>')
        !            72:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            73:            '<a href="javascript:if (zscale>1) { zscale--; draw();}">'
        !            74:           .&mt('Zoom out').'</a>')
        !            75:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            76:            '<a href="javascript:if (zscale<3) { zscale++; draw();}">'
        !            77:           .&mt('Zoom in').'</a>')
        !            78:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            79:            '<a href="javascript:condense();draw();">'
        !            80:           .&mt('Condense').'</a>')
        !            81:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            82:            '<a href="javascript:graphopt();draw();">'
        !            83:           .&mt('Straighten').'</a>')
        !            84:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            85:            '<a href="javascript:revert();">'
        !            86:           .&mt('Revert').'</a>')
        !            87:       .&Apache::lonhtmlcommon::end_funclist();
        !            88: 
        !            89:     $functions .=
        !            90:        &Apache::lonhtmlcommon::start_funclist(&mt('Version Actions'))
        !            91:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            92:            '<a href="javascript:undo();">'
        !            93:           .&mt('Undo').'</a>')
        !            94:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            95:            '<a href="javascript:redo();">'
        !            96:           .&mt('Redo').'</a>')
        !            97:       .&Apache::lonhtmlcommon::add_item_funclist(
        !            98:            '<a href="javascript:groupopen(\''.$readfile.'\');">'
        !            99:           .&mt('Recover deleted').'</a>')
        !           100:       .&Apache::lonhtmlcommon::end_funclist();
        !           101: 
        !           102:     $functions .=
        !           103:        &Apache::lonhtmlcommon::start_funclist(&mt('Import'))
        !           104:       .&Apache::lonhtmlcommon::add_item_funclist(
        !           105:            '<a href="javascript:groupsearch();">'
        !           106:           .&mt('Search').'</a>')
        !           107:       .&Apache::lonhtmlcommon::add_item_funclist(
        !           108:            '<a href="javascript:groupimport();">'
        !           109:           .&mt('Import').'</a>')
        !           110:       .&Apache::lonhtmlcommon::add_item_funclist(
        !           111:            '<a href="javascript:bookmarkopen();">'
        !           112:           .&mt('Import Bookmarks').'</a>')
        !           113:       .&Apache::lonhtmlcommon::add_item_funclist(
        !           114:            '<a href="javascript:groupcopy();">'
        !           115:           .&mt('Copy').'</a>')
        !           116:       .&Apache::lonhtmlcommon::end_funclist();
        !           117: 
        !           118:     $functions .=
        !           119:        &Apache::lonhtmlcommon::start_funclist(&mt('Save'))
        !           120:       .&Apache::lonhtmlcommon::add_item_funclist(
        !           121:            '<a href="javascript:graphdef=\'no\';save();storechange();">'
        !           122:           .&mt('Save map').'</a>')
        !           123:       .&Apache::lonhtmlcommon::add_item_funclist(
        !           124:            '<a href="javascript:storechange();">'
        !           125:           .&mt('Save map and layout').'</a>')
        !           126:       .&Apache::lonhtmlcommon::end_funclist();
        !           127: 
        !           128:     $functions .= '</div>'; # End: LC_columnSection
        !           129: 
        !           130:     $functions .= &Apache::lonhtmlcommon::scripttag('main();');
        !           131: 
        !           132: 
        !           133:     # Print Advanced RAT page header
        !           134:     $r->send_http_header('text/html');
        !           135: 
        !           136:     $r->print(
        !           137:         &Apache::loncommon::start_page(
        !           138:             'Advanced Editor',
        !           139:             $js,
        !           140:             {'add_entries' => \%loaditem,
        !           141:              'bread_crumbs' => $brcrum,})
        !           142: 
        !           143:        .&Apache::loncommon::head_subbox(
        !           144:             &Apache::loncommon::CSTR_pageheader()
        !           145:            .$functions)
        !           146: 
        !           147:        .&Apache::loncommon::end_page()
        !           148:     );
        !           149: 
1.1       raeburn   150:     return OK;
                    151: }
                    152: 
                    153: 1;
                    154: 

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