[LON-CAPA-cvs] cvs: loncom /interface loncoursegroups.pm lonsimplepage.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 20 Jul 2006 03:11:53 -0000


This is a MIME encoded message

--raeburn1153365113
Content-Type: text/plain

raeburn		Wed Jul 19 23:11:53 2006 EDT

  Modified files:              
    /loncom/interface	lonsimplepage.pm loncoursegroups.pm 
  Log:
  Style - naming.  Caller (grppage) obsolete.  Store uploaded photos in right place. Add "Edit group settings" link for users with mdg priv in course.  Priv checking for roles with section specificity. Ensure vcg and mdg privs see page contents as well as links to group tools. Some &mt().  loncoursegroups - wording changes.  Add breadcrumb for access via "Edit settings" link on group home page.
  
  
--raeburn1153365113
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20060719231153.txt"

Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.44 loncom/interface/lonsimplepage.pm:1.45
--- loncom/interface/lonsimplepage.pm:1.44	Fri Jul  7 21:12:53 2006
+++ loncom/interface/lonsimplepage.pm	Wed Jul 19 23:11:52 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.44 2006/07/08 01:12:53 raeburn Exp $
+# $Id: lonsimplepage.pm,v 1.45 2006/07/20 03:11:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,7 +50,7 @@
     if ($target eq 'tex') {
 	$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
     } 
-    my (undef,undef,$udom,$uname,$marker,$caller)=split(/\//,$r->uri);
+    my (undef,undef,$udom,$uname,$marker)=split(/\//,$r->uri);
 # Is this even in a course?
     unless ($env{'request.course.id'}) {
 	if ($target ne 'tex') {
@@ -63,10 +63,8 @@
 
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
-    my $grp_view_permission = &Apache::lonnet::allowed('vcg',
-                                                   $env{'request.course.id'});
-    my ($namespace,$group,$grp_desc);
-
+    my ($namespace,$group,$group_desc,$group_home_view,$group_home_edit,
+        $group_view_perm,$group_edit_perm);
     my %curr_group = ();
     my %groupinfo = ();
     if ($dom && $crs && ($udom eq $dom) && ($uname eq $crs)) {
@@ -79,7 +77,7 @@
         }
         %groupinfo = 
 	    &Apache::longroup::get_group_settings($curr_groups{$group});
-        $grp_desc = &unescape($groupinfo{'description'});
+        $group_desc = &unescape($groupinfo{'description'});
         $namespace = 'grppage_'.$group;
     } else {
         $marker=~s/\D//g;
@@ -97,7 +95,7 @@
        'bbb_content'       => 'Content',
        'ccc_webreferences' => 'Web References');
     if ($group ne '') {
-        $syllabusfields{'abb_links'} = &mt('Functionality');
+        $syllabusfields{'abb_links'} = &mt('Available Group Tools');
     }
 
 
@@ -111,6 +109,10 @@
     my $forceedit='';
     if ($env{'form.forceedit'}) { $forceedit='edit'; }
 
+    my $refarg;
+    if ($env{'form.ref'}) {
+        $refarg = '&ref='.$env{'form.ref'};
+    }
    
     my %syllabus=&Apache::lonnet::dump($namespace,$dom,$crs);
        
@@ -131,20 +133,24 @@
     }
 
     if ($group ne '') {
-        if (($grp_view_permission) || 
-                            (&Apache::longroup::check_group_access($caller))) {
-            if ((!&Apache::lonnet::allowed('vgh',
-                                      $env{'request.course.id'}.'/'.$marker))
-                && (!&Apache::lonnet::allowed('mdg',
-                                     $env{'request.course.id'}.'/'.$marker))) {
-                if ($env{'form.ref'} eq 'grouplist') {
-                    my $gpterm =  &Apache::loncommon::group_term();
-                    my $ucgpterm = $gpterm;
-                    $ucgpterm =~ s/^(\w)/uc($1)/e;
-                    $r->print(&grouppage_breadcrumbs($dom,$crs,$group,$gpterm,
-                                                     $ucgpterm,$grp_desc));
-                }
-                &display_group_links($r,$target,$marker,'view',%groupinfo);
+        my $group_view_perm =
+               &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.
+               ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+        $group_edit_perm =
+               &Apache::lonnet::allowed('mdg',$env{'request.course.id'}.
+               ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+        $group_home_view = &Apache::lonnet::allowed('vgh',
+                                         $env{'request.course.id'}.'/'.$group);
+        $group_home_edit = &Apache::lonnet::allowed('mgh',
+                                         $env{'request.course.id'}.'/'.$group);
+        if ($group_view_perm || $group_edit_perm || $group_home_view || 
+            $group_home_edit || &Apache::longroup::check_group_access($group)) {
+            if (($env{'form.ref'} eq 'grouplist') && ($target ne 'tex')) {
+                $r->print(&grouppage_breadcrumbs($dom,$crs,$group,$group_desc));
+            }
+            if ((!$group_home_edit) && (!$group_home_view) && 
+                (!$group_view_perm) && (!$group_edit_perm)) {  
+                &display_group_links($r,$target,$group,'view',$refarg,%groupinfo);
                 return OK;
             }
         } else {
@@ -161,11 +167,11 @@
     }
 
     my $allowed;
+    
     if ($group ne '') {
-        $allowed  = &Apache::lonnet::allowed('mdg',$env{'request.course.id'});
+        $allowed  = $group_edit_perm;
         if (!$allowed) {
-            $allowed = &Apache::lonnet::allowed('mgh',$env{'request.course.id'}.
-                                                                  '/'.$marker);
+            $allowed = $group_home_edit; 
         }
     } else { 
         $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
@@ -179,10 +185,22 @@
     
     if ($allowed) {
 	$r->print('<p>'.
-		  &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.&mt('Show Student View').'</font></a>'.
+		  &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1'.$refarg.'"><font size="+1">'.&mt('Show Student View').'</font></a>'.
 		  &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
     } elsif ($privileged and $target ne 'tex') {
-	$r->print('<a href="'.$r->uri.'?forceedit=edit"><font size="+1">'.&mt('Edit').'</font></a>');
+        my $edittext = &mt('Edit');
+        if ($group ne '') {
+            $edittext = &mt('Edit Group Homepage');
+        }
+	$r->print('<a href="'.$r->uri.'?forceedit=edit'.$refarg.'"><font size="+1">'.$edittext.'</font></a>');
+        if ($group ne '') {
+            if ($group_edit_perm) {
+                $r->print('&nbsp;&nbsp;&nbsp;<font size="+1">'.
+               '<a href="/adm/coursegroups?action=modify&amp;refpage=grouplist'.
+               '&amp;state=pick_task&amp;groupname='.$group.'">'.
+               &mt('Edit Group Settings').'</a></font>');
+            }
+        }    
     } 
     if (($env{'form.uploaddoc.filename'} and $target ne 'tex') &&
 	($env{'form.storeupl'}) && ($allowed)) {
@@ -190,9 +208,9 @@
 	    if ($syllabus{'uploaded.photourl'}) {
 		&Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
 	    }
-            if ($caller eq 'grppage') {
+            if ($group ne '') {
                 $syllabus{'uploaded.photourl'}=&Apache::lonnet::userfileupload(
-                                              'uploaddoc',1,"grouppage/$marker");
+                                              'uploaddoc',1,"grouppage/$group");
             } else {
 	        $syllabus{'uploaded.photourl'}=
 		     &Apache::lonnet::userfileupload('uploaddoc',1,'simplepage');
@@ -216,9 +234,11 @@
     }
 
 # ---------------------------------------------------------------- Get syllabus
-    if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
+    if ((($syllabus{'uploaded.lastmodified'}) && 
+         (($group ne '' && ($group_home_view || $group_edit_perm || 
+           $group_view_perm)) || ($group eq ''))) || ($allowed)) { 
 	if ($syllabus{'uploaded.photourl'}) {
-	    &Apache::lonnet::allowuploaded('/adm/'.$caller,
+	    &Apache::lonnet::allowuploaded('/adm/smppg',
 					   $syllabus{'uploaded.photourl'});
 	    
 	    my $image='<img src="'.$syllabus{'uploaded.photourl'}.'"
@@ -250,7 +270,8 @@
                 if ($_ eq 'abb_links' && $group ne '') {
                     $r->print('<br /><input type="hidden" name="'.$_.
                                           '" value="'.$syllabus{$_}.'" />');
-                    &display_group_links($r,$target,$marker,'edit',%groupinfo);
+                    &display_group_links($r,$target,$group,'edit',$refarg,
+                                         %groupinfo);
                     $r->print('<br />');
                 } elsif ($_ eq 'aaa_title') {
                     if ($target ne 'tex') {
@@ -305,7 +326,11 @@
 	}
 	if ($env{'form.grade_target'} ne 'tex') {$r->print('</p>');}
     } else {
-	$r->print('<p>No page information provided.</p>');
+        if ($group ne '') {
+            &display_group_links($r,$target,$group,'view',$refarg,%groupinfo);
+        } else {
+	    $r->print(&mt('<p>No page information provided.</p>'));
+        }
     }
     if ($env{'form.grade_target'} ne 'tex') {
 	$r->print(&Apache::loncommon::end_page());
@@ -316,33 +341,30 @@
 }
 
 sub display_group_links {
-    my ($r,$target,$marker,$context,%groupinfo) = @_;
-    my $refarg;
-    if ($env{'form.ref'} eq 'grouplist') {
-        $refarg = '&amp;ref=grouplist';
-    }
+    my ($r,$target,$group,$context,$refarg,%groupinfo) = @_;
     my @available = ();
     my %menu = ();
     %{$menu{'email'}} = (
                         text => 'Group e-mail',
-                        href => '/adm/email?compose=group&amp;group='.$marker.
-                        $refarg,
+                        href => '/adm/email?compose=group&amp;group='.$group.
+                                $refarg,
                       );
     %{$menu{'discussion'}} = (
                         text => 'Discussion Boards',
-                        href => '/adm/groupboards?group='.$marker.$refarg,
+                        href => '/adm/groupboards?group='.$group.$refarg,
                       );
     %{$menu{'chat'}} = (
                         text => 'Group chat',
-                        href => "javascript:group_chat('$marker')",
+                        href => "javascript:group_chat('$group')",
                       );
     %{$menu{'files'}} = (
                         text => 'File repository',
-                        href => '/adm/coursegrp_portfolio?group='.$marker.$refarg,
+                        href => '/adm/coursegrp_portfolio?group='.$group.
+                                $refarg,
                       );
     %{$menu{'roster'}} = (
                         text => 'Membership roster',
-                        href => '/adm/grouproster?group='.$marker.$refarg,
+                        href => '/adm/grouproster?group='.$group.$refarg,
                       );
     foreach my $tool (sort(keys(%menu))) {
         if ($groupinfo{functions}{$tool} eq 'on') {
@@ -353,7 +375,7 @@
         my $output = '<table cellspacing="4" cellpadding="4"><tr>';
         foreach my $tool (@available) {
             if ($target eq 'tex') {
-                $output .= '<td>'.$menu{$tool}{text}.'</td>';
+                $output .= '<td>'.&mt($menu{$tool}{text}).'</td>';
             } else {
                 $output .= '<td><a href="'.$menu{$tool}{href}.'">'.
                            $menu{$tool}{text}.'</a></td>';
@@ -361,16 +383,16 @@
         }
         $output .= '</tr></table>';
         if ($target eq 'tex') {
-            $r->print(&Apache::lonxml::xmlparse($r,'tex','Available functions<br /><br />'.$output));
+            $r->print(&Apache::lonxml::xmlparse($r,'tex',&mt('Available functions').'<br /><br />'.$output));
         } else {
-            $r->print('<h3>Functions</h3>'.$output);
+            $r->print('<h3>'.&mt('Available Group Tools').'</h3>'.$output);
         }
     } else {
         my $output;
         if ($context eq 'edit') {
-            $output = 'No group functionality';
+            $output = &mt('No group functionality.');
         } else {  
-            $output = 'No group functionality (e.g., e-mail, discussion, chat or file upload) is currently available to you in this group: '.$marker;
+            $output = &mt('No group functionality (e.g., e-mail, discussion, chat or file upload) is currently available to you in this group: <b>[_1]</b>.',&unescape($groupinfo{'description'}));
         }
         if ($target eq 'tex') {
             $r->print(&Apache::lonxml::xmlparse($r,'tex',$output));
@@ -381,17 +403,18 @@
 }
 
 sub grouppage_breadcrumbs {
-    my ($cdom,$cnum,$group,$gpterm,$ucgpterm,$description) = @_;
+    my ($cdom,$cnum,$group,$description) = @_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"/adm/coursegroups",
-          text=>"$ucgpterm".'s',
-          title=>"Display $ucgpterm".'s'},
+          text=>"Groups",
+          title=>"Display Groups"},
         {href=>"/adm/$cdom/$cnum/$group/smppg?ref=grouplist",
-          text=>"$ucgpterm: $description",
+          text=>"Group: $description",
           title=>"Go to group's home page"},
         );
-    my $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('[_1] page - [_2]',$gpterm,$description));
+    my $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('Group page - [_1]',
+                                                           $description));
     return $output;
 }
 
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.53 loncom/interface/loncoursegroups.pm:1.54
--- loncom/interface/loncoursegroups.pm:1.53	Wed Jul 19 19:28:20 2006
+++ loncom/interface/loncoursegroups.pm	Wed Jul 19 23:11:52 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.53 2006/07/19 23:28:20 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.54 2006/07/20 03:11:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -840,6 +840,11 @@
           ({href=>"/adm/coursegroups",
             text=>"Groups",
             faq=>9,bug=>'Instructor Interface',});
+        if ($env{'form.refpage'} eq 'grouplist') {
+            &Apache::lonhtmlcommon::add_breadcrumb
+             ({href=>"/adm/$cdom/$cnum/$env{'form.groupname'}/smppg?ref=grouplist",
+               text=>"Group: $description",});
+        }
     }
 
     my %trail = ();
@@ -2485,7 +2490,9 @@
                       'members being added or modified, '. 
                       'there are no optional privileges to set '.
                       'for specific members.',
-            'algr' => 'All group members will receive the same privileges.',
+            'algr' => 'All new group members will receive the same privileges.',            'ifex' => 'If previously expired members are being re-enabled, or '.
+                      'if access for future members is being activated now, '.
+                      'previously set privileges will be preserved.',
             'asno' => 'As no group members are being added, '.
                       'there are no specific user privileges to set.',
             'asng' => 'As no group tools will be made available to users, '.
@@ -2619,7 +2626,7 @@
             }
         } else {
             if (keys(%{$usertools}) > 0) {
-                $r->print($lt{'algr'}.'<br /><br />');
+                $r->print($lt{'algr'}.'<br />'.$lt{'ifex'}.'<br /><br />');
                 &display_defprivs($r,$tools,$toolprivs,\@defprivs);
             } else {
                 $r->print($lt{'asno'}.'<br />');

--raeburn1153365113--