version 1.512.2.24.2.10, 2024/02/27 19:46:23
|
version 1.512.2.24.2.14, 2024/03/01 17:05:45
|
Line 406 sub page_start {
|
Line 406 sub page_start {
|
if (&Apache::lonhtmlcommon::htmlareabrowser()) { |
if (&Apache::lonhtmlcommon::htmlareabrowser()) { |
my %textarea_args; |
my %textarea_args; |
if (($env{'request.state'} ne 'construct') || |
if (($env{'request.state'} ne 'construct') || |
($env{'environment.nocodemirror'})) { |
(&Apache::loncommon::nocodemirror())) { |
%textarea_args = ( |
%textarea_args = ( |
dragmath => 'math', |
dragmath => 'math', |
); |
); |
Line 514 sub page_start {
|
Line 514 sub page_start {
|
} elsif (!defined($found{'body'}) |
} elsif (!defined($found{'body'}) |
&& $env{'request.state'} eq 'construct') { |
&& $env{'request.state'} eq 'construct') { |
if ($target eq 'web' || $target eq 'edit') { |
if ($target eq 'web' || $target eq 'edit') { |
# Breadcrumbs for Authoring Space |
unless ($env{'form.inhibitmenu'} eq 'yes') { |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
# Breadcrumbs for Authoring Space |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
'text' => 'Authoring Space', |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'href' => &Apache::loncommon::authorspace($env{'request.uri'}), |
'text' => 'Authoring Space', |
}); |
'href' => &Apache::loncommon::authorspace($env{'request.uri'}), |
# breadcrumbs (and tools) will be created |
}); |
# in start_page->bodytag->innerregister |
# breadcrumbs (and tools) will be created |
|
# in start_page->bodytag->innerregister |
|
|
# FIXME Where are we? |
# FIXME Where are we? |
# &Apache::lonhtmlcommon::add_breadcrumb({ |
# &Apache::lonhtmlcommon::add_breadcrumb({ |
# 'text' => 'Problem Editing', # 'Problem Testing' |
# 'text' => 'Problem Editing', # 'Problem Testing' |
# 'href' => '', |
# 'href' => '', |
# }); |
# }); |
$pageheader =&Apache::loncommon::head_subbox( |
$pageheader = &Apache::loncommon::head_subbox( |
&Apache::loncommon::CSTR_pageheader()); |
&Apache::loncommon::CSTR_pageheader()); |
} |
} |
|
} |
} elsif (!defined($found{'body'})) { |
} elsif (!defined($found{'body'})) { |
my %add_entries; |
my %add_entries; |
my $background=&Apache::lonxml::get_param('background',$parstack, |
my $background=&Apache::lonxml::get_param('background',$parstack, |
Line 693 sub setup_rndseed {
|
Line 695 sub setup_rndseed {
|
} |
} |
$env{'form.'.$Apache::inputtags::part.'.rndseed'}=$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.submitted'} eq 'yes') || |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
srand(time); |
srand(time); |
Line 776 sub problem_edit_action_button {
|
Line 778 sub problem_edit_action_button {
|
|
|
sub problem_edit_buttons { |
sub problem_edit_buttons { |
my ($mode)=@_; |
my ($mode)=@_; |
|
my %editors = &Apache::loncommon::permitted_editors(); |
# Buttons that save |
# Buttons that save |
my $result = '<div style="float:right">'; |
my $result = '<div style="float:right">'; |
if ($mode eq 'editxml') { |
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'); |
$result.=&problem_edit_action_button('subsaveview','saveviewxml','v','Save and View'); |
} else { |
} 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.=&problem_edit_action_button('subsaveview','saveview','v','Save and View'); |
} |
} |
$result.="\n</div>\n"; |
$result.="\n</div>\n"; |
Line 790 sub problem_edit_buttons {
|
Line 797 sub problem_edit_buttons {
|
$result .= '<div>'. |
$result .= '<div>'. |
&problem_edit_action_button('subdiscview','discard','d','Discard Edits and View',1); |
&problem_edit_action_button('subdiscview','discard','d','Discard Edits and View',1); |
if ($mode eq 'editxml') { |
if ($mode eq 'editxml') { |
$result.=&problem_edit_action_button('subedit','edit','e','Edit',1); |
if ($editors{'edit'}) { |
|
$result.=&problem_edit_action_button('subedit','edit','e','Edit',1); |
|
} |
|
if ($editors{'daxe'}) { |
|
$result.=&problem_edit_action_button('subdaxe','daxe','w','Edit with Daxe',1); |
|
} |
$result.=&problem_edit_action_button('subundo','undoxml','u','Undo',1); |
$result.=&problem_edit_action_button('subundo','undoxml','u','Undo',1); |
if ($env{'environment.nocodemirror'}) { |
if (&Apache::loncommon::nocodemirror()) { |
$result.=&Apache::lonhtmlcommon::dragmath_button("LC_editxmltext",1); |
$result.=&Apache::lonhtmlcommon::dragmath_button("LC_editxmltext",1); |
} |
} |
} else { |
} else { |
$result.=&problem_edit_action_button('subeditxml','editxml','x','EditXML',1); |
if ($editors{'xml'}) { |
|
$result.=&problem_edit_action_button('subeditxml','editxml','x','EditXML',1); |
|
} |
|
if ($editors{'daxe'}) { |
|
$result.=&problem_edit_action_button('subdaxe','daxe','w','Edit with Daxe',1); |
|
} |
$result.=&problem_edit_action_button('subundo','undo','u','Undo',1); |
$result.=&problem_edit_action_button('subundo','undo','u','Undo',1); |
} |
} |
$result.="\n</div>"; |
$result.="\n</div>"; |
Line 810 sub problem_edit_header {
|
Line 827 sub problem_edit_header {
|
<div class="LC_edit_problem_header"> |
<div class="LC_edit_problem_header"> |
<div class="LC_edit_problem_header_title"> |
<div class="LC_edit_problem_header_title"> |
'.&mt('Problem Editing').$mode.&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').' |
'.&mt('Problem Editing').$mode.&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').' |
</div><div class="LC_edit_actionbar" id="actionbar">'. |
</div><div class="LC_edit_actionbar" id="actionbar">'. |
'<input type="hidden" name="problemmode" value="saveedit" />'. |
'<input type="hidden" name="problemmode" value="saveedit" />'. |
&problem_edit_buttons(); |
&problem_edit_buttons(); |
|
|
$return .= '</div></div>' . &Apache::lonxml::message_location(); |
$return .= '</div></div>' . &Apache::lonxml::message_location(); |
$return .= '<link rel="stylesheet" href="/adm/codemirror/codemirror-combined.css" /> |
$return .= '<link rel="stylesheet" href="/adm/codemirror/codemirror-combined.css" /> |
Line 869 sub option {
|
Line 886 sub option {
|
|
|
sub problem_web_to_edit_header { |
sub problem_web_to_edit_header { |
my ($rndseed)=@_; |
my ($rndseed)=@_; |
|
my %editors = &Apache::loncommon::permitted_editors(); |
my $result .= '<div class="LC_edit_problem_header">'; |
my $result .= '<div class="LC_edit_problem_header">'; |
|
|
if (!$Apache::lonhomework::parsing_a_task) { |
if (!$Apache::lonhomework::parsing_a_task) { |
Line 968 $show_all
|
Line 986 $show_all
|
</div> |
</div> |
<input type="submit" name="changeproblemmode" value="'.&mt("Change View").'" /> |
<input type="submit" name="changeproblemmode" value="'.&mt("Change View").'" /> |
<input type="submit" name="clear_style_file" accesskey="d" value="'.&mt('Show Default View').'" /> |
<input type="submit" name="clear_style_file" accesskey="d" value="'.&mt('Show Default View').'" /> |
<input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
<button type="submit" name="resetdata" accesskey="r" value="reset_submissions"> |
|
'.&mt('Reset Submissions').'</button> |
</div> |
</div> |
<hr /> |
<hr /> |
<div class="LC_edit_problem_header_randomize_row"> |
<div class="LC_edit_problem_header_randomize_row"> |
Line 997 $show_all
|
Line 1016 $show_all
|
<hr /> |
<hr /> |
<div>'; |
<div>'; |
$result.='<input type="hidden" name="problemmode" value="view" />'; |
$result.='<input type="hidden" name="problemmode" value="view" />'; |
$result .= '<input type="button" name="submitmode" accesskey="e" value="'.&mt('Edit').'" '. |
if ($editors{'edit'}) { |
'onclick="javascript:setmode(this.form,'."'edit'".')" />'; |
$result .= '<input type="button" name="submitmode" accesskey="e" value="'.&mt('Edit').'" '. |
$result .= '<input type="button" name="submitmode" accesskey="x" value="'.&mt('EditXML').'" '. |
'onclick="javascript:setmode(this.form,'."'edit'".')" />'; |
'onclick="javascript:setmode(this.form,'."'editxml'".')" />'; |
} |
|
if ($editors{'xml'}) { |
|
$result .= '<input type="button" name="submitmode" accesskey="x" value="'.&mt('EditXML').'" '. |
|
'onclick="javascript:setmode(this.form,'."'editxml'".')" />'; |
|
} |
|
if (($editors{'daxe'}) && |
|
($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9)) { |
|
my $uri = $env{'request.uri'}; |
|
my $daxeurl = '/daxepage'.$uri; |
|
$result .= '<input type="button" accesskey="w" value="'.&mt('Edit with Daxe').'" '. |
|
'onclick="javascript:setmode(this.form,'."'daxe'".')" />'; |
|
} |
$result.=' |
$result.=' |
</div> |
</div> |
<hr /> |
<hr /> |
Line 1027 sub initialize_storage {
|
Line 1057 sub initialize_storage {
|
|| $Apache::lonhomework::type eq 'practice') { |
|| $Apache::lonhomework::type eq 'practice') { |
|
|
my $namespace = $symb || $env{'request.uri'}; |
my $namespace = $symb || $env{'request.uri'}; |
if ($env{'form.resetdata'} eq &mt('Reset Submissions') || |
if ($env{'form.resetdata'} eq 'reset_submissions' || |
($env{'form.resetdata'} eq &mt('New Problem Variation') |
($env{'form.resetdata'} eq 'new_problem_variation' |
&& $env{'form.submitted'} eq 'yes') || |
&& $env{'form.submitted'} eq 'yes') || |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
$env{'form.newrandomization'} eq &mt('New Randomization')) { |
&Apache::lonnet::tmpreset($namespace,'',$domain,$name); |
&Apache::lonnet::tmpreset($namespace,'',$domain,$name); |
Line 1574 sub access_status_msg {
|
Line 1604 sub access_status_msg {
|
$msg ='\noindent \vskip 1 mm '. |
$msg ='\noindent \vskip 1 mm '. |
$startminipage.'\vskip 0 mm'; |
$startminipage.'\vskip 0 mm'; |
if ($status eq 'UNAVAILABLE') { |
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 { |
} 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; |
return $msg; |
} |
} |
Line 1916 sub start_problem {
|
Line 1949 sub start_problem {
|
} |
} |
$form_tag_start.='<input type="hidden" name="rndseed" value="'. |
$form_tag_start.='<input type="hidden" name="rndseed" value="'. |
$rndseedval.'" />'. |
$rndseedval.'" />'. |
'<input type="submit" name="resetdata" |
'<button type="submit" name="resetdata" |
value="'.&mt('New Problem Variation').'" />'; |
value="new_problem_variation">'.&mt('New Problem Variation').'</button>'; |
if (exists($env{'form.username'})) { |
if (exists($env{'form.username'})) { |
$form_tag_start.= |
$form_tag_start.= |
'<input type="hidden" name="username" |
'<input type="hidden" name="username" |
Line 1973 sub start_problem {
|
Line 2006 sub start_problem {
|
$result .= '<p class="LC_error">'. |
$result .= '<p class="LC_error">'. |
&mt('A problem occurred when trying to start the timer.').'</p>'; |
&mt('A problem occurred when trying to start the timer.').'</p>'; |
} |
} |
$result .= &access_status_msg('problem',$status,$symb,$target,$ipused,$accessmsg); |
$result .= &access_status_msg('problem',$status,$symb,$target,'',$accessmsg); |
} elsif ($status eq 'NEEDS_CHECKIN') { |
} elsif ($status eq 'NEEDS_CHECKIN') { |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
$style); |
$style); |
Line 1996 sub start_problem {
|
Line 2029 sub start_problem {
|
'<input type="hidden" name="submitted" value="yes" />'; |
'<input type="hidden" name="submitted" value="yes" />'; |
# create a page header and exit |
# create a page header and exit |
if ($env{'request.state'} eq "construct") { |
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') { |
if ($Apache::lonhomework::type eq 'practice') { |
$result.= '<input type="submit" name="resetdata" '. |
$result.= '<button type="submit" name="resetdata" '. |
'value="'.&mt('New Problem Variation').'" />'. |
'value="new_problem_variation">'.&mt('New Problem Variation').'</button>'. |
&practice_problem_header().'<hr />'; |
&practice_problem_header().'<hr />'; |
} elsif ($Apache::lonhomework::type eq 'randomizetry') { |
} elsif ($Apache::lonhomework::type eq 'randomizetry') { |
my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries"); |
my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries"); |
Line 2305 sub start_library {
|
Line 2343 sub start_library {
|
'<input type="hidden" name="submitted" value="yes" />'; |
'<input type="hidden" name="submitted" value="yes" />'; |
$result.=&problem_web_to_edit_header($rndseed); |
$result.=&problem_web_to_edit_header($rndseed); |
if ($Apache::lonhomework::type eq 'practice') { |
if ($Apache::lonhomework::type eq 'practice') { |
$result.= '<input type="submit" name="resetdata" '. |
$result.= '<button type="submit" name="resetdata" '. |
'value="'.&mt('New Problem Variation').'" />'. |
'value="new_problem_variation">'.&mt('New Problem Variation').'</button>'. |
&practice_problem_header().'<hr />'; |
&practice_problem_header().'<hr />'; |
} |
} |
} |
} |
Line 3258 sub end_startouttext {
|
Line 3296 sub end_startouttext {
|
.&Apache::edit::deletelist($target,$token) |
.&Apache::edit::deletelist($target,$token) |
.'</span></td>' |
.'</span></td>' |
.'<td><span id="math_'.$areaid.'">'; |
.'<td><span id="math_'.$areaid.'">'; |
if ($env{'environment.nocodemirror'}) { |
if (&Apache::loncommon::nocodemirror()) { |
$result.=&Apache::lonhtmlcommon::dragmath_button($areaid,1); |
$result.=&Apache::lonhtmlcommon::dragmath_button($areaid,1); |
} else { |
} else { |
$result.=' '; |
$result.=' '; |