|
From: jj v. a. <we...@ma...> - 2005-07-29 20:44:00
|
Log Message:
-----------
More improvements on library - advanced panel. Still a work in progress.
Modified Files:
--------------
webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor:
SetMaker.pm
Revision Data
-------------
Index: SetMaker.pm
===================================================================
RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -Llib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm -Llib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm -u -r1.45 -r1.46
--- lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm
+++ lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm
@@ -503,6 +503,7 @@
my $self = shift;
my $r = $self->r;
my $ce = $r->ce;
+ my $right_button_style = "width: 18ex";
my @subjs = WeBWorK::Utils::ListingDB::getAllDBsubjects($r);
unshift @subjs, ALL_SUBJECTS;
@@ -514,7 +515,6 @@
unshift @sects, ALL_SECTIONS;
my $texts = WeBWorK::Utils::ListingDB::getDBTextbooks($r);
- #my @textarray = map { $_->[1]." by ".$_->[2] } @{$texts};
my @textarray = map { $_->[0] } @{$texts};
my %textlabels = ();
for my $ta (@{$texts}) {
@@ -531,9 +531,20 @@
my $text_popup = CGI::popup_menu(-name => 'library_textbook',
-values =>\@textarray,
-labels => \%textlabels,
- -default=>$textbook_selected);
+ -default=>$textbook_selected,
+ -onchange=>"submit();return true");
+
+ my $library_keywords = $r->param('library_keywords') || '';
+
my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r);
+ my $count_line = WeBWorK::Utils::ListingDB::countDBListings($r);
+ if($count_line==0) {
+ $count_line = "There are no matching pg files";
+ } else {
+ $count_line = "There are $count_line matching WeBWorK problem files";
+ }
+
print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"},
CGI::hidden(-name=>"library_is_basic", -default=>[2]),
CGI::start_table({-width=>"100%"}),
@@ -547,7 +558,8 @@
-onchange=>"submit();return true"
)]),
CGI::td({-colspan=>2, -align=>"right"},
- CGI::submit(-name=>"lib_select_subject", -value=>"Update Lists"))),
+ CGI::submit(-name=>"lib_select_subject", -value=>"Update Menus",
+ -style=> $right_button_style))),
CGI::Tr(
CGI::td(["Chapter:",
CGI::popup_menu(-name=> 'library_chapters',
@@ -556,7 +568,8 @@
-onchange=>"submit();return true"
)]),
CGI::td({-colspan=>2, -align=>"right"},
- CGI::submit(-name=>"library_basic", -value=>"Basic Search"))
+ CGI::submit(-name=>"library_reset", -value=>"Reset",
+ -style=>$right_button_style))
),
CGI::Tr(
CGI::td(["Section:",
@@ -565,28 +578,22 @@
-default=> $section_selected,
-onchange=>"submit();return true"
)]),
+ CGI::td({-colspan=>2, -align=>"right"},
+ CGI::submit(-name=>"library_basic", -value=>"Basic Search",
+ -style=>$right_button_style))
),
CGI::Tr(
CGI::td(["Textbook:", $text_popup]),
),
+ CGI::Tr(CGI::td("Keywords:"),CGI::td({-colspan=>2},
+ CGI::textfield(-name=>"library_keywords",
+ -default=>$library_keywords,
+ -override=>1,
+ -size=>40))),
CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)),
+ CGI::Tr(CGI::td({-colspan=>3, -align=>"center"}, $count_line)),
CGI::end_table(),
));
- #CGI::Tr(
- # CGI::td("Textbook:"),
- # CGI::td({-colspan=>2},
- # CGI::popup_menu(-name=> 'library_textbooks',
- # -values=>\@textbooks,
- # #-default=> $section_selected
- #))),
-
- #CGI::Tr(
- # CGI::td("Keywords:"),
- # CGI::td({-colspan=>2},
- # CGI::textfield(-name=>"keywords",
- # -default=>"Keywords not implemented yet",
- # -override=>1, -size=>60
- #))),
}
|
|
From: jj v. a. <we...@ma...> - 2005-07-29 20:44:05
|
Log Message:
-----------
More improvements on library - advanced panel. Still a work in progress.
Modified Files:
--------------
webwork-modperl/lib/WeBWorK/Utils:
ListingDB.pm
Revision Data
-------------
Index: ListingDB.pm
===================================================================
RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/Utils/ListingDB.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -Llib/WeBWorK/Utils/ListingDB.pm -Llib/WeBWorK/Utils/ListingDB.pm -u -r1.10 -r1.11
--- lib/WeBWorK/Utils/ListingDB.pm
+++ lib/WeBWorK/Utils/ListingDB.pm
@@ -29,7 +29,7 @@
&createListing &updateListing &deleteListing &getAllChapters
&getAllSections &searchListings &getAllListings &getSectionListings
&getAllDBsubjects &getAllDBchapters &getAllDBsections &getDBTextbooks
- &getDBListings
+ &getDBListings &countDBListings
);
%EXPORT_TAGS =();
@EXPORT_OK =qw();
@@ -216,6 +216,50 @@
return @results;
}
+
+sub countDBListings {
+ my $r = shift;
+ my $ce = $r->ce;
+ my $subj = $r->param('library_subjects') || "";
+ my $chap = $r->param('library_chapters') || "";
+ my $sec = $r->param('library_sections') || "";
+ my $text = $r->param('library_textbook') || "";
+ my $textchap = $r->param('library_textbook_chapter') || "";
+ my $textsec = $r->param('library_textbook_section') || "";
+
+ my $dbh = getDB($ce);
+
+ my $extrawhere = '';
+ if($subj) {
+ $subj =~ s/'/\\'/g;
+ $extrawhere .= " AND dbsj.name=\"$subj\" ";
+ }
+ if($chap) {
+ $chap =~ s/'/\\'/g;
+ $extrawhere .= " AND dbc.name=\"$chap\" ";
+ }
+ if($sec) {
+ $sec =~ s/'/\\'/g;
+ $extrawhere .= " AND dbsc.name=\"$sec\" ";
+ }
+ if($text) {
+ $text =~ s/'/\\'/g;
+ $extrawhere .= " AND t.textbook_id=\"$text\" ";
+ }
+
+ my $query = "SELECT COUNT(DISTINCT pgf.pgfile_id) from pgfile pgf,
+ DBsection dbsc, DBchapter dbc, DBsubject dbsj, pgfile_problem pgp,
+ problem p, textbook t
+ WHERE dbsj.DBsubject_id = dbc.DBsubject_id AND
+ dbc.DBchapter_id = dbsc.DBchapter_id AND
+ dbsc.DBsection_id = pgf.DBsection_id AND
+ pgf.pgfile_id = pgp.pgfile_id AND
+ pgp.problem_id = p.problem_id AND
+ p.textbook_id = t.textbook_id \n $extrawhere";
+ my $pg_id_ref = $dbh->selectrow_arrayref($query);
+ return($pg_id_ref->[0])
+}
+
##############################################################################
# input expected: keywords,<keywords>,chapter,<chapter>,section,<section>,path,<path>,filename,<filename>,author,<author>,instituition,<instituition>,history,<history>
sub createListing {
|