Diff for /loncom/interface/loncreateuser.pm between versions 1.351 and 1.361

version 1.351, 2010/10/08 01:59:39 version 1.361, 2012/06/01 11:39:24
Line 223  sub build_tools_display { Line 223  sub build_tools_display {
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                    'blog'       => "Personal User Blog",                     'blog'       => "Personal User Blog",
                    'aboutme'    => "Personal Information Page",                     'aboutme'    => "Personal Information Page",
                      'webdav'     => "WebDAV access to authoring spaces (if SSL and author/co-author)",
                    'portfolio'  => "Personal User Portfolio",                     'portfolio'  => "Personal User Portfolio",
                    'avai'       => "Available",                     'avai'       => "Available",
                    'cusa'       => "availability",                     'cusa'       => "availability",
Line 248  sub build_tools_display { Line 249  sub build_tools_display {
         $isadv = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);          $isadv = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
     } else {      } else {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
                           'tools.aboutme','tools.portfolio','tools.blog');                            'tools.aboutme','tools.portfolio','tools.blog',
         @usertools = ('aboutme','blog','portfolio');                            'tools.webdav');
           @usertools = ('aboutme','blog','webdav','portfolio');
     }      }
     foreach my $item (@usertools) {      foreach my $item (@usertools) {
         my ($custom_access,$curr_access,$cust_on,$cust_off,$tool_on,$tool_off,          my ($custom_access,$curr_access,$cust_on,$cust_off,$tool_on,$tool_off,
Line 356  sub build_tools_display { Line 358  sub build_tools_display {
             $currdisp = ($curr_access?&mt('Yes'):&mt('No'));              $currdisp = ($curr_access?&mt('Yes'):&mt('No'));
             $custdisp = '<span class="LC_nobreak"><label>'.              $custdisp = '<span class="LC_nobreak"><label>'.
                         '<input type="radio" name="'.$context.'_'.$item.'"'.                          '<input type="radio" name="'.$context.'_'.$item.'"'.
                         ' value="1"'. $tool_on.'/>'.&mt('On').'</label>&nbsp;<label>'.                          ' value="1" '.$tool_on.'/>'.&mt('On').'</label>&nbsp;<label>'.
                         '<input type="radio" name="'.$context.'_'.$item.'" value="0" '.                          '<input type="radio" name="'.$context.'_'.$item.'" value="0" '.
                         $tool_off.'/>'.&mt('Off').'</label></span>';                          $tool_off.'/>'.&mt('Off').'</label></span>';
             $custradio = ('&nbsp;'x2).'--'.$lt{'cusa'}.':&nbsp;'.$custdisp.              $custradio = ('&nbsp;'x2).'--'.$lt{'cusa'}.':&nbsp;'.$custdisp.
Line 638  END Line 640  END
   
 sub entry_form {  sub entry_form {
     my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype) = @_;      my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype) = @_;
     my %domconf = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom);  
     my ($usertype,$inexact);      my ($usertype,$inexact);
     if (ref($srch) eq 'HASH') {      if (ref($srch) eq 'HASH') {
         if (($srch->{'srchin'} eq 'dom') &&          if (($srch->{'srchin'} eq 'dom') &&
Line 646  sub entry_form { Line 647  sub entry_form {
             ($srch->{'srchtype'} eq 'exact') &&              ($srch->{'srchtype'} eq 'exact') &&
             ($srch->{'srchdomain'} ne '') &&              ($srch->{'srchdomain'} ne '') &&
             ($srch->{'srchterm'} ne '')) {              ($srch->{'srchterm'} ne '')) {
               my (%curr_rules,%got_rules);
             my ($rules,$ruleorder) =              my ($rules,$ruleorder) =
                 &Apache::lonnet::inst_userrules($srch->{'srchdomain'},'username');                  &Apache::lonnet::inst_userrules($srch->{'srchdomain'},'username');
             $usertype = &Apache::lonuserutils::check_usertype($srch->{'srchdomain'},$srch->{'srchterm'},$rules);              $usertype = &Apache::lonuserutils::check_usertype($srch->{'srchdomain'},$srch->{'srchterm'},$rules,\%curr_rules,\%got_rules);
         } else {          } else {
             $inexact = 1;              $inexact = 1;
         }          }
Line 742  sub user_modification_js { Line 744  sub user_modification_js {
 <script type="text/javascript" language="Javascript">  <script type="text/javascript" language="Javascript">
 // <![CDATA[  // <![CDATA[
   
     function pclose() {  
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",  
                  "height=350,width=350,scrollbars=no,menubar=no");  
         parmwin.close();  
     }  
   
     $pjump_def      $pjump_def
     $dc_setcourse_code      $dc_setcourse_code
   
     function dateset() {      function dateset() {
         eval("document.cu."+document.cu.pres_marker.value+          eval("document.cu."+document.cu.pres_marker.value+
             ".value=document.cu.pres_value.value");              ".value=document.cu.pres_value.value");
         pclose();          modalWindow.close();
     }      }
   
     $nondc_setsection_code      $nondc_setsection_code
Line 942  sub print_user_modification_page { Line 938  sub print_user_modification_page {
         my ($rules,$ruleorder) =          my ($rules,$ruleorder) =
             &Apache::lonnet::inst_userrules($ccdomain,'username');              &Apache::lonnet::inst_userrules($ccdomain,'username');
             $usertype =              $usertype =
                 &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules);                  &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules,
                                                          \%curr_rules,\%got_rules);
         my $cancreate =          my $cancreate =
             &Apache::lonuserutils::can_create_user($ccdomain,$context,              &Apache::lonuserutils::can_create_user($ccdomain,$context,
                                                    $usertype);                                                     $usertype);
Line 1261  ENDNOPORTPRIV Line 1258  ENDNOPORTPRIV
             if (&Apache::lonnet::allowed('mut',$env{'request.role.domain'})) {              if (&Apache::lonnet::allowed('mut',$env{'request.role.domain'})) {
                 my %lt=&Apache::lonlocal::texthash(                  my %lt=&Apache::lonlocal::texthash(
                     'utav'  => "User Tools Availability",                      'utav'  => "User Tools Availability",
                     'yodo'  => "You do not have privileges to modify Portfolio, Blog or Personal Information Page settings for this user.",                      'yodo'  => "You do not have privileges to modify Portfolio, Blog, WebDAV, or Personal Information Page settings for this user.",
                     'ifch'  => "If a change is required, contact a domain coordinator for the domain",                      'ifch'  => "If a change is required, contact a domain coordinator for the domain",
                 );                  );
                 $user_tools_text = <<ENDNOTOOLSPRIV;                  $user_tools_text = <<ENDNOTOOLSPRIV;
Line 1321  ENDNOTOOLSPRIV Line 1318  ENDNOTOOLSPRIV
             $addrolesdisplay = &new_coauthor_roles($r,$ccuname,$ccdomain);              $addrolesdisplay = &new_coauthor_roles($r,$ccuname,$ccdomain);
         }          }
         if ($context eq 'domain') {          if ($context eq 'domain') {
             my $add_domainroles = &new_domain_roles($r);              my $add_domainroles = &new_domain_roles($r,$ccdomain);
             if (!$addrolesdisplay) {              if (!$addrolesdisplay) {
                 $addrolesdisplay = $add_domainroles;                  $addrolesdisplay = $add_domainroles;
             }              }
Line 1346  ENDNOTOOLSPRIV Line 1343  ENDNOTOOLSPRIV
     }      }
     $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));      $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));
     $r->print('<input type="hidden" name="currstate" value="" />');      $r->print('<input type="hidden" name="currstate" value="" />');
     $r->print('<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />');      $r->print('<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" /></form>');
     return;      return;
 }  }
   
Line 1470  sub display_existing_roles { Line 1467  sub display_existing_roles {
             $rolesdump{$newkey} = $newvalue;              $rolesdump{$newkey} = $newvalue;
         }          }
     } else {      } else {
         my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1});          %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname);
         %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname,'.',undef,$extra);  
     }      }
     # Build up table of user roles to allow revocation and re-enabling of roles.      # Build up table of user roles to allow revocation and re-enabling of roles.
     my ($tmp) = keys(%rolesdump);      my ($tmp) = keys(%rolesdump);
Line 1764  sub new_coauthor_roles { Line 1760  sub new_coauthor_roles {
 }  }
   
 sub new_domain_roles {  sub new_domain_roles {
     my ($r) = @_;      my ($r,$ccdomain) = @_;
     my $addrolesdisplay = 0;      my $addrolesdisplay = 0;
     #      #
     # Domain level      # Domain level
Line 1782  sub new_domain_roles { Line 1778  sub new_domain_roles {
     foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) {      foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) {
         foreach my $role (@allroles) {          foreach my $role (@allroles) {
             next if ($role eq 'ad');              next if ($role eq 'ad');
               next if (($role eq 'au') && ($ccdomain ne $thisdomain));
             if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) {              if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) {
                my $plrole=&Apache::lonnet::plaintext($role);                 my $plrole=&Apache::lonnet::plaintext($role);
                my %lt=&Apache::lonlocal::texthash(                 my %lt=&Apache::lonlocal::texthash(
Line 2317  sub update_user_data { Line 2314  sub update_user_data {
   
     my (%alerts,%rulematch,%inst_results,%curr_rules);      my (%alerts,%rulematch,%inst_results,%curr_rules);
     my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');      my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
     my @usertools = ('aboutme','blog','portfolio');      my @usertools = ('aboutme','blog','webdav','portfolio');
     my @requestcourses = ('official','unofficial','community');      my @requestcourses = ('official','unofficial','community');
     my ($othertitle,$usertypes,$types) =       my ($othertitle,$usertypes,$types) = 
         &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});          &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
Line 2470  sub update_user_data { Line 2467  sub update_user_data {
         my %userenv = &Apache::lonnet::get          my %userenv = &Apache::lonnet::get
             ('environment',['firstname','middlename','lastname','generation',              ('environment',['firstname','middlename','lastname','generation',
              'id','permanentemail','portfolioquota','inststatus','tools.aboutme',               'id','permanentemail','portfolioquota','inststatus','tools.aboutme',
              'tools.blog','tools.portfolio','requestcourses.official',               'tools.blog','tools.webdav','tools.portfolio',
              'requestcourses.unofficial','requestcourses.community',               'requestcourses.official','requestcourses.unofficial',
              'reqcrsotherdom.official','reqcrsotherdom.unofficial',               'requestcourses.community','reqcrsotherdom.official',
              'reqcrsotherdom.community'],               'reqcrsotherdom.unofficial','reqcrsotherdom.community'],
               $env{'form.ccdomain'},$env{'form.ccuname'});                $env{'form.ccdomain'},$env{'form.ccuname'});
         my ($tmp) = keys(%userenv);          my ($tmp) = keys(%userenv);
         if ($tmp =~ /^(con_lost|error)/i) {           if ($tmp =~ /^(con_lost|error)/i) { 
Line 2923  sub display_userinfo { Line 2920  sub display_userinfo {
          'permanentemail' => 'Permanent e-mail address',           'permanentemail' => 'Permanent e-mail address',
          'quota'          => 'Disk space allocated to portfolio files',           'quota'          => 'Disk space allocated to portfolio files',
          'blog'           => 'Blog Availability',           'blog'           => 'Blog Availability',
            'webdav'         => 'WebDAV Availability',
          'aboutme'        => 'Personal Information Page Availability',           'aboutme'        => 'Personal Information Page Availability',
          'portfolio'      => 'Portfolio Availability',           'portfolio'      => 'Portfolio Availability',
          'official'       => 'Can Request Official Courses',           'official'       => 'Can Request Official Courses',
Line 3929  sub set_custom_role { Line 3927  sub set_custom_role {
                  .$jsback."\n"                   .$jsback."\n"
                  .'// ]]>'."\n"                   .'// ]]>'."\n"
                  .'</script>'."\n";                   .'</script>'."\n";
     my $brcrum = [{href => "javascript:backPage(document.customresult,'pickrole','')",      push(@{$brcrum},
                    text => "Pick custom role",          {href => "javascript:backPage(document.customresult,'pickrole','')",
                    faq  => 282,           text => "Pick custom role",
                    bug  => 'Instructor Interface',},           faq  => 282,
                   {href => "javascript:backPage(document.customresult,'selected_custom_edit','')",           bug  => 'Instructor Interface',},
                    text => "Edit custom role",          {href => "javascript:backPage(document.customresult,'selected_custom_edit','')",
                    faq  => 282,           text => "Edit custom role",
                    bug  => 'Instructor Interface',},           faq  => 282,
                   {href => "javascript:backPage(document.customresult,'set_custom_roles','')",           bug  => 'Instructor Interface',},
                    text => "Result",          {href => "javascript:backPage(document.customresult,'set_custom_roles','')",
                    faq  => 282,           text => "Result",
                    bug  => 'Instructor Interface',           faq  => 282,
                    help => 'Course_Editing_Custom_Roles'},           bug  => 'Instructor Interface',
                  ];           help => 'Course_Editing_Custom_Roles'},
     my $args = { bread_crumbs          => $brcrum,          );
       my $args = { bread_crumbs           => $brcrum,
                  bread_crumbs_component => 'User Management'};                    bread_crumbs_component => 'User Management'}; 
     $r->print(&Apache::loncommon::start_page('Save Custom Role',$jscript,$args));      $r->print(&Apache::loncommon::start_page('Save Custom Role',$jscript,$args));
   
Line 4039  sub handler { Line 4038  sub handler {
     my ($permission,$allowed) =       my ($permission,$allowed) = 
         &Apache::lonuserutils::get_permission($context,$crstype);          &Apache::lonuserutils::get_permission($context,$crstype);
     if (!$allowed) {      if (!$allowed) {
           if ($context eq 'course') {
               $r->internal_redirect('/adm/viewclasslist');
               return OK;
           }
         $env{'user.error.msg'}=          $env{'user.error.msg'}=
             "/adm/createuser:cst:0:0:Cannot create/modify user data ".              "/adm/createuser:cst:0:0:Cannot create/modify user data ".
                                  "or view user status.";                                   "or view user status.";
Line 4383  sub print_main_menu { Line 4386  sub print_main_menu {
                 course => {                  course => {
                             upload     => 'Upload a File of Course Users',                              upload     => 'Upload a File of Course Users',
                             singleuser => 'Add/Modify a Course User',                              singleuser => 'Add/Modify a Course User',
                             listusers  => 'Manage Course Users',                              listusers  => 'List and Modify Multiple Course Users',
                             },                              },
                 community => {                  community => {
                             upload     => 'Upload a File of Community Users',                              upload     => 'Upload a File of Community Users',
                             singleuser => 'Add/Modify a Community User',                              singleuser => 'Add/Modify a Community User',
                             listusers  => 'Manage Community Users',                              listusers  => 'List and Modify Multiple Community Users',
                            },                             },
                 );                  );
      my %linktitles = (       my %linktitles = (
Line 6205  sub course_level_dc { Line 6208  sub course_level_dc {
     my $hiddenitems = '<input type="hidden" name="dcdomain" value="'.$dcdom.'" />'.      my $hiddenitems = '<input type="hidden" name="dcdomain" value="'.$dcdom.'" />'.
                       '<input type="hidden" name="origdom" value="'.$dcdom.'" />'.                        '<input type="hidden" name="origdom" value="'.$dcdom.'" />'.
                       '<input type="hidden" name="dccourse" value="" />';                        '<input type="hidden" name="dccourse" value="" />';
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link      my $courseform=&Apache::loncommon::selectcourse_link
             ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course/Community','crstype').'</b>';              ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Select','crstype');
     my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,'currsec','cu','role','Course/Community Browser');      my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,'currsec','cu','role','Course/Community Browser');
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
                     'rol'  => "Role",                      'rol'  => "Role",
Line 6216  sub course_level_dc { Line 6219  sub course_level_dc {
                     'sta'  => "Start",                      'sta'  => "Start",
                     'end'  => "End",                      'end'  => "End",
                     'ssd'  => "Set Start Date",                      'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date"                      'sed'  => "Set End Date",
                       'scc'  => "Course/Community"
                   );                    );
     my $header = '<h4>'.&mt('Course/Community Level').'</h4>'.      my $header = '<h4>'.&mt('Course/Community Level').'</h4>'.
                  &Apache::loncommon::start_data_table().                   &Apache::loncommon::start_data_table().
                  &Apache::loncommon::start_data_table_header_row().                   &Apache::loncommon::start_data_table_header_row().
                  '<th>'.$courseform.'</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><th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.
                  &Apache::loncommon::end_data_table_header_row();                   &Apache::loncommon::end_data_table_header_row();
     my $otheritems = &Apache::loncommon::start_data_table_row()."\n".      my $otheritems = &Apache::loncommon::start_data_table_row()."\n".
                      '<td><br /><input type="text" name="coursedesc" value="" onfocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc','','','','crstype'".')" /></td>'."\n".                       '<td><br /><span class="LC_nobreak"><input type="text" name="coursedesc" value="" onfocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc','','','','crstype'".')" />'.
                        $courseform.('&nbsp;' x4).'</span></td>'."\n".
                      '<td valign><br /><select name="role">'."\n";                       '<td valign><br /><select name="role">'."\n";
     foreach my $role (@roles) {      foreach my $role (@roles) {
         my $plrole=&Apache::lonnet::plaintext($role);          my $plrole=&Apache::lonnet::plaintext($role);

Removed from v.1.351  
changed lines
  Added in v.1.361


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>