--- rat/lonratedt.pm 2002/05/22 13:31:22 1.26 +++ rat/lonratedt.pm 2002/08/20 13:02:41 1.32 @@ -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.32 2002/08/20 13:02:41 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; @@ -67,6 +68,9 @@ sub mapread { if ($command eq 'objlinks') { $links[$number]=$content; } + if ($command eq 'objparms') { + return('Map has resource parameters. Use advanced editor.',1); + } } # ------------------------------------------------------- Is this a linear map? my @starters=(); @@ -129,7 +133,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 +269,6 @@ ENDDOCUMENT # ---------------------------------------------------------------- Make buttons sub buttons { - if ($ENV{'form.forceselect'}) { return ''; } my $adv=shift; my $output='
'; if ($adv==1) { @@ -342,6 +347,113 @@ sub storemap { &Apache::lonratsrv::loadmap($fn,&Apache::lonratsrv::savemap($fn,'')); } +sub editscript { + my $mode=shift; + return(< ---- Import and Paste Area ---- '. + join("\n",map { $idx++; if ($_) { my ($name,$url)=split(/\=/,$_); @@ -551,7 +665,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'; } @@ -562,112 +678,13 @@ sub smpedt { } @order); # ----------------------------------------------------- Start simple RAT screen + my $editscript=&editscript('simple'); $r->print(< @@ -692,6 +709,7 @@ function idxcheck(mode) { $buttons $errtext +

$url

@@ -721,7 +739,7 @@ after selected
- @@ -735,7 +753,7 @@ Copy selected
Paste after selected
-
@@ -765,41 +783,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 +791,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 +815,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);