version 1.255, 2006/06/30 05:10:29
|
version 1.259, 2006/10/02 20:44:31
|
Line 480 sub check_access {
|
Line 480 sub check_access {
|
if (!$first_access) { |
if (!$first_access) { |
$status='NOT_YET_VIEWED'; |
$status='NOT_YET_VIEWED'; |
my $due_date = &due_date($id); |
my $due_date = &due_date($id); |
$datemsg=&seconds_to_human_length($due_date-time); |
my $seconds_left = $due_date - time; |
|
if ($seconds_left > $interval || $due_date eq '') { |
|
$seconds_left = $interval; |
|
} |
|
$datemsg=&seconds_to_human_length($seconds_left); |
} |
} |
} |
} |
} |
} |
Line 510 sub due_date {
|
Line 514 sub due_date {
|
my $due_date= &Apache::lonnet::EXT("resource.$part_id.duedate",$symb, |
my $due_date= &Apache::lonnet::EXT("resource.$part_id.duedate",$symb, |
$udom,$uname); |
$udom,$uname); |
&Apache::lonxml::debug("looking for due_date $part_id $symb $due_date"); |
&Apache::lonxml::debug("looking for due_date $part_id $symb $due_date"); |
if (defined($interval)) { |
if ($interval =~ /\d+/) { |
my $first_access=&Apache::lonnet::get_first_access('map',$symb); |
my $first_access=&Apache::lonnet::get_first_access('map',$symb); |
|
&Apache::lonxml::debug("looking for first_access $first_access"); |
if (defined($first_access)) { |
if (defined($first_access)) { |
$interval = $first_access+$interval; |
$interval = $first_access+$interval; |
$date = ($interval < $due_date)? $interval : $due_date; |
$date = ($interval < $due_date)? $interval : $due_date; |
Line 964 sub newproblem {
|
Line 969 sub newproblem {
|
# I don't like hard-coded filenames but for now, this will work. |
# I don't like hard-coded filenames but for now, this will work. |
use File::Copy; |
use File::Copy; |
my $templatefilename = |
my $templatefilename = |
$request->dir_config('lonIncludes').'/templates/blank.problem'; |
$request->dir_config('lonIncludes').'/templates/blank.'.$extension; |
&Apache::lonxml::debug("$templatefilename"); |
&Apache::lonxml::debug("$templatefilename"); |
my $dest = &Apache::lonnet::filelocation("",$request->uri); |
my $dest = &Apache::lonnet::filelocation("",$request->uri); |
copy($templatefilename,$dest); |
copy($templatefilename,$dest); |
Line 981 sub newproblem {
|
Line 986 sub newproblem {
|
my $instructions; |
my $instructions; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page("Create New $extension"); |
&Apache::loncommon::start_page("Create New $extension"); |
if ($templatelist) { $instructions=&mt(", select a template from the pull-down menu below.").'<br />'.&mt("Then");} |
$request->print(" |
my %lt=&Apache::lonlocal::texthash( 'create' => 'Creating a new', |
|
'resource' => 'resource', |
|
'requested' => 'The requested file', |
|
'not exist' => 'currently does not exist', |
|
'createnew' => 'To create a new', |
|
'click' => 'click on the', |
|
'Create' => 'Create', |
|
'button' => 'button'); |
|
$request->print(<<ENDNEWPROBLEM); |
|
$start_page |
$start_page |
<h1>$lt{'create'} $extension $lt{'resource'}</h1> |
<h1>".&mt("Creating a new $extension resource.")."</h1> |
$errormsg |
$errormsg |
$lt{'requested'} <tt>$shownurl</tt> $lt{'not exist'}. |
".&mt("The requested file [_1] currently does not exist.", |
|
"<tt>$shownurl</tt>")." |
<p> |
<p> |
<b>$lt{'createnew'} $extension$instructions $lt{'click'} "$lt{'Create'} $extension" $lt{'button'}.</b> |
<b> |
</p> |
".&mt("To create a new $extension, select a template from the". |
<p><form action="$url" method="POST"> |
"pull-down menu below. Then click on the \"Create $extension\" button.")."</b> |
ENDNEWPROBLEM |
</p><form action=\"$url\" method=\"POST\">"); |
|
|
if (defined($templatelist)) { |
if (defined($templatelist)) { |
$request->print("<select name=\"template\">$templatelist</select>"); |
$request->print("<select name=\"template\">$templatelist</select>"); |
} |
} |