File:
[LON-CAPA] /
rat /
lonratsrv.pm
Revision
1.39:
download - view:
text,
annotated -
select for diffs
Wed Dec 20 22:42:48 2006 UTC (17 years, 9 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_8_X,
version_2_8_2,
version_2_8_1,
version_2_8_0,
version_2_7_X,
version_2_7_99_1,
version_2_7_99_0,
version_2_7_1,
version_2_7_0,
version_2_6_X,
version_2_6_99_1,
version_2_6_99_0,
version_2_6_3,
version_2_6_2,
version_2_6_1,
version_2_6_0,
version_2_5_X,
version_2_5_99_1,
version_2_5_99_0,
version_2_5_2,
version_2_5_1,
version_2_5_0,
version_2_4_X,
version_2_4_99_0,
version_2_4_2,
version_2_4_1,
version_2_4_0,
version_2_3_X,
version_2_3_99_0,
version_2_3_2,
version_2_3_1,
version_2_3_0,
version_2_2_99_1,
HEAD,
GCI_1
- bunch of \w replacements
1: # The LearningOnline Network with CAPA
2: # Server for RAT Maps
3: #
4: # $Id: lonratsrv.pm,v 1.39 2006/12/20 22:42:48 albertel Exp $
5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28:
29: package Apache::lonratsrv;
30:
31: use strict;
32: use Apache::Constants qw(:common);
33: use LONCAPA();
34: use LONCAPA::map();
35:
36:
37: # ================================================================ Main Handler
38:
39: sub handler {
40: my $r=shift;
41: &Apache::loncommon::content_type($r,'text/html');
42: $r->send_http_header;
43:
44: return OK if $r->header_only;
45:
46: my $url=$r->uri;
47: $url=~m{/(\w+)/ratserver$};
48: my $mode=$1;
49:
50: $url=~s{/loadonly/ratserver$}{/save/ratserver};
51:
52: my $fn=$r->filename;
53: my $lonDocRoot=$r->dir_config('lonDocRoot');
54: if ( $fn =~ /\Q$lonDocRoot\E/ ) {
55: #internal authentication, needs fixup.
56: $fn = $url;
57: $fn=~s{^/~($LONCAPA::username_re)}{/home/$1/public_html};
58: $fn=~s{/[^/]*/ratserver$}{};
59: }
60: my $errtext='';
61: my $infotext='';
62: my $outtext='';
63:
64: if ($mode ne 'loadonly') {
65: ($errtext,$infotext)=&LONCAPA::map::savemap($fn,$errtext);
66: }
67: ($outtext,$errtext,$infotext)=&LONCAPA::map::loadmap($fn,$errtext,$infotext);
68:
69: my $start_page =
70: &Apache::loncommon::start_page('Alert',undef,
71: {'only_body' => 1,
72: 'bgcolor' => '#FFFFFF',});
73: my $end_page =
74: &Apache::loncommon::end_page();
75:
76: $r->print(<<ENDDOCUMENT);
77: $start_page
78: <form name="storage" method="post" action="$url">
79: <input type="hidden" name="output" value="$outtext" />
80: </form>
81: <script type ="text/javascript">
82: parent.flag=1;
83: </script>
84: ENDDOCUMENT
85: if (($errtext ne '') || ($infotext ne '')) {
86: $r->print(<<ENDSCRIPT);
87: <script type="text/javascript">
88: alert("$infotext $errtext");
89: </script>
90: ENDSCRIPT
91: }
92: $r->print($end_page);
93:
94: return OK;
95: }
96:
97: 1;
98: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>