[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface lonmainmenu.pm

raeburn raeburn@source.lon-capa.org
Mon, 07 Dec 2009 22:33:26 -0000


raeburn		Mon Dec  7 22:33:26 2009 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	lonmainmenu.pm 
  Log:
  - Customization for GCI_3
    - Javascript for switching between Concept Test courses via select box. 
  
  
Index: loncom/interface/lonmainmenu.pm
diff -u loncom/interface/lonmainmenu.pm:1.8.4.2 loncom/interface/lonmainmenu.pm:1.8.4.3
--- loncom/interface/lonmainmenu.pm:1.8.4.2	Mon Dec  7 18:47:31 2009
+++ loncom/interface/lonmainmenu.pm	Mon Dec  7 22:33:26 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # displays the main menu
 #
-# $Id: lonmainmenu.pm,v 1.8.4.2 2009/12/07 18:47:31 raeburn Exp $
+# $Id: lonmainmenu.pm,v 1.8.4.3 2009/12/07 22:33:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -145,6 +145,38 @@
     return $output;
 }
 
+sub gcitest_switcher_js {
+    my ($current,$numcourses) = @_;
+    my $output = <<"ENDJS";
+
+function courseswitcher(caller) {
+    var numcourses = $numcourses;
+    var current = '$current';
+    var choice = document.pickrole.newrole.options[document.pickrole.newrole.selectedIndex].value;
+    if (choice == '') {
+        if (caller == 'icon') {
+            alert('No Concept Test selected');
+        }
+        document.pickrole.selectrole.value = '';
+        return;
+    }
+    if (choice == current) {
+        if ((caller != 'icon') && (numcourses > 1)) {
+            alert('You have selected the current course.\\nPlease select a different Concept Test course');
+        }
+        document.pickrole.newrole.selectedIndex = 0;
+        document.pickrole.selectrole.value = '';
+        return;
+    }
+    document.pickrole.selectrole.value = '1';
+    document.pickrole.submit();
+    return;
+}
+
+ENDJS
+    return $output;
+}
+
 1;
 __END__