[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface/statistics lonstathelpers.pm
www
www@source.lon-capa.org
Sat, 17 Apr 2010 22:48:56 -0000
www Sat Apr 17 22:48:56 2010 EDT
Modified files:
/loncom/homework grades.pm
/loncom/interface/statistics lonstathelpers.pm
Log:
Allow user to select probem when called context-free
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.621 loncom/homework/grades.pm:1.622
--- loncom/homework/grades.pm:1.621 Sat Apr 17 16:38:38 2010
+++ loncom/homework/grades.pm Sat Apr 17 22:48:52 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.621 2010/04/17 16:38:38 www Exp $
+# $Id: grades.pm,v 1.622 2010/04/17 22:48:52 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,6 +43,7 @@
use Apache::Constants qw(:common);
use Apache::lonlocal;
use Apache::lonenc;
+use Apache::lonstathelpers;
use String::Similarity;
use LONCAPA;
@@ -9169,6 +9170,14 @@
}
}
+sub select_problem {
+ my ($r)=@_;
+ $r->print('<h2>'.&mt('Select the problem you want to grade').'</h2><form action="/adm/grades">');
+ $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1));
+ $r->print('<input type="hidden" name="command" value="gradingmenu" />');
+ $r->print('<input type="submit" value="'.&mt('Next').' →" /></form>');
+}
+
sub handler {
my $request=$_[0];
&reset_caches();
@@ -9200,11 +9209,12 @@
&Apache::lonenc::check_decrypt(\$symb);
$ssi_error = 0;
- if ($symb eq '' && $command eq '') {
+ if ($symb eq '' || $command eq '') {
#
# Not called from a resource
#
-
+ &startpage($request,undef,[],1,1);
+ &select_problem($request);
} else {
&init_perm();
if ($command eq 'submission' && $perm{'vgr'}) {
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.60 loncom/interface/statistics/lonstathelpers.pm:1.61
--- loncom/interface/statistics/lonstathelpers.pm:1.60 Sun Feb 28 23:58:55 2010
+++ loncom/interface/statistics/lonstathelpers.pm Sat Apr 17 22:48:56 2010
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstathelpers.pm,v 1.60 2010/02/28 23:58:55 raeburn Exp $
+# $Id: lonstathelpers.pm,v 1.61 2010/04/17 22:48:56 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -135,9 +135,9 @@
####################################################
####################################################
sub problem_selector {
- my ($AcceptedResponseTypes,$sequence_addendum) = @_;
+ my ($AcceptedResponseTypes,$sequence_addendum,$symbmode) = @_;
my $Str;
- $Str = "\n<table>\n";
+ $Str = &Apache::loncommon::start_data_table();
my $rb_count =0;
my ($navmap,@sequences) =
&Apache::lonstatistics::selected_sequences_with_assessments('all');
@@ -164,8 +164,10 @@
if (! defined($title) || $title eq '') {
($title) = ($res->src =~ m:/([^/]*)$:);
}
- $seq_str .= '<tr>'.
- qq{<td><input type="radio" id="$rb_count" name="problemchoice" value="$value"$checked /></td>}.
+ $seq_str .= &Apache::loncommon::start_data_table_row().
+ ($symbmode?
+ '<td><input type="radio" id="'.$rb_count.'" name="symb" value="'.&HTML::Entities::encode($res->symb,'<>&"').'" '.$checked.' /></td>'
+ :qq{<td><input type="radio" id="$rb_count" name="problemchoice" value="$value"$checked /></td>}).
'<td><label for="'.$rb_count.'">'.$resptype.'</label></td>'.
'<td><label for="'.$rb_count.'">'.$title.'</label>';
if (scalar(@response_ids) > 1) {
@@ -174,25 +176,25 @@
my $link = $res->link.'?symb='.&escape($res->shown_symb);
$seq_str .= (' 'x2).
'<a target="preview" href="'.$link.'">'.&mt('view').'</a>';
- $seq_str .= "</td></tr>\n";
+ $seq_str .= "</td>". &Apache::loncommon::end_data_table_row()."\n";
$rb_count++;
}
}
}
}
if ($seq_str ne '') {
- $Str .= '<tr><td> </td>'.
- '<td colspan="2"><b>'.$seq->compTitle.'</b></td>'.
- "</tr>\n".$seq_str;
+ $Str .= &Apache::loncommon::start_data_table_header_row().
+ '<th colspan="3">'.$seq->compTitle.'</th>'.
+ &Apache::loncommon::end_data_table_header_row()."\n".$seq_str;
if (defined($sequence_addendum)) {
- $Str .= '<tr>'.
+ $Str .= &Apache::loncommon::start_data_table_header_row().
('<td> </td>'x2).
'<td align="right">'.$sequence_addendum.'</td>'.
- "</tr>\n";
+ &Apache::loncommon::end_data_table_header_row()."\n";
}
}
}
- $Str .= "</table>\n";
+ $Str .= &Apache::loncommon::end_data_table()."\n";
return $Str;
}