@@ -672,50 +672,12 @@ EOF
672672
673673# ######## print action forms
674674
675+ print CGI::start_table({});
675676 # print CGI::Tr({}, CGI::td({-colspan=>2}, "Select an action to perform:"));
676677
677678 my @formsToShow = @{ ACTION_FORMS() };
678679 my $default_choice = $formsToShow [0];
679680 my $i = 0;
680-
681- # ##################################################################COLUMN STYLE BEGIN###############################################################
682-
683- # foreach my $actionID (@formsToShow) {
684- # # Check permissions
685- # #next if FORM_PERMS()->{$actionID} and not $authz->hasPermissions($user, FORM_PERMS()->{$actionID});
686- # my $actionForm = "${actionID}_form";
687- # my $newWindow = ($actionID =~ m/^(view|add_problem|save)$/)? 1: 0;
688- # my $onChange = "setRadio($i,$newWindow)";
689- # my %actionParams = $self->getActionParams($actionID);
690- # my $line_contents = $self->$actionForm($onChange, %actionParams);
691- # my $radio_params = {-type=>"radio", -name=>"action", -value=>$actionID};
692- # $radio_params->{checked}=1 if ($actionID eq $default_choice) ;
693- # $radio_params->{onclick} = "setTarget($newWindow)";
694- # $radio_params->{id} = "action$i";
695- # # print CGI::Tr({-valign=>"top"},
696- # # CGI::td({}, CGI::input($radio_params)),
697- # # CGI::td({}, $line_contents)
698- # # ) if $line_contents;
699- # if($line_contents){
700- # print CGI::start_div({-class=>"column"});
701- # print CGI::div({-class=>"pg_editor_input_span"},WeBWorK::CGI_labeled_input(-type=>"radio", -id=>$actionForm."_id", -label_text=>ucfirst(WeBWorK::underscore_to_whitespace($actionForm)), -input_attr=>$radio_params),CGI::br());
702- # print CGI::div({-class=>"pg_editor_input_div"},$line_contents);
703- # print CGI::br();
704- # print CGI::end_div();
705- # }
706- # $i++;
707- # }
708- # my $checkbox = WeBWorK::CGI_labeled_input(-type=>"checkbox", -id=>"newWindow", -label_text=>"Open in new window", -input_attr=>{-checked=>"checked", -onchange=>"updateTarget()"});
709- # $checkbox =~ s/\n//; # remove unwanted linebreak
710- # print CGI::div({-class=>"pd_editor_input_div", -id=>"submit_input_div"}, $checkbox, CGI::br(), WeBWorK::CGI_labeled_input(-type=>"submit", -id=>"submit_button_id", -input_attr=>{-name=>'submit', -value=>"Take Action!"}));
711-
712- # #######################################################COLUMN STYLE END###########################################################################
713-
714-
715- # #######################################################TABBER STYLE BEGIN#########################################################################
716-
717- my @divArr = ();
718-
719681 foreach my $actionID (@formsToShow ) {
720682 # Check permissions
721683 # next if FORM_PERMS()->{$actionID} and not $authz->hasPermissions($user, FORM_PERMS()->{$actionID});
@@ -728,33 +690,20 @@ EOF
728690 $radio_params -> {checked }=1 if ($actionID eq $default_choice ) ;
729691 $radio_params -> {onclick } = " setTarget($newWindow )" ;
730692 $radio_params -> {id } = " action$i " ;
731- # print CGI::Tr({-valign=>"top"},
732- # CGI::td({}, CGI::input($radio_params)),
733- # CGI::td({}, $line_contents)
734- # ) if $line_contents;
735- if ($line_contents ){
736- my @titleArr = split (" " , ucfirst (WeBWorK::underscore_to_whitespace($actionForm )));
737- my $title = $titleArr [0];
738- push @divArr , join (" " ,
739- CGI::h3($title ),
740- CGI::div({-class => " pg_editor_input_span" },WeBWorK::CGI_labeled_input(-type => " radio" , -id => $actionForm ." _id" , -label_text => ucfirst (WeBWorK::underscore_to_whitespace($actionForm )), -input_attr => $radio_params ),CGI::br()),
741- CGI::div({-class => " pg_editor_input_div" },$line_contents ),
742- CGI::br())
743- }
693+ print CGI::Tr({-valign => " top" },
694+ CGI::td({}, CGI::input($radio_params )),
695+ CGI::td({}, $line_contents )
696+ ) if $line_contents ;
697+
744698 $i ++;
745699 }
746-
747- my $divArrRef = \@divArr ;
748-
749- print CGI::div({-class => " tabber" },
750- CGI::div({-class => " tabbertab" },$divArrRef )
751- );
752-
753- # ##################################################TABBER STYLE END##############################################################################
754-
755- my $checkbox = WeBWorK::CGI_labeled_input(-type => " checkbox" , -id => " newWindow" , -label_text => " Open in new window" , -input_attr => {-checked => " checked" , -onchange => " updateTarget()" });
700+ my $checkbox = CGI::input({-type => " checkbox" , -id => " newWindow" , -checked => " checked" ,
701+ -onchange => " updateTarget()" });
756702 $checkbox =~ s /\n // ; # remove unwanted linebreak
757- print CGI::div({-class => " pd_editor_input_div" , -id => " submit_input_div" }, $checkbox , CGI::br(), WeBWorK::CGI_labeled_input(-type => " submit" , -id => " submit_button_id" , -input_attr => {-name => ' submit' , -value => " Take Action!" }));
703+ print CGI::Tr({}, CGI::td({-colspan => 2}, " Select above then:" ,
704+ CGI::submit(-name => ' submit' , -value => " Take Action!" ),
705+ CGI::script(" document.write('$checkbox in another window')" )));
706+ print CGI::end_table();
758707
759708
760709 print CGI::end_form();
@@ -1271,17 +1220,15 @@ sub view_form {
12711220 my ($self , $onChange , %actionParams ) = @_ ;
12721221 my $file_type = $self -> {file_type };
12731222 return " " if $file_type eq ' hardcopy_header' ; # these can't yet be edited from temporary files #FIXME
1274- my $output_string = " " ;
1223+ my $output_string = " View " ;
12751224 unless ($file_type eq ' course_info' || $file_type eq ' options_info' ) {
12761225
12771226 $output_string .= join (" " ,
1278- # "Use what seed?: ",
1279- # CGI::textfield(-name=>'action.view.seed',-value=>$self->{problemSeed},-onfocus=>$onChange),
1280- WeBWorK::CGI_labeled_input(-type => " text" , -id => " action_view_seed_id" , -label_text => " Using what seed?: " , -input_attr => {-name => ' action.view.seed' ,-value => $self -> {problemSeed },-onfocus => $onChange }),CGI::br(),
1281- # "and display mode ",
1282- # CGI::popup_menu(-name=>'action.view.displayMode', -values=>$self->r->ce->{pg}->{displayModes},
1283- # -default=>$self->{displayMode}, -onmousedown=>$onChange)
1284- WeBWorK::CGI_labeled_input(-type => " select" , -id => " action_view_displayMode_id" , -label_text => " Using what display mode?: " , -input_attr => {-name => ' action.view.displayMode' , -values => $self -> r-> ce-> {pg }-> {displayModes }, -default => $self -> {displayMode }, -onmousedown => $onChange }),CGI::br(),
1227+ " using seed " ,
1228+ CGI::textfield(-name => ' action.view.seed' ,-value => $self -> {problemSeed },-onfocus => $onChange ),
1229+ " and display mode " ,
1230+ CGI::popup_menu(-name => ' action.view.displayMode' , -values => $self -> r-> ce-> {pg }-> {displayModes },
1231+ -default => $self -> {displayMode }, -onmousedown => $onChange )
12851232 );
12861233 }
12871234
@@ -1440,9 +1387,11 @@ sub add_problem_form {
14401387 };
14411388 return " " if $self -> {file_type } eq ' course_info' || $self -> {file_type } eq ' options_info' ;
14421389 return join (" " ,
1443- WeBWorK::CGI_labeled_input(-type => " select" , -id => " action_add_problem_target_set_id" , -label_text => " Add to what set?: " , -input_attr => {name => ' action.add_problem.target_set' , values => \@allSetNames , default => $setName , onmousedown => $onChange }),CGI::br(),
1444- WeBWorK::CGI_labeled_input(-type => " select" , -id => " action_add_problem_file_type_id" , -label_text => " Add as what filetype?: " , -input_attr => {name => ' action.add_problem.file_type' , values => [' problem' ,' set_header' , ' hardcopy_header' ], labels => $labels , default => $self -> {file_type }, onmousedown => $onChange }),
1445- CGI::br()
1390+ " Add to set " ,
1391+ CGI::popup_menu({name => ' action.add_problem.target_set' , values => \@allSetNames , default => $setName , onmousedown => $onChange }),
1392+ " as " ,
1393+ CGI::popup_menu({name => ' action.add_problem.file_type' , values => [' problem' ,' set_header' , ' hardcopy_header' ], labels => $labels , default => $self -> {file_type }, onmousedown => $onChange }),
1394+
14461395 ); # FIXME add -lables to the pop up menu
14471396 return " " ;
14481397}
@@ -1760,51 +1709,38 @@ sub save_as_form { # calls the save_as_handler
17601709 # don't addor replace problems to sets if the set is the Undefined_Set or if the problem is the blank_problem.
17611710
17621711 my $replace_problem_in_set = ($can_add_problem_to_set )?
1763- # CGI::input({
1764- # -type => 'radio',
1765- # -name => "action.save_as.saveMode",
1766- # -value => "rename",
1767- # -label => '',
1768- # },"and replace ".CGI::b("set $fullSetID$probNum").',')
1769- WeBWorK::CGI_labeled_input(-type => ' radio' , -id => ' action_save_as_saveMode_rename_id' , -label_text => " Replace " .CGI::b(" set $fullSetID$probNum " ), -input_attr => {
1770- -name => " action.save_as.saveMode" ,
1771- -value => " rename" ,
1772- }).CGI::br() : ' '
1712+ CGI::input({
1713+ -type => ' radio' ,
1714+ -name => " action.save_as.saveMode" ,
1715+ -value => " rename" ,
1716+ -label => ' ' ,
1717+ }," and replace " .CGI::b(" set $fullSetID$probNum " ).' ,' ) : ' '
17731718 ;
17741719 my $add_problem_to_set = ($can_add_problem_to_set )?
1775- # CGI::input({
1776- # -type => 'radio',
1777- # -name => "action.save_as.saveMode",
1778- # -value => 'add_to_set_as_new_problem',
1779- # -label => '',
1780- # -onfocus => $onChange,
1781- # },"and append to end of set $fullSetID",) : ''
1782- WeBWorK::CGI_labeled_input(-type => ' radio' , -id => " action_save_as_saveMode_new_problem_id" , -label_text => " Append to end of set $fullSetID " , -input_attr => {
1783- -name => " action.save_as.saveMode" ,
1720+ CGI::input({
1721+ -type => ' radio' ,
1722+ -name => " action.save_as.saveMode" ,
17841723 -value => ' add_to_set_as_new_problem' ,
1785- -onfocus => $onChange ,
1786- }).CGI::br() : ' '
1724+ -label => ' ' ,
1725+ -onfocus => $onChange ,
1726+ }," and append to end of set $fullSetID " ,) : ' '
17871727 ;
17881728 my $rh_new_problem_options = {
1789- # -type => 'radio',
1729+ -type => ' radio' ,
17901730 -name => " action.save_as.saveMode" ,
17911731 -value => " new_independent_problem" ,
17921732 -onfocus => $onChange ,
17931733 };
17941734 $rh_new_problem_options -> {checked }=1 unless $can_add_problem_to_set ;
1795- my $create_new_problem = WeBWorK::CGI_labeled_input(- type => ' radio ' , - id => " action_save_as_saveMode_independent_problem_id " , - label_text => " Append as new independent problem " , - input_attr => $rh_new_problem_options ).CGI::br(); # CGI::input($rh_new_problem_options,"as a new independent problem");
1735+ my $create_new_problem = CGI::input($rh_new_problem_options ," as a new independent problem" );
17961736
17971737 $andRelink = CGI::br(). $replace_problem_in_set . $add_problem_to_set . $create_new_problem ;
17981738
1799- return # 'Save AS [TMPL]/'.
1800- # CGI::textfield(
1801- # -name=>'action.save_as.target_file', -size=>60, -value=>"$shortFilePath",
1802- # -onfocus=>$onChange
1803- # ).",".
1804- WeBWorK::CGI_labeled_input(-type => " text" , -id => " action_save_as_target_file_id" , -label_text => " Save AS [TMPL]/" , -input_attr => {
1805- -name => ' action.save_as.target_file' , -size => 60, -value => " $shortFilePath " ,
1806- -onfocus => $onChange
1807- }).
1739+ return ' Save AS [TMPL]/' .
1740+ CGI::textfield(
1741+ -name => ' action.save_as.target_file' , -size => 60, -value => " $shortFilePath " ,
1742+ -onfocus => $onChange
1743+ )." ," .
18081744 CGI::hidden(-name => ' action.save_as.source_file' , -value => $editFilePath ).
18091745 CGI::hidden(-name => ' action.save_as.file_type' ,-value => $self -> {file_type }).
18101746 $andRelink ;
@@ -2015,21 +1951,7 @@ sub revert_handler {
20151951 # no redirect is needed
20161952}
20171953
2018- sub output_JS{
2019- my $self = shift ;
2020- my $r = $self -> r;
2021- my $ce = $r -> ce;
20221954
2023- my $site_url = $ce -> {webworkURLs }-> {htdocs };
2024- print CGI::start_script({type => " text/javascript" , src => " $site_url /js/addOnLoadEvent.js" }), CGI::end_script();
2025- print CGI::start_script({type => " text/javascript" , src => " $site_url /js/tabber.js" }), CGI::end_script();
2026-
2027- return " " ;
2028- }
2029-
2030- sub output_tabber_CSS{
2031- return " " ;
2032- }
20331955
20341956
203519571;
0 commit comments