+ use UTF-8 as internal encoding
+ dump stats into var/stats.yml
+ WebPAC::Output::SWISH for indexing with swish-e [2.35]
+- implement attribute labels in webpac2.cgi
- fix encoding for swish-e and/or webpac2.cgi
- marc_clone to copy records/fields/indicators from input marc
- rewrite WebPAC::Input to be based on Module::Pluggable or Moose
my $db = $config->{databases}->{$database};
-my @attr = keys %{ $stats->{attr} }; # FIXME replace with real gnerated lookup
+sub read_config_txt {
+ my ( $file ) = @_;
+ my $input;
+ foreach ( split(/[\n\r]+/, read_file( "$dir/$path/$path-$file.txt" ) ) ) {
+ my ( $val,$label ) = split(/\s*\t\s*/,$_,2);
+ push @{ $input->{ '-values' } }, $val;
+ $input->{ '-labels' }->{$val} = $label;
+ }
+ return $input;
+}
-# XXX pipe delimit list!
-my $select_attr_operators = << '__ATTR_OPERATORS__';
-Q* | Bilo koja riječ
-BW Q | Početak
-BW Q EW | Točan oblik
-__ATTR_OPERATORS__
+my $attr_labels = read_config_txt 'labels';
+my $attr_operators = read_config_txt 'operators';
-my $attr_operator;
+my @attr = @{ $attr_labels->{'-values'} };
+@attr = keys %{ $stats->{attr} } unless @attr;
-foreach ( split(/[\n\r]+/, $select_attr_operators ) ) {
- my ( $operator,$label ) = split(/\s+\|\s+/,$_,2);
- push @{ $attr_operator->{ '-values' } }, $operator;
- $attr_operator->{ '-labels' }->{$operator} = $label;
-}
-warn "## attr_operator = ", dump( $attr_operator );
+warn dump( $attr_labels, $attr_operators );
my $only_input;
start_form( -action => self_url( query => 0 ) ),
radio_group(
-name => 'attr',
- -values => [ @attr ],
+ %$attr_labels,
# -linebreak => 0,
),
textfield( -name => 'search' ),
- popup_menu( -name => 'attr_operator', %$attr_operator ),
+ popup_menu( -name => 'attr_operator', %$attr_operators ),
submit,
hidden( -name => 'entries_per_page', -default => $entries_per_page ),
# we need current_page fixed at 1 so that every submit through form will reset it
$html_markup_skip->{$attr} = $@;
}
}
- print qq|<div><label>$attr</label><span class=$attr>$v</span></div>\n|;
+ my $label = $attr_labels->{'-labels'}->{$attr} || $attr;
+ print qq|<div><label>$label</label><span class=$attr>$v</span></div>\n|;
}
print qq|</li>\n|;
}