/[pliva-si]/m/menu.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /m/menu.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ravilov, Thu Jun 28 10:55:30 2001 UTC revision 1.3 by dpavlin, Thu Jun 28 19:00:15 2001 UTC
# Line 4  use strict; Line 4  use strict;
4  use DBI;  use DBI;
5  use Image::Magick;  use Image::Magick;
6    
7  use constant TYPE_NONE => scalar 0;  use constant TYPE_NONE => scalar 2;
8  use constant TYPE_BULLET => scalar 1;  use constant TYPE_BULLET => scalar 3;
9  use constant TYPE_LINE => scalar 2;  use constant TYPE_LINE => scalar 1;
10    
11  sub dump_gif {  sub dump_gif {
12          my ($text, $type, $file) = @_;          my ($text, $type, $file) = @_;
# Line 18  sub dump_gif { Line 18  sub dump_gif {
18          $image->Set('size' => '125x13');          $image->Set('size' => '125x13');
19          $image->Read('xc:#283880');          $image->Read('xc:#283880');
20          if ($type == TYPE_BULLET) {          if ($type == TYPE_BULLET) {
21                  $image->Annotate('text' => $text, 'geometry' => '+17+1',                  $image->Annotate('text' => $text, 'geometry' => '+17+10',
22                          'font' => "\@arialbd.ttf", 'pointsize' => 11,                          'font' => "\@arialbd.ttf", 'pointsize' => 11,
23                          'pen' => '#FFFFFF', 'align' => 'left');                          'fill' => '#ffffff', 'align' => 'left');
24                  $image->Blur('radius' => 1);  #               $image->Annotate('text' => $text, 'geometry' => '+17+1',
25    #                       'font' => "\@arialbd.ttf", 'pointsize' => 11,
26    #                       'pen' => '#FFFFFF', 'align' => 'left');
27    #               $image->Blur('radius' => 0.1);
28                  $image->Draw('primitive' => 'rectangle', 'stroke' => '#00D000',                  $image->Draw('primitive' => 'rectangle', 'stroke' => '#00D000',
29                          'fill' => '#00D000', 'antialias' => 1, 'points' =>                          'fill' => '#00D000', 'antialias' => 1, 'points' =>
30                          '7,4 10,7');                          '7,4 10,7');
31          } else {          } else {
32                  $image->Annotate('text' => $text, 'geometry' => '+3+0',                  $image->Annotate('text' => $text, 'geometry' => '+3+10',
33                          'font' => "\@arialbd.ttf", 'pointsize' => 11,                          'font' => "\@arialbd.ttf", 'pointsize' => 11,
34                          'pen' => '#FFFFFF', 'align' => 'left');                          'fill' => '#FFFFFF', 'align' => 'left');
35                  $image->Blur('radius' => 1);  #               $image->Blur('radius' => 1);
36                  if ($type == TYPE_LINE) {                  if ($type == TYPE_LINE) {
37                          $image->Draw('primitive' => 'line',                          $image->Draw('primitive' => 'line',
38                                  'stroke' => '#00FF00', 'fill' => '#00FF00',                                  'stroke' => '#00FF00', 'fill' => '#00FF00',
# Line 46  sub dump_gif { Line 49  sub dump_gif {
49                                  );                                  );
50                                  $image->Draw('primitive' => 'point',                                  $image->Draw('primitive' => 'point',
51                                          'stroke' => $color,                                          'stroke' => $color,
52                                            'fill' => $color,
53                                          'antialias' => 1,                                          'antialias' => 1,
54                                          'points' => "$j,11");                                          'points' => "$j,11");
55                          }                          }
# Line 66  sub dump_gif { Line 70  sub dump_gif {
70          return "$file";          return "$file";
71  }  }
72    
73  print "Content-Type: image/gif\n\n";  #print "Content-Type: image/gif\n\n";
74  dump_gif("NOVOSTI", TYPE_LINE, "-");  #dump_gif("NOVOSTI", TYPE_LINE, "-");
75  exit $?;  #exit $?;
76    
77  my $dbh = DBI->connect("DBI:Pg:dbname=corp", "", "") ||  my $dbh = DBI->connect("DBI:Pg:dbname=plivasi", "", "") ||
78          die $DBI::errstr;          die $DBI::errstr;
79  my $sth = $dbh->prepare("SELECT section,item,url FROM menu") ||  my $sth = $dbh->prepare("SELECT section,item,url,level FROM menu") ||
80          die $dbh->errstr();          die $dbh->errstr();
81  $sth->execute() || die $sth->errstr();  $sth->execute() || die $sth->errstr();
82  while (my @arr = $sth->fetchrow_array()) {  while (my @arr = $sth->fetchrow_array()) {
83          if (0) {          $dbh->do("UPDATE menu SET file='".dump_gif($arr[1], $arr[3])."' WHERE item='$arr[1]'");
                 dump_gif($arr[1], TYPE_BULLET);  
         } else {  
                 $dbh->do("UPDATE menu SET file='".dump_gif($arr[1], TYPE_BULLET).  
                         "' WHERE item='$arr[1]'");  
         }  
84  }  }
85  $sth->finish;  $sth->finish;
86  $dbh->disconnect;  $dbh->disconnect;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26