--- loncom/homework/structuretags.pm 2008/05/27 19:48:55 1.420 +++ loncom/homework/structuretags.pm 2008/08/21 20:46:23 1.428 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.420 2008/05/27 19:48:55 www Exp $ +# $Id: structuretags.pm,v 1.428 2008/08/21 20:46:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -148,6 +148,10 @@ sub page_start { $extra_head .= &homework_js(); + unless ($env{'environment.wysiwygeditor'} eq 'on') { + $extra_head .= &Apache::lonhtmlcommon::dragmath_js(); + } + my %body_args; if (defined($found{'html'})) { $body_args{'skip_phases'}{'head'}=1; @@ -312,24 +316,28 @@ sub remember_problem_state { '; } -sub problem_edit_header { - return ''. - &Apache::structuretags::remember_problem_state().' -
-
-'.&mt('Problem Editing').&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').' -
+sub problem_edit_buttons { + return '
- + ' onclick="javscript:setmode(this.form,'."'discard'".')" />
-
+
'; +} + +sub problem_edit_header { + return ''. + &Apache::structuretags::remember_problem_state().' +
+
+'.&mt('Problem Editing').&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').' +
'. +&problem_edit_buttons().'
'.&Apache::lonxml::message_location().'
@@ -340,17 +348,8 @@ sub problem_edit_header { sub problem_edit_footer { return '
'. @@ -417,8 +416,9 @@ sub problem_web_to_edit_header { $show_all @@ -451,28 +451,15 @@ $show_all $show_all "; } - if (($env{'form.problemlanguage'}) && ($env{'form.problemlanguage'}!~/notset/)) { - $env{'environment.languages'}=$env{'form.problemlanguage'}; - } - my %langchoices=('' => ''); - foreach (&Apache::loncommon::languageids()) { - if (&Apache::loncommon::supportedlanguagecode($_)) { - $langchoices{&Apache::loncommon::supportedlanguagecode($_)} - = &Apache::loncommon::plainlanguagedescription($_); - } - } $result.=' '.&mt('Apply style file: ').' &').'" /> '.&mt('Select').' -
- '. - &mt('Language: '). - &Apache::loncommon::select_form($env{'environment.languages'},'problemlanguage', - %langchoices).' - +
+
'. + &Apache::lonxml::renderingoptions().'
@@ -879,8 +866,7 @@ sub start_problem { ''; } if ($Apache::lonhomework::type eq 'practice') { - $form_tag_start.='

'.&mt('Practice Problem').'

'. - ''.&mt('Submissions are not permanently recorded').''; + $form_tag_start.=&practice_problem_header(); } $form_tag_start.='
'; } @@ -954,6 +940,11 @@ sub start_problem { # create a page header and exit if ($env{'request.state'} eq "construct") { $result.= &problem_web_to_edit_header($env{'form.rndseed'}); + if ($Apache::lonhomework::type eq 'practice') { + $result.= ''. + &practice_problem_header().'
'; + } } # if we are viewing someone else preserve that info if (defined $env{'form.grade_symb'}) { @@ -1189,6 +1180,11 @@ sub start_library { $result.=" \n $form_tag_start". ''; $result.=&problem_web_to_edit_header($rndseed); + if ($Apache::lonhomework::type eq 'practice') { + $result.= ''. + &practice_problem_header().'
'; + } } return $result; } @@ -1396,7 +1392,11 @@ sub end_languageblock { my $result = &Apache::lonxml::endredirection(); my $which = &Apache::lonxml::get_param('which',$parstack, $safeeval); - $available_texts{$which} = $result; + foreach my $language (split(/\s*\,\s*/,$which)) { + unless ($language=~/\w/) { next; } + $available_texts{$language} = $result; + } + } return ''; } @@ -1853,7 +1853,8 @@ sub start_problemtype { $result .=&Apache::edit::checked_arg('When used as type(s):','for', [ ['exam','Exam/Quiz Problem'], ['survey','Survey'], - ['problem','Homework Problem'] ] + ['problem','Homework Problem'], + ['practice','Practice Problem'] ] ,$token); $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { @@ -1888,14 +1889,18 @@ sub end_startouttext { my $text=''; if ($target eq 'edit') { + my $areaid = 'homework_edit_'.$Apache::lonxml::curdepth; $text=&Apache::lonxml::get_all_text("endouttext",$parser,$style); $result.=&Apache::edit::start_table($token)."".&mt('Text Block')." ".&mt('Delete:'). &Apache::edit::deletelist($target,$token) - ." -". - &Apache::edit::insertlist($target,$token). - '' . + .""; + unless ($env{'environment.wysiwygeditor'} eq 'on') { + $result.='' + .&Apache::lonhtmlcommon::dragmath_button($areaid,1) + .''; + } + $result.='' . &Apache::loncommon::helpLatexCheatsheet(). &Apache::edit::end_row(). &Apache::edit::start_spanning_row()."\n". @@ -1970,5 +1975,11 @@ sub end_simpleeditbutton { return ''; } +sub practice_problem_header { + return '

'.&mt('Practice Problem').'

'. + ''.&mt('Submissions are not permanently recorded'). + ''; +} + 1; __END__