--- loncom/interface/loncreatecourse.pm	2013/12/17 14:28:36	1.151
+++ loncom/interface/loncreatecourse.pm	2014/01/29 19:01:27	1.155
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.151 2013/12/17 14:28:36 raeburn Exp $
+# $Id: loncreatecourse.pm,v 1.155 2014/01/29 19:01:27 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -160,6 +160,7 @@ function validate(formname) {
                     'crcs' => "Crosslisted courses",
                     'cscs' => "a comma separated list of course sections crosslisted with the current course, with each entry including the institutional course section name followed by a colon and then the (optional) sectionID to be used in LON-CAPA, e.g., fs03ent231001:ent1,fs03bot231001:bot1,fs03zol231002:zol2",
                     'ccre' => "Course credits",
+                    'crcd' => "Create six character course identifier to share with students",
                     'cred' => "the number of institutional credits students will earn by completing this course",
                     'crco' => "Course Content",
                     'cncr' => "Completely new course",
@@ -317,8 +318,8 @@ END
         $r->print(&Apache::lonhtmlcommon::row_headline()
                  .'<h3>'.$lt{'iinf'}.'</h3>'
                  .$lt{'stat'}.' '
-                 .&mt('Default credits can also be specified, if different from the domain defaults (official courses: [_1]; unofficial courses: [_2]).',
-                      $domdefaults{'officialcredits'},$domdefaults{'unofficialcredits'})
+                 .&mt('Default credits can also be specified, if different from the domain defaults (official courses: [_1]; unofficial courses: [_2]; textbook courses: [_3]).',
+                      $domdefaults{'officialcredits'},$domdefaults{'unofficialcredits'},$domdefaults{'textbookcredits'})
                  .&Apache::lonhtmlcommon::row_closure()
 
                  .&Apache::lonhtmlcommon::row_title($lt{'ccod'})
@@ -336,13 +337,19 @@ END
                  .'<br />('.$lt{'cscs'}.')'
                  .&Apache::lonhtmlcommon::row_closure()
         );
-        if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) {
+        if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
             $r->print(&Apache::lonhtmlcommon::row_title($lt{'ccre'})
                      .'<input type="text" size="3" name="defaultcredits" />'
                      .'<br />('.$lt{'cred'}.')'
                      .&Apache::lonhtmlcommon::row_closure()
             );
         }
+        $r->print(&Apache::lonhtmlcommon::row_title($lt{'crcd'})
+                     .'<span class="LC_nobreak">'
+                     .'<input type="radio" name="uniquecode" value="1" />'.&mt('Yes').('&nbsp;'x2)
+                     .'<input type="radio" name="uniquecode" value="0" checked="checked" />'.&mt('No')
+                     .&Apache::lonhtmlcommon::row_closure()
+            );
     }
     # Table: New Course / Clone Course
     $r->print(&Apache::lonhtmlcommon::row_headline()
@@ -649,10 +656,14 @@ sub create_course {
                };
 
     if (($crstype eq 'Course') && 
-        ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'})) {
+        ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'})) {
         $args->{'defaultcredits'} = $env{'form.defaultcredits'};
     }
 
+    if ($env{'form.uniquecode'}) {
+         $args->{'uniquecode'} = 1;
+    }
+
     #
     # Verify data
     #
@@ -681,12 +692,12 @@ sub create_course {
                      ,$env{'form.course_home'}.&Apache::loncommon::end_page()));
         return;
     }
-    my ($courseid,$crsudom,$crsunum);
+    my ($courseid,$crsudom,$crsunum,$code);
     my ($success,$output) = 
 	&Apache::loncommon::construct_course($args,\$logmsg,\$courseid,
 					     \$crsudom,\$crsunum,
 					     $env{'user.domain'},
-					     $env{'user.name'},'dc_create');
+					     $env{'user.name'},'dc_create',undef,undef,\$code);
     $r->print($output);
     if ($success) {
         #
@@ -706,6 +717,11 @@ sub create_course {
 	    $r->print(
 		      '<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>');
 	}
+        if ($code) {
+            $r->print(
+                      '<p>'.&mt('Course identifier to share with students: [_1]',$code).'</p>'
+                     );
+        }
         # Flush the course logs so reverse user roles immediately updated
 	$r->register_cleanup(\&Apache::lonnet::flushcourselogs);
 	$r->print('<p>'.&mt('Roles will be active at next login').'.</p>');
@@ -1142,7 +1158,7 @@ sub creation_display_filter {
                         $typename = $typenames->{$type};
                     }
                 }
-                $output .= '<option value="'.$type.'"'.$selstr.'>'.$typename.'</option>'."\n";
+                $output .= '<option value="'.$type.'"'.$selstr.'>'.&mt($typename).'</option>'."\n";
             }
             $output .= '</select></td>';
         }