[LON-CAPA-cvs] cvs: loncom /auth roles.tab rolesplain.tab /interface loncoursequeueadmin.pm loncreatecourse.pm mydesk.tab

raeburn raeburn at source.lon-capa.org
Thu Oct 6 12:20:15 EDT 2016


raeburn		Thu Oct  6 16:20:15 2016 EDT

  Modified files:              
    /loncom/interface	loncreatecourse.pm loncoursequeueadmin.pm 
                     	mydesk.tab 
    /loncom/auth	roles.tab rolesplain.tab 
  Log:
  - 'dcc' priv assigned to Domain Helpdesk role so course creation log and
    and queued course requests are viewable by a user with that role selected.
  
  
-------------- next part --------------
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.163 loncom/interface/loncreatecourse.pm:1.164
--- loncom/interface/loncreatecourse.pm:1.163	Thu Aug 25 22:33:03 2016
+++ loncom/interface/loncreatecourse.pm	Thu Oct  6 16:20:05 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.163 2016/08/25 22:33:03 raeburn Exp $
+# $Id: loncreatecourse.pm,v 1.164 2016/10/06 16:20:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -773,7 +773,7 @@
 }
 
 sub print_intro_page {
-    my ($r,$show_all_choices,$cancreate) = @_;
+    my ($r,$show_all_choices,$cancreate,$permission) = @_;
     my $start_page =
         &Apache::loncommon::start_page('Create a New Course, Community or Placement Test');
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Options','Create_Course',undef,'Create_Courses');
@@ -782,6 +782,10 @@
     my $helplink=&Apache::loncommon::help_open_topic('Create_Course_Community',&mt('Help on Creating Courses and Communities'));
 
     # Create menu
+    my $approve = 'Display requests awaiting approval';
+    if ($permission->{'create'}) {
+        $approve = 'Approve or reject requests';
+    }
     my @menu;
     @menu =
        ({ categorytitle => 'Course/Community Creation',
@@ -789,7 +793,7 @@
           {
                linktext => 'Create a single course',
                url => '/adm/createcourse?phase=courseone',
-               permission => 1,
+               permission => $permission->{'create'},
                #help => '',
                icon => 'crsnew.png',
                linktitle => 'Create a new course by completing an online form.'
@@ -797,7 +801,7 @@
           {
                linktext => 'Create a single community',
                url => '/adm/createcourse?phase=groupone',
-               permission => $cancreate->{'Community'},
+               permission => $permission->{'create'} && $cancreate->{'Community'},
                #help => '',
                icon => 'crsnew.png',
                linktitle => 'Create a new collaborative community by completing an online form.'
@@ -805,7 +809,7 @@
           {
                linktext => 'Create a single placement test',
                url => '/adm/createcourse?phase=placementone',
-               permission => $cancreate->{'Placement'},
+               permission => $permission->{'create'} && $cancreate->{'Placement'},
                #help => '',
                icon => 'crsnew.png',
                linktitle => 'Create a new placement test by completing an online form.'
@@ -813,7 +817,7 @@
           {
                linktext => 'Create courses/communities/placement tests by uploading an attributes file',
                url => '/adm/createcourse?phase=batchone',
-               permission => 1,
+               permission => $permission->{'create'},
                help => 'Batch_Creation',
                icon => 'uplcrs.png',
                linktitle => 'Upload an attributes file containing specifications for one or more courses, communities or placement tests in XML format.'
@@ -823,7 +827,7 @@
        { categorytitle => 'Course/Community Requests',
        items => [
            {
-               linktext => 'Approve or reject requests',
+               linktext => $approve,
                url => '/adm/createcourse?phase=requestdisplay',
                permission => $show_all_choices,
                #help => '',
@@ -1298,6 +1302,20 @@
 
 }
 
+sub get_permission {
+    my ($dom) = @_;
+    my ($allowed,%permission);
+    if (&Apache::lonnet::allowed('ccc',$dom)) {
+        $allowed = 1;
+        %permission = (
+            create => 1,
+        );
+    } elsif (&Apache::lonnet::allowed('dcc',$dom)) {
+        $allowed = 1;
+    }
+    return ($allowed,\%permission);
+}
+
 # ===================================================================== Handler
 sub handler {
     my $r = shift;
@@ -1308,28 +1326,28 @@
        return OK;
     }
 
-    my $show_all_choices = 0;
-    my $primary_rev = &Apache::lonnet::get_server_loncaparev($env{'request.role.domain'});
-    my %cancreate = (
-                         Community => 0,
-                         Placement => 0,
-                    );
-
-    if (($primary_rev ne 'refused') && ($primary_rev ne 'error') &&
-        ($primary_rev ne 'unknown_cmd') && ($primary_rev ne 'no_such_host')) {
-        $show_all_choices = 1;
-        my ($primary_major,$primary_minor) = split(/\./,$primary_rev);
-        foreach my $key (keys(%cancreate)) {
-            my ($needsmajor,$needsminor) = 
-                split(/\./,$Apache::lonnet::needsrelease{'course:crstype:'.$key});
-            unless (($needsmajor > $primary_major) ||
-                    (($needsmajor == $primary_major) && ($needsminor > $primary_minor))) {
-                $cancreate{$key} = 1;
+    my ($allowed,$permission) = &get_permission($env{'request.role.domain'});
+    if ($allowed) {
+        my $show_all_choices = 0;
+        my $primary_rev = &Apache::lonnet::get_server_loncaparev($env{'request.role.domain'});
+        my %cancreate = (
+                           Community => 0,
+                           Placement => 0,
+                        );
+        if (($primary_rev ne 'refused') && ($primary_rev ne 'error') &&
+            ($primary_rev ne 'unknown_cmd') && ($primary_rev ne 'no_such_host')) {
+            $show_all_choices = 1;
+            my ($primary_major,$primary_minor) = split(/\./,$primary_rev);
+            foreach my $key (keys(%cancreate)) {
+                my ($needsmajor,$needsminor) = 
+                    split(/\./,$Apache::lonnet::needsrelease{'course:crstype:'.$key});
+                unless (($needsmajor > $primary_major) ||
+                        (($needsmajor == $primary_major) && ($needsminor > $primary_minor))) {
+                    $cancreate{$key} = 1;
+                }
             }
         }
-    }
 
-    if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
        &Apache::loncommon::content_type($r,'text/html');
        $r->send_http_header;
 
@@ -1340,11 +1358,12 @@
           ({href=>"/adm/createcourse",
             text=>"Creation Options",
             faq=>79,bug=>'Dom Coord Interface',});
-       if (($env{'form.phase'} eq 'coursetwo') ||
-           (($env{'form.phase'} eq 'grouptwo') && 
+       if (($permission->{'create'}) &&
+           (($env{'form.phase'} eq 'coursetwo') ||
+            (($env{'form.phase'} eq 'grouptwo') && 
             ($cancreate{'Community'})) ||
            (($env{'form.phase'} eq 'placementtwo') &&
-            ($cancreate{'Placement'}))) { 
+            ($cancreate{'Placement'})))) { 
            &Apache::lonhtmlcommon::add_breadcrumb
                  ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
                    text=>&mt('[_1] Creation Settings',),
@@ -1354,23 +1373,26 @@
                    text=>"Creation Outcome",
                    faq=>9,bug=>'Dom Coord Interface',});
            &create_course($r);
-       } elsif (($env{'form.phase'} eq 'courseone') || 
-                (($env{'form.phase'} eq 'groupone') && 
-                ($cancreate{'Community'})) ||
-                (($env{'form.phase'} eq 'placementone') &&
-                 ($cancreate{'Placement'}))) {
+       } elsif (($permission->{'create'}) &&
+                (($env{'form.phase'} eq 'courseone') || 
+                 (($env{'form.phase'} eq 'groupone') && 
+                 ($cancreate{'Community'})) ||
+                 (($env{'form.phase'} eq 'placementone') &&
+                  ($cancreate{'Placement'})))) {
            &Apache::lonhtmlcommon::add_breadcrumb
                  ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
                    text=>&mt('[_1] Creation Settings',),
                    faq=>9,bug=>'Dom Coord Interface',});
 	   &print_course_creation_page($r);
-       } elsif ($env{'form.phase'} eq 'batchone') {
+       } elsif (($permission->{'create'}) &&
+                ($env{'form.phase'} eq 'batchone')) {
            &Apache::lonhtmlcommon::add_breadcrumb
                  ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
                    text=>"Upload Description File",
                    faq=>9,bug=>'Dom Coord Interface',});
            &upload_batchfile($r);
-       } elsif ($env{'form.phase'} eq 'batchtwo') {
+       } elsif (($permission->{'create'}) &&
+                ($env{'form.phase'} eq 'batchtwo')) {
            &Apache::lonhtmlcommon::add_breadcrumb
                  ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
                    text=>"Upload Description File",
@@ -1388,11 +1410,16 @@
            my $js = &courserequestbrowser_javascript();
            my $start_page=&Apache::loncommon::start_page('Display Requests',$js);
            my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Display Requests','Course_Requests',undef,'Course_Requests');
+           my $context = 'domain';
+           unless ($permission->{'create'}) {
+               $context = 'helpdesk';
+           }
            $r->print($start_page.$crumbs."\n".'<div>'.
                      &Apache::loncoursequeueadmin::display_queued_requests(
-                         'domain',$env{'request.role.domain'}).'</div>'.
+                         $context,$env{'request.role.domain'},undef,).'</div>'.
                      &Apache::loncommon::end_page());
-       } elsif (($env{'form.phase'} eq 'requestchange') && ($show_all_choices)) {
+       } elsif (($permission->{'create'}) &&
+                ($env{'form.phase'} eq 'requestchange') && ($show_all_choices)) {
            if ($env{'form.queue'} eq 'pending') {
                &Apache::lonhtmlcommon::add_breadcrumb
                    ({href=>"/adm/createcourse?phase=pendingdisplay",
@@ -1422,11 +1449,16 @@
            my $js = &courserequestbrowser_javascript();
            my $start_page=&Apache::loncommon::start_page('Display Pending Queue',$js);
            my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Display Pending Queue','Course_Requests',undef,'Course_Requests');
+           my $context = 'pending';
+           unless ($permission->{'create'}) {
+               $context = 'displaypending';
+           }
            $r->print($start_page.$crumbs."\n".'<div>'.
                      &Apache::loncoursequeueadmin::display_queued_requests(
-                         'pending',$env{'request.role.domain'}).'</div>'.
+                         $context,$env{'request.role.domain'}).'</div>'.
                      &Apache::loncommon::end_page());
-       } elsif (($env{'form.phase'} eq 'requestvalidation') && ($show_all_choices)) {
+       } elsif (($permission->{'create'}) &&
+                ($env{'form.phase'} eq 'requestvalidation') && ($show_all_choices)) {
            my $js = &courserequestbrowser_javascript();
            &Apache::lonhtmlcommon::add_breadcrumb
                  ({href=>"/adm/createcourse?phase=pendingdisplay",
@@ -1453,7 +1485,7 @@
            &print_creation_logs($r);
            $r->print('</div>'.&Apache::loncommon::end_page());
        } else {
-           &print_intro_page($r,$show_all_choices,\%cancreate);
+           &print_intro_page($r,$show_all_choices,\%cancreate,$permission);
        }
    } else {
       $env{'user.error.msg'}=
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.55 loncom/interface/loncoursequeueadmin.pm:1.56
--- loncom/interface/loncoursequeueadmin.pm:1.55	Thu Aug 25 22:33:03 2016
+++ loncom/interface/loncoursequeueadmin.pm	Thu Oct  6 16:20:05 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Utilities to administer domain course requests and course self-enroll requests
 #
-# $Id: loncoursequeueadmin.pm,v 1.55 2016/08/25 22:33:03 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.56 2016/10/06 16:20:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -396,6 +396,8 @@
         if ($context eq 'pending') {
             $disposition = 'pending';
             $nextphase = 'requestvalidation';
+        } elsif ($context eq 'displaypending') {
+            $disposition = 'pending';
         }
         %requesthash = &Apache::lonnet::dump_dom($namespace,$dom,'_'.$disposition);
         $nextelement = '<input type="hidden" name="phase" value="'.$nextphase.'" />';
@@ -422,7 +424,7 @@
                     my ($cnum,$disposition) = split('_',$item);
                     $entry = $cnum.':'.$requesthash{$item}{'ownername'}.':'.
                              $requesthash{$item}{'ownerdom'}.':';
-                    if ($context eq 'pending') {
+                    if (($context eq 'pending') || ($context eq 'displaypending')) {
                         $entry .= $requesthash{$item}{'instcode'};
                     } else {
                         $entry .= $requesthash{$item}{'crstype'};
@@ -441,10 +443,12 @@
         if (keys(%queue_by_date) > 0) {
             if ($context eq 'course') {
                 $output .=  '<h3>'.&mt('Self-enrollment requests queued pending approval by a Coordinator').'</h3>';
-            } elsif ($context eq 'pending') {
+            } elsif (($context eq 'pending') || ($context eq 'displaypending')) {
                 $output .= '<h3>'.&mt('Requests for official courses queued pending validation').'</h3>'.
                            '<p>'.&mt('Requests are validated against institutional data to confirm that the requestor is an instructor of record.').'<br />'.
-                           &mt('Validation is attempted when the request is submitted.').' '.&mt('If unvalidated, the request will be held in a queue.').' '.&mt('Validation of pending requests is automatically repeated daily.').'</p>';
+                           &mt('Validation is attempted when the request is submitted.').' '.
+                           &mt('If unvalidated, the request will be held in a queue.').' '.
+                           &mt('Validation of pending requests is automatically repeated daily.').'</p>';
             } elsif ($context eq 'requestauthor') {
                 $output .= '<h3>'.&mt('Requests for Authoring Space queued pending approval by a Domain Coordinator').'</h3>';
             } elsif ($context eq 'requestusername') {
@@ -472,8 +476,9 @@
         if ($context eq 'pending') {
             $output .= '<br /><input type="submit" name="validationcheck" value="'.
                        &mt('Validate').'" /><br />'."\n".
-                       '<p>'.&mt('Any course/community requests which are successfully validated will be created immediately.').' '.&mt('Unvalidated requests will be listed for manual approval/rejection.').'</p>';
-        } else {
+                       '<p>'.&mt('Any course/community requests which are successfully validated will be created immediately.').' '.
+                             &mt('Unvalidated requests will be listed for manual approval/rejection.').'</p>';
+        } elsif (($context ne 'helpdesk') && ($context ne 'displaypending')) {
             $output .= '<br /><input type="submit" name="processqueue" value="'.&mt('Save').'" />';
         }
         $output .= '</form>';
@@ -481,7 +486,7 @@
         $output .= '<div class="LC_info">';
         if ($context eq 'course') {
             $output .= &mt('There are currently no enrollment requests awaiting approval.');
-        } elsif ($context eq 'pending') {
+        } elsif (($context eq 'pending') || ($context eq 'displaypending')) {
             $output .= &mt('There are currently no requests for official courses awaiting validation.');
         } elsif ($context eq 'requestauthor') {
             $output .= &mt('There are currently no requests for Authoring Space awaiting approval.');
@@ -501,7 +506,7 @@
     my %crstypes;
     my $output =  &Apache::loncommon::start_data_table().
                   &Apache::loncommon::start_data_table_header_row();
-    unless ($context eq 'pending') { 
+    unless (($context eq 'pending') || ($context eq 'displaypending') || ($context eq 'helpdesk')) { 
         $output .= '<th>'.&mt('Action').'</th>';
     }
     $output .= '<th>'.&mt('Requestor').'</th>';
@@ -513,7 +518,7 @@
     } elsif ($context eq 'requestusername') {
         $output .= '<th>'.&mt('Date requested').'</th>'.
                    '<th>'.&mt('Details').'</th>';
-    } elsif ($context eq 'pending' || $context eq 'stillpending') {
+    } elsif ($context eq 'pending' || $context eq 'displaypending' || $context eq 'stillpending') {
         $output .= '<th>'.&mt('Institutional code').'</th>'.
                    '<th>'.&mt('Date requested').'</th>'.
                    '<th>'.&mt('Details').'</th>';
@@ -569,7 +574,7 @@
                 } else {
                     my ($cnum,$ownername,$ownerdom,$type,$cdesc);
                     my $queued = 'approval'; 
-                    if ($context eq 'pending' || $context eq 'stillpending') {
+                    if ($context eq 'pending' || $context eq 'displaypending' || $context eq 'stillpending') {
                         ($cnum,$ownername,$ownerdom,$instcode,$cdesc)=split(/:/,$request,5);
                         $queued = 'pending';                        
                     } else {
@@ -587,7 +592,7 @@
                                 &Apache::loncommon::plainname($ownername,$ownerdom),
                                 $ownername,$ownerdom);
                 }
-                unless ($context eq 'pending') {
+                unless (($context eq 'pending') || ($context eq 'displaypending') || ($context eq 'helpdesk')) {
                     $row = '<td><span class="LC_nobreak"><label>'.
                            '<input type="radio" value="'.$approve.'" name="'.$count.'radioreq" />'.&mt('Approve').'</label>'.
                            '<label>'.(' 'x2).
@@ -606,7 +611,7 @@
                     $row .= '<td>'.$showtime.'</td>'."\n".
                             '<td>'.$detailslink.'</td>'."\n";
                 } else { 
-                    if ($context eq 'pending' || $context eq 'stillpending') {
+                    if ($context eq 'pending' || $context eq 'displaypending' || $context eq 'stillpending') {
                         $row .= '<td>'.$instcode.'</td>'."\n";
                     } else {
                         $row .= '<td>'.$crstype.'</td>'."\n";
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.167 loncom/interface/mydesk.tab:1.168
--- loncom/interface/mydesk.tab:1.167	Wed Oct  5 13:59:46 2016
+++ loncom/interface/mydesk.tab	Thu Oct  6 16:20:05 2016
@@ -205,6 +205,7 @@
 5:2:pmau:$requested_domain:cprv.png:user[_1]:privs[_1]:go('/adm/createuser');:Create users or modify the roles and privileges of users:umn
 5:3:clear
 5:3:pccc:$requested_domain:ccrs.png:course[_8]:creation[_1]:go('/adm/createcourse');:Course and community creation:ccm
+5:3:pdcc:$requested_domain:ccrs.png:course[_8]:creation[_1]:go('/adm/createcourse');:Course and community creation:ccm
 5:3:popa:$crs:parm.png:course[_9]:parms[_1]:go('/adm/parmset');:Modify parameter settings (due dates, etc) for resources and the course:cmn
 5:3:popa:$cmty:parm.png:communi-[_6]:ty parms[_1]:go('/adm/parmset');:Modify parameter settings (due dates, etc) for resources and the community:cmm
 6:1:clear
Index: loncom/auth/roles.tab
diff -u loncom/auth/roles.tab:1.62 loncom/auth/roles.tab:1.63
--- loncom/auth/roles.tab:1.62	Wed Oct  5 13:30:16 2016
+++ loncom/auth/roles.tab	Thu Oct  6 16:20:15 2016
@@ -29,7 +29,7 @@
 aa:s sma:bro:pav
 aa:d are:ere
 dg:d bre&R
-dh:d sma:rar:dcd
+dh:d sma:rar:dcd:dcc
 sc:d usc
 
 
Index: loncom/auth/rolesplain.tab
diff -u loncom/auth/rolesplain.tab:1.45 loncom/auth/rolesplain.tab:1.46
--- loncom/auth/rolesplain.tab:1.45	Wed Oct  5 13:30:16 2016
+++ loncom/auth/rolesplain.tab	Thu Oct  6 16:20:15 2016
@@ -86,6 +86,7 @@
 usc:Upload bubblesheet data
 rar:Receive ad hoc role in course or community
 dcd:Display detailed information in course catalog  
+dcc:Display information about course creation and requests
 pfo:Print for other users and entire course
 pav:Advanced printing options (with answers, discussions, all foils, ...)
 adv:Advanced Role


More information about the LON-CAPA-cvs mailing list