Annotation of rat/lonratedt.pm, revision 1.4
1.1 www 1: # The LearningOnline Network with CAPA
2: # Edit Handler for RAT Maps
3: # (TeX Content Handler
4: #
5: # 05/29/00,05/30 Gerd Kortemeyer)
1.4 ! www 6: # 7/1,6/30 Gerd Kortemeyer
1.1 www 7:
8: package Apache::lonratedt;
9:
10: use strict;
11: use Apache::Constants qw(:common);
1.3 www 12: use Apache::lonnet;
1.1 www 13:
1.3 www 14: # --------------------------------------------------------- Build up RAT screen
15: sub ratedt {
16: my ($r,$url)=@_;
1.1 www 17: $r->print(<<ENDDOCUMENT);
18:
19: <html>
1.2 harris41 20: <head>
21: <script language="JavaScript">
22: var flag=0;
23: </script>
24: </head>
1.1 www 25: <frameset rows="1,50,*" border=0>
26: <frame name=server src="$url/loadonly/ratserver" noresize noscroll>
27: <frame name=code src="/adm/rat/code.html">
28: <frame name=mapout src="/adm/rat/map.html">
29: </frameset>
30: </html>
31:
32: ENDDOCUMENT
1.3 www 33: }
34:
35: sub smpedt {
36: my ($r,$fn)=@_;
37: $r->print(<<ENDSMPHEAD);
38: <html>
39: <body bgcolor='#FFFFFF'>
40: <form method=post>
41: <input type=submit name=forceadv
42: value="Advanced Map Editing - Resource Assembly Tool"><hr>
43: ENDSMPHEAD
44: $r->print(
45: '<input type=submit name=forcesmp value="Store"></form></body></html>');
46: }
47:
1.4 ! www 48: sub nodir {
! 49: my ($r,$dir)=@_;
! 50: $dir=~s/^\/home\/\w+\/public\_html//;
! 51: $r->print(<<ENDNODIR);
! 52: <html>
! 53: <body bgcolor='#FFFFFF'>
! 54: <h1>No such directory: $dir</h1>
! 55: </body>
! 56: </html>
! 57: ENDNODIR
! 58: }
! 59:
1.3 www 60: # ================================================================ Main Handler
61:
62: sub handler {
63: my $r=shift;
64: $r->content_type('text/html');
65: $r->send_http_header;
66:
67: return OK if $r->header_only;
68:
69: my $url=$r->uri;
70: my $fn=&Apache::lonnet::filelocation('',$url);
71:
1.4 ! www 72: my ($dir)=($fn=~/^(.+)\/[^\/]+$/);
! 73: unless (-e $dir) {
! 74: &nodir($r,$dir);
! 75: return OK;
! 76: }
1.3 www 77: my $adv=0;
78:
79: unless ($ENV{'form.forcesmp'}) {
80: if ($ENV{'form.forceadv'}) {
81: $adv=1;
82: } elsif (my $fh=Apache::File->new($fn)) {
83: my $allmap=join('',<$fh>);
84: $adv=($allmap=~/\<map[^\>]+mode\s*\=\s*(\'|\")rat/is);
85: }
86: }
87:
88: if ($adv) {
89: &ratedt($r,$url);
90: } else {
91: &smpedt($r,$fn);
92: }
1.1 www 93: return OK;
94: }
95:
96: 1;
97: __END__
98:
99:
100:
101:
102:
103:
104:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>