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

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 07 Jul 2006 21:25:03 -0000


raeburn		Fri Jul  7 17:25:03 2006 EDT

  Modified files:              
    /loncom/interface	loncoursegroups.pm lonsimplepage.pm 
  Log:
  Replacing grppg with smppg for file name of group home pages. Detection of group context from presence of course's domain and coursenumber in page URL (instead of a username and user domain).
  
  
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.48 loncom/interface/loncoursegroups.pm:1.49
--- loncom/interface/loncoursegroups.pm:1.48	Fri Jul  7 17:20:25 2006
+++ loncom/interface/loncoursegroups.pm	Fri Jul  7 17:25:02 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.48 2006/07/07 21:20:25 albertel Exp $
+# $Id: loncoursegroups.pm,v 1.49 2006/07/07 21:25:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -273,7 +273,7 @@
                     if ($action eq 'modify' || $action eq 'delete') {
                         $link .= $group;
                     } else {
-                        $link .= $group.'/grppg';
+                        $link .= $group.'/smppg';
                     }
                     $link .= '">'.$lt{$action}.'</a>';
                     if ($action eq 'view') { 
@@ -330,7 +330,7 @@
                     my $description = &unescape(
                                         $group_info{description});
                     my ($uname,$udom) = split(/:/,$group_info{creator});
-                    $r->print('<font size="+1"><a href="/adm/'.$udom.'/'.$uname.'/'.$group.'/grppg">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />');
+                    $r->print('<font size="+1"><a href="/adm/'.$udom.'/'.$uname.'/'.$group.'/smppg">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />');
                 }
             }
         } else {
@@ -3276,7 +3276,7 @@
             }
         }
         my $grpfolder = &mt('[_1] Folder -',$ucgpterm,).$description;
-        $grppage='/adm/'.$cdom.'/'.$cnum.'/'.$groupname.'/grppg';
+        $grppage='/adm/'.$cdom.'/'.$cnum.'/'.$groupname.'/smppg';
         my $grptitle = &mt('Group homepage').' - '.$description;
         my ($seqid,$discussions,$disctitle);
         my $outcome = &map_updater($cdom,$cnum,'group_folder_'.$groupname.'.sequence',
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.42 loncom/interface/lonsimplepage.pm:1.43
--- loncom/interface/lonsimplepage.pm:1.42	Fri Jun 30 14:06:47 2006
+++ loncom/interface/lonsimplepage.pm	Fri Jul  7 17:25:02 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.42 2006/06/30 18:06:47 raeburn Exp $
+# $Id: lonsimplepage.pm,v 1.43 2006/07/07 21:25:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,7 +49,7 @@
     if ($target eq 'tex') {
 	$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
     } 
-    my (undef,undef,undef,undef,$marker,$caller)=split(/\//,$r->uri);
+    my (undef,undef,$udom,$uname,$marker,$caller)=split(/\//,$r->uri);
 # Is this even in a course?
     unless ($env{'request.course.id'}) {
 	if ($target ne 'tex') {
@@ -65,20 +65,22 @@
     my $grp_view_permission = &Apache::lonnet::allowed('vcg',
                                                    $env{'request.course.id'});
     my $namespace;
+    my $group;
 
     my %curr_group = ();
     my %groupinfo = ();
-    if ($caller eq 'grppg') {
+    if ($dom && $crs && ($udom eq $dom) && ($uname eq $crs)) {
         $marker =~ s/\W//g;
-        $namespace = 'grppage_'.$marker;
-        my %curr_groups = &Apache::longroup::coursegroups($dom,$crs,$marker);
+        $group = $marker;
+        my %curr_groups = &Apache::longroup::coursegroups($dom,$crs,$group);
         if (!%curr_groups) {
 	    &Apache::loncommon::simple_error_page($r,'','Invalid group name');
 	    return OK;
         }
         %groupinfo = 
-	    &Apache::longroup::get_group_settings($curr_groups{$marker});
-    } else {  
+	    &Apache::longroup::get_group_settings($curr_groups{$group});
+        $namespace = 'grppage_'.$group;
+    } else {
         $marker=~s/\D//g;
         $namespace = 'smppage_'.$marker;
     }
@@ -93,7 +95,7 @@
        'aaa_title'         => 'Page Title',
        'bbb_content'       => 'Content',
        'ccc_webreferences' => 'Web References');
-    if ($caller eq 'grppg') {
+    if ($group ne '') {
         $syllabusfields{'abb_links'} = &mt('Functionality');
     }
 
@@ -114,7 +116,7 @@
 
     if ($target ne 'tex') {
         my $title = 'Course Page';
-        if ($caller eq 'grppg') {
+        if ($group ne '') {
             $title = 'Group Page';
         }
 	my $start_page = 
@@ -126,7 +128,7 @@
 	$r->print($start_page);
     }
 
-    if ($caller eq 'grppg') {
+    if ($group ne '') {
         if (($grp_view_permission) || 
                            (&Apache::longroup::check_group_access($caller))) {
             if ((!&Apache::lonnet::allowed('vgh',
@@ -150,7 +152,7 @@
     }
 
     my $allowed;
-    if ($caller eq 'grppg') {
+    if ($group ne '') {
         $allowed  = &Apache::lonnet::allowed('mdg',$env{'request.course.id'});
         if (!$allowed) {
             $allowed = &Apache::lonnet::allowed('mgh',$env{'request.course.id'}.
@@ -236,7 +238,7 @@
 		    $message=&Apache::lonspeller::markeduptext($message);
 		}
 		$message=&Apache::lontexconvert::msgtexconverted($message);
-                if ($_ eq 'abb_links' && $caller eq 'grppg') {
+                if ($_ eq 'abb_links' && $group ne '') {
                     $r->print('<br /><input type="hidden" name="'.$_.
                                           '" value="'.$syllabus{$_}.'" />');
                     &display_group_links($r,$target,$marker,'edit',%groupinfo);