--- loncom/homework/structuretags.pm 2023/09/11 12:08:18 1.512.2.24.2.6
+++ loncom/homework/structuretags.pm 2024/02/28 00:19:04 1.512.2.24.2.13
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.512.2.24.2.6 2023/09/11 12:08:18 raeburn Exp $
+# $Id: structuretags.pm,v 1.512.2.24.2.13 2024/02/28 00:19:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -273,7 +273,7 @@ sub homework_js {
}
return &Apache::loncommon::resize_textarea_js().
&Apache::loncommon::colorfuleditor_js().
- &setmode_javascript().
+ &Apache::lonxml::setmode_javascript().
<<"JS";
-ENDSCRIPT
-}
-
sub page_start {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name,
$extra_head)=@_;
@@ -421,7 +406,7 @@ sub page_start {
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
my %textarea_args;
if (($env{'request.state'} ne 'construct') ||
- ($env{'environment.nocodemirror'})) {
+ (&Apache::loncommon::nocodemirror())) {
%textarea_args = (
dragmath => 'math',
);
@@ -708,7 +693,7 @@ sub setup_rndseed {
}
$env{'form.'.$Apache::inputtags::part.'.rndseed'}=$rndseed;
}
- if ( ($env{'form.resetdata'} eq &mt('New Problem Variation')
+ if ( ($env{'form.resetdata'} eq 'new_problem_variation'
&& $env{'form.submitted'} eq 'yes') ||
$env{'form.newrandomization'} eq &mt('New Randomization')) {
srand(time);
@@ -791,13 +776,18 @@ sub problem_edit_action_button {
sub problem_edit_buttons {
my ($mode)=@_;
+ my %editors = &Apache::loncommon::permitted_editors();
# Buttons that save
my $result = '
';
if ($mode eq 'editxml') {
- $result.=&problem_edit_action_button('subsaveedit','saveeditxml','s','Save and EditXML');
+ if ($editors{'xml'}) {
+ $result.=&problem_edit_action_button('subsaveedit','saveeditxml','s','Save and EditXML');
+ }
$result.=&problem_edit_action_button('subsaveview','saveviewxml','v','Save and View');
} else {
- $result.=&problem_edit_action_button('subsaveedit','saveedit','s','Save and Edit');
+ if ($editors{'edit'}) {
+ $result.=&problem_edit_action_button('subsaveedit','saveedit','s','Save and Edit');
+ }
$result.=&problem_edit_action_button('subsaveview','saveview','v','Save and View');
}
$result.="\n
'.
- &mt('A problem occurred when trying to start the timer.').'
';
- }
- $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");
- } elsif ($status eq 'RESERVABLE') {
- $msg.=&mt('Available to make a reservation.').' '.&mt('Reservation window closes [_1].',
- &Apache::lonnavmaps::timeToHumanString($accessmsg,'end')).
- ' '.
- &Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");
- } elsif ($status eq 'RESERVABLE_LATER') {
- $msg.=&mt('Window to make a reservation will open [_1].',
- &Apache::lonnavmaps::timeToHumanString($accessmsg,'start'));
- } elsif ($status eq 'NOTRESERVABLE') {
- $msg.=&mt('Not available to make a reservation.');
- }
- $result.=$msg.' ';
- } elsif ($target eq 'tex') {
- my $startminipage = ($env{'form.problem_split'}=~/yes/i)? ''
- : '\begin{minipage}{\textwidth}';
- $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 ';
- } else {
- $result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
- }
- }
+ if (($status eq 'NOT_YET_VIEWED') && ($firstaccres)) {
+ $result .= '
'.
+ &mt('A problem occurred when trying to start the timer.').'