'."\n"; + + $scrout .= '
' + .$hidden_fields + .''; + + $scrout .= '
'."\n" + .''.&mt('Display Options').''."\n" + .&viewoptions() + .'
'; + + $scrout .= $advanced_buttons; + + $scrout .= &Apache::lonhtmlcommon::start_pick_box(); + + my %fields=&Apache::lonmeta::fieldnames(); + + # Standard Metadata + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt("Standard $srchtype Metadata").'

' + .&searchhelp() + .&Apache::lonhtmlcommon::row_closure(); + my %related_word_search = + ('title' => 1, + 'author' => 0, + 'owner' => 0, + 'authorspace' => 0, + 'modifyinguser'=> 0, + 'keywords' => 1, + 'notes' => 1, + 'abstract' => 1, + 'standards'=> 1, + 'mime' => 1, + 'subject' => 1, + ); + # + foreach my $field ('title','author','subject','owner','authorspace', + 'modifyinguser','keywords','notes','abstract', + 'standards','mime') { + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&Apache::lonmeta::prettyinput($field, + $env{'form.'.$field},'', + $field, + 'advsearch', + $related_word_search{$field}, + '  ', + $env{'form.'.$field.'_related'}, + 50); + if ($related_word_search{$field}) { + $scrout .= ''; + } else { + $scrout .= ''; + } + $scrout .= &Apache::lonhtmlcommon::row_closure(); } - elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') { - untie %hash; return &advancedsearch($r,\%ENV); + foreach my $field ('lowestgradelevel','highestgradelevel') { + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&Apache::lonmeta::prettyinput($field, + $env{'form.'.$field},'', + $field, + 'advsearch', + 0) + .&Apache::lonhtmlcommon::row_closure(); + } + + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&Apache::loncommon::filecategoryselect('category', + $env{'form.category'},'category') + .&Apache::lonhtmlcommon::row_closure(); + + my $anydomain = 1; + if ($env{'form.area'} ne 'portfolio') { + unless (&Apache::lonnet::allowed('bre','/res/')) { + $anydomain = 0; + } } -# ----------------------------- Else, begin building search interface to output - $scrout=''; # building a part of screen output - $scrout.=&searchphrasefield('Limit by title','title', - $ENV{'form.title'}); + $scrout .= &Apache::lonhtmlcommon::row_title(''); + if ($anydomain) { + my $defdom = &Apache::lonnet::default_login_domain(); + my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('shared',$defdom); + $scrout .= &Apache::loncommon::domain_select('domains', + $env{'form.domains'},1,$trusted,$untrusted,'domains'); + } else { + $scrout .= &Apache::loncommon::select_dom_form($env{'user.domain'}, + 'domains','','','', + [$env{'user.domain'}],'',1,'domains'); + } + $scrout .= &Apache::lonhtmlcommon::row_closure(); + + # Misc metadata + if ($env{'form.area'} ne 'portfolio') { + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&Apache::lonmeta::selectbox('copyright', + $env{'form.copyright'},'', + 'copyright', + \&Apache::loncommon::copyrightdescription, + ( undef, + &Apache::loncommon::copyrightids) + ) + .&Apache::lonhtmlcommon::row_closure(); + } + + $scrout .= &Apache::lonhtmlcommon::row_title('') + .&Apache::lonmeta::selectbox('language', + $env{'form.language'},'','language', + \&Apache::loncommon::languagedescription, + ('any',&Apache::loncommon::languageids) + ) + .&Apache::lonhtmlcommon::row_closure(); + + # Portfolio Metadata + if ($env{'form.area'} eq 'portfolio') { + # Added fields + my $curnumadd = $env{'form.numaddedfields'}; + if ($curnumadd eq '') { + $curnumadd = 1; + } + my $customlabel = &mt('Text box description'); + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Custom Metadata fields').'

' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title(''.$customlabel.'', + '','','',1) + .&mt('Field Name').' | '.&mt('Field Value(s)') + .&Apache::lonhtmlcommon::row_closure(); + + for (my $j=0; $j<$curnumadd; $j++) { + my $num = $j+1; + my $namelabel = &mt('name of custom metadata field [_1]',$num); + my $valuelabel = &mt('value of custom metadata field [_1]',$num); + $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Custom metadata [_1]',$num)) + .'' + .' ' + .'' + .&Apache::lonhtmlcommon::row_closure(); + } + my $addcustomlabel = &mt('Add metadata field option'); + $scrout .= &Apache::lonhtmlcommon::row_title(''.$addcustomlabel.'', + '','','',1) + .'' + .'' + .&Apache::lonhtmlcommon::row_closure(); +} else { + # + # Dynamic metadata + my $statslabel = &mt('Text box description'); + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Problem Statistics').'

' + .&Apache::lonhtmlcommon::row_closure(); + $scrout .= &Apache::lonhtmlcommon::row_title(''.$statslabel.'', + '','','',1) + .&mt('Minimum').' | '.&mt('Maximum') + .&Apache::lonhtmlcommon::row_closure(); + foreach my $statistic + ({ name=>'count', + description=>'Network-wide number of accesses (hits)', + minlabel => 'minimum hit count', + maxlabel => 'maximum hit count'}, + { name=>'stdno', + description=> + 'Statistics calculated for number of students', + minlabel => 'minimum number of students in calculation', + maxlabel => 'maximum number of students in calculation'}, + { name => 'avetries', + description=>'Average number of tries till solved', + minlabel => 'minimum average tries till solved', + maxlabel => 'maximum average tries till solved'}, + { name => 'difficulty', + description=>'Degree of difficulty', + minlabel => 'minimum degree of difficulty', + maxlabel => 'maximum degree of difficulty'}, + { name => 'disc', + description=>'Degree of discrimination', + minlabel => 'minimum degree of discrimination', + maxlabel => 'maximum degree of discrimination'}) { + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt($statistic->{'description'}))) + .'' + .' ' + .'' + .&Apache::lonhtmlcommon::row_closure(); + } + my $evallabel = &mt('Text box description'); + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Evaluation Data').'

' + .&Apache::lonhtmlcommon::row_closure(); + $scrout .= &Apache::lonhtmlcommon::row_title(''.$evallabel.'', + '','','',1) + .&mt('Minimum').' | '.&mt('Maximum') + .&Apache::lonhtmlcommon::row_closure(); + foreach my $evaluation + ( { name => 'clear', + description => 'Material presented in clear way', + minlabel => 'minimum score: clarity', + maxlabel => 'maximum score: clarity'}, + { name =>'depth', + description => 'Material covered with sufficient depth', + minlabel => 'minimum score: coverage depth', + maxlabel => 'maximum score: coverage depth'}, + { name => 'helpful', + description => 'Material is helpful', + minlabel => 'minimum score: content helpful', + maxlabel => 'maximum score: content helpful'}, + { name => 'correct', + description => 'Material appears to be correct', + minlabel => 'minimum score: correctness', + maxlabel => 'maximum score: correctness'}, + { name => 'technical', + description => 'Resource is technically correct', + minlabel => 'minimum score: technical correctness', + maxlabel => 'maximum score: technical correctness'}) { + $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt($evaluation->{'description'}))) + .'' + .' ' + .'' + .&Apache::lonhtmlcommon::row_closure(); + } + } + # + # Creation/Modification date limits + my $dateslabel = &mt('Text box description'); + $scrout .= &Apache::lonhtmlcommon::row_headline() + .'

'.&mt('Creation and Modification dates').'

' + .&Apache::lonhtmlcommon::row_closure(); + $scrout .= &Apache::lonhtmlcommon::row_title(''.$dateslabel.'', + '','','',1) + .&mt('Month[_1]Day[_2]Year',' 'x14,' 'x6) + .&Apache::lonhtmlcommon::row_closure(); + + my $cafter = + &Apache::lonhtmlcommon::date_setter('advsearch', # formname + 'creationdate1', # fieldname + 0, # current value + '', # special + 1, # includeempty + '', # state + 1, # no_hh_mm_ss + ); + my $cbefore = + &Apache::lonhtmlcommon::date_setter('advsearch', # formname + 'creationdate2', # fieldname + 0, # current value + '', # special + 1, # includeempty + '', # state + 1, # no_hh_mm_ss + ); + $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Created between')) + .$cafter + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::row_title(&mt('and')) + .$cbefore + .&Apache::lonhtmlcommon::row_closure(); + + my $lafter = + &Apache::lonhtmlcommon::date_setter('advsearch', + 'revisiondate1', + 0, # current value + '', # special + 1, # includeempty + '', # state + 1, # no_hh_mm_ss + ); + my $lbefore = + &Apache::lonhtmlcommon::date_setter('advsearch', + 'revisiondate2', + 0, # current value + '', # special + 1, # includeempty + '', # state + 1, # no_hh_mm_ss + ); + $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Last modified between')) + .$lafter + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::row_title(&mt('and')) + .$lbefore + .&Apache::lonhtmlcommon::row_closure(1); # Last row of total pick_box + + $scrout .= &Apache::lonhtmlcommon::end_pick_box(); + + $scrout .= $advanced_buttons + .'
'; + + $scrout .= '