Encode-Arabic

 view release on metacpan or  search on metacpan

lib/Encode/Arabic/CGI.pm  view on Meta::CPAN


    return $r;
}

sub display_headline ($) {

    my $c = shift;
    my $q = $c->query();
    my $r;

    $r .= $q->h1($q->a({'href' => 'http://sourceforge.net/projects/encode-arabic/'}, "Encode Arabic"), 'Online Interface');

    return $r;
}

sub display_welcome ($) {

    my $c = shift;
    my $q = $c->query();
    my $r;

    $r .= $q->p("Welcome to the online interface to", $q->a({-href => 'http://sourceforge.net/projects/encode-arabic/'}, "Encode Arabic") .
                ", a library for processing various encodings and notations of Arabic with",
                $q->a({-href => 'http://search.cpan.org/dist/Encode-Arabic/'}, "Perl"), "or",
                $q->a({-href => 'http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Encode/'}, "Haskell") . ".");

    $r .= $q->p('You must have Unicode fonts installed to appreciate this site. If you need some, try the',
                $q->a({'href' => 'http://sourceforge.net/projects/dejavu/'}, 'DejaVu Fonts'), 'from SourceForge.');

    return $r;
}

sub display_footline ($) {

    my $c = shift;
    my $q = $c->query();
    my $r;

    $r .= $q->br();

    $r .= $q->p("(C) Otakar Smr\x{017E} 2012-2003. GNU General Public License", $q->a({-href => 'http://www.gnu.org/licenses/'}, "GNU GPL 3") . ".");

    $r .= $q->p("Encode Arabic is an", $q->a({-href => 'http://sourceforge.net/projects/encode-arabic/'}, "open-source online"), "project.",
                "You can contribute to its development with your suggestions!");

    $r .= $q->p("Contact", $q->a({-href => 'http://otakar-smrz.users.sf.net/'}, "otakar-smrz users.sf.net") . ",",
                "Institute of Formal and Applied Linguistics, Charles University in Prague.");

    return $r;
}

sub display_footer ($) {

    my $c = shift;
    my $q = $c->query();
    my $r;

    $r .= $q->p({'style' => 'text-align: right;'},
                '<a href="http://validator.w3.org/check?uri=referer"><img border="0"
                    src="http://www.w3.org/Icons/valid-xhtml10"
                    alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>',
                '<a href="http://jigsaw.w3.org/css-validator/check?uri=referer"><img border="0"
                    src="http://www.w3.org/Icons/valid-css2"
                    alt="Valid CSS level 2.1" height="31" width="88" /></a>');

    $r .= $q->script({-type => 'text/javascript', -src => 'http://api.yamli.com/js/yamli_api.js'}, "");

    $r .= $q->script({-type => 'text/javascript'}, join ' ', split ' ', q {

                            if (typeof(Yamli) == "object") {

                                Yamli.init({ uiLanguage: "en", startMode: "onOrUserDefault",
                                             settingsPlacement: 'inside',
                                             showTutorialLink: false, showDirectionLink: true });

                                encodeYamli('');
                            }
                    });

    $r .= $q->end_html();

    return $r;
}


sub recode {

    my $c = shift;

    my $q = $c->query();

    my $r = '';

    my @tick = ();

    $q->param($c->mode_param(), 'recode');

    $r .= display_header $c;

    $r .= display_headline $c;

    my @example = ( [ 'ArabTeX',    "\\cap al-waqtu al-'Ana " . (timer gmtime time) . " bi-tawqIti <GMT>, 'ah\"laN wa-sah\"laN!" ],
                    [ 'ArabTeX',    "\\cap iqra' h_a_dA an-na.s.sa bi-intibAhiN: li-al-laylaTayni yusAwI li-llaylatayni, wa-lA li-a|l-laylaT-|ayni." ],
                    [ 'ArabTeX',    "iqra'-i ad-darsa al-'awwala" ],
                    [ 'Buckwalter', "AqrO Aldrs AlOwl" ],
                    [ 'Buckwalter', "yEtbr mDy}A" ],
                    [ 'Unicode',    decode "buckwalter", "AqrO Aldrs AlOwl" ],
                    [ 'Unicode',    decode "buckwalter", "Aldrs AlOwl" ],
                    [ 'Unicode',    decode "buckwalter", "yEtbr mDy}A" ] );

    if (defined $q->param('submit') and $q->param('submit') eq 'Example') {

        my $idx = rand @example;

        $q->param('text', $example[$idx][1]);
        $q->param('decode', $example[$idx][0]);
    }
    else {

        if (defined $q->param('text') and $q->param('text') != /^\s*$/) {



( run in 0.769 second using v1.01-cache-2.11-cpan-172d661cebc )