#!/usr/bin/perl -w
# Copyright (C) 2003 Alexander Mikhailian (mikhailian@altern.org).
# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
# This is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
use CGI qw(:standard);
use Net::Dict;
my $webmaster="vle\@gmx.net";
#my $dict_server='cheusov.scnsoft.com';
#my $dict_server='dict.mova.org';
my $dict_server='dict.org';
#my $dict_server='127.0.0.1';
#my $dict_server='mova.org';
#my $dict_server='dict.org';
#my $download_url="http://$dict_server/dict/";
my $download_url="http://mova.org/~cheusov/dict/";
my $default_strategy='word';
my $message_first_match='First match';
my $message_all_databases='All databases';
my $message_return_definitions='Return definitions';
my $message_query_string='Query string:';
my $message_strategies='Strategies:';
my $message_databases='Databases:';
my $message_header='Slavic dictionaries on-line';
my $message_no_defs_found='No definitions found for the word';
my $message_no_matches_found='No matches found for the word';
my $message_information_about_dbs='Information about databases';
my $message_information_server='Information about server';
my $message_webmaster='webmaster';
my $message_server_runs="$dict_server runs DICT server.";
my $message_download="Download dictionaries from here .
If you found bugs in the dictionaries or have suggestions, subscribe to
the mailing list
here.
If you want to be notified about changes at dict://$dict_server, subscribe to this
mailing list
";
my $message_project_info='Read about DICT project here .';
my $message_related="Mozilla users can install
this XUL plugin for searching the
dictionaries by selecting a word and choosing \"Lookup at $dict_server\"
in the context menu. (install as root, close mozilla, restart it as
root again so that mozilla registers the new XUL plugin at startup).
See a screenshot
"; my $message_footer="Best viewed with Lynx
"; my $dict = Net::Dict->new($dict_server, Port => 2628); # a dictionary object my @databases = $dict->dbs_array(); my @strategies = $dict->strategies_array(); my $q = param("q"); # search my @database = param("database"); my $strategy = param("strategy"); my $dbinfo = param("dbinfo"); my $serverinfo = param("serverinfo"); my $full_url = url(); my @dbid; # database ids my @dbtitle; # database names my @stid; # definition ids my @sttitle; # definition names # default database unshift @databases, ['!', $message_first_match]; unshift @databases, ['*', $message_all_databases]; foreach (@databases){ push(@dbid, $_ -> [0]); push(@dbtitle, $_ -> [1]); $databases{$_ -> [0]} = $_ -> [1]; } push @strategies, ['definitions', $message_return_definitions]; foreach (@strategies){ push(@stid, $_ -> [0]); push(@sttitle, $_ -> [1]); $strategies{$_ -> [0]} = $_ -> [1]; } print header("text/html;charset=utf-8"), start_html(-title => "$message_header",-encoding => 'utf-8'), h1 ({-align=>'center'}, "$message_header"); print start_form(-method=>'GET'), '', $message_query_string, ' | ', '', textfield('q','',40,80), ' | ', '', $message_strategies, ' | ', popup_menu(-name=>'strategy', -default=>"$default_strategy", -values=>\@stid, -labels=>\%strategies), ' | ', '
', $message_databases, ' | ', popup_menu(-name=>'database', -default=>'*', -values=>\@dbid, -labels=>\%databases), ' | ', '
', submit, ' |
" . hr;
}
print div({-align=>'center'}, "
$message_information_about_dbs");
print div({-align=>'center'}, "
$message_information_server");
print div({-align=>'center'}, "$message_webmaster");
print div("
" . hr . "$message_related");
print hr;
print div($message_server_runs . ' ' . "$message_project_info");
print div("$message_download");
#print div("Mailing list is here. ");
print div("$message_footer");
print end_form;
print end_html;