--- loncom/interface/groupsort.pm 2007/07/12 00:27:13 1.57 +++ loncom/interface/groupsort.pm 2007/07/12 19:54:43 1.59 @@ -2,7 +2,7 @@ # The LON-CAPA group sort handler # Allows for sorting prior to import into RAT. # -# $Id: groupsort.pm,v 1.57 2007/07/12 00:27:13 albertel Exp $ +# $Id: groupsort.pm,v 1.59 2007/07/12 19:54:43 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -160,7 +160,6 @@ sub readfromfile { if ($token->[2]->{'type'} eq 'zombie') { next; } } - my $url=$token->[2]->{'src'}; my $name=$token->[2]->{'title'}; $name=~s/ \[\((\d+)\,($LONCAPA::username_re)\,($LONCAPA::domain_re)\)\]$//; my $note; @@ -170,9 +169,10 @@ sub readfromfile { &Apache::lonlocal::locallocaltime($1); } $name=~s/\&colon\;/\:/g; - push(@{$resources}, {'url' => $url, + push(@{$resources}, {'url' => $token->[2]->{'src'}, 'title' => $name, - 'note' => $note, }); + 'note' => $note, + 'id' => $token->[2]->{'id'},}); } } } @@ -228,7 +228,8 @@ function finish_import() { $begincondition opener.document.forms.simpleedit.importdetail.value+='&'+ escape(eval("document.forms.groupsort.title"+num+".value"))+'='+ - escape(eval("document.forms.groupsort.filelink"+num+".value")); + escape(eval("document.forms.groupsort.filelink"+num+".value"))+'='+ + escape(eval("document.forms.groupsort.id"+num+".value")); $endcondition } opener.document.forms.simpleedit.submit(); @@ -245,6 +246,7 @@ function finish_import() { placeResourceInLastRow( eval("document.forms.groupsort.title"+num+".value"), eval("document.forms.groupsort.filelink"+num+".value"), + eval("document.forms.groupsort.id"+num+".value"), linkflag ); linkflag=true; @@ -266,9 +268,9 @@ function insertRowInLastRow() { opener.insertrow(opener.maxrow); opener.addobj(opener.maxrow,'e&2'); } -function placeResourceInLastRow (title,url,linkflag) { +function placeResourceInLastRow (title,url,id,linkflag) { opener.mostrecent=opener.newresource(opener.maxrow,2,opener.escape(title), - opener.escape(url),'false','normal'); + opener.escape(url),'false','normal',id); opener.save(); if (linkflag) { opener.joinres(opener.linkmode,opener.mostrecent,0); @@ -393,7 +395,8 @@ END $r->print(&movers($clen,$ctr)); } } - $r->print(&hidden($ctr-1,$resource->{'title'},$resource->{'url'})); + $r->print(&hidden($ctr-1,$resource->{'title'},$resource->{'url'}, + $resource->{'id'})); if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { $r->print(""); unless (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { @@ -425,12 +428,13 @@ END # --------------------------------------- Hidden values (returns scalar string) sub hidden { - my ($sel,$title,$filelink) = @_; + my ($sel,$title,$filelink,$id) = @_; my $string = ''; $filelink=~s|^/ext/|http://|; $string .= ''; + $string .= ''; return $string; }