Annotation of rat/lonratmenu.pm, revision 1.16
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.16 ! wenzelju 5: # $Id: lonratmenu.pm,v 1.15 2009/12/04 15:13:04 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(
1.16 ! wenzelju 114: '<a href="javascript:open_Wishlist_Import('."'advanced'".');">'
! 115: .&mt('Import from Wishlist').'</a>')
! 116: .&Apache::lonhtmlcommon::add_item_funclist(
1.15 bisitz 117: '<a href="javascript:groupcopy();">'
118: .&mt('Copy').'</a>')
119: .&Apache::lonhtmlcommon::end_funclist();
120:
121: $functions .=
122: &Apache::lonhtmlcommon::start_funclist(&mt('Save'))
123: .&Apache::lonhtmlcommon::add_item_funclist(
124: '<a href="javascript:graphdef=\'no\';save();storechange();">'
125: .&mt('Save map').'</a>')
126: .&Apache::lonhtmlcommon::add_item_funclist(
127: '<a href="javascript:storechange();">'
128: .&mt('Save map and layout').'</a>')
129: .&Apache::lonhtmlcommon::end_funclist();
130:
131: $functions .= '</div>'; # End: LC_columnSection
132:
133: $functions .= &Apache::lonhtmlcommon::scripttag('main();');
134:
135:
136: # Print Advanced RAT page header
137: $r->send_http_header('text/html');
138:
139: $r->print(
140: &Apache::loncommon::start_page(
141: 'Advanced Editor',
142: $js,
143: {'add_entries' => \%loaditem,
144: 'bread_crumbs' => $brcrum,})
145:
146: .&Apache::loncommon::head_subbox(
147: &Apache::loncommon::CSTR_pageheader()
148: .$functions)
149:
150: .&Apache::loncommon::end_page()
151: );
152:
1.1 raeburn 153: return OK;
154: }
155:
156: 1;
157:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>