--- loncom/interface/groupsort.pm 2002/03/21 14:33:49 1.7 +++ loncom/interface/groupsort.pm 2002/05/09 20:57:26 1.8 @@ -2,7 +2,7 @@ # The LON-CAPA group sort handler # Allows for sorting prior to import into RAT. # -# $Id: groupsort.pm,v 1.7 2002/03/21 14:33:49 www Exp $ +# $Id: groupsort.pm,v 1.8 2002/05/09 20:57:26 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,7 +55,38 @@ sub handler { $r->send_http_header; return OK if $r->header_only; - # output start of web page +# finish_import looks different for graphical or "simple" RAT + my $finishimport=''; + if ($ENV{'form.mode'} eq 'simple') { + $finishimport=(<<ENDSMP); +function finish_import() { + alert("Finishing a simple import"); +} +ENDSMP + } else { + $finishimport=(<<ENDADV); +function finish_import() { + var linkflag=false; + for (var num=0; num<document.forms.groupsort.fnum.value; num++) { + insertRowInLastRow(); + placeResourceInLastRow( + eval("document.forms.groupsort.title"+num+".value"), + eval("document.forms.groupsort.filelink"+num+".value"), + linkflag + ); + linkflag=true; + } + opener.editmode=0; + opener.notclear=0; + opener.linkmode=0; + opener.draw(); + self.close(); +} +ENDADV + } + +# output start of web page + $r->print(<<END); <html> <head> @@ -75,23 +106,7 @@ function placeResourceInLastRow (title,u } opener.linkmode=opener.mostrecent; } -function finish_import() { - var linkflag=false; - for (var num=0; num<document.forms.groupsort.fnum.value; num++) { - insertRowInLastRow(); - placeResourceInLastRow( - eval("document.forms.groupsort.title"+num+".value"), - eval("document.forms.groupsort.filelink"+num+".value"), - linkflag - ); - linkflag=true; - } - opener.editmode=0; - opener.notclear=0; - opener.linkmode=0; - opener.draw(); - self.close(); -} +$finishimport function selectchange(val) { var newval=0+eval("document.forms.groupsort.alt"+val+".selectedIndex"); orderchange(val,newval);