[LON-CAPA-cvs] cvs: loncom /cgi quotacheck.pl /interface courseclassifier.pm lonmodifycourse.pm

musolffc musolffc at source.lon-capa.org
Thu Jul 31 11:45:31 EDT 2014


musolffc		Thu Jul 31 15:45:31 2014 EDT

  Modified files:              
    /loncom/interface	courseclassifier.pm lonmodifycourse.pm 
    /loncom/cgi	quotacheck.pl 
  Log:
  Making drop-down selections persistent after search
  
  
Index: loncom/interface/courseclassifier.pm
diff -u loncom/interface/courseclassifier.pm:1.18 loncom/interface/courseclassifier.pm:1.19
--- loncom/interface/courseclassifier.pm:1.18	Mon Mar 17 02:33:32 2014
+++ loncom/interface/courseclassifier.pm	Thu Jul 31 15:45:27 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utilities for classifying courses based on institutional code
 #
-# $Id: courseclassifier.pm,v 1.18 2014/03/17 02:33:32 raeburn Exp $
+# $Id: courseclassifier.pm,v 1.19 2014/07/31 15:45:27 musolffc Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -739,12 +739,23 @@
     my $nocrs = &mt('No courses');
     my $output = <<END;
 
-function courseSet(caller) {
+function courseSet(caller, onload) {
     var longtitles = new Array ("$longtitles_str");
-    var valyr = document.$formname.Year.options[document.$formname.Year.selectedIndex].value
-    var valsem  = document.$formname.Semester.options[document.$formname.Semester.selectedIndex].value
-    var valdept = document.$formname.Department.options[document.$formname.Department.selectedIndex].value
-    var valclass = document.$formname.Number.options[document.$formname.Number.selectedIndex].value
+    var valyr = '';
+    var valsem = '';
+    var valdept = '';
+    var valclass = '';
+    if (onload) {
+        valyr = "$env{'form.Year'}";
+        valsem = "$env{'form.Semester'}";
+        valdept = "$env{'form.Department'}";
+        valclass = "$env{'form.Number'}";
+    } else {
+        valyr = document.$formname.Year.options[document.$formname.Year.selectedIndex].value;
+        valsem  = document.$formname.Semester.options[document.$formname.Semester.selectedIndex].value;
+        valdept = document.$formname.Department.options[document.$formname.Department.selectedIndex].value;
+        valclass = document.$formname.Number.options[document.$formname.Number.selectedIndex].value;
+    }
     var idyears = new Array("$allidlist");
     var idyr = -1;
     var idsem = -1;
@@ -753,9 +764,36 @@
 
     $scripttext
 
-    selYear = document.$formname.Year.selectedIndex-1;
-    selSemester = document.$formname.Semester.selectedIndex-1;
-    selDepartment = document.$formname.Department.selectedIndex-1;
+    if (onload) {
+        if (document.$formname.Year.options.length > 0) {
+            for (var i = 0; i< document.$formname.Year.options.length; i++) {
+                if (document.$formname.Year.options[i].value == "$env{'form.Year'}") {
+                    document.$formname.Year.selectedIndex = i;
+                    break;
+                }
+            }
+        }
+        if (document.$formname.Department.options.length > 0) {
+            for (var i = 0; i< document.$formname.Department.options.length; i++) {
+                if (document.$formname.Department.options[i].value == "$env{'form.Department'}") {
+                    document.$formname.Department.selectedIndex = i;
+                    break;
+                }
+            }
+        }
+        if (document.$formname.Semester.options.length > 0) {
+            for (var i = 0; i< document.$formname.Semester.options.length; i++) {
+                if (document.$formname.Semester.options[i].value == "$env{'form.Semester'}") {
+                    document.$formname.Semester.selectedIndex = i;
+                    break;
+                }
+            }
+        }
+    }
+
+    var selYear = document.$formname.Year.selectedIndex-1;
+    var selSemester = document.$formname.Semester.selectedIndex-1;
+    var selDepartment = document.$formname.Department.selectedIndex-1;
     if (selYear == -1) {
         if (selSemester == -1) {
             if (selDepartment > -1) {
@@ -870,7 +908,18 @@
         }
         document.$formname.Number.selectedIndex = 0
     }
-    $officialjs
+    if (onload) {
+        if (document.$formname.Number.options.length > 0) {
+            for (var i = 0; i< document.$formname.Number.options.length; i++) {
+                if (document.$formname.Number.options[i].value == "$env{'form.Number'}") {
+                    document.$formname.Number.selectedIndex = i;
+                    break;
+                }
+            }
+        }
+    } else {
+        $officialjs
+    }
 }
 END
     return $output;
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.73 loncom/interface/lonmodifycourse.pm:1.74
--- loncom/interface/lonmodifycourse.pm:1.73	Mon Apr 28 22:20:13 2014
+++ loncom/interface/lonmodifycourse.pm	Thu Jul 31 15:45:27 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # handler for DC-only modifiable course settings
 #
-# $Id: lonmodifycourse.pm,v 1.73 2014/04/28 22:20:13 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.74 2014/07/31 15:45:27 musolffc Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1772,7 +1772,7 @@
                      };
     } elsif ($phase eq 'courselist') {
         $starthash = {
-           add_entries => {'onload' => "hide_searching();"},
+           add_entries => {'onload' => "hide_searching(); courseSet(document.filterpicker.official, 'load');"},
                      };
     }
     $r->print(&Apache::loncommon::start_page('View/Modify Course/Community Settings',
Index: loncom/cgi/quotacheck.pl
diff -u loncom/cgi/quotacheck.pl:1.3 loncom/cgi/quotacheck.pl:1.4
--- loncom/cgi/quotacheck.pl:1.3	Thu Jul 31 15:02:26 2014
+++ loncom/cgi/quotacheck.pl	Thu Jul 31 15:45:31 2014
@@ -6,7 +6,7 @@
 # requested domain, or current server should belong to requested
 # domain.
 #
-# $Id: quotacheck.pl,v 1.3 2014/07/31 15:02:26 musolffc Exp $
+# $Id: quotacheck.pl,v 1.4 2014/07/31 15:45:31 musolffc Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -131,7 +131,10 @@
               text=>"Result"});
     }
     my $domdesc = &Apache::lonnet::domain($reqdom,'description');
-    print(&Apache::loncommon::start_page('Course/Community disk usage and quotas').
+    my $starthash = {
+        add_entries => {'onload' => "javascript:courseSet(document.filterpicker.official, 'load');"},
+    };
+    print(&Apache::loncommon::start_page('Course/Community disk usage and quotas', undef, $starthash).
           &Apache::lonhtmlcommon::breadcrumbs('Course/Community status').
           '<h2>'.&Apache::lonlocal::mt('Quotas for uploaded course content').'</h2>'.
           '<h3>'.$domdesc.'</h3>');




More information about the LON-CAPA-cvs mailing list