Skip to content

Commit 8ead6fc

Browse files
committed
Merge pull request #14 from mgage/master
Changes from WeBWorK::Rochester
2 parents d6b3307 + b57a123 commit 8ead6fc

File tree

19 files changed

+2644
-887
lines changed

19 files changed

+2644
-887
lines changed

DATA/uploads/README

100644100755
File mode changed.

bin/addadmin

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
$db->addUser($db->newUser(user_id=>"admin", first_name=>"Prof", last_name=>"Admin",email_address=>"", student_id=>"admin", status=>"C",section=>"", recitation=>"",comment=>"administrator"));
3+
4+
$db->addPassword($db->newPassword(user_id=>"admin", password=>crypt("admin", "dc")));
5+
6+
$db->addPermissionLevel($db->newPermissionLevel(user_id=>"admin", permission=>"10"));
7+
8+
9+
exit;
10+

bin/addprofa

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
$db->addUser($db->newUser(user_id=>"profa", first_name=>"Prof", last_name=>"A",email_address=>"", student_id=>"profa", status=>"C",section=>"", recitation=>"",comment=>"administrator"));
3+
4+
$db->addPassword($db->newPassword(user_id=>"profa", password=>crypt("profa", "dc")));
5+
6+
$db->addPermissionLevel($db->newPermissionLevel(user_id=>"profa", permission=>"10"));
7+
8+
9+
exit;
10+

bin/wwsh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ wwdb - command-line interface to the WeBWorK libraries.
2121
2222
=cut
2323

24-
use Data::Dumper;
24+
2525

2626
BEGIN {
2727
DB::parse_options("NonStop=1");
@@ -33,6 +33,7 @@ BEGIN {
3333
use lib "$ENV{WEBWORK_ROOT}/lib";
3434
use WeBWorK::CourseEnvironment;
3535
use WeBWorK::DB;
36+
use Data::Dumper;
3637

3738
our $ce;
3839
our $db;

conf/localOverrides.conf.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ $problemDefaults{max_attempts} = -1;
243243
#
244244
# pgproblemeditor1 => 1,
245245
# pgproblemeditor2 => 1,
246+
# pgproblemeditor3 => 1,
246247
# );
247248

248249
################################################################################

htdocs/tmp/equations/README

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
$CVSHeader$
21

32
Equation images are stored in this directory.

lib/WeBWorK/Authen.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ use WeBWorK::Debug;
5757
use WeBWorK::Utils qw/writeCourseLog runtime_use/;
5858
use WeBWorK::Localize;
5959
use URI::Escape;
60+
use Carp;
6061

6162
use mod_perl;
6263
use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 );

lib/WeBWorK/ContentGenerator.pm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ sub links {
737737

738738
if (defined $problemID) {
739739
print CGI::start_ul();
740-
print CGI::li(&$makelink("${pfx}PGProblemEditor", text=>"$problemID", urlpath_args=>{%args,setID=>$setID,problemID=>$problemID}, systemlink_args=>\%systemlink_args, target=>"WW_Editor"))
740+
print CGI::li(&$makelink("${pfx}PGProblemEditor", text=>"$problemID", urlpath_args=>{%args,setID=>$setID,problemID=>$problemID}, systemlink_args=>\%systemlink_args, target=>"WW_Editor1"))
741741
if $ce->{showeditors}->{pgproblemeditor1};
742742
print CGI::end_ul();
743743
}
@@ -747,6 +747,12 @@ sub links {
747747
if $ce->{showeditors}->{pgproblemeditor2};;
748748
print CGI::end_ul();
749749
}
750+
if (defined $problemID) {
751+
print CGI::start_ul();
752+
print CGI::li(&$makelink("${pfx}PGProblemEditor3", text=>"----$problemID", urlpath_args=>{%args,setID=>$setID,problemID=>$problemID}, systemlink_args=>\%systemlink_args, target=>"WW_Editor3"))
753+
if $ce->{showeditors}->{pgproblemeditor3};;
754+
print CGI::end_ul();
755+
}
750756

751757
print CGI::end_li(); # end $setID
752758
print CGI::end_ul();

lib/WeBWorK/ContentGenerator/CourseAdmin.pm

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,8 +3185,9 @@ sub display_registration_form {
31853185
my $self = shift;
31863186
my $ce = $self->r->ce;
31873187
my $registeredQ = (-e ($ce->{courseDirs}->{root})."/$registered_file_name")?1:0;
3188-
#my $registration_subDisplay = ( $self->{method_to_call} eq "registration_form") ? 1: 0;
3189-
return 0 if $registeredQ or $self->r->param("register_site"); #otherwise return registration form
3188+
my $registration_subDisplay = ( defined($self->r->param('subDisplay') ) and $self->r->param('subDisplay') eq "registration") ? 1: 0;
3189+
my $register_site = ($self->r->param("register_site"))?1:0;
3190+
return 0 if $registeredQ or $register_site or $registration_subDisplay; #otherwise return registration form
31903191
return q!
31913192
<center>
31923193
<table class="messagebox" style="background-color:#FFFFCC;width:60%">
@@ -3247,11 +3248,14 @@ sub registration_form {
32473248
# the email to gage@math.rochester.edu
32483249
# !
32493250
print "\n",
3250-
CGI::p({style=>"text-align: left; width:60%"},
3251-
"Please click on ",
3252-
CGI::a({ href=>"http://forms.maa.org/r/WebworkSoftware/add.aspx" }, " this link "),
3253-
"and fill out the form.",
3254-
),"\n",
3251+
CGI::iframe({src => "http://forms.maa.org/r/WebworkSoftware/add.aspx",
3252+
style=>"width:100%;height:700px", id=>"maa_content"}, "Your browser cannot use iframes"),
3253+
# CGI::p({style=>"text-align: left; width:60%"},
3254+
# "Please click on ",
3255+
# CGI::a({ href=>"http://forms.maa.org/r/WebworkSoftware/add.aspx" }, " this link "),
3256+
# "and fill out the form.",
3257+
# ),
3258+
"\n",
32553259
CGI::p({style=>"text-align: left; width:60%"},
32563260
"The form will be sent to the MAA and your site will be listed along with all of the others on the ",
32573261
CGI::a({href=>"http://webwork.maa.org/wiki/WeBWorK_Sites"}, "site map"),
@@ -3266,11 +3270,19 @@ sub registration_form {
32663270
);
32673271

32683272
print "</center>";
3269-
print CGI::start_form(-method=>"POST", -action=>$self->r->uri);
3273+
print CGI::start_form(-method=>"POST", id=>"return_to_main_page", -action=>$self->r->uri);
32703274
print $self->hidden_authen_fields;
32713275
print $self->hidden_fields("subDisplay");
3272-
print CGI::p({style=>"text-align: center"}, CGI::submit(-name=>"register_site", -label=>"Site has been registered"));
3276+
print CGI::p({style=>"text-align: center"}, CGI::submit(-id => "register_site", -name=>"register_site", -label=>"Site has been registered"));
32733277
print CGI::end_form();
3278+
print q!<script type="text/javascript">
3279+
# $("#maa_content").load( alert("loaded") );
3280+
# $("#return_to_main_page").append(
3281+
# "<center><p>hey site is registered cool</p></center>"
3282+
# );
3283+
#
3284+
# </script>
3285+
# !;
32743286
}
32753287

32763288

lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm

Lines changed: 42 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -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

20351957
1;

0 commit comments

Comments
 (0)