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

raeburn raeburn at source.lon-capa.org
Tue Mar 11 17:42:18 EDT 2014


raeburn		Tue Mar 11 21:42:18 2014 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm courseclassifier.pm 
  Log:
  - Moving &instcode_selectors() from lonpickcourse.pm to courseclassifier.pm
    to facilitate re-use.
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.109 loncom/interface/lonpickcourse.pm:1.110
--- loncom/interface/lonpickcourse.pm:1.109	Tue Dec 24 19:15:11 2013
+++ loncom/interface/lonpickcourse.pm	Tue Mar 11 21:42:18 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.109 2013/12/24 19:15:11 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.110 2014/03/11 21:42:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -694,7 +694,8 @@
                 || ($formname eq 'modifycourse')) {
                 $officialjs = 1;
                 ($instcodeform,$jscript,$$numtitlesref) = 
-                    &instcode_selectors($codedom,'filterpicker',$officialjs,$codetitlesref);
+                    &Apache::courseclassifier::instcode_selectors($codedom,'filterpicker',
+                                                                  $officialjs,$codetitlesref);
                 if ($jscript) {
                     $jscript = '<script type="text/javascript" language="Javascript">'.
                                $jscript.'</script>'."\n";
@@ -873,33 +874,6 @@
     }
 }
 
-sub instcode_selectors {
-    my ($codedom,$formname,$officialjs,$codetitles) = @_;
-    my ($output,%cat_titles,%cat_order,%cat_items);
-    my ($jscript,$totcodes,$numtitles,$lasttitle) =
-        &Apache::courseclassifier::instcode_selectors_data($codedom,$formname,
-                           \%cat_items,$codetitles,\%cat_titles,\%cat_order,$officialjs);
-    if ($numtitles > 0) {
-        my $official = ' checked="checked" ';
-        my $unofficial = '';
-        if ($env{'form.official'} eq 'off') {
-            $unofficial = $official;
-            $official = '';
-        }
-        $output .= '<span class="LC_nobreak">'.&mt('Official course:').' <label>'.
-                   '<input type="radio" name="official" value="on"'.$official.' />'.
-                   &mt('Yes').'</label>'.(' 'x3).'<label>'.
-                   '<input type="radio" name="official" value="off"'.$unofficial.
-                   ' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'.
-                   &Apache::courseclassifier::build_instcode_selectors($numtitles,
-                   $lasttitle,\%cat_items,$codetitles,\%cat_titles,\%cat_order)."\n".
-                   '<input type="hidden" name="numtitles" value="'.$numtitles.'" />'."\n".
-                   '<input type="hidden" name="state" value="listing" />'."\n";
- 
-    }
-    return ($output,$jscript,$numtitles);
-}
-
 sub search_courses {
     my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom,$domcloner,$codetitles) = @_;
     my (%courses,%showcourses,$cloner,$ccrole);
Index: loncom/interface/courseclassifier.pm
diff -u loncom/interface/courseclassifier.pm:1.15 loncom/interface/courseclassifier.pm:1.16
--- loncom/interface/courseclassifier.pm:1.15	Mon Jul 15 14:32:45 2013
+++ loncom/interface/courseclassifier.pm	Tue Mar 11 21:42:18 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utilities for classifying courses based on institutional code
 #
-# $Id: courseclassifier.pm,v 1.15 2013/07/15 14:32:45 bisitz Exp $
+# $Id: courseclassifier.pm,v 1.16 2014/03/11 21:42:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -604,6 +604,32 @@
     return $output;
 }
 
+sub instcode_selectors {
+    my ($codedom,$formname,$officialjs,$codetitles) = @_;
+    my ($output,%cat_titles,%cat_order,%cat_items);
+    my ($jscript,$totcodes,$numtitles,$lasttitle) =
+        &instcode_selectors_data($codedom,$formname,\%cat_items,$codetitles,
+                                 \%cat_titles,\%cat_order,$officialjs);
+    if ($numtitles > 0) {
+        my $official = ' checked="checked" ';
+        my $unofficial = '';
+        if ($env{'form.official'} eq 'off') {
+            $unofficial = $official;
+            $official = '';
+        }
+        $output .= '<span class="LC_nobreak">'.&mt('Official course:').' <label>'.
+                   '<input type="radio" name="official" value="on"'.$official.' />'.
+                   &mt('Yes').'</label>'.(' 'x3).'<label>'.
+                   '<input type="radio" name="official" value="off"'.$unofficial.
+                   ' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'.
+                   &build_instcode_selectors($numtitles,$lasttitle,\%cat_items,$codetitles,
+                                             \%cat_titles,\%cat_order)."\n".
+                   '<input type="hidden" name="numtitles" value="'.$numtitles.'" />'."\n".
+                   '<input type="hidden" name="state" value="listing" />'."\n";
+    }
+    return ($output,$jscript,$numtitles);
+}
+
 sub recurse_options {
     my ($currkey,$currlist,$level,$cat,$cat_options,$data,$by_year,$by_sem,$by_dept) = @_;
     if (ref($currlist) eq 'HASH') {




More information about the LON-CAPA-cvs mailing list