[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /interface/spreadsheet studentcalc.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 08 Dec 2004 00:56:01 -0000


albertel		Tue Dec  7 19:56:01 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/interface/spreadsheet	studentcalc.pm 
  Log:
  - BUG #2207, the SUBM,PGRD,PPRM links on the SPRS now go to the correct place.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.241 loncom/interface/loncommon.pm:1.242
--- loncom/interface/loncommon.pm:1.241	Fri Dec  3 21:05:23 2004
+++ loncom/interface/loncommon.pm	Tue Dec  7 19:56:00 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.241 2004/12/04 02:05:23 raeburn Exp $
+# $Id: loncommon.pm,v 1.242 2004/12/08 00:56:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2325,7 +2325,7 @@
 
 =item * &submlink()
 
-Inputs: $text $uname $udom $symb
+Inputs: $text $uname $udom $symb $target
 
 Returns: A link to grades.pm such as to see the SUBM view of a student
 
@@ -2333,15 +2333,64 @@
 
 ###############################################
 sub submlink {
-    my ($text,$uname,$udom,$symb)=@_;
+    my ($text,$uname,$udom,$symb,$target)=@_;
     if (!($uname && $udom)) {
 	(my $cursymb, my $courseid,$udom,$uname)=
 	    &Apache::lonxml::whichuser($symb);
 	if (!$symb) { $symb=$cursymb; }
     }
     if (!$symb) { $symb=&symbread(); }
-    return '<a href="/adm/grades?symb='.$symb.'&student='.$uname.
-	'&userdom='.$udom.'&command=submission">'.$text.'</a>';
+    $symb=&Apache::lonnet::escape($symb);
+    if ($target) { $target="target=\"$target\""; }
+    return '<a href="/adm/grades?&command=submission&'.
+	'symb='.$symb.'&student='.$uname.
+	'&userdom='.$udom.'" '.$target.'>'.$text.'</a>';
+}
+##############################################
+
+=pod
+
+=item * &pgrdlink()
+
+Inputs: $text $uname $udom $symb $target
+
+Returns: A link to grades.pm such as to see the PGRD view of a student
+
+=cut
+
+###############################################
+sub pgrdlink {
+    my $link=&submlink(@_);
+    $link=~s/(&command=submission)/$1&showgrading=yes/;
+    return $link;
+}
+##############################################
+
+=pod
+
+=item * &pprmlink()
+
+Inputs: $text $uname $udom $symb $target
+
+Returns: A link to parmset.pm such as to see the PPRM view of a
+student andn resource
+
+=cut
+
+###############################################
+sub pprmlink {
+    my ($text,$uname,$udom,$symb,$target)=@_;
+    if (!($uname && $udom)) {
+	(my $cursymb, my $courseid,$udom,$uname)=
+	    &Apache::lonxml::whichuser($symb);
+	if (!$symb) { $symb=$cursymb; }
+    }
+    if (!$symb) { $symb=&symbread(); }
+    $symb=&Apache::lonnet::escape($symb);
+    if ($target) { $target="target=\"$target\""; }
+    return '<a href="/adm/parmset?&command=set&'.
+	'symb='.$symb.'&uname='.$uname.
+	'&udom='.$udom.'" '.$target.'>'.$text.'</a>';
 }
 ##############################################
 
Index: loncom/interface/spreadsheet/studentcalc.pm
diff -u loncom/interface/spreadsheet/studentcalc.pm:1.26 loncom/interface/spreadsheet/studentcalc.pm:1.27
--- loncom/interface/spreadsheet/studentcalc.pm:1.26	Tue Nov  2 15:48:02 2004
+++ loncom/interface/spreadsheet/studentcalc.pm	Tue Dec  7 19:56:00 2004
@@ -1,5 +1,5 @@
 #
-# $Id: studentcalc.pm,v 1.26 2004/11/02 20:48:02 albertel Exp $
+# $Id: studentcalc.pm,v 1.27 2004/12/08 00:56:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -143,18 +143,9 @@
 sub convenience_links {
     my $self = shift;
     my ($resource) = @_;
-    my $symb = &Apache::lonnet::escape($resource->{'symb'});
-    my $result = <<"END";
-<a href="/adm/grades?symb=$symb&command=submission" target="LONcatInfo">
-    <img src="/adm/lonMisc/subm_button.gif" border=0 />
-    </a>
-<a href="/adm/grades?symb=$symb&command=gradingmenu" target="LONcatInfo">
-    <img src="/adm/lonMisc/pgrd_button.gif" border=0 />
-    </a>
-<a href="/adm/parmset?symb=$symb" target="LONcatInfo">
-    <img src="/adm/lonMisc/pprm_button.gif" border=0 />
-    </a>
-END
+    my $result=&Apache::loncommon::submlink('<img src="/adm/lonMisc/subm_button.gif" border="0" />',$self->{'name'},$self->{'domain'},$resource->{'symb'},'LONcatInfo');
+    $result .= &Apache::loncommon::pgrdlink('<img src="/adm/lonMisc/pgrd_button.gif" border="0" />',$self->{'name'},$self->{'domain'},$resource->{'symb'},'LONcatInfo');
+    $result .= &Apache::loncommon::pprmlink('<img src="/adm/lonMisc/pprm_button.gif" border="0" />',$self->{'name'},$self->{'domain'},$resource->{'symb'},'LONcatInfo');
     return $result;
 }