--- rat/lonratedt.pm 2002/05/22 20:39:59 1.27 +++ rat/lonratedt.pm 2002/06/04 13:23:54 1.30 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.27 2002/05/22 20:39:59 www Exp $ +# $Id: lonratedt.pm,v 1.30 2002/06/04 13:23:54 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use strict; use Apache::Constants qw(:common); use Apache::lonnet; use Apache::lonratsrv; +use Apache::lonsequence; my @order; my @resources; @@ -129,7 +130,9 @@ sub mapread { } # ---------------------------------------------- Read a map as well as possible - +# Also used by the sequence handler +# Call lonsequence::attemptread to read from resource space +# sub attemptread { my $fn=shift; @@ -263,7 +266,6 @@ ENDDOCUMENT # ---------------------------------------------------------------- Make buttons sub buttons { - if ($ENV{'form.forceselect'}) { return ''; } my $adv=shift; my $output='
'; if ($adv==1) { @@ -442,7 +444,7 @@ sub smpedt { } foreach ( - &attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) { + &Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) { my ($name,$url)=split(/\:/,$_); if ($url) { $importdetail.='&'.&Apache::lonnet::escape($name).'='. @@ -539,7 +541,9 @@ sub smpedt { # ------------------------------------------------------------ Assemble windows my $idx=-1; - my $importwindow=join("\n",map { + my $importwindow= + ''. + join("\n",map { $idx++; if ($_) { my ($name,$url)=split(/\=/,$_); @@ -551,7 +555,9 @@ sub smpedt { } split(/\&/,$importdetail)); $idx=0; - my $targetwindow=join("\n",map { + my $targetwindow= + ''. + join("\n",map { my ($name,$url)=split(/\:/,$resources[$_]); unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { $name='EMPTY'; } @@ -692,6 +698,7 @@ function idxcheck(mode) { $buttons $errtext +

$url

@@ -765,41 +772,7 @@ ENDNODIR sub viewmap { my ($r,$url,$adv,$errtext)=@_; - $r->print(''); - if ($ENV{'form.forceselect'}) { $r->print(< - -function select_group() { - window.location="/adm/groupsort?catalogmode=groupimport&mode=rat&acts="+document.forms.fileattr.acts.value; -} - -function queue(val) { - if (eval("document.forms."+val+".filelink.checked")) { - var l=val.length; - var v=val.substring(4,l); - document.forms.fileattr.acts.value+='1a'+v+'b'; - } - else { - var l=val.length; - var v=val.substring(4,l); - document.forms.fileattr.acts.value+='0a'+v+'b'; - } -} - - - - -ENDSCRIPT - } - $r->print(''.&buttons($adv)); - if ($ENV{'form.forceselect'}) { $r->print(< - - - -ENDSELECT - } + $r->print(''.&buttons($adv)); if ($errtext) { $r->print($errtext.'
'); } @@ -807,31 +780,17 @@ ENDSELECT foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) { if (defined($_)) { $idx++; - if ($ENV{'form.forceselect'}) { - $r->print('
'); - } my ($title,$url)=split(/\:/,$_); $title=~s/\&colon\;/\:/g; $url=~s/\&colon\;/\:/g; unless ($title) { $title=(split(/\//,$url))[-1] }; unless ($title) { $title='Empty'; } if ($url) { - if ($ENV{'form.forceselect'}) { - $r->print(< - -ENDCHECKBOX - } $r->print(''); } $r->print(&Apache::lonratsrv::qtescape($title)); if ($url) { $r->print(''); } - if ($ENV{'form.forceselect'}) { - $r->print(''); - } else { - $r->print('
'); - } + $r->print('
'); } } $r->print(''); @@ -845,9 +804,6 @@ sub handler { $r->send_http_header; return OK if $r->header_only; - - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['forceselect']); my $url=$r->uri; my $fn=&Apache::lonnet::filelocation('',$url);