File:  [LON-CAPA] / rat / lonratmenu.pm
Revision 1.21: download - view: text, annotated - select for diffs
Fri Feb 5 17:46:08 2016 UTC (8 years, 2 months ago) by damieng
Branches: MAIN
CVS tags: HEAD
bug fix: target _top was missing in the breadcrumbs for the Authoring Space link

    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: #
    5: # $Id: lonratmenu.pm,v 1.21 2016/02/05 17:46:08 damieng Exp $
    6: #
    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;
   35: use Apache::lonhtmlcommon;
   36: use Apache::lonlocal;
   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");
   43:     my $js = join('',<$jsh>);
   44:     my %loaditem = ('onunload' => "leave();",);
   45: 
   46:     my $readfile=$r->uri;
   47:     $readfile=~s/\/loadonly\/adveditmenu$//;
   48: 
   49:     # Breadcrumbs
   50:     my $brcrum = [{'href' => &Apache::loncommon::authorspace($r->uri),
   51:                    'text' => 'Authoring Space',
   52:                    'target' => '_top'},
   53:                   {'href' => '',
   54:                    'text' => 'RAT'},
   55:                   {'href' => '',
   56:                    'text' => 'Advanced Editor'}];
   57: 
   58:     my $help=&Apache::loncommon::help_open_menu(
   59:         'Sequence_Advanced_Editor_Creation',
   60:         'Sequence_Advanced_Editor_Creation',6,'RAT');
   61: 
   62: 
   63:     # Compile available Advanced RAT functions
   64:     my $functions = '<div class="LC_columnSection">';
   65: 
   66:     $functions .= $help; # FIXME: Move help to bread_crumbs_component
   67: 
   68:     $functions .=
   69:        &Apache::lonhtmlcommon::start_funclist(&mt('Display Actions'))
   70:       .&Apache::lonhtmlcommon::add_item_funclist(
   71:            '<a href="javascript:togglemode();">'
   72:           .&mt('Toggle display').'</a>')
   73:       .&Apache::lonhtmlcommon::add_item_funclist(
   74:            '<a href="javascript:if (zscale>1) { zscale--; draw();}">'
   75:           .&mt('Zoom out').'</a>')
   76:       .&Apache::lonhtmlcommon::add_item_funclist(
   77:            '<a href="javascript:if (zscale<3) { zscale++; draw();}">'
   78:           .&mt('Zoom in').'</a>')
   79:       .&Apache::lonhtmlcommon::add_item_funclist(
   80:            '<a href="javascript:condense();draw();">'
   81:           .&mt('Condense').'</a>')
   82:       .&Apache::lonhtmlcommon::add_item_funclist(
   83:            '<a href="javascript:graphopt();draw();">'
   84:           .&mt('Straighten').'</a>')
   85:       .&Apache::lonhtmlcommon::add_item_funclist(
   86:            '<a href="javascript:revert();">'
   87:           .&mt('Revert').'</a>')
   88:       .&Apache::lonhtmlcommon::end_funclist();
   89: 
   90:     $functions .=
   91:        &Apache::lonhtmlcommon::start_funclist(&mt('Version Actions'))
   92:       .&Apache::lonhtmlcommon::add_item_funclist(
   93:            '<a href="javascript:undo();">'
   94:           .&mt('Undo').'</a>')
   95:       .&Apache::lonhtmlcommon::add_item_funclist(
   96:            '<a href="javascript:redo();">'
   97:           .&mt('Redo').'</a>')
   98:       .&Apache::lonhtmlcommon::add_item_funclist(
   99:            '<a href="javascript:groupopen(\''.$readfile.'\');">'
  100:           .&mt('Recover deleted').'</a>')
  101:       .&Apache::lonhtmlcommon::end_funclist();
  102: 
  103:     $functions .=
  104:        &Apache::lonhtmlcommon::start_funclist(&mt('Import'))
  105:       .&Apache::lonhtmlcommon::add_item_funclist(
  106:            '<a href="javascript:groupsearch();">'
  107:           .&mt('Search').'</a>')
  108:       .&Apache::lonhtmlcommon::add_item_funclist(
  109:            '<a href="javascript:groupimport();">'
  110:           .&mt('Import').'</a>')
  111:       .&Apache::lonhtmlcommon::add_item_funclist(
  112:            '<a href="javascript:open_StoredLinks_Import('."'advanced'".');">'
  113:           .&mt('Import from Stored Links').'</a>')
  114:       .&Apache::lonhtmlcommon::add_item_funclist(
  115:            '<a href="javascript:groupcopy();">'
  116:           .&mt('Copy').'</a>')
  117:       .&Apache::lonhtmlcommon::end_funclist();
  118: 
  119:     $functions .=
  120:        &Apache::lonhtmlcommon::start_funclist(&mt('Save'))
  121:       .&Apache::lonhtmlcommon::add_item_funclist(
  122:            '<a href="javascript:graphdef=\'no\';save();storechange();">'
  123:           .&mt('Save map').'</a>')
  124:       .&Apache::lonhtmlcommon::add_item_funclist(
  125:            '<a href="javascript:storechange();">'
  126:           .&mt('Save map and layout').'</a>')
  127:       .&Apache::lonhtmlcommon::end_funclist();
  128: 
  129:     $functions .= '</div>'; # End: LC_columnSection
  130: 
  131:     $functions .= &Apache::lonhtmlcommon::scripttag('main();');
  132: 
  133: 
  134:     # Print Advanced RAT page header
  135:     $r->send_http_header('text/html');
  136: 
  137:     $r->print(
  138:         &Apache::loncommon::start_page(
  139:             'Advanced Editor',
  140:             $js,
  141:             {'add_entries' => \%loaditem,
  142:              'bread_crumbs' => $brcrum,})
  143: 
  144:        .&Apache::loncommon::head_subbox(
  145:             &Apache::loncommon::CSTR_pageheader()
  146:            .$functions)
  147: 
  148:        .&Apache::loncommon::end_page()
  149:     );
  150: 
  151:     return OK;
  152: }
  153: 
  154: 1;
  155: 

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