--- loncom/interface/loncreateuser.pm	2012/08/21 15:43:27	1.365
+++ loncom/interface/loncreateuser.pm	2013/07/15 16:13:21	1.380
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.365 2012/08/21 15:43:27 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.380 2013/07/15 16:13:21 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -111,77 +111,53 @@ sub initialize_authen_forms {
 
 sub auth_abbrev {
     my %abv_auth = (
-                     krb5     => 'krb',
-                     krb4     => 'krb',
-                     internal => 'int',
-                     localuth => 'loc',
-                     unix     => 'fsys',
+                     krb5      => 'krb',
+                     krb4      => 'krb',
+                     internal  => 'int',
+                     localauth => 'loc',
+                     unix      => 'fsys',
                    );
     return %abv_auth;
 }
 
 # ====================================================
 
-sub portfolio_quota {
+sub user_quotas {
     my ($ccuname,$ccdomain) = @_;
     my %lt = &Apache::lonlocal::texthash(
                    'usrt'      => "User Tools",
-                   'disk'      => "Disk space allocated to user's portfolio files",
                    'cuqu'      => "Current quota",
                    'cust'      => "Custom quota",
                    'defa'      => "Default",
                    'chqu'      => "Change quota",
     );
-    my ($currquota,$quotatype,$inststatus,$defquota) = 
-        &Apache::loncommon::get_user_quota($ccuname,$ccdomain);
-    my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($ccdomain);
-    my ($longinsttype,$showquota,$custom_on,$custom_off,$defaultinfo);
-    if ($inststatus ne '') {
-        if ($usertypes->{$inststatus} ne '') {
-            $longinsttype = $usertypes->{$inststatus};
-        }
-    }
-    $custom_on = ' ';
-    $custom_off = ' checked="checked" ';
+   
     my $quota_javascript = <<"END_SCRIPT";
 <script type="text/javascript">
 // <![CDATA[
-function quota_changes(caller) {
+function quota_changes(caller,context) {
+    var customoff = document.getElementById('custom_'+context+'quota_off');
+    var customon = document.getElementById('custom_'+context+'quota_on');
+    var number = document.getElementById(context+'quota');
     if (caller == "custom") {
-        if (document.cu.customquota[0].checked) {
-            document.cu.portfolioquota.value = "";
+        if (customoff) {
+            if (customoff.checked) {
+                number.value = "";
+            }
         }
     }
     if (caller == "quota") {
-        document.cu.customquota[1].checked = true;
+        if (customon) {
+            customon.checked = true;
+        }
     }
+    return;
 }
 // ]]>
 </script>
 END_SCRIPT
-    if ($quotatype eq 'custom') {
-        $custom_on = $custom_off;
-        $custom_off = ' ';
-        $showquota = $currquota;
-        if ($longinsttype eq '') {
-            $defaultinfo = &mt('For this user, the default quota would be [_1]'
-                            .' Mb.',$defquota);
-        } else {
-            $defaultinfo = &mt("For this user, the default quota would be [_1]".
-                               " Mb, as determined by the user's institutional".
-                               " affiliation ([_2]).",$defquota,$longinsttype);
-        }
-    } else {
-        if ($longinsttype eq '') {
-            $defaultinfo = &mt('For this user, the default quota is [_1]'
-                            .' Mb.',$defquota);
-        } else {
-            $defaultinfo = &mt("For this user, the default quota of [_1]".
-                               " Mb, is determined by the user's institutional".
-                               " affiliation ([_2]).",$defquota,$longinsttype);
-        }
-    }
-
+    my $longinsttype;
+    my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($ccdomain);
     my $output = $quota_javascript."\n".
                  '<h3>'.$lt{'usrt'}.'</h3>'."\n".
                  &Apache::loncommon::start_data_table();
@@ -189,29 +165,71 @@ END_SCRIPT
     if (&Apache::lonnet::allowed('mut',$ccdomain)) {
         $output .= &build_tools_display($ccuname,$ccdomain,'tools');
     }
-    if (&Apache::lonnet::allowed('mpq',$ccdomain)) {
-        $output .= '<tr class="LC_info_row">'."\n".
-                   '    <td>'.$lt{'disk'}.'</td>'."\n".
-                   '  </tr>'."\n".
-                   &Apache::loncommon::start_data_table_row()."\n".
-                   '  <td>'.$lt{'cuqu'}.': '.
-                   $currquota.'&nbsp;Mb.&nbsp;&nbsp;'.
-                   $defaultinfo.'</td>'."\n".
-                   &Apache::loncommon::end_data_table_row()."\n".
-                   &Apache::loncommon::start_data_table_row()."\n".
-                   '  <td><span class="LC_nobreak">'.$lt{'chqu'}.
-                   ': <label>'.
-                   '<input type="radio" name="customquota" value="0" '.
-                   $custom_off.' onchange="javascript:quota_changes('."'custom'".')"'.
-                   ' />'.$lt{'defa'}.'&nbsp;('.$defquota.' Mb).</label>&nbsp;'.
-                   '&nbsp;<label><input type="radio" name="customquota" value="1" '. 
-                   $custom_on.'  onchange="javascript:quota_changes('."'custom'".')" />'.
-                   $lt{'cust'}.':</label>&nbsp;'.
-                   '<input type="text" name="portfolioquota" size ="5" value="'.
-                   $showquota.'" onfocus="javascript:quota_changes('."'quota'".')" '.
-                   '/>&nbsp;Mb</span></td>'."\n".
-                   &Apache::loncommon::end_data_table_row()."\n";
-    }  
+
+    my %titles = &Apache::lonlocal::texthash (
+                    portfolio => "Disk space allocated to user's portfolio files",
+                    author    => "Disk space allocated to user's authoring space (if role assigned)",
+                 );
+    foreach my $name ('portfolio','author') {
+        my ($currquota,$quotatype,$inststatus,$defquota) =
+            &Apache::loncommon::get_user_quota($ccuname,$ccdomain,$name);
+        if ($longinsttype eq '') { 
+            if ($inststatus ne '') {
+                if ($usertypes->{$inststatus} ne '') {
+                    $longinsttype = $usertypes->{$inststatus};
+                }
+            }
+        }
+        my ($showquota,$custom_on,$custom_off,$defaultinfo);
+        $custom_on = ' ';
+        $custom_off = ' checked="checked" ';
+        if ($quotatype eq 'custom') {
+            $custom_on = $custom_off;
+            $custom_off = ' ';
+            $showquota = $currquota;
+            if ($longinsttype eq '') {
+                $defaultinfo = &mt('For this user, the default quota would be [_1]'
+                              .' Mb.',$defquota);
+            } else {
+                $defaultinfo = &mt("For this user, the default quota would be [_1]".
+                                   " Mb, as determined by the user's institutional".
+                                   " affiliation ([_2]).",$defquota,$longinsttype);
+            }
+        } else {
+            if ($longinsttype eq '') {
+                $defaultinfo = &mt('For this user, the default quota is [_1]'
+                              .' Mb.',$defquota);
+            } else {
+                $defaultinfo = &mt("For this user, the default quota of [_1]".
+                                   " Mb, is determined by the user's institutional".
+                                   " affiliation ([_2]).",$defquota,$longinsttype);
+            }
+        }
+
+        if (&Apache::lonnet::allowed('mpq',$ccdomain)) {
+            $output .= '<tr class="LC_info_row">'."\n".
+                       '    <td>'.$titles{$name}.'</td>'."\n".
+                       '  </tr>'."\n".
+                       &Apache::loncommon::start_data_table_row()."\n".
+                       '  <td>'.$lt{'cuqu'}.': '.
+                       $currquota.'&nbsp;Mb.&nbsp;&nbsp;'.
+                       $defaultinfo.'</td>'."\n".
+                       &Apache::loncommon::end_data_table_row()."\n".
+                       &Apache::loncommon::start_data_table_row()."\n".
+                       '  <td><span class="LC_nobreak">'.$lt{'chqu'}.
+                       ': <label>'.
+                       '<input type="radio" name="custom_'.$name.'quota" id="custom_'.$name.'quota_off" '.
+                       'value="0" '.$custom_off.' onchange="javascript:quota_changes('."'custom','$name'".');"'.
+                       ' />'.$lt{'defa'}.'&nbsp;('.$defquota.' Mb).</label>&nbsp;'.
+                       '&nbsp;<label><input type="radio" name="custom_'.$name.'quota" id="custom_'.$name.'quota_on" '.
+                       'value="1" '.$custom_on.'  onchange="javascript:quota_changes('."'custom','$name'".');"'.
+                       ' />'.$lt{'cust'}.':</label>&nbsp;'.
+                       '<input type="text" name="'.$name.'quota" id="'.$name.'quota" size ="5" '.
+                       'value="'.$showquota.'" onfocus="javascript:quota_changes('."'quota','$name'".');"'.
+                       ' />&nbsp;Mb</span></td>'."\n".
+                       &Apache::loncommon::end_data_table_row()."\n";
+        }
+    }
     $output .= &Apache::loncommon::end_data_table();
     return $output;
 }
@@ -970,7 +988,7 @@ ENDSCRIPT
             $r->print('</h3>');
         }
     }
-    $r->print('<form name="usersrchform" method="post">'.
+    $r->print('<form name="usersrchform" method="post" action="">'.
               &Apache::loncommon::start_data_table()."\n".
               &Apache::loncommon::start_data_table_header_row()."\n".
               ' <th> </th>'."\n");
@@ -1042,7 +1060,8 @@ sub print_user_query_page {
 }
 
 sub print_user_modification_page {
-    my ($r,$ccuname,$ccdomain,$srch,$response,$context,$permission,$crstype,$brcrum) = @_;
+    my ($r,$ccuname,$ccdomain,$srch,$response,$context,$permission,$crstype,
+        $brcrum,$showcredits) = @_;
     if (($ccuname eq '') || ($ccdomain eq '')) {
         my $usermsg = &mt('No username and/or domain provided.');
         $env{'form.phase'} = '';
@@ -1133,7 +1152,7 @@ sub print_user_modification_page {
 
     my $groupslist = &Apache::lonuserutils::get_groupslist();
 
-    my $js = &validation_javascript($context,$ccdomain,$pjump_def,
+    my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype,
                                $groupslist,$newuser,$formname,\%loaditem);
     my %breadcrumb_text = &singleuser_breadcrumb($crstype);
     my $helpitem = 'Course_Change_Privileges';
@@ -1176,10 +1195,13 @@ sub print_user_modification_page {
 <input type="hidden" name="pres_type"   value="" />
 <input type="hidden" name="pres_marker" value="" />
 ENDFORMINFO
-    my (%inccourses,$roledom);
+    my (%inccourses,$roledom,$defaultcredits);
     if ($context eq 'course') {
         $inccourses{$env{'request.course.id'}}=1;
         $roledom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        if ($showcredits) {
+            $defaultcredits = &Apache::lonuserutils::get_defaultcredits();
+        }
     } elsif ($context eq 'author') {
         $roledom = $env{'request.role.domain'};
     } elsif ($context eq 'domain') {
@@ -1201,7 +1223,7 @@ ENDFORMINFO
         if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) ||
             (&Apache::lonnet::allowed('mut',$env{'request.role.domain'}))) {
             # Current user has quota or user tools modification privileges
-            $portfolioform = '<br />'.&portfolio_quota($ccuname,$ccdomain);
+            $portfolioform = '<br />'.&user_quotas($ccuname,$ccdomain);
         }
         if (&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) {
             $domroleform = '<br />'.&domainrole_req($ccuname,$ccdomain);
@@ -1319,7 +1341,8 @@ ENDAUTH
         $r->print($portfolioform.$domroleform);
         if ($env{'form.action'} eq 'singlestudent') {
             $r->print(&date_sections_select($context,$newuser,$formname,
-                                            $permission));
+                                            $permission,$crstype,$ccuname,
+                                            $ccdomain,$showcredits));
         }
         $r->print('</div><div class="LC_clear_float_footer"></div>');
     } else { # user already exists
@@ -1376,16 +1399,13 @@ ENDCHANGEUSER
         if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||
             (&Apache::lonnet::allowed('mut',$ccdomain))) {
             # Current user has quota modification privileges
-            $user_text{'quota'} = &portfolio_quota($ccuname,$ccdomain);
+            $user_text{'quota'} = &user_quotas($ccuname,$ccdomain);
         }
         if (!&Apache::lonnet::allowed('mpq',$ccdomain)) {
             if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) {
-                # Get the user's portfolio information
-                my %portq = &Apache::lonnet::get('environment',['portfolioquota'],
-                                                 $ccdomain,$ccuname);
                 my %lt=&Apache::lonlocal::texthash(
-                    'dska'  => "Disk space allocated to user's portfolio files",
-                    'youd'  => "You do not have privileges to modify the portfolio quota for this user.",
+                    'dska'  => "Disk quotas for user's portfolio and authoring space",
+                    'youd'  => "You do not have privileges to modify the portfolio and/or authoring space quotas for this user.",
                     'ichr'  => "If a change is required, contact a domain coordinator for the domain",
                 );
                 $user_text{'quota'} = <<ENDNOPORTPRIV;
@@ -1421,8 +1441,17 @@ ENDNOTOOLSPRIV
             unless ($gotdiv) {
                 $r->print('<div class="LC_left_float">');
             }
-            $r->print(&date_sections_select($context,$newuser,$formname));
-        } 
+            my $credits;
+            if ($showcredits) {
+                $credits = &get_user_credits($ccuname,$ccdomain,$defaultcredits);
+                if ($credits eq '') {
+                    $credits = $defaultcredits;
+                }
+            }
+            $r->print(&date_sections_select($context,$newuser,$formname,
+                                            $permission,$crstype,$ccuname,
+                                            $ccdomain,$showcredits));
+        }
         if ($gotdiv) {
             $r->print('</div><div class="LC_clear_float_footer"></div>');
         }
@@ -1440,7 +1469,7 @@ ENDNOTOOLSPRIV
         }
         $r->print('<br /><input type="button" value="'.$btntxt.'" onclick="setSections(this.form)" />'."\n");
     } else {
-        $r->print('<h3>'.&mt('Add Roles').'</h3>');
+        $r->print('<fieldset><legend>'.&mt('Add Roles').'</legend>');
         my $addrolesdisplay = 0;
         if ($context eq 'domain' || $context eq 'author') {
             $addrolesdisplay = &new_coauthor_roles($r,$ccuname,$ccdomain);
@@ -1450,23 +1479,23 @@ ENDNOTOOLSPRIV
             if (!$addrolesdisplay) {
                 $addrolesdisplay = $add_domainroles;
             }
-            $r->print(&course_level_dc($env{'request.role.domain'},'Course'));
-            $r->print('<br /><input type="button" value="'.&mt('Save').'" onclick="setCourse()" />'."\n");
+            $r->print(&course_level_dc($env{'request.role.domain'},$showcredits));
+            $r->print('</fieldset><br /><input type="button" value="'.&mt('Save').'" onclick="setCourse()" />'."\n");
         } elsif ($context eq 'author') {
             if ($addrolesdisplay) {
-                $r->print('<br /><input type="button" value="'.&mt('Save').'"');
+                $r->print('</fieldset><br /><input type="button" value="'.&mt('Save').'"');
                 if ($newuser) {
                     $r->print(' onclick="auth_check()" \>'."\n");
                 } else {
                     $r->print('onclick="this.form.submit()" \>'."\n");
                 }
             } else {
-                $r->print('<br /><a href="javascript:backPage(document.cu)">'.
+                $r->print('</fieldset><br /><a href="javascript:backPage(document.cu)">'.
                           &mt('Back to previous page').'</a>');
             }
         } else {
-            $r->print(&course_level_table(%inccourses));
-            $r->print('<br /><input type="button" value="'.&mt('Save').'" onclick="setSections(this.form)" />'."\n");
+            $r->print(&course_level_table(\%inccourses,$showcredits,$defaultcredits));
+            $r->print('</fieldset><br /><input type="button" value="'.&mt('Save').'" onclick="setSections(this.form)" />'."\n");
         }
     }
     $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));
@@ -1495,22 +1524,32 @@ sub singleuser_breadcrumb {
 }
 
 sub date_sections_select {
-    my ($context,$newuser,$formname,$permission) = @_;
+    my ($context,$newuser,$formname,$permission,$crstype,$ccuname,$ccdomain,
+        $showcredits) = @_;
+    my $credits;
+    if ($showcredits) {
+        my $defaultcredits = &Apache::lonuserutils::get_defaultcredits();
+        $credits = &get_user_credits($ccuname,$ccdomain,$defaultcredits);
+        if ($credits eq '') {
+            $credits = $defaultcredits;
+        }
+    }
     my $cid = $env{'request.course.id'};
     my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity($cid);
     my $date_table = '<h3>'.&mt('Starting and Ending Dates').'</h3>'."\n".
         &Apache::lonuserutils::date_setting_table(undef,undef,$context,
                                                   undef,$formname,$permission);
     my $rowtitle = 'Section';
-    my $secbox = '<h3>'.&mt('Section').'</h3>'."\n".
+    my $secbox = '<h3>'.&mt('Section and Credits').'</h3>'."\n".
         &Apache::lonuserutils::section_picker($cdom,$cnum,'st',$rowtitle,
-                                              $permission);
+                                              $permission,$context,'',$crstype,
+                                              $showcredits,$credits);
     my $output = $date_table.$secbox;
     return $output;
 }
 
 sub validation_javascript {
-    my ($context,$ccdomain,$pjump_def,$groupslist,$newuser,$formname,
+    my ($context,$ccdomain,$pjump_def,$crstype,$groupslist,$newuser,$formname,
         $loaditem) = @_;
     my $dc_setcourse_code = '';
     my $nondc_setsection_code = '';
@@ -1527,7 +1566,8 @@ sub validation_javascript {
         if ($context eq 'course') {
             $nondc_setsection_code =
                 &Apache::lonuserutils::setsections_javascript($formname,$groupslist,
-                                                              undef,$checkauth);
+                                                              undef,$checkauth,
+                                                              $crstype);
         }
         if ($checkauth) {
             $nondc_setsection_code .= 
@@ -1547,7 +1587,8 @@ sub validation_javascript {
 }
 
 sub display_existing_roles {
-    my ($r,$ccuname,$ccdomain,$inccourses,$context,$roledom,$crstype) = @_;
+    my ($r,$ccuname,$ccdomain,$inccourses,$context,$roledom,$crstype,
+        $showcredits) = @_;
     my $now=time;
     my %lt=&Apache::lonlocal::texthash(
                     'rer'  => "Existing Roles",
@@ -1556,6 +1597,7 @@ sub display_existing_roles {
                     'ren'  => "Re-Enable",
                     'rol'  => "Role",
                     'ext'  => "Extent",
+                    'crd'  => "Credits",
                     'sta'  => "Start",
                     'end'  => "End",
                                        );
@@ -1618,6 +1660,7 @@ sub display_existing_roles {
         my $delallowed=0;
         my $sortkey=$role_code;
         my $class='Unknown';
+        my $credits='';
         if ($area =~ m{^/($match_domain)/($match_courseid)} ) {
             $class='Course';
             my ($coursedom,$coursedir) = ($1,$2);
@@ -1646,6 +1689,15 @@ sub display_existing_roles {
             }
             $sortkey.="\0$coursedir";
             $inccourses->{$cid}=1;
+            if (($showcredits) && ($class eq 'Course') && ($role_code eq 'st')) {
+                my $defaultcredits = $coursedata{'internal.defaultcredits'};
+                $credits =
+                    &get_user_credits($ccuname,$ccdomain,$defaultcredits,
+                                      $coursedom,$coursedir);
+                if ($credits eq '') {
+                    $credits = $defaultcredits;
+                }
+            }
             if ((&Apache::lonnet::allowed('c'.$role_code,$coursedom.'/'.$coursedir)) ||
                 (&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) {
                 $allowed=1;
@@ -1672,7 +1724,7 @@ sub display_existing_roles {
                 }
             }
             if ($area=~m{^/($match_domain)/($match_courseid)/(\w+)}) {
-                $carea.='<br />Section: '.$3;
+                $carea.='<br />'.&mt('Section: [_1]',$3);
                 $sortkey.="\0$3";
                 if (!$allowed) {
                     if ($env{'request.course.sec'} eq $3) {
@@ -1702,7 +1754,7 @@ sub display_existing_roles {
                 }
             }
             if ($role_code eq 'ca' || $role_code eq 'au' || $role_code eq 'aa') {
-                $class='Construction Space';
+                $class='Authoring Space';
             } elsif ($role_code eq 'su') {
                 $class='System';
             } else {
@@ -1744,7 +1796,13 @@ sub display_existing_roles {
         }
         my $plaintext='';
         if (!$croletitle) {
-            $plaintext=&Apache::lonnet::plaintext($role_code,$class)
+            $plaintext=&Apache::lonnet::plaintext($role_code,$class);
+            if (($showcredits) && ($credits ne '')) {
+                $plaintext .= '<br/ ><span class="LC_nobreak">'.
+                              '<span class="LC_fontsize_small">'.
+                              &mt('Credits: [_1]',$credits).
+                              '</span></span>';
+            }
         } else {
             $plaintext=
                 &mt('Customrole [_1][_2]defined by [_3]',
@@ -1767,7 +1825,7 @@ sub display_existing_roles {
 
     my $rolesdisplay = 0;
     my %output = ();
-    foreach my $type ('Construction Space','Course','Community','Domain','System','Unknown') {
+    foreach my $type ('Authoring Space','Course','Community','Domain','System','Unknown') {
         $output{$type} = '';
         foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
             if ( ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/ ) && ($rolepriv{$sortrole{$which}}) ) {
@@ -1793,25 +1851,25 @@ sub display_existing_roles {
                 $contextrole = &mt('Existing Roles in this Course');
             }
         } elsif ($env{'request.role'} =~ /^au\./) {
-            $contextrole = &mt('Existing Co-Author Roles in your Construction Space');
+            $contextrole = &mt('Existing Co-Author Roles in your Authoring Space');
         } else {
             $contextrole = &mt('Existing Roles in this Domain');
         }
-        $r->print('
-<h3>'.$lt{'rer'}.'</h3>'.
-'<div>'.$contextrole.'</div>'.
+        $r->print('<div>'.
+'<fieldset><legend>'.$contextrole.'</legend>'.
 &Apache::loncommon::start_data_table("LC_createuser").
 &Apache::loncommon::start_data_table_header_row().
 '<th>'.$lt{'rev'}.'</th><th>'.$lt{'ren'}.'</th><th>'.$lt{'del'}.
 '</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'ext'}.
 '</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.
 &Apache::loncommon::end_data_table_header_row());
-        foreach my $type ('Construction Space','Course','Community','Domain','System','Unknown') {
+        foreach my $type ('Authoring Space','Course','Community','Domain','System','Unknown') {
             if ($output{$type}) {
                 $r->print($output{$type}."\n");
             }
         }
-        $r->print(&Apache::loncommon::end_data_table());
+        $r->print(&Apache::loncommon::end_data_table().
+                  '</fieldset></div>');
     }
     return;
 }
@@ -1830,7 +1888,7 @@ sub new_coauthor_roles {
         my $cuname=$env{'user.name'};
         my $cudom=$env{'request.role.domain'};
         my %lt=&Apache::lonlocal::texthash(
-                    'cs'   => "Construction Space",
+                    'cs'   => "Authoring Space",
                     'act'  => "Activate",
                     'rol'  => "Role",
                     'ext'  => "Extent",
@@ -1881,7 +1939,7 @@ sub new_coauthor_roles {
                       '</span>');
         } elsif (($env{'user.name'} eq $ccuname) &&
              ($env{'user.domain'} eq $ccdomain)) {
-            $r->print(&mt('Assigning yourself a co-author or assistant co-author role in your own author area in Construction Space is not permitted'));
+            $r->print(&mt('Assigning yourself a co-author or assistant co-author role in your own author area in Authoring Space is not permitted'));
         }
     }
     return $addrolesdisplay;;
@@ -2314,7 +2372,7 @@ sub get_inststatuses {
 
 # ================================================================= Phase Three
 sub update_user_data {
-    my ($r,$context,$crstype,$brcrum) = @_; 
+    my ($r,$context,$crstype,$brcrum,$showcredits) = @_; 
     my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'},
                                           $env{'form.ccdomain'});
     # Error messages
@@ -2432,13 +2490,14 @@ sub update_user_data {
         # If they are creating a new user but have not specified login
         # information this will be caught below.
     } else {
-	    $r->print($error.&mt('Invalid login mode or password').$end.$rtnlink);    
-	    return;
+            $r->print($error.&mt('Invalid login mode or password').$end.$rtnlink);
+            return;
     }
 
     $r->print('<h3>'.&mt('User [_1] in domain [_2]',
-			 $env{'form.ccuname'}, $env{'form.ccdomain'}).'</h3>');
-    $r->print('<p class="LC_info">'.&mt('Please be patient').'</p>');
+                        $env{'form.ccuname'}.' ('.&Apache::loncommon::plainname($env{'form.ccuname'},
+                        $env{'form.ccdomain'}).')', $env{'form.ccdomain'}).'</h3>');
+    my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,2);
 
     my (%alerts,%rulematch,%inst_results,%curr_rules);
     my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
@@ -2499,6 +2558,7 @@ sub update_user_data {
                 }
             }
         }
+        &Apache::lonhtmlcommon::Increment_PrgWin($r, \%prog_state);
 	# Call modifyuser
 	my $result = &Apache::lonnet::modifyuser
 	    ($env{'form.ccdomain'},$env{'form.ccuname'},$env{'form.cid'},
@@ -2512,14 +2572,18 @@ sub update_user_data {
         my (%changeHash,%newcustom,%changed,%changedinfo);
         if ($uhome ne 'no_host') {
             if ($context eq 'domain') {
-                if ($env{'form.customquota'} == 1) {
-                    if ($env{'form.portfolioquota'} eq '') {
-                        $newcustom{'quota'} = 0;
-                    } else {
-                        $newcustom{'quota'} = $env{'form.portfolioquota'};
-                        $newcustom{'quota'} =~ s/[^\d\.]//g;
+                foreach my $name ('portfolio','author') {
+                    if ($env{'form.custom_'.$name.'quota'} == 1) {
+                        if ($env{'form.'.$name.'quota'} eq '') {
+                            $newcustom{$name.'quota'} = 0;
+                        } else {
+                            $newcustom{$name.'quota'} = $env{'form.'.$name.'quota'};
+                            $newcustom{$name.'quota'} =~ s/[^\d\.]//g;
+                        }
+                        if (&quota_admin($newcustom{$name.'quota'},\%changeHash,$name)) {
+                            $changed{$name.'quota'} = 1;
+                        }
                     }
-                    $changed{'quota'} = &quota_admin($newcustom{'quota'},\%changeHash);
                 }
                 foreach my $item (@usertools) {
                     if ($env{'form.custom'.$item} == 1) {
@@ -2588,21 +2652,24 @@ sub update_user_data {
 	    $r->print($error.&mt('You do not have the authority to modify this users authentification information').'.'.$end);    
 	}
     }
-
     $r->rflush(); # Finish display of header before time consuming actions start
-
+    &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state);
     ##
-    my (@userroles,%userupdate,$cnum,$cdom,%namechanged);
+    my (@userroles,%userupdate,$cnum,$cdom,$defaultcredits,%namechanged);
     if ($context eq 'course') {
-        ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
+        ($cnum,$cdom) =
+            &Apache::lonuserutils::get_course_identity();
         $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
+        if ($showcredits) {
+           $defaultcredits = &Apache::lonuserutils::get_defaultcredits($cdom,$cnum);
+        }
     }
     if (! $env{'form.makeuser'} ) {
         # Check for need to change
         my %userenv = &Apache::lonnet::get
             ('environment',['firstname','middlename','lastname','generation',
-             'id','permanentemail','portfolioquota','inststatus','tools.aboutme',
-             'tools.blog','tools.webdav','tools.portfolio',
+             'id','permanentemail','portfolioquota','authorquota','inststatus',
+             'tools.aboutme','tools.blog','tools.webdav','tools.portfolio',
              'requestcourses.official','requestcourses.unofficial',
              'requestcourses.community','reqcrsotherdom.official',
              'reqcrsotherdom.unofficial','reqcrsotherdom.community',
@@ -2728,10 +2795,10 @@ sub update_user_data {
                 }
             }
         }
-        my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus,
-            $newinststatus,$oldisdefault,$newisdefault,%oldsettings,
+        my (%quotachanged,%oldquota,%newquota,%olddefquota,%newdefquota, 
+            $oldinststatus,$newinststatus,%oldisdefault,%newisdefault,%oldsettings,
             %oldsettingstext,%newsettings,%newsettingstext,@disporder,
-            $olddefquota,$oldsettingstatus,$newdefquota,$newsettingstatus);
+            %oldsettingstatus,%newsettingstatus);
         @disporder = ('inststatus');
         if ($env{'request.role.domain'} eq $env{'form.ccdomain'}) {
             push(@disporder,'requestcourses','requestauthor');
@@ -2740,9 +2807,11 @@ sub update_user_data {
         }
         push(@disporder,('quota','tools'));
         $oldinststatus = $userenv{'inststatus'};
-        ($olddefquota,$oldsettingstatus) = 
-            &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus);
-        ($newdefquota,$newsettingstatus) = ($olddefquota,$oldsettingstatus);
+        foreach my $name ('portfolio','author') {
+            ($olddefquota{$name},$oldsettingstatus{$name}) = 
+                &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus,$name);
+            ($newdefquota{$name},$newsettingstatus{$name}) = ($olddefquota{$name},$oldsettingstatus{$name});
+        }
         my %canshow;
         if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
             $canshow{'quota'} = 1;
@@ -2781,8 +2850,10 @@ sub update_user_data {
                     $changeHash{'inststatus'} = $newinststatus;
                     if ($newinststatus ne $oldinststatus) {
                         $changed{'inststatus'} = $newinststatus;
-                        ($newdefquota,$newsettingstatus) =
-                            &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus);
+                        foreach my $name ('portfolio','author') {
+                            ($newdefquota{$name},$newsettingstatus{$name}) =
+                                &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus,$name);
+                        }
                     }
                     if (ref($usertypes) eq 'HASH') {
                         $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses)); 
@@ -2796,54 +2867,66 @@ sub update_user_data {
                 $newsettings{'inststatus'} = $othertitle;
                 if ($newinststatus ne $oldinststatus) {
                     $changed{'inststatus'} = $changeHash{'inststatus'};
-                    ($newdefquota,$newsettingstatus) =
-                        &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus);
+                    foreach my $name ('portfolio','author') {
+                        ($newdefquota{$name},$newsettingstatus{$name}) =
+                            &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus,$name);
+                    }
                 }
             }
         } elsif ($context ne 'selfcreate') {
             $canshow{'inststatus'} = 1;
             $newsettings{'inststatus'} = $oldsettings{'inststatus'};
         }
-        $changeHash{'portfolioquota'} = $userenv{'portfolioquota'};
+        foreach my $name ('portfolio','author') {
+            $changeHash{$name.'quota'} = $userenv{$name.'quota'};
+        }
         if ($context eq 'domain') {
-            if ($userenv{'portfolioquota'} ne '') {
-                $oldportfolioquota = $userenv{'portfolioquota'};
-                if ($env{'form.customquota'} == 1) {
-                    if ($env{'form.portfolioquota'} eq '') {
-                        $newportfolioquota = 0;
+            foreach my $name ('portfolio','author') {
+                if ($userenv{$name.'quota'} ne '') {
+                    $oldquota{$name} = $userenv{$name.'quota'};
+                    if ($env{'form.custom_'.$name.'quota'} == 1) {
+                        if ($env{'form.'.$name.'quota'} eq '') {
+                            $newquota{$name} = 0;
+                        } else {
+                            $newquota{$name} = $env{'form.'.$name.'quota'};
+                            $newquota{$name} =~ s/[^\d\.]//g;
+                        }
+                        if ($newquota{$name} != $oldquota{$name}) {
+                            if (&quota_admin($newquota{$name},\%changeHash,$name)) {
+                                $changed{$name.'quota'} = 1;
+                            }
+                        }
                     } else {
-                        $newportfolioquota = $env{'form.portfolioquota'};
-                        $newportfolioquota =~ s/[^\d\.]//g;
-                    }
-                    if ($newportfolioquota != $oldportfolioquota) {
-                        $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
+                        if (&quota_admin('',\%changeHash,$name)) {
+                            $changed{$name.'quota'} = 1;
+                            $newquota{$name} = $newdefquota{$name};
+                            $newisdefault{$name} = 1;
+                        }
                     }
                 } else {
-                    $changed{'quota'} = &quota_admin('',\%changeHash);
-                    $newportfolioquota = $newdefquota;
-                    $newisdefault = 1;
-                }
-            } else {
-                $oldisdefault = 1;
-                $oldportfolioquota = $olddefquota;
-                if ($env{'form.customquota'} == 1) {
-                    if ($env{'form.portfolioquota'} eq '') {
-                        $newportfolioquota = 0;
+                    $oldisdefault{$name} = 1;
+                    $oldquota{$name} = $olddefquota{$name};
+                    if ($env{'form.custom_'.$name.'quota'} == 1) {
+                        if ($env{'form.'.$name.'quota'} eq '') {
+                            $newquota{$name} = 0;
+                        } else {
+                            $newquota{$name} = $env{'form.'.$name.'quota'};
+                            $newquota{$name} =~ s/[^\d\.]//g;
+                        }
+                        if (&quota_admin($newquota{$name},\%changeHash,$name)) {
+                            $changed{$name.'quota'} = 1;
+                        }
                     } else {
-                        $newportfolioquota = $env{'form.portfolioquota'};
-                        $newportfolioquota =~ s/[^\d\.]//g;
+                        $newquota{$name} = $newdefquota{$name};
+                        $newisdefault{$name} = 1;
                     }
-                    $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
-                } else {
-                    $newportfolioquota = $newdefquota;
-                    $newisdefault = 1;
                 }
-            }
-            if ($oldisdefault) {
-                $oldsettingstext{'quota'} = &get_defaultquota_text($oldsettingstatus);
-            }
-            if ($newisdefault) {
-                $newsettingstext{'quota'} = &get_defaultquota_text($newsettingstatus);
+                if ($oldisdefault{$name}) {
+                    $oldsettingstext{'quota'}{$name} = &get_defaultquota_text($oldsettingstatus{$name});
+                }
+                if ($newisdefault{$name}) {
+                    $newsettingstext{'quota'}{$name} = &get_defaultquota_text($newsettingstatus{$name});
+                }
             }
             &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv,
                           \%changeHash,\%changed,\%newsettings,\%newsettingstext);
@@ -2861,8 +2944,10 @@ sub update_user_data {
                 $namechanged{$item} = 1;
             }
         }
-        $oldsettings{'quota'} = $oldportfolioquota.' Mb';
-        $newsettings{'quota'} = $newportfolioquota.' Mb';
+        foreach my $name ('portfolio','author') {
+            $oldsettings{'quota'}{$name} = $oldquota{$name}.' Mb';
+            $newsettings{'quota'}{$name} = $newquota{$name}.' Mb';
+        }
         if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) {
             my ($chgresult,$namechgresult);
             if (keys(%changed) > 0) {
@@ -2902,7 +2987,8 @@ sub update_user_data {
                                         $changeHash{'tools.'.$key};
                                 } else {
                                     $newenvhash{'environment.availabletools.'.$key} =
-          &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},                                            $key,'reload','tools');
+          &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
+          $key,'reload','tools');
                                 }
                             }
                         }
@@ -3005,8 +3091,10 @@ sub update_user_data {
                   .&Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules)
                   .'</span>');
     }
+    &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
     if ($env{'form.action'} eq 'singlestudent') {
-        &enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context,$crstype);
+        &enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context,
+                               $crstype,$showcredits,$defaultcredits);
         $r->print('<p><a href="javascript:backPage(document.userupdate)">');
         if ($crstype eq 'Community') {
             $r->print(&mt('Enroll Another Member'));
@@ -3015,7 +3103,7 @@ sub update_user_data {
         }
         $r->print('</a></p>');
     } else {
-        my @rolechanges = &update_roles($r,$context);
+        my @rolechanges = &update_roles($r,$context,$showcredits);
         if (keys(%namechanged) > 0) {
             if ($context eq 'course') {
                 if (@userroles > 0) {
@@ -3036,10 +3124,9 @@ sub update_user_data {
         if ($env{'form.popup'}) {
             $r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a></p>');
         } else {
-            $r->print('<p><a href="javascript:backPage(document.userupdate,'."'$env{'form.prevphase'}','modify'".')">'
-                     .&mt('Modify this user: [_1]','<span class="LC_cusr_emph">'.$env{'form.ccuname'}.':'.$env{'form.ccdomain'}.' ('.$userinfo.')</span>').'</a>'
-                     .('&nbsp;'x5).'<a href="javascript:backPage(document.userupdate)">'
-                     .&mt('Create/Modify Another User').'</a></p>');
+            $r->print('<br />'.&Apache::lonhtmlcommon::actionbox(['<a href="javascript:backPage(document.userupdate,'."'$env{'form.prevphase'}','modify'".')">'
+                     .&mt('Modify this user: [_1]','<span class="LC_cusr_emph">'.$env{'form.ccuname'}.':'.$env{'form.ccdomain'}.' ('.$userinfo.')</span>').'</a>',
+                     '<a href="javascript:backPage(document.userupdate)">'.&mt('Create/Modify Another User').'</a>']));
         }
     }
 }
@@ -3060,7 +3147,7 @@ sub display_userinfo {
                    ref($newsetting) eq 'HASH' &&
                    ref($newsettingtext) eq 'HASH');
     my %lt=&Apache::lonlocal::texthash(
-         'ui'             => 'User Information (unchanged)',
+         'ui'             => 'User Information',
          'uic'            => 'User Information Changed',
          'firstname'      => 'First Name',
          'middlename'     => 'Middle Name',
@@ -3068,7 +3155,8 @@ sub display_userinfo {
          'generation'     => 'Generation',
          'id'             => 'Student/Employee ID',
          'permanentemail' => 'Permanent e-mail address',
-         'quota'          => 'Disk space allocated to portfolio files',
+         'portfolioquota' => 'Disk space allocated to portfolio files',
+         'authorquota'    => 'Disk space allocated to authoring space',
          'blog'           => 'Blog Availability',
          'webdav'         => 'WebDAV Availability',
          'aboutme'        => 'Personal Information Page Availability',
@@ -3081,73 +3169,37 @@ sub display_userinfo {
          'prvs'           => 'Previous Value:',
          'chto'           => 'Changed To:'
     );
-    my $title = $lt{'ui'}; 
-    if ($changed) {
-        $title = $lt{'uic'};
-    }
-    $r->print('<h4>'.$title.'</h4>'.
-              &Apache::loncommon::start_data_table().
-              &Apache::loncommon::start_data_table_header_row());
     if ($changed) {
+        $r->print('<h3>'.$lt{'uic'}.'</h3>'.
+                &Apache::loncommon::start_data_table().
+                &Apache::loncommon::start_data_table_header_row());
         $r->print("<th>&nbsp;</th>\n");
-    }
-    my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
-    foreach my $item (@userinfo) {
-        $r->print("<th>$lt{$item}</th>\n");
-    }
-    foreach my $entry (@{$order}) {
-        if ($canshow->{$entry}) {
-            if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
-                foreach my $item (@{$requestcourses}) {
-                    $r->print("<th>$lt{$item}</th>\n");
-                }
-            } elsif ($entry eq 'tools') {
-                foreach my $item (@{$usertools}) {
-                    $r->print("<th>$lt{$item}</th>\n");
-                }
-            } else {
-                $r->print("<th>$lt{$entry}</th>\n");
-            }
-        }
-    }
-    $r->print(&Apache::loncommon::end_data_table_header_row().
-             &Apache::loncommon::start_data_table_row());
-    if ($changed) {
-        $r->print('<td><b>'.$lt{'prvs'}.'</b></td>'."\n");
-    }
-    foreach my $item (@userinfo) {
-        $r->print('<td>'.$userenv->{$item}.' </td>'."\n");
-    }
-    foreach my $entry (@{$order}) {
-        if ($canshow->{$entry}) {
-            if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
-                foreach my $item (@{$requestcourses}) {
-                    $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");
-                }
-            } elsif ($entry eq 'tools') {
-                foreach my $item (@{$usertools}) {
-                    $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");
-                }
-            } else {
-                $r->print("<td>$oldsetting->{$entry} $oldsettingtext->{$entry} </td>\n");
-            }
-        }
-    }
-    $r->print(&Apache::loncommon::end_data_table_row());
-    if ($changed) {
-        $r->print(&Apache::loncommon::start_data_table_row().
-                  '<td><span class="LC_nobreak"><b>'.$lt{'chto'}.'</b></span></td>'."\n");
+        $r->print('<th><b>'.$lt{'prvs'}.'</b></th>');
+        $r->print('<th><span class="LC_nobreak"><b>'.$lt{'chto'}.'</b></span></th>');
+        $r->print(&Apache::loncommon::end_data_table_header_row());
+        my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
+        
+
         foreach my $item (@userinfo) {
             my $value = $env{'form.c'.$item};
-            if ($namechangedhash->{$item}) {
-                $value = '<span class="LC_cusr_emph">'.$value.'</span>';
+            #show changes only:
+            unless($value eq $userenv->{$item}){
+                $r->print(&Apache::loncommon::start_data_table_row());
+
+                $r->print("<td>$lt{$item}</td>\n");
+                $r->print('<td>'.$userenv->{$item}.' </td>');
+                $r->print("<td>$value </td>\n");
+
+                $r->print(&Apache::loncommon::end_data_table_row());
             }
-            $r->print("<td>$value </td>\n");
         }
         foreach my $entry (@{$order}) {
-            if ($canshow->{$entry}) {
+            if ($canshow->{$entry} && ($newsetting->{$entry} ne $newsetting->{$entry})) {
+                $r->print(&Apache::loncommon::start_data_table_row());
                 if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
                     foreach my $item (@{$requestcourses}) {
+                        $r->print("<td>$lt{$item}</td>\n");
+                        $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");
                         my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};
                         if ($changedhash->{$item}) {
                             $value = '<span class="LC_cusr_emph">'.$value.'</span>';
@@ -3156,24 +3208,44 @@ sub display_userinfo {
                     }
                 } elsif ($entry eq 'tools') {
                     foreach my $item (@{$usertools}) {
+                        $r->print("<td>$lt{$item}</td>\n");
+                        $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");
                         my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};
                         if ($changedhash->{$item}) {
                             $value = '<span class="LC_cusr_emph">'.$value.'</span>';
                         }
                         $r->print("<td>$value </td>\n");
                     }
+                } elsif ($entry eq 'quota') {
+                    if ((ref($oldsetting->{$entry}) eq 'HASH') && (ref($oldsettingtext->{$entry}) eq 'HASH') &&
+                        (ref($newsetting->{$entry}) eq 'HASH') && (ref($newsettingtext->{$entry}) eq 'HASH')) {
+                        foreach my $name ('portfolio','author') {
+                            $r->print("<td>$lt{$name.$entry}</td>\n");
+                            $r->print("<td>$oldsetting->{$entry}->{$name} $oldsettingtext->{$entry}->{$name} </td>\n");
+                            my $value = $newsetting->{$entry}->{$name}.' '.$newsettingtext->{$entry}->{$name};
+                            if ($changedhash->{$entry}) {
+                                $value = '<span class="LC_cusr_emph">'.$value.'</span>';
+                            }
+                             $r->print("<td>$value </td>\n");
+                        }
+                    }
                 } else {
+                    $r->print("<td>$lt{$entry}</td>\n");
+                    $r->print("<td>$oldsetting->{$entry} $oldsettingtext->{$entry} </td>\n");
                     my $value = $newsetting->{$entry}.' '.$newsettingtext->{$entry};
                     if ($changedhash->{$entry}) {
                         $value = '<span class="LC_cusr_emph">'.$value.'</span>';
                     }
                     $r->print("<td>$value </td>\n");
                 }
+                $r->print(&Apache::loncommon::end_data_table_row());
             }
         }
-        $r->print(&Apache::loncommon::end_data_table_row());
+        $r->print(&Apache::loncommon::end_data_table().'<br />');
+    } else {
+        $r->print('<h3>'.$lt{'ui'}.'</h3>'.
+                  '<p>'.&mt('No changes made to user information').'</p>');
     }
-    $r->print(&Apache::loncommon::end_data_table().'<br />');
     return;
 }
 
@@ -3353,7 +3425,7 @@ sub tool_changes {
 }
 
 sub update_roles {
-    my ($r,$context) = @_;
+    my ($r,$context,$showcredits) = @_;
     my $now=time;
     my @rolechanges;
     my %disallowed;
@@ -3370,14 +3442,20 @@ sub update_roles {
 		    &Apache::lonnet::revokerole($env{'form.ccdomain'},
 						$env{'form.ccuname'},
 						$scope,$role,'','',$context);
-	        $r->print(&mt('Revoking [_1] in [_2]: [_3]',
-			      $role,$scope,'<b>'.$result.'</b>').'<br />');
+                $r->print(&Apache::lonhtmlcommon::confirm_success(
+                            &mt('Revoking [_1] in [_2]',
+                                &Apache::lonnet::plaintext($role),
+                                &Apache::loncommon::show_role_extent($scope,$context,$role)),
+                                $result ne "ok").'<br />');
+                if ($result ne "ok") {
+                    $r->print(&mt('Error: [_1]',$result).'<br />');
+                }
 		if ($role eq 'st') {
 		    my $result = 
                         &Apache::lonuserutils::classlist_drop($scope,
                             $env{'form.ccuname'},$env{'form.ccdomain'},
 			    $now);
-		    $r->print($result);
+                    $r->print(&Apache::lonhtmlcommon::confirm_success($result));
 		}
                 if (!grep(/^\Q$role\E$/,@rolechanges)) {
                     push(@rolechanges,$role);
@@ -3385,11 +3463,15 @@ sub update_roles {
 	    }
 	    if ($key=~m{^form\.rev\:([^_]+)_cr\.cr/($match_domain)/($match_username)/(\w+)$}s) {
 # Revoke custom role
-		$r->print(&mt('Revoking custom role:').
-                      ' '.$4.' by '.$3.':'.$2.' in '.$1.': <b>'.
-                      &Apache::lonnet::revokecustomrole($env{'form.ccdomain'},
-				  $env{'form.ccuname'},$1,$2,$3,$4,'','',$context).
-		'</b><br />');
+                my $result = &Apache::lonnet::revokecustomrole(
+                    $env{'form.ccdomain'},$env{'form.ccuname'},$1,$2,$3,$4,'','',$context);
+                $r->print(&Apache::lonhtmlcommon::confirm_success(
+                            &mt('Revoking custom role [_1] by [_2] in [_3]',
+                                $4,$3.':'.$2,&Apache::loncommon::show_role_extent($1,$context,'cr')),
+                            $result ne 'ok').'<br />');
+                if ($result ne "ok") {
+                    $r->print(&mt('Error: [_1]',$result).'<br />');
+                }
                 if (!grep(/^cr$/,@rolechanges)) {
                     push(@rolechanges,'cr');
                 }
@@ -3403,14 +3485,21 @@ sub update_roles {
 						$env{'form.ccuname'},
 						$scope,$role,$now,0,1,'',
                                                 $context);
-	        $r->print(&mt('Deleting [_1] in [_2]: [_3]',$role,$scope,
-			      '<b>'.$result.'</b>').'<br />');
+                $r->print(&Apache::lonhtmlcommon::confirm_success(
+                            &mt('Deleting [_1] in [_2]',
+                                &Apache::lonnet::plaintext($role),
+                                &Apache::loncommon::show_role_extent($scope,$context,$role)),
+                            $result ne 'ok').'<br />');
+                if ($result ne "ok") {
+                    $r->print(&mt('Error: [_1]',$result).'<br />');
+                }
+
 		if ($role eq 'st') {
 		    my $result = 
                         &Apache::lonuserutils::classlist_drop($scope,
                             $env{'form.ccuname'},$env{'form.ccdomain'},
 			    $now);
-		    $r->print($result);
+		    $r->print(&Apache::lonhtmlcommon::confirm_success($result));
 		}
                 if (!grep(/^\Q$role\E$/,@rolechanges)) {
                     push(@rolechanges,$role);
@@ -3419,11 +3508,17 @@ sub update_roles {
 	    if ($key=~m{^form\.del\:([^_]+)_cr\.cr/($match_domain)/($match_username)/(\w+)$}) {
                 my ($url,$rdom,$rnam,$rolename) = ($1,$2,$3,$4);
 # Delete custom role
-                $r->print(&mt('Deleting custom role [_1] by [_2] in [_3]',
-                      $rolename,$rnam.':'.$rdom,$url).': <b>'.
-                      &Apache::lonnet::assigncustomrole($env{'form.ccdomain'},
-                         $env{'form.ccuname'},$url,$rdom,$rnam,$rolename,$now,
-                         0,1,$context).'</b><br />');
+                my $result =
+                    &Apache::lonnet::assigncustomrole($env{'form.ccdomain'},
+                        $env{'form.ccuname'},$url,$rdom,$rnam,$rolename,$now,
+                        0,1,$context);
+                $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Deleting custom role [_1] by [_2] in [_3]',
+                      $rolename,$rnam.':'.$rdom,&Apache::loncommon::show_role_extent($1,$context,'cr')),
+                      $result ne "ok").'<br />');
+                if ($result ne "ok") {
+                    $r->print(&mt('Error: [_1]',$result).'<br />');
+                }
+
                 if (!grep(/^cr$/,@rolechanges)) {
                     push(@rolechanges,'cr');
                 }
@@ -3439,27 +3534,38 @@ sub update_roles {
                 my $output;
                 if ($role eq 'st') {
                     if ($url =~ m-^/($match_domain)/($match_courseid)/?(\w*)$-) {
-                        my $result = &Apache::loncommon::commit_studentrole(\$logmsg,$udom,$uname,$url,$role,$now,0,$1,$2,$3);
+                        my ($cdom,$cnum,$csec) = ($1,$2,$3);
+                        my $credits;
+                        if ($showcredits) {
+                            my $defaultcredits = 
+                                &Apache::lonuserutils::get_defaultcredits($cdom,$cnum);
+                            $credits = &get_user_credits($defaultcredits,$cdom,$cnum);
+                        }
+                        my $result = &Apache::loncommon::commit_studentrole(\$logmsg,$udom,$uname,$url,$role,$now,0,$cdom,$cnum,$csec,$context,$credits);
                         if (($result =~ /^error/) || ($result eq 'not_in_class') || ($result eq 'unknown_course') || ($result eq 'refused')) {
                             if ($result eq 'refused' && $logmsg) {
                                 $output = $logmsg;
                             } else { 
-                                $output = "Error: $result\n";
+                                $output = &mt('Error: [_1]',$result)."\n";
                             }
                         } else {
-                            $output = &mt('Assigning').' '.$role.' in '.$url.
-                                      &mt('starting').' '.localtime($now).
-                                      ': <br />'.$logmsg.'<br />'.
-                                      &mt('Add to classlist').': <b>ok</b><br />';
+                            $output = &Apache::lonhtmlcommon::confirm_success(&mt('Assigning [_1] in [_2] starting [_3]',
+                                        &Apache::lonnet::plaintext($role),
+                                        &Apache::loncommon::show_role_extent($url,$context,'st'),
+                                        &Apache::lonlocal::locallocaltime($now))).'<br />'.$logmsg.'<br />';
                         }
                     }
                 } else {
 		    my $result=&Apache::lonnet::assignrole($env{'form.ccdomain'},
                                $env{'form.ccuname'},$url,$role,0,$now,'','',
                                $context);
-		    $output = &mt('Re-enabling [_1] in [_2]: [_3]',
-			      $role,$url,'<b>'.$result.'</b>').'<br />';
-		}
+                        $output = &Apache::lonhtmlcommon::confirm_success(&mt('Re-enabling [_1] in [_2]',
+                                        &Apache::lonnet::plaintext($role),
+                                        &Apache::loncommon::show_role_extent($url,$context,$role)),$result ne "ok").'<br />';
+                    if ($result ne "ok") {
+                        $output .= &mt('Error: [_1]',$result).'<br />';
+                    }
+                }
                 $r->print($output);
                 if (!grep(/^\Q$role\E$/,@rolechanges)) {
                     push(@rolechanges,$role);
@@ -3471,8 +3577,13 @@ sub update_roles {
                 my $result = &Apache::lonnet::assigncustomrole(
                                $env{'form.ccdomain'}, $env{'form.ccuname'},
                                $url,$rdom,$rnam,$rolename,0,$now,undef,$context);
-                $r->print(&mt('Re-enabling custom role [_1] by [_2] in [_3]: [_4]',
-                          $rolename,$rnam.':'.$rdom,$url,'<b>'.$result.'</b>').'<br />');
+                $r->print(&Apache::lonhtmlcommon::confirm_success(
+                    &mt('Re-enabling custom role [_1] by [_2] in [_3]',
+                        $rolename,$rnam.':'.$rdom,&Apache::loncommon::show_role_extent($1,$context,'cr')),
+                    $result ne "ok").'<br />');
+                if ($result ne "ok") {
+                    $r->print(&mt('Error: [_1]',$result).'<br />');
+                }
                 if (!grep(/^cr$/,@rolechanges)) {
                     push(@rolechanges,'cr');
                 }
@@ -3529,8 +3640,20 @@ sub update_roles {
                 # split multiple sections
                 my %sections = ();
                 my $num_sections = &build_roles($env{'form.sec_'.$one.'_'.$two.'_'.$three},\%sections,$three);
+                my $credits;
+                if ($three eq 'st') {
+                    if ($showcredits) { 
+                        my $defaultcredits = 
+                            &Apache::lonuserutils::get_defaultcredits($one,$two);
+                        $credits = $env{'form.credits_'.$one.'_'.$two.'_'.$three};
+                        $credits =~ s/[^\d\.]//g;
+                        if ($credits eq $defaultcredits) {
+                            undef($credits);
+                        }
+                    }
+                }
                 if ($num_sections == 0) {
-                    $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'',$context));
+                    $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'',$context,$credits));
                 } else {
                     my %curr_groups = 
 			&Apache::longroup::coursegroups($one,$two);
@@ -3544,13 +3667,13 @@ sub update_roles {
                                 next;
                             }
                             my $securl = $url.'/'.$sec;
-                            $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$securl,$three,$start,$end,$one,$two,$sec,$context));
+                            $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$securl,$three,$start,$end,$one,$two,$sec,$context,$credits));
                         } else {
                             $emptysec = 1;
                         }
                     }
                     if ($emptysec) {
-                        $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'',$context));
+                        $r->print(&Apache::loncommon::commit_standardrole($udom,$uname,$url,$three,$start,$end,$one,$two,'',$context,$credits));
                     }
                 }
                 if (!grep(/^\Q$three\E$/,@rolechanges)) {
@@ -3612,13 +3735,36 @@ sub update_roles {
 # Flush the course logs so reverse user roles immediately updated
     $r->register_cleanup(\&Apache::lonnet::flushcourselogs);
     if (@rolechanges == 0) {
-        $r->print(&mt('No roles to modify'));
+        $r->print('<p>'.&mt('No roles to modify').'</p>');
     }
     return @rolechanges;
 }
 
+sub get_user_credits {
+    my ($uname,$udom,$defaultcredits,$cdom,$cnum) = @_;
+    if ($cdom eq '' || $cnum eq '') {
+        return unless ($env{'request.course.id'});
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+    }
+    my $credits;
+    my %currhash =
+        &Apache::lonnet::get('classlist',[$uname.':'.$udom],$cdom,$cnum);
+    if (keys(%currhash) > 0) {
+        my @items = split(/:/,$currhash{$uname.':'.$udom});
+        my $crdidx = &Apache::loncoursedata::CL_CREDITS() - 3;
+        $credits = $items[$crdidx];
+        $credits =~ s/[^\d\.]//g;
+    }
+    if ($credits eq $defaultcredits) {
+        undef($credits);
+    }
+    return $credits;
+}
+
 sub enroll_single_student {
-    my ($r,$uhome,$amode,$genpwd,$now,$newuser,$context,$crstype) = @_;
+    my ($r,$uhome,$amode,$genpwd,$now,$newuser,$context,$crstype,
+        $showcredits,$defaultcredits) = @_;
     $r->print('<h3>');
     if ($crstype eq 'Community') {
         $r->print(&mt('Enrolling Member'));
@@ -3630,6 +3776,17 @@ sub enroll_single_student {
     # Remove non alphanumeric values from section
     $env{'form.sections'}=~s/\W//g;
 
+    my $credits;
+    if (($showcredits) && ($env{'form.credits'} ne '')) {
+        $credits = $env{'form.credits'};
+        $credits =~ s/[^\d\.]//g;
+        if ($credits ne '') {
+            if ($credits eq $defaultcredits) {
+                undef($credits);
+            }
+        }
+    }
+
     # Clean out any old student roles the user has in this class.
     &Apache::lonuserutils::modifystudent($env{'form.ccdomain'},
          $env{'form.ccuname'},$env{'request.course.id'},undef,$uhome);
@@ -3639,7 +3796,8 @@ sub enroll_single_student {
             $env{'form.ccuname'},$env{'form.cid'},$env{'form.cfirstname'},
             $env{'form.cmiddlename'},$env{'form.clastname'},
             $env{'form.generation'},$env{'form.sections'},$enddate,
-            $startdate,'manual',undef,$env{'request.course.id'},'',$context);
+            $startdate,'manual',undef,$env{'request.course.id'},'',$context,
+            $credits);
     if ($enroll_result =~ /^ok/) {
         $r->print(&mt('<b>[_1]</b> enrolled',$env{'form.ccuname'}.':'.$env{'form.ccdomain'}));
         if ($env{'form.sections'} ne '') {
@@ -3692,7 +3850,7 @@ sub get_defaultquota_text {
 sub update_result_form {
     my ($uhome) = @_;
     my $outcome = 
-    '<form name="userupdate" method="post" />'."\n";
+    '<form name="userupdate" method="post" action="">'."\n";
     foreach my $item ('srchby','srchin','srchtype','srchterm','srchdomain','ccuname','ccdomain') {
         $outcome .= '<input type="hidden" name="'.$item.'" value="'.$env{'form.'.$item}.'" />'."\n";
     }
@@ -3715,13 +3873,13 @@ sub update_result_form {
 }
 
 sub quota_admin {
-    my ($setquota,$changeHash) = @_;
+    my ($setquota,$changeHash,$name) = @_;
     my $quotachanged;
     if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
         # Current user has quota modification privileges
         if (ref($changeHash) eq 'HASH') {
             $quotachanged = 1;
-            $changeHash->{'portfolioquota'} = $setquota;
+            $changeHash->{$name.'quota'} = $setquota;
         }
     }
     return $quotachanged;
@@ -3966,7 +4124,7 @@ sub custom_role_editor {
     $r->print('<br clear="all" />');
 
     $r->print(<<ENDCCF);
-<form name="form1" method="post">
+<form name="form1" method="post" action="">
 <input type="hidden" name="phase" value="set_custom_roles" />
 <input type="hidden" name="rolename" value="$rolename" />
 ENDCCF
@@ -4162,8 +4320,13 @@ sub set_custom_role {
 						$env{'user.name'},
 						$rolename,undef,undef,undef,$context));
     }
-    $r->print('<p><a href="javascript:backPage(document.customresult,'."'pickrole'".')">'.&mt('Create or edit another custom role').'</a></p><form name="customresult" method="post">');
-    $r->print(&Apache::lonhtmlcommon::echo_form_input([]).'</form>');
+    $r->print(
+        '<p><a href="javascript:backPage(document.customresult,'."'pickrole'".')">'
+       .&mt('Create or edit another custom role')
+       .'</a></p>'
+       .'<form name="customresult" method="post" action="">'
+       .&Apache::lonhtmlcommon::echo_form_input([]).'</form>'
+    );
 }
 
 # ================================================================ Main Handler
@@ -4183,6 +4346,7 @@ sub handler {
     } else {
         $context = 'domain';
     }
+
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
         ['action','state','callingform','roletype','showrole','bulkaction','popup','phase',
          'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);
@@ -4214,6 +4378,16 @@ sub handler {
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
 
+    my $showcredits;
+    if ((($context eq 'course') && ($crstype eq 'Course')) || 
+         ($context eq 'domain')) {
+        my %domdefaults = 
+            &Apache::lonnet::get_domain_defaults($env{'request.role.domain'});
+        if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) {
+            $showcredits = 1;
+        }
+    }
+
     # Main switch on form.action and form.state, as appropriate
     if (! exists($env{'form.action'})) {
         $args = {bread_crumbs => $brcrum,
@@ -4236,11 +4410,12 @@ sub handler {
         if (! exists($env{'form.state'})) {
             &Apache::lonuserutils::print_first_users_upload_form($r,$context);
         } elsif ($env{'form.state'} eq 'got_file') {
-            &Apache::lonuserutils::print_upload_manager_form($r,$context,
-                                                             $permission,$crstype);
+            &Apache::lonuserutils::print_upload_manager_form($r,$context,$permission,
+                                                             $crstype,$showcredits);
         } elsif ($env{'form.state'} eq 'enrolling') {
             if ($env{'form.datatoken'}) {
-                &Apache::lonuserutils::upfile_drop_add($r,$context,$permission);
+                &Apache::lonuserutils::upfile_drop_add($r,$context,$permission,
+                                                       $showcredits);
             }
         } else {
             &Apache::lonuserutils::print_first_users_upload_form($r,$context);
@@ -4259,15 +4434,21 @@ sub handler {
             if ($env{'form.phase'} eq 'createnewuser') {
                 my $response;
                 if ($env{'form.srchterm'} !~ /^$match_username$/) {
-                    my $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
+                    my $response =
+                        '<span class="LC_warning">'
+                       .&mt('You must specify a valid username. Only the following are allowed:'
+                           .' letters numbers - . @')
+                       .'</span>';
                     $env{'form.phase'} = '';
-                    &print_username_entry_form($r,$context,$response,$srch,undef,$crstype,$brcrum);
+                    &print_username_entry_form($r,$context,$response,$srch,undef,
+                                               $crstype,$brcrum,$showcredits);
                 } else {
                     my $ccuname =&LONCAPA::clean_username($srch->{'srchterm'});
                     my $ccdomain=&LONCAPA::clean_domain($srch->{'srchdomain'});
                     &print_user_modification_page($r,$ccuname,$ccdomain,
                                                   $srch,$response,$context,
-                                                  $permission,$crstype,$brcrum);
+                                                  $permission,$crstype,$brcrum,
+                                                  $showcredits);
                 }
             } elsif ($env{'form.phase'} eq 'get_user_info') {
                 my ($currstate,$response,$forcenewuser,$results) = 
@@ -4312,7 +4493,7 @@ sub handler {
                                               $brcrum);
             }
         } elsif ($env{'form.phase'} eq 'update_user_data') {
-            &update_user_data($r,$context,$crstype,$brcrum);
+            &update_user_data($r,$context,$crstype,$brcrum,$showcredits);
         } else {
             &print_username_entry_form($r,$context,undef,$srch,undef,$crstype,
                                        $brcrum);
@@ -4415,7 +4596,8 @@ sub handler {
                 $r->print(&header(&add_script($jscript),$args));
             }
             &Apache::lonuserutils::print_userlist($r,undef,$permission,$context,
-                         $formname,$totcodes,$codetitles,$idlist,$idlist_titles);
+                         $formname,$totcodes,$codetitles,$idlist,$idlist_titles,
+                         $showcredits);
         }
     } elsif ($env{'form.action'} eq 'drop' && $permission->{'cusr'}) {
         my $brtext;
@@ -4446,8 +4628,8 @@ sub handler {
     } elsif ($env{'form.action'} eq 'dateselect') {
         if ($permission->{'cusr'}) {
             $r->print(&header(undef,{'no_nav_bar' => 1}).
-                      &Apache::lonuserutils::date_section_selector($context,
-                                                                   $permission,$crstype));
+                      &Apache::lonuserutils::date_section_selector($context,$permission,
+                                                                   $crstype,$showcredits));
         } else {
             $r->print(&header(undef,{'no_nav_bar' => 1}).
                      '<span class="LC_error">'.&mt('You do not have permission to modify dates or sections for users').'</span>'); 
@@ -4549,6 +4731,11 @@ sub add_script {
 
 sub verify_user_display {
     my ($context) = @_;
+    my %lt = &Apache::lonlocal::texthash (
+        course    => 'course(s): description, section(s), status',
+        community => 'community(s): description, section(s), status',
+        author    => 'author',
+    );
     my $photos;
     if (($context eq 'course') && $env{'request.course.id'}) {
         $photos = $env{'course.'.$env{'request.course.id'}.'.internal.showphoto'};
@@ -4572,16 +4759,25 @@ function updateCols(caller) {
     var context = '$context';
     var photos = '$photos';
     if (caller == 'Status') {
-        if (document.studentform.Status.options[document.studentform.Status.selectedIndex].value == 'Any') {
-            document.getElementById('showcolstatus').checked = true;
-            document.getElementById('showcolstatus').disabled = '';
-            document.getElementById('showcolstart').checked = true;
-            document.getElementById('showcolend').checked = true;
-        } else {
+        if ((context == 'domain') && 
+            ((document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'course') ||
+             (document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'community'))) {
             document.getElementById('showcolstatus').checked = false;
             document.getElementById('showcolstatus').disabled = 'disabled';
             document.getElementById('showcolstart').checked = false;
             document.getElementById('showcolend').checked = false;
+        } else {
+            if (document.studentform.Status.options[document.studentform.Status.selectedIndex].value == 'Any') {
+                document.getElementById('showcolstatus').checked = true;
+                document.getElementById('showcolstatus').disabled = '';
+                document.getElementById('showcolstart').checked = true;
+                document.getElementById('showcolend').checked = true;
+            } else {
+                document.getElementById('showcolstatus').checked = false;
+                document.getElementById('showcolstatus').disabled = 'disabled';
+                document.getElementById('showcolstart').checked = false;
+                document.getElementById('showcolend').checked = false;
+            }
         }
     }
     if (caller == 'output') {
@@ -4599,13 +4795,53 @@ function updateCols(caller) {
         }
     }
     if (caller == 'showrole') {
-        if (document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value == 'Any') {
+        if ((document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value == 'Any') ||
+            (document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value == 'cr')) {
             document.getElementById('showcolrole').checked = true;
             document.getElementById('showcolrole').disabled = '';
         } else {
             document.getElementById('showcolrole').checked = false;
             document.getElementById('showcolrole').disabled = 'disabled';
         }
+        if (context == 'domain') {
+            if ((document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'course') ||
+                (document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'community')) {
+                document.getElementById('showcolstatus').checked = false;
+                document.getElementById('showcolstatus').disabled = 'disabled';
+                document.getElementById('showcolstart').checked = false;
+                document.getElementById('showcolend').checked = false;
+            } else {
+                if (document.studentform.Status.options[document.studentform.Status.selectedIndex].value == 'Any') {
+                    document.getElementById('showcolstatus').checked = true;
+                    document.getElementById('showcolstatus').disabled = '';
+                    document.getElementById('showcolstart').checked = true;
+                    document.getElementById('showcolend').checked = true;
+                }
+            }
+            if (document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'domain') {
+                document.getElementById('showcolextent').disabled = 'disabled';
+                document.getElementById('showcolextent').checked = 'false';
+                document.getElementById('showextent').style.display='none';
+                document.getElementById('showcoltextextent').innerHTML = '';
+            } else {
+                document.getElementById('showextent').style.display='block';
+                document.getElementById('showextent').style.textAlign='left';
+                document.getElementById('showextent').style.textFace='normal';
+                if (document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'author') {
+                    document.getElementById('showcolextent').disabled = '';
+                    document.getElementById('showcolextent').checked = 'true';
+                    document.getElementById('showcoltextextent').innerHTML="$lt{'author'}";
+                } else {
+                    document.getElementById('showcolextent').disabled = '';
+                    document.getElementById('showcolextent').checked = 'true';
+                    if (document.studentform.roletype.options[document.studentform.roletype.selectedIndex].value == 'community') {
+                        document.getElementById('showcoltextextent').innerHTML="$lt{'community'}";
+                    } else {
+                        document.getElementById('showcoltextextent').innerHTML="$lt{'course'}";
+                    }
+                }
+            }
+        }
     }
     return;
 }
@@ -4849,6 +5085,7 @@ sub print_main_menu {
             );
         }
     } elsif ($context eq 'author') {
+        push(@{ $menu[2]->{items} }, #Category: Administration
             {
              linktext => 'Change Log',
              icon => 'document-properties.png',
@@ -4857,6 +5094,7 @@ sub print_main_menu {
              permission => $permission->{'cusr'},
              linktitle => 'View change log.',
             },
+        );
     }
     return Apache::lonhtmlcommon::generate_menu(@menu);
 #               { text => 'View Log-in History',
@@ -5843,7 +6081,7 @@ sub role_display_filter {
                &mt('Context:').'</b><br /><select name="chgcontext">';
     my @posscontexts;
     if ($context eq 'course') {
-        @posscontexts = ('any','auto','updatenow','createcourse','course','domain','selfenroll','requestcourses');
+        @posscontexts = ('any','automated','updatenow','createcourse','course','domain','selfenroll','requestcourses');
     } elsif ($context eq 'domain') {
         @posscontexts = ('any','domain','requestauthor','domconfig','server');
     } else {
@@ -5855,7 +6093,7 @@ sub role_display_filter {
             $selstr = ' selected="selected"';
         }
         if ($context eq 'course') {
-            if (($chgtype eq 'auto') || ($chgtype eq 'updatenow')) {
+            if (($chgtype eq 'automated') || ($chgtype eq 'updatenow')) {
                 next if (!&Apache::lonnet::auto_run($cnum,$cdom));
             }
         }
@@ -5891,7 +6129,7 @@ sub rolechg_contexts {
     if ($context eq 'course') {
         %lt = &Apache::lonlocal::texthash (
                                              any          => 'Any',
-                                             auto         => 'Automated enrollment',
+                                             automated    => 'Automated Enrollment',
                                              updatenow    => 'Roster Update',
                                              createcourse => 'Course Creation',
                                              course       => 'User Management in course',
@@ -6416,7 +6654,8 @@ function backPage(formname,prevphase,pre
 }
 
 sub course_level_table {
-    my (%inccourses) = @_;
+    my ($inccourses,$showcredits,$defaultcredits) = @_;
+    return unless (ref($inccourses) eq 'HASH');
     my $table = '';
 # Custom Roles?
 
@@ -6431,11 +6670,12 @@ sub course_level_table {
             'rol'  => "Role",
             'ext'  => "Extent",
             'grs'  => "Section",
+            'crd'  => "Credits",
             'sta'  => "Start",
             'end'  => "End"
     );
 
-    foreach my $protectedcourse (sort(keys(%inccourses))) {
+    foreach my $protectedcourse (sort(keys(%{$inccourses}))) {
 	my $thiscourse=$protectedcourse;
 	$thiscourse=~s:_:/:g;
 	my %coursedata=&Apache::lonnet::coursedescription($thiscourse);
@@ -6457,12 +6697,14 @@ sub course_level_table {
 	    if ((&Apache::lonnet::allowed('c'.$role,$thiscourse)) ||
                 ((($role eq 'cc') || ($role eq 'co')) && ($isowner))) {
                 $table .= &course_level_row($protectedcourse,$role,$area,$domain,
-                                            $plrole,\%sections_count,\%lt);
+                                            $plrole,\%sections_count,\%lt,
+                                            $defaultcredits,$crstype);
             } elsif ($env{'request.course.sec'} ne '') {
                 if (&Apache::lonnet::allowed('c'.$role,$thiscourse.'/'.
                                              $env{'request.course.sec'})) {
                     $table .= &course_level_row($protectedcourse,$role,$area,$domain,
-                                                $plrole,\%sections_count,\%lt);
+                                                $plrole,\%sections_count,\%lt,
+                                                $defaultcredits,$crstype);
                 }
             }
         }
@@ -6484,8 +6726,10 @@ sub course_level_table {
     $result .= 
 &Apache::loncommon::start_data_table().
 &Apache::loncommon::start_data_table_header_row().
-'<th>'.$lt{'act'}.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'ext'}.'</th>
-<th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.
+'<th>'.$lt{'act'}.'</th><th>'.$lt{'rol'}.'</th>'."\n".
+'<th>'.$lt{'ext'}.'</th><th>'.$lt{'crd'}.'</th>'."\n".
+'<th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th>'."\n".
+'<th>'.$lt{'end'}.'</th>'.
 &Apache::loncommon::end_data_table_header_row().
 $table.
 &Apache::loncommon::end_data_table();
@@ -6493,12 +6737,21 @@ $table.
 }
 
 sub course_level_row {
-    my ($protectedcourse,$role,$area,$domain,$plrole,$sections_count,$lt) = @_;
+    my ($protectedcourse,$role,$area,$domain,$plrole,$sections_count,
+        $lt,$defaultcredits,$crstype) = @_;
+    my $creditem;
     my $row = &Apache::loncommon::start_data_table_row().
               ' <td><input type="checkbox" name="act_'.
               $protectedcourse.'_'.$role.'" /></td>'."\n".
               ' <td>'.$plrole.'</td>'."\n".
               ' <td>'.$area.'<br />Domain: '.$domain.'</td>'."\n";
+    if (($role eq 'st') && ($crstype eq 'Course')) {
+        $row .= 
+            '<td><input type="text" name="credits_'.$protectedcourse.'_'.
+            $role.'" size="3" value="'.$defaultcredits.'" /></td>';
+    } else {
+        $row .= '<td>&nbsp;</td>';
+    }
     if (($role eq 'cc') || ($role eq 'co')) {
         $row .= '<td>&nbsp;</td>';
     } elsif ($env{'request.course.sec'} ne '') {
@@ -6524,7 +6777,7 @@ sub course_level_row {
                      '</tr></table></td>'."\n";
         } else {
             $row .= '<td><input type="text" size="10" '.
-                      'name="sec_'.$protectedcourse.'_'.$role.'" /></td>'."\n";
+                    'name="sec_'.$protectedcourse.'_'.$role.'" /></td>'."\n";
         }
     }
     $row .= <<ENDTIMEENTRY;
@@ -6540,7 +6793,7 @@ ENDTIMEENTRY
 }
 
 sub course_level_dc {
-    my ($dcdom) = @_;
+    my ($dcdom,$showcredits) = @_;
     my %customroles=&Apache::lonuserutils::my_custom_roles();
     my @roles = &Apache::lonuserutils::roles_by_context('course');
     my $hiddenitems = '<input type="hidden" name="dcdomain" value="'.$dcdom.'" />'.
@@ -6548,7 +6801,11 @@ sub course_level_dc {
                       '<input type="hidden" name="dccourse" value="" />';
     my $courseform=&Apache::loncommon::selectcourse_link
             ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Select','crstype');
-    my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,'currsec','cu','role','Course/Community Browser');
+    my $credit_elem;
+    if ($showcredits) {
+        $credit_elem = 'credits';
+    }
+    my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,'currsec','cu','role','Course/Community Browser',$credit_elem);
     my %lt=&Apache::lonlocal::texthash(
                     'rol'  => "Role",
                     'grs'  => "Section",
@@ -6558,12 +6815,15 @@ sub course_level_dc {
                     'end'  => "End",
                     'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date",
-                    'scc'  => "Course/Community"
+                    'scc'  => "Course/Community",
+                    'crd'  => "Credits",
                   );
     my $header = '<h4>'.&mt('Course/Community Level').'</h4>'.
                  &Apache::loncommon::start_data_table().
                  &Apache::loncommon::start_data_table_header_row().
-                 '<th>'.$lt{'scc'}.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.
+                 '<th>'.$lt{'scc'}.'</th><th>'.$lt{'rol'}.'</th>'."\n".
+                 '<th>'.$lt{'grs'}.'</th><th>'.$lt{'crd'}.'</th>'."\n".
+                 '<th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'."\n".
                  &Apache::loncommon::end_data_table_header_row();
     my $otheritems = &Apache::loncommon::start_data_table_row()."\n".
                      '<td><br /><span class="LC_nobreak"><input type="text" name="coursedesc" value="" onfocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc','','','','crstype'".')" />'.
@@ -6590,7 +6850,11 @@ sub course_level_dc {
                      '<input type="hidden" name="section" value="" />'.
                      '<input type="hidden" name="groups" value="" />'.
                      '<input type="hidden" name="crstype" value="" /></td>'.
-                     '</tr></table></td>';
+                     '</tr></table></td>'."\n";
+    if ($showcredits) {
+        $otheritems .= '<td><br />'."\n".
+                       '<input type="text" size="3" name="credits" value="" />'."\n";
+    }
     $otheritems .= <<ENDTIMEENTRY;
 <td><br /><input type="hidden" name="start" value='' />
 <a href=
@@ -6933,7 +7197,7 @@ sub update_selfenroll_config {
     my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum);
     if (ref($visactions) eq 'HASH') {
         if (!$visible) {
-            $r->print('<br />'.$visactions->{'miss'}.'<br />'.$visactions->{'yous'}.
+            $r->print('<br /><span class="LC_warning">'.$visactions->{'miss'}.'</span><br />'.$visactions->{'yous'}.
                       '<br />');
             if (ref($vismsgs) eq 'ARRAY') {
                 $r->print('<br />'.$visactions->{'take'}.'<ul>');