version 1.399, 2007/09/12 08:35:44
|
version 1.406, 2007/10/30 00:09:30
|
Line 92 sub end_tex {
|
Line 92 sub end_tex {
|
return ''; |
return ''; |
} |
} |
|
|
|
sub homework_js { |
|
return &Apache::loncommon::resize_textarea_js(). |
|
<<'JS'; |
|
<script type="text/javascript"> |
|
function setSubmittedPart (part) { |
|
this.document.lonhomework.submitted.value="part_"+part; |
|
} |
|
|
|
function image_response_click (which, e) { |
|
init_geometry(); |
|
if (!e) { e = window.event; } //IE |
|
var input_element = document.lonhomework.elements[which]; |
|
var token_element = document.lonhomework.elements[which+'_token']; |
|
var token = token_element.value; |
|
var img_element = document.getElementById(which+'_imageresponse'); |
|
var x= e.clientX-getX(img_element)+Geometry.getHorizontalScroll(); |
|
var y= e.clientY-getY(img_element)+Geometry.getVerticalScroll(); |
|
var click = x+':'+y; |
|
input_element.value = click; |
|
img_element.src = '/adm/randomlabel.png?token='+token+'&clickdata='+click; |
|
} |
|
</script> |
|
JS |
|
} |
|
|
sub page_start { |
sub page_start { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name, |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name, |
$extra_head)=@_; |
$extra_head)=@_; |
Line 108 sub page_start {
|
Line 133 sub page_start {
|
$parstack,$parser,$safeeval); |
$parstack,$parser,$safeeval); |
} |
} |
|
|
$extra_head.= ' |
$extra_head .= &homework_js(); |
<script type="text/javascript"> |
|
function setSubmittedPart (part) { |
|
this.document.lonhomework.submitted.value="part_"+part; |
|
} |
|
</script> |
|
'; |
|
|
|
my %body_args; |
my %body_args; |
if (defined($found{'html'})) { |
if (defined($found{'html'})) { |
Line 139 function setSubmittedPart (part) {
|
Line 158 function setSubmittedPart (part) {
|
} 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') { |
# no extra args to bodytag |
if ($env{'environment.remote'} ne 'off') { |
|
$body_args{'only_body'} = 1; |
|
} |
} |
} |
} elsif (!defined($found{'body'})) { |
} elsif (!defined($found{'body'})) { |
my %add_entries; |
my %add_entries; |
Line 311 sub option {
|
Line 332 sub option {
|
|
|
sub problem_web_to_edit_header { |
sub problem_web_to_edit_header { |
my ($rndseed)=@_; |
my ($rndseed)=@_; |
my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" />'; |
my $result .= '<div class="LC_edit_problem_header">'; |
|
|
|
$result.='<div class="LC_edit_problem_header_edit_row">'; |
|
$result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" />'; |
$result .= '<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />'; |
$result .= '<input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />'; |
$result .= '<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" /> |
$result .= '<input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" />'; |
<input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" /> |
$result.='</div>'; |
<input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
|
<nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
if (!$Apache::lonhomework::parsing_a_task) { |
<input type="text" name="rndseed" size="10" value="'. |
$result .= |
$rndseed.'" |
'<div class="LC_edit_problem_header_title">'. |
onchange="javascript:document.lonhomework.changerandseed.click()" /></nobr> |
&mt('Problem Testing'). |
<span class="LC_nobreak"><label><input type="checkbox" name="showallfoils" '; |
&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area'). |
|
'</div>'; |
|
} else { |
|
$result .= |
|
'<div class="LC_edit_problem_header_title">'. |
|
&mt('Task Testing'). |
|
'</div>'; |
|
} |
|
|
my $show_all_foils_text = |
my $show_all_foils_text = |
($Apache::lonhomework::parsing_a_task) ? |
($Apache::lonhomework::parsing_a_task) ? |
&mt(' Show All Instances') |
&mt(' Show All Instances') |
: &mt(' Show All Foils'); |
: &mt(' Show All Foils'); |
|
|
if (defined($env{'form.showallfoils'})) { $result.='checked="on"'; } |
my $show_all= '<span class="LC_nobreak"><label><input type="checkbox" name="showallfoils" '; |
$result.= ' />'.$show_all_foils_text.'</label></span>'. |
if (defined($env{'form.showallfoils'})) { $show_all.='checked="checked"'; } |
&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems'). |
$show_all.= ' />'.$show_all_foils_text.'</label></span>'; |
'<hr />'; |
|
$result.=&mt('Apply style file: ').' |
|
<input type="text" name="style_file" value="'.&HTML::Entities::encode($env{'construct.style'},'"<>&').'" /> |
|
<a href="javascript:openbrowser(\'lonhomework\',\'style_file\',\'sty\')">'.&mt('Select').'</a> |
|
<input type="submit" name="clear_style_file" value="'.&mt('Clear').'" /> |
|
<br />'; |
|
|
|
|
$result .= '<div class="LC_edit_problem_header_status_row">'; |
if (!$Apache::lonhomework::parsing_a_task) { |
if (!$Apache::lonhomework::parsing_a_task) { |
$result.=" |
$result.=" |
<nobr> |
<div class='LC_edit_problem_header_row1'> |
Problem Status: |
<span class=\"LC_nobreak\"> |
|
".&mt("Problem Status:")." |
<select name='problemstate'> |
<select name='problemstate'> |
<option value=''></option> |
<option value=''></option> |
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
Line 348 Problem Status:
|
Line 378 Problem Status:
|
".&option('CANNOT_ANSWER_correct','problemstate').&mt("Open and correct")."</option> |
".&option('CANNOT_ANSWER_correct','problemstate').&mt("Open and correct")."</option> |
".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Answer")."</option> |
".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Answer")."</option> |
</select> |
</select> |
</nobr> |
</span> |
<nobr> |
<span class=\"LC_nobreak\"> |
Problem Type: |
".&mt("Problem Type:")." |
<select name='problemtype'> |
<select name='problemtype'> |
<option value=''></option> |
<option value=''></option> |
".&option('exam' ,'problemtype').&mt("Exam Problem")."</option> |
".&option('exam' ,'problemtype').&mt("Exam Problem")."</option> |
".&option('problem','problemtype').&mt("Homework problem")."</option> |
".&option('problem','problemtype').&mt("Homework problem")."</option> |
".&option('survey' ,'problemtype').&mt("Survey Question")."</option> |
".&option('survey' ,'problemtype').&mt("Survey Question")."</option> |
</select> |
</select> |
</nobr> |
</span> |
<nobr> |
$show_all |
Feedback Mode: |
</div> |
|
<div class='LC_edit_problem_header_row2'> |
|
<span class=\"LC_nobreak\"> |
|
".&mt("Feedback Mode:")." |
<select name='problemstatus'> |
<select name='problemstatus'> |
<option value=''></option> |
<option value=''></option> |
".&option('yes','problemstatus').&mt("Show Feedback")."</option> |
".&option('yes','problemstatus').&mt("Show Feedback")."</option> |
".&option('no', 'problemstatus').&mt("Don't Show Feedback")."</option> |
".&option('no', 'problemstatus').&mt("Don't Show Incorect/Correct Feedback")."</option> |
|
".&option('no_feedback_ever', 'problemstatus').&mt("Don't Show Any Feedback")."</option> |
</select> |
</select> |
</nobr> |
</span> |
<input type='submit' name='changeproblemmode' value='".&mt("Change")."' /> |
"; |
<hr />"; |
|
my $numtoanalyze=$env{'form.numtoanalyze'}; |
|
if (!$numtoanalyze) { $numtoanalyze=20; } |
|
$result.= '<input type="submit" name="problemmode" value='. |
|
&mt('"Calculate answers').'" /> for |
|
<input type="text" name="numtoanalyze" value="'. |
|
$numtoanalyze.'" size="5" /> '.&mt('versions of this problem'). |
|
'.'.&Apache::loncommon::help_open_topic("Analyze_Problem", |
|
'',undef,undef,300). |
|
'<hr />'; |
|
} elsif ($Apache::lonhomework::parsing_a_task) { |
} elsif ($Apache::lonhomework::parsing_a_task) { |
$result.=" |
$result.=" |
<nobr> |
<div class='LC_edit_problem_header_row1'> |
Problem Status: |
<span class=\"LC_nobreak\"> |
|
".&mt("Problem Status:")." |
<select name='problemstate'> |
<select name='problemstate'> |
<option value=''></option> |
<option value=''></option> |
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
Line 388 Problem Status:
|
Line 414 Problem Status:
|
".&option('WEB_GRADE' ,'problemstate').&mt("Criteria Grading")."</option> |
".&option('WEB_GRADE' ,'problemstate').&mt("Criteria Grading")."</option> |
".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Feedback")."</option> |
".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Feedback")."</option> |
</select> |
</select> |
</nobr> |
</span> |
<input type='submit' name='changeproblemmode' value='".&mt("Change")."' /> |
$show_all |
<hr />"; |
"; |
|
} |
|
|
|
$result.=' |
|
<span class="LC_nobreak"> |
|
'.&mt('Apply style file: ').' |
|
<input type="text" name="style_file" value="'.&HTML::Entities::encode($env{'construct.style'},'"<>&').'" /> |
|
<a href="javascript:openbrowser(\'lonhomework\',\'style_file\',\'sty\')">'.&mt('Select').'</a> |
|
</span> |
|
</div> |
|
<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="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
|
</div> |
|
<hr class="LC_edit_problem_divide" /> |
|
<div class="LC_edit_problem_header_randomize_row"> |
|
<input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" /> |
|
<input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
|
<input type="text" name="rndseed" size="10" value="'. |
|
$rndseed.'" |
|
onchange="javascript:document.lonhomework.changerandseed.click()" />'; |
|
|
|
if (!$Apache::lonhomework::parsing_a_task) { |
|
my $numtoanalyze=$env{'form.numtoanalyze'}; |
|
if (!$numtoanalyze) { $numtoanalyze=20; } |
|
$result .= &mt('[_1] for [_2] versions of this problem.', |
|
'<input type="submit" name="problemmode" value='.&mt('"Calculate answers').'" />', |
|
'<input type="text" name="numtoanalyze" value="'. |
|
$numtoanalyze.'" size="5" />'). |
|
&Apache::loncommon::help_open_topic("Analyze_Problem", |
|
'',undef,undef,300); |
} |
} |
|
|
|
$result.=' |
|
</div> |
|
<hr class="LC_edit_problem_divide" /> |
|
</div>'; |
return $result; |
return $result; |
} |
} |
|
|
Line 555 sub init_problem_globals {
|
Line 616 sub init_problem_globals {
|
if ($type eq 'problem') { |
if ($type eq 'problem') { |
$Apache::inputtags::part='0'; |
$Apache::inputtags::part='0'; |
@Apache::inputtags::partlist=('0'); |
@Apache::inputtags::partlist=('0'); |
$Apache::lonhomework::problemstatus=&get_problem_status('0'); |
&Apache::lonhomework::set_show_problem_status(&get_problem_status('0')); |
$Apache::lonhomework::ignore_response_errors=0; |
$Apache::lonhomework::ignore_response_errors=0; |
|
|
} elsif ($type eq 'library') { |
} elsif ($type eq 'library') { |
$Apache::inputtags::part=''; |
$Apache::inputtags::part=''; |
@Apache::inputtags::partlist=(); |
@Apache::inputtags::partlist=(); |
$Apache::lonhomework::problemstatus=''; |
&Apache::lonhomework::reset_show_problem_status(); |
$Apache::lonhomework::ignore_response_errors=1; |
$Apache::lonhomework::ignore_response_errors=1; |
|
|
} elsif ($type eq 'Task') { |
} elsif ($type eq 'Task') { |
$Apache::inputtags::part='0'; |
$Apache::inputtags::part='0'; |
@Apache::inputtags::partlist=('0'); |
@Apache::inputtags::partlist=('0'); |
$Apache::lonhomework::problemstatus=''; |
&Apache::lonhomework::reset_show_problem_status(); |
$Apache::lonhomework::ignore_response_errors=1; |
$Apache::lonhomework::ignore_response_errors=1; |
} |
} |
@Apache::inputtags::responselist = (); |
@Apache::inputtags::responselist = (); |
Line 596 sub reset_problem_globals {
|
Line 657 sub reset_problem_globals {
|
undef($Apache::lonhomework::default_type); |
undef($Apache::lonhomework::default_type); |
undef($Apache::lonhomework::type); |
undef($Apache::lonhomework::type); |
undef($Apache::lonhomework::scantronmode); |
undef($Apache::lonhomework::scantronmode); |
undef($Apache::lonhomework::problemstatus); |
|
undef($Apache::lonhomework::ignore_response_errors); |
undef($Apache::lonhomework::ignore_response_errors); |
|
&Apache::lonhomework::reset_show_problem_status(); |
} |
} |
|
|
sub set_problem_state { |
sub set_problem_state { |
Line 1467 sub start_part {
|
Line 1528 sub start_part {
|
@Apache::inputtags::response=(); |
@Apache::inputtags::response=(); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous_version=(); |
@Apache::inputtags::previous_version=(); |
$Apache::lonhomework::problemstatus=&get_problem_status($id); |
&Apache::lonhomework::set_show_problem_status(&get_problem_status($id)); |
|
&Apache::response::reset_params(); |
|
|
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); |
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); |
my $newtype=&Apache::lonnet::EXT("resource.$id.type"); |
my $newtype=&Apache::lonnet::EXT("resource.$id.type"); |
if ($newtype) { $Apache::lonhomework::type=$newtype; } |
if ($newtype) { $Apache::lonhomework::type=$newtype; } |
Line 1724 sub start_startouttext {
|
Line 1787 sub start_startouttext {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my @result=(''.''); |
my @result=(''.''); |
if ($target eq 'edit' || $target eq 'modified' ) { @result=('','no'); } |
if ($target eq 'edit' || $target eq 'modified' ) { @result=('','no'); } |
|
|
|
my $nesting = |
|
&Apache::lonxml::set_state('outtext', |
|
&Apache::lonxml::get_state('outtext')+1); |
|
if ($nesting > 1 && $env{'request.state'} eq 'construct') { |
|
&Apache::lonxml::error("Nesting of <startouttext /> not allowed, on line ".$token->[5]); |
|
} |
return (@result); |
return (@result); |
} |
} |
|
|
Line 1763 sub start_endouttext {
|
Line 1833 sub start_endouttext {
|
$result='<endouttext />'. |
$result='<endouttext />'. |
&Apache::edit::handle_insertafter('startouttext'); |
&Apache::edit::handle_insertafter('startouttext'); |
} |
} |
|
|
|
my $nesting = |
|
&Apache::lonxml::set_state('outtext', |
|
&Apache::lonxml::get_state('outtext')-1); |
|
if ($nesting < 0 && $env{'request.state'} eq 'construct') { |
|
&Apache::lonxml::error(" Extraneous <endouttext /> not allowed on line ".$token->[5]); |
|
&Apache::lonxml::set_state('outtext', 0); |
|
} |
return $result; |
return $result; |
} |
} |
|
|