--- rat/lonratedt.pm 2002/05/13 15:36:05 1.12 +++ rat/lonratedt.pm 2002/05/13 19:23:52 1.13 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.12 2002/05/13 15:36:05 www Exp $ +# $Id: lonratedt.pm,v 1.13 2002/05/13 19:23:52 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -175,37 +175,80 @@ sub smpedt { undef @targetselect; if (defined($ENV{'form.import'})) { if (ref($ENV{'form.import'})) { - @importselect=$ENV->{'form.import'}; + @importselect=sort($ENV->{'form.import'}); } else { @importselect=($ENV{'form.import'}); } } if (defined($ENV{'form.target'})) { if (ref($ENV{'form.target'})) { - @targetselect=$ENV->{'form.target'}; + @targetselect=sort($ENV->{'form.target'}); } else { @targetselect=($ENV{'form.target'}); } } -# --------------------------------------------------------- +# ============================================================ Process commands - my $targetdetail=(); - - my @imporder=(); - my @impresources=(); + my $targetdetail=''; my $importdetail=''; + +# ---------------------------------------------------- Importing from groupsort + if ($ENV{'form.importdetail'}) { + + my @curimport=split(/\&/,$ENV{'form.curimpdetail'}); + + my $lastsel; + + if (defined($importselect[-1])) { + $lastsel=$importselect[-1]; + } else { + $lastsel=$#curimport; + } + + for (my $i=0;$i<=$lastsel;$i++) { + my ($name,$url)=split(/\=/,$curimport[$i]); + if ($url) { + $importdetail.='&'.&Apache::lonnet::escape($name).'='. + &Apache::lonnet::escape($url); + } + } + + $importdetail.='&'.$ENV{'form.importdetail'}; + + for (my $i=$lastsel+1;$i<=$#curimport;$i++) { + my ($name,$url)=split(/\=/,$curimport[$i]); + if ($url) { + $importdetail.='&'.&Apache::lonnet::escape($name).'='. + &Apache::lonnet::escape($url); + } + } + $importdetail=~s/\&+/\&/g; + $importdetail=~s/^\&//; + +# -------------------------------------------------------- + } + # ------------------------------------------------------------ Assemble windows - my $importwindow=join("\n",map { - my ($name)=split(/\:/,$impresources[$_]); - unless ($name) { $name='UNKNOWN'; } - ''; - } @imporder); + my $idx=-1; + my $importwindow=join("\n",map { + $idx++; + if ($_) { + my ($name)=split(/\=/,$_); + unless ($name) { $name='UNKNOWN'; } + ''; + } + } split(/\&/,$importdetail)); + $idx=0; my $targetwindow=join("\n",map { - my ($name)=split(/\:/,$resources[$_]); + my ($name,$url)=split(/\:/,$resources[$_]); unless ($name) { $name='UNKNOWN'; } - ''; + $targetdetail.='&'.&Apache::lonnet::escape($name).'='. + &Apache::lonnet::escape($url); + $idx++; + ''; } @order); # ----------------------------------------------------- Start simple RAT screen @@ -296,7 +339,7 @@ function idxcheck(mode) {
$buttons $errtext -