[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface courseprefs.pm

raeburn raeburn at source.lon-capa.org
Tue Mar 10 20:28:29 EDT 2015


raeburn		Wed Mar 11 00:28:29 2015 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	courseprefs.pm 
  Log:
  - For 2.11
    - Backport 1.69.
  
  
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.49.2.16 loncom/interface/courseprefs.pm:1.49.2.17
--- loncom/interface/courseprefs.pm:1.49.2.16	Wed Sep 24 04:43:28 2014
+++ loncom/interface/courseprefs.pm	Wed Mar 11 00:28:28 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.49.2.16 2014/09/24 04:43:28 raeburn Exp $
+# $Id: courseprefs.pm,v 1.49.2.17 2015/03/11 00:28:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -463,13 +463,15 @@
                      help => 'Course_Prefs_Display',
                      ordered => ['default_xml_style','pageseparators',
                                  'disable_receipt_display','texengine',
-                                 'tthoptions'],
+                                 'tthoptions','uselcmath','usejsme'],
                       itemtext => {
                           default_xml_style       => 'Default XML style file',
                           pageseparators          => 'Visibly Separate Items on Pages',
                           disable_receipt_display => 'Disable display of problem receipts',
                           texengine               => 'Force use of a specific math rendering engine',
                           tthoptions              => 'Default set of options to pass to tth/m when converting TeX',
+                          uselcmath               => 'Student formula entry uses inline preview, not DragMath pop-up',
+                          usejsme                 => 'Molecule editor uses JSME (HTML5) in place of JME (Java)',
                                   },
                   },
         'grading' =>
@@ -1405,7 +1407,7 @@
                                         $displayval = &Apache::lonlocal::locallocaltime($displayval);
                                     } elsif ($key eq 'categories') {
                                         $displayval = $env{'form.categories_display'};
-                                    } elsif ($key eq 'canuse_pdfforms') {
+                                    } elsif (($key eq 'canuse_pdfforms') || ($key eq 'usejsme') || ($key eq 'uselcmath')) {
                                         if ($changes->{$item}{$key} eq '1') {
                                             $displayval = &mt('Yes');
                                         } elsif ($changes->{$item}{$key} eq '0') {
@@ -3698,6 +3700,14 @@
                    input => 'textbox',
                    size => 40,
                  },
+         'uselcmath' => {
+                   text => '<b>'.&mt($itemtext->{'uselcmath'}).'</b>',
+                   input => 'radio',
+                 },
+         'usejsme'  => {
+                   text => '<b>'.&mt($itemtext->{'usejsme'}).'</b>',
+                   input => 'radio',
+                 },
     );
     return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'appearance');
 }
@@ -3959,20 +3969,30 @@
 }
 
 sub yesno_radio {
-    my ($item,$settings) = @_;
+    my ($item,$settings,$unsetdefault,$valueyes,$valueno) = @_;
     my $itemon = ' ';
     my $itemoff = ' checked="checked" ';
+    if (($valueyes eq '') && ($valueno eq '')) {
+        $valueyes = 'yes';
+        $valueno = '';
+    }
     if (ref($settings) eq 'HASH') {
-        if ($settings->{$item} eq 'yes') {
+        if ($settings->{$item} eq $valueyes) {
             $itemon = $itemoff;
             $itemoff = ' ';
         }
+        unless (exists($settings->{$item})) {
+            if ($unsetdefault eq $valueyes) {
+                $itemon = $itemoff;
+                $itemoff = ' ';
+            }
+        }
     }
     return '<span class="LC_nobreak"><label>'.
            '<input type="radio" name="'.$item.'"'.
-           $itemon.' value="yes" />'.&mt('Yes').'</label> '.
+           $itemon.' value="'.$valueyes.'" />'.&mt('Yes').'</label> '.
            '<label><input type="radio" name="'.$item.'"'.
-           $itemoff.' value="" />'.&mt('No').'</label></span>';
+           $itemoff.' value="'.$valueno.'" />'.&mt('No').'</label></span>';
 }
 
 sub select_from_options {
@@ -4057,7 +4077,16 @@
                    &Apache::lonhtmlcommon::date_setter('display',$item,
                                                        $settings->{$item});
             } elsif ($items->{$item}{input} eq 'radio') {
-                $datatable .= &yesno_radio($item,$settings);
+                my ($unsetdefault,$valueyes,$valueno);
+                if (($item eq 'usejsme') || ($item eq 'uselcmath')) {
+                     my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
+                     unless ($domdefs{$item} eq '0') {
+                         $unsetdefault = 1;
+                     }
+                     $valueyes = "1";
+                     $valueno = "0";
+                }
+                $datatable .= &yesno_radio($item,$settings,$unsetdefault,$valueyes,$valueno);
             } elsif ($items->{$item}{input} eq 'selectbox') {
                 my $curr = $settings->{$item};
                 $datatable .=
@@ -4133,7 +4162,8 @@
                           '<span class="LC_nobreak"><label>'.
                           '<input type="radio" name="'.$item.'_'.$user.'"'.
                           $hideon.' value="" />'.&mt('Hidden').'</label> '.
-                          '<label><input type="radio" name="'.$item.'_'.$user.'"'.                          $hideoff.' value="yes" />'.&mt('Shown').'</label></span></td>'.
+                          '<label><input type="radio" name="'.$item.'_'.$user.'"'.
+                          $hideoff.' value="yes" />'.&mt('Shown').'</label></span></td>'.
                           '</tr>';
         }
         $datatable .= '</table>';




More information about the LON-CAPA-cvs mailing list