--- loncom/interface/lonuserutils.pm	2013/12/09 21:33:32	1.159
+++ loncom/interface/lonuserutils.pm	2014/02/05 18:02:15	1.161
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.159 2013/12/09 21:33:32 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.161 2014/02/05 18:02:15 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -401,7 +401,7 @@ sub javascript_validations {
 
     my $showcredits;
     my %domdefaults = &Apache::lonnet::get_domain_defaults($domain);
-    if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) {
+    if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
         $showcredits = 1;
     }
 
@@ -1013,7 +1013,9 @@ sub print_upload_manager_footer {
                .&Apache::lonhtmlcommon::row_closure();
     }
     if ($context eq 'course' || $context eq 'domain') {
-        $Str .= &forceid_change($context);
+        $Str .= &Apache::lonhtmlcommon::row_title(&mt('Student/Employee ID'))
+               .&forceid_change($context)
+               .&Apache::lonhtmlcommon::row_closure(1); # last row in pick_box
     }
 
     $Str .= &Apache::lonhtmlcommon::end_pick_box();
@@ -1047,10 +1049,12 @@ sub get_defaultcredits {
     return unless(($cdom =~ /^$match_domain$/) && ($cnum =~ /^$match_courseid$/)); 
     my ($defaultcredits,$domdefcredits);
     my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom);
-    if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) {
+    if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
         my $instcode = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'};
         if ($instcode) {
             $domdefcredits = $domdefaults{'officialcredits'};
+        } elsif ($env{'course.'.$cdom.'_'.$cnum.'.internal.textbook'}) {
+            $domdefcredits = $domdefaults{'textbookcredits'};
         } else {
             $domdefcredits = $domdefaults{'unofficialcredits'};
         }
@@ -1076,8 +1080,7 @@ sub get_defaultcredits {
 sub forceid_change {
     my ($context) = @_;
     my $output = 
-        &Apache::lonhtmlcommon::row_title(&mt('Student/Employee ID'))
-       .'<label><input type="checkbox" name="forceid" value="yes" />'
+        '<label><input type="checkbox" name="forceid" value="yes" />'
        .&mt('Disable Student/Employee ID Safeguard and force change of conflicting IDs')
        .'</label><br />'."\n"
        .&mt('(only do if you know what you are doing.)')."\n";
@@ -1087,7 +1090,6 @@ sub forceid_change {
   &mt('Update student/employee ID in courses in which user is active/future student,[_1](if forcing change).','<br />').
                    '</label>'."\n";
     }
-    $output .= &Apache::lonhtmlcommon::row_closure(1); # last row in pick_box
     return $output;
 }