| … | |
… | |
| 501 | |
501 | |
| 502 | sub browse_library_panel2adv { |
502 | sub browse_library_panel2adv { |
| 503 | my $self = shift; |
503 | my $self = shift; |
| 504 | my $r = $self->r; |
504 | my $r = $self->r; |
| 505 | my $ce = $r->ce; |
505 | my $ce = $r->ce; |
|
|
506 | my $right_button_style = "width: 18ex"; |
| 506 | |
507 | |
| 507 | my @subjs = WeBWorK::Utils::ListingDB::getAllDBsubjects($r); |
508 | my @subjs = WeBWorK::Utils::ListingDB::getAllDBsubjects($r); |
| 508 | unshift @subjs, ALL_SUBJECTS; |
509 | unshift @subjs, ALL_SUBJECTS; |
| 509 | |
510 | |
| 510 | my @chaps = WeBWorK::Utils::ListingDB::getAllDBchapters($r); |
511 | my @chaps = WeBWorK::Utils::ListingDB::getAllDBchapters($r); |
| … | |
… | |
| 512 | |
513 | |
| 513 | my @sects = WeBWorK::Utils::ListingDB::getAllDBsections($r); |
514 | my @sects = WeBWorK::Utils::ListingDB::getAllDBsections($r); |
| 514 | unshift @sects, ALL_SECTIONS; |
515 | unshift @sects, ALL_SECTIONS; |
| 515 | |
516 | |
| 516 | my $texts = WeBWorK::Utils::ListingDB::getDBTextbooks($r); |
517 | my $texts = WeBWorK::Utils::ListingDB::getDBTextbooks($r); |
| 517 | #my @textarray = map { $_->[1]." by ".$_->[2] } @{$texts}; |
|
|
| 518 | my @textarray = map { $_->[0] } @{$texts}; |
518 | my @textarray = map { $_->[0] } @{$texts}; |
| 519 | my %textlabels = (); |
519 | my %textlabels = (); |
| 520 | for my $ta (@{$texts}) { |
520 | for my $ta (@{$texts}) { |
| 521 | $textlabels{$ta->[0]} = $ta->[1]." by ".$ta->[2]." (edition ".$ta->[3].")"; |
521 | $textlabels{$ta->[0]} = $ta->[1]." by ".$ta->[2]." (edition ".$ta->[3].")"; |
| 522 | } |
522 | } |
| … | |
… | |
| 529 | my $textbook_selected = $r->param('library_textbook') || ALL_TEXTBOOKS; |
529 | my $textbook_selected = $r->param('library_textbook') || ALL_TEXTBOOKS; |
| 530 | |
530 | |
| 531 | my $text_popup = CGI::popup_menu(-name => 'library_textbook', |
531 | my $text_popup = CGI::popup_menu(-name => 'library_textbook', |
| 532 | -values =>\@textarray, |
532 | -values =>\@textarray, |
| 533 | -labels => \%textlabels, |
533 | -labels => \%textlabels, |
| 534 | -default=>$textbook_selected); |
534 | -default=>$textbook_selected, |
|
|
535 | -onchange=>"submit();return true"); |
|
|
536 | |
|
|
537 | my $library_keywords = $r->param('library_keywords') || ''; |
|
|
538 | |
| 535 | my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); |
539 | my $view_problem_line = view_problems_line('lib_view', 'View Problems', $self->r); |
|
|
540 | |
|
|
541 | my $count_line = WeBWorK::Utils::ListingDB::countDBListings($r); |
|
|
542 | if($count_line==0) { |
|
|
543 | $count_line = "There are no matching pg files"; |
|
|
544 | } else { |
|
|
545 | $count_line = "There are $count_line matching WeBWorK problem files"; |
|
|
546 | } |
| 536 | |
547 | |
| 537 | print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, |
548 | print CGI::Tr(CGI::td({-class=>"InfoPanel", -align=>"left"}, |
| 538 | CGI::hidden(-name=>"library_is_basic", -default=>[2]), |
549 | CGI::hidden(-name=>"library_is_basic", -default=>[2]), |
| 539 | CGI::start_table({-width=>"100%"}), |
550 | CGI::start_table({-width=>"100%"}), |
| 540 | # Html done by hand since it is temporary |
551 | # Html done by hand since it is temporary |
| … | |
… | |
| 545 | -values=>\@subjs, |
556 | -values=>\@subjs, |
| 546 | -default=> $subject_selected, |
557 | -default=> $subject_selected, |
| 547 | -onchange=>"submit();return true" |
558 | -onchange=>"submit();return true" |
| 548 | )]), |
559 | )]), |
| 549 | CGI::td({-colspan=>2, -align=>"right"}, |
560 | CGI::td({-colspan=>2, -align=>"right"}, |
| 550 | CGI::submit(-name=>"lib_select_subject", -value=>"Update Lists"))), |
561 | CGI::submit(-name=>"lib_select_subject", -value=>"Update Menus", |
|
|
562 | -style=> $right_button_style))), |
| 551 | CGI::Tr( |
563 | CGI::Tr( |
| 552 | CGI::td(["Chapter:", |
564 | CGI::td(["Chapter:", |
| 553 | CGI::popup_menu(-name=> 'library_chapters', |
565 | CGI::popup_menu(-name=> 'library_chapters', |
| 554 | -values=>\@chaps, |
566 | -values=>\@chaps, |
| 555 | -default=> $chapter_selected, |
567 | -default=> $chapter_selected, |
| 556 | -onchange=>"submit();return true" |
568 | -onchange=>"submit();return true" |
| 557 | )]), |
569 | )]), |
| 558 | CGI::td({-colspan=>2, -align=>"right"}, |
570 | CGI::td({-colspan=>2, -align=>"right"}, |
| 559 | CGI::submit(-name=>"library_basic", -value=>"Basic Search")) |
571 | CGI::submit(-name=>"library_reset", -value=>"Reset", |
|
|
572 | -style=>$right_button_style)) |
| 560 | ), |
573 | ), |
| 561 | CGI::Tr( |
574 | CGI::Tr( |
| 562 | CGI::td(["Section:", |
575 | CGI::td(["Section:", |
| 563 | CGI::popup_menu(-name=> 'library_sections', |
576 | CGI::popup_menu(-name=> 'library_sections', |
| 564 | -values=>\@sects, |
577 | -values=>\@sects, |
| 565 | -default=> $section_selected, |
578 | -default=> $section_selected, |
| 566 | -onchange=>"submit();return true" |
579 | -onchange=>"submit();return true" |
| 567 | )]), |
580 | )]), |
|
|
581 | CGI::td({-colspan=>2, -align=>"right"}, |
|
|
582 | CGI::submit(-name=>"library_basic", -value=>"Basic Search", |
|
|
583 | -style=>$right_button_style)) |
| 568 | ), |
584 | ), |
| 569 | CGI::Tr( |
585 | CGI::Tr( |
| 570 | CGI::td(["Textbook:", $text_popup]), |
586 | CGI::td(["Textbook:", $text_popup]), |
| 571 | ), |
587 | ), |
|
|
588 | CGI::Tr(CGI::td("Keywords:"),CGI::td({-colspan=>2}, |
|
|
589 | CGI::textfield(-name=>"library_keywords", |
|
|
590 | -default=>$library_keywords, |
|
|
591 | -override=>1, |
|
|
592 | -size=>40))), |
| 572 | CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)), |
593 | CGI::Tr(CGI::td({-colspan=>3}, $view_problem_line)), |
|
|
594 | CGI::Tr(CGI::td({-colspan=>3, -align=>"center"}, $count_line)), |
| 573 | CGI::end_table(), |
595 | CGI::end_table(), |
| 574 | )); |
596 | )); |
| 575 | #CGI::Tr( |
|
|
| 576 | # CGI::td("Textbook:"), |
|
|
| 577 | # CGI::td({-colspan=>2}, |
|
|
| 578 | # CGI::popup_menu(-name=> 'library_textbooks', |
|
|
| 579 | # -values=>\@textbooks, |
|
|
| 580 | # #-default=> $section_selected |
|
|
| 581 | #))), |
|
|
| 582 | |
|
|
| 583 | #CGI::Tr( |
|
|
| 584 | # CGI::td("Keywords:"), |
|
|
| 585 | # CGI::td({-colspan=>2}, |
|
|
| 586 | # CGI::textfield(-name=>"keywords", |
|
|
| 587 | # -default=>"Keywords not implemented yet", |
|
|
| 588 | # -override=>1, -size=>60 |
|
|
| 589 | #))), |
|
|
| 590 | |
597 | |
| 591 | } |
598 | } |
| 592 | |
599 | |
| 593 | |
600 | |
| 594 | ##### Version 4 is the set definition file panel |
601 | ##### Version 4 is the set definition file panel |