Gossamer Forum
Home : Products : Links 2.0 : Customization :

Re: [PerlFlunkie] Problem with the nonenglish mod (bug?)

Quote Reply
Re: [PerlFlunkie] Problem with the nonenglish mod (bug?) In reply to
In Reply To:
I read that before, but still had no success. Post the whole sub you changed, maybe i can see what I missed... It is sub build_select_field_from_db, right?


In db_utils.pl search for sub build_select_field. This is the entire sub build_select_field I'm using right now:

Code:
sub build_select_field {
# --------------------------------------------------------
# Builds a SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $mult) = @_;
my ($size, %values);

$name || ($name = $column);
$size || ($size = 1);

if (! exists $db_select_fields{$column}) {
$db_select_fields{$db_cols[$db_category]} = $db_select_fields{'Mult-Related'} = join (",", &category_list);
}
if ($mult) {
@fields = split (/\,/, $db_select_fields{"Mult-$column"});
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
@fields = split (/\,/, $db_select_fields{$column});
$values{$value}++;
}
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";

$output = qq|<select class="form" name="$name" $mult size=$size><option>---|;
foreach $field (@fields) {
$kategory{$field} = &kategorie_title_mb($field);
}

foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED VALUE=\"$field\">$kategory{$field}\n") :
($output .= "<OPTION VALUE=\"$field\">$kategory{$field}");
}
$output .= "</select>";
return $output;
} sub kategorie_title_mb {
# --------------------------------------------------------
my ($input, $output, $title, $kategorie, @fields); $input = $_[0];
$title = ""; KATEGORIE: foreach $kategorie (@kategorien) {
if ($kategorie =~ /^#/) { next KATEGORIE; } # Skip comment lines.
chomp ($kategorie);
@fields = &split_decode ($kategorie);
if ($fields[1] eq $input) {
$title = $fields[8];
last KATEGORIE;
}
}
if ($title eq "") {
$output = &build_clean ($input);
}
else {
$output = &build_clean_mb ($title);
} return $output;
}


Don't forget to include the sub kategorie_title_mb below the sub build_select_field (like I did above). Otherwise the validation of new links won't work...

C.

Last edited by:

C.: Sep 4, 2003, 5:24 PM
Subject Author Views Date
Thread Problem with the nonenglish mod (bug?) C. 3239 Sep 1, 2003, 5:06 AM
Thread Re: [C.] Problem with the nonenglish mod (bug?)
PerlFlunkie 3230 Sep 1, 2003, 12:26 PM
Thread Re: [PerlFlunkie] Problem with the nonenglish mod (bug?)
Andy 3198 Sep 1, 2003, 1:41 PM
Thread Re: [Andy] Problem with the nonenglish mod (bug?)
PerlFlunkie 3185 Sep 1, 2003, 2:10 PM
Thread Re: [PerlFlunkie] Problem with the nonenglish mod (bug?)
Andy 3199 Sep 1, 2003, 2:30 PM
Thread Re: [Andy] Problem with the nonenglish mod (bug?)
PerlFlunkie 3165 Sep 1, 2003, 8:02 PM
Thread Re: [PerlFlunkie] Problem with the nonenglish mod (bug?)
C. 3166 Sep 3, 2003, 10:05 AM
Thread Re: [C.] Problem with the nonenglish mod (bug?)
PerlFlunkie 3149 Sep 3, 2003, 10:44 AM
Thread Re: [PerlFlunkie] Problem with the nonenglish mod (bug?)
C. 3114 Sep 4, 2003, 5:19 PM
Post Re: [C.] Problem with the nonenglish mod (bug?)
PerlFlunkie 3103 Sep 4, 2003, 7:53 PM
Post Re: [PerlFlunkie] Problem with the nonenglish mod (bug?)
C. 3188 Sep 1, 2003, 5:25 PM