[LON-CAPA-cvs] cvs: loncom /interface groupsort.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 09 May 2002 20:57:26 -0000


www		Thu May  9 16:57:26 2002 EDT

  Modified files:              
    /loncom/interface	groupsort.pm 
  Log:
  JavaScript function finish_import exchangable in preparation for "simple RAT" 
  (bug 331) 
  
  
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.7 loncom/interface/groupsort.pm:1.8
--- loncom/interface/groupsort.pm:1.7	Thu Mar 21 09:33:49 2002
+++ loncom/interface/groupsort.pm	Thu May  9 16:57:26 2002
@@ -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 @@
     $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 @@
     }
     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);