%perl> my @langshtml; if( $bg ) { my $langs = $dbh->selectall_arrayref("SELECT tag,realname FROM languages WHERE langid>0 ORDER BY tag"); my @langs = map { $_->[0] } @{ $langs }; my %mapping = map { $_->[0] => $_->[1] } @{ $langs }; my $format = '%s'; foreach my $curlang (@langs) { if($langarg eq $curlang) { push @langshtml, $curlang; next; } my $vislang = $curlang; $vislang =~ s/\s+/ /g; my $html = sprintf($format, &utils::armorurl($curlang), ";bg=$bg", $vislang); push @langshtml, $html; } # If we're in best guess mode but have no language arg... if( ! $langarg ) { %perl>
This is a "best guess" listing, meaning that only one of the definitions for each word will be shown.The best guess is determined by compiling user votes.
As a side effect, only words that have votes registered will be shown here.
% }%s
'
: '%s
';
foreach my $curinitial (@initialletters) {
if($curinitial eq $initial) {
push @initialshtml, $curinitial;
next;
}
my $html = sprintf($format,
$curinitial,
defined($type)?";type=".utils::armorurl($type):";type=all",
$curinitial);
push @initialshtml, $html;
}
%perl>
Pick a word type, above. Or you can go to the all words list
% } else {Pick a word type, above. Or you can go to the all words list
% } % if (defined($session{'username'})) { % } else {If you were logged in you could also add new words from here.
% } % return; % } <%perl> my(@conditions,@args); if(defined($type) && $type ne "all") { push @conditions, "typeid=(SELECT typeid FROM valsitypes WHERE descriptor=?)"; push @args, $type; } if(defined($initial)) { push @conditions, "word LIKE '$initial%'"; } my $sql; if( $bg ) { if( defined($langarg) ) { my $langid=$dbh->selectrow_array("SELECT langid FROM languages WHERE tag=?", undef, $langarg); push @conditions, "d.langid=$langid"; } if ($#conditions >= 0) { $sql = "SELECT v.word, d.definitionnum, d.definitionid, d.langid FROM valsi v, definitions d, valsibestguesses vbg WHERE ".join(" AND ",@conditions)." AND v.valsiid = d.valsiid AND d.definitionid=vbg.definitionid ORDER BY v.word, d.definitionnum"; } else { $sql = "SELECT v.word, d.definitionnum, d.definitionid, d.langid FROM valsi v, definitions d WHERE v.valsiid != 0 AND v.valsiid = d.valsiid ORDER BY v.word, d.definitionnum"; } } else { if ($#conditions >= 0) { $sql = "SELECT * FROM valsi WHERE ".join(" AND ",@conditions)." ORDER BY word"; } else { $sql = "SELECT word FROM valsi WHERE valsiid!=0 ORDER BY word"; } } my $listingquery = $dbh->prepare($sql); $listingquery->execute(@args); my $count = $listingquery->rows; my $columns = 4; my $percolumn = POSIX::ceil($count/$columns); %perl>
% my $thiscolcount=$percolumn;
% while($listingquery->{Active} && defined(my $listingrow = $listingquery->fetchrow_hashref)) {
% if( $bg )
% {
% my $bgstring="?bg=1;langidarg=$listingrow->{'langid'}";
- <% $listingrow->{'word'} %> def #<%
$listingrow->{'definitionnum'} %>
% } else { - <% $listingrow->{'word'} %> % } % last unless --$thiscolcount; % } |
% }