Annotation of rat/lonratedt.pm, revision 1.3
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)
6: # 7/1 Gerd Kortemeyer
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:
! 48: # ================================================================ Main Handler
! 49:
! 50: sub handler {
! 51: my $r=shift;
! 52: $r->content_type('text/html');
! 53: $r->send_http_header;
! 54:
! 55: return OK if $r->header_only;
! 56:
! 57: my $url=$r->uri;
! 58: my $fn=&Apache::lonnet::filelocation('',$url);
! 59:
! 60: my $adv=0;
! 61:
! 62: unless ($ENV{'form.forcesmp'}) {
! 63: if ($ENV{'form.forceadv'}) {
! 64: $adv=1;
! 65: } elsif (my $fh=Apache::File->new($fn)) {
! 66: my $allmap=join('',<$fh>);
! 67: $adv=($allmap=~/\<map[^\>]+mode\s*\=\s*(\'|\")rat/is);
! 68: }
! 69: }
! 70:
! 71: if ($adv) {
! 72: &ratedt($r,$url);
! 73: } else {
! 74: &smpedt($r,$fn);
! 75: }
1.1 www 76: return OK;
77: }
78:
79: 1;
80: __END__
81:
82:
83:
84:
85:
86:
87:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>