[LON-CAPA-cvs] cvs: loncom /interface loncoursegroups.pm loncreateuser.pm mydesk.tab

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 13 Dec 2007 01:08:48 -0000


This is a MIME encoded message

--raeburn1197508128
Content-Type: text/plain

raeburn		Wed Dec 12 20:08:48 2007 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm mydesk.tab loncoursegroups.pm 
  Log:
  bug 1931 - All user management functionality reached from a single icon/button/text link
  - Extra links available on user management main menu in domain (custom role editor) and course context (custom role editor, automated enrollment manager - if enabled - and manage course groups.
  
  mydesk.tab - change buttons
  loncreateuser.pm - modify main menu
  loncoursegroups.pm - add "Re-enable deleted group" link adjacent to "Create a group" link, if deleted groups exist.
  
  
--raeburn1197508128
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20071212200848.txt"

Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.207 loncom/interface/loncreateuser.pm:1.208
--- loncom/interface/loncreateuser.pm:1.207	Wed Dec 12 18:59:41 2007
+++ loncom/interface/loncreateuser.pm	Wed Dec 12 20:08:47 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.207 2007/12/12 23:59:41 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.208 2007/12/13 01:08:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2633,7 +2633,7 @@
     if (! exists($env{'form.action'})) {
         $r->print(&header());
         $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
-        $r->print(&print_main_menu($permission));
+        $r->print(&print_main_menu($permission,$context));
         $r->print(&Apache::loncommon::end_page());
     } elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {
         $r->print(&header());
@@ -2853,35 +2853,68 @@
 ###############################################################
 #  Menu Phase One
 sub print_main_menu {
-    my ($permission) = @_;
+    my ($permission,$context) = @_;
+    my %links = (
+                       domain => {
+                                   upload => 'Upload a File of Users',
+                                   singleuser => 'Add/Manage a Single User',
+                                   listusers => 'Manage Multiple Users',
+                                 },
+                       author => {
+                                   upload => 'Upload a File of Co-authors',
+                                   singleuser => 'Add/Manage a Single Co-author',
+                                   listusers => 'Display Co-authors and Manage Multiple Users',
+                                 },
+                       course => {
+                                   upload => 'Upload a File of Course Users',
+                                   singleuser => 'Add/Manage a Single Course User',
+                                   listusers => 'Display Class Lists and Manage Multiple Users',
+                                 },
+                     );
     my @menu =
         (
-          { text => 'Upload a File of Users to Modify/Create Users and/or Add roles',
+          { text => $links{$context}{'upload'},
             help => 'User_Management_Upload',
             action => 'upload',
             permission => $permission->{'cusr'},
             },
-          { text => 'Create User/Set User Roles for a single user',
+          { text => $links{$context}{'singleuser'}, 
             help => 'User_Management_Single_User',
             action => 'singleuser',
             permission => $permission->{'cusr'},
             },
-          { text => 'Display Lists of Users',
+          { text => $links{$context}{'listusers'},
             help => 'User_Management_List',
             action => 'listusers',
-            permission => $permission->{'view'},
-            },
-#          { text => 'Expire User Roles',
-#            help => 'User_Management_Drops',
-#            action => 'expire',
-#            permission => $permission->{'cusr'},
-#            },
-          { text => 'Edit Custom Roles',
-            help => 'Custom_Role_Edit',
-            action => 'custom',
-            permission => $permission->{'custom'},
+            permission => ($permission->{'view'} || $permission->{'cusr'}),
           },
         );
+    if ($context eq 'domain' || $context eq 'course') {
+        my $customlink =  { text => 'Edit Custom Roles',
+                            help => 'Custom_Role_Edit',
+                            action => 'custom',
+                            permission => $permission->{'custom'},
+                          };
+        push(@menu,$customlink);
+    }
+    if ($context eq 'course') {
+        my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; 
+        my @courselinks = 
+            (
+               { text => 'Automated Enrollment Manager',
+                 permission => (&Apache::lonnet::auto_run($cnum,$cdom)
+                                && $permission->{'cusr'}),
+                 url  => '/adm/populate',
+                 },
+               { text => 'Manage Course Groups',
+                 help => 'Course_Manage_Group',
+                 permission => $permission->{'grp_manage'},
+                 url => '/adm/coursegroups?refpage=cusr',
+               },
+            );
+        push(@menu,@courselinks);
+    }
     my $menu_html = '';
     foreach my $menu_item (@menu) {
         next if (! $menu_item->{'permission'});
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.86 loncom/interface/mydesk.tab:1.87
--- loncom/interface/mydesk.tab:1.86	Fri Nov  9 15:57:29 2007
+++ loncom/interface/mydesk.tab	Wed Dec 12 20:08:47 2007
@@ -59,16 +59,14 @@
 4:3:clear
 4:3:pvgr:$crs:stat.gif:course[_6]:stats[_1]:gopost('/adm/statistics','Problem Statistics');:View course assessment statistics:grd
 5:1:clear
-5:1:courseenv_student_classlist_view:any:clst.gif:course[_12]:roster[_1]:go('/adm/viewclasslist');:View course roster:umn
-5:1:pvcl:$crs:clst.gif:course[_12]:roster[_1]:go('/adm/dropadd?action=classlist');:View class list:umn
-5:1:pcst:$crs:enrl.gif:course[_7]:enroll[_1]:go('/adm/dropadd');:Manage student enrollment:umn
-#and groups in this course
 5:1:pmky:$requested_domain:keys.gif:manage[_1]:acc keys[_1]:go('/adm/managekeys');:Manage Access Keys:dom
 5:2:clear
-5:2:pcst:$crs:cprv.gif:user[_1]:roles[_1]:go('/adm/createuser');:Create a user or modify the roles and privileges of a user:umn
-5:2:pcca:$requested_domain:cprv.gif:user[_1]:roles[_1]:go('/adm/createuser');:Create a user or modify the roles and privileges of a user:umn
-5:2:pcdc:/:cprv.gif:user[_1]:roles[_1]:go('/adm/createuser');:Create a user or modify the roles and privileges of a user:umn
-5:2:pmau:$requested_domain:cprv.gif:user[_1]:roles[_1]:go('/adm/createuser');:Create a user or modify the roles and privileges of a user:umn
+5:2:courseenv_student_classlist_view:any:clst.gif:course[_12]:roster[_1]:go('/adm/viewclasslist');:View course roster:umn
+5:2:pvcl:$crs:clst.gif:course[_12]:roster[_1]:go('/adm/createuser?action=listusers');:View class lists:umn
+5:2:pcst:$crs:enrl.gif:user[_1]:roles[_1]:go('/adm/createuser');:Manage course users:umn
+5:2:pcca:$requested_domain:enrl.gif:user[_1]:roles[_1]:go('/adm/createuser');:Manage co-authors:umn
+5:2:pcdc:/:enrl.gif:user[_1]:roles[_1]:go('/adm/createuser');:Create users or modify the roles and privileges of users:umn
+5:2:pmau:$requested_domain:enrl.gif:user[_1]:roles[_1]:go('/adm/createuser');:Create users or modify the roles and privileges of users:umn
 5:3:clear
 5:3:pccc:$requested_domain:ccrs.gif:create[_1]:course[_8]:go('/adm/createcourse');:Create a new course:cmn
 5:3:popa:$crs:parm.gif:course[_9]:parms[_1]:go('/adm/parmset');:Modify parameter settings (due dates, etc) for resources and the course:cmn
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.70 loncom/interface/loncoursegroups.pm:1.71
--- loncom/interface/loncoursegroups.pm:1.70	Tue May  1 21:33:48 2007
+++ loncom/interface/loncoursegroups.pm	Wed Dec 12 20:08:47 2007
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.70 2007/05/02 01:33:48 albertel Exp $
+# $Id: loncoursegroups.pm,v 1.71 2007/12/13 01:08:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -140,10 +140,10 @@
     rosterbrowser.focus();
 }\n|;
     $r->print(&header('Groups',$jscript,$action,$state));
-    if ($env{'form.refpage'} eq 'enrl') {
+    if ($env{'form.refpage'} eq 'cusr') {
         &Apache::lonhtmlcommon::add_breadcrumb
-            ({href=>"/adm/dropadd",
-              text=>"Enrollment Manager"});
+            ({href=>"/adm/createuser",
+              text=>"User Management"});
     }
     &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"/adm/coursegroups",
@@ -189,6 +189,7 @@
                           dius   => 'Disk Use (%)',
                           nogr   => 'No groups exist.',
                           crng   => 'Create a new group',
+                          redg   => 'Re-enable a deleted group',
                           alth   => 'Although your current role has privileges'.
                                     ' to view any existing groups in this '.
                                     lc($crstype).', you do not have privileges '.
@@ -198,16 +199,28 @@
         if (!defined($action)) {
             $action = 'view';
         }
-        my $status;
+        my ($status,$reenable_link);
         if ($action eq 'reenable') {
             $status = 'deleted_groups';
+        } else {
+            if ($manage_permission) {
+                my %deleted_groups = 
+                    &Apache::longroup::coursegroups($cdom,$cnum,undef,'deleted_groups');
+                if (keys(%deleted_groups) > 0) {
+                    $reenable_link = '&nbsp;&nbsp;&nbsp;&nbsp;<a href="/adm/coursegroups?action=reenable&amp;refpage='.$env{'form.refpage'}.'">'.$lt{'redg'}.'</a>';
+                }
+            }
         }
         my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum,undef,
                                                           $status);
+
         if (%curr_groups) {
             if ($manage_permission) {
-                if (!exists($env{'form.refpage'})) { 
-                    $r->print('<br /><a href="/adm/coursegroups?action=create">'.$lt{'crng'}.'</a>');
+                if ($action ne 'reenable') {
+                    $r->print('<br /><a href="/adm/coursegroups?action=create&amp;refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>');
+                }
+                if ($reenable_link) {
+                    $r->print($reenable_link);
                 }
             }
             $r->print('<br /><br />');
@@ -312,8 +325,7 @@
                     }
                     $link .= '">'.$lt{$action}.'</a>';
                     if ($action eq 'view') { 
-                        if (($manage_permission) && 
-                            ($env{'form.refpage'} ne 'enrl')) {
+                        if ($manage_permission) { 
                             $link .= '&nbsp;&nbsp;'.$actionlinks{'modify'}.
                                       $group.'">'.$lt{'modify'}.'</a>'.
                                      '&nbsp;&nbsp;'.$actionlinks{'delete'}.
@@ -349,12 +361,14 @@
         } else {
             $r->print($lt{'nogr'});
             if ($manage_permission) {
-                if (!exists($env{'form.refpage'})) {
-                    $r->print('<br /><br /><a href="/adm/coursegroups?action=create">'.$lt{'crng'}.'</a>');
+                $r->print('<br /><br /><a href="/adm/coursegroups?action=create&amp;refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>');
+                if ($action ne 'reenable') {
+                    if ($reenable_link) {
+                        $r->print($reenable_link);
+                    }
                 }
             } else {
                 $r->print('<br /><br />'.$lt{'alth'});
-
             }
         }
     } else {
@@ -848,14 +862,14 @@
     $r->print(&header("Groups Manager",
 		      $jscript,$action,$state,$page,$loaditems));
 
-    if ($env{'form.refpage'} eq 'enrl') {
+    if ($env{'form.refpage'} eq 'cusr') {
         &Apache::lonhtmlcommon::add_breadcrumb
-        ({href=>"/adm/dropadd",
-          text=>"Enrollment Manager",
+        ({href=>"/adm/createuser",
+          text=>"User Management",
           faq=>9,bug=>'Instructor Interface',});
         if ($action eq 'modify' || $action eq 'delete') {
             &Apache::lonhtmlcommon::add_breadcrumb
-            ({href=>"/adm/coursegroups?refpage=enrl&action=$action",
+            ({href=>"/adm/coursegroups?refpage=cusr&action=$action",
               text=>"Groups",
               faq=>9,bug=>'Instructor Interface',});
         }
@@ -1132,7 +1146,7 @@
     my $prevtext = &mt('Go back');
     my $nexttext = &mt('Delete group');
     my $prev;
-    if ($env{'form.refpage'} eq 'enrl')  {
+    if ($env{'form.refpage'} eq 'cusr')  {
         $prev = 'view';
     }
     &display_navbuttons($r,$formname,$prev,$prevtext,
@@ -1288,7 +1302,7 @@
     my $prevtext = &mt('Go back');
     my $nexttext = &mt('Reenable group');
     my $prev;
-    if ($env{'form.refpage'} eq 'enrl')  {
+    if ($env{'form.refpage'} eq 'cusr')  {
         $prev = 'view';
     }
     &display_navbuttons($r,$formname,$prev,$prevtext,

--raeburn1197508128--