--- loncom/homework/structuretags.pm 2008/12/11 04:54:32 1.434.2.1
+++ loncom/homework/structuretags.pm 2009/08/12 22:57:14 1.444.4.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.434.2.1 2008/12/11 04:54:32 raeburn Exp $
+# $Id: structuretags.pm,v 1.444.4.1 2009/08/12 22:57:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,6 +27,29 @@
#
###
+=pod
+
+=head1 NAME
+
+Apache::structuretags
+
+=head1 SYNOPSIS
+
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+
+=head1 NOTABLE SUBROUTINES
+
+=over
+
+=item
+
+=back
+
+=cut
+
package Apache::structuretags;
@@ -220,10 +243,11 @@ sub page_start {
my ($symb,undef,undef,undef,$publicuser)= &Apache::lonnet::whichuser();
if ($symb eq '' && !$publicuser) {
- my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference");
- $help=&mt("Browsing resource, all submissions are temporary.")." ";
- $page_start .= $help;
- }
+ if ($symb eq '' && !$publicuser) {
+ $page_start .= '
'
+ .&mt('Browsing resource, all submissions are temporary.')
+ .'
';
+ }
}
if (!defined($found{'body'}) && $env{'request.state'} ne 'construct') {
@@ -395,14 +419,16 @@ sub problem_web_to_edit_header {
'';
}
- my $show_all_foils_text =
- ($Apache::lonhomework::parsing_a_task) ?
- &mt(' Show All Instances')
- : &mt(' Show All Foils');
-
- my $show_all= '';
+ my $show_all_foils_text =
+ ($Apache::lonhomework::parsing_a_task) ?
+ &mt('Show All Instances')
+ : &mt('Show All Foils');
+
+ my $show_all= '';
@@ -551,12 +577,19 @@ sub initialize_storage {
if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }
}
-# -------------------------------------------------------------finalize_storage
-# Stores away the result has to a student's environment
-# checks form.grade_ for specific values, other wises stores
-# to the running users environment
-# Will increment totals for attempts, students, and corrects
-# if running user has student role.
+=pod
+
+=item finalize_storage()
+
+ Stores away the result has to a student's environment
+ checks form.grade_ for specific values, other wises stores
+ to the running users environment
+ Will increment totals for attempts, students, and corrects
+ if running user has student role.
+
+=cut
+
+
sub finalize_storage {
my ($given_symb) = @_;
my $result;
@@ -587,10 +620,16 @@ sub finalize_storage {
return $result;
}
-# -------------------------------------------------------------store_aggregates
-# Sends hash of values to be incremented in nohist_resourcetracker.db
-# for the course. Increments total number of attempts, unique students
-# and corrects for each part for an instance of a problem, as appropriate.
+=pod
+
+item store_aggregates()
+
+ Sends hash of values to be incremented in nohist_resourcetracker.db
+ for the course. Increments total number of attempts, unique students
+ and corrects for each part for an instance of a problem, as appropriate.
+
+=cut
+
sub store_aggregates {
my ($symb,$courseid) = @_;
my %aggregate;
@@ -638,10 +677,8 @@ sub checkout_msg {
return (<$lt{'resource'}
$lt{'id_expln'}
-
-
$lt{'warning'}
-
-
@@ -675,7 +712,7 @@ sub firstaccess_msg {
my $buttontext = &mt('Show Resource');
my $timertext = &mt('Start Timer?');
$result .= (<
+
@@ -866,14 +903,16 @@ sub start_problem {
'';
}
- if ($env{'request.role.adv'}) {
- $form_tag_start.=
- ' ';
+ if ($env{'request.role.adv'}) {
+ $form_tag_start.= ' ';
+
}
if ($Apache::lonhomework::type eq 'practice') {
$form_tag_start.=&practice_problem_header();
@@ -903,6 +942,8 @@ sub start_problem {
my $msg;
if ($status eq 'UNAVAILABLE') {
$msg.='
'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'
'.&mt('You are not currently signed up to work at this time and/or place.').'
';
} elsif ($status ne 'NOT_YET_VIEWED') {
$msg.='
'.&mt('Not open to be viewed').'
';
}
@@ -913,13 +954,13 @@ sub start_problem {
} elsif ($status eq 'NOT_YET_VIEWED') {
$msg.=&firstaccess_msg($accessmsg,$symb);
} elsif ($status eq 'NOT_IN_A_SLOT') {
- $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work.");
+ $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");
}
$result.=$msg.' ';
} elsif ($target eq 'tex') {
my $startminipage = ($env{'form.problem_split'}=~/yes/i)? ''
: '\begin{minipage}{\textwidth}';
- $result.='\begin{document}\noindent \vskip 1 mm '.
+ $result.='\noindent \vskip 1 mm '.
$startminipage.'\vskip 0 mm';
if ($status eq 'UNAVAILABLE') {
$result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
@@ -1020,7 +1061,7 @@ sub end_problem {
$allow_print_points=0;
}
my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
- my $begin_doc='\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource
"'.$name_of_resourse.'"
located in '.$env{'request.uri'}.' STAMPOFPASSEDRESOURCEEND} \noindent ';
+ my $begin_doc=' \typeout{STAMPOFPASSEDRESOURCESTART Resource
"'.$name_of_resourse.'"
located in '.$env{'request.uri'}.' STAMPOFPASSEDRESOURCEEND} \noindent ';
my $toc_line='\vskip 1 mm\noindent '.$startminipage.
'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
@@ -1028,8 +1069,10 @@ sub end_problem {
# it in the problem header. We have been logging the
# last due date written to file.
- my $duetime = &Apache::lonnet::EXT("resource.$id.duedate");
+ my $duetime = &Apache::lonnet::EXT("resource.$id.duedate");
my $duedate = POSIX::strftime("%c",localtime($duetime));
+ my $duedate_text = &mt('Due date: [_1]'
+ ,&Apache::lonlocal::locallocaltime($duetime));
my $temp_file;
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
@@ -1061,13 +1104,13 @@ sub end_problem {
if (not $env{'request.symb'} =~ m/\.page_/) {
if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
$frontmatter .= $begin_doc.
- '\textit{Due date: '.$duedate.'} '.$toc_line;
+ '\textit{'.$duedate_text.'} '.$toc_line;
} else {
$frontmatter.= $begin_doc.$toc_line;
if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';}
}
} else {
- $frontmatter .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\'.$startminipage;
+ $frontmatter .= '\vskip 1mm\textit{'.$duedate_text.'} \\\\\\\\'.$startminipage;
}
} else {
if (not $env{'request.symb'} =~ m/\.page_/) {
@@ -1563,6 +1606,20 @@ sub start_randomlist {
my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval);
$showarg--;
if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; }
+ if (($target eq 'analyze') && ($env{'form.check_parts_withrandomlist'})) {
+ my @currlist;
+ my $part = $Apache::inputtags::part;
+ if ($part ne '') {
+ if (ref($Apache::lonhomework::analyze{'parts_withrandomlist'}) eq 'ARRAY') {
+ my @currlist = @{$Apache::lonhomework::analyze{'parts_withrandomlist'}};
+ if (!(grep(/^\Q$part\E$/,@currlist))) {
+ push(@{$Apache::lonhomework::analyze{'parts_withrandomlist'}},$part);
+ }
+ } else {
+ push(@{$Apache::lonhomework::analyze{'parts_withrandomlist'}},$part);
+ }
+ }
+ }
for(0 .. $show) {
$bodytext .= "$randomlist[ $idx_arr[$_] ]";
}
@@ -1906,9 +1963,8 @@ sub end_startouttext {
if ($target eq 'edit') {
my $areaid = 'homework_edit_'.$Apache::lonxml::curdepth;
$text=&Apache::lonxml::get_all_text("endouttext",$parser,$style);
-
$result.=&Apache::edit::start_table($token)."
';
unless ($env{'environment.wysiwygeditor'} eq 'on') {
@@ -1983,9 +2039,16 @@ sub start_simpleeditbutton {
my $url=$env{'request.noversionuri'};
$url=~s/\?.*$//;
my ($symb) = &Apache::lonnet::whichuser();
- $result='
'.
- ''.&mt('Edit').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').
-&Apache::loncommon::help_open_topic('Caching').'
';
+# Warning make more sense and is more important on edit screen
+# $result='
'
+# .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.')
+# .&Apache::loncommon::help_open_topic('Caching')
+# .'