--- loncom/homework/radiobuttonresponse.pm 2007/06/29 17:32:31 1.123
+++ loncom/homework/radiobuttonresponse.pm 2008/10/24 16:22:54 1.136
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# mutliple choice style responses
#
-# $Id: radiobuttonresponse.pm,v 1.123 2007/06/29 17:32:31 albertel Exp $
+# $Id: radiobuttonresponse.pm,v 1.136 2008/10/24 16:22:54 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -18,8 +18,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with LON-CAPA; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with LON-CAPA; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
@@ -56,8 +55,6 @@ sub start_radiobuttonresponse {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
-
-
#when in a radiobutton response use these
&Apache::lonxml::register('Apache::radiobuttonresponse',('foilgroup','foil','conceptgroup'));
push (@Apache::lonxml::namespace,'radiobuttonresponse');
@@ -68,17 +65,19 @@ sub start_radiobuttonresponse {
if ($target eq 'meta') {
$result=&Apache::response::meta_package_write('radiobuttonresponse');
} elsif ($target eq 'edit' ) {
- $result.=&Apache::edit::start_table($token).
- '
";
@@ -652,12 +697,18 @@ sub displayallanswers {
}
sub displayanswers {
- my ($answer, $whichopt)=@_;
- my $result=&Apache::response::answer_header('radiobuttonresponse');
+ my ($answer, $whichopt, $bubbles_per_line)=@_;
+ my $result;
+
if ($Apache::lonhomework::type eq 'exam') {
- my $correct = ('A'..'Z')[$answer];
- $result.=&Apache::response::answer_part('radiobuttonresponse',
- $correct);
+ my $line = int($answer/$bubbles_per_line);
+ my $correct = ('A'..'Z')[$answer%$bubbles_per_line];
+ $result .= &Apache::response::answer_header('radiobuttonresponse',
+ $line);
+ $result .= &Apache::response::answer_part('radiobuttonresponse',
+ $correct);
+ } else {
+ $result .= &Apache::response::answer_header('radiobuttonresponse');
}
foreach my $name (@{ $whichopt }) {
$result.=&Apache::response::answer_part('radiobuttonresponse',
@@ -747,11 +798,11 @@ sub end_foil {
if ($value ne 'unused') {
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
if ($name eq "") {
- &Apache::lonxml::warning("Foils without names exist. This can cause problems to malfunction.");
+ &Apache::lonxml::warning(&mt('Foils without names exist. This can cause problems to malfunction.'));
$name=$Apache::lonxml::curdepth;
}
if (defined($Apache::response::foilnames{$name})) {
- &Apache::lonxml::error(&mt("Foil name [_1] appears more than once. Foil names need to be unique.",$name));
+ &Apache::lonxml::error(&mt('Foil name [_1] appears more than once. Foil names need to be unique.',''.$name.''));
}
$Apache::response::foilnames{$name}++;
my $location =&Apache::lonxml::get_param('location',$parstack,