--- rat/lonratedt.pm 2002/05/22 13:31:22 1.26
+++ rat/lonratedt.pm 2009/04/04 21:46:02 1.93
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Edit Handler for RAT Maps
#
-# $Id: lonratedt.pm,v 1.26 2002/05/22 13:31:22 www Exp $
+# $Id: lonratedt.pm,v 1.93 2009/04/04 21:46:02 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,359 +25,234 @@
#
# http://www.lon-capa.org/
#
-# (TeX Content Handler
-#
-# 05/29/00,05/30 Gerd Kortemeyer)
-# 7/1,6/30 Gerd Kortemeyer
+
package Apache::lonratedt;
use strict;
use Apache::Constants qw(:common);
use Apache::lonnet;
-use Apache::lonratsrv;
-
-my @order;
-my @resources;
+use Apache::lonsequence();
+use Apache::loncommon();
+use Apache::lonlocal;
+use LONCAPA::map();
+use File::Copy;
+use LONCAPA;
+use HTML::Entities();
+# --------------------------------------------------------- Build up RAT screen
+sub ratedt {
+ my ($r,$url)=@_;
+ my %layout = ('border' => "0");
+ if ($env{'environment.remote'} eq 'off') {
+ $layout{'rows'} = "1,250,*";
+ } else {
+ $layout{'rows'} = "1,70,*";
+ }
+ my $js ='
+';
-# Mapread read maps into global arrays @links and @resources, determines status
-# sets @order - pointer to resources in right order
-# sets @resources - array with the resources with correct idx
-#
-sub mapread {
- my $fn=shift;
+ my $start_page =
+ &Apache::loncommon::start_page('Edit Sequence',$js,
+ {'frameset' => 1,
+ 'add_entries' => \%layout});
+ my $end_page =
+ &Apache::loncommon::end_page({'frameset' => 1});
- my @links;
- undef @links;
- undef @resources;
- undef @order;
- @resources=('');
- @order=();
-
- my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,'');
- if ($errtext) { return ($errtext,2); }
-
-# -------------------------------------------------------------------- Read map
- foreach (split(/\<\&\>/,$outtext)) {
- my ($command,$number,$content)=split(/\<\:\>/,$_);
- if ($command eq 'objcont') {
- $resources[$number]=$content;
- }
- if ($command eq 'objlinks') {
- $links[$number]=$content;
- }
- }
-# ------------------------------------------------------- Is this a linear map?
- my @starters=();
- my @endings=();
- undef @starters;
- undef @endings;
-
- foreach (@links) {
- if (defined($_)) {
- my ($start,$end,$cond)=split(/\:/,$_);
- if ((defined($starters[$start])) || (defined($endings[$end]))) {
- return
- ('Map has branchings. Use advanced editor.',1);
- }
- $starters[$start]=1;
- $endings[$end]=1;
- if ($cond) {
- return
- ('Map has conditions. Use advanced editor.',1);
- }
- }
-
- }
- for (my $i=1; $i<=$#resources; $i++) {
- if (defined($resources[$i])) {
- unless (($starters[$i]) || ($endings[$i])) {
- return
- ('Map has unconnected resources. Use advanced editor.',1);
- }
- }
- }
+ $r->print(<