Annotation of rat/lonratmenu.pm, revision 1.24
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.24 ! raeburn 5: # $Id: lonratmenu.pm,v 1.23 2022/05/29 11:33:57 raeburn 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:
1.22 raeburn 49: my $target = '_top';
50: if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
51: (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'}))) {
52: $target = '_parent';
53: }
54:
1.15 bisitz 55: # Breadcrumbs
1.18 raeburn 56: my $brcrum = [{'href' => &Apache::loncommon::authorspace($r->uri),
1.21 damieng 57: 'text' => 'Authoring Space',
1.22 raeburn 58: 'target' => $target},
1.15 bisitz 59: {'href' => '',
60: 'text' => 'RAT'},
61: {'href' => '',
62: 'text' => 'Advanced Editor'}];
63:
64: my $help=&Apache::loncommon::help_open_menu(
65: 'Sequence_Advanced_Editor_Creation',
66: 'Sequence_Advanced_Editor_Creation',6,'RAT');
67:
68:
69: # Compile available Advanced RAT functions
70: my $functions = '<div class="LC_columnSection">';
71:
72: $functions .= $help; # FIXME: Move help to bread_crumbs_component
73:
74: $functions .=
75: &Apache::lonhtmlcommon::start_funclist(&mt('Display Actions'))
76: .&Apache::lonhtmlcommon::add_item_funclist(
77: '<a href="javascript:togglemode();">'
78: .&mt('Toggle display').'</a>')
79: .&Apache::lonhtmlcommon::add_item_funclist(
80: '<a href="javascript:if (zscale>1) { zscale--; draw();}">'
81: .&mt('Zoom out').'</a>')
82: .&Apache::lonhtmlcommon::add_item_funclist(
83: '<a href="javascript:if (zscale<3) { zscale++; draw();}">'
84: .&mt('Zoom in').'</a>')
85: .&Apache::lonhtmlcommon::add_item_funclist(
86: '<a href="javascript:condense();draw();">'
87: .&mt('Condense').'</a>')
88: .&Apache::lonhtmlcommon::add_item_funclist(
89: '<a href="javascript:graphopt();draw();">'
90: .&mt('Straighten').'</a>')
91: .&Apache::lonhtmlcommon::add_item_funclist(
92: '<a href="javascript:revert();">'
93: .&mt('Revert').'</a>')
94: .&Apache::lonhtmlcommon::end_funclist();
95:
96: $functions .=
97: &Apache::lonhtmlcommon::start_funclist(&mt('Version Actions'))
98: .&Apache::lonhtmlcommon::add_item_funclist(
99: '<a href="javascript:undo();">'
100: .&mt('Undo').'</a>')
101: .&Apache::lonhtmlcommon::add_item_funclist(
102: '<a href="javascript:redo();">'
103: .&mt('Redo').'</a>')
104: .&Apache::lonhtmlcommon::add_item_funclist(
105: '<a href="javascript:groupopen(\''.$readfile.'\');">'
106: .&mt('Recover deleted').'</a>')
107: .&Apache::lonhtmlcommon::end_funclist();
108:
109: $functions .=
110: &Apache::lonhtmlcommon::start_funclist(&mt('Import'))
111: .&Apache::lonhtmlcommon::add_item_funclist(
112: '<a href="javascript:groupsearch();">'
113: .&mt('Search').'</a>')
114: .&Apache::lonhtmlcommon::add_item_funclist(
115: '<a href="javascript:groupimport();">'
116: .&mt('Import').'</a>')
117: .&Apache::lonhtmlcommon::add_item_funclist(
1.19 raeburn 118: '<a href="javascript:open_StoredLinks_Import('."'advanced'".');">'
119: .&mt('Import from Stored Links').'</a>')
1.16 wenzelju 120: .&Apache::lonhtmlcommon::add_item_funclist(
1.15 bisitz 121: '<a href="javascript:groupcopy();">'
122: .&mt('Copy').'</a>')
123: .&Apache::lonhtmlcommon::end_funclist();
124:
125: $functions .=
126: &Apache::lonhtmlcommon::start_funclist(&mt('Save'))
127: .&Apache::lonhtmlcommon::add_item_funclist(
128: '<a href="javascript:graphdef=\'no\';save();storechange();">'
129: .&mt('Save map').'</a>')
130: .&Apache::lonhtmlcommon::add_item_funclist(
131: '<a href="javascript:storechange();">'
132: .&mt('Save map and layout').'</a>')
133: .&Apache::lonhtmlcommon::end_funclist();
134:
135: $functions .= '</div>'; # End: LC_columnSection
136:
137: $functions .= &Apache::lonhtmlcommon::scripttag('main();');
138:
139:
140: # Print Advanced RAT page header
141: $r->send_http_header('text/html');
1.22 raeburn 142: my $frameset = 1;
1.15 bisitz 143:
144: $r->print(
145: &Apache::loncommon::start_page(
146: 'Advanced Editor',
147: $js,
148: {'add_entries' => \%loaditem,
1.23 raeburn 149: 'bread_crumbs' => $brcrum,
1.24 ! raeburn 150: 'links_target' => '_parent',})
1.15 bisitz 151:
152: .&Apache::loncommon::head_subbox(
1.22 raeburn 153: &Apache::loncommon::CSTR_pageheader('',$frameset)
1.15 bisitz 154: .$functions)
155:
156: .&Apache::loncommon::end_page()
157: );
158:
1.1 raeburn 159: return OK;
160: }
161:
162: 1;
163:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>