Source

IDO / perl / ido-calendar2010.pl

The default branch has multiple heads

Full commit
# -*- perl -*- ###############################################################
#
#  			Copyright 2009 Potsdam University.
#			      All Rights Reserved
#
#
#  System        : 
#  Module        : 
#  Object Name   : $RCSfile:$
#  Revision      : $Revision:$
#  Date          : $Date:$
#  Author        : $Author:$
#  Created By    : Dr. Detlef Groth
#  Created       : Sun May 3 07:24:45 2009
#  Last Modified : <090603.0610>
#
#  Description	
#
#  Notes
#
#  History
#	
##############################################################################
#
#  Copyright (c) 2009 Potsdam University.
# 
#  All Rights Reserved.
# 
#  This  document  may  not, in  whole  or in  part, be  copied,  photocopied,
#  reproduced,  translated,  or  reduced to any  electronic  medium or machine
#  readable form without prior written consent from Potsdam University.
#
##############################################################################

use strict;
use PDF::Reuse;
use Date::Formatter;
my %feste ;
while (<DATA>) {
    my @F = split(/\t/,$_);
    $feste{$F[0]} = $F[1];
}
my %days = (
            "Monday" => "Lundio",
            "Tuesday" => "Mardio",
            "Wednesday" => "Merkurdio",
            "Thursday" => "Jovdio",
            "Friday" => "Venerdio",
            "Saturday" => "Saturdio",
            "Sunday" => "Sundio");
my %gdays = (
            "Monday" => "Montag",
            "Tuesday" => "Dienstag",
            "Wednesday" => "Mittwoch",
            "Thursday" => "Donnerstag",
            "Friday" => "Freitag",
            "Saturday" => "Samstag",
            "Sunday" => "Sonntag");

my @months = ("null","January","February","March","April","May","June",
              "July","August","September","October", "November", "December");
my @imonths = qw(Decembro Januaro Februaro Marto Aprilo Mayo Junio Julio Agosto Septembro Oktobro Novembro Decembro);
prFile("calendario-2010x.pdf");
sub printCalendar {
    my %date= (year => 2009, day_of_month => 27, month => 12);
    my $df=Date::Formatter->new(%date);
    $df->createDateFormatter("(D)");   
    my $formatDay = $df->getDateFormatter();
    $df->createDateFormatter("(DD)");   
    my $formatDayNumber = $df->getDateFormatter();
    $df->createDateFormatter("(YYYY)");   
    my $formatYear = $df->getDateFormatter();
    $df->createDateFormatter("(MM)");   
    my $formatMonth = $df->getDateFormatter();
    $df->createDateFormatter("(hh):(mm):(ss) (D) (MM)/(DD)/(YYYY)");   
    my $formatter=$df->getDateFormatter();   
    $df->createDateFormatter("(DD)/(MM)/(YYYY)");   
    my $formatFull=$df->getDateFormatter();   
    my $week = 0 ;
    my $total = 0 ;
    my $ft;
    while ($week++ < 27) {
        prPage();
        prFontSize(20);
        prFont("Times-Bold");
        if ($week*2-1>1) {
            # corecta semano segune unesma jovdio!
            
            prText(550,800,"Semano ".($week*2-2),"right");
        }
        foreach my $d (0..6) {
            my $day = ($week-1)*14+$d+1 ;
            my $iv = Date::Formatter->createTimeInterval(days => $day);
            $ft=$df+$iv;
            if ($d == 0) {
                $ft->setDateFormatter($formatMonth);
                my $m = $imonths[$ft];
                $ft->setDateFormatter($formatYear);
                my $y= sprintf("%i",$ft);
                prText(50,800,"$m $y","left");
            }
            $ft->setDateFormatter($formatDay);
            my $ftDay=sprintf($ft);
            $ft->setDateFormatter($formatDayNumber);
            my $ftDayNumber=sprintf($ft) ;
            $ft->setDateFormatter($formatFull);
            my $ftFull=sprintf($ft);
            prFontSize(20);
            prFont("Times-Bold");
            prText(100,760-$d*105,$ftDayNumber,'center');
            #prFontSize(14);
            prText(100,740-$d*105, $days{$ftDay}, 'center');
            prFontSize(14);
            prFont("Times-Roman");
            prText(100,725-$d*105, $gdays{$ftDay}, 'center');
            if (exists($feste{$ftFull})) {
                my $z = 0;
                prFontSize(10);
                foreach my $item (split(/\s*;\s*/,$feste{$ftFull})) {
                    prText(100,710-($d*105)-(10*$z),$item,"center");
                    $z++;
                }
                prFontSize(14);
            }
        }
        prSinglePage("calendar-lines.pdf",1);
        prPage();
        last if ($week*2+1>54) ;
        prFontSize(20);
        prFont("Times-Bold");
        prText(50,800,"Semano ".($week*2-1),"left");
        foreach my $d (0..6) {
            my $day = ($week-1)*14+$d+8;
            my $iv = Date::Formatter->createTimeInterval(days => $day);
            my $ft=$df+$iv;
            $ft->setDateFormatter($formatDay);
            my $ftDay=sprintf($ft);
            $ft->setDateFormatter($formatDayNumber);
            my $ftDayNumber=sprintf($ft) ;
            $ft->setDateFormatter($formatFull);
            my $ftFull=sprintf($ft);
            prFontSize(20);
            prFont("Times-Bold");
            prText(500,760-$d*105,$ftDayNumber,'center');
            prText(500,740-$d*105, $days{$ftDay}, 'center');
            if ($d == 6) {
                $ft->setDateFormatter($formatMonth);
                my $m = $imonths[$ft];
                $ft->setDateFormatter($formatYear);
                my $y= sprintf("%i",$ft);
                prText(550,800,"$m $y","right");
            }

            prFontSize(14);
            prFont("Times-Roman");
            prText(500,725-$d*105, $gdays{$ftDay}, 'center');
            if (exists($feste{$ftFull})) {
                my $z = 0;
                prFontSize(10);
                foreach my $item (split(/\s*;\s*/,$feste{$ftFull})) {
                    prText(500,710-($d*105)-(10*$z),$item,"center");
                    $z++;
                }
                prFontSize(14);
            }

            
        }
        prFont("Times-Roman");
        prFontSize(14);
        prSinglePage("calendar-lines.pdf",2);

    }
}
sub addText {
    my $infile = shift ;
    my $outfile = shift ;
    my $x = shift ;
    my $y = shift ;
    my $text = shift ;
    my $font=shift ;
    my $fontsize=shift;
    my $skip = shift || 0 ;
    my $n = 0;
    prFile($outfile);
    prFont($font);
    prFontSize($fontsize);
    while (1) {
        $n++;
        my $page = $n-$skip;
        my $itext = $text ;
        $itext =~ s/<PAGE>/$page/g ;
        if ($n > $skip) {
            prText($x, $y, $itext);
        }
        last unless prSinglePage($infile);
     }
    prEnd();
}

prDoc("../pdf/frontspicio-kalendario.pdf");
prPage();
prDoc("../pdf/kalendario-duesma-pago.pdf");
prPage();
prSinglePage('../pdf/cal-2010-2011.pdf'); 
prPage();
prDoc("../docs/ido-flyer.pdf");
prPage();
printCalendar();
prDoc('../docs/ido-mini-sprachlehre.pdf');
prPage();
prDoc('../docs/ido-wortbildung.pdf');
prPage();
prDoc('../docs/ido-dialog.pdf');
prPage();
prDoc('../vortari/bazala-vortaro.pdf');
prPage();
prDoc('../docs/ido-links.pdf');
prPage();
prDoc('../docs/ido-adresaro.pdf');
prPage();
prDoc('../docs/konferi/ido-konferi.pdf');
prPage();
prFont("Times-Bold");
prFontSize(14);
my @letters = ("ABCD","EFGH","IJKL", "MNOP","QRST","UVWXYZ");
while (1) {
    my $l =shift @letters || last;
    prText(290,800,"Adresaro: $l","center");
    prSinglePage("../pdf/pdf-pages.pdf",1)
}
#prText(290,800,"Noti","center");
#prSinglePage("../pdf/pdf-pages.pdf",1);
#prText(290,800,"Noti","center");
#prSinglePage("../pdf/pdf-pages.pdf",1);
prText(290,800,"Noti","center");
prSinglePage("../pdf/pdf-pages.pdf",1);
#prPage();
#prText(10,10,"");
prEnd();
addText("calendario-2010x.pdf","kalendario-2010.pdf",290,15,"<PAGE>","Times-Bold", 16,2);
unlink("calendario-2010x.pdf");
exit 0;
__DATA__
1/1/2010	Novyaro
6/1/2010	santa tri rejuli
17/1/2010	Louis Couturat ; 1868-1914
20/3/2010	komenco di ; printempo
28/3/2010	komenco di ; somer-tempo
2/4/2010	Pasko
4/4/2010	Pasko
5/4/2010	Pasko
1/5/2010	dio dil laboro
13/5/2010	acenso di kristo
23/5/2010	Pentekosto
24/5/2010	Pentekosto
3/6/2010	krist-korpo
21/6/2010	komenco di somero
15/8/2010	ciel-iro di Maria 
2/9/2010	Wilhelm Ostwald ; 1853-1932
22/9/2010	komenco di autuno
3/10/2010	germana nacionala dio; Louis de Beaufront ; 1855-1935 
21/10/2010	komenco di vintro
24/10/2010	Ido nask-dio
31/10/2010	dio di reformaco*
1/11/2010	santara festo
17/11/2010	penitenco e prego dio
15/12/2010	Ludwik Zamenhof ; 1859-1917
24/12/2010	vigilio di Krist-nasko
25/12/2010	unesma Krist-nasko dio
26/12/2010	duesma Krist-nasko dio
31/12/2010	Silvestro*
1/1/2011	Novjaro

1/1/2009	novyaro
6/1/2009	santa tri rejuli
17/1/2009	Louis Couturat ; 1868-1914
28/3/2009	komenco di somer-tempo
10/4/2009	pask-venerdio
12/4/2009	pask-sundio
13/4/2009	pask-lundio
1/5/2009	dio dil laboro
21/5/2009	acenso di kristo
31/5/2009	pentekosto
1/6/2009	pentekosto
11/6/2009	krist-korpo
15/8/2009	ciel-iro di Maria 
2/9/2009	Wilhelm Ostwald ; 1853-1932
3/10/2009	germana nacionala dio; Louis de Beaufront ; 1855-1935 
24/10/2009	Ido nask-dio
31/10/2009	dio di reformaco*
1/11/2009	santara festo
18/11/2009	penitenco e prego dio
15/12/2009	Ludwik Zamenhof ; 1859-1917
24/12/2009	vigilio di Krist-nasko
25/12/2009	unesma Krist-nasko dio
26/12/2009	duesma Krist-nasko dio
31/12/2009	Silvestro*