--- loncom/homework/structuretags.pm 2024/02/27 19:53:40 1.512.2.24.2.11
+++ loncom/homework/structuretags.pm 2024/03/01 17:05:45 1.512.2.24.2.14
@@ -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.14 2024/03/01 17:05:45 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',
);
@@ -514,23 +514,25 @@ sub page_start {
} elsif (!defined($found{'body'})
&& $env{'request.state'} eq 'construct') {
if ($target eq 'web' || $target eq 'edit') {
- # Breadcrumbs for Authoring Space
- &Apache::lonhtmlcommon::clear_breadcrumbs();
- &Apache::lonhtmlcommon::add_breadcrumb({
- 'text' => 'Authoring Space',
- 'href' => &Apache::loncommon::authorspace($env{'request.uri'}),
- });
- # breadcrumbs (and tools) will be created
- # in start_page->bodytag->innerregister
+ unless ($env{'form.inhibitmenu'} eq 'yes') {
+ # Breadcrumbs for Authoring Space
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ 'text' => 'Authoring Space',
+ 'href' => &Apache::loncommon::authorspace($env{'request.uri'}),
+ });
+ # breadcrumbs (and tools) will be created
+ # in start_page->bodytag->innerregister
# FIXME Where are we?
-# &Apache::lonhtmlcommon::add_breadcrumb({
-# 'text' => 'Problem Editing', # 'Problem Testing'
-# 'href' => '',
-# });
- $pageheader =&Apache::loncommon::head_subbox(
- &Apache::loncommon::CSTR_pageheader());
- }
+# &Apache::lonhtmlcommon::add_breadcrumb({
+# 'text' => 'Problem Editing', # 'Problem Testing'
+# 'href' => '',
+# });
+ $pageheader = &Apache::loncommon::head_subbox(
+ &Apache::loncommon::CSTR_pageheader());
+ }
+ }
} elsif (!defined($found{'body'})) {
my %add_entries;
my $background=&Apache::lonxml::get_param('background',$parstack,
@@ -693,7 +695,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 +778,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 +886,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 +986,8 @@ $show_all
-
+
@@ -997,10 +1016,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 +1057,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 +1604,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 +1949,8 @@ sub start_problem {
}
$form_tag_start.=''.
- '';
+ '';
if (exists($env{'form.username'})) {
$form_tag_start.=
'';
# create a page header and exit
if ($env{'request.state'} eq "construct") {
- $result.= &problem_web_to_edit_header($env{'form.rndseed'});
+ if ($env{'form.inhibitmenu'} eq 'yes') {
+ # error messages can be useful in any case
+ $result.= &Apache::lonxml::message_location();
+ } else {
+ $result.= &problem_web_to_edit_header($env{'form.rndseed'});
+ }
if ($Apache::lonhomework::type eq 'practice') {
- $result.= ''.
+ $result.= ''.
&practice_problem_header().'';
} elsif ($Apache::lonhomework::type eq 'randomizetry') {
my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries");
@@ -2305,8 +2343,8 @@ sub start_library {
'';
$result.=&problem_web_to_edit_header($rndseed);
if ($Apache::lonhomework::type eq 'practice') {
- $result.= ''.
+ $result.= ''.
&practice_problem_header().'';
}
}
@@ -3258,7 +3296,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.=' ';