--- loncom/homework/structuretags.pm 2024/02/27 19:53:40 1.512.2.24.2.11
+++ 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.11 2024/02/27 19:53:40 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
#
@@ -406,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',
);
@@ -693,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);
@@ -776,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
' . &Apache::lonxml::message_location();
$return .= '
@@ -869,6 +884,7 @@ sub option {
sub problem_web_to_edit_header {
my ($rndseed)=@_;
+ my %editors = &Apache::loncommon::permitted_editors();
my $result .= '
';
if (!$Apache::lonhomework::parsing_a_task) {
@@ -968,7 +984,8 @@ $show_all
-
+
@@ -997,10 +1014,21 @@ $show_all
';
$result.='';
- $result .= '';
- $result .= '';
+ if ($editors{'edit'}) {
+ $result .= '';
+ }
+ if ($editors{'xml'}) {
+ $result .= '';
+ }
+ if (($editors{'daxe'}) &&
+ ($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9)) {
+ my $uri = $env{'request.uri'};
+ my $daxeurl = '/daxepage'.$uri;
+ $result .= '';
+ }
$result.='
@@ -1027,8 +1055,8 @@ sub initialize_storage {
|| $Apache::lonhomework::type eq 'practice') {
my $namespace = $symb || $env{'request.uri'};
- if ($env{'form.resetdata'} eq &mt('Reset Submissions') ||
- ($env{'form.resetdata'} eq &mt('New Problem Variation')
+ if ($env{'form.resetdata'} eq 'reset_submissions' ||
+ ($env{'form.resetdata'} eq 'new_problem_variation'
&& $env{'form.submitted'} eq 'yes') ||
$env{'form.newrandomization'} eq &mt('New Randomization')) {
&Apache::lonnet::tmpreset($namespace,'',$domain,$name);
@@ -1574,10 +1602,13 @@ sub access_status_msg {
$msg ='\noindent \vskip 1 mm '.
$startminipage.'\vskip 0 mm';
if ($status eq 'UNAVAILABLE') {
- $msg.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
+ $msg.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.');
+ } elsif ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
+ $msg.=&mt('Problem is not open to be viewed. It')." $accessmsg";
} else {
- $msg.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
+ $msg.=&mt('Problem is not open to be viewed.');
}
+ $msg .= " \\vskip 0 mm ";
}
return $msg;
}
@@ -1916,8 +1947,8 @@ sub start_problem {
}
$form_tag_start.=''.
- '';
+ '';
if (exists($env{'form.username'})) {
$form_tag_start.=
''.
+ $result.= ''.
&practice_problem_header().'';
} elsif ($Apache::lonhomework::type eq 'randomizetry') {
my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries");
@@ -2305,8 +2336,8 @@ sub start_library {
'';
$result.=&problem_web_to_edit_header($rndseed);
if ($Apache::lonhomework::type eq 'practice') {
- $result.= ''.
+ $result.= ''.
&practice_problem_header().'';
}
}
@@ -3258,7 +3289,7 @@ sub end_startouttext {
.&Apache::edit::deletelist($target,$token)
.''
.'
';
- if ($env{'environment.nocodemirror'}) {
+ if (&Apache::loncommon::nocodemirror()) {
$result.=&Apache::lonhtmlcommon::dragmath_button($areaid,1);
} else {
$result.=' ';